Merge pull request #805 from fredj/cleanup

ol.Geolocation and ol.DeviceOrientation cleanup
This commit is contained in:
Frédéric Junod
2013-06-21 08:07:03 -07:00
2 changed files with 18 additions and 14 deletions

View File

@@ -27,6 +27,10 @@ ol.DeviceOrientationProperty = {
*/
ol.DeviceOrientation = function(opt_options) {
goog.base(this);
var options = goog.isDef(opt_options) ? opt_options : {};
/**
* @private
* @type {?number}
@@ -37,7 +41,7 @@ ol.DeviceOrientation = function(opt_options) {
ol.Object.getChangeEventType(ol.DeviceOrientationProperty.TRACKING),
this.handleTrackingChanged_, false, this);
goog.base(this, goog.isDef(opt_options) ? opt_options : {});
this.setTracking(goog.isDef(options.tracking) ? options.tracking : false);
};
goog.inherits(ol.DeviceOrientation, ol.Object);
@@ -90,7 +94,7 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(browserEvent) {
* @return {number|undefined} alpha.
*/
ol.DeviceOrientation.prototype.getAlpha = function() {
return /** @type {number} */ (
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientationProperty.ALPHA));
};
goog.exportProperty(
@@ -103,7 +107,7 @@ goog.exportProperty(
* @return {number|undefined} beta.
*/
ol.DeviceOrientation.prototype.getBeta = function() {
return /** @type {number} */ (
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientationProperty.BETA));
};
goog.exportProperty(
@@ -116,7 +120,7 @@ goog.exportProperty(
* @return {number|undefined} gamma.
*/
ol.DeviceOrientation.prototype.getGamma = function() {
return /** @type {number} */ (
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientationProperty.GAMMA));
};
goog.exportProperty(
@@ -129,7 +133,7 @@ goog.exportProperty(
* @return {number|undefined} heading.
*/
ol.DeviceOrientation.prototype.getHeading = function() {
return /** @type {number} */ (
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientationProperty.HEADING));
};
goog.exportProperty(
@@ -139,7 +143,8 @@ goog.exportProperty(
/**
* @return {boolean|undefined} tracking.
* Are we tracking the device's orientation?
* @return {boolean} tracking.
*/
ol.DeviceOrientation.prototype.getTracking = function() {
return /** @type {boolean} */ (

View File

@@ -86,9 +86,8 @@ ol.Geolocation = function(opt_options) {
if (goog.isDef(options.trackingOptions)) {
this.setTrackingOptions(options.trackingOptions);
}
if (goog.isDef(options.tracking)) {
this.setTracking(options.tracking);
}
this.setTracking(goog.isDef(options.tracking) ? options.tracking : false);
};
goog.inherits(ol.Geolocation, ol.Object);
@@ -187,7 +186,7 @@ ol.Geolocation.prototype.positionError_ = function(error) {
* @return {number|undefined} accuracy in meters.
*/
ol.Geolocation.prototype.getAccuracy = function() {
return /** @type {number} */ (
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ACCURACY));
};
goog.exportProperty(
@@ -243,7 +242,7 @@ goog.exportProperty(
* @return {ol.Coordinate|undefined} position.
*/
ol.Geolocation.prototype.getPosition = function() {
return /** @type {ol.Coordinate} */ (
return /** @type {ol.Coordinate|undefined} */ (
this.get(ol.GeolocationProperty.POSITION));
};
goog.exportProperty(
@@ -257,7 +256,7 @@ goog.exportProperty(
* @return {ol.Projection|undefined} projection.
*/
ol.Geolocation.prototype.getProjection = function() {
return /** @type {ol.Projection} */ (
return /** @type {ol.Projection|undefined} */ (
this.get(ol.GeolocationProperty.PROJECTION));
};
goog.exportProperty(
@@ -282,7 +281,7 @@ goog.exportProperty(
/**
* Are we tracking the user's position?
* @return {boolean|undefined} tracking.
* @return {boolean} tracking.
*/
ol.Geolocation.prototype.getTracking = function() {
return /** @type {boolean} */ (
@@ -299,7 +298,7 @@ goog.exportProperty(
* @return {GeolocationPositionOptions|undefined} Tracking options.
*/
ol.Geolocation.prototype.getTrackingOptions = function() {
return /** @type {GeolocationPositionOptions} */ (
return /** @type {GeolocationPositionOptions|undefined} */ (
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
};
goog.exportProperty(