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