Transformed
This commit is contained in:
@@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user