Rename _ol_geom_LinearRing_ to LinearRing
This commit is contained in:
@@ -10,7 +10,7 @@ import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
|
||||
import GeometryLayout from '../geom/GeometryLayout.js';
|
||||
import GeometryType from '../geom/GeometryType.js';
|
||||
import LineString from '../geom/LineString.js';
|
||||
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
|
||||
import LinearRing from '../geom/LinearRing.js';
|
||||
import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import MultiPolygon from '../geom/MultiPolygon.js';
|
||||
@@ -124,8 +124,8 @@ _ol_format_EsriJSON_.convertRings_ = function(rings, layout) {
|
||||
for (i = outerRings.length - 1; i >= 0; i--) {
|
||||
var outerRing = outerRings[i][0];
|
||||
var containsHole = containsExtent(
|
||||
new _ol_geom_LinearRing_(outerRing).getExtent(),
|
||||
new _ol_geom_LinearRing_(hole).getExtent()
|
||||
new LinearRing(outerRing).getExtent(),
|
||||
new LinearRing(hole).getExtent()
|
||||
);
|
||||
if (containsHole) {
|
||||
// the hole is contained push it into our polygon
|
||||
|
||||
@@ -11,7 +11,7 @@ import _ol_format_Feature_ from '../format/Feature.js';
|
||||
import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
|
||||
import GeometryLayout from '../geom/GeometryLayout.js';
|
||||
import LineString from '../geom/LineString.js';
|
||||
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
|
||||
import LinearRing from '../geom/LinearRing.js';
|
||||
import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import MultiPolygon from '../geom/MultiPolygon.js';
|
||||
@@ -404,7 +404,7 @@ _ol_format_GMLBase_.prototype.readLinearRing = function(node, objectStack) {
|
||||
var flatCoordinates =
|
||||
this.readFlatCoordinatesFromNode_(node, objectStack);
|
||||
if (flatCoordinates) {
|
||||
var ring = new _ol_geom_LinearRing_(null);
|
||||
var ring = new LinearRing(null);
|
||||
ring.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
|
||||
return ring;
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ import _ol_geom_flat_simplify_ from '../geom/flat/simplify.js';
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
var _ol_geom_LinearRing_ = function(coordinates, opt_layout) {
|
||||
var LinearRing = function(coordinates, opt_layout) {
|
||||
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
|
||||
@@ -43,7 +43,7 @@ var _ol_geom_LinearRing_ = function(coordinates, opt_layout) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_geom_LinearRing_, _ol_geom_SimpleGeometry_);
|
||||
inherits(LinearRing, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,8 +52,8 @@ inherits(_ol_geom_LinearRing_, _ol_geom_SimpleGeometry_);
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.clone = function() {
|
||||
var linearRing = new _ol_geom_LinearRing_(null);
|
||||
LinearRing.prototype.clone = function() {
|
||||
var linearRing = new LinearRing(null);
|
||||
linearRing.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
|
||||
return linearRing;
|
||||
};
|
||||
@@ -62,7 +62,7 @@ _ol_geom_LinearRing_.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
LinearRing.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ _ol_geom_LinearRing_.prototype.closestPointXY = function(x, y, closestPoint, min
|
||||
* @return {number} Area (on projected plane).
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.getArea = function() {
|
||||
LinearRing.prototype.getArea = function() {
|
||||
return _ol_geom_flat_area_.linearRing(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
|
||||
};
|
||||
@@ -94,7 +94,7 @@ _ol_geom_LinearRing_.prototype.getArea = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.getCoordinates = function() {
|
||||
LinearRing.prototype.getCoordinates = function() {
|
||||
return _ol_geom_flat_inflate_.coordinates(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
|
||||
};
|
||||
@@ -103,12 +103,12 @@ _ol_geom_LinearRing_.prototype.getCoordinates = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
LinearRing.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
var simplifiedFlatCoordinates = [];
|
||||
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.douglasPeucker(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
|
||||
squaredTolerance, simplifiedFlatCoordinates, 0);
|
||||
var simplifiedLinearRing = new _ol_geom_LinearRing_(null);
|
||||
var simplifiedLinearRing = new LinearRing(null);
|
||||
simplifiedLinearRing.setFlatCoordinates(
|
||||
GeometryLayout.XY, simplifiedFlatCoordinates);
|
||||
return simplifiedLinearRing;
|
||||
@@ -119,7 +119,7 @@ _ol_geom_LinearRing_.prototype.getSimplifiedGeometryInternal = function(squaredT
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.getType = function() {
|
||||
LinearRing.prototype.getType = function() {
|
||||
return GeometryType.LINEAR_RING;
|
||||
};
|
||||
|
||||
@@ -127,7 +127,7 @@ _ol_geom_LinearRing_.prototype.getType = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.intersectsExtent = function(extent) {};
|
||||
LinearRing.prototype.intersectsExtent = function(extent) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ _ol_geom_LinearRing_.prototype.intersectsExtent = function(extent) {};
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
LinearRing.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(GeometryLayout.XY, null);
|
||||
} else {
|
||||
@@ -156,8 +156,8 @@ _ol_geom_LinearRing_.prototype.setCoordinates = function(coordinates, opt_layout
|
||||
* @param {ol.geom.GeometryLayout} layout Layout.
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
*/
|
||||
_ol_geom_LinearRing_.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
LinearRing.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.changed();
|
||||
};
|
||||
export default _ol_geom_LinearRing_;
|
||||
export default LinearRing;
|
||||
|
||||
@@ -6,7 +6,7 @@ import _ol_array_ from '../array.js';
|
||||
import {closestSquaredDistanceXY, getCenter} from '../extent.js';
|
||||
import GeometryLayout from '../geom/GeometryLayout.js';
|
||||
import GeometryType from '../geom/GeometryType.js';
|
||||
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
|
||||
import LinearRing from '../geom/LinearRing.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_area_ from '../geom/flat/area.js';
|
||||
@@ -245,7 +245,7 @@ Polygon.prototype.getLinearRing = function(index) {
|
||||
if (index < 0 || this.ends_.length <= index) {
|
||||
return null;
|
||||
}
|
||||
var linearRing = new _ol_geom_LinearRing_(null);
|
||||
var linearRing = new LinearRing(null);
|
||||
linearRing.setFlatCoordinates(this.layout, this.flatCoordinates.slice(
|
||||
index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]));
|
||||
return linearRing;
|
||||
@@ -266,7 +266,7 @@ Polygon.prototype.getLinearRings = function() {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
var linearRing = new _ol_geom_LinearRing_(null);
|
||||
var linearRing = new LinearRing(null);
|
||||
linearRing.setFlatCoordinates(layout, flatCoordinates.slice(offset, end));
|
||||
linearRings.push(linearRing);
|
||||
offset = end;
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import _ol_format_EsriJSON_ from '../../../../src/ol/format/EsriJSON.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||
import LinearRing from '../../../../src/ol/geom/LinearRing.js';
|
||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
@@ -563,9 +563,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0].getCoordinates()[0].length).to.equal(2);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[0]).to.be.a(LinearRing);
|
||||
expect(rings[1]).to.be.a(LinearRing);
|
||||
expect(rings[2]).to.be.a(LinearRing);
|
||||
});
|
||||
|
||||
it('parses XYZ polygon', function() {
|
||||
@@ -582,9 +582,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0].getCoordinates()[0].length).to.equal(3);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[0]).to.be.a(LinearRing);
|
||||
expect(rings[1]).to.be.a(LinearRing);
|
||||
expect(rings[2]).to.be.a(LinearRing);
|
||||
});
|
||||
|
||||
it('parses XYM polygon', function() {
|
||||
@@ -601,9 +601,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0].getCoordinates()[0].length).to.equal(3);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[0]).to.be.a(LinearRing);
|
||||
expect(rings[1]).to.be.a(LinearRing);
|
||||
expect(rings[2]).to.be.a(LinearRing);
|
||||
});
|
||||
|
||||
it('parses XYZM polygon', function() {
|
||||
@@ -630,9 +630,9 @@ describe('ol.format.EsriJSON', function() {
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0].getCoordinates()[0].length).to.equal(4);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[0]).to.be.a(LinearRing);
|
||||
expect(rings[1]).to.be.a(LinearRing);
|
||||
expect(rings[2]).to.be.a(LinearRing);
|
||||
});
|
||||
|
||||
it('parses XY multipolygon', function() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js';
|
||||
import Circle from '../../../../src/ol/geom/Circle.js';
|
||||
import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||
import LinearRing from '../../../../src/ol/geom/LinearRing.js';
|
||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
@@ -399,9 +399,9 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
var rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[1]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[2]).to.be.a(_ol_geom_LinearRing_);
|
||||
expect(rings[0]).to.be.a(LinearRing);
|
||||
expect(rings[1]).to.be.a(LinearRing);
|
||||
expect(rings[2]).to.be.a(LinearRing);
|
||||
});
|
||||
|
||||
it('parses geometry collection', function() {
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_format_GML_ from '../../../../src/ol/format/GML.js';
|
||||
import _ol_format_GML2_ from '../../../../src/ol/format/GML2.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||
import LinearRing from '../../../../src/ol/geom/LinearRing.js';
|
||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
@@ -578,7 +578,7 @@ describe('ol.format.GML3', function() {
|
||||
' <gml:posList srsDimension="2">1 2 3 4 5 6 1 2</gml:posList>' +
|
||||
'</gml:LinearRing>';
|
||||
var g = readGeometry(format, text);
|
||||
expect(g).to.be.an(_ol_geom_LinearRing_);
|
||||
expect(g).to.be.an(LinearRing);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[1, 2, 0], [3, 4, 0], [5, 6, 0], [1, 2, 0]]);
|
||||
var serialized = format.writeGeometryNode(g);
|
||||
|
||||
@@ -4,7 +4,7 @@ import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js';
|
||||
import _ol_format_KML_ from '../../../../src/ol/format/KML.js';
|
||||
import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||
import LinearRing from '../../../../src/ol/geom/LinearRing.js';
|
||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
@@ -559,7 +559,7 @@ describe('ol.format.KML', function() {
|
||||
|
||||
it('can write XY LinearRing geometries', function() {
|
||||
var layout = 'XY';
|
||||
var linearRing = new _ol_geom_LinearRing_(
|
||||
var linearRing = new LinearRing(
|
||||
[[1, 2], [3, 4], [1, 2]], layout);
|
||||
var features = [new _ol_Feature_(linearRing)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
@@ -580,7 +580,7 @@ describe('ol.format.KML', function() {
|
||||
|
||||
it('can write XYZ LinearRing geometries', function() {
|
||||
var layout = 'XYZ';
|
||||
var linearRing = new _ol_geom_LinearRing_(
|
||||
var linearRing = new LinearRing(
|
||||
[[1, 2, 3], [4, 5, 6], [1, 2, 3]], layout);
|
||||
var features = [new _ol_Feature_(linearRing)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
@@ -601,7 +601,7 @@ describe('ol.format.KML', function() {
|
||||
|
||||
it('can write XYM LinearRing geometries', function() {
|
||||
var layout = 'XYM';
|
||||
var linearRing = new _ol_geom_LinearRing_(
|
||||
var linearRing = new LinearRing(
|
||||
[[1, 2, 100], [3, 4, 200], [1, 2, 100]], layout);
|
||||
var features = [new _ol_Feature_(linearRing)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
@@ -622,7 +622,7 @@ describe('ol.format.KML', function() {
|
||||
|
||||
it('can write XYZM LinearRing geometries', function() {
|
||||
var layout = 'XYZM';
|
||||
var linearRing = new _ol_geom_LinearRing_(
|
||||
var linearRing = new LinearRing(
|
||||
[[1, 2, 3, 100], [4, 5, 6, 200], [1, 2, 3, 100]], layout);
|
||||
var features = [new _ol_Feature_(linearRing)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import Circle from '../../../../src/ol/geom/Circle.js';
|
||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||
import LinearRing from '../../../../src/ol/geom/LinearRing.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ describe('ol.geom.Polygon', function() {
|
||||
|
||||
it('can append linear rings', function() {
|
||||
polygon.appendLinearRing(
|
||||
new _ol_geom_LinearRing_([[1, 2], [3, 4], [5, 6]]));
|
||||
new LinearRing([[1, 2], [3, 4], [5, 6]]));
|
||||
expect(polygon.getCoordinates()).to.eql(
|
||||
[[[1, 2], [3, 4], [5, 6]]]);
|
||||
polygon.appendLinearRing(
|
||||
new _ol_geom_LinearRing_([[7, 8], [9, 10], [11, 12]]));
|
||||
new LinearRing([[7, 8], [9, 10], [11, 12]]));
|
||||
expect(polygon.getCoordinates()).to.eql(
|
||||
[[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]]);
|
||||
});
|
||||
@@ -95,9 +95,9 @@ describe('ol.geom.Polygon', function() {
|
||||
var linearRings = polygon.getLinearRings();
|
||||
expect(linearRings).to.be.an(Array);
|
||||
expect(linearRings).to.have.length(2);
|
||||
expect(linearRings[0]).to.be.an(_ol_geom_LinearRing_);
|
||||
expect(linearRings[0]).to.be.an(LinearRing);
|
||||
expect(linearRings[0].getCoordinates()).to.eql(outerRing);
|
||||
expect(linearRings[1]).to.be.an(_ol_geom_LinearRing_);
|
||||
expect(linearRings[1]).to.be.an(LinearRing);
|
||||
expect(linearRings[1].getCoordinates()).to.eql(innerRing);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user