Transformed
This commit is contained in:
+37
-35
@@ -1,12 +1,12 @@
|
||||
goog.provide('ol.geom.Circle');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
|
||||
/**
|
||||
* @module ol/geom/Circle
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -19,12 +19,13 @@ goog.require('ol.geom.flat.deflate');
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle = function(center, opt_radius, opt_layout) {
|
||||
ol.geom.SimpleGeometry.call(this);
|
||||
var _ol_geom_Circle_ = function(center, opt_radius, opt_layout) {
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
var radius = opt_radius ? opt_radius : 0;
|
||||
this.setCenterAndRadius(center, radius, opt_layout);
|
||||
};
|
||||
ol.inherits(ol.geom.Circle, ol.geom.SimpleGeometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_Circle_, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -33,8 +34,8 @@ ol.inherits(ol.geom.Circle, ol.geom.SimpleGeometry);
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.clone = function() {
|
||||
var circle = new ol.geom.Circle(null);
|
||||
_ol_geom_Circle_.prototype.clone = function() {
|
||||
var circle = new _ol_geom_Circle_(null);
|
||||
circle.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
|
||||
return circle;
|
||||
};
|
||||
@@ -43,7 +44,7 @@ ol.geom.Circle.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Circle.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_Circle_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var dx = x - flatCoordinates[0];
|
||||
var dy = y - flatCoordinates[1];
|
||||
@@ -73,7 +74,7 @@ ol.geom.Circle.prototype.closestPointXY = function(x, y, closestPoint, minSquare
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Circle.prototype.containsXY = function(x, y) {
|
||||
_ol_geom_Circle_.prototype.containsXY = function(x, y) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var dx = x - flatCoordinates[0];
|
||||
var dy = y - flatCoordinates[1];
|
||||
@@ -86,7 +87,7 @@ ol.geom.Circle.prototype.containsXY = function(x, y) {
|
||||
* @return {ol.Coordinate} Center.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.getCenter = function() {
|
||||
_ol_geom_Circle_.prototype.getCenter = function() {
|
||||
return this.flatCoordinates.slice(0, this.stride);
|
||||
};
|
||||
|
||||
@@ -94,10 +95,10 @@ ol.geom.Circle.prototype.getCenter = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Circle.prototype.computeExtent = function(extent) {
|
||||
_ol_geom_Circle_.prototype.computeExtent = function(extent) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var radius = flatCoordinates[this.stride] - flatCoordinates[0];
|
||||
return ol.extent.createOrUpdate(
|
||||
return _ol_extent_.createOrUpdate(
|
||||
flatCoordinates[0] - radius, flatCoordinates[1] - radius,
|
||||
flatCoordinates[0] + radius, flatCoordinates[1] + radius,
|
||||
extent);
|
||||
@@ -109,7 +110,7 @@ ol.geom.Circle.prototype.computeExtent = function(extent) {
|
||||
* @return {number} Radius.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.getRadius = function() {
|
||||
_ol_geom_Circle_.prototype.getRadius = function() {
|
||||
return Math.sqrt(this.getRadiusSquared_());
|
||||
};
|
||||
|
||||
@@ -118,7 +119,7 @@ ol.geom.Circle.prototype.getRadius = function() {
|
||||
* @private
|
||||
* @return {number} Radius squared.
|
||||
*/
|
||||
ol.geom.Circle.prototype.getRadiusSquared_ = function() {
|
||||
_ol_geom_Circle_.prototype.getRadiusSquared_ = function() {
|
||||
var dx = this.flatCoordinates[this.stride] - this.flatCoordinates[0];
|
||||
var dy = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1];
|
||||
return dx * dx + dy * dy;
|
||||
@@ -129,8 +130,8 @@ ol.geom.Circle.prototype.getRadiusSquared_ = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.CIRCLE;
|
||||
_ol_geom_Circle_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.CIRCLE;
|
||||
};
|
||||
|
||||
|
||||
@@ -138,9 +139,9 @@ ol.geom.Circle.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.intersectsExtent = function(extent) {
|
||||
_ol_geom_Circle_.prototype.intersectsExtent = function(extent) {
|
||||
var circleExtent = this.getExtent();
|
||||
if (ol.extent.intersects(extent, circleExtent)) {
|
||||
if (_ol_extent_.intersects(extent, circleExtent)) {
|
||||
var center = this.getCenter();
|
||||
|
||||
if (extent[0] <= center[0] && extent[2] >= center[0]) {
|
||||
@@ -150,7 +151,7 @@ ol.geom.Circle.prototype.intersectsExtent = function(extent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ol.extent.forEachCorner(extent, this.intersectsCoordinate, this);
|
||||
return _ol_extent_.forEachCorner(extent, this.intersectsCoordinate, this);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -162,7 +163,7 @@ ol.geom.Circle.prototype.intersectsExtent = function(extent) {
|
||||
* @param {ol.Coordinate} center Center.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.setCenter = function(center) {
|
||||
_ol_geom_Circle_.prototype.setCenter = function(center) {
|
||||
var stride = this.stride;
|
||||
var radius = this.flatCoordinates[stride] - this.flatCoordinates[0];
|
||||
var flatCoordinates = center.slice();
|
||||
@@ -183,9 +184,9 @@ ol.geom.Circle.prototype.setCenter = function(center) {
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.setCenterAndRadius = function(center, radius, opt_layout) {
|
||||
_ol_geom_Circle_.prototype.setCenterAndRadius = function(center, radius, opt_layout) {
|
||||
if (!center) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, center, 0);
|
||||
if (!this.flatCoordinates) {
|
||||
@@ -193,7 +194,7 @@ ol.geom.Circle.prototype.setCenterAndRadius = function(center, radius, opt_layou
|
||||
}
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var offset = ol.geom.flat.deflate.coordinate(
|
||||
var offset = _ol_geom_flat_deflate_.coordinate(
|
||||
flatCoordinates, 0, center, this.stride);
|
||||
flatCoordinates[offset++] = flatCoordinates[0] + radius;
|
||||
var i, ii;
|
||||
@@ -209,20 +210,20 @@ ol.geom.Circle.prototype.setCenterAndRadius = function(center, radius, opt_layou
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Circle.prototype.getCoordinates = function() {};
|
||||
_ol_geom_Circle_.prototype.getCoordinates = function() {};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Circle.prototype.setCoordinates = function(coordinates, opt_layout) {};
|
||||
_ol_geom_Circle_.prototype.setCoordinates = function(coordinates, opt_layout) {};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.geom.GeometryLayout} layout Layout.
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
*/
|
||||
ol.geom.Circle.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
_ol_geom_Circle_.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.changed();
|
||||
};
|
||||
@@ -233,7 +234,7 @@ ol.geom.Circle.prototype.setFlatCoordinates = function(layout, flatCoordinates)
|
||||
* @param {number} radius Radius.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.setRadius = function(radius) {
|
||||
_ol_geom_Circle_.prototype.setRadius = function(radius) {
|
||||
this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;
|
||||
this.changed();
|
||||
};
|
||||
@@ -261,4 +262,5 @@ ol.geom.Circle.prototype.setRadius = function(radius) {
|
||||
* @function
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.transform;
|
||||
_ol_geom_Circle_.prototype.transform;
|
||||
export default _ol_geom_Circle_;
|
||||
|
||||
+42
-40
@@ -1,14 +1,14 @@
|
||||
goog.provide('ol.geom.Geometry');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.functions');
|
||||
goog.require('ol.geom.flat.transform');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.proj.Units');
|
||||
goog.require('ol.transform');
|
||||
|
||||
/**
|
||||
* @module ol/geom/Geometry
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_functions_ from '../functions.js';
|
||||
import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
import _ol_transform_ from '../transform.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -24,15 +24,15 @@ goog.require('ol.transform');
|
||||
* @extends {ol.Object}
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry = function() {
|
||||
var _ol_geom_Geometry_ = function() {
|
||||
|
||||
ol.Object.call(this);
|
||||
_ol_Object_.call(this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Extent}
|
||||
*/
|
||||
this.extent_ = ol.extent.createEmpty();
|
||||
this.extent_ = _ol_extent_.createEmpty();
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -62,10 +62,11 @@ ol.geom.Geometry = function() {
|
||||
* @private
|
||||
* @type {ol.Transform}
|
||||
*/
|
||||
this.tmpTransform_ = ol.transform.create();
|
||||
this.tmpTransform_ = _ol_transform_.create();
|
||||
|
||||
};
|
||||
ol.inherits(ol.geom.Geometry, ol.Object);
|
||||
|
||||
_ol_.inherits(_ol_geom_Geometry_, _ol_Object_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -73,7 +74,7 @@ ol.inherits(ol.geom.Geometry, ol.Object);
|
||||
* @abstract
|
||||
* @return {!ol.geom.Geometry} Clone.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.clone = function() {};
|
||||
_ol_geom_Geometry_.prototype.clone = function() {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -84,7 +85,7 @@ ol.geom.Geometry.prototype.clone = function() {};
|
||||
* @param {number} minSquaredDistance Minimum squared distance.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {};
|
||||
_ol_geom_Geometry_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -95,7 +96,7 @@ ol.geom.Geometry.prototype.closestPointXY = function(x, y, closestPoint, minSqua
|
||||
* @return {ol.Coordinate} Closest point.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry.prototype.getClosestPoint = function(point, opt_closestPoint) {
|
||||
_ol_geom_Geometry_.prototype.getClosestPoint = function(point, opt_closestPoint) {
|
||||
var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN];
|
||||
this.closestPointXY(point[0], point[1], closestPoint, Infinity);
|
||||
return closestPoint;
|
||||
@@ -109,7 +110,7 @@ ol.geom.Geometry.prototype.getClosestPoint = function(point, opt_closestPoint) {
|
||||
* @return {boolean} Contains coordinate.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry.prototype.intersectsCoordinate = function(coordinate) {
|
||||
_ol_geom_Geometry_.prototype.intersectsCoordinate = function(coordinate) {
|
||||
return this.containsXY(coordinate[0], coordinate[1]);
|
||||
};
|
||||
|
||||
@@ -120,7 +121,7 @@ ol.geom.Geometry.prototype.intersectsCoordinate = function(coordinate) {
|
||||
* @protected
|
||||
* @return {ol.Extent} extent Extent.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.computeExtent = function(extent) {};
|
||||
_ol_geom_Geometry_.prototype.computeExtent = function(extent) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -128,7 +129,7 @@ ol.geom.Geometry.prototype.computeExtent = function(extent) {};
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
ol.geom.Geometry.prototype.containsXY = ol.functions.FALSE;
|
||||
_ol_geom_Geometry_.prototype.containsXY = _ol_functions_.FALSE;
|
||||
|
||||
|
||||
/**
|
||||
@@ -137,12 +138,12 @@ ol.geom.Geometry.prototype.containsXY = ol.functions.FALSE;
|
||||
* @return {ol.Extent} extent Extent.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry.prototype.getExtent = function(opt_extent) {
|
||||
_ol_geom_Geometry_.prototype.getExtent = function(opt_extent) {
|
||||
if (this.extentRevision_ != this.getRevision()) {
|
||||
this.extent_ = this.computeExtent(this.extent_);
|
||||
this.extentRevision_ = this.getRevision();
|
||||
}
|
||||
return ol.extent.returnOrUpdate(this.extent_, opt_extent);
|
||||
return _ol_extent_.returnOrUpdate(this.extent_, opt_extent);
|
||||
};
|
||||
|
||||
|
||||
@@ -154,7 +155,7 @@ ol.geom.Geometry.prototype.getExtent = function(opt_extent) {
|
||||
* @param {ol.Coordinate} anchor The rotation center.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry.prototype.rotate = function(angle, anchor) {};
|
||||
_ol_geom_Geometry_.prototype.rotate = function(angle, anchor) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -168,7 +169,7 @@ ol.geom.Geometry.prototype.rotate = function(angle, anchor) {};
|
||||
* of the geometry extent).
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry.prototype.scale = function(sx, opt_sy, opt_anchor) {};
|
||||
_ol_geom_Geometry_.prototype.scale = function(sx, opt_sy, opt_anchor) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -183,7 +184,7 @@ ol.geom.Geometry.prototype.scale = function(sx, opt_sy, opt_anchor) {};
|
||||
* geometry.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry.prototype.simplify = function(tolerance) {
|
||||
_ol_geom_Geometry_.prototype.simplify = function(tolerance) {
|
||||
return this.getSimplifiedGeometry(tolerance * tolerance);
|
||||
};
|
||||
|
||||
@@ -196,7 +197,7 @@ ol.geom.Geometry.prototype.simplify = function(tolerance) {
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {ol.geom.Geometry} Simplified geometry.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.getSimplifiedGeometry = function(squaredTolerance) {};
|
||||
_ol_geom_Geometry_.prototype.getSimplifiedGeometry = function(squaredTolerance) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -204,7 +205,7 @@ ol.geom.Geometry.prototype.getSimplifiedGeometry = function(squaredTolerance) {}
|
||||
* @abstract
|
||||
* @return {ol.geom.GeometryType} Geometry type.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.getType = function() {};
|
||||
_ol_geom_Geometry_.prototype.getType = function() {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -215,7 +216,7 @@ ol.geom.Geometry.prototype.getType = function() {};
|
||||
* @abstract
|
||||
* @param {ol.TransformFunction} transformFn Transform.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.applyTransform = function(transformFn) {};
|
||||
_ol_geom_Geometry_.prototype.applyTransform = function(transformFn) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -224,7 +225,7 @@ ol.geom.Geometry.prototype.applyTransform = function(transformFn) {};
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} `true` if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.intersectsExtent = function(extent) {};
|
||||
_ol_geom_Geometry_.prototype.intersectsExtent = function(extent) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -234,7 +235,7 @@ ol.geom.Geometry.prototype.intersectsExtent = function(extent) {};
|
||||
* @param {number} deltaX Delta X.
|
||||
* @param {number} deltaY Delta Y.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.translate = function(deltaX, deltaY) {};
|
||||
_ol_geom_Geometry_.prototype.translate = function(deltaX, deltaY) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -252,23 +253,24 @@ ol.geom.Geometry.prototype.translate = function(deltaX, deltaY) {};
|
||||
* modified in place.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Geometry.prototype.transform = function(source, destination) {
|
||||
_ol_geom_Geometry_.prototype.transform = function(source, destination) {
|
||||
var tmpTransform = this.tmpTransform_;
|
||||
source = ol.proj.get(source);
|
||||
var transformFn = source.getUnits() == ol.proj.Units.TILE_PIXELS ?
|
||||
source = _ol_proj_.get(source);
|
||||
var transformFn = source.getUnits() == _ol_proj_Units_.TILE_PIXELS ?
|
||||
function(inCoordinates, outCoordinates, stride) {
|
||||
var pixelExtent = source.getExtent();
|
||||
var projectedExtent = source.getWorldExtent();
|
||||
var scale = ol.extent.getHeight(projectedExtent) / ol.extent.getHeight(pixelExtent);
|
||||
ol.transform.compose(tmpTransform,
|
||||
var scale = _ol_extent_.getHeight(projectedExtent) / _ol_extent_.getHeight(pixelExtent);
|
||||
_ol_transform_.compose(tmpTransform,
|
||||
projectedExtent[0], projectedExtent[3],
|
||||
scale, -scale, 0,
|
||||
0, 0);
|
||||
ol.geom.flat.transform.transform2D(inCoordinates, 0, inCoordinates.length, stride,
|
||||
_ol_geom_flat_transform_.transform2D(inCoordinates, 0, inCoordinates.length, stride,
|
||||
tmpTransform, outCoordinates);
|
||||
return ol.proj.getTransform(source, destination)(inCoordinates, outCoordinates, stride);
|
||||
return _ol_proj_.getTransform(source, destination)(inCoordinates, outCoordinates, stride);
|
||||
} :
|
||||
ol.proj.getTransform(source, destination);
|
||||
_ol_proj_.getTransform(source, destination);
|
||||
this.applyTransform(transformFn);
|
||||
return this;
|
||||
};
|
||||
export default _ol_geom_Geometry_;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
goog.provide('ol.geom.GeometryCollection');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.obj');
|
||||
|
||||
/**
|
||||
* @module ol/geom/GeometryCollection
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_Geometry_ from '../geom/Geometry.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -18,9 +18,9 @@ goog.require('ol.obj');
|
||||
* @param {Array.<ol.geom.Geometry>=} opt_geometries Geometries.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection = function(opt_geometries) {
|
||||
var _ol_geom_GeometryCollection_ = function(opt_geometries) {
|
||||
|
||||
ol.geom.Geometry.call(this);
|
||||
_ol_geom_Geometry_.call(this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -30,7 +30,8 @@ ol.geom.GeometryCollection = function(opt_geometries) {
|
||||
|
||||
this.listenGeometriesChange_();
|
||||
};
|
||||
ol.inherits(ol.geom.GeometryCollection, ol.geom.Geometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_GeometryCollection_, _ol_geom_Geometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -38,7 +39,7 @@ ol.inherits(ol.geom.GeometryCollection, ol.geom.Geometry);
|
||||
* @private
|
||||
* @return {Array.<ol.geom.Geometry>} Cloned geometries.
|
||||
*/
|
||||
ol.geom.GeometryCollection.cloneGeometries_ = function(geometries) {
|
||||
_ol_geom_GeometryCollection_.cloneGeometries_ = function(geometries) {
|
||||
var clonedGeometries = [];
|
||||
var i, ii;
|
||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
@@ -51,14 +52,14 @@ ol.geom.GeometryCollection.cloneGeometries_ = function(geometries) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.unlistenGeometriesChange_ = function() {
|
||||
_ol_geom_GeometryCollection_.prototype.unlistenGeometriesChange_ = function() {
|
||||
var i, ii;
|
||||
if (!this.geometries_) {
|
||||
return;
|
||||
}
|
||||
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
||||
ol.events.unlisten(
|
||||
this.geometries_[i], ol.events.EventType.CHANGE,
|
||||
_ol_events_.unlisten(
|
||||
this.geometries_[i], _ol_events_EventType_.CHANGE,
|
||||
this.changed, this);
|
||||
}
|
||||
};
|
||||
@@ -67,14 +68,14 @@ ol.geom.GeometryCollection.prototype.unlistenGeometriesChange_ = function() {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.listenGeometriesChange_ = function() {
|
||||
_ol_geom_GeometryCollection_.prototype.listenGeometriesChange_ = function() {
|
||||
var i, ii;
|
||||
if (!this.geometries_) {
|
||||
return;
|
||||
}
|
||||
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
||||
ol.events.listen(
|
||||
this.geometries_[i], ol.events.EventType.CHANGE,
|
||||
_ol_events_.listen(
|
||||
this.geometries_[i], _ol_events_EventType_.CHANGE,
|
||||
this.changed, this);
|
||||
}
|
||||
};
|
||||
@@ -86,8 +87,8 @@ ol.geom.GeometryCollection.prototype.listenGeometriesChange_ = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.clone = function() {
|
||||
var geometryCollection = new ol.geom.GeometryCollection(null);
|
||||
_ol_geom_GeometryCollection_.prototype.clone = function() {
|
||||
var geometryCollection = new _ol_geom_GeometryCollection_(null);
|
||||
geometryCollection.setGeometries(this.geometries_);
|
||||
return geometryCollection;
|
||||
};
|
||||
@@ -96,9 +97,9 @@ ol.geom.GeometryCollection.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_GeometryCollection_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
var geometries = this.geometries_;
|
||||
@@ -114,7 +115,7 @@ ol.geom.GeometryCollection.prototype.closestPointXY = function(x, y, closestPoin
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.containsXY = function(x, y) {
|
||||
_ol_geom_GeometryCollection_.prototype.containsXY = function(x, y) {
|
||||
var geometries = this.geometries_;
|
||||
var i, ii;
|
||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
@@ -129,11 +130,11 @@ ol.geom.GeometryCollection.prototype.containsXY = function(x, y) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.computeExtent = function(extent) {
|
||||
ol.extent.createOrUpdateEmpty(extent);
|
||||
_ol_geom_GeometryCollection_.prototype.computeExtent = function(extent) {
|
||||
_ol_extent_.createOrUpdateEmpty(extent);
|
||||
var geometries = this.geometries_;
|
||||
for (var i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
ol.extent.extend(extent, geometries[i].getExtent());
|
||||
_ol_extent_.extend(extent, geometries[i].getExtent());
|
||||
}
|
||||
return extent;
|
||||
};
|
||||
@@ -144,15 +145,15 @@ ol.geom.GeometryCollection.prototype.computeExtent = function(extent) {
|
||||
* @return {Array.<ol.geom.Geometry>} Geometries.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.getGeometries = function() {
|
||||
return ol.geom.GeometryCollection.cloneGeometries_(this.geometries_);
|
||||
_ol_geom_GeometryCollection_.prototype.getGeometries = function() {
|
||||
return _ol_geom_GeometryCollection_.cloneGeometries_(this.geometries_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<ol.geom.Geometry>} Geometries.
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.getGeometriesArray = function() {
|
||||
_ol_geom_GeometryCollection_.prototype.getGeometriesArray = function() {
|
||||
return this.geometries_;
|
||||
};
|
||||
|
||||
@@ -160,9 +161,9 @@ ol.geom.GeometryCollection.prototype.getGeometriesArray = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTolerance) {
|
||||
_ol_geom_GeometryCollection_.prototype.getSimplifiedGeometry = function(squaredTolerance) {
|
||||
if (this.simplifiedGeometryRevision != this.getRevision()) {
|
||||
ol.obj.clear(this.simplifiedGeometryCache);
|
||||
_ol_obj_.clear(this.simplifiedGeometryCache);
|
||||
this.simplifiedGeometryMaxMinSquaredTolerance = 0;
|
||||
this.simplifiedGeometryRevision = this.getRevision();
|
||||
}
|
||||
@@ -188,7 +189,7 @@ ol.geom.GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTol
|
||||
}
|
||||
}
|
||||
if (simplified) {
|
||||
var simplifiedGeometryCollection = new ol.geom.GeometryCollection(null);
|
||||
var simplifiedGeometryCollection = new _ol_geom_GeometryCollection_(null);
|
||||
simplifiedGeometryCollection.setGeometriesArray(simplifiedGeometries);
|
||||
this.simplifiedGeometryCache[key] = simplifiedGeometryCollection;
|
||||
return simplifiedGeometryCollection;
|
||||
@@ -204,8 +205,8 @@ ol.geom.GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTol
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.GEOMETRY_COLLECTION;
|
||||
_ol_geom_GeometryCollection_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.GEOMETRY_COLLECTION;
|
||||
};
|
||||
|
||||
|
||||
@@ -213,7 +214,7 @@ ol.geom.GeometryCollection.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.intersectsExtent = function(extent) {
|
||||
_ol_geom_GeometryCollection_.prototype.intersectsExtent = function(extent) {
|
||||
var geometries = this.geometries_;
|
||||
var i, ii;
|
||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
@@ -228,7 +229,7 @@ ol.geom.GeometryCollection.prototype.intersectsExtent = function(extent) {
|
||||
/**
|
||||
* @return {boolean} Is empty.
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.isEmpty = function() {
|
||||
_ol_geom_GeometryCollection_.prototype.isEmpty = function() {
|
||||
return this.geometries_.length === 0;
|
||||
};
|
||||
|
||||
@@ -237,7 +238,7 @@ ol.geom.GeometryCollection.prototype.isEmpty = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.rotate = function(angle, anchor) {
|
||||
_ol_geom_GeometryCollection_.prototype.rotate = function(angle, anchor) {
|
||||
var geometries = this.geometries_;
|
||||
for (var i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
geometries[i].rotate(angle, anchor);
|
||||
@@ -250,10 +251,10 @@ ol.geom.GeometryCollection.prototype.rotate = function(angle, anchor) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
||||
_ol_geom_GeometryCollection_.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
||||
var anchor = opt_anchor;
|
||||
if (!anchor) {
|
||||
anchor = ol.extent.getCenter(this.getExtent());
|
||||
anchor = _ol_extent_.getCenter(this.getExtent());
|
||||
}
|
||||
var geometries = this.geometries_;
|
||||
for (var i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
@@ -268,16 +269,16 @@ ol.geom.GeometryCollection.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
||||
* @param {Array.<ol.geom.Geometry>} geometries Geometries.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.setGeometries = function(geometries) {
|
||||
_ol_geom_GeometryCollection_.prototype.setGeometries = function(geometries) {
|
||||
this.setGeometriesArray(
|
||||
ol.geom.GeometryCollection.cloneGeometries_(geometries));
|
||||
_ol_geom_GeometryCollection_.cloneGeometries_(geometries));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<ol.geom.Geometry>} geometries Geometries.
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.setGeometriesArray = function(geometries) {
|
||||
_ol_geom_GeometryCollection_.prototype.setGeometriesArray = function(geometries) {
|
||||
this.unlistenGeometriesChange_();
|
||||
this.geometries_ = geometries;
|
||||
this.listenGeometriesChange_();
|
||||
@@ -289,7 +290,7 @@ ol.geom.GeometryCollection.prototype.setGeometriesArray = function(geometries) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.applyTransform = function(transformFn) {
|
||||
_ol_geom_GeometryCollection_.prototype.applyTransform = function(transformFn) {
|
||||
var geometries = this.geometries_;
|
||||
var i, ii;
|
||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
@@ -306,7 +307,7 @@ ol.geom.GeometryCollection.prototype.applyTransform = function(transformFn) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.translate = function(deltaX, deltaY) {
|
||||
_ol_geom_GeometryCollection_.prototype.translate = function(deltaX, deltaY) {
|
||||
var geometries = this.geometries_;
|
||||
var i, ii;
|
||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
@@ -319,7 +320,8 @@ ol.geom.GeometryCollection.prototype.translate = function(deltaX, deltaY) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.disposeInternal = function() {
|
||||
_ol_geom_GeometryCollection_.prototype.disposeInternal = function() {
|
||||
this.unlistenGeometriesChange_();
|
||||
ol.geom.Geometry.prototype.disposeInternal.call(this);
|
||||
_ol_geom_Geometry_.prototype.disposeInternal.call(this);
|
||||
};
|
||||
export default _ol_geom_GeometryCollection_;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
goog.provide('ol.geom.GeometryLayout');
|
||||
|
||||
|
||||
/**
|
||||
* @module ol/geom/GeometryLayout
|
||||
*/
|
||||
/**
|
||||
* The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')
|
||||
* or measure ('M') coordinate is available. Supported values are `'XY'`,
|
||||
* `'XYZ'`, `'XYM'`, `'XYZM'`.
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.geom.GeometryLayout = {
|
||||
var _ol_geom_GeometryLayout_ = {
|
||||
XY: 'XY',
|
||||
XYZ: 'XYZ',
|
||||
XYM: 'XYM',
|
||||
XYZM: 'XYZM'
|
||||
};
|
||||
|
||||
export default _ol_geom_GeometryLayout_;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
goog.provide('ol.geom.GeometryType');
|
||||
|
||||
|
||||
/**
|
||||
* @module ol/geom/GeometryType
|
||||
*/
|
||||
/**
|
||||
* The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,
|
||||
* `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,
|
||||
* `'GeometryCollection'`, `'Circle'`.
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.geom.GeometryType = {
|
||||
var _ol_geom_GeometryType_ = {
|
||||
POINT: 'Point',
|
||||
LINE_STRING: 'LineString',
|
||||
LINEAR_RING: 'LinearRing',
|
||||
@@ -18,3 +18,5 @@ ol.geom.GeometryType = {
|
||||
GEOMETRY_COLLECTION: 'GeometryCollection',
|
||||
CIRCLE: 'Circle'
|
||||
};
|
||||
|
||||
export default _ol_geom_GeometryType_;
|
||||
|
||||
+55
-53
@@ -1,20 +1,20 @@
|
||||
goog.provide('ol.geom.LineString');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.closest');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
goog.require('ol.geom.flat.inflate');
|
||||
goog.require('ol.geom.flat.interpolate');
|
||||
goog.require('ol.geom.flat.intersectsextent');
|
||||
goog.require('ol.geom.flat.length');
|
||||
goog.require('ol.geom.flat.segments');
|
||||
goog.require('ol.geom.flat.simplify');
|
||||
|
||||
/**
|
||||
* @module ol/geom/LineString
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
|
||||
import _ol_geom_flat_interpolate_ from '../geom/flat/interpolate.js';
|
||||
import _ol_geom_flat_intersectsextent_ from '../geom/flat/intersectsextent.js';
|
||||
import _ol_geom_flat_length_ from '../geom/flat/length.js';
|
||||
import _ol_geom_flat_segments_ from '../geom/flat/segments.js';
|
||||
import _ol_geom_flat_simplify_ from '../geom/flat/simplify.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -26,9 +26,9 @@ goog.require('ol.geom.flat.simplify');
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString = function(coordinates, opt_layout) {
|
||||
var _ol_geom_LineString_ = function(coordinates, opt_layout) {
|
||||
|
||||
ol.geom.SimpleGeometry.call(this);
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -57,7 +57,8 @@ ol.geom.LineString = function(coordinates, opt_layout) {
|
||||
this.setCoordinates(coordinates, opt_layout);
|
||||
|
||||
};
|
||||
ol.inherits(ol.geom.LineString, ol.geom.SimpleGeometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_LineString_, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -65,11 +66,11 @@ ol.inherits(ol.geom.LineString, ol.geom.SimpleGeometry);
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
|
||||
_ol_geom_LineString_.prototype.appendCoordinate = function(coordinate) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = coordinate.slice();
|
||||
} else {
|
||||
ol.array.extend(this.flatCoordinates, coordinate);
|
||||
_ol_array_.extend(this.flatCoordinates, coordinate);
|
||||
}
|
||||
this.changed();
|
||||
};
|
||||
@@ -81,8 +82,8 @@ ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.clone = function() {
|
||||
var lineString = new ol.geom.LineString(null);
|
||||
_ol_geom_LineString_.prototype.clone = function() {
|
||||
var lineString = new _ol_geom_LineString_(null);
|
||||
lineString.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
|
||||
return lineString;
|
||||
};
|
||||
@@ -91,17 +92,17 @@ ol.geom.LineString.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.LineString.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_LineString_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getMaxSquaredDelta(
|
||||
this.maxDelta_ = Math.sqrt(_ol_geom_flat_closest_.getMaxSquaredDelta(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0));
|
||||
this.maxDeltaRevision_ = this.getRevision();
|
||||
}
|
||||
return ol.geom.flat.closest.getClosestPoint(
|
||||
return _ol_geom_flat_closest_.getClosestPoint(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
|
||||
this.maxDelta_, false, x, y, closestPoint, minSquaredDistance);
|
||||
};
|
||||
@@ -120,8 +121,8 @@ ol.geom.LineString.prototype.closestPointXY = function(x, y, closestPoint, minSq
|
||||
* @template T,S
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.forEachSegment = function(callback, opt_this) {
|
||||
return ol.geom.flat.segments.forEach(this.flatCoordinates, 0,
|
||||
_ol_geom_LineString_.prototype.forEachSegment = function(callback, opt_this) {
|
||||
return _ol_geom_flat_segments_.forEach(this.flatCoordinates, 0,
|
||||
this.flatCoordinates.length, this.stride, callback, opt_this);
|
||||
};
|
||||
|
||||
@@ -140,13 +141,13 @@ ol.geom.LineString.prototype.forEachSegment = function(callback, opt_this) {
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) {
|
||||
if (this.layout != ol.geom.GeometryLayout.XYM &&
|
||||
this.layout != ol.geom.GeometryLayout.XYZM) {
|
||||
_ol_geom_LineString_.prototype.getCoordinateAtM = function(m, opt_extrapolate) {
|
||||
if (this.layout != _ol_geom_GeometryLayout_.XYM &&
|
||||
this.layout != _ol_geom_GeometryLayout_.XYZM) {
|
||||
return null;
|
||||
}
|
||||
var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;
|
||||
return ol.geom.flat.interpolate.lineStringCoordinateAtM(this.flatCoordinates, 0,
|
||||
return _ol_geom_flat_interpolate_.lineStringCoordinateAtM(this.flatCoordinates, 0,
|
||||
this.flatCoordinates.length, this.stride, m, extrapolate);
|
||||
};
|
||||
|
||||
@@ -157,8 +158,8 @@ ol.geom.LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.getCoordinates = function() {
|
||||
return ol.geom.flat.inflate.coordinates(
|
||||
_ol_geom_LineString_.prototype.getCoordinates = function() {
|
||||
return _ol_geom_flat_inflate_.coordinates(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
|
||||
};
|
||||
|
||||
@@ -173,8 +174,8 @@ ol.geom.LineString.prototype.getCoordinates = function() {
|
||||
* @return {ol.Coordinate} Coordinate of the interpolated point.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.getCoordinateAt = function(fraction, opt_dest) {
|
||||
return ol.geom.flat.interpolate.lineString(
|
||||
_ol_geom_LineString_.prototype.getCoordinateAt = function(fraction, opt_dest) {
|
||||
return _ol_geom_flat_interpolate_.lineString(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
|
||||
fraction, opt_dest);
|
||||
};
|
||||
@@ -185,8 +186,8 @@ ol.geom.LineString.prototype.getCoordinateAt = function(fraction, opt_dest) {
|
||||
* @return {number} Length (on projected plane).
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.getLength = function() {
|
||||
return ol.geom.flat.length.lineString(
|
||||
_ol_geom_LineString_.prototype.getLength = function() {
|
||||
return _ol_geom_flat_length_.lineString(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
|
||||
};
|
||||
|
||||
@@ -194,7 +195,7 @@ ol.geom.LineString.prototype.getLength = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Flat midpoint.
|
||||
*/
|
||||
ol.geom.LineString.prototype.getFlatMidpoint = function() {
|
||||
_ol_geom_LineString_.prototype.getFlatMidpoint = function() {
|
||||
if (this.flatMidpointRevision_ != this.getRevision()) {
|
||||
this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_);
|
||||
this.flatMidpointRevision_ = this.getRevision();
|
||||
@@ -206,14 +207,14 @@ ol.geom.LineString.prototype.getFlatMidpoint = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.LineString.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
_ol_geom_LineString_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
var simplifiedFlatCoordinates = [];
|
||||
simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeucker(
|
||||
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.douglasPeucker(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
|
||||
squaredTolerance, simplifiedFlatCoordinates, 0);
|
||||
var simplifiedLineString = new ol.geom.LineString(null);
|
||||
var simplifiedLineString = new _ol_geom_LineString_(null);
|
||||
simplifiedLineString.setFlatCoordinates(
|
||||
ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates);
|
||||
_ol_geom_GeometryLayout_.XY, simplifiedFlatCoordinates);
|
||||
return simplifiedLineString;
|
||||
};
|
||||
|
||||
@@ -222,8 +223,8 @@ ol.geom.LineString.prototype.getSimplifiedGeometryInternal = function(squaredTol
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.LINE_STRING;
|
||||
_ol_geom_LineString_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.LINE_STRING;
|
||||
};
|
||||
|
||||
|
||||
@@ -231,8 +232,8 @@ ol.geom.LineString.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.intersectsExtent = function(extent) {
|
||||
return ol.geom.flat.intersectsextent.lineString(
|
||||
_ol_geom_LineString_.prototype.intersectsExtent = function(extent) {
|
||||
return _ol_geom_flat_intersectsextent_.lineString(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
|
||||
extent);
|
||||
};
|
||||
@@ -245,15 +246,15 @@ ol.geom.LineString.prototype.intersectsExtent = function(extent) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LineString.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
_ol_geom_LineString_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 1);
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||
this.flatCoordinates.length = _ol_geom_flat_deflate_.coordinates(
|
||||
this.flatCoordinates, 0, coordinates, this.stride);
|
||||
this.changed();
|
||||
}
|
||||
@@ -264,7 +265,8 @@ ol.geom.LineString.prototype.setCoordinates = function(coordinates, opt_layout)
|
||||
* @param {ol.geom.GeometryLayout} layout Layout.
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
*/
|
||||
ol.geom.LineString.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
_ol_geom_LineString_.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.changed();
|
||||
};
|
||||
export default _ol_geom_LineString_;
|
||||
|
||||
+39
-37
@@ -1,16 +1,16 @@
|
||||
goog.provide('ol.geom.LinearRing');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.area');
|
||||
goog.require('ol.geom.flat.closest');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
goog.require('ol.geom.flat.inflate');
|
||||
goog.require('ol.geom.flat.simplify');
|
||||
|
||||
/**
|
||||
* @module ol/geom/LinearRing
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_area_ from '../geom/flat/area.js';
|
||||
import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
|
||||
import _ol_geom_flat_simplify_ from '../geom/flat/simplify.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -23,9 +23,9 @@ goog.require('ol.geom.flat.simplify');
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LinearRing = function(coordinates, opt_layout) {
|
||||
var _ol_geom_LinearRing_ = function(coordinates, opt_layout) {
|
||||
|
||||
ol.geom.SimpleGeometry.call(this);
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -42,7 +42,8 @@ ol.geom.LinearRing = function(coordinates, opt_layout) {
|
||||
this.setCoordinates(coordinates, opt_layout);
|
||||
|
||||
};
|
||||
ol.inherits(ol.geom.LinearRing, ol.geom.SimpleGeometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_LinearRing_, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,8 +52,8 @@ ol.inherits(ol.geom.LinearRing, ol.geom.SimpleGeometry);
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.clone = function() {
|
||||
var linearRing = new ol.geom.LinearRing(null);
|
||||
_ol_geom_LinearRing_.prototype.clone = function() {
|
||||
var linearRing = new _ol_geom_LinearRing_(null);
|
||||
linearRing.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
|
||||
return linearRing;
|
||||
};
|
||||
@@ -61,17 +62,17 @@ ol.geom.LinearRing.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_LinearRing_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getMaxSquaredDelta(
|
||||
this.maxDelta_ = Math.sqrt(_ol_geom_flat_closest_.getMaxSquaredDelta(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0));
|
||||
this.maxDeltaRevision_ = this.getRevision();
|
||||
}
|
||||
return ol.geom.flat.closest.getClosestPoint(
|
||||
return _ol_geom_flat_closest_.getClosestPoint(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
|
||||
this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
|
||||
};
|
||||
@@ -82,8 +83,8 @@ ol.geom.LinearRing.prototype.closestPointXY = function(x, y, closestPoint, minSq
|
||||
* @return {number} Area (on projected plane).
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.getArea = function() {
|
||||
return ol.geom.flat.area.linearRing(
|
||||
_ol_geom_LinearRing_.prototype.getArea = function() {
|
||||
return _ol_geom_flat_area_.linearRing(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
|
||||
};
|
||||
|
||||
@@ -94,8 +95,8 @@ ol.geom.LinearRing.prototype.getArea = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.getCoordinates = function() {
|
||||
return ol.geom.flat.inflate.coordinates(
|
||||
_ol_geom_LinearRing_.prototype.getCoordinates = function() {
|
||||
return _ol_geom_flat_inflate_.coordinates(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
|
||||
};
|
||||
|
||||
@@ -103,14 +104,14 @@ ol.geom.LinearRing.prototype.getCoordinates = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
_ol_geom_LinearRing_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
var simplifiedFlatCoordinates = [];
|
||||
simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeucker(
|
||||
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 _ol_geom_LinearRing_(null);
|
||||
simplifiedLinearRing.setFlatCoordinates(
|
||||
ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates);
|
||||
_ol_geom_GeometryLayout_.XY, simplifiedFlatCoordinates);
|
||||
return simplifiedLinearRing;
|
||||
};
|
||||
|
||||
@@ -119,15 +120,15 @@ ol.geom.LinearRing.prototype.getSimplifiedGeometryInternal = function(squaredTol
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.LINEAR_RING;
|
||||
_ol_geom_LinearRing_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.LINEAR_RING;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.intersectsExtent = function(extent) {};
|
||||
_ol_geom_LinearRing_.prototype.intersectsExtent = function(extent) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -137,15 +138,15 @@ ol.geom.LinearRing.prototype.intersectsExtent = function(extent) {};
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
_ol_geom_LinearRing_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 1);
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||
this.flatCoordinates.length = _ol_geom_flat_deflate_.coordinates(
|
||||
this.flatCoordinates, 0, coordinates, this.stride);
|
||||
this.changed();
|
||||
}
|
||||
@@ -156,7 +157,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) {
|
||||
_ol_geom_LinearRing_.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.changed();
|
||||
};
|
||||
export default _ol_geom_LinearRing_;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
goog.provide('ol.geom.MultiLineString');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.closest');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
goog.require('ol.geom.flat.inflate');
|
||||
goog.require('ol.geom.flat.interpolate');
|
||||
goog.require('ol.geom.flat.intersectsextent');
|
||||
goog.require('ol.geom.flat.simplify');
|
||||
|
||||
/**
|
||||
* @module ol/geom/MultiLineString
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_LineString_ from '../geom/LineString.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
|
||||
import _ol_geom_flat_interpolate_ from '../geom/flat/interpolate.js';
|
||||
import _ol_geom_flat_intersectsextent_ from '../geom/flat/intersectsextent.js';
|
||||
import _ol_geom_flat_simplify_ from '../geom/flat/simplify.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -25,9 +25,9 @@ goog.require('ol.geom.flat.simplify');
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString = function(coordinates, opt_layout) {
|
||||
var _ol_geom_MultiLineString_ = function(coordinates, opt_layout) {
|
||||
|
||||
ol.geom.SimpleGeometry.call(this);
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
|
||||
/**
|
||||
* @type {Array.<number>}
|
||||
@@ -50,7 +50,8 @@ ol.geom.MultiLineString = function(coordinates, opt_layout) {
|
||||
this.setCoordinates(coordinates, opt_layout);
|
||||
|
||||
};
|
||||
ol.inherits(ol.geom.MultiLineString, ol.geom.SimpleGeometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_MultiLineString_, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -58,11 +59,11 @@ ol.inherits(ol.geom.MultiLineString, ol.geom.SimpleGeometry);
|
||||
* @param {ol.geom.LineString} lineString LineString.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
|
||||
_ol_geom_MultiLineString_.prototype.appendLineString = function(lineString) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = lineString.getFlatCoordinates().slice();
|
||||
} else {
|
||||
ol.array.extend(
|
||||
_ol_array_.extend(
|
||||
this.flatCoordinates, lineString.getFlatCoordinates().slice());
|
||||
}
|
||||
this.ends_.push(this.flatCoordinates.length);
|
||||
@@ -76,8 +77,8 @@ ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.clone = function() {
|
||||
var multiLineString = new ol.geom.MultiLineString(null);
|
||||
_ol_geom_MultiLineString_.prototype.clone = function() {
|
||||
var multiLineString = new _ol_geom_MultiLineString_(null);
|
||||
multiLineString.setFlatCoordinates(
|
||||
this.layout, this.flatCoordinates.slice(), this.ends_.slice());
|
||||
return multiLineString;
|
||||
@@ -87,17 +88,17 @@ ol.geom.MultiLineString.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_MultiLineString_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getsMaxSquaredDelta(
|
||||
this.maxDelta_ = Math.sqrt(_ol_geom_flat_closest_.getsMaxSquaredDelta(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride, 0));
|
||||
this.maxDeltaRevision_ = this.getRevision();
|
||||
}
|
||||
return ol.geom.flat.closest.getsClosestPoint(
|
||||
return _ol_geom_flat_closest_.getsClosestPoint(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride,
|
||||
this.maxDelta_, false, x, y, closestPoint, minSquaredDistance);
|
||||
};
|
||||
@@ -125,15 +126,15 @@ ol.geom.MultiLineString.prototype.closestPointXY = function(x, y, closestPoint,
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getCoordinateAtM = function(m, opt_extrapolate, opt_interpolate) {
|
||||
if ((this.layout != ol.geom.GeometryLayout.XYM &&
|
||||
this.layout != ol.geom.GeometryLayout.XYZM) ||
|
||||
_ol_geom_MultiLineString_.prototype.getCoordinateAtM = function(m, opt_extrapolate, opt_interpolate) {
|
||||
if ((this.layout != _ol_geom_GeometryLayout_.XYM &&
|
||||
this.layout != _ol_geom_GeometryLayout_.XYZM) ||
|
||||
this.flatCoordinates.length === 0) {
|
||||
return null;
|
||||
}
|
||||
var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;
|
||||
var interpolate = opt_interpolate !== undefined ? opt_interpolate : false;
|
||||
return ol.geom.flat.interpolate.lineStringsCoordinateAtM(this.flatCoordinates, 0,
|
||||
return _ol_geom_flat_interpolate_.lineStringsCoordinateAtM(this.flatCoordinates, 0,
|
||||
this.ends_, this.stride, m, extrapolate, interpolate);
|
||||
};
|
||||
|
||||
@@ -144,8 +145,8 @@ ol.geom.MultiLineString.prototype.getCoordinateAtM = function(m, opt_extrapolate
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getCoordinates = function() {
|
||||
return ol.geom.flat.inflate.coordinatess(
|
||||
_ol_geom_MultiLineString_.prototype.getCoordinates = function() {
|
||||
return _ol_geom_flat_inflate_.coordinatess(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride);
|
||||
};
|
||||
|
||||
@@ -153,7 +154,7 @@ ol.geom.MultiLineString.prototype.getCoordinates = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Ends.
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getEnds = function() {
|
||||
_ol_geom_MultiLineString_.prototype.getEnds = function() {
|
||||
return this.ends_;
|
||||
};
|
||||
|
||||
@@ -164,11 +165,11 @@ ol.geom.MultiLineString.prototype.getEnds = function() {
|
||||
* @return {ol.geom.LineString} LineString.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getLineString = function(index) {
|
||||
_ol_geom_MultiLineString_.prototype.getLineString = function(index) {
|
||||
if (index < 0 || this.ends_.length <= index) {
|
||||
return null;
|
||||
}
|
||||
var lineString = new ol.geom.LineString(null);
|
||||
var lineString = new _ol_geom_LineString_(null);
|
||||
lineString.setFlatCoordinates(this.layout, this.flatCoordinates.slice(
|
||||
index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]));
|
||||
return lineString;
|
||||
@@ -180,7 +181,7 @@ ol.geom.MultiLineString.prototype.getLineString = function(index) {
|
||||
* @return {Array.<ol.geom.LineString>} LineStrings.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getLineStrings = function() {
|
||||
_ol_geom_MultiLineString_.prototype.getLineStrings = function() {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var ends = this.ends_;
|
||||
var layout = this.layout;
|
||||
@@ -190,7 +191,7 @@ ol.geom.MultiLineString.prototype.getLineStrings = function() {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
var lineString = new ol.geom.LineString(null);
|
||||
var lineString = new _ol_geom_LineString_(null);
|
||||
lineString.setFlatCoordinates(layout, flatCoordinates.slice(offset, end));
|
||||
lineStrings.push(lineString);
|
||||
offset = end;
|
||||
@@ -202,7 +203,7 @@ ol.geom.MultiLineString.prototype.getLineStrings = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Flat midpoints.
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getFlatMidpoints = function() {
|
||||
_ol_geom_MultiLineString_.prototype.getFlatMidpoints = function() {
|
||||
var midpoints = [];
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var offset = 0;
|
||||
@@ -211,9 +212,9 @@ ol.geom.MultiLineString.prototype.getFlatMidpoints = function() {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
var midpoint = ol.geom.flat.interpolate.lineString(
|
||||
var midpoint = _ol_geom_flat_interpolate_.lineString(
|
||||
flatCoordinates, offset, end, stride, 0.5);
|
||||
ol.array.extend(midpoints, midpoint);
|
||||
_ol_array_.extend(midpoints, midpoint);
|
||||
offset = end;
|
||||
}
|
||||
return midpoints;
|
||||
@@ -223,15 +224,15 @@ ol.geom.MultiLineString.prototype.getFlatMidpoints = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
_ol_geom_MultiLineString_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
var simplifiedFlatCoordinates = [];
|
||||
var simplifiedEnds = [];
|
||||
simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeuckers(
|
||||
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.douglasPeuckers(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, 0, simplifiedEnds);
|
||||
var simplifiedMultiLineString = new ol.geom.MultiLineString(null);
|
||||
var simplifiedMultiLineString = new _ol_geom_MultiLineString_(null);
|
||||
simplifiedMultiLineString.setFlatCoordinates(
|
||||
ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
||||
_ol_geom_GeometryLayout_.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
||||
return simplifiedMultiLineString;
|
||||
};
|
||||
|
||||
@@ -240,8 +241,8 @@ ol.geom.MultiLineString.prototype.getSimplifiedGeometryInternal = function(squar
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.MULTI_LINE_STRING;
|
||||
_ol_geom_MultiLineString_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.MULTI_LINE_STRING;
|
||||
};
|
||||
|
||||
|
||||
@@ -249,8 +250,8 @@ ol.geom.MultiLineString.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.intersectsExtent = function(extent) {
|
||||
return ol.geom.flat.intersectsextent.lineStrings(
|
||||
_ol_geom_MultiLineString_.prototype.intersectsExtent = function(extent) {
|
||||
return _ol_geom_flat_intersectsextent_.lineStrings(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride, extent);
|
||||
};
|
||||
|
||||
@@ -262,15 +263,15 @@ ol.geom.MultiLineString.prototype.intersectsExtent = function(extent) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
_ol_geom_MultiLineString_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.ends_);
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null, this.ends_);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 2);
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
var ends = ol.geom.flat.deflate.coordinatess(
|
||||
var ends = _ol_geom_flat_deflate_.coordinatess(
|
||||
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
||||
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
||||
this.changed();
|
||||
@@ -283,7 +284,7 @@ ol.geom.MultiLineString.prototype.setCoordinates = function(coordinates, opt_lay
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array.<number>} ends Ends.
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) {
|
||||
_ol_geom_MultiLineString_.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.ends_ = ends;
|
||||
this.changed();
|
||||
@@ -293,7 +294,7 @@ ol.geom.MultiLineString.prototype.setFlatCoordinates = function(layout, flatCoor
|
||||
/**
|
||||
* @param {Array.<ol.geom.LineString>} lineStrings LineStrings.
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) {
|
||||
_ol_geom_MultiLineString_.prototype.setLineStrings = function(lineStrings) {
|
||||
var layout = this.getLayout();
|
||||
var flatCoordinates = [];
|
||||
var ends = [];
|
||||
@@ -303,8 +304,9 @@ ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) {
|
||||
if (i === 0) {
|
||||
layout = lineString.getLayout();
|
||||
}
|
||||
ol.array.extend(flatCoordinates, lineString.getFlatCoordinates());
|
||||
_ol_array_.extend(flatCoordinates, lineString.getFlatCoordinates());
|
||||
ends.push(flatCoordinates.length);
|
||||
}
|
||||
this.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
};
|
||||
export default _ol_geom_MultiLineString_;
|
||||
|
||||
+39
-37
@@ -1,16 +1,16 @@
|
||||
goog.provide('ol.geom.MultiPoint');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
goog.require('ol.geom.flat.inflate');
|
||||
goog.require('ol.math');
|
||||
|
||||
/**
|
||||
* @module ol/geom/MultiPoint
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -22,11 +22,12 @@ goog.require('ol.math');
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint = function(coordinates, opt_layout) {
|
||||
ol.geom.SimpleGeometry.call(this);
|
||||
var _ol_geom_MultiPoint_ = function(coordinates, opt_layout) {
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
this.setCoordinates(coordinates, opt_layout);
|
||||
};
|
||||
ol.inherits(ol.geom.MultiPoint, ol.geom.SimpleGeometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_MultiPoint_, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,11 +35,11 @@ ol.inherits(ol.geom.MultiPoint, ol.geom.SimpleGeometry);
|
||||
* @param {ol.geom.Point} point Point.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.appendPoint = function(point) {
|
||||
_ol_geom_MultiPoint_.prototype.appendPoint = function(point) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = point.getFlatCoordinates().slice();
|
||||
} else {
|
||||
ol.array.extend(this.flatCoordinates, point.getFlatCoordinates());
|
||||
_ol_array_.extend(this.flatCoordinates, point.getFlatCoordinates());
|
||||
}
|
||||
this.changed();
|
||||
};
|
||||
@@ -50,8 +51,8 @@ ol.geom.MultiPoint.prototype.appendPoint = function(point) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.clone = function() {
|
||||
var multiPoint = new ol.geom.MultiPoint(null);
|
||||
_ol_geom_MultiPoint_.prototype.clone = function() {
|
||||
var multiPoint = new _ol_geom_MultiPoint_(null);
|
||||
multiPoint.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
|
||||
return multiPoint;
|
||||
};
|
||||
@@ -60,16 +61,16 @@ ol.geom.MultiPoint.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_MultiPoint_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var stride = this.stride;
|
||||
var i, ii, j;
|
||||
for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
|
||||
var squaredDistance = ol.math.squaredDistance(
|
||||
var squaredDistance = _ol_math_.squaredDistance(
|
||||
x, y, flatCoordinates[i], flatCoordinates[i + 1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
minSquaredDistance = squaredDistance;
|
||||
@@ -89,8 +90,8 @@ ol.geom.MultiPoint.prototype.closestPointXY = function(x, y, closestPoint, minSq
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.getCoordinates = function() {
|
||||
return ol.geom.flat.inflate.coordinates(
|
||||
_ol_geom_MultiPoint_.prototype.getCoordinates = function() {
|
||||
return _ol_geom_flat_inflate_.coordinates(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
|
||||
};
|
||||
|
||||
@@ -101,13 +102,13 @@ ol.geom.MultiPoint.prototype.getCoordinates = function() {
|
||||
* @return {ol.geom.Point} Point.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.getPoint = function(index) {
|
||||
_ol_geom_MultiPoint_.prototype.getPoint = function(index) {
|
||||
var n = !this.flatCoordinates ?
|
||||
0 : this.flatCoordinates.length / this.stride;
|
||||
if (index < 0 || n <= index) {
|
||||
return null;
|
||||
}
|
||||
var point = new ol.geom.Point(null);
|
||||
var point = new _ol_geom_Point_(null);
|
||||
point.setFlatCoordinates(this.layout, this.flatCoordinates.slice(
|
||||
index * this.stride, (index + 1) * this.stride));
|
||||
return point;
|
||||
@@ -119,7 +120,7 @@ ol.geom.MultiPoint.prototype.getPoint = function(index) {
|
||||
* @return {Array.<ol.geom.Point>} Points.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.getPoints = function() {
|
||||
_ol_geom_MultiPoint_.prototype.getPoints = function() {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var layout = this.layout;
|
||||
var stride = this.stride;
|
||||
@@ -127,7 +128,7 @@ ol.geom.MultiPoint.prototype.getPoints = function() {
|
||||
var points = [];
|
||||
var i, ii;
|
||||
for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
|
||||
var point = new ol.geom.Point(null);
|
||||
var point = new _ol_geom_Point_(null);
|
||||
point.setFlatCoordinates(layout, flatCoordinates.slice(i, i + stride));
|
||||
points.push(point);
|
||||
}
|
||||
@@ -139,8 +140,8 @@ ol.geom.MultiPoint.prototype.getPoints = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.MULTI_POINT;
|
||||
_ol_geom_MultiPoint_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.MULTI_POINT;
|
||||
};
|
||||
|
||||
|
||||
@@ -148,14 +149,14 @@ ol.geom.MultiPoint.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.intersectsExtent = function(extent) {
|
||||
_ol_geom_MultiPoint_.prototype.intersectsExtent = function(extent) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var stride = this.stride;
|
||||
var i, ii, x, y;
|
||||
for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
|
||||
x = flatCoordinates[i];
|
||||
y = flatCoordinates[i + 1];
|
||||
if (ol.extent.containsXY(extent, x, y)) {
|
||||
if (_ol_extent_.containsXY(extent, x, y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -170,15 +171,15 @@ ol.geom.MultiPoint.prototype.intersectsExtent = function(extent) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
_ol_geom_MultiPoint_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 1);
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||
this.flatCoordinates.length = _ol_geom_flat_deflate_.coordinates(
|
||||
this.flatCoordinates, 0, coordinates, this.stride);
|
||||
this.changed();
|
||||
}
|
||||
@@ -189,7 +190,8 @@ ol.geom.MultiPoint.prototype.setCoordinates = function(coordinates, opt_layout)
|
||||
* @param {ol.geom.GeometryLayout} layout Layout.
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
_ol_geom_MultiPoint_.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.changed();
|
||||
};
|
||||
export default _ol_geom_MultiPoint_;
|
||||
|
||||
+69
-67
@@ -1,24 +1,24 @@
|
||||
goog.provide('ol.geom.MultiPolygon');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.area');
|
||||
goog.require('ol.geom.flat.center');
|
||||
goog.require('ol.geom.flat.closest');
|
||||
goog.require('ol.geom.flat.contains');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
goog.require('ol.geom.flat.inflate');
|
||||
goog.require('ol.geom.flat.interiorpoint');
|
||||
goog.require('ol.geom.flat.intersectsextent');
|
||||
goog.require('ol.geom.flat.orient');
|
||||
goog.require('ol.geom.flat.simplify');
|
||||
|
||||
/**
|
||||
* @module ol/geom/MultiPolygon
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
|
||||
import _ol_geom_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';
|
||||
import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
|
||||
import _ol_geom_flat_contains_ from '../geom/flat/contains.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
|
||||
import _ol_geom_flat_interiorpoint_ from '../geom/flat/interiorpoint.js';
|
||||
import _ol_geom_flat_intersectsextent_ from '../geom/flat/intersectsextent.js';
|
||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||
import _ol_geom_flat_simplify_ from '../geom/flat/simplify.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -30,9 +30,9 @@ goog.require('ol.geom.flat.simplify');
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon = function(coordinates, opt_layout) {
|
||||
var _ol_geom_MultiPolygon_ = function(coordinates, opt_layout) {
|
||||
|
||||
ol.geom.SimpleGeometry.call(this);
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
|
||||
/**
|
||||
* @type {Array.<Array.<number>>}
|
||||
@@ -79,7 +79,8 @@ ol.geom.MultiPolygon = function(coordinates, opt_layout) {
|
||||
this.setCoordinates(coordinates, opt_layout);
|
||||
|
||||
};
|
||||
ol.inherits(ol.geom.MultiPolygon, ol.geom.SimpleGeometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_MultiPolygon_, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -87,7 +88,7 @@ ol.inherits(ol.geom.MultiPolygon, ol.geom.SimpleGeometry);
|
||||
* @param {ol.geom.Polygon} polygon Polygon.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
|
||||
_ol_geom_MultiPolygon_.prototype.appendPolygon = function(polygon) {
|
||||
/** @type {Array.<number>} */
|
||||
var ends;
|
||||
if (!this.flatCoordinates) {
|
||||
@@ -96,7 +97,7 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
|
||||
this.endss_.push();
|
||||
} else {
|
||||
var offset = this.flatCoordinates.length;
|
||||
ol.array.extend(this.flatCoordinates, polygon.getFlatCoordinates());
|
||||
_ol_array_.extend(this.flatCoordinates, polygon.getFlatCoordinates());
|
||||
ends = polygon.getEnds().slice();
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
@@ -114,8 +115,8 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.clone = function() {
|
||||
var multiPolygon = new ol.geom.MultiPolygon(null);
|
||||
_ol_geom_MultiPolygon_.prototype.clone = function() {
|
||||
var multiPolygon = new _ol_geom_MultiPolygon_(null);
|
||||
|
||||
var len = this.endss_.length;
|
||||
var newEndss = new Array(len);
|
||||
@@ -132,17 +133,17 @@ ol.geom.MultiPolygon.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_MultiPolygon_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getssMaxSquaredDelta(
|
||||
this.maxDelta_ = Math.sqrt(_ol_geom_flat_closest_.getssMaxSquaredDelta(
|
||||
this.flatCoordinates, 0, this.endss_, this.stride, 0));
|
||||
this.maxDeltaRevision_ = this.getRevision();
|
||||
}
|
||||
return ol.geom.flat.closest.getssClosestPoint(
|
||||
return _ol_geom_flat_closest_.getssClosestPoint(
|
||||
this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride,
|
||||
this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
|
||||
};
|
||||
@@ -151,8 +152,8 @@ ol.geom.MultiPolygon.prototype.closestPointXY = function(x, y, closestPoint, min
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.containsXY = function(x, y) {
|
||||
return ol.geom.flat.contains.linearRingssContainsXY(
|
||||
_ol_geom_MultiPolygon_.prototype.containsXY = function(x, y) {
|
||||
return _ol_geom_flat_contains_.linearRingssContainsXY(
|
||||
this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, x, y);
|
||||
};
|
||||
|
||||
@@ -162,8 +163,8 @@ ol.geom.MultiPolygon.prototype.containsXY = function(x, y) {
|
||||
* @return {number} Area (on projected plane).
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getArea = function() {
|
||||
return ol.geom.flat.area.linearRingss(
|
||||
_ol_geom_MultiPolygon_.prototype.getArea = function() {
|
||||
return _ol_geom_flat_area_.linearRingss(
|
||||
this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride);
|
||||
};
|
||||
|
||||
@@ -182,17 +183,17 @@ ol.geom.MultiPolygon.prototype.getArea = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getCoordinates = function(opt_right) {
|
||||
_ol_geom_MultiPolygon_.prototype.getCoordinates = function(opt_right) {
|
||||
var flatCoordinates;
|
||||
if (opt_right !== undefined) {
|
||||
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
||||
ol.geom.flat.orient.orientLinearRingss(
|
||||
_ol_geom_flat_orient_.orientLinearRingss(
|
||||
flatCoordinates, 0, this.endss_, this.stride, opt_right);
|
||||
} else {
|
||||
flatCoordinates = this.flatCoordinates;
|
||||
}
|
||||
|
||||
return ol.geom.flat.inflate.coordinatesss(
|
||||
return _ol_geom_flat_inflate_.coordinatesss(
|
||||
flatCoordinates, 0, this.endss_, this.stride);
|
||||
};
|
||||
|
||||
@@ -200,7 +201,7 @@ ol.geom.MultiPolygon.prototype.getCoordinates = function(opt_right) {
|
||||
/**
|
||||
* @return {Array.<Array.<number>>} Endss.
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getEndss = function() {
|
||||
_ol_geom_MultiPolygon_.prototype.getEndss = function() {
|
||||
return this.endss_;
|
||||
};
|
||||
|
||||
@@ -208,11 +209,11 @@ ol.geom.MultiPolygon.prototype.getEndss = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Flat interior points.
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getFlatInteriorPoints = function() {
|
||||
_ol_geom_MultiPolygon_.prototype.getFlatInteriorPoints = function() {
|
||||
if (this.flatInteriorPointsRevision_ != this.getRevision()) {
|
||||
var flatCenters = ol.geom.flat.center.linearRingss(
|
||||
var flatCenters = _ol_geom_flat_center_.linearRingss(
|
||||
this.flatCoordinates, 0, this.endss_, this.stride);
|
||||
this.flatInteriorPoints_ = ol.geom.flat.interiorpoint.linearRingss(
|
||||
this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRingss(
|
||||
this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride,
|
||||
flatCenters);
|
||||
this.flatInteriorPointsRevision_ = this.getRevision();
|
||||
@@ -227,9 +228,9 @@ ol.geom.MultiPolygon.prototype.getFlatInteriorPoints = function() {
|
||||
* the length of the horizontal intersection that the point belongs to.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getInteriorPoints = function() {
|
||||
var interiorPoints = new ol.geom.MultiPoint(null);
|
||||
interiorPoints.setFlatCoordinates(ol.geom.GeometryLayout.XYM,
|
||||
_ol_geom_MultiPolygon_.prototype.getInteriorPoints = function() {
|
||||
var interiorPoints = new _ol_geom_MultiPoint_(null);
|
||||
interiorPoints.setFlatCoordinates(_ol_geom_GeometryLayout_.XYM,
|
||||
this.getFlatInteriorPoints().slice());
|
||||
return interiorPoints;
|
||||
};
|
||||
@@ -238,16 +239,16 @@ ol.geom.MultiPolygon.prototype.getInteriorPoints = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Oriented flat coordinates.
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getOrientedFlatCoordinates = function() {
|
||||
_ol_geom_MultiPolygon_.prototype.getOrientedFlatCoordinates = function() {
|
||||
if (this.orientedRevision_ != this.getRevision()) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
if (ol.geom.flat.orient.linearRingssAreOriented(
|
||||
if (_ol_geom_flat_orient_.linearRingssAreOriented(
|
||||
flatCoordinates, 0, this.endss_, this.stride)) {
|
||||
this.orientedFlatCoordinates_ = flatCoordinates;
|
||||
} else {
|
||||
this.orientedFlatCoordinates_ = flatCoordinates.slice();
|
||||
this.orientedFlatCoordinates_.length =
|
||||
ol.geom.flat.orient.orientLinearRingss(
|
||||
_ol_geom_flat_orient_.orientLinearRingss(
|
||||
this.orientedFlatCoordinates_, 0, this.endss_, this.stride);
|
||||
}
|
||||
this.orientedRevision_ = this.getRevision();
|
||||
@@ -259,16 +260,16 @@ ol.geom.MultiPolygon.prototype.getOrientedFlatCoordinates = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
_ol_geom_MultiPolygon_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
var simplifiedFlatCoordinates = [];
|
||||
var simplifiedEndss = [];
|
||||
simplifiedFlatCoordinates.length = ol.geom.flat.simplify.quantizess(
|
||||
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.quantizess(
|
||||
this.flatCoordinates, 0, this.endss_, this.stride,
|
||||
Math.sqrt(squaredTolerance),
|
||||
simplifiedFlatCoordinates, 0, simplifiedEndss);
|
||||
var simplifiedMultiPolygon = new ol.geom.MultiPolygon(null);
|
||||
var simplifiedMultiPolygon = new _ol_geom_MultiPolygon_(null);
|
||||
simplifiedMultiPolygon.setFlatCoordinates(
|
||||
ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates, simplifiedEndss);
|
||||
_ol_geom_GeometryLayout_.XY, simplifiedFlatCoordinates, simplifiedEndss);
|
||||
return simplifiedMultiPolygon;
|
||||
};
|
||||
|
||||
@@ -279,7 +280,7 @@ ol.geom.MultiPolygon.prototype.getSimplifiedGeometryInternal = function(squaredT
|
||||
* @return {ol.geom.Polygon} Polygon.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getPolygon = function(index) {
|
||||
_ol_geom_MultiPolygon_.prototype.getPolygon = function(index) {
|
||||
if (index < 0 || this.endss_.length <= index) {
|
||||
return null;
|
||||
}
|
||||
@@ -298,7 +299,7 @@ ol.geom.MultiPolygon.prototype.getPolygon = function(index) {
|
||||
ends[i] -= offset;
|
||||
}
|
||||
}
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
polygon.setFlatCoordinates(
|
||||
this.layout, this.flatCoordinates.slice(offset, end), ends);
|
||||
return polygon;
|
||||
@@ -310,7 +311,7 @@ ol.geom.MultiPolygon.prototype.getPolygon = function(index) {
|
||||
* @return {Array.<ol.geom.Polygon>} Polygons.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getPolygons = function() {
|
||||
_ol_geom_MultiPolygon_.prototype.getPolygons = function() {
|
||||
var layout = this.layout;
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var endss = this.endss_;
|
||||
@@ -325,7 +326,7 @@ ol.geom.MultiPolygon.prototype.getPolygons = function() {
|
||||
ends[j] -= offset;
|
||||
}
|
||||
}
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
polygon.setFlatCoordinates(
|
||||
layout, flatCoordinates.slice(offset, end), ends);
|
||||
polygons.push(polygon);
|
||||
@@ -339,8 +340,8 @@ ol.geom.MultiPolygon.prototype.getPolygons = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.MULTI_POLYGON;
|
||||
_ol_geom_MultiPolygon_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.MULTI_POLYGON;
|
||||
};
|
||||
|
||||
|
||||
@@ -348,8 +349,8 @@ ol.geom.MultiPolygon.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.intersectsExtent = function(extent) {
|
||||
return ol.geom.flat.intersectsextent.linearRingss(
|
||||
_ol_geom_MultiPolygon_.prototype.intersectsExtent = function(extent) {
|
||||
return _ol_geom_flat_intersectsextent_.linearRingss(
|
||||
this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, extent);
|
||||
};
|
||||
|
||||
@@ -361,15 +362,15 @@ ol.geom.MultiPolygon.prototype.intersectsExtent = function(extent) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
_ol_geom_MultiPolygon_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.endss_);
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null, this.endss_);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 3);
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
var endss = ol.geom.flat.deflate.coordinatesss(
|
||||
var endss = _ol_geom_flat_deflate_.coordinatesss(
|
||||
this.flatCoordinates, 0, coordinates, this.stride, this.endss_);
|
||||
if (endss.length === 0) {
|
||||
this.flatCoordinates.length = 0;
|
||||
@@ -388,7 +389,7 @@ ol.geom.MultiPolygon.prototype.setCoordinates = function(coordinates, opt_layout
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array.<Array.<number>>} endss Endss.
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.setFlatCoordinates = function(layout, flatCoordinates, endss) {
|
||||
_ol_geom_MultiPolygon_.prototype.setFlatCoordinates = function(layout, flatCoordinates, endss) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.endss_ = endss;
|
||||
this.changed();
|
||||
@@ -398,7 +399,7 @@ ol.geom.MultiPolygon.prototype.setFlatCoordinates = function(layout, flatCoordin
|
||||
/**
|
||||
* @param {Array.<ol.geom.Polygon>} polygons Polygons.
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.setPolygons = function(polygons) {
|
||||
_ol_geom_MultiPolygon_.prototype.setPolygons = function(polygons) {
|
||||
var layout = this.getLayout();
|
||||
var flatCoordinates = [];
|
||||
var endss = [];
|
||||
@@ -414,8 +415,9 @@ ol.geom.MultiPolygon.prototype.setPolygons = function(polygons) {
|
||||
for (j = 0, jj = ends.length; j < jj; ++j) {
|
||||
ends[j] += offset;
|
||||
}
|
||||
ol.array.extend(flatCoordinates, polygon.getFlatCoordinates());
|
||||
_ol_array_.extend(flatCoordinates, polygon.getFlatCoordinates());
|
||||
endss.push(ends);
|
||||
}
|
||||
this.setFlatCoordinates(layout, flatCoordinates, endss);
|
||||
};
|
||||
export default _ol_geom_MultiPolygon_;
|
||||
|
||||
+30
-28
@@ -1,13 +1,13 @@
|
||||
goog.provide('ol.geom.Point');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
goog.require('ol.math');
|
||||
|
||||
/**
|
||||
* @module ol/geom/Point
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -19,11 +19,12 @@ goog.require('ol.math');
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Point = function(coordinates, opt_layout) {
|
||||
ol.geom.SimpleGeometry.call(this);
|
||||
var _ol_geom_Point_ = function(coordinates, opt_layout) {
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
this.setCoordinates(coordinates, opt_layout);
|
||||
};
|
||||
ol.inherits(ol.geom.Point, ol.geom.SimpleGeometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_Point_, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -32,8 +33,8 @@ ol.inherits(ol.geom.Point, ol.geom.SimpleGeometry);
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Point.prototype.clone = function() {
|
||||
var point = new ol.geom.Point(null);
|
||||
_ol_geom_Point_.prototype.clone = function() {
|
||||
var point = new _ol_geom_Point_(null);
|
||||
point.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
|
||||
return point;
|
||||
};
|
||||
@@ -42,9 +43,9 @@ ol.geom.Point.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Point.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_Point_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var squaredDistance = ol.math.squaredDistance(
|
||||
var squaredDistance = _ol_math_.squaredDistance(
|
||||
x, y, flatCoordinates[0], flatCoordinates[1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
var stride = this.stride;
|
||||
@@ -66,7 +67,7 @@ ol.geom.Point.prototype.closestPointXY = function(x, y, closestPoint, minSquared
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Point.prototype.getCoordinates = function() {
|
||||
_ol_geom_Point_.prototype.getCoordinates = function() {
|
||||
return !this.flatCoordinates ? [] : this.flatCoordinates.slice();
|
||||
};
|
||||
|
||||
@@ -74,8 +75,8 @@ ol.geom.Point.prototype.getCoordinates = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Point.prototype.computeExtent = function(extent) {
|
||||
return ol.extent.createOrUpdateFromCoordinate(this.flatCoordinates, extent);
|
||||
_ol_geom_Point_.prototype.computeExtent = function(extent) {
|
||||
return _ol_extent_.createOrUpdateFromCoordinate(this.flatCoordinates, extent);
|
||||
};
|
||||
|
||||
|
||||
@@ -83,8 +84,8 @@ ol.geom.Point.prototype.computeExtent = function(extent) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Point.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.POINT;
|
||||
_ol_geom_Point_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.POINT;
|
||||
};
|
||||
|
||||
|
||||
@@ -92,8 +93,8 @@ ol.geom.Point.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Point.prototype.intersectsExtent = function(extent) {
|
||||
return ol.extent.containsXY(extent,
|
||||
_ol_geom_Point_.prototype.intersectsExtent = function(extent) {
|
||||
return _ol_extent_.containsXY(extent,
|
||||
this.flatCoordinates[0], this.flatCoordinates[1]);
|
||||
};
|
||||
|
||||
@@ -102,15 +103,15 @@ ol.geom.Point.prototype.intersectsExtent = function(extent) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Point.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
_ol_geom_Point_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 0);
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinate(
|
||||
this.flatCoordinates.length = _ol_geom_flat_deflate_.coordinate(
|
||||
this.flatCoordinates, 0, coordinates, this.stride);
|
||||
this.changed();
|
||||
}
|
||||
@@ -121,7 +122,8 @@ ol.geom.Point.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
* @param {ol.geom.GeometryLayout} layout Layout.
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
*/
|
||||
ol.geom.Point.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
_ol_geom_Point_.prototype.setFlatCoordinates = function(layout, flatCoordinates) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.changed();
|
||||
};
|
||||
export default _ol_geom_Point_;
|
||||
|
||||
+79
-77
@@ -1,24 +1,24 @@
|
||||
goog.provide('ol.geom.Polygon');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.area');
|
||||
goog.require('ol.geom.flat.closest');
|
||||
goog.require('ol.geom.flat.contains');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
goog.require('ol.geom.flat.inflate');
|
||||
goog.require('ol.geom.flat.interiorpoint');
|
||||
goog.require('ol.geom.flat.intersectsextent');
|
||||
goog.require('ol.geom.flat.orient');
|
||||
goog.require('ol.geom.flat.simplify');
|
||||
goog.require('ol.math');
|
||||
|
||||
/**
|
||||
* @module ol/geom/Polygon
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_area_ from '../geom/flat/area.js';
|
||||
import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
|
||||
import _ol_geom_flat_contains_ from '../geom/flat/contains.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
|
||||
import _ol_geom_flat_interiorpoint_ from '../geom/flat/interiorpoint.js';
|
||||
import _ol_geom_flat_intersectsextent_ from '../geom/flat/intersectsextent.js';
|
||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||
import _ol_geom_flat_simplify_ from '../geom/flat/simplify.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -35,9 +35,9 @@ goog.require('ol.math');
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon = function(coordinates, opt_layout) {
|
||||
var _ol_geom_Polygon_ = function(coordinates, opt_layout) {
|
||||
|
||||
ol.geom.SimpleGeometry.call(this);
|
||||
_ol_geom_SimpleGeometry_.call(this);
|
||||
|
||||
/**
|
||||
* @type {Array.<number>}
|
||||
@@ -84,7 +84,8 @@ ol.geom.Polygon = function(coordinates, opt_layout) {
|
||||
this.setCoordinates(coordinates, opt_layout);
|
||||
|
||||
};
|
||||
ol.inherits(ol.geom.Polygon, ol.geom.SimpleGeometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_Polygon_, _ol_geom_SimpleGeometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -92,11 +93,11 @@ ol.inherits(ol.geom.Polygon, ol.geom.SimpleGeometry);
|
||||
* @param {ol.geom.LinearRing} linearRing Linear ring.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
|
||||
_ol_geom_Polygon_.prototype.appendLinearRing = function(linearRing) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
|
||||
} else {
|
||||
ol.array.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
|
||||
_ol_array_.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
|
||||
}
|
||||
this.ends_.push(this.flatCoordinates.length);
|
||||
this.changed();
|
||||
@@ -109,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);
|
||||
_ol_geom_Polygon_.prototype.clone = function() {
|
||||
var polygon = new _ol_geom_Polygon_(null);
|
||||
polygon.setFlatCoordinates(
|
||||
this.layout, this.flatCoordinates.slice(), this.ends_.slice());
|
||||
return polygon;
|
||||
@@ -120,17 +121,17 @@ ol.geom.Polygon.prototype.clone = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Polygon.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
_ol_geom_Polygon_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||
if (minSquaredDistance <
|
||||
ol.extent.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
_ol_extent_.closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||
return minSquaredDistance;
|
||||
}
|
||||
if (this.maxDeltaRevision_ != this.getRevision()) {
|
||||
this.maxDelta_ = Math.sqrt(ol.geom.flat.closest.getsMaxSquaredDelta(
|
||||
this.maxDelta_ = Math.sqrt(_ol_geom_flat_closest_.getsMaxSquaredDelta(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride, 0));
|
||||
this.maxDeltaRevision_ = this.getRevision();
|
||||
}
|
||||
return ol.geom.flat.closest.getsClosestPoint(
|
||||
return _ol_geom_flat_closest_.getsClosestPoint(
|
||||
this.flatCoordinates, 0, this.ends_, this.stride,
|
||||
this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
|
||||
};
|
||||
@@ -139,8 +140,8 @@ ol.geom.Polygon.prototype.closestPointXY = function(x, y, closestPoint, minSquar
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Polygon.prototype.containsXY = function(x, y) {
|
||||
return ol.geom.flat.contains.linearRingsContainsXY(
|
||||
_ol_geom_Polygon_.prototype.containsXY = function(x, y) {
|
||||
return _ol_geom_flat_contains_.linearRingsContainsXY(
|
||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y);
|
||||
};
|
||||
|
||||
@@ -150,8 +151,8 @@ ol.geom.Polygon.prototype.containsXY = function(x, y) {
|
||||
* @return {number} Area (on projected plane).
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getArea = function() {
|
||||
return ol.geom.flat.area.linearRings(
|
||||
_ol_geom_Polygon_.prototype.getArea = function() {
|
||||
return _ol_geom_flat_area_.linearRings(
|
||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride);
|
||||
};
|
||||
|
||||
@@ -170,17 +171,17 @@ ol.geom.Polygon.prototype.getArea = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getCoordinates = function(opt_right) {
|
||||
_ol_geom_Polygon_.prototype.getCoordinates = function(opt_right) {
|
||||
var flatCoordinates;
|
||||
if (opt_right !== undefined) {
|
||||
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
||||
ol.geom.flat.orient.orientLinearRings(
|
||||
_ol_geom_flat_orient_.orientLinearRings(
|
||||
flatCoordinates, 0, this.ends_, this.stride, opt_right);
|
||||
} else {
|
||||
flatCoordinates = this.flatCoordinates;
|
||||
}
|
||||
|
||||
return ol.geom.flat.inflate.coordinatess(
|
||||
return _ol_geom_flat_inflate_.coordinatess(
|
||||
flatCoordinates, 0, this.ends_, this.stride);
|
||||
};
|
||||
|
||||
@@ -188,7 +189,7 @@ ol.geom.Polygon.prototype.getCoordinates = function(opt_right) {
|
||||
/**
|
||||
* @return {Array.<number>} Ends.
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getEnds = function() {
|
||||
_ol_geom_Polygon_.prototype.getEnds = function() {
|
||||
return this.ends_;
|
||||
};
|
||||
|
||||
@@ -196,10 +197,10 @@ ol.geom.Polygon.prototype.getEnds = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Interior point.
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getFlatInteriorPoint = function() {
|
||||
_ol_geom_Polygon_.prototype.getFlatInteriorPoint = function() {
|
||||
if (this.flatInteriorPointRevision_ != this.getRevision()) {
|
||||
var flatCenter = ol.extent.getCenter(this.getExtent());
|
||||
this.flatInteriorPoint_ = ol.geom.flat.interiorpoint.linearRings(
|
||||
var flatCenter = _ol_extent_.getCenter(this.getExtent());
|
||||
this.flatInteriorPoint_ = _ol_geom_flat_interiorpoint_.linearRings(
|
||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride,
|
||||
flatCenter, 0);
|
||||
this.flatInteriorPointRevision_ = this.getRevision();
|
||||
@@ -214,8 +215,8 @@ ol.geom.Polygon.prototype.getFlatInteriorPoint = function() {
|
||||
* length of the horizontal intersection that the point belongs to.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getInteriorPoint = function() {
|
||||
return new ol.geom.Point(this.getFlatInteriorPoint(), ol.geom.GeometryLayout.XYM);
|
||||
_ol_geom_Polygon_.prototype.getInteriorPoint = function() {
|
||||
return new _ol_geom_Point_(this.getFlatInteriorPoint(), _ol_geom_GeometryLayout_.XYM);
|
||||
};
|
||||
|
||||
|
||||
@@ -226,7 +227,7 @@ ol.geom.Polygon.prototype.getInteriorPoint = function() {
|
||||
* @return {number} Number of rings.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getLinearRingCount = function() {
|
||||
_ol_geom_Polygon_.prototype.getLinearRingCount = function() {
|
||||
return this.ends_.length;
|
||||
};
|
||||
|
||||
@@ -241,11 +242,11 @@ ol.geom.Polygon.prototype.getLinearRingCount = function() {
|
||||
* @return {ol.geom.LinearRing} Linear ring.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getLinearRing = function(index) {
|
||||
_ol_geom_Polygon_.prototype.getLinearRing = function(index) {
|
||||
if (index < 0 || this.ends_.length <= index) {
|
||||
return null;
|
||||
}
|
||||
var linearRing = new ol.geom.LinearRing(null);
|
||||
var linearRing = new _ol_geom_LinearRing_(null);
|
||||
linearRing.setFlatCoordinates(this.layout, this.flatCoordinates.slice(
|
||||
index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]));
|
||||
return linearRing;
|
||||
@@ -257,7 +258,7 @@ ol.geom.Polygon.prototype.getLinearRing = function(index) {
|
||||
* @return {Array.<ol.geom.LinearRing>} Linear rings.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getLinearRings = function() {
|
||||
_ol_geom_Polygon_.prototype.getLinearRings = function() {
|
||||
var layout = this.layout;
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
var ends = this.ends_;
|
||||
@@ -266,7 +267,7 @@ ol.geom.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 _ol_geom_LinearRing_(null);
|
||||
linearRing.setFlatCoordinates(layout, flatCoordinates.slice(offset, end));
|
||||
linearRings.push(linearRing);
|
||||
offset = end;
|
||||
@@ -278,16 +279,16 @@ ol.geom.Polygon.prototype.getLinearRings = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Oriented flat coordinates.
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getOrientedFlatCoordinates = function() {
|
||||
_ol_geom_Polygon_.prototype.getOrientedFlatCoordinates = function() {
|
||||
if (this.orientedRevision_ != this.getRevision()) {
|
||||
var flatCoordinates = this.flatCoordinates;
|
||||
if (ol.geom.flat.orient.linearRingsAreOriented(
|
||||
if (_ol_geom_flat_orient_.linearRingsAreOriented(
|
||||
flatCoordinates, 0, this.ends_, this.stride)) {
|
||||
this.orientedFlatCoordinates_ = flatCoordinates;
|
||||
} else {
|
||||
this.orientedFlatCoordinates_ = flatCoordinates.slice();
|
||||
this.orientedFlatCoordinates_.length =
|
||||
ol.geom.flat.orient.orientLinearRings(
|
||||
_ol_geom_flat_orient_.orientLinearRings(
|
||||
this.orientedFlatCoordinates_, 0, this.ends_, this.stride);
|
||||
}
|
||||
this.orientedRevision_ = this.getRevision();
|
||||
@@ -299,16 +300,16 @@ ol.geom.Polygon.prototype.getOrientedFlatCoordinates = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
_ol_geom_Polygon_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
var simplifiedFlatCoordinates = [];
|
||||
var simplifiedEnds = [];
|
||||
simplifiedFlatCoordinates.length = ol.geom.flat.simplify.quantizes(
|
||||
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 _ol_geom_Polygon_(null);
|
||||
simplifiedPolygon.setFlatCoordinates(
|
||||
ol.geom.GeometryLayout.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
||||
_ol_geom_GeometryLayout_.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
||||
return simplifiedPolygon;
|
||||
};
|
||||
|
||||
@@ -317,8 +318,8 @@ ol.geom.Polygon.prototype.getSimplifiedGeometryInternal = function(squaredTolera
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.POLYGON;
|
||||
_ol_geom_Polygon_.prototype.getType = function() {
|
||||
return _ol_geom_GeometryType_.POLYGON;
|
||||
};
|
||||
|
||||
|
||||
@@ -326,8 +327,8 @@ ol.geom.Polygon.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.intersectsExtent = function(extent) {
|
||||
return ol.geom.flat.intersectsextent.linearRings(
|
||||
_ol_geom_Polygon_.prototype.intersectsExtent = function(extent) {
|
||||
return _ol_geom_flat_intersectsextent_.linearRings(
|
||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent);
|
||||
};
|
||||
|
||||
@@ -339,15 +340,15 @@ ol.geom.Polygon.prototype.intersectsExtent = function(extent) {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
_ol_geom_Polygon_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.ends_);
|
||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null, this.ends_);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 2);
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
var ends = ol.geom.flat.deflate.coordinatess(
|
||||
var ends = _ol_geom_flat_deflate_.coordinatess(
|
||||
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
||||
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
||||
this.changed();
|
||||
@@ -360,7 +361,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) {
|
||||
_ol_geom_Polygon_.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) {
|
||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||
this.ends_ = ends;
|
||||
this.changed();
|
||||
@@ -378,19 +379,19 @@ ol.geom.Polygon.prototype.setFlatCoordinates = function(layout, flatCoordinates,
|
||||
* @return {ol.geom.Polygon} The "circular" polygon.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.circular = function(sphere, center, radius, opt_n) {
|
||||
_ol_geom_Polygon_.circular = function(sphere, center, radius, opt_n) {
|
||||
var n = opt_n ? opt_n : 32;
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = [];
|
||||
var i;
|
||||
for (i = 0; i < n; ++i) {
|
||||
ol.array.extend(
|
||||
_ol_array_.extend(
|
||||
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 _ol_geom_Polygon_(null);
|
||||
polygon.setFlatCoordinates(
|
||||
ol.geom.GeometryLayout.XY, flatCoordinates, [flatCoordinates.length]);
|
||||
_ol_geom_GeometryLayout_.XY, flatCoordinates, [flatCoordinates.length]);
|
||||
return polygon;
|
||||
};
|
||||
|
||||
@@ -401,16 +402,16 @@ ol.geom.Polygon.circular = function(sphere, center, radius, opt_n) {
|
||||
* @return {ol.geom.Polygon} The polygon.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.fromExtent = function(extent) {
|
||||
_ol_geom_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 _ol_geom_Polygon_(null);
|
||||
polygon.setFlatCoordinates(
|
||||
ol.geom.GeometryLayout.XY, flatCoordinates, [flatCoordinates.length]);
|
||||
_ol_geom_GeometryLayout_.XY, flatCoordinates, [flatCoordinates.length]);
|
||||
return polygon;
|
||||
};
|
||||
|
||||
@@ -424,11 +425,11 @@ ol.geom.Polygon.fromExtent = function(extent) {
|
||||
* @return {ol.geom.Polygon} Polygon geometry.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Polygon.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||
_ol_geom_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 _ol_geom_Polygon_(null, layout);
|
||||
var arrayLength = stride * (sides + 1);
|
||||
var flatCoordinates = new Array(arrayLength);
|
||||
for (var i = 0; i < arrayLength; i++) {
|
||||
@@ -436,7 +437,7 @@ ol.geom.Polygon.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||
}
|
||||
var ends = [flatCoordinates.length];
|
||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
ol.geom.Polygon.makeRegular(
|
||||
_ol_geom_Polygon_.makeRegular(
|
||||
polygon, circle.getCenter(), circle.getRadius(), opt_angle);
|
||||
return polygon;
|
||||
};
|
||||
@@ -450,7 +451,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) {
|
||||
_ol_geom_Polygon_.makeRegular = function(polygon, center, radius, opt_angle) {
|
||||
var flatCoordinates = polygon.getFlatCoordinates();
|
||||
var layout = polygon.getLayout();
|
||||
var stride = polygon.getStride();
|
||||
@@ -460,9 +461,10 @@ ol.geom.Polygon.makeRegular = function(polygon, center, radius, opt_angle) {
|
||||
var angle, offset;
|
||||
for (var i = 0; i <= sides; ++i) {
|
||||
offset = i * stride;
|
||||
angle = startAngle + (ol.math.modulo(i, sides) * 2 * Math.PI / sides);
|
||||
angle = startAngle + (_ol_math_.modulo(i, sides) * 2 * Math.PI / sides);
|
||||
flatCoordinates[offset] = center[0] + (radius * Math.cos(angle));
|
||||
flatCoordinates[offset + 1] = center[1] + (radius * Math.sin(angle));
|
||||
}
|
||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
};
|
||||
export default _ol_geom_Polygon_;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
goog.provide('ol.geom.SimpleGeometry');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.functions');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.flat.transform');
|
||||
goog.require('ol.obj');
|
||||
|
||||
/**
|
||||
* @module ol/geom/SimpleGeometry
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_functions_ from '../functions.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_geom_Geometry_ from '../geom/Geometry.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -19,15 +19,15 @@ goog.require('ol.obj');
|
||||
* @extends {ol.geom.Geometry}
|
||||
* @api
|
||||
*/
|
||||
ol.geom.SimpleGeometry = function() {
|
||||
var _ol_geom_SimpleGeometry_ = function() {
|
||||
|
||||
ol.geom.Geometry.call(this);
|
||||
_ol_geom_Geometry_.call(this);
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {ol.geom.GeometryLayout}
|
||||
*/
|
||||
this.layout = ol.geom.GeometryLayout.XY;
|
||||
this.layout = _ol_geom_GeometryLayout_.XY;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
@@ -42,7 +42,8 @@ ol.geom.SimpleGeometry = function() {
|
||||
this.flatCoordinates = null;
|
||||
|
||||
};
|
||||
ol.inherits(ol.geom.SimpleGeometry, ol.geom.Geometry);
|
||||
|
||||
_ol_.inherits(_ol_geom_SimpleGeometry_, _ol_geom_Geometry_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -50,14 +51,14 @@ ol.inherits(ol.geom.SimpleGeometry, ol.geom.Geometry);
|
||||
* @private
|
||||
* @return {ol.geom.GeometryLayout} layout Layout.
|
||||
*/
|
||||
ol.geom.SimpleGeometry.getLayoutForStride_ = function(stride) {
|
||||
_ol_geom_SimpleGeometry_.getLayoutForStride_ = function(stride) {
|
||||
var layout;
|
||||
if (stride == 2) {
|
||||
layout = ol.geom.GeometryLayout.XY;
|
||||
layout = _ol_geom_GeometryLayout_.XY;
|
||||
} else if (stride == 3) {
|
||||
layout = ol.geom.GeometryLayout.XYZ;
|
||||
layout = _ol_geom_GeometryLayout_.XYZ;
|
||||
} else if (stride == 4) {
|
||||
layout = ol.geom.GeometryLayout.XYZM;
|
||||
layout = _ol_geom_GeometryLayout_.XYZM;
|
||||
}
|
||||
return /** @type {ol.geom.GeometryLayout} */ (layout);
|
||||
};
|
||||
@@ -67,13 +68,13 @@ ol.geom.SimpleGeometry.getLayoutForStride_ = function(stride) {
|
||||
* @param {ol.geom.GeometryLayout} layout Layout.
|
||||
* @return {number} Stride.
|
||||
*/
|
||||
ol.geom.SimpleGeometry.getStrideForLayout = function(layout) {
|
||||
_ol_geom_SimpleGeometry_.getStrideForLayout = function(layout) {
|
||||
var stride;
|
||||
if (layout == ol.geom.GeometryLayout.XY) {
|
||||
if (layout == _ol_geom_GeometryLayout_.XY) {
|
||||
stride = 2;
|
||||
} else if (layout == ol.geom.GeometryLayout.XYZ || layout == ol.geom.GeometryLayout.XYM) {
|
||||
} else if (layout == _ol_geom_GeometryLayout_.XYZ || layout == _ol_geom_GeometryLayout_.XYM) {
|
||||
stride = 3;
|
||||
} else if (layout == ol.geom.GeometryLayout.XYZM) {
|
||||
} else if (layout == _ol_geom_GeometryLayout_.XYZM) {
|
||||
stride = 4;
|
||||
}
|
||||
return /** @type {number} */ (stride);
|
||||
@@ -83,14 +84,14 @@ ol.geom.SimpleGeometry.getStrideForLayout = function(layout) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.containsXY = ol.functions.FALSE;
|
||||
_ol_geom_SimpleGeometry_.prototype.containsXY = _ol_functions_.FALSE;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.computeExtent = function(extent) {
|
||||
return ol.extent.createOrUpdateFromFlatCoordinates(
|
||||
_ol_geom_SimpleGeometry_.prototype.computeExtent = function(extent) {
|
||||
return _ol_extent_.createOrUpdateFromFlatCoordinates(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride,
|
||||
extent);
|
||||
};
|
||||
@@ -100,7 +101,7 @@ ol.geom.SimpleGeometry.prototype.computeExtent = function(extent) {
|
||||
* @abstract
|
||||
* @return {Array} Coordinates.
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getCoordinates = function() {};
|
||||
_ol_geom_SimpleGeometry_.prototype.getCoordinates = function() {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -108,7 +109,7 @@ ol.geom.SimpleGeometry.prototype.getCoordinates = function() {};
|
||||
* @return {ol.Coordinate} First coordinate.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getFirstCoordinate = function() {
|
||||
_ol_geom_SimpleGeometry_.prototype.getFirstCoordinate = function() {
|
||||
return this.flatCoordinates.slice(0, this.stride);
|
||||
};
|
||||
|
||||
@@ -116,7 +117,7 @@ ol.geom.SimpleGeometry.prototype.getFirstCoordinate = function() {
|
||||
/**
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getFlatCoordinates = function() {
|
||||
_ol_geom_SimpleGeometry_.prototype.getFlatCoordinates = function() {
|
||||
return this.flatCoordinates;
|
||||
};
|
||||
|
||||
@@ -126,7 +127,7 @@ ol.geom.SimpleGeometry.prototype.getFlatCoordinates = function() {
|
||||
* @return {ol.Coordinate} Last point.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getLastCoordinate = function() {
|
||||
_ol_geom_SimpleGeometry_.prototype.getLastCoordinate = function() {
|
||||
return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride);
|
||||
};
|
||||
|
||||
@@ -136,7 +137,7 @@ ol.geom.SimpleGeometry.prototype.getLastCoordinate = function() {
|
||||
* @return {ol.geom.GeometryLayout} Layout.
|
||||
* @api
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getLayout = function() {
|
||||
_ol_geom_SimpleGeometry_.prototype.getLayout = function() {
|
||||
return this.layout;
|
||||
};
|
||||
|
||||
@@ -144,9 +145,9 @@ ol.geom.SimpleGeometry.prototype.getLayout = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getSimplifiedGeometry = function(squaredTolerance) {
|
||||
_ol_geom_SimpleGeometry_.prototype.getSimplifiedGeometry = function(squaredTolerance) {
|
||||
if (this.simplifiedGeometryRevision != this.getRevision()) {
|
||||
ol.obj.clear(this.simplifiedGeometryCache);
|
||||
_ol_obj_.clear(this.simplifiedGeometryCache);
|
||||
this.simplifiedGeometryMaxMinSquaredTolerance = 0;
|
||||
this.simplifiedGeometryRevision = this.getRevision();
|
||||
}
|
||||
@@ -186,7 +187,7 @@ ol.geom.SimpleGeometry.prototype.getSimplifiedGeometry = function(squaredToleran
|
||||
* @return {ol.geom.SimpleGeometry} Simplified geometry.
|
||||
* @protected
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
_ol_geom_SimpleGeometry_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -194,7 +195,7 @@ ol.geom.SimpleGeometry.prototype.getSimplifiedGeometryInternal = function(square
|
||||
/**
|
||||
* @return {number} Stride.
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getStride = function() {
|
||||
_ol_geom_SimpleGeometry_.prototype.getStride = function() {
|
||||
return this.stride;
|
||||
};
|
||||
|
||||
@@ -204,8 +205,8 @@ ol.geom.SimpleGeometry.prototype.getStride = function() {
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @protected
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.setFlatCoordinatesInternal = function(layout, flatCoordinates) {
|
||||
this.stride = ol.geom.SimpleGeometry.getStrideForLayout(layout);
|
||||
_ol_geom_SimpleGeometry_.prototype.setFlatCoordinatesInternal = function(layout, flatCoordinates) {
|
||||
this.stride = _ol_geom_SimpleGeometry_.getStrideForLayout(layout);
|
||||
this.layout = layout;
|
||||
this.flatCoordinates = flatCoordinates;
|
||||
};
|
||||
@@ -216,7 +217,7 @@ ol.geom.SimpleGeometry.prototype.setFlatCoordinatesInternal = function(layout, f
|
||||
* @param {Array} coordinates Coordinates.
|
||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.setCoordinates = function(coordinates, opt_layout) {};
|
||||
_ol_geom_SimpleGeometry_.prototype.setCoordinates = function(coordinates, opt_layout) {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -225,16 +226,16 @@ ol.geom.SimpleGeometry.prototype.setCoordinates = function(coordinates, opt_layo
|
||||
* @param {number} nesting Nesting.
|
||||
* @protected
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.setLayout = function(layout, coordinates, nesting) {
|
||||
_ol_geom_SimpleGeometry_.prototype.setLayout = function(layout, coordinates, nesting) {
|
||||
/** @type {number} */
|
||||
var stride;
|
||||
if (layout) {
|
||||
stride = ol.geom.SimpleGeometry.getStrideForLayout(layout);
|
||||
stride = _ol_geom_SimpleGeometry_.getStrideForLayout(layout);
|
||||
} else {
|
||||
var i;
|
||||
for (i = 0; i < nesting; ++i) {
|
||||
if (coordinates.length === 0) {
|
||||
this.layout = ol.geom.GeometryLayout.XY;
|
||||
this.layout = _ol_geom_GeometryLayout_.XY;
|
||||
this.stride = 2;
|
||||
return;
|
||||
} else {
|
||||
@@ -242,7 +243,7 @@ ol.geom.SimpleGeometry.prototype.setLayout = function(layout, coordinates, nesti
|
||||
}
|
||||
}
|
||||
stride = coordinates.length;
|
||||
layout = ol.geom.SimpleGeometry.getLayoutForStride_(stride);
|
||||
layout = _ol_geom_SimpleGeometry_.getLayoutForStride_(stride);
|
||||
}
|
||||
this.layout = layout;
|
||||
this.stride = stride;
|
||||
@@ -253,7 +254,7 @@ ol.geom.SimpleGeometry.prototype.setLayout = function(layout, coordinates, nesti
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) {
|
||||
_ol_geom_SimpleGeometry_.prototype.applyTransform = function(transformFn) {
|
||||
if (this.flatCoordinates) {
|
||||
transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);
|
||||
this.changed();
|
||||
@@ -265,11 +266,11 @@ ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.rotate = function(angle, anchor) {
|
||||
_ol_geom_SimpleGeometry_.prototype.rotate = function(angle, anchor) {
|
||||
var flatCoordinates = this.getFlatCoordinates();
|
||||
if (flatCoordinates) {
|
||||
var stride = this.getStride();
|
||||
ol.geom.flat.transform.rotate(
|
||||
_ol_geom_flat_transform_.rotate(
|
||||
flatCoordinates, 0, flatCoordinates.length,
|
||||
stride, angle, anchor, flatCoordinates);
|
||||
this.changed();
|
||||
@@ -281,19 +282,19 @@ ol.geom.SimpleGeometry.prototype.rotate = function(angle, anchor) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
||||
_ol_geom_SimpleGeometry_.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
||||
var sy = opt_sy;
|
||||
if (sy === undefined) {
|
||||
sy = sx;
|
||||
}
|
||||
var anchor = opt_anchor;
|
||||
if (!anchor) {
|
||||
anchor = ol.extent.getCenter(this.getExtent());
|
||||
anchor = _ol_extent_.getCenter(this.getExtent());
|
||||
}
|
||||
var flatCoordinates = this.getFlatCoordinates();
|
||||
if (flatCoordinates) {
|
||||
var stride = this.getStride();
|
||||
ol.geom.flat.transform.scale(
|
||||
_ol_geom_flat_transform_.scale(
|
||||
flatCoordinates, 0, flatCoordinates.length,
|
||||
stride, sx, sy, anchor, flatCoordinates);
|
||||
this.changed();
|
||||
@@ -305,11 +306,11 @@ ol.geom.SimpleGeometry.prototype.scale = function(sx, opt_sy, opt_anchor) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.translate = function(deltaX, deltaY) {
|
||||
_ol_geom_SimpleGeometry_.prototype.translate = function(deltaX, deltaY) {
|
||||
var flatCoordinates = this.getFlatCoordinates();
|
||||
if (flatCoordinates) {
|
||||
var stride = this.getStride();
|
||||
ol.geom.flat.transform.translate(
|
||||
_ol_geom_flat_transform_.translate(
|
||||
flatCoordinates, 0, flatCoordinates.length, stride,
|
||||
deltaX, deltaY, flatCoordinates);
|
||||
this.changed();
|
||||
@@ -323,14 +324,15 @@ ol.geom.SimpleGeometry.prototype.translate = function(deltaX, deltaY) {
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed flat coordinates.
|
||||
*/
|
||||
ol.geom.SimpleGeometry.transform2D = function(simpleGeometry, transform, opt_dest) {
|
||||
_ol_geom_SimpleGeometry_.transform2D = function(simpleGeometry, transform, opt_dest) {
|
||||
var flatCoordinates = simpleGeometry.getFlatCoordinates();
|
||||
if (!flatCoordinates) {
|
||||
return null;
|
||||
} else {
|
||||
var stride = simpleGeometry.getStride();
|
||||
return ol.geom.flat.transform.transform2D(
|
||||
return _ol_geom_flat_transform_.transform2D(
|
||||
flatCoordinates, 0, flatCoordinates.length, stride,
|
||||
transform, opt_dest);
|
||||
}
|
||||
};
|
||||
export default _ol_geom_SimpleGeometry_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.area');
|
||||
/**
|
||||
* @module ol/geom/flat/area
|
||||
*/
|
||||
var _ol_geom_flat_area_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +11,7 @@ goog.provide('ol.geom.flat.area');
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Area.
|
||||
*/
|
||||
ol.geom.flat.area.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_area_.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
var twiceArea = 0;
|
||||
var x1 = flatCoordinates[end - stride];
|
||||
var y1 = flatCoordinates[end - stride + 1];
|
||||
@@ -30,12 +33,12 @@ ol.geom.flat.area.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Area.
|
||||
*/
|
||||
ol.geom.flat.area.linearRings = function(flatCoordinates, offset, ends, stride) {
|
||||
_ol_geom_flat_area_.linearRings = function(flatCoordinates, offset, ends, stride) {
|
||||
var area = 0;
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
area += ol.geom.flat.area.linearRing(flatCoordinates, offset, end, stride);
|
||||
area += _ol_geom_flat_area_.linearRing(flatCoordinates, offset, end, stride);
|
||||
offset = end;
|
||||
}
|
||||
return area;
|
||||
@@ -49,14 +52,15 @@ ol.geom.flat.area.linearRings = function(flatCoordinates, offset, ends, stride)
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Area.
|
||||
*/
|
||||
ol.geom.flat.area.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
_ol_geom_flat_area_.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
var area = 0;
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
area +=
|
||||
ol.geom.flat.area.linearRings(flatCoordinates, offset, ends, stride);
|
||||
_ol_geom_flat_area_.linearRings(flatCoordinates, offset, ends, stride);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
return area;
|
||||
};
|
||||
export default _ol_geom_flat_area_;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.center');
|
||||
|
||||
goog.require('ol.extent');
|
||||
/**
|
||||
* @module ol/geom/flat/center
|
||||
*/
|
||||
import _ol_extent_ from '../../extent.js';
|
||||
var _ol_geom_flat_center_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,16 +12,17 @@ goog.require('ol.extent');
|
||||
* @param {number} stride Stride.
|
||||
* @return {Array.<number>} Flat centers.
|
||||
*/
|
||||
ol.geom.flat.center.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
_ol_geom_flat_center_.linearRingss = function(flatCoordinates, offset, endss, stride) {
|
||||
var flatCenters = [];
|
||||
var i, ii;
|
||||
var extent = ol.extent.createEmpty();
|
||||
var extent = _ol_extent_.createEmpty();
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
extent = ol.extent.createOrUpdateFromFlatCoordinates(
|
||||
extent = _ol_extent_.createOrUpdateFromFlatCoordinates(
|
||||
flatCoordinates, offset, ends[0], stride);
|
||||
flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
return flatCenters;
|
||||
};
|
||||
export default _ol_geom_flat_center_;
|
||||
|
||||
+24
-21
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.closest');
|
||||
|
||||
goog.require('ol.math');
|
||||
/**
|
||||
* @module ol/geom/flat/closest
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
var _ol_geom_flat_closest_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,7 +17,7 @@ goog.require('ol.math');
|
||||
* @param {number} y Y.
|
||||
* @param {Array.<number>} closestPoint Closest point.
|
||||
*/
|
||||
ol.geom.flat.closest.point = function(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) {
|
||||
_ol_geom_flat_closest_.point = function(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) {
|
||||
var x1 = flatCoordinates[offset1];
|
||||
var y1 = flatCoordinates[offset1 + 1];
|
||||
var dx = flatCoordinates[offset2] - x1;
|
||||
@@ -29,7 +31,7 @@ ol.geom.flat.closest.point = function(flatCoordinates, offset1, offset2, stride,
|
||||
offset = offset2;
|
||||
} else if (t > 0) {
|
||||
for (i = 0; i < stride; ++i) {
|
||||
closestPoint[i] = ol.math.lerp(flatCoordinates[offset1 + i],
|
||||
closestPoint[i] = _ol_math_.lerp(flatCoordinates[offset1 + i],
|
||||
flatCoordinates[offset2 + i], t);
|
||||
}
|
||||
closestPoint.length = stride;
|
||||
@@ -55,13 +57,13 @@ ol.geom.flat.closest.point = function(flatCoordinates, offset1, offset2, stride,
|
||||
* @param {number} maxSquaredDelta Max squared delta.
|
||||
* @return {number} Max squared delta.
|
||||
*/
|
||||
ol.geom.flat.closest.getMaxSquaredDelta = function(flatCoordinates, offset, end, stride, maxSquaredDelta) {
|
||||
_ol_geom_flat_closest_.getMaxSquaredDelta = function(flatCoordinates, offset, end, stride, maxSquaredDelta) {
|
||||
var x1 = flatCoordinates[offset];
|
||||
var y1 = flatCoordinates[offset + 1];
|
||||
for (offset += stride; offset < end; offset += stride) {
|
||||
var x2 = flatCoordinates[offset];
|
||||
var y2 = flatCoordinates[offset + 1];
|
||||
var squaredDelta = ol.math.squaredDistance(x1, y1, x2, y2);
|
||||
var squaredDelta = _ol_math_.squaredDistance(x1, y1, x2, y2);
|
||||
if (squaredDelta > maxSquaredDelta) {
|
||||
maxSquaredDelta = squaredDelta;
|
||||
}
|
||||
@@ -80,11 +82,11 @@ ol.geom.flat.closest.getMaxSquaredDelta = function(flatCoordinates, offset, end,
|
||||
* @param {number} maxSquaredDelta Max squared delta.
|
||||
* @return {number} Max squared delta.
|
||||
*/
|
||||
ol.geom.flat.closest.getsMaxSquaredDelta = function(flatCoordinates, offset, ends, stride, maxSquaredDelta) {
|
||||
_ol_geom_flat_closest_.getsMaxSquaredDelta = function(flatCoordinates, offset, ends, stride, maxSquaredDelta) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
maxSquaredDelta = ol.geom.flat.closest.getMaxSquaredDelta(
|
||||
maxSquaredDelta = _ol_geom_flat_closest_.getMaxSquaredDelta(
|
||||
flatCoordinates, offset, end, stride, maxSquaredDelta);
|
||||
offset = end;
|
||||
}
|
||||
@@ -100,11 +102,11 @@ ol.geom.flat.closest.getsMaxSquaredDelta = function(flatCoordinates, offset, end
|
||||
* @param {number} maxSquaredDelta Max squared delta.
|
||||
* @return {number} Max squared delta.
|
||||
*/
|
||||
ol.geom.flat.closest.getssMaxSquaredDelta = function(flatCoordinates, offset, endss, stride, maxSquaredDelta) {
|
||||
_ol_geom_flat_closest_.getssMaxSquaredDelta = function(flatCoordinates, offset, endss, stride, maxSquaredDelta) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
maxSquaredDelta = ol.geom.flat.closest.getsMaxSquaredDelta(
|
||||
maxSquaredDelta = _ol_geom_flat_closest_.getsMaxSquaredDelta(
|
||||
flatCoordinates, offset, ends, stride, maxSquaredDelta);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
@@ -126,7 +128,7 @@ ol.geom.flat.closest.getssMaxSquaredDelta = function(flatCoordinates, offset, en
|
||||
* @param {Array.<number>=} opt_tmpPoint Temporary point object.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
_ol_geom_flat_closest_.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
||||
opt_tmpPoint) {
|
||||
if (offset == end) {
|
||||
@@ -135,7 +137,7 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
var i, squaredDistance;
|
||||
if (maxDelta === 0) {
|
||||
// All points are identical, so just test the first point.
|
||||
squaredDistance = ol.math.squaredDistance(
|
||||
squaredDistance = _ol_math_.squaredDistance(
|
||||
x, y, flatCoordinates[offset], flatCoordinates[offset + 1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -150,9 +152,9 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||
var index = offset + stride;
|
||||
while (index < end) {
|
||||
ol.geom.flat.closest.point(
|
||||
_ol_geom_flat_closest_.point(
|
||||
flatCoordinates, index - stride, index, stride, x, y, tmpPoint);
|
||||
squaredDistance = ol.math.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
squaredDistance = _ol_math_.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
minSquaredDistance = squaredDistance;
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -178,9 +180,9 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
}
|
||||
if (isRing) {
|
||||
// Check the closing segment.
|
||||
ol.geom.flat.closest.point(
|
||||
_ol_geom_flat_closest_.point(
|
||||
flatCoordinates, end - stride, offset, stride, x, y, tmpPoint);
|
||||
squaredDistance = ol.math.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
squaredDistance = _ol_math_.squaredDistance(x, y, tmpPoint[0], tmpPoint[1]);
|
||||
if (squaredDistance < minSquaredDistance) {
|
||||
minSquaredDistance = squaredDistance;
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -207,14 +209,14 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
||||
* @param {Array.<number>=} opt_tmpPoint Temporary point object.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
ol.geom.flat.closest.getsClosestPoint = function(flatCoordinates, offset, ends,
|
||||
_ol_geom_flat_closest_.getsClosestPoint = function(flatCoordinates, offset, ends,
|
||||
stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
||||
opt_tmpPoint) {
|
||||
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
minSquaredDistance = ol.geom.flat.closest.getClosestPoint(
|
||||
minSquaredDistance = _ol_geom_flat_closest_.getClosestPoint(
|
||||
flatCoordinates, offset, end, stride,
|
||||
maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);
|
||||
offset = end;
|
||||
@@ -237,17 +239,18 @@ ol.geom.flat.closest.getsClosestPoint = function(flatCoordinates, offset, ends,
|
||||
* @param {Array.<number>=} opt_tmpPoint Temporary point object.
|
||||
* @return {number} Minimum squared distance.
|
||||
*/
|
||||
ol.geom.flat.closest.getssClosestPoint = function(flatCoordinates, offset,
|
||||
_ol_geom_flat_closest_.getssClosestPoint = function(flatCoordinates, offset,
|
||||
endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
||||
opt_tmpPoint) {
|
||||
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
minSquaredDistance = ol.geom.flat.closest.getsClosestPoint(
|
||||
minSquaredDistance = _ol_geom_flat_closest_.getsClosestPoint(
|
||||
flatCoordinates, offset, ends, stride,
|
||||
maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
return minSquaredDistance;
|
||||
};
|
||||
export default _ol_geom_flat_closest_;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.contains');
|
||||
|
||||
goog.require('ol.extent');
|
||||
/**
|
||||
* @module ol/geom/flat/contains
|
||||
*/
|
||||
import _ol_extent_ from '../../extent.js';
|
||||
var _ol_geom_flat_contains_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -11,14 +13,14 @@ goog.require('ol.extent');
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} Contains extent.
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingContainsExtent = function(flatCoordinates, offset, end, stride, extent) {
|
||||
var outside = ol.extent.forEachCorner(extent,
|
||||
_ol_geom_flat_contains_.linearRingContainsExtent = function(flatCoordinates, offset, end, stride, extent) {
|
||||
var outside = _ol_extent_.forEachCorner(extent,
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
function(coordinate) {
|
||||
return !ol.geom.flat.contains.linearRingContainsXY(flatCoordinates,
|
||||
return !_ol_geom_flat_contains_.linearRingContainsXY(flatCoordinates,
|
||||
offset, end, stride, coordinate[0], coordinate[1]);
|
||||
});
|
||||
return !outside;
|
||||
@@ -34,7 +36,7 @@ ol.geom.flat.contains.linearRingContainsExtent = function(flatCoordinates, offse
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingContainsXY = function(flatCoordinates, offset, end, stride, x, y) {
|
||||
_ol_geom_flat_contains_.linearRingContainsXY = function(flatCoordinates, offset, end, stride, x, y) {
|
||||
// http://geomalgorithms.com/a03-_inclusion.html
|
||||
// Copyright 2000 softSurfer, 2012 Dan Sunday
|
||||
// This code may be freely used and modified for any purpose
|
||||
@@ -71,17 +73,17 @@ ol.geom.flat.contains.linearRingContainsXY = function(flatCoordinates, offset, e
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingsContainsXY = function(flatCoordinates, offset, ends, stride, x, y) {
|
||||
_ol_geom_flat_contains_.linearRingsContainsXY = function(flatCoordinates, offset, ends, stride, x, y) {
|
||||
if (ends.length === 0) {
|
||||
return false;
|
||||
}
|
||||
if (!ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (!_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, ends[0], stride, x, y)) {
|
||||
return false;
|
||||
}
|
||||
var i, ii;
|
||||
for (i = 1, ii = ends.length; i < ii; ++i) {
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, ends[i - 1], ends[i], stride, x, y)) {
|
||||
return false;
|
||||
}
|
||||
@@ -99,14 +101,14 @@ ol.geom.flat.contains.linearRingsContainsXY = function(flatCoordinates, offset,
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
ol.geom.flat.contains.linearRingssContainsXY = function(flatCoordinates, offset, endss, stride, x, y) {
|
||||
_ol_geom_flat_contains_.linearRingssContainsXY = function(flatCoordinates, offset, endss, stride, x, y) {
|
||||
if (endss.length === 0) {
|
||||
return false;
|
||||
}
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
if (ol.geom.flat.contains.linearRingsContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingsContainsXY(
|
||||
flatCoordinates, offset, ends, stride, x, y)) {
|
||||
return true;
|
||||
}
|
||||
@@ -114,3 +116,4 @@ ol.geom.flat.contains.linearRingssContainsXY = function(flatCoordinates, offset,
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default _ol_geom_flat_contains_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.deflate');
|
||||
/**
|
||||
* @module ol/geom/flat/deflate
|
||||
*/
|
||||
var _ol_geom_flat_deflate_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +11,7 @@ goog.provide('ol.geom.flat.deflate');
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} offset Offset.
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinate = function(flatCoordinates, offset, coordinate, stride) {
|
||||
_ol_geom_flat_deflate_.coordinate = function(flatCoordinates, offset, coordinate, stride) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = coordinate.length; i < ii; ++i) {
|
||||
flatCoordinates[offset++] = coordinate[i];
|
||||
@@ -24,7 +27,7 @@ ol.geom.flat.deflate.coordinate = function(flatCoordinates, offset, coordinate,
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} offset Offset.
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinates = function(flatCoordinates, offset, coordinates, stride) {
|
||||
_ol_geom_flat_deflate_.coordinates = function(flatCoordinates, offset, coordinates, stride) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||
var coordinate = coordinates[i];
|
||||
@@ -45,12 +48,12 @@ ol.geom.flat.deflate.coordinates = function(flatCoordinates, offset, coordinates
|
||||
* @param {Array.<number>=} opt_ends Ends.
|
||||
* @return {Array.<number>} Ends.
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinatess = function(flatCoordinates, offset, coordinatess, stride, opt_ends) {
|
||||
_ol_geom_flat_deflate_.coordinatess = function(flatCoordinates, offset, coordinatess, stride, opt_ends) {
|
||||
var ends = opt_ends ? opt_ends : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = coordinatess.length; j < jj; ++j) {
|
||||
var end = ol.geom.flat.deflate.coordinates(
|
||||
var end = _ol_geom_flat_deflate_.coordinates(
|
||||
flatCoordinates, offset, coordinatess[j], stride);
|
||||
ends[i++] = end;
|
||||
offset = end;
|
||||
@@ -68,12 +71,12 @@ ol.geom.flat.deflate.coordinatess = function(flatCoordinates, offset, coordinate
|
||||
* @param {Array.<Array.<number>>=} opt_endss Endss.
|
||||
* @return {Array.<Array.<number>>} Endss.
|
||||
*/
|
||||
ol.geom.flat.deflate.coordinatesss = function(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
|
||||
_ol_geom_flat_deflate_.coordinatesss = function(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
|
||||
var endss = opt_endss ? opt_endss : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = coordinatesss.length; j < jj; ++j) {
|
||||
var ends = ol.geom.flat.deflate.coordinatess(
|
||||
var ends = _ol_geom_flat_deflate_.coordinatess(
|
||||
flatCoordinates, offset, coordinatesss[j], stride, endss[i]);
|
||||
endss[i++] = ends;
|
||||
offset = ends[ends.length - 1];
|
||||
@@ -81,3 +84,4 @@ ol.geom.flat.deflate.coordinatesss = function(flatCoordinates, offset, coordinat
|
||||
endss.length = i;
|
||||
return endss;
|
||||
};
|
||||
export default _ol_geom_flat_deflate_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.flip');
|
||||
/**
|
||||
* @module ol/geom/flat/flip
|
||||
*/
|
||||
var _ol_geom_flat_flip_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,7 +13,7 @@ goog.provide('ol.geom.flat.flip');
|
||||
* @param {number=} opt_destOffset Destination offset.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.flip.flipXY = function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
|
||||
_ol_geom_flat_flip_.flipXY = function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
|
||||
var dest, destOffset;
|
||||
if (opt_dest !== undefined) {
|
||||
dest = opt_dest;
|
||||
@@ -31,3 +34,4 @@ ol.geom.flat.flip.flipXY = function(flatCoordinates, offset, end, stride, opt_de
|
||||
dest.length = destOffset;
|
||||
return dest;
|
||||
};
|
||||
export default _ol_geom_flat_flip_;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
goog.provide('ol.geom.flat.geodesic');
|
||||
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.proj');
|
||||
/**
|
||||
* @module ol/geom/flat/geodesic
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
import _ol_proj_ from '../../proj.js';
|
||||
var _ol_geom_flat_geodesic_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -12,7 +14,7 @@ goog.require('ol.proj');
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.geodesic.line_ = function(interpolate, transform, squaredTolerance) {
|
||||
_ol_geom_flat_geodesic_.line_ = function(interpolate, transform, squaredTolerance) {
|
||||
// FIXME reduce garbage generation
|
||||
// FIXME optimize stack operations
|
||||
|
||||
@@ -57,7 +59,7 @@ ol.geom.flat.geodesic.line_ = function(interpolate, transform, squaredTolerance)
|
||||
fracM = (fracA + fracB) / 2;
|
||||
geoM = interpolate(fracM);
|
||||
m = transform(geoM);
|
||||
if (ol.math.squaredSegmentDistance(m[0], m[1], a[0], a[1],
|
||||
if (_ol_math_.squaredSegmentDistance(m[0], m[1], a[0], a[1],
|
||||
b[0], b[1]) < squaredTolerance) {
|
||||
// If the m point is sufficiently close to the straight line, then we
|
||||
// discard it. Just use the b coordinate and move on to the next line
|
||||
@@ -88,20 +90,20 @@ ol.geom.flat.geodesic.line_ = function(interpolate, transform, squaredTolerance)
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.geodesic.greatCircleArc = function(
|
||||
_ol_geom_flat_geodesic_.greatCircleArc = function(
|
||||
lon1, lat1, lon2, lat2, projection, squaredTolerance) {
|
||||
|
||||
var geoProjection = ol.proj.get('EPSG:4326');
|
||||
var geoProjection = _ol_proj_.get('EPSG:4326');
|
||||
|
||||
var cosLat1 = Math.cos(ol.math.toRadians(lat1));
|
||||
var sinLat1 = Math.sin(ol.math.toRadians(lat1));
|
||||
var cosLat2 = Math.cos(ol.math.toRadians(lat2));
|
||||
var sinLat2 = Math.sin(ol.math.toRadians(lat2));
|
||||
var cosDeltaLon = Math.cos(ol.math.toRadians(lon2 - lon1));
|
||||
var sinDeltaLon = Math.sin(ol.math.toRadians(lon2 - lon1));
|
||||
var cosLat1 = Math.cos(_ol_math_.toRadians(lat1));
|
||||
var sinLat1 = Math.sin(_ol_math_.toRadians(lat1));
|
||||
var cosLat2 = Math.cos(_ol_math_.toRadians(lat2));
|
||||
var sinLat2 = Math.sin(_ol_math_.toRadians(lat2));
|
||||
var cosDeltaLon = Math.cos(_ol_math_.toRadians(lon2 - lon1));
|
||||
var sinDeltaLon = Math.sin(_ol_math_.toRadians(lon2 - lon1));
|
||||
var d = sinLat1 * sinLat2 + cosLat1 * cosLat2 * cosDeltaLon;
|
||||
|
||||
return ol.geom.flat.geodesic.line_(
|
||||
return _ol_geom_flat_geodesic_.line_(
|
||||
/**
|
||||
* @param {number} frac Fraction.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
@@ -117,11 +119,11 @@ ol.geom.flat.geodesic.greatCircleArc = function(
|
||||
var x = cosLat1 * sinLat2 - sinLat1 * cosLat2 * cosDeltaLon;
|
||||
var theta = Math.atan2(y, x);
|
||||
var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));
|
||||
var lon = ol.math.toRadians(lon1) +
|
||||
var lon = _ol_math_.toRadians(lon1) +
|
||||
Math.atan2(Math.sin(theta) * sinD * cosLat1,
|
||||
cosD - sinLat1 * Math.sin(lat));
|
||||
return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)];
|
||||
}, ol.proj.getTransform(geoProjection, projection), squaredTolerance);
|
||||
return [_ol_math_.toDegrees(lon), _ol_math_.toDegrees(lat)];
|
||||
}, _ol_proj_.getTransform(geoProjection, projection), squaredTolerance);
|
||||
};
|
||||
|
||||
|
||||
@@ -134,9 +136,9 @@ ol.geom.flat.geodesic.greatCircleArc = function(
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.geodesic.meridian = function(lon, lat1, lat2, projection, squaredTolerance) {
|
||||
var epsg4326Projection = ol.proj.get('EPSG:4326');
|
||||
return ol.geom.flat.geodesic.line_(
|
||||
_ol_geom_flat_geodesic_.meridian = function(lon, lat1, lat2, projection, squaredTolerance) {
|
||||
var epsg4326Projection = _ol_proj_.get('EPSG:4326');
|
||||
return _ol_geom_flat_geodesic_.line_(
|
||||
/**
|
||||
* @param {number} frac Fraction.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
@@ -144,7 +146,7 @@ ol.geom.flat.geodesic.meridian = function(lon, lat1, lat2, projection, squaredTo
|
||||
function(frac) {
|
||||
return [lon, lat1 + ((lat2 - lat1) * frac)];
|
||||
},
|
||||
ol.proj.getTransform(epsg4326Projection, projection), squaredTolerance);
|
||||
_ol_proj_.getTransform(epsg4326Projection, projection), squaredTolerance);
|
||||
};
|
||||
|
||||
|
||||
@@ -157,9 +159,9 @@ ol.geom.flat.geodesic.meridian = function(lon, lat1, lat2, projection, squaredTo
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.geom.flat.geodesic.parallel = function(lat, lon1, lon2, projection, squaredTolerance) {
|
||||
var epsg4326Projection = ol.proj.get('EPSG:4326');
|
||||
return ol.geom.flat.geodesic.line_(
|
||||
_ol_geom_flat_geodesic_.parallel = function(lat, lon1, lon2, projection, squaredTolerance) {
|
||||
var epsg4326Projection = _ol_proj_.get('EPSG:4326');
|
||||
return _ol_geom_flat_geodesic_.line_(
|
||||
/**
|
||||
* @param {number} frac Fraction.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
@@ -167,5 +169,6 @@ ol.geom.flat.geodesic.parallel = function(lat, lon1, lon2, projection, squaredTo
|
||||
function(frac) {
|
||||
return [lon1 + ((lon2 - lon1) * frac), lat];
|
||||
},
|
||||
ol.proj.getTransform(epsg4326Projection, projection), squaredTolerance);
|
||||
_ol_proj_.getTransform(epsg4326Projection, projection), squaredTolerance);
|
||||
};
|
||||
export default _ol_geom_flat_geodesic_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.inflate');
|
||||
/**
|
||||
* @module ol/geom/flat/inflate
|
||||
*/
|
||||
var _ol_geom_flat_inflate_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -9,7 +12,7 @@ goog.provide('ol.geom.flat.inflate');
|
||||
* @param {Array.<ol.Coordinate>=} opt_coordinates Coordinates.
|
||||
* @return {Array.<ol.Coordinate>} Coordinates.
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinates = function(flatCoordinates, offset, end, stride, opt_coordinates) {
|
||||
_ol_geom_flat_inflate_.coordinates = function(flatCoordinates, offset, end, stride, opt_coordinates) {
|
||||
var coordinates = opt_coordinates !== undefined ? opt_coordinates : [];
|
||||
var i = 0;
|
||||
var j;
|
||||
@@ -29,13 +32,13 @@ ol.geom.flat.inflate.coordinates = function(flatCoordinates, offset, end, stride
|
||||
* @param {Array.<Array.<ol.Coordinate>>=} opt_coordinatess Coordinatess.
|
||||
* @return {Array.<Array.<ol.Coordinate>>} Coordinatess.
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinatess = function(flatCoordinates, offset, ends, stride, opt_coordinatess) {
|
||||
_ol_geom_flat_inflate_.coordinatess = function(flatCoordinates, offset, ends, stride, opt_coordinatess) {
|
||||
var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = ends.length; j < jj; ++j) {
|
||||
var end = ends[j];
|
||||
coordinatess[i++] = ol.geom.flat.inflate.coordinates(
|
||||
coordinatess[i++] = _ol_geom_flat_inflate_.coordinates(
|
||||
flatCoordinates, offset, end, stride, coordinatess[i]);
|
||||
offset = end;
|
||||
}
|
||||
@@ -53,16 +56,17 @@ ol.geom.flat.inflate.coordinatess = function(flatCoordinates, offset, ends, stri
|
||||
* Coordinatesss.
|
||||
* @return {Array.<Array.<Array.<ol.Coordinate>>>} Coordinatesss.
|
||||
*/
|
||||
ol.geom.flat.inflate.coordinatesss = function(flatCoordinates, offset, endss, stride, opt_coordinatesss) {
|
||||
_ol_geom_flat_inflate_.coordinatesss = function(flatCoordinates, offset, endss, stride, opt_coordinatesss) {
|
||||
var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : [];
|
||||
var i = 0;
|
||||
var j, jj;
|
||||
for (j = 0, jj = endss.length; j < jj; ++j) {
|
||||
var ends = endss[j];
|
||||
coordinatesss[i++] = ol.geom.flat.inflate.coordinatess(
|
||||
coordinatesss[i++] = _ol_geom_flat_inflate_.coordinatess(
|
||||
flatCoordinates, offset, ends, stride, coordinatesss[i]);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
coordinatesss.length = i;
|
||||
return coordinatesss;
|
||||
};
|
||||
export default _ol_geom_flat_inflate_;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
goog.provide('ol.geom.flat.interiorpoint');
|
||||
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.geom.flat.contains');
|
||||
/**
|
||||
* @module ol/geom/flat/interiorpoint
|
||||
*/
|
||||
import _ol_array_ from '../../array.js';
|
||||
import _ol_geom_flat_contains_ from '../flat/contains.js';
|
||||
var _ol_geom_flat_interiorpoint_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,7 +19,7 @@ goog.require('ol.geom.flat.contains');
|
||||
* @return {Array.<number>} Destination point as XYM coordinate, where M is the
|
||||
* length of the horizontal intersection that the point belongs to.
|
||||
*/
|
||||
ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
|
||||
_ol_geom_flat_interiorpoint_.linearRings = function(flatCoordinates, offset,
|
||||
ends, stride, flatCenters, flatCentersOffset, opt_dest) {
|
||||
var i, ii, x, x1, x2, y1, y2;
|
||||
var y = flatCenters[flatCentersOffset + 1];
|
||||
@@ -43,14 +45,14 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
|
||||
// inside the linear ring.
|
||||
var pointX = NaN;
|
||||
var maxSegmentLength = -Infinity;
|
||||
intersections.sort(ol.array.numberSafeCompareFunction);
|
||||
intersections.sort(_ol_array_.numberSafeCompareFunction);
|
||||
x1 = intersections[0];
|
||||
for (i = 1, ii = intersections.length; i < ii; ++i) {
|
||||
x2 = intersections[i];
|
||||
var segmentLength = Math.abs(x2 - x1);
|
||||
if (segmentLength > maxSegmentLength) {
|
||||
x = (x1 + x2) / 2;
|
||||
if (ol.geom.flat.contains.linearRingsContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingsContainsXY(
|
||||
flatCoordinates, offset, ends, stride, x, y)) {
|
||||
pointX = x;
|
||||
maxSegmentLength = segmentLength;
|
||||
@@ -81,14 +83,15 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
|
||||
* @return {Array.<number>} Interior points as XYM coordinates, where M is the
|
||||
* length of the horizontal intersection that the point belongs to.
|
||||
*/
|
||||
ol.geom.flat.interiorpoint.linearRingss = function(flatCoordinates, offset, endss, stride, flatCenters) {
|
||||
_ol_geom_flat_interiorpoint_.linearRingss = function(flatCoordinates, offset, endss, stride, flatCenters) {
|
||||
var interiorPoints = [];
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
interiorPoints = ol.geom.flat.interiorpoint.linearRings(flatCoordinates,
|
||||
interiorPoints = _ol_geom_flat_interiorpoint_.linearRings(flatCoordinates,
|
||||
offset, ends, stride, flatCenters, 2 * i, interiorPoints);
|
||||
offset = ends[ends.length - 1];
|
||||
}
|
||||
return interiorPoints;
|
||||
};
|
||||
export default _ol_geom_flat_interiorpoint_;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
goog.provide('ol.geom.flat.interpolate');
|
||||
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.math');
|
||||
/**
|
||||
* @module ol/geom/flat/interpolate
|
||||
*/
|
||||
import _ol_array_ from '../../array.js';
|
||||
import _ol_math_ from '../../math.js';
|
||||
var _ol_geom_flat_interpolate_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,7 +15,7 @@ goog.require('ol.math');
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Destination.
|
||||
*/
|
||||
ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, stride, fraction, opt_dest) {
|
||||
_ol_geom_flat_interpolate_.lineString = function(flatCoordinates, offset, end, stride, fraction, opt_dest) {
|
||||
var pointX = NaN;
|
||||
var pointY = NaN;
|
||||
var n = (end - offset) / stride;
|
||||
@@ -40,14 +42,14 @@ ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, str
|
||||
y1 = y2;
|
||||
}
|
||||
var target = fraction * length;
|
||||
var index = ol.array.binarySearch(cumulativeLengths, target);
|
||||
var index = _ol_array_.binarySearch(cumulativeLengths, target);
|
||||
if (index < 0) {
|
||||
var t = (target - cumulativeLengths[-index - 2]) /
|
||||
(cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);
|
||||
var o = offset + (-index - 2) * stride;
|
||||
pointX = ol.math.lerp(
|
||||
pointX = _ol_math_.lerp(
|
||||
flatCoordinates[o], flatCoordinates[o + stride], t);
|
||||
pointY = ol.math.lerp(
|
||||
pointY = _ol_math_.lerp(
|
||||
flatCoordinates[o + 1], flatCoordinates[o + stride + 1], t);
|
||||
} else {
|
||||
pointX = flatCoordinates[offset + index * stride];
|
||||
@@ -73,7 +75,7 @@ ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, str
|
||||
* @param {boolean} extrapolate Extrapolate.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
*/
|
||||
ol.geom.flat.interpolate.lineStringCoordinateAtM = function(flatCoordinates, offset, end, stride, m, extrapolate) {
|
||||
_ol_geom_flat_interpolate_.lineStringCoordinateAtM = function(flatCoordinates, offset, end, stride, m, extrapolate) {
|
||||
if (end == offset) {
|
||||
return null;
|
||||
}
|
||||
@@ -118,7 +120,7 @@ ol.geom.flat.interpolate.lineStringCoordinateAtM = function(flatCoordinates, off
|
||||
coordinate = [];
|
||||
var i;
|
||||
for (i = 0; i < stride - 1; ++i) {
|
||||
coordinate.push(ol.math.lerp(flatCoordinates[(lo - 1) * stride + i],
|
||||
coordinate.push(_ol_math_.lerp(flatCoordinates[(lo - 1) * stride + i],
|
||||
flatCoordinates[lo * stride + i], t));
|
||||
}
|
||||
coordinate.push(m);
|
||||
@@ -136,10 +138,10 @@ ol.geom.flat.interpolate.lineStringCoordinateAtM = function(flatCoordinates, off
|
||||
* @param {boolean} interpolate Interpolate.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
*/
|
||||
ol.geom.flat.interpolate.lineStringsCoordinateAtM = function(
|
||||
_ol_geom_flat_interpolate_.lineStringsCoordinateAtM = function(
|
||||
flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) {
|
||||
if (interpolate) {
|
||||
return ol.geom.flat.interpolate.lineStringCoordinateAtM(
|
||||
return _ol_geom_flat_interpolate_.lineStringCoordinateAtM(
|
||||
flatCoordinates, offset, ends[ends.length - 1], stride, m, extrapolate);
|
||||
}
|
||||
var coordinate;
|
||||
@@ -170,10 +172,11 @@ ol.geom.flat.interpolate.lineStringsCoordinateAtM = function(
|
||||
if (m < flatCoordinates[offset + stride - 1]) {
|
||||
return null;
|
||||
} else if (m <= flatCoordinates[end - 1]) {
|
||||
return ol.geom.flat.interpolate.lineStringCoordinateAtM(
|
||||
return _ol_geom_flat_interpolate_.lineStringCoordinateAtM(
|
||||
flatCoordinates, offset, end, stride, m, false);
|
||||
}
|
||||
offset = end;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
export default _ol_geom_flat_interpolate_;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
goog.provide('ol.geom.flat.intersectsextent');
|
||||
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.flat.contains');
|
||||
goog.require('ol.geom.flat.segments');
|
||||
/**
|
||||
* @module ol/geom/flat/intersectsextent
|
||||
*/
|
||||
import _ol_extent_ from '../../extent.js';
|
||||
import _ol_geom_flat_contains_ from '../flat/contains.js';
|
||||
import _ol_geom_flat_segments_ from '../flat/segments.js';
|
||||
var _ol_geom_flat_intersectsextent_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,13 +15,13 @@ goog.require('ol.geom.flat.segments');
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.lineString = function(flatCoordinates, offset, end, stride, extent) {
|
||||
var coordinatesExtent = ol.extent.extendFlatCoordinates(
|
||||
ol.extent.createEmpty(), flatCoordinates, offset, end, stride);
|
||||
if (!ol.extent.intersects(extent, coordinatesExtent)) {
|
||||
_ol_geom_flat_intersectsextent_.lineString = function(flatCoordinates, offset, end, stride, extent) {
|
||||
var coordinatesExtent = _ol_extent_.extendFlatCoordinates(
|
||||
_ol_extent_.createEmpty(), flatCoordinates, offset, end, stride);
|
||||
if (!_ol_extent_.intersects(extent, coordinatesExtent)) {
|
||||
return false;
|
||||
}
|
||||
if (ol.extent.containsExtent(extent, coordinatesExtent)) {
|
||||
if (_ol_extent_.containsExtent(extent, coordinatesExtent)) {
|
||||
return true;
|
||||
}
|
||||
if (coordinatesExtent[0] >= extent[0] &&
|
||||
@@ -30,7 +32,7 @@ ol.geom.flat.intersectsextent.lineString = function(flatCoordinates, offset, end
|
||||
coordinatesExtent[3] <= extent[3]) {
|
||||
return true;
|
||||
}
|
||||
return ol.geom.flat.segments.forEach(flatCoordinates, offset, end, stride,
|
||||
return _ol_geom_flat_segments_.forEach(flatCoordinates, offset, end, stride,
|
||||
/**
|
||||
* @param {ol.Coordinate} point1 Start point.
|
||||
* @param {ol.Coordinate} point2 End point.
|
||||
@@ -38,7 +40,7 @@ ol.geom.flat.intersectsextent.lineString = function(flatCoordinates, offset, end
|
||||
* `false` otherwise.
|
||||
*/
|
||||
function(point1, point2) {
|
||||
return ol.extent.intersectsSegment(extent, point1, point2);
|
||||
return _ol_extent_.intersectsSegment(extent, point1, point2);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -51,10 +53,10 @@ ol.geom.flat.intersectsextent.lineString = function(flatCoordinates, offset, end
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.lineStrings = function(flatCoordinates, offset, ends, stride, extent) {
|
||||
_ol_geom_flat_intersectsextent_.lineStrings = function(flatCoordinates, offset, ends, stride, extent) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
if (ol.geom.flat.intersectsextent.lineString(
|
||||
if (_ol_geom_flat_intersectsextent_.lineString(
|
||||
flatCoordinates, offset, ends[i], stride, extent)) {
|
||||
return true;
|
||||
}
|
||||
@@ -72,24 +74,24 @@ ol.geom.flat.intersectsextent.lineStrings = function(flatCoordinates, offset, en
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.linearRing = function(flatCoordinates, offset, end, stride, extent) {
|
||||
if (ol.geom.flat.intersectsextent.lineString(
|
||||
_ol_geom_flat_intersectsextent_.linearRing = function(flatCoordinates, offset, end, stride, extent) {
|
||||
if (_ol_geom_flat_intersectsextent_.lineString(
|
||||
flatCoordinates, offset, end, stride, extent)) {
|
||||
return true;
|
||||
}
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, end, stride, extent[0], extent[1])) {
|
||||
return true;
|
||||
}
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, end, stride, extent[0], extent[3])) {
|
||||
return true;
|
||||
}
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, end, stride, extent[2], extent[1])) {
|
||||
return true;
|
||||
}
|
||||
if (ol.geom.flat.contains.linearRingContainsXY(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsXY(
|
||||
flatCoordinates, offset, end, stride, extent[2], extent[3])) {
|
||||
return true;
|
||||
}
|
||||
@@ -105,8 +107,8 @@ ol.geom.flat.intersectsextent.linearRing = function(flatCoordinates, offset, end
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.linearRings = function(flatCoordinates, offset, ends, stride, extent) {
|
||||
if (!ol.geom.flat.intersectsextent.linearRing(
|
||||
_ol_geom_flat_intersectsextent_.linearRings = function(flatCoordinates, offset, ends, stride, extent) {
|
||||
if (!_ol_geom_flat_intersectsextent_.linearRing(
|
||||
flatCoordinates, offset, ends[0], stride, extent)) {
|
||||
return false;
|
||||
}
|
||||
@@ -115,7 +117,7 @@ ol.geom.flat.intersectsextent.linearRings = function(flatCoordinates, offset, en
|
||||
}
|
||||
var i, ii;
|
||||
for (i = 1, ii = ends.length; i < ii; ++i) {
|
||||
if (ol.geom.flat.contains.linearRingContainsExtent(
|
||||
if (_ol_geom_flat_contains_.linearRingContainsExtent(
|
||||
flatCoordinates, ends[i - 1], ends[i], stride, extent)) {
|
||||
return false;
|
||||
}
|
||||
@@ -132,11 +134,11 @@ ol.geom.flat.intersectsextent.linearRings = function(flatCoordinates, offset, en
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {boolean} True if the geometry and the extent intersect.
|
||||
*/
|
||||
ol.geom.flat.intersectsextent.linearRingss = function(flatCoordinates, offset, endss, stride, extent) {
|
||||
_ol_geom_flat_intersectsextent_.linearRingss = function(flatCoordinates, offset, endss, stride, extent) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
if (ol.geom.flat.intersectsextent.linearRings(
|
||||
if (_ol_geom_flat_intersectsextent_.linearRings(
|
||||
flatCoordinates, offset, ends, stride, extent)) {
|
||||
return true;
|
||||
}
|
||||
@@ -144,3 +146,4 @@ ol.geom.flat.intersectsextent.linearRingss = function(flatCoordinates, offset, e
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default _ol_geom_flat_intersectsextent_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.length');
|
||||
/**
|
||||
* @module ol/geom/flat/length
|
||||
*/
|
||||
var _ol_geom_flat_length_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -8,7 +11,7 @@ goog.provide('ol.geom.flat.length');
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Length.
|
||||
*/
|
||||
ol.geom.flat.length.lineString = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_length_.lineString = function(flatCoordinates, offset, end, stride) {
|
||||
var x1 = flatCoordinates[offset];
|
||||
var y1 = flatCoordinates[offset + 1];
|
||||
var length = 0;
|
||||
@@ -31,11 +34,12 @@ ol.geom.flat.length.lineString = function(flatCoordinates, offset, end, stride)
|
||||
* @param {number} stride Stride.
|
||||
* @return {number} Perimeter.
|
||||
*/
|
||||
ol.geom.flat.length.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_length_.linearRing = function(flatCoordinates, offset, end, stride) {
|
||||
var perimeter =
|
||||
ol.geom.flat.length.lineString(flatCoordinates, offset, end, stride);
|
||||
_ol_geom_flat_length_.lineString(flatCoordinates, offset, end, stride);
|
||||
var dx = flatCoordinates[end - stride] - flatCoordinates[offset];
|
||||
var dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];
|
||||
perimeter += Math.sqrt(dx * dx + dy * dy);
|
||||
return perimeter;
|
||||
};
|
||||
export default _ol_geom_flat_length_;
|
||||
|
||||
+16
-13
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.orient');
|
||||
|
||||
goog.require('ol.geom.flat.reverse');
|
||||
/**
|
||||
* @module ol/geom/flat/orient
|
||||
*/
|
||||
import _ol_geom_flat_reverse_ from '../flat/reverse.js';
|
||||
var _ol_geom_flat_orient_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,7 +12,7 @@ goog.require('ol.geom.flat.reverse');
|
||||
* @param {number} stride Stride.
|
||||
* @return {boolean} Is clockwise.
|
||||
*/
|
||||
ol.geom.flat.orient.linearRingIsClockwise = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_orient_.linearRingIsClockwise = function(flatCoordinates, offset, end, stride) {
|
||||
// http://tinyurl.com/clockwise-method
|
||||
// https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrlinearring.cpp
|
||||
var edge = 0;
|
||||
@@ -40,12 +42,12 @@ ol.geom.flat.orient.linearRingIsClockwise = function(flatCoordinates, offset, en
|
||||
* (counter-clockwise exterior ring and clockwise interior rings).
|
||||
* @return {boolean} Rings are correctly oriented.
|
||||
*/
|
||||
ol.geom.flat.orient.linearRingsAreOriented = function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||
_ol_geom_flat_orient_.linearRingsAreOriented = function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||
var right = opt_right !== undefined ? opt_right : false;
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
|
||||
var isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
|
||||
flatCoordinates, offset, end, stride);
|
||||
if (i === 0) {
|
||||
if ((right && isClockwise) || (!right && !isClockwise)) {
|
||||
@@ -75,10 +77,10 @@ ol.geom.flat.orient.linearRingsAreOriented = function(flatCoordinates, offset, e
|
||||
* (counter-clockwise exterior ring and clockwise interior rings).
|
||||
* @return {boolean} Rings are correctly oriented.
|
||||
*/
|
||||
ol.geom.flat.orient.linearRingssAreOriented = function(flatCoordinates, offset, endss, stride, opt_right) {
|
||||
_ol_geom_flat_orient_.linearRingssAreOriented = function(flatCoordinates, offset, endss, stride, opt_right) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
if (!ol.geom.flat.orient.linearRingsAreOriented(
|
||||
if (!_ol_geom_flat_orient_.linearRingsAreOriented(
|
||||
flatCoordinates, offset, endss[i], stride, opt_right)) {
|
||||
return false;
|
||||
}
|
||||
@@ -100,18 +102,18 @@ ol.geom.flat.orient.linearRingssAreOriented = function(flatCoordinates, offset,
|
||||
* @param {boolean=} opt_right Follow the right-hand rule for orientation.
|
||||
* @return {number} End.
|
||||
*/
|
||||
ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||
_ol_geom_flat_orient_.orientLinearRings = function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||
var right = opt_right !== undefined ? opt_right : false;
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
|
||||
var isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
|
||||
flatCoordinates, offset, end, stride);
|
||||
var reverse = i === 0 ?
|
||||
(right && isClockwise) || (!right && !isClockwise) :
|
||||
(right && !isClockwise) || (!right && isClockwise);
|
||||
if (reverse) {
|
||||
ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride);
|
||||
_ol_geom_flat_reverse_.coordinates(flatCoordinates, offset, end, stride);
|
||||
}
|
||||
offset = end;
|
||||
}
|
||||
@@ -132,11 +134,12 @@ ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends,
|
||||
* @param {boolean=} opt_right Follow the right-hand rule for orientation.
|
||||
* @return {number} End.
|
||||
*/
|
||||
ol.geom.flat.orient.orientLinearRingss = function(flatCoordinates, offset, endss, stride, opt_right) {
|
||||
_ol_geom_flat_orient_.orientLinearRingss = function(flatCoordinates, offset, endss, stride, opt_right) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
offset = ol.geom.flat.orient.orientLinearRings(
|
||||
offset = _ol_geom_flat_orient_.orientLinearRings(
|
||||
flatCoordinates, offset, endss[i], stride, opt_right);
|
||||
}
|
||||
return offset;
|
||||
};
|
||||
export default _ol_geom_flat_orient_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.reverse');
|
||||
/**
|
||||
* @module ol/geom/flat/reverse
|
||||
*/
|
||||
var _ol_geom_flat_reverse_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -7,7 +10,7 @@ goog.provide('ol.geom.flat.reverse');
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
*/
|
||||
ol.geom.flat.reverse.coordinates = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_reverse_.coordinates = function(flatCoordinates, offset, end, stride) {
|
||||
while (offset < end - stride) {
|
||||
var i;
|
||||
for (i = 0; i < stride; ++i) {
|
||||
@@ -19,3 +22,4 @@ ol.geom.flat.reverse.coordinates = function(flatCoordinates, offset, end, stride
|
||||
end -= stride;
|
||||
}
|
||||
};
|
||||
export default _ol_geom_flat_reverse_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.segments');
|
||||
/**
|
||||
* @module ol/geom/flat/segments
|
||||
*/
|
||||
var _ol_geom_flat_segments_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,7 +19,7 @@ goog.provide('ol.geom.flat.segments');
|
||||
* @return {T|boolean} Value.
|
||||
* @template T,S
|
||||
*/
|
||||
ol.geom.flat.segments.forEach = function(flatCoordinates, offset, end, stride, callback, opt_this) {
|
||||
_ol_geom_flat_segments_.forEach = function(flatCoordinates, offset, end, stride, callback, opt_this) {
|
||||
var point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];
|
||||
var point2 = [];
|
||||
var ret;
|
||||
@@ -32,3 +35,4 @@ ol.geom.flat.segments.forEach = function(flatCoordinates, offset, end, stride, c
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default _ol_geom_flat_segments_;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @module ol/geom/flat/simplify
|
||||
*/
|
||||
// Based on simplify-js https://github.com/mourner/simplify-js
|
||||
// Copyright (c) 2012, Vladimir Agafonkin
|
||||
// All rights reserved.
|
||||
@@ -24,9 +27,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
goog.provide('ol.geom.flat.simplify');
|
||||
|
||||
goog.require('ol.math');
|
||||
import _ol_math_ from '../../math.js';
|
||||
var _ol_geom_flat_simplify_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -40,19 +42,19 @@ goog.require('ol.math');
|
||||
* coordinates.
|
||||
* @return {Array.<number>} Simplified line string.
|
||||
*/
|
||||
ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
|
||||
_ol_geom_flat_simplify_.lineString = function(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
|
||||
var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?
|
||||
opt_simplifiedFlatCoordinates : [];
|
||||
if (!highQuality) {
|
||||
end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end,
|
||||
end = _ol_geom_flat_simplify_.radialDistance(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, 0);
|
||||
flatCoordinates = simplifiedFlatCoordinates;
|
||||
offset = 0;
|
||||
stride = 2;
|
||||
}
|
||||
simplifiedFlatCoordinates.length = ol.geom.flat.simplify.douglasPeucker(
|
||||
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.douglasPeucker(
|
||||
flatCoordinates, offset, end, stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, 0);
|
||||
return simplifiedFlatCoordinates;
|
||||
@@ -70,7 +72,7 @@ ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
|
||||
* @param {number} simplifiedOffset Simplified offset.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.douglasPeucker = function(flatCoordinates, offset, end,
|
||||
_ol_geom_flat_simplify_.douglasPeucker = function(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {
|
||||
var n = (end - offset) / stride;
|
||||
if (n < 3) {
|
||||
@@ -101,7 +103,7 @@ ol.geom.flat.simplify.douglasPeucker = function(flatCoordinates, offset, end,
|
||||
for (i = first + stride; i < last; i += stride) {
|
||||
var x = flatCoordinates[i];
|
||||
var y = flatCoordinates[i + 1];
|
||||
var squaredDistance = ol.math.squaredSegmentDistance(
|
||||
var squaredDistance = _ol_math_.squaredSegmentDistance(
|
||||
x, y, x1, y1, x2, y2);
|
||||
if (squaredDistance > maxSquaredDistance) {
|
||||
index = i;
|
||||
@@ -142,13 +144,13 @@ ol.geom.flat.simplify.douglasPeucker = function(flatCoordinates, offset, end,
|
||||
* @param {Array.<number>} simplifiedEnds Simplified ends.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.douglasPeuckers = function(flatCoordinates, offset,
|
||||
_ol_geom_flat_simplify_.douglasPeuckers = function(flatCoordinates, offset,
|
||||
ends, stride, squaredTolerance, simplifiedFlatCoordinates,
|
||||
simplifiedOffset, simplifiedEnds) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
simplifiedOffset = ol.geom.flat.simplify.douglasPeucker(
|
||||
simplifiedOffset = _ol_geom_flat_simplify_.douglasPeucker(
|
||||
flatCoordinates, offset, end, stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset);
|
||||
simplifiedEnds.push(simplifiedOffset);
|
||||
@@ -170,14 +172,14 @@ ol.geom.flat.simplify.douglasPeuckers = function(flatCoordinates, offset,
|
||||
* @param {Array.<Array.<number>>} simplifiedEndss Simplified endss.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.douglasPeuckerss = function(
|
||||
_ol_geom_flat_simplify_.douglasPeuckerss = function(
|
||||
flatCoordinates, offset, endss, stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
var simplifiedEnds = [];
|
||||
simplifiedOffset = ol.geom.flat.simplify.douglasPeuckers(
|
||||
simplifiedOffset = _ol_geom_flat_simplify_.douglasPeuckers(
|
||||
flatCoordinates, offset, ends, stride, squaredTolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);
|
||||
simplifiedEndss.push(simplifiedEnds);
|
||||
@@ -198,7 +200,7 @@ ol.geom.flat.simplify.douglasPeuckerss = function(
|
||||
* @param {number} simplifiedOffset Simplified offset.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.radialDistance = function(flatCoordinates, offset, end,
|
||||
_ol_geom_flat_simplify_.radialDistance = function(flatCoordinates, offset, end,
|
||||
stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {
|
||||
if (end <= offset + stride) {
|
||||
// zero or one point, no simplification possible, so copy and return
|
||||
@@ -219,7 +221,7 @@ ol.geom.flat.simplify.radialDistance = function(flatCoordinates, offset, end,
|
||||
for (offset += stride; offset < end; offset += stride) {
|
||||
x2 = flatCoordinates[offset];
|
||||
y2 = flatCoordinates[offset + 1];
|
||||
if (ol.math.squaredDistance(x1, y1, x2, y2) > squaredTolerance) {
|
||||
if (_ol_math_.squaredDistance(x1, y1, x2, y2) > squaredTolerance) {
|
||||
// copy point at offset
|
||||
simplifiedFlatCoordinates[simplifiedOffset++] = x2;
|
||||
simplifiedFlatCoordinates[simplifiedOffset++] = y2;
|
||||
@@ -241,7 +243,7 @@ ol.geom.flat.simplify.radialDistance = function(flatCoordinates, offset, end,
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @return {number} Rounded value.
|
||||
*/
|
||||
ol.geom.flat.simplify.snap = function(value, tolerance) {
|
||||
_ol_geom_flat_simplify_.snap = function(value, tolerance) {
|
||||
return tolerance * Math.round(value / tolerance);
|
||||
};
|
||||
|
||||
@@ -265,15 +267,15 @@ ol.geom.flat.simplify.snap = function(value, tolerance) {
|
||||
* @param {number} simplifiedOffset Simplified offset.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,
|
||||
_ol_geom_flat_simplify_.quantize = function(flatCoordinates, offset, end, stride,
|
||||
tolerance, simplifiedFlatCoordinates, simplifiedOffset) {
|
||||
// do nothing if the line is empty
|
||||
if (offset == end) {
|
||||
return simplifiedOffset;
|
||||
}
|
||||
// snap the first coordinate (P1)
|
||||
var x1 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);
|
||||
var y1 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);
|
||||
var x1 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset], tolerance);
|
||||
var y1 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset + 1], tolerance);
|
||||
offset += stride;
|
||||
// add the first coordinate to the output
|
||||
simplifiedFlatCoordinates[simplifiedOffset++] = x1;
|
||||
@@ -282,8 +284,8 @@ ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,
|
||||
// coordinate (P2)
|
||||
var x2, y2;
|
||||
do {
|
||||
x2 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);
|
||||
y2 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);
|
||||
x2 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset], tolerance);
|
||||
y2 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset + 1], tolerance);
|
||||
offset += stride;
|
||||
if (offset == end) {
|
||||
// all coordinates snap to the same value, the line collapses to a point
|
||||
@@ -298,8 +300,8 @@ ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,
|
||||
while (offset < end) {
|
||||
var x3, y3;
|
||||
// snap the next coordinate (P3)
|
||||
x3 = ol.geom.flat.simplify.snap(flatCoordinates[offset], tolerance);
|
||||
y3 = ol.geom.flat.simplify.snap(flatCoordinates[offset + 1], tolerance);
|
||||
x3 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset], tolerance);
|
||||
y3 = _ol_geom_flat_simplify_.snap(flatCoordinates[offset + 1], tolerance);
|
||||
offset += stride;
|
||||
// skip P3 if it is equal to P2
|
||||
if (x3 == x2 && y3 == y2) {
|
||||
@@ -351,14 +353,14 @@ ol.geom.flat.simplify.quantize = function(flatCoordinates, offset, end, stride,
|
||||
* @param {Array.<number>} simplifiedEnds Simplified ends.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.quantizes = function(
|
||||
_ol_geom_flat_simplify_.quantizes = function(
|
||||
flatCoordinates, offset, ends, stride,
|
||||
tolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
var end = ends[i];
|
||||
simplifiedOffset = ol.geom.flat.simplify.quantize(
|
||||
simplifiedOffset = _ol_geom_flat_simplify_.quantize(
|
||||
flatCoordinates, offset, end, stride,
|
||||
tolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset);
|
||||
@@ -381,7 +383,7 @@ ol.geom.flat.simplify.quantizes = function(
|
||||
* @param {Array.<Array.<number>>} simplifiedEndss Simplified endss.
|
||||
* @return {number} Simplified offset.
|
||||
*/
|
||||
ol.geom.flat.simplify.quantizess = function(
|
||||
_ol_geom_flat_simplify_.quantizess = function(
|
||||
flatCoordinates, offset, endss, stride,
|
||||
tolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {
|
||||
@@ -389,7 +391,7 @@ ol.geom.flat.simplify.quantizess = function(
|
||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||
var ends = endss[i];
|
||||
var simplifiedEnds = [];
|
||||
simplifiedOffset = ol.geom.flat.simplify.quantizes(
|
||||
simplifiedOffset = _ol_geom_flat_simplify_.quantizes(
|
||||
flatCoordinates, offset, ends, stride,
|
||||
tolerance,
|
||||
simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);
|
||||
@@ -398,3 +400,4 @@ ol.geom.flat.simplify.quantizess = function(
|
||||
}
|
||||
return simplifiedOffset;
|
||||
};
|
||||
export default _ol_geom_flat_simplify_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.straightchunk');
|
||||
/**
|
||||
* @module ol/geom/flat/straightchunk
|
||||
*/
|
||||
var _ol_geom_flat_straightchunk_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,7 +13,7 @@ goog.provide('ol.geom.flat.straightchunk');
|
||||
* @return {Array.<number>} Start and end of the first suitable chunk of the
|
||||
* given `flatCoordinates`.
|
||||
*/
|
||||
ol.geom.flat.straightchunk.lineString = function(maxAngle, flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_straightchunk_.lineString = function(maxAngle, flatCoordinates, offset, end, stride) {
|
||||
var chunkStart = offset;
|
||||
var chunkEnd = offset;
|
||||
var chunkM = 0;
|
||||
@@ -47,3 +50,4 @@ ol.geom.flat.straightchunk.lineString = function(maxAngle, flatCoordinates, offs
|
||||
m += m23;
|
||||
return m > chunkM ? [start, i] : [chunkStart, chunkEnd];
|
||||
};
|
||||
export default _ol_geom_flat_straightchunk_;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.textpath');
|
||||
|
||||
goog.require('ol.math');
|
||||
/**
|
||||
* @module ol/geom/flat/textpath
|
||||
*/
|
||||
import _ol_math_ from '../../math.js';
|
||||
var _ol_geom_flat_textpath_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,7 +18,7 @@ goog.require('ol.math');
|
||||
* @return {Array.<Array.<*>>} The result array of null if `maxAngle` was
|
||||
* exceeded. Entries of the array are x, y, anchorX, angle, chunk.
|
||||
*/
|
||||
ol.geom.flat.textpath.lineString = function(
|
||||
_ol_geom_flat_textpath_.lineString = function(
|
||||
flatCoordinates, offset, end, stride, text, measure, startM, maxAngle) {
|
||||
var result = [];
|
||||
|
||||
@@ -65,8 +67,8 @@ ol.geom.flat.textpath.lineString = function(
|
||||
}
|
||||
}
|
||||
var interpolate = segmentPos / segmentLength;
|
||||
var x = ol.math.lerp(x1, x2, interpolate);
|
||||
var y = ol.math.lerp(y1, y2, interpolate);
|
||||
var x = _ol_math_.lerp(x1, x2, interpolate);
|
||||
var y = _ol_math_.lerp(y1, y2, interpolate);
|
||||
if (previousAngle == angle) {
|
||||
if (reverse) {
|
||||
data[0] = x;
|
||||
@@ -89,3 +91,4 @@ ol.geom.flat.textpath.lineString = function(
|
||||
}
|
||||
return result;
|
||||
};
|
||||
export default _ol_geom_flat_textpath_;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
goog.provide('ol.geom.flat.topology');
|
||||
|
||||
goog.require('ol.geom.flat.area');
|
||||
/**
|
||||
* @module ol/geom/flat/topology
|
||||
*/
|
||||
import _ol_geom_flat_area_ from '../flat/area.js';
|
||||
var _ol_geom_flat_topology_ = {};
|
||||
|
||||
/**
|
||||
* Check if the linestring is a boundary.
|
||||
@@ -10,11 +12,12 @@ goog.require('ol.geom.flat.area');
|
||||
* @param {number} stride Stride.
|
||||
* @return {boolean} The linestring is a boundary.
|
||||
*/
|
||||
ol.geom.flat.topology.lineStringIsClosed = function(flatCoordinates, offset, end, stride) {
|
||||
_ol_geom_flat_topology_.lineStringIsClosed = function(flatCoordinates, offset, end, stride) {
|
||||
var lastCoord = end - stride;
|
||||
if (flatCoordinates[offset] === flatCoordinates[lastCoord] &&
|
||||
flatCoordinates[offset + 1] === flatCoordinates[lastCoord + 1] && (end - offset) / stride > 3) {
|
||||
return !!ol.geom.flat.area.linearRing(flatCoordinates, offset, end, stride);
|
||||
return !!_ol_geom_flat_area_.linearRing(flatCoordinates, offset, end, stride);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default _ol_geom_flat_topology_;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
goog.provide('ol.geom.flat.transform');
|
||||
/**
|
||||
* @module ol/geom/flat/transform
|
||||
*/
|
||||
var _ol_geom_flat_transform_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -10,7 +13,7 @@ goog.provide('ol.geom.flat.transform');
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed coordinates.
|
||||
*/
|
||||
ol.geom.flat.transform.transform2D = function(flatCoordinates, offset, end, stride, transform, opt_dest) {
|
||||
_ol_geom_flat_transform_.transform2D = function(flatCoordinates, offset, end, stride, transform, opt_dest) {
|
||||
var dest = opt_dest ? opt_dest : [];
|
||||
var i = 0;
|
||||
var j;
|
||||
@@ -37,7 +40,7 @@ ol.geom.flat.transform.transform2D = function(flatCoordinates, offset, end, stri
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed coordinates.
|
||||
*/
|
||||
ol.geom.flat.transform.rotate = function(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) {
|
||||
_ol_geom_flat_transform_.rotate = function(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) {
|
||||
var dest = opt_dest ? opt_dest : [];
|
||||
var cos = Math.cos(angle);
|
||||
var sin = Math.sin(angle);
|
||||
@@ -72,7 +75,7 @@ ol.geom.flat.transform.rotate = function(flatCoordinates, offset, end, stride, a
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed coordinates.
|
||||
*/
|
||||
ol.geom.flat.transform.scale = function(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) {
|
||||
_ol_geom_flat_transform_.scale = function(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) {
|
||||
var dest = opt_dest ? opt_dest : [];
|
||||
var anchorX = anchor[0];
|
||||
var anchorY = anchor[1];
|
||||
@@ -103,7 +106,7 @@ ol.geom.flat.transform.scale = function(flatCoordinates, offset, end, stride, sx
|
||||
* @param {Array.<number>=} opt_dest Destination.
|
||||
* @return {Array.<number>} Transformed coordinates.
|
||||
*/
|
||||
ol.geom.flat.transform.translate = function(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
|
||||
_ol_geom_flat_transform_.translate = function(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
|
||||
var dest = opt_dest ? opt_dest : [];
|
||||
var i = 0;
|
||||
var j, k;
|
||||
@@ -119,3 +122,4 @@ ol.geom.flat.transform.translate = function(flatCoordinates, offset, end, stride
|
||||
}
|
||||
return dest;
|
||||
};
|
||||
export default _ol_geom_flat_transform_;
|
||||
|
||||
Reference in New Issue
Block a user