Rename ol.GeolocationProperty to ol.Geolocation.Property
This commit is contained in:
committed by
Tim Schaub
parent
3972ec42f6
commit
1fa91717bd
@@ -14,6 +14,7 @@ A number of internal types have been renamed. This will not affect those who us
|
||||
* rename `ol.layer.GroupProperty` to `ol.layer.Group.Property`
|
||||
* rename `ol.CollectionProperty` to `ol.Collection.Property`
|
||||
* rename `ol.DeviceOrientationProperty` to `ol.DeviceOrientation.Property`
|
||||
* rename `ol.GeolocationProperty` to `ol.Geolocation.Property`
|
||||
|
||||
### v3.18.0
|
||||
|
||||
|
||||
@@ -13,23 +13,6 @@ goog.require('ol.proj');
|
||||
goog.require('ol.sphere.WGS84');
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.GeolocationProperty = {
|
||||
ACCURACY: 'accuracy',
|
||||
ACCURACY_GEOMETRY: 'accuracyGeometry',
|
||||
ALTITUDE: 'altitude',
|
||||
ALTITUDE_ACCURACY: 'altitudeAccuracy',
|
||||
HEADING: 'heading',
|
||||
POSITION: 'position',
|
||||
PROJECTION: 'projection',
|
||||
SPEED: 'speed',
|
||||
TRACKING: 'tracking',
|
||||
TRACKING_OPTIONS: 'trackingOptions'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Helper class for providing HTML5 Geolocation capabilities.
|
||||
@@ -82,10 +65,10 @@ ol.Geolocation = function(opt_options) {
|
||||
this.watchId_ = undefined;
|
||||
|
||||
ol.events.listen(
|
||||
this, ol.Object.getChangeEventType(ol.GeolocationProperty.PROJECTION),
|
||||
this, ol.Object.getChangeEventType(ol.Geolocation.Property.PROJECTION),
|
||||
this.handleProjectionChanged_, this);
|
||||
ol.events.listen(
|
||||
this, ol.Object.getChangeEventType(ol.GeolocationProperty.TRACKING),
|
||||
this, ol.Object.getChangeEventType(ol.Geolocation.Property.TRACKING),
|
||||
this.handleTrackingChanged_, this);
|
||||
|
||||
if (options.projection !== undefined) {
|
||||
@@ -120,7 +103,7 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||
ol.proj.get('EPSG:4326'), projection);
|
||||
if (this.position_) {
|
||||
this.set(
|
||||
ol.GeolocationProperty.POSITION, this.transform_(this.position_));
|
||||
ol.Geolocation.Property.POSITION, this.transform_(this.position_));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -151,13 +134,13 @@ ol.Geolocation.prototype.handleTrackingChanged_ = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.positionChange_ = function(position) {
|
||||
var coords = position.coords;
|
||||
this.set(ol.GeolocationProperty.ACCURACY, coords.accuracy);
|
||||
this.set(ol.GeolocationProperty.ALTITUDE,
|
||||
this.set(ol.Geolocation.Property.ACCURACY, coords.accuracy);
|
||||
this.set(ol.Geolocation.Property.ALTITUDE,
|
||||
coords.altitude === null ? undefined : coords.altitude);
|
||||
this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY,
|
||||
this.set(ol.Geolocation.Property.ALTITUDE_ACCURACY,
|
||||
coords.altitudeAccuracy === null ?
|
||||
undefined : coords.altitudeAccuracy);
|
||||
this.set(ol.GeolocationProperty.HEADING, coords.heading === null ?
|
||||
this.set(ol.Geolocation.Property.HEADING, coords.heading === null ?
|
||||
undefined : ol.math.toRadians(coords.heading));
|
||||
if (!this.position_) {
|
||||
this.position_ = [coords.longitude, coords.latitude];
|
||||
@@ -166,13 +149,13 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
||||
this.position_[1] = coords.latitude;
|
||||
}
|
||||
var projectedPosition = this.transform_(this.position_);
|
||||
this.set(ol.GeolocationProperty.POSITION, projectedPosition);
|
||||
this.set(ol.GeolocationProperty.SPEED,
|
||||
this.set(ol.Geolocation.Property.POSITION, projectedPosition);
|
||||
this.set(ol.Geolocation.Property.SPEED,
|
||||
coords.speed === null ? undefined : coords.speed);
|
||||
var geometry = ol.geom.Polygon.circular(
|
||||
ol.sphere.WGS84, this.position_, coords.accuracy);
|
||||
geometry.applyTransform(this.transform_);
|
||||
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
|
||||
this.set(ol.Geolocation.Property.ACCURACY_GEOMETRY, geometry);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -202,7 +185,7 @@ ol.Geolocation.prototype.positionError_ = function(error) {
|
||||
*/
|
||||
ol.Geolocation.prototype.getAccuracy = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.GeolocationProperty.ACCURACY));
|
||||
this.get(ol.Geolocation.Property.ACCURACY));
|
||||
};
|
||||
|
||||
|
||||
@@ -214,7 +197,7 @@ ol.Geolocation.prototype.getAccuracy = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getAccuracyGeometry = function() {
|
||||
return /** @type {?ol.geom.Geometry} */ (
|
||||
this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null);
|
||||
this.get(ol.Geolocation.Property.ACCURACY_GEOMETRY) || null);
|
||||
};
|
||||
|
||||
|
||||
@@ -227,7 +210,7 @@ ol.Geolocation.prototype.getAccuracyGeometry = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getAltitude = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.GeolocationProperty.ALTITUDE));
|
||||
this.get(ol.Geolocation.Property.ALTITUDE));
|
||||
};
|
||||
|
||||
|
||||
@@ -240,7 +223,7 @@ ol.Geolocation.prototype.getAltitude = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getAltitudeAccuracy = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY));
|
||||
this.get(ol.Geolocation.Property.ALTITUDE_ACCURACY));
|
||||
};
|
||||
|
||||
|
||||
@@ -252,7 +235,7 @@ ol.Geolocation.prototype.getAltitudeAccuracy = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getHeading = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.GeolocationProperty.HEADING));
|
||||
this.get(ol.Geolocation.Property.HEADING));
|
||||
};
|
||||
|
||||
|
||||
@@ -265,7 +248,7 @@ ol.Geolocation.prototype.getHeading = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getPosition = function() {
|
||||
return /** @type {ol.Coordinate|undefined} */ (
|
||||
this.get(ol.GeolocationProperty.POSITION));
|
||||
this.get(ol.Geolocation.Property.POSITION));
|
||||
};
|
||||
|
||||
|
||||
@@ -278,7 +261,7 @@ ol.Geolocation.prototype.getPosition = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getProjection = function() {
|
||||
return /** @type {ol.proj.Projection|undefined} */ (
|
||||
this.get(ol.GeolocationProperty.PROJECTION));
|
||||
this.get(ol.Geolocation.Property.PROJECTION));
|
||||
};
|
||||
|
||||
|
||||
@@ -291,7 +274,7 @@ ol.Geolocation.prototype.getProjection = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getSpeed = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.GeolocationProperty.SPEED));
|
||||
this.get(ol.Geolocation.Property.SPEED));
|
||||
};
|
||||
|
||||
|
||||
@@ -303,7 +286,7 @@ ol.Geolocation.prototype.getSpeed = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getTracking = function() {
|
||||
return /** @type {boolean} */ (
|
||||
this.get(ol.GeolocationProperty.TRACKING));
|
||||
this.get(ol.Geolocation.Property.TRACKING));
|
||||
};
|
||||
|
||||
|
||||
@@ -318,7 +301,7 @@ ol.Geolocation.prototype.getTracking = function() {
|
||||
*/
|
||||
ol.Geolocation.prototype.getTrackingOptions = function() {
|
||||
return /** @type {GeolocationPositionOptions|undefined} */ (
|
||||
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
|
||||
this.get(ol.Geolocation.Property.TRACKING_OPTIONS));
|
||||
};
|
||||
|
||||
|
||||
@@ -330,7 +313,7 @@ ol.Geolocation.prototype.getTrackingOptions = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.Geolocation.prototype.setProjection = function(projection) {
|
||||
this.set(ol.GeolocationProperty.PROJECTION, projection);
|
||||
this.set(ol.Geolocation.Property.PROJECTION, projection);
|
||||
};
|
||||
|
||||
|
||||
@@ -341,7 +324,7 @@ ol.Geolocation.prototype.setProjection = function(projection) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.Geolocation.prototype.setTracking = function(tracking) {
|
||||
this.set(ol.GeolocationProperty.TRACKING, tracking);
|
||||
this.set(ol.Geolocation.Property.TRACKING, tracking);
|
||||
};
|
||||
|
||||
|
||||
@@ -355,5 +338,22 @@ ol.Geolocation.prototype.setTracking = function(tracking) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.Geolocation.prototype.setTrackingOptions = function(options) {
|
||||
this.set(ol.GeolocationProperty.TRACKING_OPTIONS, options);
|
||||
this.set(ol.Geolocation.Property.TRACKING_OPTIONS, options);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.Geolocation.Property = {
|
||||
ACCURACY: 'accuracy',
|
||||
ACCURACY_GEOMETRY: 'accuracyGeometry',
|
||||
ALTITUDE: 'altitude',
|
||||
ALTITUDE_ACCURACY: 'altitudeAccuracy',
|
||||
HEADING: 'heading',
|
||||
POSITION: 'position',
|
||||
PROJECTION: 'projection',
|
||||
SPEED: 'speed',
|
||||
TRACKING: 'tracking',
|
||||
TRACKING_OPTIONS: 'trackingOptions'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user