Rename misnamed functions in geom/flat/orient

- Rename linearRingIsOriented => linearRingsAreOriented
  The function checks all linear rings of a Polygon, so
  the plural "rings" is more appropriate
- Rename linearRingsAreOriented => linearRingssAreOriented
  The double s is appropriate because the check is done for
  all Polygons of a MultiPolygon

This commit restores the function names from OpenLayers v4,
they were changed (wrongly IMHO) in #7820.
This commit is contained in:
Roman Zoller
2019-02-05 17:35:29 +01:00
parent c4be22b1b6
commit 2c859b1196
4 changed files with 13 additions and 13 deletions

View File

@@ -16,7 +16,7 @@ import {deflateMultiCoordinatesArray} from './flat/deflate.js';
import {inflateMultiCoordinatesArray} from './flat/inflate.js'; import {inflateMultiCoordinatesArray} from './flat/inflate.js';
import {getInteriorPointsOfMultiArray} from './flat/interiorpoint.js'; import {getInteriorPointsOfMultiArray} from './flat/interiorpoint.js';
import {intersectsLinearRingMultiArray} from './flat/intersectsextent.js'; import {intersectsLinearRingMultiArray} from './flat/intersectsextent.js';
import {linearRingsAreOriented, orientLinearRingsArray} from './flat/orient.js'; import {linearRingssAreOriented, orientLinearRingsArray} from './flat/orient.js';
import {quantizeMultiArray} from './flat/simplify.js'; import {quantizeMultiArray} from './flat/simplify.js';
/** /**
@@ -251,7 +251,7 @@ class MultiPolygon extends SimpleGeometry {
getOrientedFlatCoordinates() { getOrientedFlatCoordinates() {
if (this.orientedRevision_ != this.getRevision()) { if (this.orientedRevision_ != this.getRevision()) {
const flatCoordinates = this.flatCoordinates; const flatCoordinates = this.flatCoordinates;
if (linearRingsAreOriented( if (linearRingssAreOriented(
flatCoordinates, 0, this.endss_, this.stride)) { flatCoordinates, 0, this.endss_, this.stride)) {
this.orientedFlatCoordinates_ = flatCoordinates; this.orientedFlatCoordinates_ = flatCoordinates;
} else { } else {

View File

@@ -16,7 +16,7 @@ import {deflateCoordinatesArray} from './flat/deflate.js';
import {inflateCoordinatesArray} from './flat/inflate.js'; import {inflateCoordinatesArray} from './flat/inflate.js';
import {getInteriorPointOfArray} from './flat/interiorpoint.js'; import {getInteriorPointOfArray} from './flat/interiorpoint.js';
import {intersectsLinearRingArray} from './flat/intersectsextent.js'; import {intersectsLinearRingArray} from './flat/intersectsextent.js';
import {linearRingIsOriented, orientLinearRings} from './flat/orient.js'; import {linearRingsAreOriented, orientLinearRings} from './flat/orient.js';
import {quantizeArray} from './flat/simplify.js'; import {quantizeArray} from './flat/simplify.js';
import {modulo} from '../math.js'; import {modulo} from '../math.js';
@@ -266,7 +266,7 @@ class Polygon extends SimpleGeometry {
getOrientedFlatCoordinates() { getOrientedFlatCoordinates() {
if (this.orientedRevision_ != this.getRevision()) { if (this.orientedRevision_ != this.getRevision()) {
const flatCoordinates = this.flatCoordinates; const flatCoordinates = this.flatCoordinates;
if (linearRingIsOriented( if (linearRingsAreOriented(
flatCoordinates, 0, this.ends_, this.stride)) { flatCoordinates, 0, this.ends_, this.stride)) {
this.orientedFlatCoordinates_ = flatCoordinates; this.orientedFlatCoordinates_ = flatCoordinates;
} else { } else {

View File

@@ -41,7 +41,7 @@ export function linearRingIsClockwise(flatCoordinates, offset, end, stride) {
* (counter-clockwise exterior ring and clockwise interior rings). * (counter-clockwise exterior ring and clockwise interior rings).
* @return {boolean} Rings are correctly oriented. * @return {boolean} Rings are correctly oriented.
*/ */
export function linearRingIsOriented(flatCoordinates, offset, ends, stride, opt_right) { export function linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right) {
const right = opt_right !== undefined ? opt_right : false; const right = opt_right !== undefined ? opt_right : false;
for (let i = 0, ii = ends.length; i < ii; ++i) { for (let i = 0, ii = ends.length; i < ii; ++i) {
const end = ends[i]; const end = ends[i];
@@ -75,9 +75,9 @@ export function linearRingIsOriented(flatCoordinates, offset, ends, stride, opt_
* (counter-clockwise exterior ring and clockwise interior rings). * (counter-clockwise exterior ring and clockwise interior rings).
* @return {boolean} Rings are correctly oriented. * @return {boolean} Rings are correctly oriented.
*/ */
export function linearRingsAreOriented(flatCoordinates, offset, endss, stride, opt_right) { export function linearRingssAreOriented(flatCoordinates, offset, endss, stride, opt_right) {
for (let i = 0, ii = endss.length; i < ii; ++i) { for (let i = 0, ii = endss.length; i < ii; ++i) {
if (!linearRingIsOriented( if (!linearRingsAreOriented(
flatCoordinates, offset, endss[i], stride, opt_right)) { flatCoordinates, offset, endss[i], stride, opt_right)) {
return false; return false;
} }

View File

@@ -1,5 +1,5 @@
import {linearRingIsClockwise, linearRingIsOriented, import {linearRingIsClockwise, linearRingsAreOriented,
linearRingsAreOriented, orientLinearRings, orientLinearRingsArray} from '../../../../../src/ol/geom/flat/orient.js'; linearRingssAreOriented, orientLinearRings, orientLinearRingsArray} from '../../../../../src/ol/geom/flat/orient.js';
describe('ol.geom.flat.orient', function() { describe('ol.geom.flat.orient', function() {
@@ -22,8 +22,8 @@ describe('ol.geom.flat.orient', function() {
}); });
describe('ol.geom.flat.orient.linearRingIsOriented', function() { describe('ol.geom.flat.orient.linearRingsAreOriented', function() {
const oriented = linearRingIsOriented; const oriented = linearRingsAreOriented;
const rightCoords = [ const rightCoords = [
-180, -90, 180, -90, 180, 90, -180, 90, -180, -90, -180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
@@ -49,8 +49,8 @@ describe('ol.geom.flat.orient', function() {
}); });
describe('ol.geom.flat.orient.linearRingsAreOriented', function() { describe('ol.geom.flat.orient.linearRingssAreOriented', function() {
const oriented = linearRingsAreOriented; const oriented = linearRingssAreOriented;
const rightCoords = [ const rightCoords = [
-180, -90, 180, -90, 180, 90, -180, 90, -180, -90, -180, -90, 180, -90, 180, 90, -180, 90, -180, -90,