Merge pull request #7610 from fredj/better_names

More variable renaming
This commit is contained in:
Frédéric Junod
2017-12-16 08:54:47 +01:00
committed by GitHub
15 changed files with 100 additions and 100 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import _ol_Geolocation_ from '../src/ol/Geolocation.js'; import Geolocation from '../src/ol/Geolocation.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_Overlay_ from '../src/ol/Overlay.js'; import _ol_Overlay_ from '../src/ol/Overlay.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
@@ -46,7 +46,7 @@ var positions = new LineString([],
/** @type {ol.geom.GeometryLayout} */ ('XYZM')); /** @type {ol.geom.GeometryLayout} */ ('XYZM'));
// Geolocation Control // Geolocation Control
var geolocation = new _ol_Geolocation_({ var geolocation = new Geolocation({
projection: view.getProjection(), projection: view.getProjection(),
trackingOptions: { trackingOptions: {
maximumAge: 10000, maximumAge: 10000,
+2 -2
View File
@@ -1,5 +1,5 @@
import _ol_Feature_ from '../src/ol/Feature.js'; import _ol_Feature_ from '../src/ol/Feature.js';
import _ol_Geolocation_ from '../src/ol/Geolocation.js'; import Geolocation from '../src/ol/Geolocation.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.js'; import _ol_control_ from '../src/ol/control.js';
@@ -33,7 +33,7 @@ var map = new _ol_Map_({
view: view view: view
}); });
var geolocation = new _ol_Geolocation_({ var geolocation = new Geolocation({
projection: view.getProjection() projection: view.getProjection()
}); });
+2 -2
View File
@@ -1,4 +1,4 @@
import _ol_Graticule_ from '../src/ol/Graticule.js'; import Graticule from '../src/ol/Graticule.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -23,7 +23,7 @@ var map = new _ol_Map_({
}); });
// Create the graticule component // Create the graticule component
var graticule = new _ol_Graticule_({ var graticule = new Graticule({
// the style to use for the lines, optional. // the style to use for the lines, optional.
strokeStyle: new _ol_style_Stroke_({ strokeStyle: new _ol_style_Stroke_({
color: 'rgba(255,120,0,0.9)', color: 'rgba(255,120,0,0.9)',
+2 -2
View File
@@ -1,4 +1,4 @@
import _ol_Geolocation_ from '../src/ol/Geolocation.js'; import Geolocation from '../src/ol/Geolocation.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -23,7 +23,7 @@ var map = new _ol_Map_({
view: view view: view
}); });
var geolocation = new _ol_Geolocation_({ var geolocation = new Geolocation({
projection: view.getProjection(), projection: view.getProjection(),
tracking: true tracking: true
}); });
+2 -2
View File
@@ -1,4 +1,4 @@
import _ol_Graticule_ from '../src/ol/Graticule.js'; import Graticule from '../src/ol/Graticule.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js';
@@ -41,6 +41,6 @@ var map = new _ol_Map_({
}) })
}); });
new _ol_Graticule_({ new Graticule({
map: map map: map
}); });
+3 -3
View File
@@ -12,7 +12,7 @@ import {VERSION, inherits} from './index.js';
* @implements {oli.AssertionError} * @implements {oli.AssertionError}
* @param {number} code Error code. * @param {number} code Error code.
*/ */
var _ol_AssertionError_ = function(code) { var AssertionError = function(code) {
var path = VERSION ? VERSION.split('-')[0] : 'latest'; var path = VERSION ? VERSION.split('-')[0] : 'latest';
@@ -36,6 +36,6 @@ var _ol_AssertionError_ = function(code) {
}; };
inherits(_ol_AssertionError_, Error); inherits(AssertionError, Error);
export default _ol_AssertionError_; export default AssertionError;
+2 -2
View File
@@ -2,7 +2,7 @@
* @module ol/Collection * @module ol/Collection
*/ */
import {inherits} from './index.js'; import {inherits} from './index.js';
import _ol_AssertionError_ from './AssertionError.js'; import AssertionError from './AssertionError.js';
import _ol_CollectionEventType_ from './CollectionEventType.js'; import _ol_CollectionEventType_ from './CollectionEventType.js';
import _ol_Object_ from './Object.js'; import _ol_Object_ from './Object.js';
import Event from './events/Event.js'; import Event from './events/Event.js';
@@ -268,7 +268,7 @@ _ol_Collection_.prototype.updateLength_ = function() {
_ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) { _ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) {
for (var i = 0, ii = this.array_.length; i < ii; ++i) { for (var i = 0, ii = this.array_.length; i < ii; ++i) {
if (this.array_[i] === elem && i !== opt_except) { if (this.array_[i] === elem && i !== opt_except) {
throw new _ol_AssertionError_(58); throw new AssertionError(58);
} }
} }
}; };
+21 -21
View File
@@ -55,7 +55,7 @@ export var GeolocationOptions;
* is reported in. * is reported in.
* @api * @api
*/ */
var _ol_Geolocation_ = function(opt_options) { var Geolocation = function(opt_options) {
_ol_Object_.call(this); _ol_Object_.call(this);
@@ -104,13 +104,13 @@ var _ol_Geolocation_ = function(opt_options) {
}; };
inherits(_ol_Geolocation_, _ol_Object_); inherits(Geolocation, _ol_Object_);
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_Geolocation_.prototype.disposeInternal = function() { Geolocation.prototype.disposeInternal = function() {
this.setTracking(false); this.setTracking(false);
_ol_Object_.prototype.disposeInternal.call(this); _ol_Object_.prototype.disposeInternal.call(this);
}; };
@@ -119,7 +119,7 @@ _ol_Geolocation_.prototype.disposeInternal = function() {
/** /**
* @private * @private
*/ */
_ol_Geolocation_.prototype.handleProjectionChanged_ = function() { Geolocation.prototype.handleProjectionChanged_ = function() {
var projection = this.getProjection(); var projection = this.getProjection();
if (projection) { if (projection) {
this.transform_ = getTransformFromProjections( this.transform_ = getTransformFromProjections(
@@ -135,7 +135,7 @@ _ol_Geolocation_.prototype.handleProjectionChanged_ = function() {
/** /**
* @private * @private
*/ */
_ol_Geolocation_.prototype.handleTrackingChanged_ = function() { Geolocation.prototype.handleTrackingChanged_ = function() {
if (_ol_has_.GEOLOCATION) { if (_ol_has_.GEOLOCATION) {
var tracking = this.getTracking(); var tracking = this.getTracking();
if (tracking && this.watchId_ === undefined) { if (tracking && this.watchId_ === undefined) {
@@ -155,7 +155,7 @@ _ol_Geolocation_.prototype.handleTrackingChanged_ = function() {
* @private * @private
* @param {GeolocationPosition} position position event. * @param {GeolocationPosition} position position event.
*/ */
_ol_Geolocation_.prototype.positionChange_ = function(position) { Geolocation.prototype.positionChange_ = function(position) {
var coords = position.coords; var coords = position.coords;
this.set(_ol_GeolocationProperty_.ACCURACY, coords.accuracy); this.set(_ol_GeolocationProperty_.ACCURACY, coords.accuracy);
this.set(_ol_GeolocationProperty_.ALTITUDE, this.set(_ol_GeolocationProperty_.ALTITUDE,
@@ -192,7 +192,7 @@ _ol_Geolocation_.prototype.positionChange_ = function(position) {
* @private * @private
* @param {GeolocationPositionError} error error object. * @param {GeolocationPositionError} error error object.
*/ */
_ol_Geolocation_.prototype.positionError_ = function(error) { Geolocation.prototype.positionError_ = function(error) {
error.type = EventType.ERROR; error.type = EventType.ERROR;
this.setTracking(false); this.setTracking(false);
this.dispatchEvent(/** @type {{type: string, target: undefined}} */ (error)); this.dispatchEvent(/** @type {{type: string, target: undefined}} */ (error));
@@ -206,7 +206,7 @@ _ol_Geolocation_.prototype.positionError_ = function(error) {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getAccuracy = function() { Geolocation.prototype.getAccuracy = function() {
return ( return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ACCURACY) /** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ACCURACY)
); );
@@ -219,7 +219,7 @@ _ol_Geolocation_.prototype.getAccuracy = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getAccuracyGeometry = function() { Geolocation.prototype.getAccuracyGeometry = function() {
return ( return (
/** @type {?ol.geom.Polygon} */ this.get(_ol_GeolocationProperty_.ACCURACY_GEOMETRY) || null /** @type {?ol.geom.Polygon} */ this.get(_ol_GeolocationProperty_.ACCURACY_GEOMETRY) || null
); );
@@ -233,7 +233,7 @@ _ol_Geolocation_.prototype.getAccuracyGeometry = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getAltitude = function() { Geolocation.prototype.getAltitude = function() {
return ( return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ALTITUDE) /** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ALTITUDE)
); );
@@ -247,7 +247,7 @@ _ol_Geolocation_.prototype.getAltitude = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getAltitudeAccuracy = function() { Geolocation.prototype.getAltitudeAccuracy = function() {
return ( return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ALTITUDE_ACCURACY) /** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ALTITUDE_ACCURACY)
); );
@@ -260,7 +260,7 @@ _ol_Geolocation_.prototype.getAltitudeAccuracy = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getHeading = function() { Geolocation.prototype.getHeading = function() {
return ( return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.HEADING) /** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.HEADING)
); );
@@ -274,7 +274,7 @@ _ol_Geolocation_.prototype.getHeading = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getPosition = function() { Geolocation.prototype.getPosition = function() {
return ( return (
/** @type {ol.Coordinate|undefined} */ this.get(_ol_GeolocationProperty_.POSITION) /** @type {ol.Coordinate|undefined} */ this.get(_ol_GeolocationProperty_.POSITION)
); );
@@ -288,7 +288,7 @@ _ol_Geolocation_.prototype.getPosition = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getProjection = function() { Geolocation.prototype.getProjection = function() {
return ( return (
/** @type {ol.proj.Projection|undefined} */ this.get(_ol_GeolocationProperty_.PROJECTION) /** @type {ol.proj.Projection|undefined} */ this.get(_ol_GeolocationProperty_.PROJECTION)
); );
@@ -302,7 +302,7 @@ _ol_Geolocation_.prototype.getProjection = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getSpeed = function() { Geolocation.prototype.getSpeed = function() {
return ( return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.SPEED) /** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.SPEED)
); );
@@ -315,7 +315,7 @@ _ol_Geolocation_.prototype.getSpeed = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getTracking = function() { Geolocation.prototype.getTracking = function() {
return ( return (
/** @type {boolean} */ this.get(_ol_GeolocationProperty_.TRACKING) /** @type {boolean} */ this.get(_ol_GeolocationProperty_.TRACKING)
); );
@@ -331,7 +331,7 @@ _ol_Geolocation_.prototype.getTracking = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.getTrackingOptions = function() { Geolocation.prototype.getTrackingOptions = function() {
return ( return (
/** @type {GeolocationPositionOptions|undefined} */ this.get(_ol_GeolocationProperty_.TRACKING_OPTIONS) /** @type {GeolocationPositionOptions|undefined} */ this.get(_ol_GeolocationProperty_.TRACKING_OPTIONS)
); );
@@ -345,7 +345,7 @@ _ol_Geolocation_.prototype.getTrackingOptions = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.setProjection = function(projection) { Geolocation.prototype.setProjection = function(projection) {
this.set(_ol_GeolocationProperty_.PROJECTION, getProjection(projection)); this.set(_ol_GeolocationProperty_.PROJECTION, getProjection(projection));
}; };
@@ -356,7 +356,7 @@ _ol_Geolocation_.prototype.setProjection = function(projection) {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.setTracking = function(tracking) { Geolocation.prototype.setTracking = function(tracking) {
this.set(_ol_GeolocationProperty_.TRACKING, tracking); this.set(_ol_GeolocationProperty_.TRACKING, tracking);
}; };
@@ -370,7 +370,7 @@ _ol_Geolocation_.prototype.setTracking = function(tracking) {
* @observable * @observable
* @api * @api
*/ */
_ol_Geolocation_.prototype.setTrackingOptions = function(options) { Geolocation.prototype.setTrackingOptions = function(options) {
this.set(_ol_GeolocationProperty_.TRACKING_OPTIONS, options); this.set(_ol_GeolocationProperty_.TRACKING_OPTIONS, options);
}; };
export default _ol_Geolocation_; export default Geolocation;
+39 -40
View File
@@ -15,6 +15,25 @@ import _ol_style_Stroke_ from './style/Stroke.js';
import _ol_style_Text_ from './style/Text.js'; import _ol_style_Text_ from './style/Text.js';
/**
* @type {ol.style.Stroke}
* @private
* @const
*/
var DEFAULT_STROKE_STYLE = new _ol_style_Stroke_({
color: 'rgba(0,0,0,0.2)'
});
/**
* TODO can be configurable
* @type {Array.<number>}
* @private
*/
var INTERVALS = [
90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.01, 0.005, 0.002, 0.001
];
/** /**
* @typedef {{map: (ol.PluggableMap|undefined), * @typedef {{map: (ol.PluggableMap|undefined),
* maxLines: (number|undefined), * maxLines: (number|undefined),
@@ -100,7 +119,7 @@ export var GraticuleOptions;
* of the viewport. * of the viewport.
* @api * @api
*/ */
var _ol_Graticule_ = function(opt_options) { var Graticule = function(opt_options) {
var options = opt_options || {}; var options = opt_options || {};
/** /**
@@ -192,8 +211,7 @@ var _ol_Graticule_ = function(opt_options) {
* @type {ol.style.Stroke} * @type {ol.style.Stroke}
* @private * @private
*/ */
this.strokeStyle_ = options.strokeStyle !== undefined ? this.strokeStyle_ = options.strokeStyle !== undefined ? options.strokeStyle : DEFAULT_STROKE_STYLE;
options.strokeStyle : _ol_Graticule_.DEFAULT_STROKE_STYLE_;
/** /**
* @type {ol.TransformFunction|undefined} * @type {ol.TransformFunction|undefined}
@@ -302,25 +320,6 @@ var _ol_Graticule_ = function(opt_options) {
}; };
/**
* @type {ol.style.Stroke}
* @private
* @const
*/
_ol_Graticule_.DEFAULT_STROKE_STYLE_ = new _ol_style_Stroke_({
color: 'rgba(0,0,0,0.2)'
});
/**
* TODO can be configurable
* @type {Array.<number>}
* @private
*/
_ol_Graticule_.intervals_ = [90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05,
0.01, 0.005, 0.002, 0.001];
/** /**
* @param {number} lon Longitude. * @param {number} lon Longitude.
* @param {number} minLat Minimal latitude. * @param {number} minLat Minimal latitude.
@@ -331,7 +330,7 @@ _ol_Graticule_.intervals_ = [90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05,
* @return {number} Index. * @return {number} Index.
* @private * @private
*/ */
_ol_Graticule_.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredTolerance, extent, index) { Graticule.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredTolerance, extent, index) {
var lineString = this.getMeridian_(lon, minLat, maxLat, var lineString = this.getMeridian_(lon, minLat, maxLat,
squaredTolerance, index); squaredTolerance, index);
if (intersects(lineString.getExtent(), extent)) { if (intersects(lineString.getExtent(), extent)) {
@@ -354,7 +353,7 @@ _ol_Graticule_.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredTol
* @return {ol.geom.Point} Meridian point. * @return {ol.geom.Point} Meridian point.
* @private * @private
*/ */
_ol_Graticule_.prototype.getMeridianPoint_ = function(lineString, extent, index) { Graticule.prototype.getMeridianPoint_ = function(lineString, extent, index) {
var flatCoordinates = lineString.getFlatCoordinates(); var flatCoordinates = lineString.getFlatCoordinates();
var clampedBottom = Math.max(extent[1], flatCoordinates[1]); var clampedBottom = Math.max(extent[1], flatCoordinates[1]);
var clampedTop = Math.min(extent[3], flatCoordinates[flatCoordinates.length - 1]); var clampedTop = Math.min(extent[3], flatCoordinates[flatCoordinates.length - 1]);
@@ -379,7 +378,7 @@ _ol_Graticule_.prototype.getMeridianPoint_ = function(lineString, extent, index)
* @return {number} Index. * @return {number} Index.
* @private * @private
*/ */
_ol_Graticule_.prototype.addParallel_ = function(lat, minLon, maxLon, squaredTolerance, extent, index) { Graticule.prototype.addParallel_ = function(lat, minLon, maxLon, squaredTolerance, extent, index) {
var lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance, var lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance,
index); index);
if (intersects(lineString.getExtent(), extent)) { if (intersects(lineString.getExtent(), extent)) {
@@ -403,7 +402,7 @@ _ol_Graticule_.prototype.addParallel_ = function(lat, minLon, maxLon, squaredTol
* @return {ol.geom.Point} Parallel point. * @return {ol.geom.Point} Parallel point.
* @private * @private
*/ */
_ol_Graticule_.prototype.getParallelPoint_ = function(lineString, extent, index) { Graticule.prototype.getParallelPoint_ = function(lineString, extent, index) {
var flatCoordinates = lineString.getFlatCoordinates(); var flatCoordinates = lineString.getFlatCoordinates();
var clampedLeft = Math.max(extent[0], flatCoordinates[0]); var clampedLeft = Math.max(extent[0], flatCoordinates[0]);
var clampedRight = Math.min(extent[2], flatCoordinates[flatCoordinates.length - 2]); var clampedRight = Math.min(extent[2], flatCoordinates[flatCoordinates.length - 2]);
@@ -425,7 +424,7 @@ _ol_Graticule_.prototype.getParallelPoint_ = function(lineString, extent, index)
* @param {number} squaredTolerance Squared tolerance. * @param {number} squaredTolerance Squared tolerance.
* @private * @private
*/ */
_ol_Graticule_.prototype.createGraticule_ = function(extent, center, resolution, squaredTolerance) { Graticule.prototype.createGraticule_ = function(extent, center, resolution, squaredTolerance) {
var interval = this.getInterval_(resolution); var interval = this.getInterval_(resolution);
if (interval == -1) { if (interval == -1) {
@@ -519,7 +518,7 @@ _ol_Graticule_.prototype.createGraticule_ = function(extent, center, resolution,
* @return {number} The interval in degrees. * @return {number} The interval in degrees.
* @private * @private
*/ */
_ol_Graticule_.prototype.getInterval_ = function(resolution) { Graticule.prototype.getInterval_ = function(resolution) {
var centerLon = this.projectionCenterLonLat_[0]; var centerLon = this.projectionCenterLonLat_[0];
var centerLat = this.projectionCenterLonLat_[1]; var centerLat = this.projectionCenterLonLat_[1];
var interval = -1; var interval = -1;
@@ -529,8 +528,8 @@ _ol_Graticule_.prototype.getInterval_ = function(resolution) {
var p1 = []; var p1 = [];
/** @type {Array.<number>} **/ /** @type {Array.<number>} **/
var p2 = []; var p2 = [];
for (i = 0, ii = _ol_Graticule_.intervals_.length; i < ii; ++i) { for (i = 0, ii = INTERVALS.length; i < ii; ++i) {
delta = _ol_Graticule_.intervals_[i] / 2; delta = INTERVALS[i] / 2;
p1[0] = centerLon - delta; p1[0] = centerLon - delta;
p1[1] = centerLat - delta; p1[1] = centerLat - delta;
p2[0] = centerLon + delta; p2[0] = centerLon + delta;
@@ -541,7 +540,7 @@ _ol_Graticule_.prototype.getInterval_ = function(resolution) {
if (dist <= target) { if (dist <= target) {
break; break;
} }
interval = _ol_Graticule_.intervals_[i]; interval = INTERVALS[i];
} }
return interval; return interval;
}; };
@@ -552,7 +551,7 @@ _ol_Graticule_.prototype.getInterval_ = function(resolution) {
* @return {ol.PluggableMap} The map. * @return {ol.PluggableMap} The map.
* @api * @api
*/ */
_ol_Graticule_.prototype.getMap = function() { Graticule.prototype.getMap = function() {
return this.map_; return this.map_;
}; };
@@ -566,7 +565,7 @@ _ol_Graticule_.prototype.getMap = function() {
* @param {number} index Index. * @param {number} index Index.
* @private * @private
*/ */
_ol_Graticule_.prototype.getMeridian_ = function(lon, minLat, maxLat, Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat,
squaredTolerance, index) { squaredTolerance, index) {
var flatCoordinates = _ol_geom_flat_geodesic_.meridian(lon, var flatCoordinates = _ol_geom_flat_geodesic_.meridian(lon,
minLat, maxLat, this.projection_, squaredTolerance); minLat, maxLat, this.projection_, squaredTolerance);
@@ -582,7 +581,7 @@ _ol_Graticule_.prototype.getMeridian_ = function(lon, minLat, maxLat,
* @return {Array.<ol.geom.LineString>} The meridians. * @return {Array.<ol.geom.LineString>} The meridians.
* @api * @api
*/ */
_ol_Graticule_.prototype.getMeridians = function() { Graticule.prototype.getMeridians = function() {
return this.meridians_; return this.meridians_;
}; };
@@ -596,7 +595,7 @@ _ol_Graticule_.prototype.getMeridians = function() {
* @param {number} index Index. * @param {number} index Index.
* @private * @private
*/ */
_ol_Graticule_.prototype.getParallel_ = function(lat, minLon, maxLon, Graticule.prototype.getParallel_ = function(lat, minLon, maxLon,
squaredTolerance, index) { squaredTolerance, index) {
var flatCoordinates = _ol_geom_flat_geodesic_.parallel(lat, var flatCoordinates = _ol_geom_flat_geodesic_.parallel(lat,
minLon, maxLon, this.projection_, squaredTolerance); minLon, maxLon, this.projection_, squaredTolerance);
@@ -612,7 +611,7 @@ _ol_Graticule_.prototype.getParallel_ = function(lat, minLon, maxLon,
* @return {Array.<ol.geom.LineString>} The parallels. * @return {Array.<ol.geom.LineString>} The parallels.
* @api * @api
*/ */
_ol_Graticule_.prototype.getParallels = function() { Graticule.prototype.getParallels = function() {
return this.parallels_; return this.parallels_;
}; };
@@ -621,7 +620,7 @@ _ol_Graticule_.prototype.getParallels = function() {
* @param {ol.render.Event} e Event. * @param {ol.render.Event} e Event.
* @private * @private
*/ */
_ol_Graticule_.prototype.handlePostCompose_ = function(e) { Graticule.prototype.handlePostCompose_ = function(e) {
var vectorContext = e.vectorContext; var vectorContext = e.vectorContext;
var frameState = e.frameState; var frameState = e.frameState;
var extent = frameState.extent; var extent = frameState.extent;
@@ -677,7 +676,7 @@ _ol_Graticule_.prototype.handlePostCompose_ = function(e) {
* @param {ol.proj.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @private * @private
*/ */
_ol_Graticule_.prototype.updateProjectionInfo_ = function(projection) { Graticule.prototype.updateProjectionInfo_ = function(projection) {
var epsg4326Projection = getProjection('EPSG:4326'); var epsg4326Projection = getProjection('EPSG:4326');
var extent = projection.getExtent(); var extent = projection.getExtent();
@@ -722,7 +721,7 @@ _ol_Graticule_.prototype.updateProjectionInfo_ = function(projection) {
* @param {ol.PluggableMap} map Map. * @param {ol.PluggableMap} map Map.
* @api * @api
*/ */
_ol_Graticule_.prototype.setMap = function(map) { Graticule.prototype.setMap = function(map) {
if (this.map_) { if (this.map_) {
this.map_.un(_ol_render_EventType_.POSTCOMPOSE, this.map_.un(_ol_render_EventType_.POSTCOMPOSE,
this.handlePostCompose_, this); this.handlePostCompose_, this);
@@ -735,4 +734,4 @@ _ol_Graticule_.prototype.setMap = function(map) {
} }
this.map_ = map; this.map_ = map;
}; };
export default _ol_Graticule_; export default Graticule;
+8 -7
View File
@@ -1,6 +1,7 @@
/** /**
* @module ol/Kinetic * @module ol/Kinetic
*/ */
/** /**
* @classdesc * @classdesc
* Implementation of inertial deceleration for map movement. * Implementation of inertial deceleration for map movement.
@@ -13,7 +14,7 @@
* @struct * @struct
* @api * @api
*/ */
var _ol_Kinetic_ = function(decay, minVelocity, delay) { var Kinetic = function(decay, minVelocity, delay) {
/** /**
* @private * @private
@@ -56,7 +57,7 @@ var _ol_Kinetic_ = function(decay, minVelocity, delay) {
/** /**
* FIXME empty description for jsdoc * FIXME empty description for jsdoc
*/ */
_ol_Kinetic_.prototype.begin = function() { Kinetic.prototype.begin = function() {
this.points_.length = 0; this.points_.length = 0;
this.angle_ = 0; this.angle_ = 0;
this.initialVelocity_ = 0; this.initialVelocity_ = 0;
@@ -67,7 +68,7 @@ _ol_Kinetic_.prototype.begin = function() {
* @param {number} x X. * @param {number} x X.
* @param {number} y Y. * @param {number} y Y.
*/ */
_ol_Kinetic_.prototype.update = function(x, y) { Kinetic.prototype.update = function(x, y) {
this.points_.push(x, y, Date.now()); this.points_.push(x, y, Date.now());
}; };
@@ -75,7 +76,7 @@ _ol_Kinetic_.prototype.update = function(x, y) {
/** /**
* @return {boolean} Whether we should do kinetic animation. * @return {boolean} Whether we should do kinetic animation.
*/ */
_ol_Kinetic_.prototype.end = function() { Kinetic.prototype.end = function() {
if (this.points_.length < 6) { if (this.points_.length < 6) {
// at least 2 points are required (i.e. there must be at least 6 elements // at least 2 points are required (i.e. there must be at least 6 elements
// in the array) // in the array)
@@ -114,7 +115,7 @@ _ol_Kinetic_.prototype.end = function() {
/** /**
* @return {number} Total distance travelled (pixels). * @return {number} Total distance travelled (pixels).
*/ */
_ol_Kinetic_.prototype.getDistance = function() { Kinetic.prototype.getDistance = function() {
return (this.minVelocity_ - this.initialVelocity_) / this.decay_; return (this.minVelocity_ - this.initialVelocity_) / this.decay_;
}; };
@@ -122,7 +123,7 @@ _ol_Kinetic_.prototype.getDistance = function() {
/** /**
* @return {number} Angle of the kinetic panning animation (radians). * @return {number} Angle of the kinetic panning animation (radians).
*/ */
_ol_Kinetic_.prototype.getAngle = function() { Kinetic.prototype.getAngle = function() {
return this.angle_; return this.angle_;
}; };
export default _ol_Kinetic_; export default Kinetic;
+2 -2
View File
@@ -1,7 +1,7 @@
/** /**
* @module ol/asserts * @module ol/asserts
*/ */
import _ol_AssertionError_ from './AssertionError.js'; import AssertionError from './AssertionError.js';
var _ol_asserts_ = {}; var _ol_asserts_ = {};
@@ -11,7 +11,7 @@ var _ol_asserts_ = {};
*/ */
_ol_asserts_.assert = function(assertion, errorCode) { _ol_asserts_.assert = function(assertion, errorCode) {
if (!assertion) { if (!assertion) {
throw new _ol_AssertionError_(errorCode); throw new AssertionError(errorCode);
} }
}; };
export default _ol_asserts_; export default _ol_asserts_;
+2 -2
View File
@@ -2,7 +2,7 @@
* @module ol/interaction * @module ol/interaction
*/ */
import _ol_Collection_ from './Collection.js'; import _ol_Collection_ from './Collection.js';
import _ol_Kinetic_ from './Kinetic.js'; import Kinetic from './Kinetic.js';
import DoubleClickZoom from './interaction/DoubleClickZoom.js'; import DoubleClickZoom from './interaction/DoubleClickZoom.js';
import DragPan from './interaction/DragPan.js'; import DragPan from './interaction/DragPan.js';
import DragRotate from './interaction/DragRotate.js'; import DragRotate from './interaction/DragRotate.js';
@@ -44,7 +44,7 @@ _ol_interaction_.defaults = function(opt_options) {
var interactions = new _ol_Collection_(); var interactions = new _ol_Collection_();
var kinetic = new _ol_Kinetic_(-0.005, 0.05, 100); var kinetic = new Kinetic(-0.005, 0.05, 100);
var altShiftDragRotate = options.altShiftDragRotate !== undefined ? var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
options.altShiftDragRotate : true; options.altShiftDragRotate : true;
+5 -5
View File
@@ -1,25 +1,25 @@
import {VERSION} from '../../../src/ol/index.js'; import {VERSION} from '../../../src/ol/index.js';
import _ol_AssertionError_ from '../../../src/ol/AssertionError.js'; import AssertionError from '../../../src/ol/AssertionError.js';
describe('ol.AssertionError', function() { describe('ol.AssertionError', function() {
it('generates an error', function() { it('generates an error', function() {
var error = new _ol_AssertionError_(42); var error = new AssertionError(42);
expect(error).to.be.an(Error); expect(error).to.be.an(Error);
}); });
it('generates a message with a versioned url', function() { it('generates a message with a versioned url', function() {
var error = new _ol_AssertionError_(42); var error = new AssertionError(42);
var path = VERSION ? VERSION.split('-')[0] : 'latest'; var path = VERSION ? VERSION.split('-')[0] : 'latest';
expect(error.message).to.be('Assertion failed. See https://openlayers.org/en/' + path + '/doc/errors/#42 for details.'); expect(error.message).to.be('Assertion failed. See https://openlayers.org/en/' + path + '/doc/errors/#42 for details.');
}); });
it('has an error code', function() { it('has an error code', function() {
var error = new _ol_AssertionError_(42); var error = new AssertionError(42);
expect(error.code).to.be(42); expect(error.code).to.be(42);
}); });
it('has a name', function() { it('has a name', function() {
var error = new _ol_AssertionError_(42); var error = new AssertionError(42);
expect(error.name).to.be('AssertionError'); expect(error.name).to.be('AssertionError');
}); });
}); });
+3 -3
View File
@@ -1,4 +1,4 @@
import _ol_Geolocation_ from '../../../src/ol/Geolocation.js'; import Geolocation from '../../../src/ol/Geolocation.js';
describe('ol.Geolocation', function() { describe('ol.Geolocation', function() {
@@ -6,8 +6,8 @@ describe('ol.Geolocation', function() {
describe('constructor', function() { describe('constructor', function() {
it('can be constructed without arguments', function() { it('can be constructed without arguments', function() {
var instance = new _ol_Geolocation_(); var instance = new Geolocation();
expect(instance).to.be.an(_ol_Geolocation_); expect(instance).to.be.an(Geolocation);
}); });
}); });
+5 -5
View File
@@ -1,4 +1,4 @@
import _ol_Graticule_ from '../../../src/ol/Graticule.js'; import Graticule from '../../../src/ol/Graticule.js';
import _ol_Map_ from '../../../src/ol/Map.js'; import _ol_Map_ from '../../../src/ol/Map.js';
import {get as getProjection} from '../../../src/ol/proj.js'; import {get as getProjection} from '../../../src/ol/proj.js';
import _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js'; import _ol_style_Stroke_ from '../../../src/ol/style/Stroke.js';
@@ -8,7 +8,7 @@ describe('ol.Graticule', function() {
var graticule; var graticule;
function createGraticule() { function createGraticule() {
graticule = new _ol_Graticule_({ graticule = new Graticule({
map: new _ol_Map_({}) map: new _ol_Map_({})
}); });
} }
@@ -30,7 +30,7 @@ describe('ol.Graticule', function() {
}); });
it('creates a graticule with labels', function() { it('creates a graticule with labels', function() {
graticule = new _ol_Graticule_({ graticule = new Graticule({
map: new _ol_Map_({}), map: new _ol_Map_({}),
showLabels: true showLabels: true
}); });
@@ -62,7 +62,7 @@ describe('ol.Graticule', function() {
var customStrokeStyle = new _ol_style_Stroke_({ var customStrokeStyle = new _ol_style_Stroke_({
color: 'rebeccapurple' color: 'rebeccapurple'
}); });
var styledGraticule = new _ol_Graticule_({ var styledGraticule = new Graticule({
map: new _ol_Map_({}), map: new _ol_Map_({}),
strokeStyle: customStrokeStyle strokeStyle: customStrokeStyle
}); });
@@ -75,7 +75,7 @@ describe('ol.Graticule', function() {
it('can be configured with label options', function() { it('can be configured with label options', function() {
var latLabelStyle = new _ol_style_Text_(); var latLabelStyle = new _ol_style_Text_();
var lonLabelStyle = new _ol_style_Text_(); var lonLabelStyle = new _ol_style_Text_();
graticule = new _ol_Graticule_({ graticule = new Graticule({
map: new _ol_Map_({}), map: new _ol_Map_({}),
showLabels: true, showLabels: true,
lonLabelFormatter: function(lon) { lonLabelFormatter: function(lon) {