Rename _ol_geom_Polygon_ to Polygon
This commit is contained in:
@@ -9,7 +9,7 @@ import _ol_Object_ from './Object.js';
|
||||
import _ol_Sphere_ from './Sphere.js';
|
||||
import _ol_events_ from './events.js';
|
||||
import _ol_events_EventType_ from './events/EventType.js';
|
||||
import _ol_geom_Polygon_ from './geom/Polygon.js';
|
||||
import Polygon from './geom/Polygon.js';
|
||||
import _ol_has_ from './has.js';
|
||||
import _ol_math_ from './math.js';
|
||||
import {get as getProjection, getTransformFromProjections, identityTransform} from './proj.js';
|
||||
@@ -161,7 +161,7 @@ _ol_Geolocation_.prototype.positionChange_ = function(position) {
|
||||
this.set(_ol_GeolocationProperty_.POSITION, projectedPosition);
|
||||
this.set(_ol_GeolocationProperty_.SPEED,
|
||||
coords.speed === null ? undefined : coords.speed);
|
||||
var geometry = _ol_geom_Polygon_.circular(
|
||||
var geometry = Polygon.circular(
|
||||
this.sphere_, this.position_, coords.accuracy);
|
||||
geometry.applyTransform(this.transform_);
|
||||
this.set(_ol_GeolocationProperty_.ACCURACY_GEOMETRY, geometry);
|
||||
|
||||
@@ -15,7 +15,7 @@ import _ol_coordinate_ from './coordinate.js';
|
||||
import {inAndOut} from './easing.js';
|
||||
import {getForViewAndSize, getCenter, getHeight, getWidth, isEmpty} from './extent.js';
|
||||
import _ol_geom_GeometryType_ from './geom/GeometryType.js';
|
||||
import _ol_geom_Polygon_ from './geom/Polygon.js';
|
||||
import Polygon from './geom/Polygon.js';
|
||||
import _ol_geom_SimpleGeometry_ from './geom/SimpleGeometry.js';
|
||||
import _ol_math_ from './math.js';
|
||||
import _ol_obj_ from './obj.js';
|
||||
@@ -884,10 +884,10 @@ _ol_View_.prototype.fit = function(geometryOrExtent, opt_options) {
|
||||
24); // Invalid extent or geometry provided as `geometry`
|
||||
_ol_asserts_.assert(!isEmpty(geometryOrExtent),
|
||||
25); // Cannot fit empty extent provided as `geometry`
|
||||
geometry = _ol_geom_Polygon_.fromExtent(geometryOrExtent);
|
||||
geometry = Polygon.fromExtent(geometryOrExtent);
|
||||
} else if (geometryOrExtent.getType() === _ol_geom_GeometryType_.CIRCLE) {
|
||||
geometryOrExtent = geometryOrExtent.getExtent();
|
||||
geometry = _ol_geom_Polygon_.fromExtent(geometryOrExtent);
|
||||
geometry = Polygon.fromExtent(geometryOrExtent);
|
||||
geometry.rotate(this.getRotation(), getCenter(geometryOrExtent));
|
||||
} else {
|
||||
geometry = geometryOrExtent;
|
||||
|
||||
@@ -15,7 +15,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
@@ -238,7 +238,7 @@ _ol_format_EsriJSON_.readMultiPolygonGeometry_ = function(object) {
|
||||
*/
|
||||
_ol_format_EsriJSON_.readPolygonGeometry_ = function(object) {
|
||||
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
|
||||
return new _ol_geom_Polygon_(object.rings, layout);
|
||||
return new Polygon(object.rings, layout);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import LineString from '../geom/LineString.js';
|
||||
import MultiLineString from '../geom/MultiLineString.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import {get as getProjection, transformExtent} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
@@ -244,7 +244,7 @@ _ol_format_GML3_.prototype.readSurface_ = function(node, objectStack) {
|
||||
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
var polygon = new Polygon(null);
|
||||
var flatCoordinates = flatLinearRings[0];
|
||||
var ends = [flatCoordinates.length];
|
||||
var i, ii;
|
||||
|
||||
@@ -16,7 +16,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
@@ -423,7 +423,7 @@ _ol_format_GMLBase_.prototype.readPolygon = function(node, objectStack) {
|
||||
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
var polygon = new Polygon(null);
|
||||
var flatCoordinates = flatLinearRings[0];
|
||||
var ends = [flatCoordinates.length];
|
||||
var i, ii;
|
||||
|
||||
@@ -15,7 +15,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
|
||||
@@ -159,7 +159,7 @@ _ol_format_GeoJSON_.readMultiPolygonGeometry_ = function(object) {
|
||||
* @return {ol.geom.Polygon} Polygon.
|
||||
*/
|
||||
_ol_format_GeoJSON_.readPolygonGeometry_ = function(object) {
|
||||
return new _ol_geom_Polygon_(object.coordinates);
|
||||
return new Polygon(object.coordinates);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_style_Fill_ from '../style/Fill.js';
|
||||
@@ -887,7 +887,7 @@ _ol_format_KML_.readLinearRing_ = function(node, objectStack) {
|
||||
var flatCoordinates =
|
||||
_ol_format_KML_.readFlatCoordinatesFromNode_(node, objectStack);
|
||||
if (flatCoordinates) {
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
var polygon = new Polygon(null);
|
||||
polygon.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates,
|
||||
[flatCoordinates.length]);
|
||||
polygon.setProperties(properties);
|
||||
@@ -995,7 +995,7 @@ _ol_format_KML_.readPolygon_ = function(node, objectStack) {
|
||||
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||
_ol_format_KML_.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
var polygon = new Polygon(null);
|
||||
var flatCoordinates = flatLinearRings[0];
|
||||
var ends = [flatCoordinates.length];
|
||||
var i, ii;
|
||||
|
||||
@@ -15,7 +15,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||
import _ol_proj_Projection_ from '../proj/Projection.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
@@ -307,12 +307,12 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options
|
||||
ends = endss;
|
||||
geom = new _ol_geom_MultiPolygon_(null);
|
||||
} else {
|
||||
geom = new _ol_geom_Polygon_(null);
|
||||
geom = new Polygon(null);
|
||||
}
|
||||
} else {
|
||||
geom = geometryType === _ol_geom_GeometryType_.POINT ? new Point(null) :
|
||||
geometryType === _ol_geom_GeometryType_.LINE_STRING ? new LineString(null) :
|
||||
geometryType === _ol_geom_GeometryType_.POLYGON ? new _ol_geom_Polygon_(null) :
|
||||
geometryType === _ol_geom_GeometryType_.POLYGON ? new Polygon(null) :
|
||||
geometryType === _ol_geom_GeometryType_.MULTI_POINT ? new MultiPoint (null) :
|
||||
geometryType === _ol_geom_GeometryType_.MULTI_LINE_STRING ? new MultiLineString(null) :
|
||||
null;
|
||||
|
||||
@@ -10,7 +10,7 @@ import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import LineString from '../geom/LineString.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
@@ -185,7 +185,7 @@ _ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options)
|
||||
var geometry;
|
||||
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {
|
||||
// closed way
|
||||
geometry = new _ol_geom_Polygon_(null);
|
||||
geometry = new Polygon(null);
|
||||
geometry.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates,
|
||||
[flatCoordinates.length]);
|
||||
} else {
|
||||
|
||||
@@ -10,7 +10,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
|
||||
/**
|
||||
@@ -176,7 +176,7 @@ _ol_format_TopoJSON_.readPolygonGeometry_ = function(object, arcs) {
|
||||
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
|
||||
coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs);
|
||||
}
|
||||
return new _ol_geom_Polygon_(coordinates);
|
||||
return new Polygon(coordinates);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
|
||||
/**
|
||||
@@ -920,7 +920,7 @@ _ol_format_WKT_.Parser.prototype.formatErrorMessage_ = function() {
|
||||
_ol_format_WKT_.Parser.GeometryConstructor_ = {
|
||||
'POINT': Point,
|
||||
'LINESTRING': LineString,
|
||||
'POLYGON': _ol_geom_Polygon_,
|
||||
'POLYGON': Polygon,
|
||||
'MULTIPOINT': MultiPoint,
|
||||
'MULTILINESTRING': MultiLineString,
|
||||
'MULTIPOLYGON': _ol_geom_MultiPolygon_
|
||||
|
||||
@@ -7,7 +7,7 @@ import {closestSquaredDistanceXY} from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_area_ from '../geom/flat/area.js';
|
||||
import _ol_geom_flat_center_ from '../geom/flat/center.js';
|
||||
@@ -298,7 +298,7 @@ _ol_geom_MultiPolygon_.prototype.getPolygon = function(index) {
|
||||
ends[i] -= offset;
|
||||
}
|
||||
}
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
var polygon = new Polygon(null);
|
||||
polygon.setFlatCoordinates(
|
||||
this.layout, this.flatCoordinates.slice(offset, end), ends);
|
||||
return polygon;
|
||||
@@ -325,7 +325,7 @@ _ol_geom_MultiPolygon_.prototype.getPolygons = function() {
|
||||
ends[j] -= offset;
|
||||
}
|
||||
}
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
var polygon = new Polygon(null);
|
||||
polygon.setFlatCoordinates(
|
||||
layout, flatCoordinates.slice(offset, end), ends);
|
||||
polygons.push(polygon);
|
||||
|
||||
@@ -35,7 +35,7 @@ import _ol_math_ from '../math.js';
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
var _ol_geom_Polygon_ = function(coordinates, opt_layout) {
|
||||
var Polygon = function(coordinates, opt_layout) {
|
||||
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
|
||||
@@ -85,7 +85,7 @@ var _ol_geom_Polygon_ = function(coordinates, opt_layout) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_geom_Polygon_, _ol_geom_SimpleGeometry_);
|
||||
inherits(Polygon, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ inherits(_ol_geom_Polygon_, _ol_geom_SimpleGeometry_);
|
||||
* @param {ol.geom.LinearRing} linearRing Linear ring.
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.appendLinearRing = function(linearRing) {
|
||||
Polygon.prototype.appendLinearRing = function(linearRing) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
|
||||
} else {
|
||||
@@ -110,8 +110,8 @@ _ol_geom_Polygon_.prototype.appendLinearRing = function(linearRing) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.clone = function() {
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
Polygon.prototype.clone = function() {
|
||||
var polygon = new Polygon(null);
|
||||
polygon.setFlatCoordinates(
|
||||
this.layout, this.flatCoordinates.slice(), this.ends_.slice());
|
||||
return polygon;
|
||||
@@ -121,7 +121,7 @@ _ol_geom_Polygon_.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
Polygon.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ _ol_geom_Polygon_.prototype.closestPointXY = function(x, y, closestPoint, minSqu
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.containsXY = function(x, y) {
|
||||
Polygon.prototype.containsXY = function(x, y) {
|
||||
return _ol_geom_flat_contains_.linearRingsContainsXY(
|
||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y);
|
||||
};
|
||||
@@ -150,7 +150,7 @@ _ol_geom_Polygon_.prototype.containsXY = function(x, y) {
|
||||
* @return {number} Area (on projected plane).
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getArea = function() {
|
||||
Polygon.prototype.getArea = function() {
|
||||
return _ol_geom_flat_area_.linearRings(
|
||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride);
|
||||
};
|
||||
@@ -170,7 +170,7 @@ _ol_geom_Polygon_.prototype.getArea = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getCoordinates = function(opt_right) {
|
||||
Polygon.prototype.getCoordinates = function(opt_right) {
|
||||
var flatCoordinates;
|
||||
if (opt_right !== undefined) {
|
||||
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
||||
@@ -188,7 +188,7 @@ _ol_geom_Polygon_.prototype.getCoordinates = function(opt_right) {
|
||||
/**
|
||||
* @return {Array.<number>} Ends.
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getEnds = function() {
|
||||
Polygon.prototype.getEnds = function() {
|
||||
return this.ends_;
|
||||
};
|
||||
|
||||
@@ -196,7 +196,7 @@ _ol_geom_Polygon_.prototype.getEnds = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Interior point.
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getFlatInteriorPoint = function() {
|
||||
Polygon.prototype.getFlatInteriorPoint = function() {
|
||||
if (this.flatInteriorPointRevision_ != this.getRevision()) {
|
||||
var flatCenter = getCenter(this.getExtent());
|
||||
this.flatInteriorPoint_ = _ol_geom_flat_interiorpoint_.linearRings(
|
||||
@@ -214,7 +214,7 @@ _ol_geom_Polygon_.prototype.getFlatInteriorPoint = function() {
|
||||
* length of the horizontal intersection that the point belongs to.
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getInteriorPoint = function() {
|
||||
Polygon.prototype.getInteriorPoint = function() {
|
||||
return new Point(this.getFlatInteriorPoint(), _ol_geom_GeometryLayout_.XYM);
|
||||
};
|
||||
|
||||
@@ -226,7 +226,7 @@ _ol_geom_Polygon_.prototype.getInteriorPoint = function() {
|
||||
* @return {number} Number of rings.
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getLinearRingCount = function() {
|
||||
Polygon.prototype.getLinearRingCount = function() {
|
||||
return this.ends_.length;
|
||||
};
|
||||
|
||||
@@ -241,7 +241,7 @@ _ol_geom_Polygon_.prototype.getLinearRingCount = function() {
|
||||
* @return {ol.geom.LinearRing} Linear ring.
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getLinearRing = function(index) {
|
||||
Polygon.prototype.getLinearRing = function(index) {
|
||||
if (index < 0 || this.ends_.length <= index) {
|
||||
return null;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ _ol_geom_Polygon_.prototype.getLinearRing = function(index) {
|
||||
* @return {Array.<ol.geom.LinearRing>} Linear rings.
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getLinearRings = function() {
|
||||
Polygon.prototype.getLinearRings = function() {
|
||||
var layout = this.layout;
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var ends = this.ends_;
|
||||
@@ -278,7 +278,7 @@ _ol_geom_Polygon_.prototype.getLinearRings = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Oriented flat coordinates.
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getOrientedFlatCoordinates = function() {
|
||||
Polygon.prototype.getOrientedFlatCoordinates = function() {
|
||||
if (this.orientedRevision_ != this.getRevision()) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
if (_ol_geom_flat_orient_.linearRingsAreOriented(
|
||||
@@ -299,14 +299,14 @@ _ol_geom_Polygon_.prototype.getOrientedFlatCoordinates = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
Polygon.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
var simplifiedFlatCoordinates = [];
|
||||
var simplifiedEnds = [];
|
||||
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.quantizes(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride,
|
||||
Math.sqrt(squaredTolerance),
|
||||
simplifiedFlatCoordinates, 0, simplifiedEnds);
|
||||
var simplifiedPolygon = new _ol_geom_Polygon_(null);
|
||||
var simplifiedPolygon = new Polygon(null);
|
||||
simplifiedPolygon.setFlatCoordinates(
|
||||
_ol_geom_GeometryLayout_.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
||||
return simplifiedPolygon;
|
||||
@@ -317,7 +317,7 @@ _ol_geom_Polygon_.prototype.getSimplifiedGeometryInternal = function(squaredTole
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.getType = function() {
|
||||
Polygon.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.POLYGON;
|
||||
};
|
||||
|
||||
@@ -326,7 +326,7 @@ _ol_geom_Polygon_.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.intersectsExtent = function(extent) {
|
||||
Polygon.prototype.intersectsExtent = function(extent) {
|
||||
return _ol_geom_flat_intersectsextent_.linearRings(
|
||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent);
|
||||
};
|
||||
@@ -339,7 +339,7 @@ _ol_geom_Polygon_.prototype.intersectsExtent = function(extent) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null, this.ends_);
|
||||
} else {
|
||||
@@ -360,7 +360,7 @@ _ol_geom_Polygon_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array.<number>} ends Ends.
|
||||
*/
|
||||
_ol_geom_Polygon_.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) {
|
||||
Polygon.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.ends_ = ends;
|
||||
this.changed();
|
||||
@@ -378,7 +378,7 @@ _ol_geom_Polygon_.prototype.setFlatCoordinates = function(layout, flatCoordinate
|
||||
* @return {ol.geom.Polygon} The "circular" polygon.
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.circular = function(sphere, center, radius, opt_n) {
|
||||
Polygon.circular = function(sphere, center, radius, opt_n) {
|
||||
var n = opt_n ? opt_n : 32;
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = [];
|
||||
@@ -388,7 +388,7 @@ _ol_geom_Polygon_.circular = function(sphere, center, radius, opt_n) {
|
||||
flatCoordinates, sphere.offset(center, radius, 2 * Math.PI * i / n));
|
||||
}
|
||||
flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
var polygon = new Polygon(null);
|
||||
polygon.setFlatCoordinates(
|
||||
_ol_geom_GeometryLayout_.XY, flatCoordinates, [flatCoordinates.length]);
|
||||
return polygon;
|
||||
@@ -401,14 +401,14 @@ _ol_geom_Polygon_.circular = function(sphere, center, radius, opt_n) {
|
||||
* @return {ol.geom.Polygon} The polygon.
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.fromExtent = function(extent) {
|
||||
Polygon.fromExtent = function(extent) {
|
||||
var minX = extent[0];
|
||||
var minY = extent[1];
|
||||
var maxX = extent[2];
|
||||
var maxY = extent[3];
|
||||
var flatCoordinates =
|
||||
[minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY];
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
var polygon = new Polygon(null);
|
||||
polygon.setFlatCoordinates(
|
||||
_ol_geom_GeometryLayout_.XY, flatCoordinates, [flatCoordinates.length]);
|
||||
return polygon;
|
||||
@@ -424,11 +424,11 @@ _ol_geom_Polygon_.fromExtent = function(extent) {
|
||||
* @return {ol.geom.Polygon} Polygon geometry.
|
||||
* @api
|
||||
*/
|
||||
_ol_geom_Polygon_.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||
Polygon.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||
var sides = opt_sides ? opt_sides : 32;
|
||||
var stride = circle.getStride();
|
||||
var layout = circle.getLayout();
|
||||
var polygon = new _ol_geom_Polygon_(null, layout);
|
||||
var polygon = new Polygon(null, layout);
|
||||
var arrayLength = stride * (sides + 1);
|
||||
var flatCoordinates = new Array(arrayLength);
|
||||
for (var i = 0; i < arrayLength; i++) {
|
||||
@@ -436,7 +436,7 @@ _ol_geom_Polygon_.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||
}
|
||||
var ends = [flatCoordinates.length];
|
||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
_ol_geom_Polygon_.makeRegular(
|
||||
Polygon.makeRegular(
|
||||
polygon, circle.getCenter(), circle.getRadius(), opt_angle);
|
||||
return polygon;
|
||||
};
|
||||
@@ -450,7 +450,7 @@ _ol_geom_Polygon_.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||
* @param {number=} opt_angle Start angle for the first vertex of the polygon in
|
||||
* radians. Default is 0.
|
||||
*/
|
||||
_ol_geom_Polygon_.makeRegular = function(polygon, center, radius, opt_angle) {
|
||||
Polygon.makeRegular = function(polygon, center, radius, opt_angle) {
|
||||
var flatCoordinates = polygon.getFlatCoordinates();
|
||||
var layout = polygon.getLayout();
|
||||
var stride = polygon.getStride();
|
||||
@@ -466,4 +466,4 @@ _ol_geom_Polygon_.makeRegular = function(polygon, center, radius, opt_angle) {
|
||||
}
|
||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
};
|
||||
export default _ol_geom_Polygon_;
|
||||
export default Polygon;
|
||||
|
||||
@@ -18,7 +18,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
||||
import MultiPoint from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_interaction_DrawEventType_ from '../interaction/DrawEventType.js';
|
||||
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||
import _ol_interaction_Property_ from '../interaction/Property.js';
|
||||
@@ -156,7 +156,7 @@ var _ol_interaction_Draw_ = function(options) {
|
||||
} else if (mode === _ol_interaction_Draw_.Mode_.LINE_STRING) {
|
||||
Constructor = LineString;
|
||||
} else if (mode === _ol_interaction_Draw_.Mode_.POLYGON) {
|
||||
Constructor = _ol_geom_Polygon_;
|
||||
Constructor = Polygon;
|
||||
}
|
||||
/**
|
||||
* @param {!Array.<ol.Coordinate>} coordinates
|
||||
@@ -555,7 +555,7 @@ _ol_interaction_Draw_.prototype.modifyDrawing_ = function(event) {
|
||||
sketchPointGeom.setCoordinates(coordinate);
|
||||
}
|
||||
var sketchLineGeom;
|
||||
if (geometry instanceof _ol_geom_Polygon_ &&
|
||||
if (geometry instanceof Polygon &&
|
||||
this.mode_ !== _ol_interaction_Draw_.Mode_.POLYGON) {
|
||||
if (!this.sketchLine_) {
|
||||
this.sketchLine_ = new _ol_Feature_(new LineString(null));
|
||||
@@ -798,10 +798,10 @@ _ol_interaction_Draw_.createRegularPolygon = function(opt_sides, opt_angle) {
|
||||
var radius = Math.sqrt(
|
||||
_ol_coordinate_.squaredDistance(center, end));
|
||||
var geometry = opt_geometry ? /** @type {ol.geom.Polygon} */ (opt_geometry) :
|
||||
_ol_geom_Polygon_.fromCircle(new _ol_geom_Circle_(center), opt_sides);
|
||||
Polygon.fromCircle(new _ol_geom_Circle_(center), opt_sides);
|
||||
var angle = opt_angle ? opt_angle :
|
||||
Math.atan((end[1] - center[1]) / (end[0] - center[0]));
|
||||
_ol_geom_Polygon_.makeRegular(geometry, center, radius, angle);
|
||||
Polygon.makeRegular(geometry, center, radius, angle);
|
||||
return geometry;
|
||||
}
|
||||
);
|
||||
@@ -824,7 +824,7 @@ _ol_interaction_Draw_.createBox = function() {
|
||||
*/
|
||||
function(coordinates, opt_geometry) {
|
||||
var extent = boundingExtent(coordinates);
|
||||
var geometry = opt_geometry || new _ol_geom_Polygon_(null);
|
||||
var geometry = opt_geometry || new Polygon(null);
|
||||
geometry.setCoordinates([[
|
||||
getBottomLeft(extent),
|
||||
getBottomRight(extent),
|
||||
|
||||
@@ -10,7 +10,7 @@ import _ol_events_Event_ from '../events/Event.js';
|
||||
import {boundingExtent, getArea} from '../extent.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_interaction_ExtentEventType_ from '../interaction/ExtentEventType.js';
|
||||
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||
import _ol_layer_Vector_ from '../layer/Vector.js';
|
||||
@@ -376,7 +376,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent
|
||||
if (!extent) {
|
||||
extentFeature = new _ol_Feature_({});
|
||||
} else {
|
||||
extentFeature = new _ol_Feature_(_ol_geom_Polygon_.fromExtent(extent));
|
||||
extentFeature = new _ol_Feature_(Polygon.fromExtent(extent));
|
||||
}
|
||||
this.extentFeature_ = extentFeature;
|
||||
this.extentOverlay_.getSource().addFeature(extentFeature);
|
||||
@@ -384,7 +384,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent
|
||||
if (!extent) {
|
||||
extentFeature.setGeometry(undefined);
|
||||
} else {
|
||||
extentFeature.setGeometry(_ol_geom_Polygon_.fromExtent(extent));
|
||||
extentFeature.setGeometry(Polygon.fromExtent(extent));
|
||||
}
|
||||
}
|
||||
return extentFeature;
|
||||
|
||||
@@ -10,7 +10,7 @@ import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import {boundingExtent, createEmpty} from '../extent.js';
|
||||
import _ol_functions_ from '../functions.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_source_Vector_ from '../source/Vector.js';
|
||||
@@ -435,7 +435,7 @@ _ol_interaction_Snap_.prototype.updateFeature_ = function(feature) {
|
||||
* @private
|
||||
*/
|
||||
_ol_interaction_Snap_.prototype.writeCircleGeometry_ = function(feature, geometry) {
|
||||
var polygon = _ol_geom_Polygon_.fromCircle(geometry);
|
||||
var polygon = Polygon.fromCircle(geometry);
|
||||
var coordinates = polygon.getCoordinates()[0];
|
||||
var i, ii, segment, segmentData;
|
||||
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Disposable_ from '../Disposable.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -118,7 +118,7 @@ _ol_render_Box_.prototype.createOrUpdateGeometry = function() {
|
||||
// close the polygon
|
||||
coordinates[4] = coordinates[0].slice();
|
||||
if (!this.geometry_) {
|
||||
this.geometry_ = new _ol_geom_Polygon_([coordinates]);
|
||||
this.geometry_ = new Polygon([coordinates]);
|
||||
} else {
|
||||
this.geometry_.setCoordinates([coordinates]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user