Use ol.projection.identityTransform instead of goog.functions.identity
This commit is contained in:
@@ -5,7 +5,6 @@ goog.provide('ol.Geolocation');
|
|||||||
goog.provide('ol.GeolocationProperty');
|
goog.provide('ol.GeolocationProperty');
|
||||||
|
|
||||||
goog.require('goog.events');
|
goog.require('goog.events');
|
||||||
goog.require('goog.functions');
|
|
||||||
goog.require('goog.math');
|
goog.require('goog.math');
|
||||||
goog.require('ol.Coordinate');
|
goog.require('ol.Coordinate');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
@@ -48,6 +47,12 @@ ol.Geolocation = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.position_ = null;
|
this.position_ = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.TransformFunction}
|
||||||
|
*/
|
||||||
|
this.transform_ = ol.projection.identityTransform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number|undefined}
|
* @type {number|undefined}
|
||||||
@@ -90,11 +95,11 @@ ol.Geolocation.prototype.disposeInternal = function() {
|
|||||||
ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||||
var projection = this.getProjection();
|
var projection = this.getProjection();
|
||||||
if (goog.isDefAndNotNull(projection)) {
|
if (goog.isDefAndNotNull(projection)) {
|
||||||
this.transformFn_ = ol.projection.getTransformFromProjections(
|
this.transform_ = ol.projection.getTransformFromProjections(
|
||||||
ol.projection.get('EPSG:4326'), projection);
|
ol.projection.get('EPSG:4326'), projection);
|
||||||
if (!goog.isNull(this.position_)) {
|
if (!goog.isNull(this.position_)) {
|
||||||
this.set(
|
this.set(
|
||||||
ol.GeolocationProperty.POSITION, this.transformFn_(this.position_));
|
ol.GeolocationProperty.POSITION, this.transform_(this.position_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -147,7 +152,7 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
|||||||
this.position_[0] = coords.longitude;
|
this.position_[0] = coords.longitude;
|
||||||
this.position_[1] = coords.latitude;
|
this.position_[1] = coords.latitude;
|
||||||
}
|
}
|
||||||
this.set(ol.GeolocationProperty.POSITION, this.transformFn_(this.position_));
|
this.set(ol.GeolocationProperty.POSITION, this.transform_(this.position_));
|
||||||
this.set(ol.GeolocationProperty.SPEED,
|
this.set(ol.GeolocationProperty.SPEED,
|
||||||
goog.isNull(coords.speed) ? undefined : coords.speed);
|
goog.isNull(coords.speed) ? undefined : coords.speed);
|
||||||
};
|
};
|
||||||
@@ -314,13 +319,3 @@ goog.exportProperty(
|
|||||||
ol.Geolocation.prototype,
|
ol.Geolocation.prototype,
|
||||||
'setTrackingOptions',
|
'setTrackingOptions',
|
||||||
ol.Geolocation.prototype.setTrackingOptions);
|
ol.Geolocation.prototype.setTrackingOptions);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @param {Array.<number>} input Input coordinate values.
|
|
||||||
* @param {Array.<number>=} opt_output Output array of coordinate values.
|
|
||||||
* @param {number=} opt_dimension Dimension (default is 2).
|
|
||||||
* @return {Array.<number>} Output coordinate values.
|
|
||||||
*/
|
|
||||||
ol.Geolocation.prototype.transformFn_ = goog.functions.identity;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user