Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions

View File

@@ -1,6 +1,7 @@
goog.provide('ol.AssertionError');
goog.require('ol');
/**
* @module ol/AssertionError
*/
import _ol_ from './index.js';
/**
* Error object thrown when an assertion failed. This is an ECMA-262 Error,
@@ -11,9 +12,9 @@ goog.require('ol');
* @implements {oli.AssertionError}
* @param {number} code Error code.
*/
ol.AssertionError = function(code) {
var _ol_AssertionError_ = function(code) {
var path = ol.VERSION ? ol.VERSION.split('-')[0] : 'latest';
var path = _ol_.VERSION ? _ol_.VERSION.split('-')[0] : 'latest';
/**
* @type {string}
@@ -34,4 +35,6 @@ ol.AssertionError = function(code) {
this.name = 'AssertionError';
};
ol.inherits(ol.AssertionError, Error);
_ol_.inherits(_ol_AssertionError_, Error);
export default _ol_AssertionError_;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.Attribution');
goog.require('ol.TileRange');
goog.require('ol.math');
goog.require('ol.tilegrid');
/**
* @module ol/Attribution
*/
import _ol_TileRange_ from './TileRange.js';
import _ol_math_ from './math.js';
import _ol_tilegrid_ from './tilegrid.js';
/**
* @classdesc
@@ -27,7 +27,7 @@ goog.require('ol.tilegrid');
* @struct
* @api
*/
ol.Attribution = function(options) {
var _ol_Attribution_ = function(options) {
/**
* @private
@@ -49,7 +49,7 @@ ol.Attribution = function(options) {
* @return {string} The attribution HTML.
* @api
*/
ol.Attribution.prototype.getHTML = function() {
_ol_Attribution_.prototype.getHTML = function() {
return this.html_;
};
@@ -60,7 +60,7 @@ ol.Attribution.prototype.getHTML = function() {
* @param {!ol.proj.Projection} projection Projection.
* @return {boolean} Intersects any tile range.
*/
ol.Attribution.prototype.intersectsAnyTileRange = function(tileRanges, tileGrid, projection) {
_ol_Attribution_.prototype.intersectsAnyTileRange = function(tileRanges, tileGrid, projection) {
if (!this.tileRanges_) {
return true;
}
@@ -77,13 +77,13 @@ ol.Attribution.prototype.intersectsAnyTileRange = function(tileRanges, tileGrid,
return true;
}
var extentTileRange = tileGrid.getTileRangeForExtentAndZ(
ol.tilegrid.extentFromProjection(projection), parseInt(zKey, 10));
_ol_tilegrid_.extentFromProjection(projection), parseInt(zKey, 10));
var width = extentTileRange.getWidth();
if (tileRange.minX < extentTileRange.minX ||
tileRange.maxX > extentTileRange.maxX) {
if (testTileRange.intersects(new ol.TileRange(
ol.math.modulo(tileRange.minX, width),
ol.math.modulo(tileRange.maxX, width),
if (testTileRange.intersects(new _ol_TileRange_(
_ol_math_.modulo(tileRange.minX, width),
_ol_math_.modulo(tileRange.maxX, width),
tileRange.minY, tileRange.maxY))) {
return true;
}
@@ -96,3 +96,4 @@ ol.Attribution.prototype.intersectsAnyTileRange = function(tileRanges, tileGrid,
}
return false;
};
export default _ol_Attribution_;

View File

@@ -1,25 +1,26 @@
goog.provide('ol.CanvasMap');
goog.require('ol');
goog.require('ol.PluggableMap');
goog.require('ol.PluginType');
goog.require('ol.control');
goog.require('ol.interaction');
goog.require('ol.obj');
goog.require('ol.plugins');
goog.require('ol.renderer.canvas.ImageLayer');
goog.require('ol.renderer.canvas.Map');
goog.require('ol.renderer.canvas.TileLayer');
goog.require('ol.renderer.canvas.VectorLayer');
goog.require('ol.renderer.canvas.VectorTileLayer');
/**
* @module ol/CanvasMap
*/
import _ol_ from './index.js';
import _ol_PluggableMap_ from './PluggableMap.js';
import _ol_PluginType_ from './PluginType.js';
import _ol_control_ from './control.js';
import _ol_interaction_ from './interaction.js';
import _ol_obj_ from './obj.js';
import _ol_plugins_ from './plugins.js';
import _ol_renderer_canvas_ImageLayer_ from './renderer/canvas/ImageLayer.js';
import _ol_renderer_canvas_Map_ from './renderer/canvas/Map.js';
import _ol_renderer_canvas_TileLayer_ from './renderer/canvas/TileLayer.js';
import _ol_renderer_canvas_VectorLayer_ from './renderer/canvas/VectorLayer.js';
import _ol_renderer_canvas_VectorTileLayer_ from './renderer/canvas/VectorTileLayer.js';
ol.plugins.register(ol.PluginType.MAP_RENDERER, ol.renderer.canvas.Map);
ol.plugins.registerMultiple(ol.PluginType.LAYER_RENDERER, [
ol.renderer.canvas.ImageLayer,
ol.renderer.canvas.TileLayer,
ol.renderer.canvas.VectorLayer,
ol.renderer.canvas.VectorTileLayer
_ol_plugins_.register(_ol_PluginType_.MAP_RENDERER, _ol_renderer_canvas_Map_);
_ol_plugins_.registerMultiple(_ol_PluginType_.LAYER_RENDERER, [
_ol_renderer_canvas_ImageLayer_,
_ol_renderer_canvas_TileLayer_,
_ol_renderer_canvas_VectorLayer_,
_ol_renderer_canvas_VectorTileLayer_
]);
@@ -71,16 +72,18 @@ ol.plugins.registerMultiple(ol.PluginType.LAYER_RENDERER, [
* @fires ol.render.Event#precompose
* @api
*/
ol.CanvasMap = function(options) {
options = ol.obj.assign({}, options);
var _ol_CanvasMap_ = function(options) {
options = _ol_obj_.assign({}, options);
delete options.renderer;
if (!options.controls) {
options.controls = ol.control.defaults();
options.controls = _ol_control_.defaults();
}
if (!options.interactions) {
options.interactions = ol.interaction.defaults();
options.interactions = _ol_interaction_.defaults();
}
ol.PluggableMap.call(this, options);
_ol_PluggableMap_.call(this, options);
};
ol.inherits(ol.CanvasMap, ol.PluggableMap);
_ol_.inherits(_ol_CanvasMap_, _ol_PluggableMap_);
export default _ol_CanvasMap_;

View File

@@ -1,13 +1,15 @@
goog.provide('ol.CenterConstraint');
goog.require('ol.math');
/**
* @module ol/CenterConstraint
*/
import _ol_math_ from './math.js';
var _ol_CenterConstraint_ = {};
/**
* @param {ol.Extent} extent Extent.
* @return {ol.CenterConstraintType} The constraint.
*/
ol.CenterConstraint.createExtent = function(extent) {
_ol_CenterConstraint_.createExtent = function(extent) {
return (
/**
* @param {ol.Coordinate|undefined} center Center.
@@ -16,13 +18,14 @@ ol.CenterConstraint.createExtent = function(extent) {
function(center) {
if (center) {
return [
ol.math.clamp(center[0], extent[0], extent[2]),
ol.math.clamp(center[1], extent[1], extent[3])
_ol_math_.clamp(center[0], extent[0], extent[2]),
_ol_math_.clamp(center[1], extent[1], extent[3])
];
} else {
return undefined;
}
});
}
);
};
@@ -30,6 +33,7 @@ ol.CenterConstraint.createExtent = function(extent) {
* @param {ol.Coordinate|undefined} center Center.
* @return {ol.Coordinate|undefined} Center.
*/
ol.CenterConstraint.none = function(center) {
_ol_CenterConstraint_.none = function(center) {
return center;
};
export default _ol_CenterConstraint_;

View File

@@ -1,16 +1,16 @@
/**
* @module ol/Collection
*/
/**
* An implementation of Google Maps' MVCArray.
* @see https://developers.google.com/maps/documentation/javascript/reference
*/
goog.provide('ol.Collection');
goog.require('ol');
goog.require('ol.AssertionError');
goog.require('ol.CollectionEventType');
goog.require('ol.Object');
goog.require('ol.events.Event');
import _ol_ from './index.js';
import _ol_AssertionError_ from './AssertionError.js';
import _ol_CollectionEventType_ from './CollectionEventType.js';
import _ol_Object_ from './Object.js';
import _ol_events_Event_ from './events/Event.js';
/**
* @classdesc
@@ -28,9 +28,9 @@ goog.require('ol.events.Event');
* @template T
* @api
*/
ol.Collection = function(opt_array, opt_options) {
var _ol_Collection_ = function(opt_array, opt_options) {
ol.Object.call(this);
_ol_Object_.call(this);
var options = opt_options || {};
@@ -55,14 +55,15 @@ ol.Collection = function(opt_array, opt_options) {
this.updateLength_();
};
ol.inherits(ol.Collection, ol.Object);
_ol_.inherits(_ol_Collection_, _ol_Object_);
/**
* Remove all elements from the collection.
* @api
*/
ol.Collection.prototype.clear = function() {
_ol_Collection_.prototype.clear = function() {
while (this.getLength() > 0) {
this.pop();
}
@@ -76,7 +77,7 @@ ol.Collection.prototype.clear = function() {
* @return {ol.Collection.<T>} This collection.
* @api
*/
ol.Collection.prototype.extend = function(arr) {
_ol_Collection_.prototype.extend = function(arr) {
var i, ii;
for (i = 0, ii = arr.length; i < ii; ++i) {
this.push(arr[i]);
@@ -94,7 +95,7 @@ ol.Collection.prototype.extend = function(arr) {
* @template S
* @api
*/
ol.Collection.prototype.forEach = function(f, opt_this) {
_ol_Collection_.prototype.forEach = function(f, opt_this) {
var fn = (opt_this) ? f.bind(opt_this) : f;
var array = this.array_;
for (var i = 0, ii = array.length; i < ii; ++i) {
@@ -111,7 +112,7 @@ ol.Collection.prototype.forEach = function(f, opt_this) {
* @return {!Array.<T>} Array.
* @api
*/
ol.Collection.prototype.getArray = function() {
_ol_Collection_.prototype.getArray = function() {
return this.array_;
};
@@ -122,7 +123,7 @@ ol.Collection.prototype.getArray = function() {
* @return {T} Element.
* @api
*/
ol.Collection.prototype.item = function(index) {
_ol_Collection_.prototype.item = function(index) {
return this.array_[index];
};
@@ -133,8 +134,10 @@ ol.Collection.prototype.item = function(index) {
* @observable
* @api
*/
ol.Collection.prototype.getLength = function() {
return /** @type {number} */ (this.get(ol.Collection.Property_.LENGTH));
_ol_Collection_.prototype.getLength = function() {
return (
/** @type {number} */ this.get(_ol_Collection_.Property_.LENGTH)
);
};
@@ -144,14 +147,14 @@ ol.Collection.prototype.getLength = function() {
* @param {T} elem Element.
* @api
*/
ol.Collection.prototype.insertAt = function(index, elem) {
_ol_Collection_.prototype.insertAt = function(index, elem) {
if (this.unique_) {
this.assertUnique_(elem);
}
this.array_.splice(index, 0, elem);
this.updateLength_();
this.dispatchEvent(
new ol.Collection.Event(ol.CollectionEventType.ADD, elem));
new _ol_Collection_.Event(_ol_CollectionEventType_.ADD, elem));
};
@@ -161,7 +164,7 @@ ol.Collection.prototype.insertAt = function(index, elem) {
* @return {T|undefined} Element.
* @api
*/
ol.Collection.prototype.pop = function() {
_ol_Collection_.prototype.pop = function() {
return this.removeAt(this.getLength() - 1);
};
@@ -172,7 +175,7 @@ ol.Collection.prototype.pop = function() {
* @return {number} New length of the collection.
* @api
*/
ol.Collection.prototype.push = function(elem) {
_ol_Collection_.prototype.push = function(elem) {
if (this.unique_) {
this.assertUnique_(elem);
}
@@ -188,7 +191,7 @@ ol.Collection.prototype.push = function(elem) {
* @return {T|undefined} The removed element or undefined if none found.
* @api
*/
ol.Collection.prototype.remove = function(elem) {
_ol_Collection_.prototype.remove = function(elem) {
var arr = this.array_;
var i, ii;
for (i = 0, ii = arr.length; i < ii; ++i) {
@@ -207,12 +210,12 @@ ol.Collection.prototype.remove = function(elem) {
* @return {T|undefined} Value.
* @api
*/
ol.Collection.prototype.removeAt = function(index) {
_ol_Collection_.prototype.removeAt = function(index) {
var prev = this.array_[index];
this.array_.splice(index, 1);
this.updateLength_();
this.dispatchEvent(
new ol.Collection.Event(ol.CollectionEventType.REMOVE, prev));
new _ol_Collection_.Event(_ol_CollectionEventType_.REMOVE, prev));
return prev;
};
@@ -223,7 +226,7 @@ ol.Collection.prototype.removeAt = function(index) {
* @param {T} elem Element.
* @api
*/
ol.Collection.prototype.setAt = function(index, elem) {
_ol_Collection_.prototype.setAt = function(index, elem) {
var n = this.getLength();
if (index < n) {
if (this.unique_) {
@@ -232,9 +235,9 @@ ol.Collection.prototype.setAt = function(index, elem) {
var prev = this.array_[index];
this.array_[index] = elem;
this.dispatchEvent(
new ol.Collection.Event(ol.CollectionEventType.REMOVE, prev));
new _ol_Collection_.Event(_ol_CollectionEventType_.REMOVE, prev));
this.dispatchEvent(
new ol.Collection.Event(ol.CollectionEventType.ADD, elem));
new _ol_Collection_.Event(_ol_CollectionEventType_.ADD, elem));
} else {
var j;
for (j = n; j < index; ++j) {
@@ -248,8 +251,8 @@ ol.Collection.prototype.setAt = function(index, elem) {
/**
* @private
*/
ol.Collection.prototype.updateLength_ = function() {
this.set(ol.Collection.Property_.LENGTH, this.array_.length);
_ol_Collection_.prototype.updateLength_ = function() {
this.set(_ol_Collection_.Property_.LENGTH, this.array_.length);
};
@@ -258,10 +261,10 @@ ol.Collection.prototype.updateLength_ = function() {
* @param {T} elem Element.
* @param {number=} opt_except Optional index to ignore.
*/
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) {
if (this.array_[i] === elem && i !== opt_except) {
throw new ol.AssertionError(58);
throw new _ol_AssertionError_(58);
}
}
};
@@ -271,7 +274,7 @@ ol.Collection.prototype.assertUnique_ = function(elem, opt_except) {
* @enum {string}
* @private
*/
ol.Collection.Property_ = {
_ol_Collection_.Property_ = {
LENGTH: 'length'
};
@@ -287,9 +290,9 @@ ol.Collection.Property_ = {
* @param {ol.CollectionEventType} type Type.
* @param {*=} opt_element Element.
*/
ol.Collection.Event = function(type, opt_element) {
_ol_Collection_.Event = function(type, opt_element) {
ol.events.Event.call(this, type);
_ol_events_Event_.call(this, type);
/**
* The element that is added to or removed from the collection.
@@ -299,4 +302,5 @@ ol.Collection.Event = function(type, opt_element) {
this.element = opt_element;
};
ol.inherits(ol.Collection.Event, ol.events.Event);
_ol_.inherits(_ol_Collection_.Event, _ol_events_Event_);
export default _ol_Collection_;

View File

@@ -1,9 +1,10 @@
goog.provide('ol.CollectionEventType');
/**
* @module ol/CollectionEventType
*/
/**
* @enum {string}
*/
ol.CollectionEventType = {
var _ol_CollectionEventType_ = {
/**
* Triggered when an item is added to the collection.
* @event ol.Collection.Event#add
@@ -17,3 +18,5 @@ ol.CollectionEventType = {
*/
REMOVE: 'remove'
};
export default _ol_CollectionEventType_;

View File

@@ -1,11 +1,11 @@
goog.provide('ol.DeviceOrientation');
goog.require('ol.events');
goog.require('ol');
goog.require('ol.Object');
goog.require('ol.has');
goog.require('ol.math');
/**
* @module ol/DeviceOrientation
*/
import _ol_events_ from './events.js';
import _ol_ from './index.js';
import _ol_Object_ from './Object.js';
import _ol_has_ from './has.js';
import _ol_math_ from './math.js';
/**
* @classdesc
@@ -64,9 +64,9 @@ goog.require('ol.math');
* @param {olx.DeviceOrientationOptions=} opt_options Options.
* @api
*/
ol.DeviceOrientation = function(opt_options) {
var _ol_DeviceOrientation_ = function(opt_options) {
ol.Object.call(this);
_ol_Object_.call(this);
var options = opt_options ? opt_options : {};
@@ -76,22 +76,23 @@ ol.DeviceOrientation = function(opt_options) {
*/
this.listenerKey_ = null;
ol.events.listen(this,
ol.Object.getChangeEventType(ol.DeviceOrientation.Property_.TRACKING),
_ol_events_.listen(this,
_ol_Object_.getChangeEventType(_ol_DeviceOrientation_.Property_.TRACKING),
this.handleTrackingChanged_, this);
this.setTracking(options.tracking !== undefined ? options.tracking : false);
};
ol.inherits(ol.DeviceOrientation, ol.Object);
_ol_.inherits(_ol_DeviceOrientation_, _ol_Object_);
/**
* @inheritDoc
*/
ol.DeviceOrientation.prototype.disposeInternal = function() {
_ol_DeviceOrientation_.prototype.disposeInternal = function() {
this.setTracking(false);
ol.Object.prototype.disposeInternal.call(this);
_ol_Object_.prototype.disposeInternal.call(this);
};
@@ -99,27 +100,27 @@ ol.DeviceOrientation.prototype.disposeInternal = function() {
* @private
* @param {Event} originalEvent Event.
*/
ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
_ol_DeviceOrientation_.prototype.orientationChange_ = function(originalEvent) {
var event = /** @type {DeviceOrientationEvent} */ (originalEvent);
if (event.alpha !== null) {
var alpha = ol.math.toRadians(event.alpha);
this.set(ol.DeviceOrientation.Property_.ALPHA, alpha);
var alpha = _ol_math_.toRadians(event.alpha);
this.set(_ol_DeviceOrientation_.Property_.ALPHA, alpha);
// event.absolute is undefined in iOS.
if (typeof event.absolute === 'boolean' && event.absolute) {
this.set(ol.DeviceOrientation.Property_.HEADING, alpha);
this.set(_ol_DeviceOrientation_.Property_.HEADING, alpha);
} else if (typeof event.webkitCompassHeading === 'number' &&
event.webkitCompassAccuracy != -1) {
var heading = ol.math.toRadians(event.webkitCompassHeading);
this.set(ol.DeviceOrientation.Property_.HEADING, heading);
var heading = _ol_math_.toRadians(event.webkitCompassHeading);
this.set(_ol_DeviceOrientation_.Property_.HEADING, heading);
}
}
if (event.beta !== null) {
this.set(ol.DeviceOrientation.Property_.BETA,
ol.math.toRadians(event.beta));
this.set(_ol_DeviceOrientation_.Property_.BETA,
_ol_math_.toRadians(event.beta));
}
if (event.gamma !== null) {
this.set(ol.DeviceOrientation.Property_.GAMMA,
ol.math.toRadians(event.gamma));
this.set(_ol_DeviceOrientation_.Property_.GAMMA,
_ol_math_.toRadians(event.gamma));
}
this.changed();
};
@@ -132,9 +133,10 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
* @observable
* @api
*/
ol.DeviceOrientation.prototype.getAlpha = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.ALPHA));
_ol_DeviceOrientation_.prototype.getAlpha = function() {
return (
/** @type {number|undefined} */ this.get(_ol_DeviceOrientation_.Property_.ALPHA)
);
};
@@ -145,9 +147,10 @@ ol.DeviceOrientation.prototype.getAlpha = function() {
* @observable
* @api
*/
ol.DeviceOrientation.prototype.getBeta = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.BETA));
_ol_DeviceOrientation_.prototype.getBeta = function() {
return (
/** @type {number|undefined} */ this.get(_ol_DeviceOrientation_.Property_.BETA)
);
};
@@ -158,9 +161,10 @@ ol.DeviceOrientation.prototype.getBeta = function() {
* @observable
* @api
*/
ol.DeviceOrientation.prototype.getGamma = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.GAMMA));
_ol_DeviceOrientation_.prototype.getGamma = function() {
return (
/** @type {number|undefined} */ this.get(_ol_DeviceOrientation_.Property_.GAMMA)
);
};
@@ -171,9 +175,10 @@ ol.DeviceOrientation.prototype.getGamma = function() {
* @observable
* @api
*/
ol.DeviceOrientation.prototype.getHeading = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.HEADING));
_ol_DeviceOrientation_.prototype.getHeading = function() {
return (
/** @type {number|undefined} */ this.get(_ol_DeviceOrientation_.Property_.HEADING)
);
};
@@ -183,23 +188,24 @@ ol.DeviceOrientation.prototype.getHeading = function() {
* @observable
* @api
*/
ol.DeviceOrientation.prototype.getTracking = function() {
return /** @type {boolean} */ (
this.get(ol.DeviceOrientation.Property_.TRACKING));
_ol_DeviceOrientation_.prototype.getTracking = function() {
return (
/** @type {boolean} */ this.get(_ol_DeviceOrientation_.Property_.TRACKING)
);
};
/**
* @private
*/
ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
if (ol.has.DEVICE_ORIENTATION) {
_ol_DeviceOrientation_.prototype.handleTrackingChanged_ = function() {
if (_ol_has_.DEVICE_ORIENTATION) {
var tracking = this.getTracking();
if (tracking && !this.listenerKey_) {
this.listenerKey_ = ol.events.listen(window, 'deviceorientation',
this.listenerKey_ = _ol_events_.listen(window, 'deviceorientation',
this.orientationChange_, this);
} else if (!tracking && this.listenerKey_ !== null) {
ol.events.unlistenByKey(this.listenerKey_);
_ol_events_.unlistenByKey(this.listenerKey_);
this.listenerKey_ = null;
}
}
@@ -213,8 +219,8 @@ ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
* @observable
* @api
*/
ol.DeviceOrientation.prototype.setTracking = function(tracking) {
this.set(ol.DeviceOrientation.Property_.TRACKING, tracking);
_ol_DeviceOrientation_.prototype.setTracking = function(tracking) {
this.set(_ol_DeviceOrientation_.Property_.TRACKING, tracking);
};
@@ -222,10 +228,11 @@ ol.DeviceOrientation.prototype.setTracking = function(tracking) {
* @enum {string}
* @private
*/
ol.DeviceOrientation.Property_ = {
_ol_DeviceOrientation_.Property_ = {
ALPHA: 'alpha',
BETA: 'beta',
GAMMA: 'gamma',
HEADING: 'heading',
TRACKING: 'tracking'
};
export default _ol_DeviceOrientation_;

View File

@@ -1,24 +1,25 @@
goog.provide('ol.Disposable');
goog.require('ol');
/**
* @module ol/Disposable
*/
import _ol_ from './index.js';
/**
* Objects that need to clean up after themselves.
* @constructor
*/
ol.Disposable = function() {};
var _ol_Disposable_ = function() {};
/**
* The object has already been disposed.
* @type {boolean}
* @private
*/
ol.Disposable.prototype.disposed_ = false;
_ol_Disposable_.prototype.disposed_ = false;
/**
* Clean up.
*/
ol.Disposable.prototype.dispose = function() {
_ol_Disposable_.prototype.dispose = function() {
if (!this.disposed_) {
this.disposed_ = true;
this.disposeInternal();
@@ -29,4 +30,5 @@ ol.Disposable.prototype.dispose = function() {
* Extension point for disposable objects.
* @protected
*/
ol.Disposable.prototype.disposeInternal = ol.nullFunction;
_ol_Disposable_.prototype.disposeInternal = _ol_.nullFunction;
export default _ol_Disposable_;

View File

@@ -1,13 +1,13 @@
goog.provide('ol.Feature');
goog.require('ol.asserts');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol');
goog.require('ol.Object');
goog.require('ol.geom.Geometry');
goog.require('ol.style.Style');
/**
* @module ol/Feature
*/
import _ol_asserts_ from './asserts.js';
import _ol_events_ from './events.js';
import _ol_events_EventType_ from './events/EventType.js';
import _ol_ from './index.js';
import _ol_Object_ from './Object.js';
import _ol_geom_Geometry_ from './geom/Geometry.js';
import _ol_style_Style_ from './style/Style.js';
/**
* @classdesc
@@ -54,9 +54,9 @@ goog.require('ol.style.Style');
* include a Geometry associated with a `geometry` key.
* @api
*/
ol.Feature = function(opt_geometryOrProperties) {
var _ol_Feature_ = function(opt_geometryOrProperties) {
ol.Object.call(this);
_ol_Object_.call(this);
/**
* @private
@@ -90,12 +90,12 @@ ol.Feature = function(opt_geometryOrProperties) {
*/
this.geometryChangeKey_ = null;
ol.events.listen(
this, ol.Object.getChangeEventType(this.geometryName_),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(this.geometryName_),
this.handleGeometryChanged_, this);
if (opt_geometryOrProperties !== undefined) {
if (opt_geometryOrProperties instanceof ol.geom.Geometry ||
if (opt_geometryOrProperties instanceof _ol_geom_Geometry_ ||
!opt_geometryOrProperties) {
var geometry = opt_geometryOrProperties;
this.setGeometry(geometry);
@@ -106,7 +106,8 @@ ol.Feature = function(opt_geometryOrProperties) {
}
}
};
ol.inherits(ol.Feature, ol.Object);
_ol_.inherits(_ol_Feature_, _ol_Object_);
/**
@@ -115,8 +116,8 @@ ol.inherits(ol.Feature, ol.Object);
* @return {ol.Feature} The clone.
* @api
*/
ol.Feature.prototype.clone = function() {
var clone = new ol.Feature(this.getProperties());
_ol_Feature_.prototype.clone = function() {
var clone = new _ol_Feature_(this.getProperties());
clone.setGeometryName(this.getGeometryName());
var geometry = this.getGeometry();
if (geometry) {
@@ -138,7 +139,7 @@ ol.Feature.prototype.clone = function() {
* @api
* @observable
*/
ol.Feature.prototype.getGeometry = function() {
_ol_Feature_.prototype.getGeometry = function() {
return /** @type {ol.geom.Geometry|undefined} */ (
this.get(this.geometryName_));
};
@@ -151,7 +152,7 @@ ol.Feature.prototype.getGeometry = function() {
* @return {number|string|undefined} Id.
* @api
*/
ol.Feature.prototype.getId = function() {
_ol_Feature_.prototype.getId = function() {
return this.id_;
};
@@ -163,7 +164,7 @@ ol.Feature.prototype.getId = function() {
* for this feature.
* @api
*/
ol.Feature.prototype.getGeometryName = function() {
_ol_Feature_.prototype.getGeometryName = function() {
return this.geometryName_;
};
@@ -175,7 +176,7 @@ ol.Feature.prototype.getGeometryName = function() {
* ol.FeatureStyleFunction|ol.StyleFunction} The feature style.
* @api
*/
ol.Feature.prototype.getStyle = function() {
_ol_Feature_.prototype.getStyle = function() {
return this.style_;
};
@@ -186,7 +187,7 @@ ol.Feature.prototype.getStyle = function() {
* representing the current style of this feature.
* @api
*/
ol.Feature.prototype.getStyleFunction = function() {
_ol_Feature_.prototype.getStyleFunction = function() {
return this.styleFunction_;
};
@@ -194,7 +195,7 @@ ol.Feature.prototype.getStyleFunction = function() {
/**
* @private
*/
ol.Feature.prototype.handleGeometryChange_ = function() {
_ol_Feature_.prototype.handleGeometryChange_ = function() {
this.changed();
};
@@ -202,15 +203,15 @@ ol.Feature.prototype.handleGeometryChange_ = function() {
/**
* @private
*/
ol.Feature.prototype.handleGeometryChanged_ = function() {
_ol_Feature_.prototype.handleGeometryChanged_ = function() {
if (this.geometryChangeKey_) {
ol.events.unlistenByKey(this.geometryChangeKey_);
_ol_events_.unlistenByKey(this.geometryChangeKey_);
this.geometryChangeKey_ = null;
}
var geometry = this.getGeometry();
if (geometry) {
this.geometryChangeKey_ = ol.events.listen(geometry,
ol.events.EventType.CHANGE, this.handleGeometryChange_, this);
this.geometryChangeKey_ = _ol_events_.listen(geometry,
_ol_events_EventType_.CHANGE, this.handleGeometryChange_, this);
}
this.changed();
};
@@ -223,7 +224,7 @@ ol.Feature.prototype.handleGeometryChanged_ = function() {
* @api
* @observable
*/
ol.Feature.prototype.setGeometry = function(geometry) {
_ol_Feature_.prototype.setGeometry = function(geometry) {
this.set(this.geometryName_, geometry);
};
@@ -237,10 +238,10 @@ ol.Feature.prototype.setGeometry = function(geometry) {
* @api
* @fires ol.events.Event#event:change
*/
ol.Feature.prototype.setStyle = function(style) {
_ol_Feature_.prototype.setStyle = function(style) {
this.style_ = style;
this.styleFunction_ = !style ?
undefined : ol.Feature.createStyleFunction(style);
undefined : _ol_Feature_.createStyleFunction(style);
this.changed();
};
@@ -254,7 +255,7 @@ ol.Feature.prototype.setStyle = function(style) {
* @api
* @fires ol.events.Event#event:change
*/
ol.Feature.prototype.setId = function(id) {
_ol_Feature_.prototype.setId = function(id) {
this.id_ = id;
this.changed();
};
@@ -267,13 +268,13 @@ ol.Feature.prototype.setId = function(id) {
* @param {string} name The property name of the default geometry.
* @api
*/
ol.Feature.prototype.setGeometryName = function(name) {
ol.events.unlisten(
this, ol.Object.getChangeEventType(this.geometryName_),
_ol_Feature_.prototype.setGeometryName = function(name) {
_ol_events_.unlisten(
this, _ol_Object_.getChangeEventType(this.geometryName_),
this.handleGeometryChanged_, this);
this.geometryName_ = name;
ol.events.listen(
this, ol.Object.getChangeEventType(this.geometryName_),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(this.geometryName_),
this.handleGeometryChanged_, this);
this.handleGeometryChanged_();
};
@@ -287,7 +288,7 @@ ol.Feature.prototype.setGeometryName = function(name) {
* A feature style function, a single style, or an array of styles.
* @return {ol.FeatureStyleFunction} A style function.
*/
ol.Feature.createStyleFunction = function(obj) {
_ol_Feature_.createStyleFunction = function(obj) {
var styleFunction;
if (typeof obj === 'function') {
@@ -306,7 +307,7 @@ ol.Feature.createStyleFunction = function(obj) {
if (Array.isArray(obj)) {
styles = obj;
} else {
ol.asserts.assert(obj instanceof ol.style.Style,
_ol_asserts_.assert(obj instanceof _ol_style_Style_,
41); // Expected an `ol.style.Style` or an array of `ol.style.Style`
styles = [obj];
}
@@ -316,3 +317,4 @@ ol.Feature.createStyleFunction = function(obj) {
}
return styleFunction;
};
export default _ol_Feature_;

View File

@@ -1,19 +1,19 @@
/**
* @module ol/Geolocation
*/
// FIXME handle geolocation not supported
goog.provide('ol.Geolocation');
goog.require('ol');
goog.require('ol.GeolocationProperty');
goog.require('ol.Object');
goog.require('ol.Sphere');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.geom.Polygon');
goog.require('ol.has');
goog.require('ol.math');
goog.require('ol.proj');
goog.require('ol.proj.EPSG4326');
import _ol_ from './index.js';
import _ol_GeolocationProperty_ from './GeolocationProperty.js';
import _ol_Object_ from './Object.js';
import _ol_Sphere_ from './Sphere.js';
import _ol_events_ from './events.js';
import _ol_events_EventType_ from './events/EventType.js';
import _ol_geom_Polygon_ from './geom/Polygon.js';
import _ol_has_ from './has.js';
import _ol_math_ from './math.js';
import _ol_proj_ from './proj.js';
import _ol_proj_EPSG4326_ from './proj/EPSG4326.js';
/**
* @classdesc
@@ -41,9 +41,9 @@ goog.require('ol.proj.EPSG4326');
* @param {olx.GeolocationOptions=} opt_options Options.
* @api
*/
ol.Geolocation = function(opt_options) {
var _ol_Geolocation_ = function(opt_options) {
ol.Object.call(this);
_ol_Object_.call(this);
var options = opt_options || {};
@@ -58,13 +58,13 @@ ol.Geolocation = function(opt_options) {
* @private
* @type {ol.TransformFunction}
*/
this.transform_ = ol.proj.identityTransform;
this.transform_ = _ol_proj_.identityTransform;
/**
* @private
* @type {ol.Sphere}
*/
this.sphere_ = new ol.Sphere(ol.proj.EPSG4326.RADIUS);
this.sphere_ = new _ol_Sphere_(_ol_proj_EPSG4326_.RADIUS);
/**
* @private
@@ -72,11 +72,11 @@ ol.Geolocation = function(opt_options) {
*/
this.watchId_ = undefined;
ol.events.listen(
this, ol.Object.getChangeEventType(ol.GeolocationProperty.PROJECTION),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_GeolocationProperty_.PROJECTION),
this.handleProjectionChanged_, this);
ol.events.listen(
this, ol.Object.getChangeEventType(ol.GeolocationProperty.TRACKING),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_GeolocationProperty_.TRACKING),
this.handleTrackingChanged_, this);
if (options.projection !== undefined) {
@@ -89,29 +89,30 @@ ol.Geolocation = function(opt_options) {
this.setTracking(options.tracking !== undefined ? options.tracking : false);
};
ol.inherits(ol.Geolocation, ol.Object);
_ol_.inherits(_ol_Geolocation_, _ol_Object_);
/**
* @inheritDoc
*/
ol.Geolocation.prototype.disposeInternal = function() {
_ol_Geolocation_.prototype.disposeInternal = function() {
this.setTracking(false);
ol.Object.prototype.disposeInternal.call(this);
_ol_Object_.prototype.disposeInternal.call(this);
};
/**
* @private
*/
ol.Geolocation.prototype.handleProjectionChanged_ = function() {
_ol_Geolocation_.prototype.handleProjectionChanged_ = function() {
var projection = this.getProjection();
if (projection) {
this.transform_ = ol.proj.getTransformFromProjections(
ol.proj.get('EPSG:4326'), projection);
this.transform_ = _ol_proj_.getTransformFromProjections(
_ol_proj_.get('EPSG:4326'), projection);
if (this.position_) {
this.set(
ol.GeolocationProperty.POSITION, this.transform_(this.position_));
_ol_GeolocationProperty_.POSITION, this.transform_(this.position_));
}
}
};
@@ -120,8 +121,8 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
/**
* @private
*/
ol.Geolocation.prototype.handleTrackingChanged_ = function() {
if (ol.has.GEOLOCATION) {
_ol_Geolocation_.prototype.handleTrackingChanged_ = function() {
if (_ol_has_.GEOLOCATION) {
var tracking = this.getTracking();
if (tracking && this.watchId_ === undefined) {
this.watchId_ = navigator.geolocation.watchPosition(
@@ -140,16 +141,16 @@ ol.Geolocation.prototype.handleTrackingChanged_ = function() {
* @private
* @param {GeolocationPosition} position position event.
*/
ol.Geolocation.prototype.positionChange_ = function(position) {
_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_GeolocationProperty_.ACCURACY, coords.accuracy);
this.set(_ol_GeolocationProperty_.ALTITUDE,
coords.altitude === null ? undefined : coords.altitude);
this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY,
this.set(_ol_GeolocationProperty_.ALTITUDE_ACCURACY,
coords.altitudeAccuracy === null ?
undefined : coords.altitudeAccuracy);
this.set(ol.GeolocationProperty.HEADING, coords.heading === null ?
undefined : ol.math.toRadians(coords.heading));
this.set(_ol_GeolocationProperty_.HEADING, coords.heading === null ?
undefined : _ol_math_.toRadians(coords.heading));
if (!this.position_) {
this.position_ = [coords.longitude, coords.latitude];
} else {
@@ -157,13 +158,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_GeolocationProperty_.POSITION, projectedPosition);
this.set(_ol_GeolocationProperty_.SPEED,
coords.speed === null ? undefined : coords.speed);
var geometry = ol.geom.Polygon.circular(
var geometry = _ol_geom_Polygon_.circular(
this.sphere_, this.position_, coords.accuracy);
geometry.applyTransform(this.transform_);
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
this.set(_ol_GeolocationProperty_.ACCURACY_GEOMETRY, geometry);
this.changed();
};
@@ -177,8 +178,8 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
* @private
* @param {GeolocationPositionError} error error object.
*/
ol.Geolocation.prototype.positionError_ = function(error) {
error.type = ol.events.EventType.ERROR;
_ol_Geolocation_.prototype.positionError_ = function(error) {
error.type = _ol_events_EventType_.ERROR;
this.setTracking(false);
this.dispatchEvent(/** @type {{type: string, target: undefined}} */ (error));
};
@@ -191,9 +192,10 @@ ol.Geolocation.prototype.positionError_ = function(error) {
* @observable
* @api
*/
ol.Geolocation.prototype.getAccuracy = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ACCURACY));
_ol_Geolocation_.prototype.getAccuracy = function() {
return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ACCURACY)
);
};
@@ -203,9 +205,10 @@ ol.Geolocation.prototype.getAccuracy = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getAccuracyGeometry = function() {
return /** @type {?ol.geom.Polygon} */ (
this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null);
_ol_Geolocation_.prototype.getAccuracyGeometry = function() {
return (
/** @type {?ol.geom.Polygon} */ this.get(_ol_GeolocationProperty_.ACCURACY_GEOMETRY) || null
);
};
@@ -216,9 +219,10 @@ ol.Geolocation.prototype.getAccuracyGeometry = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getAltitude = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ALTITUDE));
_ol_Geolocation_.prototype.getAltitude = function() {
return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ALTITUDE)
);
};
@@ -229,9 +233,10 @@ ol.Geolocation.prototype.getAltitude = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getAltitudeAccuracy = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY));
_ol_Geolocation_.prototype.getAltitudeAccuracy = function() {
return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.ALTITUDE_ACCURACY)
);
};
@@ -241,9 +246,10 @@ ol.Geolocation.prototype.getAltitudeAccuracy = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getHeading = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.HEADING));
_ol_Geolocation_.prototype.getHeading = function() {
return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.HEADING)
);
};
@@ -254,9 +260,10 @@ ol.Geolocation.prototype.getHeading = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getPosition = function() {
return /** @type {ol.Coordinate|undefined} */ (
this.get(ol.GeolocationProperty.POSITION));
_ol_Geolocation_.prototype.getPosition = function() {
return (
/** @type {ol.Coordinate|undefined} */ this.get(_ol_GeolocationProperty_.POSITION)
);
};
@@ -267,9 +274,10 @@ ol.Geolocation.prototype.getPosition = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getProjection = function() {
return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.GeolocationProperty.PROJECTION));
_ol_Geolocation_.prototype.getProjection = function() {
return (
/** @type {ol.proj.Projection|undefined} */ this.get(_ol_GeolocationProperty_.PROJECTION)
);
};
@@ -280,9 +288,10 @@ ol.Geolocation.prototype.getProjection = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getSpeed = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.SPEED));
_ol_Geolocation_.prototype.getSpeed = function() {
return (
/** @type {number|undefined} */ this.get(_ol_GeolocationProperty_.SPEED)
);
};
@@ -292,9 +301,10 @@ ol.Geolocation.prototype.getSpeed = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getTracking = function() {
return /** @type {boolean} */ (
this.get(ol.GeolocationProperty.TRACKING));
_ol_Geolocation_.prototype.getTracking = function() {
return (
/** @type {boolean} */ this.get(_ol_GeolocationProperty_.TRACKING)
);
};
@@ -307,9 +317,10 @@ ol.Geolocation.prototype.getTracking = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.getTrackingOptions = function() {
return /** @type {GeolocationPositionOptions|undefined} */ (
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
_ol_Geolocation_.prototype.getTrackingOptions = function() {
return (
/** @type {GeolocationPositionOptions|undefined} */ this.get(_ol_GeolocationProperty_.TRACKING_OPTIONS)
);
};
@@ -320,8 +331,8 @@ ol.Geolocation.prototype.getTrackingOptions = function() {
* @observable
* @api
*/
ol.Geolocation.prototype.setProjection = function(projection) {
this.set(ol.GeolocationProperty.PROJECTION, ol.proj.get(projection));
_ol_Geolocation_.prototype.setProjection = function(projection) {
this.set(_ol_GeolocationProperty_.PROJECTION, _ol_proj_.get(projection));
};
@@ -331,8 +342,8 @@ ol.Geolocation.prototype.setProjection = function(projection) {
* @observable
* @api
*/
ol.Geolocation.prototype.setTracking = function(tracking) {
this.set(ol.GeolocationProperty.TRACKING, tracking);
_ol_Geolocation_.prototype.setTracking = function(tracking) {
this.set(_ol_GeolocationProperty_.TRACKING, tracking);
};
@@ -345,6 +356,7 @@ ol.Geolocation.prototype.setTracking = function(tracking) {
* @observable
* @api
*/
ol.Geolocation.prototype.setTrackingOptions = function(options) {
this.set(ol.GeolocationProperty.TRACKING_OPTIONS, options);
_ol_Geolocation_.prototype.setTrackingOptions = function(options) {
this.set(_ol_GeolocationProperty_.TRACKING_OPTIONS, options);
};
export default _ol_Geolocation_;

View File

@@ -1,10 +1,10 @@
goog.provide('ol.GeolocationProperty');
/**
* @module ol/GeolocationProperty
*/
/**
* @enum {string}
*/
ol.GeolocationProperty = {
var _ol_GeolocationProperty_ = {
ACCURACY: 'accuracy',
ACCURACY_GEOMETRY: 'accuracyGeometry',
ALTITUDE: 'altitude',
@@ -16,3 +16,5 @@ ol.GeolocationProperty = {
TRACKING: 'tracking',
TRACKING_OPTIONS: 'trackingOptions'
};
export default _ol_GeolocationProperty_;

View File

@@ -1,18 +1,18 @@
goog.provide('ol.Graticule');
goog.require('ol.coordinate');
goog.require('ol.extent');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.flat.geodesic');
goog.require('ol.math');
goog.require('ol.proj');
goog.require('ol.render.EventType');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Text');
/**
* @module ol/Graticule
*/
import _ol_coordinate_ from './coordinate.js';
import _ol_extent_ from './extent.js';
import _ol_geom_GeometryLayout_ from './geom/GeometryLayout.js';
import _ol_geom_LineString_ from './geom/LineString.js';
import _ol_geom_Point_ from './geom/Point.js';
import _ol_geom_flat_geodesic_ from './geom/flat/geodesic.js';
import _ol_math_ from './math.js';
import _ol_proj_ from './proj.js';
import _ol_render_EventType_ from './render/EventType.js';
import _ol_style_Fill_ from './style/Fill.js';
import _ol_style_Stroke_ from './style/Stroke.js';
import _ol_style_Text_ from './style/Text.js';
/**
* Render a grid for a coordinate system on a map.
@@ -20,7 +20,7 @@ goog.require('ol.style.Text');
* @param {olx.GraticuleOptions=} opt_options Options.
* @api
*/
ol.Graticule = function(opt_options) {
var _ol_Graticule_ = function(opt_options) {
var options = opt_options || {};
/**
@@ -113,7 +113,7 @@ ol.Graticule = function(opt_options) {
* @private
*/
this.strokeStyle_ = options.strokeStyle !== undefined ?
options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_;
options.strokeStyle : _ol_Graticule_.DEFAULT_STROKE_STYLE_;
/**
* @type {ol.TransformFunction|undefined}
@@ -146,7 +146,7 @@ ol.Graticule = function(opt_options) {
this.parallelsLabels_ = null;
if (options.showLabels == true) {
var degreesToString = ol.coordinate.degreesToStringHDMS;
var degreesToString = _ol_coordinate_.degreesToStringHDMS;
/**
* @type {null|function(number):string}
@@ -185,13 +185,13 @@ ol.Graticule = function(opt_options) {
* @private
*/
this.lonLabelStyle_ = options.lonLabelStyle !== undefined ? options.lonLabelStyle :
new ol.style.Text({
new _ol_style_Text_({
font: '12px Calibri,sans-serif',
textBaseline: 'bottom',
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: 'rgba(0,0,0,1)'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'rgba(255,255,255,1)',
width: 3
})
@@ -202,13 +202,13 @@ ol.Graticule = function(opt_options) {
* @private
*/
this.latLabelStyle_ = options.latLabelStyle !== undefined ? options.latLabelStyle :
new ol.style.Text({
new _ol_style_Text_({
font: '12px Calibri,sans-serif',
textAlign: 'end',
fill: new ol.style.Fill({
fill: new _ol_style_Fill_({
color: 'rgba(0,0,0,1)'
}),
stroke: new ol.style.Stroke({
stroke: new _ol_style_Stroke_({
color: 'rgba(255,255,255,1)',
width: 3
})
@@ -227,7 +227,7 @@ ol.Graticule = function(opt_options) {
* @private
* @const
*/
ol.Graticule.DEFAULT_STROKE_STYLE_ = new ol.style.Stroke({
_ol_Graticule_.DEFAULT_STROKE_STYLE_ = new _ol_style_Stroke_({
color: 'rgba(0,0,0,0.2)'
});
@@ -237,7 +237,7 @@ ol.Graticule.DEFAULT_STROKE_STYLE_ = new ol.style.Stroke({
* @type {Array.<number>}
* @private
*/
ol.Graticule.intervals_ = [90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05,
_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];
@@ -251,10 +251,10 @@ ol.Graticule.intervals_ = [90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05,
* @return {number} Index.
* @private
*/
ol.Graticule.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredTolerance, extent, index) {
_ol_Graticule_.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredTolerance, extent, index) {
var lineString = this.getMeridian_(lon, minLat, maxLat,
squaredTolerance, index);
if (ol.extent.intersects(lineString.getExtent(), extent)) {
if (_ol_extent_.intersects(lineString.getExtent(), extent)) {
if (this.meridiansLabels_) {
var textPoint = this.getMeridianPoint_(lineString, extent, index);
this.meridiansLabels_[index] = {
@@ -274,16 +274,16 @@ ol.Graticule.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredToler
* @return {ol.geom.Point} Meridian point.
* @private
*/
ol.Graticule.prototype.getMeridianPoint_ = function(lineString, extent, index) {
_ol_Graticule_.prototype.getMeridianPoint_ = function(lineString, extent, index) {
var flatCoordinates = lineString.getFlatCoordinates();
var clampedBottom = Math.max(extent[1], flatCoordinates[1]);
var clampedTop = Math.min(extent[3], flatCoordinates[flatCoordinates.length - 1]);
var lat = ol.math.clamp(
var lat = _ol_math_.clamp(
extent[1] + Math.abs(extent[1] - extent[3]) * this.lonLabelPosition_,
clampedBottom, clampedTop);
var coordinate = [flatCoordinates[0], lat];
var point = this.meridiansLabels_[index] !== undefined ?
this.meridiansLabels_[index].geom : new ol.geom.Point(null);
this.meridiansLabels_[index].geom : new _ol_geom_Point_(null);
point.setCoordinates(coordinate);
return point;
};
@@ -299,10 +299,10 @@ ol.Graticule.prototype.getMeridianPoint_ = function(lineString, extent, index) {
* @return {number} Index.
* @private
*/
ol.Graticule.prototype.addParallel_ = function(lat, minLon, maxLon, squaredTolerance, extent, index) {
_ol_Graticule_.prototype.addParallel_ = function(lat, minLon, maxLon, squaredTolerance, extent, index) {
var lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance,
index);
if (ol.extent.intersects(lineString.getExtent(), extent)) {
if (_ol_extent_.intersects(lineString.getExtent(), extent)) {
if (this.parallelsLabels_) {
var textPoint = this.getParallelPoint_(lineString, extent, index);
this.parallelsLabels_[index] = {
@@ -323,16 +323,16 @@ ol.Graticule.prototype.addParallel_ = function(lat, minLon, maxLon, squaredToler
* @return {ol.geom.Point} Parallel point.
* @private
*/
ol.Graticule.prototype.getParallelPoint_ = function(lineString, extent, index) {
_ol_Graticule_.prototype.getParallelPoint_ = function(lineString, extent, index) {
var flatCoordinates = lineString.getFlatCoordinates();
var clampedLeft = Math.max(extent[0], flatCoordinates[0]);
var clampedRight = Math.min(extent[2], flatCoordinates[flatCoordinates.length - 2]);
var lon = ol.math.clamp(
var lon = _ol_math_.clamp(
extent[0] + Math.abs(extent[0] - extent[2]) * this.latLabelPosition_,
clampedLeft, clampedRight);
var coordinate = [lon, flatCoordinates[1]];
var point = this.parallelsLabels_[index] !== undefined ?
this.parallelsLabels_[index].geom : new ol.geom.Point(null);
this.parallelsLabels_[index].geom : new _ol_geom_Point_(null);
point.setCoordinates(coordinate);
return point;
};
@@ -345,7 +345,7 @@ ol.Graticule.prototype.getParallelPoint_ = function(lineString, extent, index) {
* @param {number} squaredTolerance Squared tolerance.
* @private
*/
ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, squaredTolerance) {
_ol_Graticule_.prototype.createGraticule_ = function(extent, center, resolution, squaredTolerance) {
var interval = this.getInterval_(resolution);
if (interval == -1) {
@@ -372,7 +372,7 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
Math.min(extent[3], this.maxLatP_)
];
validExtent = ol.proj.transformExtent(validExtent, this.projection_,
validExtent = _ol_proj_.transformExtent(validExtent, this.projection_,
'EPSG:4326');
var maxLat = validExtent[3];
var maxLon = validExtent[2];
@@ -382,7 +382,7 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
// Create meridians
centerLon = Math.floor(centerLon / interval) * interval;
lon = ol.math.clamp(centerLon, this.minLon_, this.maxLon_);
lon = _ol_math_.clamp(centerLon, this.minLon_, this.maxLon_);
idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, 0);
@@ -392,7 +392,7 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx);
}
lon = ol.math.clamp(centerLon, this.minLon_, this.maxLon_);
lon = _ol_math_.clamp(centerLon, this.minLon_, this.maxLon_);
cnt = 0;
while (lon != this.maxLon_ && cnt++ < maxLines) {
@@ -408,7 +408,7 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
// Create parallels
centerLat = Math.floor(centerLat / interval) * interval;
lat = ol.math.clamp(centerLat, this.minLat_, this.maxLat_);
lat = _ol_math_.clamp(centerLat, this.minLat_, this.maxLat_);
idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, 0);
@@ -418,7 +418,7 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, idx);
}
lat = ol.math.clamp(centerLat, this.minLat_, this.maxLat_);
lat = _ol_math_.clamp(centerLat, this.minLat_, this.maxLat_);
cnt = 0;
while (lat != this.maxLat_ && cnt++ < maxLines) {
@@ -439,7 +439,7 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
* @return {number} The interval in degrees.
* @private
*/
ol.Graticule.prototype.getInterval_ = function(resolution) {
_ol_Graticule_.prototype.getInterval_ = function(resolution) {
var centerLon = this.projectionCenterLonLat_[0];
var centerLat = this.projectionCenterLonLat_[1];
var interval = -1;
@@ -449,8 +449,8 @@ ol.Graticule.prototype.getInterval_ = function(resolution) {
var p1 = [];
/** @type {Array.<number>} **/
var p2 = [];
for (i = 0, ii = ol.Graticule.intervals_.length; i < ii; ++i) {
delta = ol.Graticule.intervals_[i] / 2;
for (i = 0, ii = _ol_Graticule_.intervals_.length; i < ii; ++i) {
delta = _ol_Graticule_.intervals_[i] / 2;
p1[0] = centerLon - delta;
p1[1] = centerLat - delta;
p2[0] = centerLon + delta;
@@ -461,7 +461,7 @@ ol.Graticule.prototype.getInterval_ = function(resolution) {
if (dist <= target) {
break;
}
interval = ol.Graticule.intervals_[i];
interval = _ol_Graticule_.intervals_[i];
}
return interval;
};
@@ -472,7 +472,7 @@ ol.Graticule.prototype.getInterval_ = function(resolution) {
* @return {ol.PluggableMap} The map.
* @api
*/
ol.Graticule.prototype.getMap = function() {
_ol_Graticule_.prototype.getMap = function() {
return this.map_;
};
@@ -486,13 +486,13 @@ ol.Graticule.prototype.getMap = function() {
* @param {number} index Index.
* @private
*/
ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat,
_ol_Graticule_.prototype.getMeridian_ = function(lon, minLat, maxLat,
squaredTolerance, index) {
var flatCoordinates = ol.geom.flat.geodesic.meridian(lon,
var flatCoordinates = _ol_geom_flat_geodesic_.meridian(lon,
minLat, maxLat, this.projection_, squaredTolerance);
var lineString = this.meridians_[index] !== undefined ?
this.meridians_[index] : new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
this.meridians_[index] : new _ol_geom_LineString_(null);
lineString.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates);
return lineString;
};
@@ -502,7 +502,7 @@ ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat,
* @return {Array.<ol.geom.LineString>} The meridians.
* @api
*/
ol.Graticule.prototype.getMeridians = function() {
_ol_Graticule_.prototype.getMeridians = function() {
return this.meridians_;
};
@@ -516,13 +516,13 @@ ol.Graticule.prototype.getMeridians = function() {
* @param {number} index Index.
* @private
*/
ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon,
_ol_Graticule_.prototype.getParallel_ = function(lat, minLon, maxLon,
squaredTolerance, index) {
var flatCoordinates = ol.geom.flat.geodesic.parallel(lat,
var flatCoordinates = _ol_geom_flat_geodesic_.parallel(lat,
minLon, maxLon, this.projection_, squaredTolerance);
var lineString = this.parallels_[index] !== undefined ?
this.parallels_[index] : new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
this.parallels_[index] : new _ol_geom_LineString_(null);
lineString.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates);
return lineString;
};
@@ -532,7 +532,7 @@ ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon,
* @return {Array.<ol.geom.LineString>} The parallels.
* @api
*/
ol.Graticule.prototype.getParallels = function() {
_ol_Graticule_.prototype.getParallels = function() {
return this.parallels_;
};
@@ -541,7 +541,7 @@ ol.Graticule.prototype.getParallels = function() {
* @param {ol.render.Event} e Event.
* @private
*/
ol.Graticule.prototype.handlePostCompose_ = function(e) {
_ol_Graticule_.prototype.handlePostCompose_ = function(e) {
var vectorContext = e.vectorContext;
var frameState = e.frameState;
var extent = frameState.extent;
@@ -554,7 +554,7 @@ ol.Graticule.prototype.handlePostCompose_ = function(e) {
resolution * resolution / (4 * pixelRatio * pixelRatio);
var updateProjectionInfo = !this.projection_ ||
!ol.proj.equivalent(this.projection_, projection);
!_ol_proj_.equivalent(this.projection_, projection);
if (updateProjectionInfo) {
this.updateProjectionInfo_(projection);
@@ -597,12 +597,12 @@ ol.Graticule.prototype.handlePostCompose_ = function(e) {
* @param {ol.proj.Projection} projection Projection.
* @private
*/
ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
var epsg4326Projection = ol.proj.get('EPSG:4326');
_ol_Graticule_.prototype.updateProjectionInfo_ = function(projection) {
var epsg4326Projection = _ol_proj_.get('EPSG:4326');
var extent = projection.getExtent();
var worldExtent = projection.getWorldExtent();
var worldExtentP = ol.proj.transformExtent(worldExtent,
var worldExtentP = _ol_proj_.transformExtent(worldExtent,
epsg4326Projection, projection);
var maxLat = worldExtent[3];
@@ -626,14 +626,14 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
this.minLonP_ = minLonP;
this.fromLonLatTransform_ = ol.proj.getTransform(
this.fromLonLatTransform_ = _ol_proj_.getTransform(
epsg4326Projection, projection);
this.toLonLatTransform_ = ol.proj.getTransform(
this.toLonLatTransform_ = _ol_proj_.getTransform(
projection, epsg4326Projection);
this.projectionCenterLonLat_ = this.toLonLatTransform_(
ol.extent.getCenter(extent));
_ol_extent_.getCenter(extent));
this.projection_ = projection;
};
@@ -645,16 +645,17 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
* @param {ol.PluggableMap} map Map.
* @api
*/
ol.Graticule.prototype.setMap = function(map) {
_ol_Graticule_.prototype.setMap = function(map) {
if (this.map_) {
this.map_.un(ol.render.EventType.POSTCOMPOSE,
this.map_.un(_ol_render_EventType_.POSTCOMPOSE,
this.handlePostCompose_, this);
this.map_.render();
}
if (map) {
map.on(ol.render.EventType.POSTCOMPOSE,
map.on(_ol_render_EventType_.POSTCOMPOSE,
this.handlePostCompose_, this);
map.render();
}
this.map_ = map;
};
export default _ol_Graticule_;

View File

@@ -1,12 +1,12 @@
goog.provide('ol.Image');
goog.require('ol');
goog.require('ol.ImageBase');
goog.require('ol.ImageState');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.extent');
/**
* @module ol/Image
*/
import _ol_ from './index.js';
import _ol_ImageBase_ from './ImageBase.js';
import _ol_ImageState_ from './ImageState.js';
import _ol_events_ from './events.js';
import _ol_events_EventType_ from './events/EventType.js';
import _ol_extent_ from './extent.js';
/**
* @constructor
@@ -18,9 +18,9 @@ goog.require('ol.extent');
* @param {?string} crossOrigin Cross origin.
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
*/
ol.Image = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
var _ol_Image_ = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.ImageState.IDLE);
_ol_ImageBase_.call(this, extent, resolution, pixelRatio, _ol_ImageState_.IDLE);
/**
* @private
@@ -47,7 +47,7 @@ ol.Image = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadF
* @protected
* @type {ol.ImageState}
*/
this.state = ol.ImageState.IDLE;
this.state = _ol_ImageState_.IDLE;
/**
* @private
@@ -56,14 +56,15 @@ ol.Image = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadF
this.imageLoadFunction_ = imageLoadFunction;
};
ol.inherits(ol.Image, ol.ImageBase);
_ol_.inherits(_ol_Image_, _ol_ImageBase_);
/**
* @inheritDoc
* @api
*/
ol.Image.prototype.getImage = function() {
_ol_Image_.prototype.getImage = function() {
return this.image_;
};
@@ -73,8 +74,8 @@ ol.Image.prototype.getImage = function() {
*
* @private
*/
ol.Image.prototype.handleImageError_ = function() {
this.state = ol.ImageState.ERROR;
_ol_Image_.prototype.handleImageError_ = function() {
this.state = _ol_ImageState_.ERROR;
this.unlistenImage_();
this.changed();
};
@@ -85,11 +86,11 @@ ol.Image.prototype.handleImageError_ = function() {
*
* @private
*/
ol.Image.prototype.handleImageLoad_ = function() {
_ol_Image_.prototype.handleImageLoad_ = function() {
if (this.resolution === undefined) {
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
this.resolution = _ol_extent_.getHeight(this.extent) / this.image_.height;
}
this.state = ol.ImageState.LOADED;
this.state = _ol_ImageState_.LOADED;
this.unlistenImage_();
this.changed();
};
@@ -102,14 +103,14 @@ ol.Image.prototype.handleImageLoad_ = function() {
* @override
* @api
*/
ol.Image.prototype.load = function() {
if (this.state == ol.ImageState.IDLE || this.state == ol.ImageState.ERROR) {
this.state = ol.ImageState.LOADING;
_ol_Image_.prototype.load = function() {
if (this.state == _ol_ImageState_.IDLE || this.state == _ol_ImageState_.ERROR) {
this.state = _ol_ImageState_.LOADING;
this.changed();
this.imageListenerKeys_ = [
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
_ol_events_.listenOnce(this.image_, _ol_events_EventType_.ERROR,
this.handleImageError_, this),
ol.events.listenOnce(this.image_, ol.events.EventType.LOAD,
_ol_events_.listenOnce(this.image_, _ol_events_EventType_.LOAD,
this.handleImageLoad_, this)
];
this.imageLoadFunction_(this, this.src_);
@@ -120,7 +121,7 @@ ol.Image.prototype.load = function() {
/**
* @param {HTMLCanvasElement|Image|HTMLVideoElement} image Image.
*/
ol.Image.prototype.setImage = function(image) {
_ol_Image_.prototype.setImage = function(image) {
this.image_ = image;
};
@@ -130,7 +131,8 @@ ol.Image.prototype.setImage = function(image) {
*
* @private
*/
ol.Image.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
_ol_Image_.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.imageListenerKeys_ = null;
};
export default _ol_Image_;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.ImageBase');
goog.require('ol');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
/**
* @module ol/ImageBase
*/
import _ol_ from './index.js';
import _ol_events_EventTarget_ from './events/EventTarget.js';
import _ol_events_EventType_ from './events/EventType.js';
/**
* @constructor
@@ -14,9 +14,9 @@ goog.require('ol.events.EventType');
* @param {number} pixelRatio Pixel ratio.
* @param {ol.ImageState} state State.
*/
ol.ImageBase = function(extent, resolution, pixelRatio, state) {
var _ol_ImageBase_ = function(extent, resolution, pixelRatio, state) {
ol.events.EventTarget.call(this);
_ol_events_EventTarget_.call(this);
/**
* @protected
@@ -43,21 +43,22 @@ ol.ImageBase = function(extent, resolution, pixelRatio, state) {
this.state = state;
};
ol.inherits(ol.ImageBase, ol.events.EventTarget);
_ol_.inherits(_ol_ImageBase_, _ol_events_EventTarget_);
/**
* @protected
*/
ol.ImageBase.prototype.changed = function() {
this.dispatchEvent(ol.events.EventType.CHANGE);
_ol_ImageBase_.prototype.changed = function() {
this.dispatchEvent(_ol_events_EventType_.CHANGE);
};
/**
* @return {ol.Extent} Extent.
*/
ol.ImageBase.prototype.getExtent = function() {
_ol_ImageBase_.prototype.getExtent = function() {
return this.extent;
};
@@ -66,13 +67,13 @@ ol.ImageBase.prototype.getExtent = function() {
* @abstract
* @return {HTMLCanvasElement|Image|HTMLVideoElement} Image.
*/
ol.ImageBase.prototype.getImage = function() {};
_ol_ImageBase_.prototype.getImage = function() {};
/**
* @return {number} PixelRatio.
*/
ol.ImageBase.prototype.getPixelRatio = function() {
_ol_ImageBase_.prototype.getPixelRatio = function() {
return this.pixelRatio_;
};
@@ -80,7 +81,7 @@ ol.ImageBase.prototype.getPixelRatio = function() {
/**
* @return {number} Resolution.
*/
ol.ImageBase.prototype.getResolution = function() {
_ol_ImageBase_.prototype.getResolution = function() {
return /** @type {number} */ (this.resolution);
};
@@ -88,7 +89,7 @@ ol.ImageBase.prototype.getResolution = function() {
/**
* @return {ol.ImageState} State.
*/
ol.ImageBase.prototype.getState = function() {
_ol_ImageBase_.prototype.getState = function() {
return this.state;
};
@@ -97,4 +98,5 @@ ol.ImageBase.prototype.getState = function() {
* Load not yet loaded URI.
* @abstract
*/
ol.ImageBase.prototype.load = function() {};
_ol_ImageBase_.prototype.load = function() {};
export default _ol_ImageBase_;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.ImageCanvas');
goog.require('ol');
goog.require('ol.ImageBase');
goog.require('ol.ImageState');
/**
* @module ol/ImageCanvas
*/
import _ol_ from './index.js';
import _ol_ImageBase_ from './ImageBase.js';
import _ol_ImageState_ from './ImageState.js';
/**
* @constructor
@@ -15,7 +15,7 @@ goog.require('ol.ImageState');
* @param {ol.ImageCanvasLoader=} opt_loader Optional loader function to
* support asynchronous canvas drawing.
*/
ol.ImageCanvas = function(extent, resolution, pixelRatio, canvas, opt_loader) {
var _ol_ImageCanvas_ = function(extent, resolution, pixelRatio, canvas, opt_loader) {
/**
* Optional canvas loader function.
@@ -25,9 +25,9 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, canvas, opt_loader) {
this.loader_ = opt_loader !== undefined ? opt_loader : null;
var state = opt_loader !== undefined ?
ol.ImageState.IDLE : ol.ImageState.LOADED;
_ol_ImageState_.IDLE : _ol_ImageState_.LOADED;
ol.ImageBase.call(this, extent, resolution, pixelRatio, state);
_ol_ImageBase_.call(this, extent, resolution, pixelRatio, state);
/**
* @private
@@ -42,14 +42,15 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, canvas, opt_loader) {
this.error_ = null;
};
ol.inherits(ol.ImageCanvas, ol.ImageBase);
_ol_.inherits(_ol_ImageCanvas_, _ol_ImageBase_);
/**
* Get any error associated with asynchronous rendering.
* @return {Error} Any error that occurred during rendering.
*/
ol.ImageCanvas.prototype.getError = function() {
_ol_ImageCanvas_.prototype.getError = function() {
return this.error_;
};
@@ -59,12 +60,12 @@ ol.ImageCanvas.prototype.getError = function() {
* @param {Error} err Any error during drawing.
* @private
*/
ol.ImageCanvas.prototype.handleLoad_ = function(err) {
_ol_ImageCanvas_.prototype.handleLoad_ = function(err) {
if (err) {
this.error_ = err;
this.state = ol.ImageState.ERROR;
this.state = _ol_ImageState_.ERROR;
} else {
this.state = ol.ImageState.LOADED;
this.state = _ol_ImageState_.LOADED;
}
this.changed();
};
@@ -73,9 +74,9 @@ ol.ImageCanvas.prototype.handleLoad_ = function(err) {
/**
* @inheritDoc
*/
ol.ImageCanvas.prototype.load = function() {
if (this.state == ol.ImageState.IDLE) {
this.state = ol.ImageState.LOADING;
_ol_ImageCanvas_.prototype.load = function() {
if (this.state == _ol_ImageState_.IDLE) {
this.state = _ol_ImageState_.LOADING;
this.changed();
this.loader_(this.handleLoad_.bind(this));
}
@@ -85,6 +86,7 @@ ol.ImageCanvas.prototype.load = function() {
/**
* @inheritDoc
*/
ol.ImageCanvas.prototype.getImage = function() {
_ol_ImageCanvas_.prototype.getImage = function() {
return this.canvas_;
};
export default _ol_ImageCanvas_;

View File

@@ -1,11 +1,14 @@
goog.provide('ol.ImageState');
/**
* @module ol/ImageState
*/
/**
* @enum {number}
*/
ol.ImageState = {
var _ol_ImageState_ = {
IDLE: 0,
LOADING: 1,
LOADED: 2,
ERROR: 3
};
export default _ol_ImageState_;

View File

@@ -1,12 +1,12 @@
goog.provide('ol.ImageTile');
goog.require('ol');
goog.require('ol.Tile');
goog.require('ol.TileState');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.events.EventType');
/**
* @module ol/ImageTile
*/
import _ol_ from './index.js';
import _ol_Tile_ from './Tile.js';
import _ol_TileState_ from './TileState.js';
import _ol_dom_ from './dom.js';
import _ol_events_ from './events.js';
import _ol_events_EventType_ from './events/EventType.js';
/**
* @constructor
@@ -18,9 +18,9 @@ goog.require('ol.events.EventType');
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
* @param {olx.TileOptions=} opt_options Tile options.
*/
ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
var _ol_ImageTile_ = function(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
ol.Tile.call(this, tileCoord, state, opt_options);
_ol_Tile_.call(this, tileCoord, state, opt_options);
/**
* @private
@@ -58,23 +58,24 @@ ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, op
this.tileLoadFunction_ = tileLoadFunction;
};
ol.inherits(ol.ImageTile, ol.Tile);
_ol_.inherits(_ol_ImageTile_, _ol_Tile_);
/**
* @inheritDoc
*/
ol.ImageTile.prototype.disposeInternal = function() {
if (this.state == ol.TileState.LOADING) {
_ol_ImageTile_.prototype.disposeInternal = function() {
if (this.state == _ol_TileState_.LOADING) {
this.unlistenImage_();
this.image_ = ol.ImageTile.getBlankImage();
this.image_ = _ol_ImageTile_.getBlankImage();
}
if (this.interimTile) {
this.interimTile.dispose();
}
this.state = ol.TileState.ABORT;
this.state = _ol_TileState_.ABORT;
this.changed();
ol.Tile.prototype.disposeInternal.call(this);
_ol_Tile_.prototype.disposeInternal.call(this);
};
@@ -83,7 +84,7 @@ ol.ImageTile.prototype.disposeInternal = function() {
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
* @api
*/
ol.ImageTile.prototype.getImage = function() {
_ol_ImageTile_.prototype.getImage = function() {
return this.image_;
};
@@ -91,7 +92,7 @@ ol.ImageTile.prototype.getImage = function() {
/**
* @inheritDoc
*/
ol.ImageTile.prototype.getKey = function() {
_ol_ImageTile_.prototype.getKey = function() {
return this.src_;
};
@@ -101,10 +102,10 @@ ol.ImageTile.prototype.getKey = function() {
*
* @private
*/
ol.ImageTile.prototype.handleImageError_ = function() {
this.state = ol.TileState.ERROR;
_ol_ImageTile_.prototype.handleImageError_ = function() {
this.state = _ol_TileState_.ERROR;
this.unlistenImage_();
this.image_ = ol.ImageTile.getBlankImage();
this.image_ = _ol_ImageTile_.getBlankImage();
this.changed();
};
@@ -114,11 +115,11 @@ ol.ImageTile.prototype.handleImageError_ = function() {
*
* @private
*/
ol.ImageTile.prototype.handleImageLoad_ = function() {
_ol_ImageTile_.prototype.handleImageLoad_ = function() {
if (this.image_.naturalWidth && this.image_.naturalHeight) {
this.state = ol.TileState.LOADED;
this.state = _ol_TileState_.LOADED;
} else {
this.state = ol.TileState.EMPTY;
this.state = _ol_TileState_.EMPTY;
}
this.unlistenImage_();
this.changed();
@@ -129,21 +130,21 @@ ol.ImageTile.prototype.handleImageLoad_ = function() {
* @inheritDoc
* @api
*/
ol.ImageTile.prototype.load = function() {
if (this.state == ol.TileState.ERROR) {
this.state = ol.TileState.IDLE;
_ol_ImageTile_.prototype.load = function() {
if (this.state == _ol_TileState_.ERROR) {
this.state = _ol_TileState_.IDLE;
this.image_ = new Image();
if (this.crossOrigin_ !== null) {
this.image_.crossOrigin = this.crossOrigin_;
}
}
if (this.state == ol.TileState.IDLE) {
this.state = ol.TileState.LOADING;
if (this.state == _ol_TileState_.IDLE) {
this.state = _ol_TileState_.LOADING;
this.changed();
this.imageListenerKeys_ = [
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
_ol_events_.listenOnce(this.image_, _ol_events_EventType_.ERROR,
this.handleImageError_, this),
ol.events.listenOnce(this.image_, ol.events.EventType.LOAD,
_ol_events_.listenOnce(this.image_, _ol_events_EventType_.LOAD,
this.handleImageLoad_, this)
];
this.tileLoadFunction_(this, this.src_);
@@ -156,8 +157,8 @@ ol.ImageTile.prototype.load = function() {
*
* @private
*/
ol.ImageTile.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
_ol_ImageTile_.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.imageListenerKeys_ = null;
};
@@ -166,9 +167,10 @@ ol.ImageTile.prototype.unlistenImage_ = function() {
* Get a 1-pixel blank image.
* @return {HTMLCanvasElement} Blank image.
*/
ol.ImageTile.getBlankImage = function() {
var ctx = ol.dom.createCanvasContext2D(1, 1);
_ol_ImageTile_.getBlankImage = function() {
var ctx = _ol_dom_.createCanvasContext2D(1, 1);
ctx.fillStyle = 'rgba(0,0,0,0)';
ctx.fillRect(0, 0, 1, 1);
return ctx.canvas;
};
export default _ol_ImageTile_;

View File

@@ -1,6 +1,6 @@
goog.provide('ol.Kinetic');
/**
* @module ol/Kinetic
*/
/**
* @classdesc
* Implementation of inertial deceleration for map movement.
@@ -13,7 +13,7 @@ goog.provide('ol.Kinetic');
* @struct
* @api
*/
ol.Kinetic = function(decay, minVelocity, delay) {
var _ol_Kinetic_ = function(decay, minVelocity, delay) {
/**
* @private
@@ -56,7 +56,7 @@ ol.Kinetic = function(decay, minVelocity, delay) {
/**
* FIXME empty description for jsdoc
*/
ol.Kinetic.prototype.begin = function() {
_ol_Kinetic_.prototype.begin = function() {
this.points_.length = 0;
this.angle_ = 0;
this.initialVelocity_ = 0;
@@ -67,7 +67,7 @@ ol.Kinetic.prototype.begin = function() {
* @param {number} x X.
* @param {number} y Y.
*/
ol.Kinetic.prototype.update = function(x, y) {
_ol_Kinetic_.prototype.update = function(x, y) {
this.points_.push(x, y, Date.now());
};
@@ -75,7 +75,7 @@ ol.Kinetic.prototype.update = function(x, y) {
/**
* @return {boolean} Whether we should do kinetic animation.
*/
ol.Kinetic.prototype.end = function() {
_ol_Kinetic_.prototype.end = function() {
if (this.points_.length < 6) {
// at least 2 points are required (i.e. there must be at least 6 elements
// in the array)
@@ -114,7 +114,7 @@ ol.Kinetic.prototype.end = function() {
/**
* @return {number} Total distance travelled (pixels).
*/
ol.Kinetic.prototype.getDistance = function() {
_ol_Kinetic_.prototype.getDistance = function() {
return (this.minVelocity_ - this.initialVelocity_) / this.decay_;
};
@@ -122,6 +122,7 @@ ol.Kinetic.prototype.getDistance = function() {
/**
* @return {number} Angle of the kinetic panning animation (radians).
*/
ol.Kinetic.prototype.getAngle = function() {
_ol_Kinetic_.prototype.getAngle = function() {
return this.angle_;
};
export default _ol_Kinetic_;

View File

@@ -1,12 +1,15 @@
goog.provide('ol.LayerType');
/**
* @module ol/LayerType
*/
/**
* A layer type used when creating layer renderers.
* @enum {string}
*/
ol.LayerType = {
var _ol_LayerType_ = {
IMAGE: 'IMAGE',
TILE: 'TILE',
VECTOR_TILE: 'VECTOR_TILE',
VECTOR: 'VECTOR'
};
export default _ol_LayerType_;

View File

@@ -1,39 +1,40 @@
goog.provide('ol.Map');
goog.require('ol');
goog.require('ol.PluggableMap');
goog.require('ol.PluginType');
goog.require('ol.control');
goog.require('ol.interaction');
goog.require('ol.obj');
goog.require('ol.plugins');
goog.require('ol.renderer.canvas.ImageLayer');
goog.require('ol.renderer.canvas.Map');
goog.require('ol.renderer.canvas.TileLayer');
goog.require('ol.renderer.canvas.VectorLayer');
goog.require('ol.renderer.canvas.VectorTileLayer');
goog.require('ol.renderer.webgl.ImageLayer');
goog.require('ol.renderer.webgl.Map');
goog.require('ol.renderer.webgl.TileLayer');
goog.require('ol.renderer.webgl.VectorLayer');
/**
* @module ol/Map
*/
import _ol_ from './index.js';
import _ol_PluggableMap_ from './PluggableMap.js';
import _ol_PluginType_ from './PluginType.js';
import _ol_control_ from './control.js';
import _ol_interaction_ from './interaction.js';
import _ol_obj_ from './obj.js';
import _ol_plugins_ from './plugins.js';
import _ol_renderer_canvas_ImageLayer_ from './renderer/canvas/ImageLayer.js';
import _ol_renderer_canvas_Map_ from './renderer/canvas/Map.js';
import _ol_renderer_canvas_TileLayer_ from './renderer/canvas/TileLayer.js';
import _ol_renderer_canvas_VectorLayer_ from './renderer/canvas/VectorLayer.js';
import _ol_renderer_canvas_VectorTileLayer_ from './renderer/canvas/VectorTileLayer.js';
import _ol_renderer_webgl_ImageLayer_ from './renderer/webgl/ImageLayer.js';
import _ol_renderer_webgl_Map_ from './renderer/webgl/Map.js';
import _ol_renderer_webgl_TileLayer_ from './renderer/webgl/TileLayer.js';
import _ol_renderer_webgl_VectorLayer_ from './renderer/webgl/VectorLayer.js';
if (ol.ENABLE_CANVAS) {
ol.plugins.register(ol.PluginType.MAP_RENDERER, ol.renderer.canvas.Map);
ol.plugins.registerMultiple(ol.PluginType.LAYER_RENDERER, [
ol.renderer.canvas.ImageLayer,
ol.renderer.canvas.TileLayer,
ol.renderer.canvas.VectorLayer,
ol.renderer.canvas.VectorTileLayer
if (_ol_.ENABLE_CANVAS) {
_ol_plugins_.register(_ol_PluginType_.MAP_RENDERER, _ol_renderer_canvas_Map_);
_ol_plugins_.registerMultiple(_ol_PluginType_.LAYER_RENDERER, [
_ol_renderer_canvas_ImageLayer_,
_ol_renderer_canvas_TileLayer_,
_ol_renderer_canvas_VectorLayer_,
_ol_renderer_canvas_VectorTileLayer_
]);
}
if (ol.ENABLE_WEBGL) {
ol.plugins.register(ol.PluginType.MAP_RENDERER, ol.renderer.webgl.Map);
ol.plugins.registerMultiple(ol.PluginType.LAYER_RENDERER, [
ol.renderer.webgl.ImageLayer,
ol.renderer.webgl.TileLayer,
ol.renderer.webgl.VectorLayer
if (_ol_.ENABLE_WEBGL) {
_ol_plugins_.register(_ol_PluginType_.MAP_RENDERER, _ol_renderer_webgl_Map_);
_ol_plugins_.registerMultiple(_ol_PluginType_.LAYER_RENDERER, [
_ol_renderer_webgl_ImageLayer_,
_ol_renderer_webgl_TileLayer_,
_ol_renderer_webgl_VectorLayer_
]);
}
@@ -86,15 +87,17 @@ if (ol.ENABLE_WEBGL) {
* @fires ol.render.Event#precompose
* @api
*/
ol.Map = function(options) {
options = ol.obj.assign({}, options);
var _ol_Map_ = function(options) {
options = _ol_obj_.assign({}, options);
if (!options.controls) {
options.controls = ol.control.defaults();
options.controls = _ol_control_.defaults();
}
if (!options.interactions) {
options.interactions = ol.interaction.defaults();
options.interactions = _ol_interaction_.defaults();
}
ol.PluggableMap.call(this, options);
_ol_PluggableMap_.call(this, options);
};
ol.inherits(ol.Map, ol.PluggableMap);
_ol_.inherits(_ol_Map_, _ol_PluggableMap_);
export default _ol_Map_;

View File

@@ -1,8 +1,8 @@
goog.provide('ol.MapBrowserEvent');
goog.require('ol');
goog.require('ol.MapEvent');
/**
* @module ol/MapBrowserEvent
*/
import _ol_ from './index.js';
import _ol_MapEvent_ from './MapEvent.js';
/**
* @classdesc
@@ -18,10 +18,10 @@ goog.require('ol.MapEvent');
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?olx.FrameState=} opt_frameState Frame state.
*/
ol.MapBrowserEvent = function(type, map, browserEvent, opt_dragging,
var _ol_MapBrowserEvent_ = function(type, map, browserEvent, opt_dragging,
opt_frameState) {
ol.MapEvent.call(this, type, map, opt_frameState);
_ol_MapEvent_.call(this, type, map, opt_frameState);
/**
* The original browser event.
@@ -55,7 +55,8 @@ ol.MapBrowserEvent = function(type, map, browserEvent, opt_dragging,
this.dragging = opt_dragging !== undefined ? opt_dragging : false;
};
ol.inherits(ol.MapBrowserEvent, ol.MapEvent);
_ol_.inherits(_ol_MapBrowserEvent_, _ol_MapEvent_);
/**
@@ -64,8 +65,8 @@ ol.inherits(ol.MapBrowserEvent, ol.MapEvent);
* @override
* @api
*/
ol.MapBrowserEvent.prototype.preventDefault = function() {
ol.MapEvent.prototype.preventDefault.call(this);
_ol_MapBrowserEvent_.prototype.preventDefault = function() {
_ol_MapEvent_.prototype.preventDefault.call(this);
this.originalEvent.preventDefault();
};
@@ -76,7 +77,8 @@ ol.MapBrowserEvent.prototype.preventDefault = function() {
* @override
* @api
*/
ol.MapBrowserEvent.prototype.stopPropagation = function() {
ol.MapEvent.prototype.stopPropagation.call(this);
_ol_MapBrowserEvent_.prototype.stopPropagation = function() {
_ol_MapEvent_.prototype.stopPropagation.call(this);
this.originalEvent.stopPropagation();
};
export default _ol_MapBrowserEvent_;

View File

@@ -1,14 +1,14 @@
goog.provide('ol.MapBrowserEventHandler');
goog.require('ol');
goog.require('ol.has');
goog.require('ol.MapBrowserEventType');
goog.require('ol.MapBrowserPointerEvent');
goog.require('ol.events');
goog.require('ol.events.EventTarget');
goog.require('ol.pointer.EventType');
goog.require('ol.pointer.PointerEventHandler');
/**
* @module ol/MapBrowserEventHandler
*/
import _ol_ from './index.js';
import _ol_has_ from './has.js';
import _ol_MapBrowserEventType_ from './MapBrowserEventType.js';
import _ol_MapBrowserPointerEvent_ from './MapBrowserPointerEvent.js';
import _ol_events_ from './events.js';
import _ol_events_EventTarget_ from './events/EventTarget.js';
import _ol_pointer_EventType_ from './pointer/EventType.js';
import _ol_pointer_PointerEventHandler_ from './pointer/PointerEventHandler.js';
/**
* @param {ol.PluggableMap} map The map with the viewport to listen to events on.
@@ -16,9 +16,9 @@ goog.require('ol.pointer.PointerEventHandler');
* @constructor
* @extends {ol.events.EventTarget}
*/
ol.MapBrowserEventHandler = function(map, moveTolerance) {
var _ol_MapBrowserEventHandler_ = function(map, moveTolerance) {
ol.events.EventTarget.call(this);
_ol_events_EventTarget_.call(this);
/**
* This is the element that we will listen to the real events on.
@@ -50,7 +50,7 @@ ol.MapBrowserEventHandler = function(map, moveTolerance) {
* @private
*/
this.moveTolerance_ = moveTolerance ?
moveTolerance * ol.has.DEVICE_PIXEL_RATIO : ol.has.DEVICE_PIXEL_RATIO;
moveTolerance * _ol_has_.DEVICE_PIXEL_RATIO : _ol_has_.DEVICE_PIXEL_RATIO;
/**
* The most recent "down" type event (or null if none have occurred).
@@ -81,7 +81,7 @@ ol.MapBrowserEventHandler = function(map, moveTolerance) {
* @type {ol.pointer.PointerEventHandler}
* @private
*/
this.pointerEventHandler_ = new ol.pointer.PointerEventHandler(element);
this.pointerEventHandler_ = new _ol_pointer_PointerEventHandler_(element);
/**
* Event handler which generates pointer events for
@@ -96,43 +96,44 @@ ol.MapBrowserEventHandler = function(map, moveTolerance) {
* @type {?ol.EventsKey}
* @private
*/
this.pointerdownListenerKey_ = ol.events.listen(this.pointerEventHandler_,
ol.pointer.EventType.POINTERDOWN,
this.pointerdownListenerKey_ = _ol_events_.listen(this.pointerEventHandler_,
_ol_pointer_EventType_.POINTERDOWN,
this.handlePointerDown_, this);
/**
* @type {?ol.EventsKey}
* @private
*/
this.relayedListenerKey_ = ol.events.listen(this.pointerEventHandler_,
ol.pointer.EventType.POINTERMOVE,
this.relayedListenerKey_ = _ol_events_.listen(this.pointerEventHandler_,
_ol_pointer_EventType_.POINTERMOVE,
this.relayEvent_, this);
};
ol.inherits(ol.MapBrowserEventHandler, ol.events.EventTarget);
_ol_.inherits(_ol_MapBrowserEventHandler_, _ol_events_EventTarget_);
/**
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.emulateClick_ = function(pointerEvent) {
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEventType.CLICK, this.map_, pointerEvent);
_ol_MapBrowserEventHandler_.prototype.emulateClick_ = function(pointerEvent) {
var newEvent = new _ol_MapBrowserPointerEvent_(
_ol_MapBrowserEventType_.CLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
if (this.clickTimeoutId_ !== 0) {
// double-click
clearTimeout(this.clickTimeoutId_);
this.clickTimeoutId_ = 0;
newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEventType.DBLCLICK, this.map_, pointerEvent);
newEvent = new _ol_MapBrowserPointerEvent_(
_ol_MapBrowserEventType_.DBLCLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
} else {
// click
this.clickTimeoutId_ = setTimeout(function() {
this.clickTimeoutId_ = 0;
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEventType.SINGLECLICK, this.map_, pointerEvent);
var newEvent = new _ol_MapBrowserPointerEvent_(
_ol_MapBrowserEventType_.SINGLECLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
}.bind(this), 250);
}
@@ -145,13 +146,13 @@ ol.MapBrowserEventHandler.prototype.emulateClick_ = function(pointerEvent) {
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.updateActivePointers_ = function(pointerEvent) {
_ol_MapBrowserEventHandler_.prototype.updateActivePointers_ = function(pointerEvent) {
var event = pointerEvent;
if (event.type == ol.MapBrowserEventType.POINTERUP ||
event.type == ol.MapBrowserEventType.POINTERCANCEL) {
if (event.type == _ol_MapBrowserEventType_.POINTERUP ||
event.type == _ol_MapBrowserEventType_.POINTERCANCEL) {
delete this.trackedTouches_[event.pointerId];
} else if (event.type == ol.MapBrowserEventType.POINTERDOWN) {
} else if (event.type == _ol_MapBrowserEventType_.POINTERDOWN) {
this.trackedTouches_[event.pointerId] = true;
}
this.activePointers_ = Object.keys(this.trackedTouches_).length;
@@ -162,10 +163,10 @@ ol.MapBrowserEventHandler.prototype.updateActivePointers_ = function(pointerEven
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) {
_ol_MapBrowserEventHandler_.prototype.handlePointerUp_ = function(pointerEvent) {
this.updateActivePointers_(pointerEvent);
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEventType.POINTERUP, this.map_, pointerEvent);
var newEvent = new _ol_MapBrowserPointerEvent_(
_ol_MapBrowserEventType_.POINTERUP, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
// We emulate click events on left mouse button click, touch contact, and pen
@@ -179,7 +180,7 @@ ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) {
}
if (this.activePointers_ === 0) {
this.dragListenerKeys_.forEach(ol.events.unlistenByKey);
this.dragListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.dragListenerKeys_.length = 0;
this.dragging_ = false;
this.down_ = null;
@@ -194,7 +195,7 @@ ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) {
* @return {boolean} If the left mouse button was pressed.
* @private
*/
ol.MapBrowserEventHandler.prototype.isMouseActionButton_ = function(pointerEvent) {
_ol_MapBrowserEventHandler_.prototype.isMouseActionButton_ = function(pointerEvent) {
return pointerEvent.button === 0;
};
@@ -203,10 +204,10 @@ ol.MapBrowserEventHandler.prototype.isMouseActionButton_ = function(pointerEvent
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent) {
_ol_MapBrowserEventHandler_.prototype.handlePointerDown_ = function(pointerEvent) {
this.updateActivePointers_(pointerEvent);
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEventType.POINTERDOWN, this.map_, pointerEvent);
var newEvent = new _ol_MapBrowserPointerEvent_(
_ol_MapBrowserEventType_.POINTERDOWN, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
this.down_ = pointerEvent;
@@ -217,14 +218,14 @@ ol.MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent)
* the viewport when dragging.
*/
this.documentPointerEventHandler_ =
new ol.pointer.PointerEventHandler(document);
new _ol_pointer_PointerEventHandler_(document);
this.dragListenerKeys_.push(
ol.events.listen(this.documentPointerEventHandler_,
ol.MapBrowserEventType.POINTERMOVE,
_ol_events_.listen(this.documentPointerEventHandler_,
_ol_MapBrowserEventType_.POINTERMOVE,
this.handlePointerMove_, this),
ol.events.listen(this.documentPointerEventHandler_,
ol.MapBrowserEventType.POINTERUP,
_ol_events_.listen(this.documentPointerEventHandler_,
_ol_MapBrowserEventType_.POINTERUP,
this.handlePointerUp_, this),
/* Note that the listener for `pointercancel is set up on
* `pointerEventHandler_` and not `documentPointerEventHandler_` like
@@ -239,8 +240,8 @@ ol.MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent)
* only receive a `touchcancel` from `pointerEventHandler_`, because it is
* only registered there.
*/
ol.events.listen(this.pointerEventHandler_,
ol.MapBrowserEventType.POINTERCANCEL,
_ol_events_.listen(this.pointerEventHandler_,
_ol_MapBrowserEventType_.POINTERCANCEL,
this.handlePointerUp_, this)
);
}
@@ -251,14 +252,14 @@ ol.MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent)
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.handlePointerMove_ = function(pointerEvent) {
_ol_MapBrowserEventHandler_.prototype.handlePointerMove_ = function(pointerEvent) {
// Between pointerdown and pointerup, pointermove events are triggered.
// To avoid a 'false' touchmove event to be dispatched, we test if the pointer
// moved a significant distance.
if (this.isMoving_(pointerEvent)) {
this.dragging_ = true;
var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEventType.POINTERDRAG, this.map_, pointerEvent,
var newEvent = new _ol_MapBrowserPointerEvent_(
_ol_MapBrowserEventType_.POINTERDRAG, this.map_, pointerEvent,
this.dragging_);
this.dispatchEvent(newEvent);
}
@@ -277,9 +278,9 @@ ol.MapBrowserEventHandler.prototype.handlePointerMove_ = function(pointerEvent)
* @param {ol.pointer.PointerEvent} pointerEvent Pointer event.
* @private
*/
ol.MapBrowserEventHandler.prototype.relayEvent_ = function(pointerEvent) {
_ol_MapBrowserEventHandler_.prototype.relayEvent_ = function(pointerEvent) {
var dragging = !!(this.down_ && this.isMoving_(pointerEvent));
this.dispatchEvent(new ol.MapBrowserPointerEvent(
this.dispatchEvent(new _ol_MapBrowserPointerEvent_(
pointerEvent.type, this.map_, pointerEvent, dragging));
};
@@ -289,7 +290,7 @@ ol.MapBrowserEventHandler.prototype.relayEvent_ = function(pointerEvent) {
* @return {boolean} Is moving.
* @private
*/
ol.MapBrowserEventHandler.prototype.isMoving_ = function(pointerEvent) {
_ol_MapBrowserEventHandler_.prototype.isMoving_ = function(pointerEvent) {
return Math.abs(pointerEvent.clientX - this.down_.clientX) > this.moveTolerance_ ||
Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_;
};
@@ -298,17 +299,17 @@ ol.MapBrowserEventHandler.prototype.isMoving_ = function(pointerEvent) {
/**
* @inheritDoc
*/
ol.MapBrowserEventHandler.prototype.disposeInternal = function() {
_ol_MapBrowserEventHandler_.prototype.disposeInternal = function() {
if (this.relayedListenerKey_) {
ol.events.unlistenByKey(this.relayedListenerKey_);
_ol_events_.unlistenByKey(this.relayedListenerKey_);
this.relayedListenerKey_ = null;
}
if (this.pointerdownListenerKey_) {
ol.events.unlistenByKey(this.pointerdownListenerKey_);
_ol_events_.unlistenByKey(this.pointerdownListenerKey_);
this.pointerdownListenerKey_ = null;
}
this.dragListenerKeys_.forEach(ol.events.unlistenByKey);
this.dragListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.dragListenerKeys_.length = 0;
if (this.documentPointerEventHandler_) {
@@ -319,5 +320,6 @@ ol.MapBrowserEventHandler.prototype.disposeInternal = function() {
this.pointerEventHandler_.dispose();
this.pointerEventHandler_ = null;
}
ol.events.EventTarget.prototype.disposeInternal.call(this);
_ol_events_EventTarget_.prototype.disposeInternal.call(this);
};
export default _ol_MapBrowserEventHandler_;

View File

@@ -1,13 +1,13 @@
goog.provide('ol.MapBrowserEventType');
goog.require('ol.events.EventType');
/**
* @module ol/MapBrowserEventType
*/
import _ol_events_EventType_ from './events/EventType.js';
/**
* Constants for event names.
* @enum {string}
*/
ol.MapBrowserEventType = {
var _ol_MapBrowserEventType_ = {
/**
* A true single click with no dragging and no double click. Note that this
@@ -22,14 +22,14 @@ ol.MapBrowserEventType = {
* @event ol.MapBrowserEvent#click
* @api
*/
CLICK: ol.events.EventType.CLICK,
CLICK: _ol_events_EventType_.CLICK,
/**
* A true double click, with no dragging.
* @event ol.MapBrowserEvent#dblclick
* @api
*/
DBLCLICK: ol.events.EventType.DBLCLICK,
DBLCLICK: _ol_events_EventType_.DBLCLICK,
/**
* Triggered when a pointer is dragged.
@@ -54,3 +54,5 @@ ol.MapBrowserEventType = {
POINTERLEAVE: 'pointerleave',
POINTERCANCEL: 'pointercancel'
};
export default _ol_MapBrowserEventType_;

View File

@@ -1,8 +1,8 @@
goog.provide('ol.MapBrowserPointerEvent');
goog.require('ol');
goog.require('ol.MapBrowserEvent');
/**
* @module ol/MapBrowserPointerEvent
*/
import _ol_ from './index.js';
import _ol_MapBrowserEvent_ from './MapBrowserEvent.js';
/**
* @constructor
@@ -13,10 +13,10 @@ goog.require('ol.MapBrowserEvent');
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?olx.FrameState=} opt_frameState Frame state.
*/
ol.MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging,
var _ol_MapBrowserPointerEvent_ = function(type, map, pointerEvent, opt_dragging,
opt_frameState) {
ol.MapBrowserEvent.call(this, type, map, pointerEvent.originalEvent, opt_dragging,
_ol_MapBrowserEvent_.call(this, type, map, pointerEvent.originalEvent, opt_dragging,
opt_frameState);
/**
@@ -26,4 +26,6 @@ ol.MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging,
this.pointerEvent = pointerEvent;
};
ol.inherits(ol.MapBrowserPointerEvent, ol.MapBrowserEvent);
_ol_.inherits(_ol_MapBrowserPointerEvent_, _ol_MapBrowserEvent_);
export default _ol_MapBrowserPointerEvent_;

View File

@@ -1,8 +1,8 @@
goog.provide('ol.MapEvent');
goog.require('ol');
goog.require('ol.events.Event');
/**
* @module ol/MapEvent
*/
import _ol_ from './index.js';
import _ol_events_Event_ from './events/Event.js';
/**
* @classdesc
@@ -16,9 +16,9 @@ goog.require('ol.events.Event');
* @param {ol.PluggableMap} map Map.
* @param {?olx.FrameState=} opt_frameState Frame state.
*/
ol.MapEvent = function(type, map, opt_frameState) {
var _ol_MapEvent_ = function(type, map, opt_frameState) {
ol.events.Event.call(this, type);
_ol_events_Event_.call(this, type);
/**
* The map where the event occurred.
@@ -35,4 +35,6 @@ ol.MapEvent = function(type, map, opt_frameState) {
this.frameState = opt_frameState !== undefined ? opt_frameState : null;
};
ol.inherits(ol.MapEvent, ol.events.Event);
_ol_.inherits(_ol_MapEvent_, _ol_events_Event_);
export default _ol_MapEvent_;

View File

@@ -1,9 +1,10 @@
goog.provide('ol.MapEventType');
/**
* @module ol/MapEventType
*/
/**
* @enum {string}
*/
ol.MapEventType = {
var _ol_MapEventType_ = {
/**
* Triggered after a map frame is rendered.
@@ -27,3 +28,5 @@ ol.MapEventType = {
MOVEEND: 'moveend'
};
export default _ol_MapEventType_;

View File

@@ -1,11 +1,14 @@
goog.provide('ol.MapProperty');
/**
* @module ol/MapProperty
*/
/**
* @enum {string}
*/
ol.MapProperty = {
var _ol_MapProperty_ = {
LAYERGROUP: 'layergroup',
SIZE: 'size',
TARGET: 'target',
VIEW: 'view'
};
export default _ol_MapProperty_;

View File

@@ -1,11 +1,11 @@
goog.provide('ol.Object');
goog.require('ol');
goog.require('ol.ObjectEventType');
goog.require('ol.Observable');
goog.require('ol.events.Event');
goog.require('ol.obj');
/**
* @module ol/Object
*/
import _ol_ from './index.js';
import _ol_ObjectEventType_ from './ObjectEventType.js';
import _ol_Observable_ from './Observable.js';
import _ol_events_Event_ from './events/Event.js';
import _ol_obj_ from './obj.js';
/**
* @classdesc
@@ -52,14 +52,14 @@ goog.require('ol.obj');
* @fires ol.Object.Event
* @api
*/
ol.Object = function(opt_values) {
ol.Observable.call(this);
var _ol_Object_ = function(opt_values) {
_ol_Observable_.call(this);
// Call ol.getUid to ensure that the order of objects' ids is the same as
// the order in which they were created. This also helps to ensure that
// object properties are always added in the same order, which helps many
// JavaScript engines generate faster code.
ol.getUid(this);
_ol_.getUid(this);
/**
* @private
@@ -71,24 +71,25 @@ ol.Object = function(opt_values) {
this.setProperties(opt_values);
}
};
ol.inherits(ol.Object, ol.Observable);
_ol_.inherits(_ol_Object_, _ol_Observable_);
/**
* @private
* @type {Object.<string, string>}
*/
ol.Object.changeEventTypeCache_ = {};
_ol_Object_.changeEventTypeCache_ = {};
/**
* @param {string} key Key name.
* @return {string} Change name.
*/
ol.Object.getChangeEventType = function(key) {
return ol.Object.changeEventTypeCache_.hasOwnProperty(key) ?
ol.Object.changeEventTypeCache_[key] :
(ol.Object.changeEventTypeCache_[key] = 'change:' + key);
_ol_Object_.getChangeEventType = function(key) {
return _ol_Object_.changeEventTypeCache_.hasOwnProperty(key) ?
_ol_Object_.changeEventTypeCache_[key] :
(_ol_Object_.changeEventTypeCache_[key] = 'change:' + key);
};
@@ -98,7 +99,7 @@ ol.Object.getChangeEventType = function(key) {
* @return {*} Value.
* @api
*/
ol.Object.prototype.get = function(key) {
_ol_Object_.prototype.get = function(key) {
var value;
if (this.values_.hasOwnProperty(key)) {
value = this.values_[key];
@@ -112,7 +113,7 @@ ol.Object.prototype.get = function(key) {
* @return {Array.<string>} List of property names.
* @api
*/
ol.Object.prototype.getKeys = function() {
_ol_Object_.prototype.getKeys = function() {
return Object.keys(this.values_);
};
@@ -122,8 +123,8 @@ ol.Object.prototype.getKeys = function() {
* @return {Object.<string, *>} Object.
* @api
*/
ol.Object.prototype.getProperties = function() {
return ol.obj.assign({}, this.values_);
_ol_Object_.prototype.getProperties = function() {
return _ol_obj_.assign({}, this.values_);
};
@@ -131,12 +132,12 @@ ol.Object.prototype.getProperties = function() {
* @param {string} key Key name.
* @param {*} oldValue Old value.
*/
ol.Object.prototype.notify = function(key, oldValue) {
_ol_Object_.prototype.notify = function(key, oldValue) {
var eventType;
eventType = ol.Object.getChangeEventType(key);
this.dispatchEvent(new ol.Object.Event(eventType, key, oldValue));
eventType = ol.ObjectEventType.PROPERTYCHANGE;
this.dispatchEvent(new ol.Object.Event(eventType, key, oldValue));
eventType = _ol_Object_.getChangeEventType(key);
this.dispatchEvent(new _ol_Object_.Event(eventType, key, oldValue));
eventType = _ol_ObjectEventType_.PROPERTYCHANGE;
this.dispatchEvent(new _ol_Object_.Event(eventType, key, oldValue));
};
@@ -147,7 +148,7 @@ ol.Object.prototype.notify = function(key, oldValue) {
* @param {boolean=} opt_silent Update without triggering an event.
* @api
*/
ol.Object.prototype.set = function(key, value, opt_silent) {
_ol_Object_.prototype.set = function(key, value, opt_silent) {
if (opt_silent) {
this.values_[key] = value;
} else {
@@ -167,7 +168,7 @@ ol.Object.prototype.set = function(key, value, opt_silent) {
* @param {boolean=} opt_silent Update without triggering an event.
* @api
*/
ol.Object.prototype.setProperties = function(values, opt_silent) {
_ol_Object_.prototype.setProperties = function(values, opt_silent) {
var key;
for (key in values) {
this.set(key, values[key], opt_silent);
@@ -181,7 +182,7 @@ ol.Object.prototype.setProperties = function(values, opt_silent) {
* @param {boolean=} opt_silent Unset without triggering an event.
* @api
*/
ol.Object.prototype.unset = function(key, opt_silent) {
_ol_Object_.prototype.unset = function(key, opt_silent) {
if (key in this.values_) {
var oldValue = this.values_[key];
delete this.values_[key];
@@ -203,8 +204,8 @@ ol.Object.prototype.unset = function(key, opt_silent) {
* @implements {oli.Object.Event}
* @constructor
*/
ol.Object.Event = function(type, key, oldValue) {
ol.events.Event.call(this, type);
_ol_Object_.Event = function(type, key, oldValue) {
_ol_events_Event_.call(this, type);
/**
* The name of the property whose value is changing.
@@ -222,4 +223,5 @@ ol.Object.Event = function(type, key, oldValue) {
this.oldValue = oldValue;
};
ol.inherits(ol.Object.Event, ol.events.Event);
_ol_.inherits(_ol_Object_.Event, _ol_events_Event_);
export default _ol_Object_;

View File

@@ -1,9 +1,10 @@
goog.provide('ol.ObjectEventType');
/**
* @module ol/ObjectEventType
*/
/**
* @enum {string}
*/
ol.ObjectEventType = {
var _ol_ObjectEventType_ = {
/**
* Triggered when a property is changed.
* @event ol.Object.Event#propertychange
@@ -11,3 +12,5 @@ ol.ObjectEventType = {
*/
PROPERTYCHANGE: 'propertychange'
};
export default _ol_ObjectEventType_;

View File

@@ -1,10 +1,10 @@
goog.provide('ol.Observable');
goog.require('ol');
goog.require('ol.events');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
/**
* @module ol/Observable
*/
import _ol_ from './index.js';
import _ol_events_ from './events.js';
import _ol_events_EventTarget_ from './events/EventTarget.js';
import _ol_events_EventType_ from './events/EventType.js';
/**
* @classdesc
@@ -20,9 +20,9 @@ goog.require('ol.events.EventType');
* @struct
* @api
*/
ol.Observable = function() {
var _ol_Observable_ = function() {
ol.events.EventTarget.call(this);
_ol_events_EventTarget_.call(this);
/**
* @private
@@ -31,7 +31,8 @@ ol.Observable = function() {
this.revision_ = 0;
};
ol.inherits(ol.Observable, ol.events.EventTarget);
_ol_.inherits(_ol_Observable_, _ol_events_EventTarget_);
/**
@@ -40,13 +41,13 @@ ol.inherits(ol.Observable, ol.events.EventTarget);
* or `once()` (or an array of keys).
* @api
*/
ol.Observable.unByKey = function(key) {
_ol_Observable_.unByKey = function(key) {
if (Array.isArray(key)) {
for (var i = 0, ii = key.length; i < ii; ++i) {
ol.events.unlistenByKey(key[i]);
_ol_events_.unlistenByKey(key[i]);
}
} else {
ol.events.unlistenByKey(/** @type {ol.EventsKey} */ (key));
_ol_events_.unlistenByKey(/** @type {ol.EventsKey} */ (key));
}
};
@@ -55,9 +56,9 @@ ol.Observable.unByKey = function(key) {
* Increases the revision counter and dispatches a 'change' event.
* @api
*/
ol.Observable.prototype.changed = function() {
_ol_Observable_.prototype.changed = function() {
++this.revision_;
this.dispatchEvent(ol.events.EventType.CHANGE);
this.dispatchEvent(_ol_events_EventType_.CHANGE);
};
@@ -72,7 +73,7 @@ ol.Observable.prototype.changed = function() {
* @function
* @api
*/
ol.Observable.prototype.dispatchEvent;
_ol_Observable_.prototype.dispatchEvent;
/**
@@ -81,7 +82,7 @@ ol.Observable.prototype.dispatchEvent;
* @return {number} Revision.
* @api
*/
ol.Observable.prototype.getRevision = function() {
_ol_Observable_.prototype.getRevision = function() {
return this.revision_;
};
@@ -96,16 +97,16 @@ ol.Observable.prototype.getRevision = function() {
* will be an array of keys.
* @api
*/
ol.Observable.prototype.on = function(type, listener, opt_this) {
_ol_Observable_.prototype.on = function(type, listener, opt_this) {
if (Array.isArray(type)) {
var len = type.length;
var keys = new Array(len);
for (var i = 0; i < len; ++i) {
keys[i] = ol.events.listen(this, type[i], listener, opt_this);
keys[i] = _ol_events_.listen(this, type[i], listener, opt_this);
}
return keys;
} else {
return ol.events.listen(
return _ol_events_.listen(
this, /** @type {string} */ (type), listener, opt_this);
}
};
@@ -121,16 +122,16 @@ ol.Observable.prototype.on = function(type, listener, opt_this) {
* will be an array of keys.
* @api
*/
ol.Observable.prototype.once = function(type, listener, opt_this) {
_ol_Observable_.prototype.once = function(type, listener, opt_this) {
if (Array.isArray(type)) {
var len = type.length;
var keys = new Array(len);
for (var i = 0; i < len; ++i) {
keys[i] = ol.events.listenOnce(this, type[i], listener, opt_this);
keys[i] = _ol_events_.listenOnce(this, type[i], listener, opt_this);
}
return keys;
} else {
return ol.events.listenOnce(
return _ol_events_.listenOnce(
this, /** @type {string} */ (type), listener, opt_this);
}
};
@@ -144,13 +145,14 @@ ol.Observable.prototype.once = function(type, listener, opt_this) {
* `listener`.
* @api
*/
ol.Observable.prototype.un = function(type, listener, opt_this) {
_ol_Observable_.prototype.un = function(type, listener, opt_this) {
if (Array.isArray(type)) {
for (var i = 0, ii = type.length; i < ii; ++i) {
ol.events.unlisten(this, type[i], listener, opt_this);
_ol_events_.unlisten(this, type[i], listener, opt_this);
}
return;
} else {
ol.events.unlisten(this, /** @type {string} */ (type), listener, opt_this);
_ol_events_.unlisten(this, /** @type {string} */ (type), listener, opt_this);
}
};
export default _ol_Observable_;

View File

@@ -1,14 +1,14 @@
goog.provide('ol.Overlay');
goog.require('ol');
goog.require('ol.MapEventType');
goog.require('ol.Object');
goog.require('ol.OverlayPositioning');
goog.require('ol.css');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.extent');
/**
* @module ol/Overlay
*/
import _ol_ from './index.js';
import _ol_MapEventType_ from './MapEventType.js';
import _ol_Object_ from './Object.js';
import _ol_OverlayPositioning_ from './OverlayPositioning.js';
import _ol_css_ from './css.js';
import _ol_dom_ from './dom.js';
import _ol_events_ from './events.js';
import _ol_extent_ from './extent.js';
/**
* @classdesc
@@ -31,9 +31,9 @@ goog.require('ol.extent');
* @param {olx.OverlayOptions} options Overlay options.
* @api
*/
ol.Overlay = function(options) {
var _ol_Overlay_ = function(options) {
ol.Object.call(this);
_ol_Object_.call(this);
/**
* @protected
@@ -66,7 +66,7 @@ ol.Overlay = function(options) {
*/
this.element = document.createElement('DIV');
this.element.className = options.className !== undefined ?
options.className : 'ol-overlay-container ' + ol.css.CLASS_SELECTABLE;
options.className : 'ol-overlay-container ' + _ol_css_.CLASS_SELECTABLE;
this.element.style.position = 'absolute';
/**
@@ -111,24 +111,24 @@ ol.Overlay = function(options) {
*/
this.mapPostrenderListenerKey = null;
ol.events.listen(
this, ol.Object.getChangeEventType(ol.Overlay.Property.ELEMENT),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.ELEMENT),
this.handleElementChanged, this);
ol.events.listen(
this, ol.Object.getChangeEventType(ol.Overlay.Property.MAP),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.MAP),
this.handleMapChanged, this);
ol.events.listen(
this, ol.Object.getChangeEventType(ol.Overlay.Property.OFFSET),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.OFFSET),
this.handleOffsetChanged, this);
ol.events.listen(
this, ol.Object.getChangeEventType(ol.Overlay.Property.POSITION),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.POSITION),
this.handlePositionChanged, this);
ol.events.listen(
this, ol.Object.getChangeEventType(ol.Overlay.Property.POSITIONING),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_Overlay_.Property.POSITIONING),
this.handlePositioningChanged, this);
if (options.element !== undefined) {
@@ -139,14 +139,15 @@ ol.Overlay = function(options) {
this.setPositioning(options.positioning !== undefined ?
/** @type {ol.OverlayPositioning} */ (options.positioning) :
ol.OverlayPositioning.TOP_LEFT);
_ol_OverlayPositioning_.TOP_LEFT);
if (options.position !== undefined) {
this.setPosition(options.position);
}
};
ol.inherits(ol.Overlay, ol.Object);
_ol_.inherits(_ol_Overlay_, _ol_Object_);
/**
@@ -155,9 +156,10 @@ ol.inherits(ol.Overlay, ol.Object);
* @observable
* @api
*/
ol.Overlay.prototype.getElement = function() {
return /** @type {Element|undefined} */ (
this.get(ol.Overlay.Property.ELEMENT));
_ol_Overlay_.prototype.getElement = function() {
return (
/** @type {Element|undefined} */ this.get(_ol_Overlay_.Property.ELEMENT)
);
};
@@ -166,7 +168,7 @@ ol.Overlay.prototype.getElement = function() {
* @return {number|string|undefined} Id.
* @api
*/
ol.Overlay.prototype.getId = function() {
_ol_Overlay_.prototype.getId = function() {
return this.id;
};
@@ -177,9 +179,10 @@ ol.Overlay.prototype.getId = function() {
* @observable
* @api
*/
ol.Overlay.prototype.getMap = function() {
return /** @type {ol.PluggableMap|undefined} */ (
this.get(ol.Overlay.Property.MAP));
_ol_Overlay_.prototype.getMap = function() {
return (
/** @type {ol.PluggableMap|undefined} */ this.get(_ol_Overlay_.Property.MAP)
);
};
@@ -189,9 +192,10 @@ ol.Overlay.prototype.getMap = function() {
* @observable
* @api
*/
ol.Overlay.prototype.getOffset = function() {
return /** @type {Array.<number>} */ (
this.get(ol.Overlay.Property.OFFSET));
_ol_Overlay_.prototype.getOffset = function() {
return (
/** @type {Array.<number>} */ this.get(_ol_Overlay_.Property.OFFSET)
);
};
@@ -202,9 +206,10 @@ ol.Overlay.prototype.getOffset = function() {
* @observable
* @api
*/
ol.Overlay.prototype.getPosition = function() {
return /** @type {ol.Coordinate|undefined} */ (
this.get(ol.Overlay.Property.POSITION));
_ol_Overlay_.prototype.getPosition = function() {
return (
/** @type {ol.Coordinate|undefined} */ this.get(_ol_Overlay_.Property.POSITION)
);
};
@@ -215,17 +220,18 @@ ol.Overlay.prototype.getPosition = function() {
* @observable
* @api
*/
ol.Overlay.prototype.getPositioning = function() {
return /** @type {ol.OverlayPositioning} */ (
this.get(ol.Overlay.Property.POSITIONING));
_ol_Overlay_.prototype.getPositioning = function() {
return (
/** @type {ol.OverlayPositioning} */ this.get(_ol_Overlay_.Property.POSITIONING)
);
};
/**
* @protected
*/
ol.Overlay.prototype.handleElementChanged = function() {
ol.dom.removeChildren(this.element);
_ol_Overlay_.prototype.handleElementChanged = function() {
_ol_dom_.removeChildren(this.element);
var element = this.getElement();
if (element) {
this.element.appendChild(element);
@@ -236,16 +242,16 @@ ol.Overlay.prototype.handleElementChanged = function() {
/**
* @protected
*/
ol.Overlay.prototype.handleMapChanged = function() {
_ol_Overlay_.prototype.handleMapChanged = function() {
if (this.mapPostrenderListenerKey) {
ol.dom.removeNode(this.element);
ol.events.unlistenByKey(this.mapPostrenderListenerKey);
_ol_dom_.removeNode(this.element);
_ol_events_.unlistenByKey(this.mapPostrenderListenerKey);
this.mapPostrenderListenerKey = null;
}
var map = this.getMap();
if (map) {
this.mapPostrenderListenerKey = ol.events.listen(map,
ol.MapEventType.POSTRENDER, this.render, this);
this.mapPostrenderListenerKey = _ol_events_.listen(map,
_ol_MapEventType_.POSTRENDER, this.render, this);
this.updatePixelPosition();
var container = this.stopEvent ?
map.getOverlayContainerStopEvent() : map.getOverlayContainer();
@@ -261,7 +267,7 @@ ol.Overlay.prototype.handleMapChanged = function() {
/**
* @protected
*/
ol.Overlay.prototype.render = function() {
_ol_Overlay_.prototype.render = function() {
this.updatePixelPosition();
};
@@ -269,7 +275,7 @@ ol.Overlay.prototype.render = function() {
/**
* @protected
*/
ol.Overlay.prototype.handleOffsetChanged = function() {
_ol_Overlay_.prototype.handleOffsetChanged = function() {
this.updatePixelPosition();
};
@@ -277,9 +283,9 @@ ol.Overlay.prototype.handleOffsetChanged = function() {
/**
* @protected
*/
ol.Overlay.prototype.handlePositionChanged = function() {
_ol_Overlay_.prototype.handlePositionChanged = function() {
this.updatePixelPosition();
if (this.get(ol.Overlay.Property.POSITION) && this.autoPan) {
if (this.get(_ol_Overlay_.Property.POSITION) && this.autoPan) {
this.panIntoView();
}
};
@@ -288,7 +294,7 @@ ol.Overlay.prototype.handlePositionChanged = function() {
/**
* @protected
*/
ol.Overlay.prototype.handlePositioningChanged = function() {
_ol_Overlay_.prototype.handlePositioningChanged = function() {
this.updatePixelPosition();
};
@@ -299,8 +305,8 @@ ol.Overlay.prototype.handlePositioningChanged = function() {
* @observable
* @api
*/
ol.Overlay.prototype.setElement = function(element) {
this.set(ol.Overlay.Property.ELEMENT, element);
_ol_Overlay_.prototype.setElement = function(element) {
this.set(_ol_Overlay_.Property.ELEMENT, element);
};
@@ -310,8 +316,8 @@ ol.Overlay.prototype.setElement = function(element) {
* @observable
* @api
*/
ol.Overlay.prototype.setMap = function(map) {
this.set(ol.Overlay.Property.MAP, map);
_ol_Overlay_.prototype.setMap = function(map) {
this.set(_ol_Overlay_.Property.MAP, map);
};
@@ -321,8 +327,8 @@ ol.Overlay.prototype.setMap = function(map) {
* @observable
* @api
*/
ol.Overlay.prototype.setOffset = function(offset) {
this.set(ol.Overlay.Property.OFFSET, offset);
_ol_Overlay_.prototype.setOffset = function(offset) {
this.set(_ol_Overlay_.Property.OFFSET, offset);
};
@@ -334,8 +340,8 @@ ol.Overlay.prototype.setOffset = function(offset) {
* @observable
* @api
*/
ol.Overlay.prototype.setPosition = function(position) {
this.set(ol.Overlay.Property.POSITION, position);
_ol_Overlay_.prototype.setPosition = function(position) {
this.set(_ol_Overlay_.Property.POSITION, position);
};
@@ -344,7 +350,7 @@ ol.Overlay.prototype.setPosition = function(position) {
* (if necessary).
* @protected
*/
ol.Overlay.prototype.panIntoView = function() {
_ol_Overlay_.prototype.panIntoView = function() {
var map = this.getMap();
if (!map || !map.getTargetElement()) {
@@ -354,10 +360,10 @@ ol.Overlay.prototype.panIntoView = function() {
var mapRect = this.getRect(map.getTargetElement(), map.getSize());
var element = /** @type {!Element} */ (this.getElement());
var overlayRect = this.getRect(element,
[ol.dom.outerWidth(element), ol.dom.outerHeight(element)]);
[_ol_dom_.outerWidth(element), _ol_dom_.outerHeight(element)]);
var margin = this.autoPanMargin;
if (!ol.extent.containsExtent(mapRect, overlayRect)) {
if (!_ol_extent_.containsExtent(mapRect, overlayRect)) {
// the overlay is not completely inside the viewport, so pan the map
var offsetLeft = overlayRect[0] - mapRect[0];
var offsetRight = mapRect[2] - overlayRect[2];
@@ -405,7 +411,7 @@ ol.Overlay.prototype.panIntoView = function() {
* @return {ol.Extent} The extent.
* @protected
*/
ol.Overlay.prototype.getRect = function(element, size) {
_ol_Overlay_.prototype.getRect = function(element, size) {
var box = element.getBoundingClientRect();
var offsetX = box.left + window.pageXOffset;
var offsetY = box.top + window.pageYOffset;
@@ -425,8 +431,8 @@ ol.Overlay.prototype.getRect = function(element, size) {
* @observable
* @api
*/
ol.Overlay.prototype.setPositioning = function(positioning) {
this.set(ol.Overlay.Property.POSITIONING, positioning);
_ol_Overlay_.prototype.setPositioning = function(positioning) {
this.set(_ol_Overlay_.Property.POSITIONING, positioning);
};
@@ -435,7 +441,7 @@ ol.Overlay.prototype.setPositioning = function(positioning) {
* @param {boolean} visible Element visibility.
* @protected
*/
ol.Overlay.prototype.setVisible = function(visible) {
_ol_Overlay_.prototype.setVisible = function(visible) {
if (this.rendered.visible !== visible) {
this.element.style.display = visible ? '' : 'none';
this.rendered.visible = visible;
@@ -447,7 +453,7 @@ ol.Overlay.prototype.setVisible = function(visible) {
* Update pixel position.
* @protected
*/
ol.Overlay.prototype.updatePixelPosition = function() {
_ol_Overlay_.prototype.updatePixelPosition = function() {
var map = this.getMap();
var position = this.getPosition();
if (!map || !map.isRendered() || !position) {
@@ -466,7 +472,7 @@ ol.Overlay.prototype.updatePixelPosition = function() {
* @param {ol.Size|undefined} mapSize The map size.
* @protected
*/
ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
_ol_Overlay_.prototype.updateRenderedPosition = function(pixel, mapSize) {
var style = this.element.style;
var offset = this.getOffset();
@@ -476,9 +482,9 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
var offsetX = offset[0];
var offsetY = offset[1];
if (positioning == ol.OverlayPositioning.BOTTOM_RIGHT ||
positioning == ol.OverlayPositioning.CENTER_RIGHT ||
positioning == ol.OverlayPositioning.TOP_RIGHT) {
if (positioning == _ol_OverlayPositioning_.BOTTOM_RIGHT ||
positioning == _ol_OverlayPositioning_.CENTER_RIGHT ||
positioning == _ol_OverlayPositioning_.TOP_RIGHT) {
if (this.rendered.left_ !== '') {
this.rendered.left_ = style.left = '';
}
@@ -490,9 +496,9 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
if (this.rendered.right_ !== '') {
this.rendered.right_ = style.right = '';
}
if (positioning == ol.OverlayPositioning.BOTTOM_CENTER ||
positioning == ol.OverlayPositioning.CENTER_CENTER ||
positioning == ol.OverlayPositioning.TOP_CENTER) {
if (positioning == _ol_OverlayPositioning_.BOTTOM_CENTER ||
positioning == _ol_OverlayPositioning_.CENTER_CENTER ||
positioning == _ol_OverlayPositioning_.TOP_CENTER) {
offsetX -= this.element.offsetWidth / 2;
}
var left = Math.round(pixel[0] + offsetX) + 'px';
@@ -500,9 +506,9 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
this.rendered.left_ = style.left = left;
}
}
if (positioning == ol.OverlayPositioning.BOTTOM_LEFT ||
positioning == ol.OverlayPositioning.BOTTOM_CENTER ||
positioning == ol.OverlayPositioning.BOTTOM_RIGHT) {
if (positioning == _ol_OverlayPositioning_.BOTTOM_LEFT ||
positioning == _ol_OverlayPositioning_.BOTTOM_CENTER ||
positioning == _ol_OverlayPositioning_.BOTTOM_RIGHT) {
if (this.rendered.top_ !== '') {
this.rendered.top_ = style.top = '';
}
@@ -514,9 +520,9 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
if (this.rendered.bottom_ !== '') {
this.rendered.bottom_ = style.bottom = '';
}
if (positioning == ol.OverlayPositioning.CENTER_LEFT ||
positioning == ol.OverlayPositioning.CENTER_CENTER ||
positioning == ol.OverlayPositioning.CENTER_RIGHT) {
if (positioning == _ol_OverlayPositioning_.CENTER_LEFT ||
positioning == _ol_OverlayPositioning_.CENTER_CENTER ||
positioning == _ol_OverlayPositioning_.CENTER_RIGHT) {
offsetY -= this.element.offsetHeight / 2;
}
var top = Math.round(pixel[1] + offsetY) + 'px';
@@ -532,7 +538,7 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
* @public
* @return {olx.OverlayOptions} overlay options
*/
ol.Overlay.prototype.getOptions = function() {
_ol_Overlay_.prototype.getOptions = function() {
return this.options;
};
@@ -541,10 +547,11 @@ ol.Overlay.prototype.getOptions = function() {
* @enum {string}
* @protected
*/
ol.Overlay.Property = {
_ol_Overlay_.Property = {
ELEMENT: 'element',
MAP: 'map',
OFFSET: 'offset',
POSITION: 'position',
POSITIONING: 'positioning'
};
export default _ol_Overlay_;

View File

@@ -1,12 +1,13 @@
goog.provide('ol.OverlayPositioning');
/**
* @module ol/OverlayPositioning
*/
/**
* Overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,
* `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,
* `'top-center'`, `'top-right'`
* @enum {string}
*/
ol.OverlayPositioning = {
var _ol_OverlayPositioning_ = {
BOTTOM_LEFT: 'bottom-left',
BOTTOM_CENTER: 'bottom-center',
BOTTOM_RIGHT: 'bottom-right',
@@ -17,3 +18,5 @@ ol.OverlayPositioning = {
TOP_CENTER: 'top-center',
TOP_RIGHT: 'top-right'
};
export default _ol_OverlayPositioning_;

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,14 @@
goog.provide('ol.PluginType');
/**
* @module ol/PluginType
*/
/**
* A plugin type used when registering a plugin. The supported plugin types are
* 'MAP_RENDERER', and 'LAYER_RENDERER'.
* @enum {string}
*/
ol.PluginType = {
var _ol_PluginType_ = {
MAP_RENDERER: 'MAP_RENDERER',
LAYER_RENDERER: 'LAYER_RENDERER'
};
export default _ol_PluginType_;

View File

@@ -1,14 +1,16 @@
goog.provide('ol.ResolutionConstraint');
goog.require('ol.array');
goog.require('ol.math');
/**
* @module ol/ResolutionConstraint
*/
import _ol_array_ from './array.js';
import _ol_math_ from './math.js';
var _ol_ResolutionConstraint_ = {};
/**
* @param {Array.<number>} resolutions Resolutions.
* @return {ol.ResolutionConstraintType} Zoom function.
*/
ol.ResolutionConstraint.createSnapToResolutions = function(resolutions) {
_ol_ResolutionConstraint_.createSnapToResolutions = function(resolutions) {
return (
/**
* @param {number|undefined} resolution Resolution.
@@ -19,8 +21,8 @@ ol.ResolutionConstraint.createSnapToResolutions = function(resolutions) {
function(resolution, delta, direction) {
if (resolution !== undefined) {
var z =
ol.array.linearFindNearest(resolutions, resolution, direction);
z = ol.math.clamp(z + delta, 0, resolutions.length - 1);
_ol_array_.linearFindNearest(resolutions, resolution, direction);
z = _ol_math_.clamp(z + delta, 0, resolutions.length - 1);
var index = Math.floor(z);
if (z != index && index < resolutions.length - 1) {
var power = resolutions[index] / resolutions[index + 1];
@@ -31,7 +33,8 @@ ol.ResolutionConstraint.createSnapToResolutions = function(resolutions) {
} else {
return undefined;
}
});
}
);
};
@@ -41,7 +44,7 @@ ol.ResolutionConstraint.createSnapToResolutions = function(resolutions) {
* @param {number=} opt_maxLevel Maximum level.
* @return {ol.ResolutionConstraintType} Zoom function.
*/
ol.ResolutionConstraint.createSnapToPower = function(power, maxResolution, opt_maxLevel) {
_ol_ResolutionConstraint_.createSnapToPower = function(power, maxResolution, opt_maxLevel) {
return (
/**
* @param {number|undefined} resolution Resolution.
@@ -64,3 +67,4 @@ ol.ResolutionConstraint.createSnapToPower = function(power, maxResolution, opt_m
}
});
};
export default _ol_ResolutionConstraint_;

View File

@@ -1,6 +1,8 @@
goog.provide('ol.RotationConstraint');
goog.require('ol.math');
/**
* @module ol/RotationConstraint
*/
import _ol_math_ from './math.js';
var _ol_RotationConstraint_ = {};
/**
@@ -8,7 +10,7 @@ goog.require('ol.math');
* @param {number} delta Delta.
* @return {number|undefined} Rotation.
*/
ol.RotationConstraint.disable = function(rotation, delta) {
_ol_RotationConstraint_.disable = function(rotation, delta) {
if (rotation !== undefined) {
return 0;
} else {
@@ -22,7 +24,7 @@ ol.RotationConstraint.disable = function(rotation, delta) {
* @param {number} delta Delta.
* @return {number|undefined} Rotation.
*/
ol.RotationConstraint.none = function(rotation, delta) {
_ol_RotationConstraint_.none = function(rotation, delta) {
if (rotation !== undefined) {
return rotation + delta;
} else {
@@ -35,7 +37,7 @@ ol.RotationConstraint.none = function(rotation, delta) {
* @param {number} n N.
* @return {ol.RotationConstraintType} Rotation constraint.
*/
ol.RotationConstraint.createSnapToN = function(n) {
_ol_RotationConstraint_.createSnapToN = function(n) {
var theta = 2 * Math.PI / n;
return (
/**
@@ -58,8 +60,8 @@ ol.RotationConstraint.createSnapToN = function(n) {
* @param {number=} opt_tolerance Tolerance.
* @return {ol.RotationConstraintType} Rotation constraint.
*/
ol.RotationConstraint.createSnapToZero = function(opt_tolerance) {
var tolerance = opt_tolerance || ol.math.toRadians(5);
_ol_RotationConstraint_.createSnapToZero = function(opt_tolerance) {
var tolerance = opt_tolerance || _ol_math_.toRadians(5);
return (
/**
* @param {number|undefined} rotation Rotation.
@@ -78,3 +80,4 @@ ol.RotationConstraint.createSnapToZero = function(opt_tolerance) {
}
});
};
export default _ol_RotationConstraint_;

View File

@@ -1,3 +1,6 @@
/**
* @module ol/Sphere
*/
/**
* @license
* Latitude/longitude spherical geodesy formulae taken from
@@ -5,11 +8,8 @@
* Licensed under CC-BY-3.0.
*/
goog.provide('ol.Sphere');
goog.require('ol.math');
goog.require('ol.geom.GeometryType');
import _ol_math_ from './math.js';
import _ol_geom_GeometryType_ from './geom/GeometryType.js';
/**
* @classdesc
@@ -27,7 +27,7 @@ goog.require('ol.geom.GeometryType');
* @param {number} radius Radius.
* @api
*/
ol.Sphere = function(radius) {
var _ol_Sphere_ = function(radius) {
/**
* @type {number}
@@ -51,8 +51,8 @@ ol.Sphere = function(radius) {
* @return {number} Area.
* @api
*/
ol.Sphere.prototype.geodesicArea = function(coordinates) {
return ol.Sphere.getArea_(coordinates, this.radius);
_ol_Sphere_.prototype.geodesicArea = function(coordinates) {
return _ol_Sphere_.getArea_(coordinates, this.radius);
};
@@ -64,8 +64,8 @@ ol.Sphere.prototype.geodesicArea = function(coordinates) {
* @return {number} Haversine distance.
* @api
*/
ol.Sphere.prototype.haversineDistance = function(c1, c2) {
return ol.Sphere.getDistance_(c1, c2, this.radius);
_ol_Sphere_.prototype.haversineDistance = function(c1, c2) {
return _ol_Sphere_.getDistance_(c1, c2, this.radius);
};
@@ -78,9 +78,9 @@ ol.Sphere.prototype.haversineDistance = function(c1, c2) {
* @param {number} bearing The bearing (in radians).
* @return {ol.Coordinate} The target point.
*/
ol.Sphere.prototype.offset = function(c1, distance, bearing) {
var lat1 = ol.math.toRadians(c1[1]);
var lon1 = ol.math.toRadians(c1[0]);
_ol_Sphere_.prototype.offset = function(c1, distance, bearing) {
var lat1 = _ol_math_.toRadians(c1[1]);
var lon1 = _ol_math_.toRadians(c1[0]);
var dByR = distance / this.radius;
var lat = Math.asin(
Math.sin(lat1) * Math.cos(dByR) +
@@ -88,7 +88,7 @@ ol.Sphere.prototype.offset = function(c1, distance, bearing) {
var lon = lon1 + Math.atan2(
Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat));
return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)];
return [_ol_math_.toDegrees(lon), _ol_math_.toDegrees(lat)];
};
@@ -97,7 +97,7 @@ ol.Sphere.prototype.offset = function(c1, distance, bearing) {
* https://en.wikipedia.org/wiki/Earth_radius#Mean_radius
* @type {number}
*/
ol.Sphere.DEFAULT_RADIUS = 6371008.8;
_ol_Sphere_.DEFAULT_RADIUS = 6371008.8;
/**
@@ -112,47 +112,47 @@ ol.Sphere.DEFAULT_RADIUS = 6371008.8;
* @return {number} The spherical length (in meters).
* @api
*/
ol.Sphere.getLength = function(geometry, opt_options) {
_ol_Sphere_.getLength = function(geometry, opt_options) {
var options = opt_options || {};
var radius = options.radius || ol.Sphere.DEFAULT_RADIUS;
var radius = options.radius || _ol_Sphere_.DEFAULT_RADIUS;
var projection = options.projection || 'EPSG:3857';
geometry = geometry.clone().transform(projection, 'EPSG:4326');
var type = geometry.getType();
var length = 0;
var coordinates, coords, i, ii, j, jj;
switch (type) {
case ol.geom.GeometryType.POINT:
case ol.geom.GeometryType.MULTI_POINT: {
case _ol_geom_GeometryType_.POINT:
case _ol_geom_GeometryType_.MULTI_POINT: {
break;
}
case ol.geom.GeometryType.LINE_STRING:
case ol.geom.GeometryType.LINEAR_RING: {
case _ol_geom_GeometryType_.LINE_STRING:
case _ol_geom_GeometryType_.LINEAR_RING: {
coordinates = /** @type {ol.geom.SimpleGeometry} */ (geometry).getCoordinates();
length = ol.Sphere.getLength_(coordinates, radius);
length = _ol_Sphere_.getLength_(coordinates, radius);
break;
}
case ol.geom.GeometryType.MULTI_LINE_STRING:
case ol.geom.GeometryType.POLYGON: {
case _ol_geom_GeometryType_.MULTI_LINE_STRING:
case _ol_geom_GeometryType_.POLYGON: {
coordinates = /** @type {ol.geom.SimpleGeometry} */ (geometry).getCoordinates();
for (i = 0, ii = coordinates.length; i < ii; ++i) {
length += ol.Sphere.getLength_(coordinates[i], radius);
length += _ol_Sphere_.getLength_(coordinates[i], radius);
}
break;
}
case ol.geom.GeometryType.MULTI_POLYGON: {
case _ol_geom_GeometryType_.MULTI_POLYGON: {
coordinates = /** @type {ol.geom.SimpleGeometry} */ (geometry).getCoordinates();
for (i = 0, ii = coordinates.length; i < ii; ++i) {
coords = coordinates[i];
for (j = 0, jj = coords.length; j < jj; ++j) {
length += ol.Sphere.getLength_(coords[j], radius);
length += _ol_Sphere_.getLength_(coords[j], radius);
}
}
break;
}
case ol.geom.GeometryType.GEOMETRY_COLLECTION: {
case _ol_geom_GeometryType_.GEOMETRY_COLLECTION: {
var geometries = /** @type {ol.geom.GeometryCollection} */ (geometry).getGeometries();
for (i = 0, ii = geometries.length; i < ii; ++i) {
length += ol.Sphere.getLength(geometries[i], opt_options);
length += _ol_Sphere_.getLength(geometries[i], opt_options);
}
break;
}
@@ -170,10 +170,10 @@ ol.Sphere.getLength = function(geometry, opt_options) {
* @param {number} radius The sphere radius to use.
* @return {number} The length (in meters).
*/
ol.Sphere.getLength_ = function(coordinates, radius) {
_ol_Sphere_.getLength_ = function(coordinates, radius) {
var length = 0;
for (var i = 0, ii = coordinates.length; i < ii - 1; ++i) {
length += ol.Sphere.getDistance_(coordinates[i], coordinates[i + 1], radius);
length += _ol_Sphere_.getDistance_(coordinates[i], coordinates[i + 1], radius);
}
return length;
};
@@ -186,11 +186,11 @@ ol.Sphere.getLength_ = function(coordinates, radius) {
* @param {number} radius The sphere radius to use.
* @return {number} The great circle distance between the points (in meters).
*/
ol.Sphere.getDistance_ = function(c1, c2, radius) {
var lat1 = ol.math.toRadians(c1[1]);
var lat2 = ol.math.toRadians(c2[1]);
_ol_Sphere_.getDistance_ = function(c1, c2, radius) {
var lat1 = _ol_math_.toRadians(c1[1]);
var lat2 = _ol_math_.toRadians(c2[1]);
var deltaLatBy2 = (lat2 - lat1) / 2;
var deltaLonBy2 = ol.math.toRadians(c2[0] - c1[0]) / 2;
var deltaLonBy2 = _ol_math_.toRadians(c2[0] - c1[0]) / 2;
var a = Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) +
Math.sin(deltaLonBy2) * Math.sin(deltaLonBy2) *
Math.cos(lat1) * Math.cos(lat2);
@@ -208,45 +208,45 @@ ol.Sphere.getDistance_ = function(c1, c2, radius) {
* @return {number} The spherical area (in square meters).
* @api
*/
ol.Sphere.getArea = function(geometry, opt_options) {
_ol_Sphere_.getArea = function(geometry, opt_options) {
var options = opt_options || {};
var radius = options.radius || ol.Sphere.DEFAULT_RADIUS;
var radius = options.radius || _ol_Sphere_.DEFAULT_RADIUS;
var projection = options.projection || 'EPSG:3857';
geometry = geometry.clone().transform(projection, 'EPSG:4326');
var type = geometry.getType();
var area = 0;
var coordinates, coords, i, ii, j, jj;
switch (type) {
case ol.geom.GeometryType.POINT:
case ol.geom.GeometryType.MULTI_POINT:
case ol.geom.GeometryType.LINE_STRING:
case ol.geom.GeometryType.MULTI_LINE_STRING:
case ol.geom.GeometryType.LINEAR_RING: {
case _ol_geom_GeometryType_.POINT:
case _ol_geom_GeometryType_.MULTI_POINT:
case _ol_geom_GeometryType_.LINE_STRING:
case _ol_geom_GeometryType_.MULTI_LINE_STRING:
case _ol_geom_GeometryType_.LINEAR_RING: {
break;
}
case ol.geom.GeometryType.POLYGON: {
case _ol_geom_GeometryType_.POLYGON: {
coordinates = /** @type {ol.geom.Polygon} */ (geometry).getCoordinates();
area = Math.abs(ol.Sphere.getArea_(coordinates[0], radius));
area = Math.abs(_ol_Sphere_.getArea_(coordinates[0], radius));
for (i = 1, ii = coordinates.length; i < ii; ++i) {
area -= Math.abs(ol.Sphere.getArea_(coordinates[i], radius));
area -= Math.abs(_ol_Sphere_.getArea_(coordinates[i], radius));
}
break;
}
case ol.geom.GeometryType.MULTI_POLYGON: {
case _ol_geom_GeometryType_.MULTI_POLYGON: {
coordinates = /** @type {ol.geom.SimpleGeometry} */ (geometry).getCoordinates();
for (i = 0, ii = coordinates.length; i < ii; ++i) {
coords = coordinates[i];
area += Math.abs(ol.Sphere.getArea_(coords[0], radius));
area += Math.abs(_ol_Sphere_.getArea_(coords[0], radius));
for (j = 1, jj = coords.length; j < jj; ++j) {
area -= Math.abs(ol.Sphere.getArea_(coords[j], radius));
area -= Math.abs(_ol_Sphere_.getArea_(coords[j], radius));
}
}
break;
}
case ol.geom.GeometryType.GEOMETRY_COLLECTION: {
case _ol_geom_GeometryType_.GEOMETRY_COLLECTION: {
var geometries = /** @type {ol.geom.GeometryCollection} */ (geometry).getGeometries();
for (i = 0, ii = geometries.length; i < ii; ++i) {
area += ol.Sphere.getArea(geometries[i], opt_options);
area += _ol_Sphere_.getArea(geometries[i], opt_options);
}
break;
}
@@ -272,17 +272,18 @@ ol.Sphere.getArea = function(geometry, opt_options) {
* @param {number} radius The sphere radius.
* @return {number} Area (in square meters).
*/
ol.Sphere.getArea_ = function(coordinates, radius) {
_ol_Sphere_.getArea_ = function(coordinates, radius) {
var area = 0, len = coordinates.length;
var x1 = coordinates[len - 1][0];
var y1 = coordinates[len - 1][1];
for (var i = 0; i < len; i++) {
var x2 = coordinates[i][0], y2 = coordinates[i][1];
area += ol.math.toRadians(x2 - x1) *
(2 + Math.sin(ol.math.toRadians(y1)) +
Math.sin(ol.math.toRadians(y2)));
area += _ol_math_.toRadians(x2 - x1) *
(2 + Math.sin(_ol_math_.toRadians(y1)) +
Math.sin(_ol_math_.toRadians(y2)));
x1 = x2;
y1 = y2;
}
return area * radius * radius / 2.0;
};
export default _ol_Sphere_;

View File

@@ -1,11 +1,11 @@
goog.provide('ol.Tile');
goog.require('ol');
goog.require('ol.TileState');
goog.require('ol.easing');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
/**
* @module ol/Tile
*/
import _ol_ from './index.js';
import _ol_TileState_ from './TileState.js';
import _ol_easing_ from './easing.js';
import _ol_events_EventTarget_ from './events/EventTarget.js';
import _ol_events_EventType_ from './events/EventType.js';
/**
* @classdesc
@@ -18,8 +18,8 @@ goog.require('ol.events.EventType');
* @param {ol.TileState} state State.
* @param {olx.TileOptions=} opt_options Tile options.
*/
ol.Tile = function(tileCoord, state, opt_options) {
ol.events.EventTarget.call(this);
var _ol_Tile_ = function(tileCoord, state, opt_options) {
_ol_events_EventTarget_.call(this);
var options = opt_options ? opt_options : {};
@@ -65,21 +65,22 @@ ol.Tile = function(tileCoord, state, opt_options) {
this.transitionStarts_ = {};
};
ol.inherits(ol.Tile, ol.events.EventTarget);
_ol_.inherits(_ol_Tile_, _ol_events_EventTarget_);
/**
* @protected
*/
ol.Tile.prototype.changed = function() {
this.dispatchEvent(ol.events.EventType.CHANGE);
_ol_Tile_.prototype.changed = function() {
this.dispatchEvent(_ol_events_EventType_.CHANGE);
};
/**
* @return {string} Key.
*/
ol.Tile.prototype.getKey = function() {
_ol_Tile_.prototype.getKey = function() {
return this.key + '/' + this.tileCoord;
};
@@ -89,7 +90,7 @@ ol.Tile.prototype.getKey = function() {
* such tile exists, the original tile is returned.
* @return {!ol.Tile} Best tile for rendering.
*/
ol.Tile.prototype.getInterimTile = function() {
_ol_Tile_.prototype.getInterimTile = function() {
if (!this.interimTile) {
//empty chain
return this;
@@ -101,7 +102,7 @@ ol.Tile.prototype.getInterimTile = function() {
// of the list (all those tiles correspond to older requests and will be
// cleaned up by refreshInterimChain)
do {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == _ol_TileState_.LOADED) {
return tile;
}
tile = tile.interimTile;
@@ -115,7 +116,7 @@ ol.Tile.prototype.getInterimTile = function() {
* Goes through the chain of interim tiles and discards sections of the chain
* that are no longer relevant.
*/
ol.Tile.prototype.refreshInterimChain = function() {
_ol_Tile_.prototype.refreshInterimChain = function() {
if (!this.interimTile) {
return;
}
@@ -124,17 +125,17 @@ ol.Tile.prototype.refreshInterimChain = function() {
var prev = this;
do {
if (tile.getState() == ol.TileState.LOADED) {
if (tile.getState() == _ol_TileState_.LOADED) {
//we have a loaded tile, we can discard the rest of the list
//we would could abort any LOADING tile request
//older than this tile (i.e. any LOADING tile following this entry in the chain)
tile.interimTile = null;
break;
} else if (tile.getState() == ol.TileState.LOADING) {
} else if (tile.getState() == _ol_TileState_.LOADING) {
//keep this LOADING tile any loaded tiles later in the chain are
//older than this tile, so we're still interested in the request
prev = tile;
} else if (tile.getState() == ol.TileState.IDLE) {
} else if (tile.getState() == _ol_TileState_.IDLE) {
//the head of the list is the most current tile, we don't need
//to start any other requests for this chain
prev.interimTile = tile.interimTile;
@@ -150,7 +151,7 @@ ol.Tile.prototype.refreshInterimChain = function() {
* @return {ol.TileCoord} The tile coordinate.
* @api
*/
ol.Tile.prototype.getTileCoord = function() {
_ol_Tile_.prototype.getTileCoord = function() {
return this.tileCoord;
};
@@ -158,14 +159,14 @@ ol.Tile.prototype.getTileCoord = function() {
/**
* @return {ol.TileState} State.
*/
ol.Tile.prototype.getState = function() {
_ol_Tile_.prototype.getState = function() {
return this.state;
};
/**
* @param {ol.TileState} state State.
*/
ol.Tile.prototype.setState = function(state) {
_ol_Tile_.prototype.setState = function(state) {
this.state = state;
this.changed();
};
@@ -177,7 +178,7 @@ ol.Tile.prototype.setState = function(state) {
* @abstract
* @api
*/
ol.Tile.prototype.load = function() {};
_ol_Tile_.prototype.load = function() {};
/**
* Get the alpha value for rendering.
@@ -185,7 +186,7 @@ ol.Tile.prototype.load = function() {};
* @param {number} time The render frame time.
* @return {number} A number between 0 and 1.
*/
ol.Tile.prototype.getAlpha = function(id, time) {
_ol_Tile_.prototype.getAlpha = function(id, time) {
if (!this.transition_) {
return 1;
}
@@ -202,7 +203,7 @@ ol.Tile.prototype.getAlpha = function(id, time) {
if (delta >= this.transition_) {
return 1;
}
return ol.easing.easeIn(delta / this.transition_);
return _ol_easing_.easeIn(delta / this.transition_);
};
/**
@@ -212,7 +213,7 @@ ol.Tile.prototype.getAlpha = function(id, time) {
* @param {number} id An id for the renderer.
* @return {boolean} The tile is in transition.
*/
ol.Tile.prototype.inTransition = function(id) {
_ol_Tile_.prototype.inTransition = function(id) {
if (!this.transition_) {
return false;
}
@@ -223,8 +224,9 @@ ol.Tile.prototype.inTransition = function(id) {
* Mark a transition as complete.
* @param {number} id An id for the renderer.
*/
ol.Tile.prototype.endTransition = function(id) {
_ol_Tile_.prototype.endTransition = function(id) {
if (this.transition_) {
this.transitionStarts_[id] = -1;
}
};
export default _ol_Tile_;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.TileCache');
goog.require('ol');
goog.require('ol.structs.LRUCache');
goog.require('ol.tilecoord');
/**
* @module ol/TileCache
*/
import _ol_ from './index.js';
import _ol_structs_LRUCache_ from './structs/LRUCache.js';
import _ol_tilecoord_ from './tilecoord.js';
/**
* @constructor
@@ -11,18 +11,19 @@ goog.require('ol.tilecoord');
* @param {number=} opt_highWaterMark High water mark.
* @struct
*/
ol.TileCache = function(opt_highWaterMark) {
var _ol_TileCache_ = function(opt_highWaterMark) {
ol.structs.LRUCache.call(this, opt_highWaterMark);
_ol_structs_LRUCache_.call(this, opt_highWaterMark);
};
ol.inherits(ol.TileCache, ol.structs.LRUCache);
_ol_.inherits(_ol_TileCache_, _ol_structs_LRUCache_);
/**
* @param {Object.<string, ol.TileRange>} usedTiles Used tiles.
*/
ol.TileCache.prototype.expireCache = function(usedTiles) {
_ol_TileCache_.prototype.expireCache = function(usedTiles) {
var tile, zKey;
while (this.canExpireCache()) {
tile = this.peekLast();
@@ -39,17 +40,18 @@ ol.TileCache.prototype.expireCache = function(usedTiles) {
/**
* Prune all tiles from the cache that don't have the same z as the newest tile.
*/
ol.TileCache.prototype.pruneExceptNewestZ = function() {
_ol_TileCache_.prototype.pruneExceptNewestZ = function() {
if (this.getCount() === 0) {
return;
}
var key = this.peekFirstKey();
var tileCoord = ol.tilecoord.fromKey(key);
var tileCoord = _ol_tilecoord_.fromKey(key);
var z = tileCoord[0];
this.forEach(function(tile) {
if (tile.tileCoord[0] !== z) {
this.remove(ol.tilecoord.getKey(tile.tileCoord));
this.remove(_ol_tilecoord_.getKey(tile.tileCoord));
tile.dispose();
}
}, this);
};
export default _ol_TileCache_;

View File

@@ -1,11 +1,11 @@
goog.provide('ol.TileQueue');
goog.require('ol');
goog.require('ol.TileState');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.structs.PriorityQueue');
/**
* @module ol/TileQueue
*/
import _ol_ from './index.js';
import _ol_TileState_ from './TileState.js';
import _ol_events_ from './events.js';
import _ol_events_EventType_ from './events/EventType.js';
import _ol_structs_PriorityQueue_ from './structs/PriorityQueue.js';
/**
* @constructor
@@ -16,9 +16,9 @@ goog.require('ol.structs.PriorityQueue');
* Function called on each tile change event.
* @struct
*/
ol.TileQueue = function(tilePriorityFunction, tileChangeCallback) {
var _ol_TileQueue_ = function(tilePriorityFunction, tileChangeCallback) {
ol.structs.PriorityQueue.call(
_ol_structs_PriorityQueue_.call(
this,
/**
* @param {Array} element Element.
@@ -54,17 +54,18 @@ ol.TileQueue = function(tilePriorityFunction, tileChangeCallback) {
this.tilesLoadingKeys_ = {};
};
ol.inherits(ol.TileQueue, ol.structs.PriorityQueue);
_ol_.inherits(_ol_TileQueue_, _ol_structs_PriorityQueue_);
/**
* @inheritDoc
*/
ol.TileQueue.prototype.enqueue = function(element) {
var added = ol.structs.PriorityQueue.prototype.enqueue.call(this, element);
_ol_TileQueue_.prototype.enqueue = function(element) {
var added = _ol_structs_PriorityQueue_.prototype.enqueue.call(this, element);
if (added) {
var tile = element[0];
ol.events.listen(tile, ol.events.EventType.CHANGE,
_ol_events_.listen(tile, _ol_events_EventType_.CHANGE,
this.handleTileChange, this);
}
return added;
@@ -74,7 +75,7 @@ ol.TileQueue.prototype.enqueue = function(element) {
/**
* @return {number} Number of tiles loading.
*/
ol.TileQueue.prototype.getTilesLoading = function() {
_ol_TileQueue_.prototype.getTilesLoading = function() {
return this.tilesLoading_;
};
@@ -83,12 +84,12 @@ ol.TileQueue.prototype.getTilesLoading = function() {
* @param {ol.events.Event} event Event.
* @protected
*/
ol.TileQueue.prototype.handleTileChange = function(event) {
_ol_TileQueue_.prototype.handleTileChange = function(event) {
var tile = /** @type {ol.Tile} */ (event.target);
var state = tile.getState();
if (state === ol.TileState.LOADED || state === ol.TileState.ERROR ||
state === ol.TileState.EMPTY || state === ol.TileState.ABORT) {
ol.events.unlisten(tile, ol.events.EventType.CHANGE,
if (state === _ol_TileState_.LOADED || state === _ol_TileState_.ERROR ||
state === _ol_TileState_.EMPTY || state === _ol_TileState_.ABORT) {
_ol_events_.unlisten(tile, _ol_events_EventType_.CHANGE,
this.handleTileChange, this);
var tileKey = tile.getKey();
if (tileKey in this.tilesLoadingKeys_) {
@@ -104,7 +105,7 @@ ol.TileQueue.prototype.handleTileChange = function(event) {
* @param {number} maxTotalLoading Maximum number tiles to load simultaneously.
* @param {number} maxNewLoads Maximum number of new tiles to load.
*/
ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
_ol_TileQueue_.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
var newLoads = 0;
var abortedTiles = false;
var state, tile, tileKey;
@@ -113,9 +114,9 @@ ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
tile = /** @type {ol.Tile} */ (this.dequeue()[0]);
tileKey = tile.getKey();
state = tile.getState();
if (state === ol.TileState.ABORT) {
if (state === _ol_TileState_.ABORT) {
abortedTiles = true;
} else if (state === ol.TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
} else if (state === _ol_TileState_.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
this.tilesLoadingKeys_[tileKey] = true;
++this.tilesLoading_;
++newLoads;
@@ -128,3 +129,4 @@ ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
this.tileChangeCallback_();
}
};
export default _ol_TileQueue_;

View File

@@ -1,6 +1,6 @@
goog.provide('ol.TileRange');
/**
* @module ol/TileRange
*/
/**
* A representation of a contiguous block of tiles. A tile range is specified
* by its min/max tile coordinates and is inclusive of coordinates.
@@ -12,7 +12,7 @@ goog.provide('ol.TileRange');
* @param {number} maxY Maximum Y.
* @struct
*/
ol.TileRange = function(minX, maxX, minY, maxY) {
var _ol_TileRange_ = function(minX, maxX, minY, maxY) {
/**
* @type {number}
@@ -45,7 +45,7 @@ ol.TileRange = function(minX, maxX, minY, maxY) {
* @param {ol.TileRange|undefined} tileRange TileRange.
* @return {ol.TileRange} Tile range.
*/
ol.TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
_ol_TileRange_.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
if (tileRange !== undefined) {
tileRange.minX = minX;
tileRange.maxX = maxX;
@@ -53,7 +53,7 @@ ol.TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
tileRange.maxY = maxY;
return tileRange;
} else {
return new ol.TileRange(minX, maxX, minY, maxY);
return new _ol_TileRange_(minX, maxX, minY, maxY);
}
};
@@ -62,7 +62,7 @@ ol.TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @return {boolean} Contains tile coordinate.
*/
ol.TileRange.prototype.contains = function(tileCoord) {
_ol_TileRange_.prototype.contains = function(tileCoord) {
return this.containsXY(tileCoord[1], tileCoord[2]);
};
@@ -71,7 +71,7 @@ ol.TileRange.prototype.contains = function(tileCoord) {
* @param {ol.TileRange} tileRange Tile range.
* @return {boolean} Contains.
*/
ol.TileRange.prototype.containsTileRange = function(tileRange) {
_ol_TileRange_.prototype.containsTileRange = function(tileRange) {
return this.minX <= tileRange.minX && tileRange.maxX <= this.maxX &&
this.minY <= tileRange.minY && tileRange.maxY <= this.maxY;
};
@@ -82,7 +82,7 @@ ol.TileRange.prototype.containsTileRange = function(tileRange) {
* @param {number} y Tile coordinate y.
* @return {boolean} Contains coordinate.
*/
ol.TileRange.prototype.containsXY = function(x, y) {
_ol_TileRange_.prototype.containsXY = function(x, y) {
return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY;
};
@@ -91,7 +91,7 @@ ol.TileRange.prototype.containsXY = function(x, y) {
* @param {ol.TileRange} tileRange Tile range.
* @return {boolean} Equals.
*/
ol.TileRange.prototype.equals = function(tileRange) {
_ol_TileRange_.prototype.equals = function(tileRange) {
return this.minX == tileRange.minX && this.minY == tileRange.minY &&
this.maxX == tileRange.maxX && this.maxY == tileRange.maxY;
};
@@ -100,7 +100,7 @@ ol.TileRange.prototype.equals = function(tileRange) {
/**
* @param {ol.TileRange} tileRange Tile range.
*/
ol.TileRange.prototype.extend = function(tileRange) {
_ol_TileRange_.prototype.extend = function(tileRange) {
if (tileRange.minX < this.minX) {
this.minX = tileRange.minX;
}
@@ -119,7 +119,7 @@ ol.TileRange.prototype.extend = function(tileRange) {
/**
* @return {number} Height.
*/
ol.TileRange.prototype.getHeight = function() {
_ol_TileRange_.prototype.getHeight = function() {
return this.maxY - this.minY + 1;
};
@@ -127,7 +127,7 @@ ol.TileRange.prototype.getHeight = function() {
/**
* @return {ol.Size} Size.
*/
ol.TileRange.prototype.getSize = function() {
_ol_TileRange_.prototype.getSize = function() {
return [this.getWidth(), this.getHeight()];
};
@@ -135,7 +135,7 @@ ol.TileRange.prototype.getSize = function() {
/**
* @return {number} Width.
*/
ol.TileRange.prototype.getWidth = function() {
_ol_TileRange_.prototype.getWidth = function() {
return this.maxX - this.minX + 1;
};
@@ -144,9 +144,10 @@ ol.TileRange.prototype.getWidth = function() {
* @param {ol.TileRange} tileRange Tile range.
* @return {boolean} Intersects.
*/
ol.TileRange.prototype.intersects = function(tileRange) {
_ol_TileRange_.prototype.intersects = function(tileRange) {
return this.minX <= tileRange.maxX &&
this.maxX >= tileRange.minX &&
this.minY <= tileRange.maxY &&
this.maxY >= tileRange.minY;
};
export default _ol_TileRange_;

View File

@@ -1,9 +1,10 @@
goog.provide('ol.TileState');
/**
* @module ol/TileState
*/
/**
* @enum {number}
*/
ol.TileState = {
var _ol_TileState_ = {
IDLE: 0,
LOADING: 1,
LOADED: 2,
@@ -11,3 +12,5 @@ ol.TileState = {
EMPTY: 4,
ABORT: 5
};
export default _ol_TileState_;

View File

@@ -1,8 +1,10 @@
goog.provide('ol.TileUrlFunction');
goog.require('ol.asserts');
goog.require('ol.math');
goog.require('ol.tilecoord');
/**
* @module ol/TileUrlFunction
*/
import _ol_asserts_ from './asserts.js';
import _ol_math_ from './math.js';
import _ol_tilecoord_ from './tilecoord.js';
var _ol_TileUrlFunction_ = {};
/**
@@ -10,7 +12,7 @@ goog.require('ol.tilecoord');
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid.
* @return {ol.TileUrlFunctionType} Tile URL function.
*/
ol.TileUrlFunction.createFromTemplate = function(template, tileGrid) {
_ol_TileUrlFunction_.createFromTemplate = function(template, tileGrid) {
var zRegEx = /\{z\}/g;
var xRegEx = /\{x\}/g;
var yRegEx = /\{y\}/g;
@@ -35,12 +37,13 @@ ol.TileUrlFunction.createFromTemplate = function(template, tileGrid) {
.replace(dashYRegEx, function() {
var z = tileCoord[0];
var range = tileGrid.getFullTileRange(z);
ol.asserts.assert(range, 55); // The {-y} placeholder requires a tile grid with extent
_ol_asserts_.assert(range, 55); // The {-y} placeholder requires a tile grid with extent
var y = range.getHeight() + tileCoord[2];
return y.toString();
});
}
});
}
);
};
@@ -49,14 +52,14 @@ ol.TileUrlFunction.createFromTemplate = function(template, tileGrid) {
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid.
* @return {ol.TileUrlFunctionType} Tile URL function.
*/
ol.TileUrlFunction.createFromTemplates = function(templates, tileGrid) {
_ol_TileUrlFunction_.createFromTemplates = function(templates, tileGrid) {
var len = templates.length;
var tileUrlFunctions = new Array(len);
for (var i = 0; i < len; ++i) {
tileUrlFunctions[i] = ol.TileUrlFunction.createFromTemplate(
tileUrlFunctions[i] = _ol_TileUrlFunction_.createFromTemplate(
templates[i], tileGrid);
}
return ol.TileUrlFunction.createFromTileUrlFunctions(tileUrlFunctions);
return _ol_TileUrlFunction_.createFromTileUrlFunctions(tileUrlFunctions);
};
@@ -64,7 +67,7 @@ ol.TileUrlFunction.createFromTemplates = function(templates, tileGrid) {
* @param {Array.<ol.TileUrlFunctionType>} tileUrlFunctions Tile URL Functions.
* @return {ol.TileUrlFunctionType} Tile URL function.
*/
ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) {
_ol_TileUrlFunction_.createFromTileUrlFunctions = function(tileUrlFunctions) {
if (tileUrlFunctions.length === 1) {
return tileUrlFunctions[0];
}
@@ -79,11 +82,12 @@ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) {
if (!tileCoord) {
return undefined;
} else {
var h = ol.tilecoord.hash(tileCoord);
var index = ol.math.modulo(h, tileUrlFunctions.length);
var h = _ol_tilecoord_.hash(tileCoord);
var index = _ol_math_.modulo(h, tileUrlFunctions.length);
return tileUrlFunctions[index](tileCoord, pixelRatio, projection);
}
});
}
);
};
@@ -93,7 +97,7 @@ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) {
* @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL.
*/
ol.TileUrlFunction.nullTileUrlFunction = function(tileCoord, pixelRatio, projection) {
_ol_TileUrlFunction_.nullTileUrlFunction = function(tileCoord, pixelRatio, projection) {
return undefined;
};
@@ -102,7 +106,7 @@ ol.TileUrlFunction.nullTileUrlFunction = function(tileCoord, pixelRatio, project
* @param {string} url URL.
* @return {Array.<string>} Array of urls.
*/
ol.TileUrlFunction.expandUrl = function(url) {
_ol_TileUrlFunction_.expandUrl = function(url) {
var urls = [];
var match = /\{([a-z])-([a-z])\}/.exec(url);
if (match) {
@@ -127,3 +131,4 @@ ol.TileUrlFunction.expandUrl = function(url) {
urls.push(url);
return urls;
};
export default _ol_TileUrlFunction_;

View File

@@ -1,14 +1,14 @@
goog.provide('ol.VectorImageTile');
goog.require('ol');
goog.require('ol.Tile');
goog.require('ol.TileState');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.extent');
goog.require('ol.events.EventType');
goog.require('ol.featureloader');
/**
* @module ol/VectorImageTile
*/
import _ol_ from './index.js';
import _ol_Tile_ from './Tile.js';
import _ol_TileState_ from './TileState.js';
import _ol_dom_ from './dom.js';
import _ol_events_ from './events.js';
import _ol_extent_ from './extent.js';
import _ol_events_EventType_ from './events/EventType.js';
import _ol_featureloader_ from './featureloader.js';
/**
* @constructor
@@ -32,11 +32,11 @@ goog.require('ol.featureloader');
* Function to call when a source tile's state changes.
* @param {olx.TileOptions=} opt_options Tile options.
*/
ol.VectorImageTile = function(tileCoord, state, sourceRevision, format,
var _ol_VectorImageTile_ = function(tileCoord, state, sourceRevision, format,
tileLoadFunction, urlTileCoord, tileUrlFunction, sourceTileGrid, tileGrid,
sourceTiles, pixelRatio, projection, tileClass, handleTileChange, opt_options) {
ol.Tile.call(this, tileCoord, state, opt_options);
_ol_Tile_.call(this, tileCoord, state, opt_options);
/**
* @private
@@ -93,25 +93,25 @@ ol.VectorImageTile = function(tileCoord, state, sourceRevision, format,
var resolution = tileGrid.getResolution(tileCoord[0]);
var sourceZ = sourceTileGrid.getZForResolution(resolution);
sourceTileGrid.forEachTileCoord(extent, sourceZ, function(sourceTileCoord) {
var sharedExtent = ol.extent.getIntersection(extent,
var sharedExtent = _ol_extent_.getIntersection(extent,
sourceTileGrid.getTileCoordExtent(sourceTileCoord));
var sourceExtent = sourceTileGrid.getExtent();
if (sourceExtent) {
sharedExtent = ol.extent.getIntersection(sharedExtent, sourceExtent);
sharedExtent = _ol_extent_.getIntersection(sharedExtent, sourceExtent);
}
if (ol.extent.getWidth(sharedExtent) / resolution >= 0.5 &&
ol.extent.getHeight(sharedExtent) / resolution >= 0.5) {
if (_ol_extent_.getWidth(sharedExtent) / resolution >= 0.5 &&
_ol_extent_.getHeight(sharedExtent) / resolution >= 0.5) {
// only include source tile if overlap is at least 1 pixel
var sourceTileKey = sourceTileCoord.toString();
var sourceTile = sourceTiles[sourceTileKey];
if (!sourceTile) {
var tileUrl = tileUrlFunction(sourceTileCoord, pixelRatio, projection);
sourceTile = sourceTiles[sourceTileKey] = new tileClass(sourceTileCoord,
tileUrl == undefined ? ol.TileState.EMPTY : ol.TileState.IDLE,
tileUrl == undefined ? _ol_TileState_.EMPTY : _ol_TileState_.IDLE,
tileUrl == undefined ? '' : tileUrl,
format, tileLoadFunction);
this.sourceTileListenerKeys_.push(
ol.events.listen(sourceTile, ol.events.EventType.CHANGE, handleTileChange));
_ol_events_.listen(sourceTile, _ol_events_EventType_.CHANGE, handleTileChange));
}
sourceTile.consumers++;
this.tileKeys.push(sourceTileKey);
@@ -120,13 +120,14 @@ ol.VectorImageTile = function(tileCoord, state, sourceRevision, format,
}
};
ol.inherits(ol.VectorImageTile, ol.Tile);
_ol_.inherits(_ol_VectorImageTile_, _ol_Tile_);
/**
* @inheritDoc
*/
ol.VectorImageTile.prototype.disposeInternal = function() {
_ol_VectorImageTile_.prototype.disposeInternal = function() {
for (var i = 0, ii = this.tileKeys.length; i < ii; ++i) {
var sourceTileKey = this.tileKeys[i];
var sourceTile = this.getTile(sourceTileKey);
@@ -138,16 +139,16 @@ ol.VectorImageTile.prototype.disposeInternal = function() {
}
this.tileKeys.length = 0;
this.sourceTiles_ = null;
this.loadListenerKeys_.forEach(ol.events.unlistenByKey);
this.loadListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.loadListenerKeys_.length = 0;
if (this.interimTile) {
this.interimTile.dispose();
}
this.state = ol.TileState.ABORT;
this.state = _ol_TileState_.ABORT;
this.changed();
this.sourceTileListenerKeys_.forEach(ol.events.unlistenByKey);
this.sourceTileListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.sourceTileListenerKeys_.length = 0;
ol.Tile.prototype.disposeInternal.call(this);
_ol_Tile_.prototype.disposeInternal.call(this);
};
@@ -155,10 +156,10 @@ ol.VectorImageTile.prototype.disposeInternal = function() {
* @param {ol.layer.Layer} layer Layer.
* @return {CanvasRenderingContext2D} The rendering context.
*/
ol.VectorImageTile.prototype.getContext = function(layer) {
var key = ol.getUid(layer).toString();
_ol_VectorImageTile_.prototype.getContext = function(layer) {
var key = _ol_.getUid(layer).toString();
if (!(key in this.context_)) {
this.context_[key] = ol.dom.createCanvasContext2D();
this.context_[key] = _ol_dom_.createCanvasContext2D();
}
return this.context_[key];
};
@@ -169,7 +170,7 @@ ol.VectorImageTile.prototype.getContext = function(layer) {
* @param {ol.layer.Layer} layer Layer.
* @return {HTMLCanvasElement} Canvas.
*/
ol.VectorImageTile.prototype.getImage = function(layer) {
_ol_VectorImageTile_.prototype.getImage = function(layer) {
return this.getReplayState(layer).renderedTileRevision == -1 ?
null : this.getContext(layer).canvas;
};
@@ -179,8 +180,8 @@ ol.VectorImageTile.prototype.getImage = function(layer) {
* @param {ol.layer.Layer} layer Layer.
* @return {ol.TileReplayState} The replay state.
*/
ol.VectorImageTile.prototype.getReplayState = function(layer) {
var key = ol.getUid(layer).toString();
_ol_VectorImageTile_.prototype.getReplayState = function(layer) {
var key = _ol_.getUid(layer).toString();
if (!(key in this.replayState_)) {
this.replayState_[key] = {
dirty: false,
@@ -196,7 +197,7 @@ ol.VectorImageTile.prototype.getReplayState = function(layer) {
/**
* @inheritDoc
*/
ol.VectorImageTile.prototype.getKey = function() {
_ol_VectorImageTile_.prototype.getKey = function() {
return this.tileKeys.join('/') + '-' + this.sourceRevision_;
};
@@ -205,7 +206,7 @@ ol.VectorImageTile.prototype.getKey = function() {
* @param {string} tileKey Key (tileCoord) of the source tile.
* @return {ol.VectorTile} Source tile.
*/
ol.VectorImageTile.prototype.getTile = function(tileKey) {
_ol_VectorImageTile_.prototype.getTile = function(tileKey) {
return this.sourceTiles_[tileKey];
};
@@ -213,7 +214,7 @@ ol.VectorImageTile.prototype.getTile = function(tileKey) {
/**
* @inheritDoc
*/
ol.VectorImageTile.prototype.load = function() {
_ol_VectorImageTile_.prototype.load = function() {
// Source tiles with LOADED state - we just count them because once they are
// loaded, we're no longer listening to state changes.
var leftToLoad = 0;
@@ -221,23 +222,23 @@ ol.VectorImageTile.prototype.load = function() {
// an ERROR state after another load attempt.
var errorSourceTiles = {};
if (this.state == ol.TileState.IDLE) {
this.setState(ol.TileState.LOADING);
if (this.state == _ol_TileState_.IDLE) {
this.setState(_ol_TileState_.LOADING);
}
if (this.state == ol.TileState.LOADING) {
if (this.state == _ol_TileState_.LOADING) {
this.tileKeys.forEach(function(sourceTileKey) {
var sourceTile = this.getTile(sourceTileKey);
if (sourceTile.state == ol.TileState.IDLE) {
if (sourceTile.state == _ol_TileState_.IDLE) {
sourceTile.setLoader(this.loader_);
sourceTile.load();
}
if (sourceTile.state == ol.TileState.LOADING) {
var key = ol.events.listen(sourceTile, ol.events.EventType.CHANGE, function(e) {
if (sourceTile.state == _ol_TileState_.LOADING) {
var key = _ol_events_.listen(sourceTile, _ol_events_EventType_.CHANGE, function(e) {
var state = sourceTile.getState();
if (state == ol.TileState.LOADED ||
state == ol.TileState.ERROR) {
var uid = ol.getUid(sourceTile);
if (state == ol.TileState.ERROR) {
if (state == _ol_TileState_.LOADED ||
state == _ol_TileState_.ERROR) {
var uid = _ol_.getUid(sourceTile);
if (state == _ol_TileState_.ERROR) {
errorSourceTiles[uid] = true;
} else {
--leftToLoad;
@@ -262,24 +263,24 @@ ol.VectorImageTile.prototype.load = function() {
/**
* @private
*/
ol.VectorImageTile.prototype.finishLoading_ = function() {
_ol_VectorImageTile_.prototype.finishLoading_ = function() {
var loaded = this.tileKeys.length;
var empty = 0;
for (var i = loaded - 1; i >= 0; --i) {
var state = this.getTile(this.tileKeys[i]).getState();
if (state != ol.TileState.LOADED) {
if (state != _ol_TileState_.LOADED) {
--loaded;
}
if (state == ol.TileState.EMPTY) {
if (state == _ol_TileState_.EMPTY) {
++empty;
}
}
if (loaded == this.tileKeys.length) {
this.loadListenerKeys_.forEach(ol.events.unlistenByKey);
this.loadListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.loadListenerKeys_.length = 0;
this.setState(ol.TileState.LOADED);
this.setState(_ol_TileState_.LOADED);
} else {
this.setState(empty == this.tileKeys.length ? ol.TileState.EMPTY : ol.TileState.ERROR);
this.setState(empty == this.tileKeys.length ? _ol_TileState_.EMPTY : _ol_TileState_.ERROR);
}
};
@@ -289,9 +290,10 @@ ol.VectorImageTile.prototype.finishLoading_ = function() {
* @param {ol.VectorTile} tile Vector tile.
* @param {string} url URL.
*/
ol.VectorImageTile.defaultLoadFunction = function(tile, url) {
var loader = ol.featureloader.loadFeaturesXhr(
_ol_VectorImageTile_.defaultLoadFunction = function(tile, url) {
var loader = _ol_featureloader_.loadFeaturesXhr(
url, tile.getFormat(), tile.onLoad.bind(tile), tile.onError.bind(tile));
tile.setLoader(loader);
};
export default _ol_VectorImageTile_;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.VectorTile');
goog.require('ol');
goog.require('ol.Tile');
goog.require('ol.TileState');
/**
* @module ol/VectorTile
*/
import _ol_ from './index.js';
import _ol_Tile_ from './Tile.js';
import _ol_TileState_ from './TileState.js';
/**
* @constructor
@@ -15,9 +15,9 @@ goog.require('ol.TileState');
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
* @param {olx.TileOptions=} opt_options Tile options.
*/
ol.VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_options) {
var _ol_VectorTile_ = function(tileCoord, state, src, format, tileLoadFunction, opt_options) {
ol.Tile.call(this, tileCoord, state, opt_options);
_ol_Tile_.call(this, tileCoord, state, opt_options);
/**
* @type {number}
@@ -74,18 +74,19 @@ ol.VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_op
this.url_ = src;
};
ol.inherits(ol.VectorTile, ol.Tile);
_ol_.inherits(_ol_VectorTile_, _ol_Tile_);
/**
* @inheritDoc
*/
ol.VectorTile.prototype.disposeInternal = function() {
_ol_VectorTile_.prototype.disposeInternal = function() {
this.features_ = null;
this.replayGroups_ = {};
this.state = ol.TileState.ABORT;
this.state = _ol_TileState_.ABORT;
this.changed();
ol.Tile.prototype.disposeInternal.call(this);
_ol_Tile_.prototype.disposeInternal.call(this);
};
@@ -94,8 +95,8 @@ ol.VectorTile.prototype.disposeInternal = function() {
* @return {ol.Extent} The extent.
* @api
*/
ol.VectorTile.prototype.getExtent = function() {
return this.extent_ || ol.VectorTile.DEFAULT_EXTENT;
_ol_VectorTile_.prototype.getExtent = function() {
return this.extent_ || _ol_VectorTile_.DEFAULT_EXTENT;
};
@@ -104,7 +105,7 @@ ol.VectorTile.prototype.getExtent = function() {
* @return {ol.format.Feature} Feature format.
* @api
*/
ol.VectorTile.prototype.getFormat = function() {
_ol_VectorTile_.prototype.getFormat = function() {
return this.format_;
};
@@ -115,7 +116,7 @@ ol.VectorTile.prototype.getFormat = function() {
* @return {Array.<ol.Feature|ol.render.Feature>} Features.
* @api
*/
ol.VectorTile.prototype.getFeatures = function() {
_ol_VectorTile_.prototype.getFeatures = function() {
return this.features_;
};
@@ -123,7 +124,7 @@ ol.VectorTile.prototype.getFeatures = function() {
/**
* @inheritDoc
*/
ol.VectorTile.prototype.getKey = function() {
_ol_VectorTile_.prototype.getKey = function() {
return this.url_;
};
@@ -134,7 +135,7 @@ ol.VectorTile.prototype.getKey = function() {
* @return {ol.proj.Projection} Feature projection.
* @api
*/
ol.VectorTile.prototype.getProjection = function() {
_ol_VectorTile_.prototype.getProjection = function() {
return this.projection_;
};
@@ -144,17 +145,17 @@ ol.VectorTile.prototype.getProjection = function() {
* @param {string} key Key.
* @return {ol.render.ReplayGroup} Replay group.
*/
ol.VectorTile.prototype.getReplayGroup = function(layer, key) {
return this.replayGroups_[ol.getUid(layer) + ',' + key];
_ol_VectorTile_.prototype.getReplayGroup = function(layer, key) {
return this.replayGroups_[_ol_.getUid(layer) + ',' + key];
};
/**
* @inheritDoc
*/
ol.VectorTile.prototype.load = function() {
if (this.state == ol.TileState.IDLE) {
this.setState(ol.TileState.LOADING);
_ol_VectorTile_.prototype.load = function() {
if (this.state == _ol_TileState_.IDLE) {
this.setState(_ol_TileState_.LOADING);
this.tileLoadFunction_(this, this.url_);
this.loader_(null, NaN, null);
}
@@ -167,7 +168,7 @@ ol.VectorTile.prototype.load = function() {
* @param {ol.proj.Projection} dataProjection Data projection.
* @param {ol.Extent} extent Extent.
*/
ol.VectorTile.prototype.onLoad = function(features, dataProjection, extent) {
_ol_VectorTile_.prototype.onLoad = function(features, dataProjection, extent) {
this.setProjection(dataProjection);
this.setFeatures(features);
this.setExtent(extent);
@@ -177,8 +178,8 @@ ol.VectorTile.prototype.onLoad = function(features, dataProjection, extent) {
/**
* Handler for tile load errors.
*/
ol.VectorTile.prototype.onError = function() {
this.setState(ol.TileState.ERROR);
_ol_VectorTile_.prototype.onError = function() {
this.setState(_ol_TileState_.ERROR);
};
@@ -194,7 +195,7 @@ ol.VectorTile.prototype.onError = function() {
* @param {ol.Extent} extent The extent.
* @api
*/
ol.VectorTile.prototype.setExtent = function(extent) {
_ol_VectorTile_.prototype.setExtent = function(extent) {
this.extent_ = extent;
};
@@ -205,9 +206,9 @@ ol.VectorTile.prototype.setExtent = function(extent) {
* @param {Array.<ol.Feature>} features Features.
* @api
*/
ol.VectorTile.prototype.setFeatures = function(features) {
_ol_VectorTile_.prototype.setFeatures = function(features) {
this.features_ = features;
this.setState(ol.TileState.LOADED);
this.setState(_ol_TileState_.LOADED);
};
@@ -218,7 +219,7 @@ ol.VectorTile.prototype.setFeatures = function(features) {
* @param {ol.proj.Projection} projection Feature projection.
* @api
*/
ol.VectorTile.prototype.setProjection = function(projection) {
_ol_VectorTile_.prototype.setProjection = function(projection) {
this.projection_ = projection;
};
@@ -228,8 +229,8 @@ ol.VectorTile.prototype.setProjection = function(projection) {
* @param {string} key Key.
* @param {ol.render.ReplayGroup} replayGroup Replay group.
*/
ol.VectorTile.prototype.setReplayGroup = function(layer, key, replayGroup) {
this.replayGroups_[ol.getUid(layer) + ',' + key] = replayGroup;
_ol_VectorTile_.prototype.setReplayGroup = function(layer, key, replayGroup) {
this.replayGroups_[_ol_.getUid(layer) + ',' + key] = replayGroup;
};
@@ -238,7 +239,7 @@ ol.VectorTile.prototype.setReplayGroup = function(layer, key, replayGroup) {
* @param {ol.FeatureLoader} loader Feature loader.
* @api
*/
ol.VectorTile.prototype.setLoader = function(loader) {
_ol_VectorTile_.prototype.setLoader = function(loader) {
this.loader_ = loader;
};
@@ -247,4 +248,5 @@ ol.VectorTile.prototype.setLoader = function(loader) {
* @const
* @type {ol.Extent}
*/
ol.VectorTile.DEFAULT_EXTENT = [0, 0, 4096, 4096];
_ol_VectorTile_.DEFAULT_EXTENT = [0, 0, 4096, 4096];
export default _ol_VectorTile_;

View File

@@ -1,25 +1,25 @@
goog.provide('ol.View');
goog.require('ol');
goog.require('ol.CenterConstraint');
goog.require('ol.Object');
goog.require('ol.ResolutionConstraint');
goog.require('ol.RotationConstraint');
goog.require('ol.ViewHint');
goog.require('ol.ViewProperty');
goog.require('ol.array');
goog.require('ol.asserts');
goog.require('ol.coordinate');
goog.require('ol.easing');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.SimpleGeometry');
goog.require('ol.math');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.proj.Units');
/**
* @module ol/View
*/
import _ol_ from './index.js';
import _ol_CenterConstraint_ from './CenterConstraint.js';
import _ol_Object_ from './Object.js';
import _ol_ResolutionConstraint_ from './ResolutionConstraint.js';
import _ol_RotationConstraint_ from './RotationConstraint.js';
import _ol_ViewHint_ from './ViewHint.js';
import _ol_ViewProperty_ from './ViewProperty.js';
import _ol_array_ from './array.js';
import _ol_asserts_ from './asserts.js';
import _ol_coordinate_ from './coordinate.js';
import _ol_easing_ from './easing.js';
import _ol_extent_ from './extent.js';
import _ol_geom_GeometryType_ from './geom/GeometryType.js';
import _ol_geom_Polygon_ from './geom/Polygon.js';
import _ol_geom_SimpleGeometry_ from './geom/SimpleGeometry.js';
import _ol_math_ from './math.js';
import _ol_obj_ from './obj.js';
import _ol_proj_ from './proj.js';
import _ol_proj_Units_ from './proj/Units.js';
/**
* @classdesc
@@ -78,10 +78,10 @@ goog.require('ol.proj.Units');
* @param {olx.ViewOptions=} opt_options View options.
* @api
*/
ol.View = function(opt_options) {
ol.Object.call(this);
var _ol_View_ = function(opt_options) {
_ol_Object_.call(this);
var options = ol.obj.assign({}, opt_options);
var options = _ol_obj_.assign({}, opt_options);
/**
* @private
@@ -108,27 +108,28 @@ ol.View = function(opt_options) {
* @const
* @type {ol.proj.Projection}
*/
this.projection_ = ol.proj.createProjection(options.projection, 'EPSG:3857');
this.projection_ = _ol_proj_.createProjection(options.projection, 'EPSG:3857');
this.applyOptions_(options);
};
ol.inherits(ol.View, ol.Object);
_ol_.inherits(_ol_View_, _ol_Object_);
/**
* Set up the view with the given options.
* @param {olx.ViewOptions} options View options.
*/
ol.View.prototype.applyOptions_ = function(options) {
_ol_View_.prototype.applyOptions_ = function(options) {
/**
* @type {Object.<string, *>}
*/
var properties = {};
properties[ol.ViewProperty.CENTER] = options.center !== undefined ?
properties[_ol_ViewProperty_.CENTER] = options.center !== undefined ?
options.center : null;
var resolutionConstraintInfo = ol.View.createResolutionConstraint_(
var resolutionConstraintInfo = _ol_View_.createResolutionConstraint_(
options);
/**
@@ -161,9 +162,9 @@ ol.View.prototype.applyOptions_ = function(options) {
*/
this.minZoom_ = resolutionConstraintInfo.minZoom;
var centerConstraint = ol.View.createCenterConstraint_(options);
var centerConstraint = _ol_View_.createCenterConstraint_(options);
var resolutionConstraint = resolutionConstraintInfo.constraint;
var rotationConstraint = ol.View.createRotationConstraint_(options);
var rotationConstraint = _ol_View_.createRotationConstraint_(options);
/**
* @private
@@ -176,18 +177,18 @@ ol.View.prototype.applyOptions_ = function(options) {
};
if (options.resolution !== undefined) {
properties[ol.ViewProperty.RESOLUTION] = options.resolution;
properties[_ol_ViewProperty_.RESOLUTION] = options.resolution;
} else if (options.zoom !== undefined) {
properties[ol.ViewProperty.RESOLUTION] = this.constrainResolution(
properties[_ol_ViewProperty_.RESOLUTION] = this.constrainResolution(
this.maxResolution_, options.zoom - this.minZoom_);
if (this.resolutions_) { // in case map zoom is out of min/max zoom range
properties[ol.ViewProperty.RESOLUTION] = ol.math.clamp(
Number(this.getResolution() || properties[ol.ViewProperty.RESOLUTION]),
properties[_ol_ViewProperty_.RESOLUTION] = _ol_math_.clamp(
Number(this.getResolution() || properties[_ol_ViewProperty_.RESOLUTION]),
this.minResolution_, this.maxResolution_);
}
}
properties[ol.ViewProperty.ROTATION] =
properties[_ol_ViewProperty_.ROTATION] =
options.rotation !== undefined ? options.rotation : 0;
this.setProperties(properties);
@@ -207,8 +208,8 @@ ol.View.prototype.applyOptions_ = function(options) {
* @param {olx.ViewOptions} newOptions New options to be applied.
* @return {olx.ViewOptions} New options updated with the current view state.
*/
ol.View.prototype.getUpdatedOptions_ = function(newOptions) {
var options = ol.obj.assign({}, this.options_);
_ol_View_.prototype.getUpdatedOptions_ = function(newOptions) {
var options = _ol_obj_.assign({}, this.options_);
// preserve resolution (or zoom)
if (options.resolution !== undefined) {
@@ -223,7 +224,7 @@ ol.View.prototype.getUpdatedOptions_ = function(newOptions) {
// preserve rotation
options.rotation = this.getRotation();
return ol.obj.assign({}, options, newOptions);
return _ol_obj_.assign({}, options, newOptions);
};
@@ -260,7 +261,7 @@ ol.View.prototype.getUpdatedOptions_ = function(newOptions) {
* the animation completed without being cancelled.
* @api
*/
ol.View.prototype.animate = function(var_args) {
_ol_View_.prototype.animate = function(var_args) {
var animationCount = arguments.length;
var callback;
if (animationCount > 1 && typeof arguments[animationCount - 1] === 'function') {
@@ -297,7 +298,7 @@ ol.View.prototype.animate = function(var_args) {
complete: false,
anchor: options.anchor,
duration: options.duration !== undefined ? options.duration : 1000,
easing: options.easing || ol.easing.inAndOut
easing: options.easing || _ol_easing_.inAndOut
});
if (options.center) {
@@ -319,7 +320,7 @@ ol.View.prototype.animate = function(var_args) {
if (options.rotation !== undefined) {
animation.sourceRotation = rotation;
var delta = ol.math.modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;
var delta = _ol_math_.modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;
animation.targetRotation = rotation + delta;
rotation = animation.targetRotation;
}
@@ -327,7 +328,7 @@ ol.View.prototype.animate = function(var_args) {
animation.callback = callback;
// check if animation is a no-op
if (ol.View.isNoopAnimation(animation)) {
if (_ol_View_.isNoopAnimation(animation)) {
animation.complete = true;
// we still push it onto the series for callback handling
} else {
@@ -336,7 +337,7 @@ ol.View.prototype.animate = function(var_args) {
series.push(animation);
}
this.animations_.push(series);
this.setHint(ol.ViewHint.ANIMATING, 1);
this.setHint(_ol_ViewHint_.ANIMATING, 1);
this.updateAnimations_();
};
@@ -346,8 +347,8 @@ ol.View.prototype.animate = function(var_args) {
* @return {boolean} The view is being animated.
* @api
*/
ol.View.prototype.getAnimating = function() {
return this.hints_[ol.ViewHint.ANIMATING] > 0;
_ol_View_.prototype.getAnimating = function() {
return this.hints_[_ol_ViewHint_.ANIMATING] > 0;
};
@@ -356,8 +357,8 @@ ol.View.prototype.getAnimating = function() {
* @return {boolean} The view is being interacted with.
* @api
*/
ol.View.prototype.getInteracting = function() {
return this.hints_[ol.ViewHint.INTERACTING] > 0;
_ol_View_.prototype.getInteracting = function() {
return this.hints_[_ol_ViewHint_.INTERACTING] > 0;
};
@@ -365,8 +366,8 @@ ol.View.prototype.getInteracting = function() {
* Cancel any ongoing animations.
* @api
*/
ol.View.prototype.cancelAnimations = function() {
this.setHint(ol.ViewHint.ANIMATING, -this.hints_[ol.ViewHint.ANIMATING]);
_ol_View_.prototype.cancelAnimations = function() {
this.setHint(_ol_ViewHint_.ANIMATING, -this.hints_[_ol_ViewHint_.ANIMATING]);
for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
var series = this.animations_[i];
if (series[0].callback) {
@@ -379,7 +380,7 @@ ol.View.prototype.cancelAnimations = function() {
/**
* Update all animations.
*/
ol.View.prototype.updateAnimations_ = function() {
_ol_View_.prototype.updateAnimations_ = function() {
if (this.updateAnimationKey_ !== undefined) {
cancelAnimationFrame(this.updateAnimationKey_);
this.updateAnimationKey_ = undefined;
@@ -413,27 +414,27 @@ ol.View.prototype.updateAnimations_ = function() {
var y1 = animation.targetCenter[1];
var x = x0 + progress * (x1 - x0);
var y = y0 + progress * (y1 - y0);
this.set(ol.ViewProperty.CENTER, [x, y]);
this.set(_ol_ViewProperty_.CENTER, [x, y]);
}
if (animation.sourceResolution && animation.targetResolution) {
var resolution = progress === 1 ?
animation.targetResolution :
animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution);
if (animation.anchor) {
this.set(ol.ViewProperty.CENTER,
this.set(_ol_ViewProperty_.CENTER,
this.calculateCenterZoom(resolution, animation.anchor));
}
this.set(ol.ViewProperty.RESOLUTION, resolution);
this.set(_ol_ViewProperty_.RESOLUTION, resolution);
}
if (animation.sourceRotation !== undefined && animation.targetRotation !== undefined) {
var rotation = progress === 1 ?
ol.math.modulo(animation.targetRotation + Math.PI, 2 * Math.PI) - Math.PI :
_ol_math_.modulo(animation.targetRotation + Math.PI, 2 * Math.PI) - Math.PI :
animation.sourceRotation + progress * (animation.targetRotation - animation.sourceRotation);
if (animation.anchor) {
this.set(ol.ViewProperty.CENTER,
this.set(_ol_ViewProperty_.CENTER,
this.calculateCenterRotate(rotation, animation.anchor));
}
this.set(ol.ViewProperty.ROTATION, rotation);
this.set(_ol_ViewProperty_.ROTATION, rotation);
}
more = true;
if (!animation.complete) {
@@ -442,7 +443,7 @@ ol.View.prototype.updateAnimations_ = function() {
}
if (seriesComplete) {
this.animations_[i] = null;
this.setHint(ol.ViewHint.ANIMATING, -1);
this.setHint(_ol_ViewHint_.ANIMATING, -1);
var callback = series[0].callback;
if (callback) {
callback(true);
@@ -461,13 +462,13 @@ ol.View.prototype.updateAnimations_ = function() {
* @param {ol.Coordinate} anchor Rotation anchor.
* @return {ol.Coordinate|undefined} Center for rotation and anchor.
*/
ol.View.prototype.calculateCenterRotate = function(rotation, anchor) {
_ol_View_.prototype.calculateCenterRotate = function(rotation, anchor) {
var center;
var currentCenter = this.getCenter();
if (currentCenter !== undefined) {
center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];
ol.coordinate.rotate(center, rotation - this.getRotation());
ol.coordinate.add(center, anchor);
_ol_coordinate_.rotate(center, rotation - this.getRotation());
_ol_coordinate_.add(center, anchor);
}
return center;
};
@@ -478,7 +479,7 @@ ol.View.prototype.calculateCenterRotate = function(rotation, anchor) {
* @param {ol.Coordinate} anchor Zoom anchor.
* @return {ol.Coordinate|undefined} Center for resolution and anchor.
*/
ol.View.prototype.calculateCenterZoom = function(resolution, anchor) {
_ol_View_.prototype.calculateCenterZoom = function(resolution, anchor) {
var center;
var currentCenter = this.getCenter();
var currentResolution = this.getResolution();
@@ -497,9 +498,9 @@ ol.View.prototype.calculateCenterZoom = function(resolution, anchor) {
* @private
* @return {ol.Size} Viewport size or `[100, 100]` when no viewport is found.
*/
ol.View.prototype.getSizeFromViewport_ = function() {
_ol_View_.prototype.getSizeFromViewport_ = function() {
var size = [100, 100];
var selector = '.ol-viewport[data-view="' + ol.getUid(this) + '"]';
var selector = '.ol-viewport[data-view="' + _ol_.getUid(this) + '"]';
var element = document.querySelector(selector);
if (element) {
var metrics = getComputedStyle(element);
@@ -516,7 +517,7 @@ ol.View.prototype.getSizeFromViewport_ = function() {
* @return {ol.Coordinate|undefined} Constrained center.
* @api
*/
ol.View.prototype.constrainCenter = function(center) {
_ol_View_.prototype.constrainCenter = function(center) {
return this.constraints_.center(center);
};
@@ -529,7 +530,7 @@ ol.View.prototype.constrainCenter = function(center) {
* @return {number|undefined} Constrained resolution.
* @api
*/
ol.View.prototype.constrainResolution = function(
_ol_View_.prototype.constrainResolution = function(
resolution, opt_delta, opt_direction) {
var delta = opt_delta || 0;
var direction = opt_direction || 0;
@@ -544,7 +545,7 @@ ol.View.prototype.constrainResolution = function(
* @return {number|undefined} Constrained rotation.
* @api
*/
ol.View.prototype.constrainRotation = function(rotation, opt_delta) {
_ol_View_.prototype.constrainRotation = function(rotation, opt_delta) {
var delta = opt_delta || 0;
return this.constraints_.rotation(rotation, delta);
};
@@ -556,16 +557,17 @@ ol.View.prototype.constrainRotation = function(rotation, opt_delta) {
* @observable
* @api
*/
ol.View.prototype.getCenter = function() {
return /** @type {ol.Coordinate|undefined} */ (
this.get(ol.ViewProperty.CENTER));
_ol_View_.prototype.getCenter = function() {
return (
/** @type {ol.Coordinate|undefined} */ this.get(_ol_ViewProperty_.CENTER)
);
};
/**
* @return {ol.Constraints} Constraints.
*/
ol.View.prototype.getConstraints = function() {
_ol_View_.prototype.getConstraints = function() {
return this.constraints_;
};
@@ -574,7 +576,7 @@ ol.View.prototype.getConstraints = function() {
* @param {Array.<number>=} opt_hints Destination array.
* @return {Array.<number>} Hint.
*/
ol.View.prototype.getHints = function(opt_hints) {
_ol_View_.prototype.getHints = function(opt_hints) {
if (opt_hints !== undefined) {
opt_hints[0] = this.hints_[0];
opt_hints[1] = this.hints_[1];
@@ -595,16 +597,16 @@ ol.View.prototype.getHints = function(opt_hints) {
* @return {ol.Extent} Extent.
* @api
*/
ol.View.prototype.calculateExtent = function(opt_size) {
_ol_View_.prototype.calculateExtent = function(opt_size) {
var size = opt_size || this.getSizeFromViewport_();
var center = /** @type {!ol.Coordinate} */ (this.getCenter());
ol.asserts.assert(center, 1); // The view center is not defined
_ol_asserts_.assert(center, 1); // The view center is not defined
var resolution = /** @type {!number} */ (this.getResolution());
ol.asserts.assert(resolution !== undefined, 2); // The view resolution is not defined
_ol_asserts_.assert(resolution !== undefined, 2); // The view resolution is not defined
var rotation = /** @type {!number} */ (this.getRotation());
ol.asserts.assert(rotation !== undefined, 3); // The view rotation is not defined
_ol_asserts_.assert(rotation !== undefined, 3); // The view rotation is not defined
return ol.extent.getForViewAndSize(center, resolution, rotation, size);
return _ol_extent_.getForViewAndSize(center, resolution, rotation, size);
};
@@ -613,7 +615,7 @@ ol.View.prototype.calculateExtent = function(opt_size) {
* @return {number} The maximum resolution of the view.
* @api
*/
ol.View.prototype.getMaxResolution = function() {
_ol_View_.prototype.getMaxResolution = function() {
return this.maxResolution_;
};
@@ -623,7 +625,7 @@ ol.View.prototype.getMaxResolution = function() {
* @return {number} The minimum resolution of the view.
* @api
*/
ol.View.prototype.getMinResolution = function() {
_ol_View_.prototype.getMinResolution = function() {
return this.minResolution_;
};
@@ -633,7 +635,7 @@ ol.View.prototype.getMinResolution = function() {
* @return {number} The maximum zoom level.
* @api
*/
ol.View.prototype.getMaxZoom = function() {
_ol_View_.prototype.getMaxZoom = function() {
return /** @type {number} */ (this.getZoomForResolution(this.minResolution_));
};
@@ -643,7 +645,7 @@ ol.View.prototype.getMaxZoom = function() {
* @param {number} zoom The maximum zoom level.
* @api
*/
ol.View.prototype.setMaxZoom = function(zoom) {
_ol_View_.prototype.setMaxZoom = function(zoom) {
this.applyOptions_(this.getUpdatedOptions_({maxZoom: zoom}));
};
@@ -653,7 +655,7 @@ ol.View.prototype.setMaxZoom = function(zoom) {
* @return {number} The minimum zoom level.
* @api
*/
ol.View.prototype.getMinZoom = function() {
_ol_View_.prototype.getMinZoom = function() {
return /** @type {number} */ (this.getZoomForResolution(this.maxResolution_));
};
@@ -663,7 +665,7 @@ ol.View.prototype.getMinZoom = function() {
* @param {number} zoom The minimum zoom level.
* @api
*/
ol.View.prototype.setMinZoom = function(zoom) {
_ol_View_.prototype.setMinZoom = function(zoom) {
this.applyOptions_(this.getUpdatedOptions_({minZoom: zoom}));
};
@@ -673,7 +675,7 @@ ol.View.prototype.setMinZoom = function(zoom) {
* @return {ol.proj.Projection} The projection of the view.
* @api
*/
ol.View.prototype.getProjection = function() {
_ol_View_.prototype.getProjection = function() {
return this.projection_;
};
@@ -684,9 +686,10 @@ ol.View.prototype.getProjection = function() {
* @observable
* @api
*/
ol.View.prototype.getResolution = function() {
return /** @type {number|undefined} */ (
this.get(ol.ViewProperty.RESOLUTION));
_ol_View_.prototype.getResolution = function() {
return (
/** @type {number|undefined} */ this.get(_ol_ViewProperty_.RESOLUTION)
);
};
@@ -696,7 +699,7 @@ ol.View.prototype.getResolution = function() {
* @return {Array.<number>|undefined} The resolutions of the view.
* @api
*/
ol.View.prototype.getResolutions = function() {
_ol_View_.prototype.getResolutions = function() {
return this.resolutions_;
};
@@ -709,10 +712,10 @@ ol.View.prototype.getResolutions = function() {
* the given size.
* @api
*/
ol.View.prototype.getResolutionForExtent = function(extent, opt_size) {
_ol_View_.prototype.getResolutionForExtent = function(extent, opt_size) {
var size = opt_size || this.getSizeFromViewport_();
var xResolution = ol.extent.getWidth(extent) / size[0];
var yResolution = ol.extent.getHeight(extent) / size[1];
var xResolution = _ol_extent_.getWidth(extent) / size[0];
var yResolution = _ol_extent_.getHeight(extent) / size[1];
return Math.max(xResolution, yResolution);
};
@@ -723,7 +726,7 @@ ol.View.prototype.getResolutionForExtent = function(extent, opt_size) {
* @param {number=} opt_power Power.
* @return {function(number): number} Resolution for value function.
*/
ol.View.prototype.getResolutionForValueFunction = function(opt_power) {
_ol_View_.prototype.getResolutionForValueFunction = function(opt_power) {
var power = opt_power || 2;
var maxResolution = this.maxResolution_;
var minResolution = this.minResolution_;
@@ -746,8 +749,10 @@ ol.View.prototype.getResolutionForValueFunction = function(opt_power) {
* @observable
* @api
*/
ol.View.prototype.getRotation = function() {
return /** @type {number} */ (this.get(ol.ViewProperty.ROTATION));
_ol_View_.prototype.getRotation = function() {
return (
/** @type {number} */ this.get(_ol_ViewProperty_.ROTATION)
);
};
@@ -757,7 +762,7 @@ ol.View.prototype.getRotation = function() {
* @param {number=} opt_power Power.
* @return {function(number): number} Value for resolution function.
*/
ol.View.prototype.getValueForResolutionFunction = function(opt_power) {
_ol_View_.prototype.getValueForResolutionFunction = function(opt_power) {
var power = opt_power || 2;
var maxResolution = this.maxResolution_;
var minResolution = this.minResolution_;
@@ -778,7 +783,7 @@ ol.View.prototype.getValueForResolutionFunction = function(opt_power) {
/**
* @return {olx.ViewState} View state.
*/
ol.View.prototype.getState = function() {
_ol_View_.prototype.getState = function() {
var center = /** @type {ol.Coordinate} */ (this.getCenter());
var projection = this.getProjection();
var resolution = /** @type {number} */ (this.getResolution());
@@ -800,7 +805,7 @@ ol.View.prototype.getState = function() {
* @return {number|undefined} Zoom.
* @api
*/
ol.View.prototype.getZoom = function() {
_ol_View_.prototype.getZoom = function() {
var zoom;
var resolution = this.getResolution();
if (resolution !== undefined) {
@@ -816,11 +821,11 @@ ol.View.prototype.getZoom = function() {
* @return {number|undefined} The zoom level for the provided resolution.
* @api
*/
ol.View.prototype.getZoomForResolution = function(resolution) {
_ol_View_.prototype.getZoomForResolution = function(resolution) {
var offset = this.minZoom_ || 0;
var max, zoomFactor;
if (this.resolutions_) {
var nearest = ol.array.linearFindNearest(this.resolutions_, resolution, 1);
var nearest = _ol_array_.linearFindNearest(this.resolutions_, resolution, 1);
offset = nearest;
max = this.resolutions_[nearest];
if (nearest == this.resolutions_.length - 1) {
@@ -842,7 +847,7 @@ ol.View.prototype.getZoomForResolution = function(resolution) {
* @return {number} The view resolution for the provided zoom level.
* @api
*/
ol.View.prototype.getResolutionForZoom = function(zoom) {
_ol_View_.prototype.getResolutionForZoom = function(zoom) {
return /** @type {number} */ (this.constrainResolution(
this.maxResolution_, zoom - this.minZoom_, 0));
};
@@ -858,7 +863,7 @@ ol.View.prototype.getResolutionForZoom = function(zoom) {
* @param {olx.view.FitOptions=} opt_options Options.
* @api
*/
ol.View.prototype.fit = function(geometryOrExtent, opt_options) {
_ol_View_.prototype.fit = function(geometryOrExtent, opt_options) {
var options = opt_options || {};
var size = options.size;
if (!size) {
@@ -866,16 +871,16 @@ ol.View.prototype.fit = function(geometryOrExtent, opt_options) {
}
/** @type {ol.geom.SimpleGeometry} */
var geometry;
if (!(geometryOrExtent instanceof ol.geom.SimpleGeometry)) {
ol.asserts.assert(Array.isArray(geometryOrExtent),
if (!(geometryOrExtent instanceof _ol_geom_SimpleGeometry_)) {
_ol_asserts_.assert(Array.isArray(geometryOrExtent),
24); // Invalid extent or geometry provided as `geometry`
ol.asserts.assert(!ol.extent.isEmpty(geometryOrExtent),
_ol_asserts_.assert(!_ol_extent_.isEmpty(geometryOrExtent),
25); // Cannot fit empty extent provided as `geometry`
geometry = ol.geom.Polygon.fromExtent(geometryOrExtent);
} else if (geometryOrExtent.getType() === ol.geom.GeometryType.CIRCLE) {
geometry = _ol_geom_Polygon_.fromExtent(geometryOrExtent);
} else if (geometryOrExtent.getType() === _ol_geom_GeometryType_.CIRCLE) {
geometryOrExtent = geometryOrExtent.getExtent();
geometry = ol.geom.Polygon.fromExtent(geometryOrExtent);
geometry.rotate(this.getRotation(), ol.extent.getCenter(geometryOrExtent));
geometry = _ol_geom_Polygon_.fromExtent(geometryOrExtent);
geometry.rotate(this.getRotation(), _ol_extent_.getCenter(geometryOrExtent));
} else {
geometry = geometryOrExtent;
}
@@ -937,7 +942,7 @@ ol.View.prototype.fit = function(geometryOrExtent, opt_options) {
var centerX = centerRotX * cosAngle - centerRotY * sinAngle;
var centerY = centerRotY * cosAngle + centerRotX * sinAngle;
var center = [centerX, centerY];
var callback = options.callback ? options.callback : ol.nullFunction;
var callback = options.callback ? options.callback : _ol_.nullFunction;
if (options.duration !== undefined) {
this.animate({
@@ -961,7 +966,7 @@ ol.View.prototype.fit = function(geometryOrExtent, opt_options) {
* @param {ol.Pixel} position Position on the view to center on.
* @api
*/
ol.View.prototype.centerOn = function(coordinate, size, position) {
_ol_View_.prototype.centerOn = function(coordinate, size, position) {
// calculate rotated position
var rotation = this.getRotation();
var cosAngle = Math.cos(-rotation);
@@ -984,7 +989,7 @@ ol.View.prototype.centerOn = function(coordinate, size, position) {
/**
* @return {boolean} Is defined.
*/
ol.View.prototype.isDef = function() {
_ol_View_.prototype.isDef = function() {
return !!this.getCenter() && this.getResolution() !== undefined;
};
@@ -995,7 +1000,7 @@ ol.View.prototype.isDef = function() {
* @param {ol.Coordinate=} opt_anchor The rotation center.
* @api
*/
ol.View.prototype.rotate = function(rotation, opt_anchor) {
_ol_View_.prototype.rotate = function(rotation, opt_anchor) {
if (opt_anchor !== undefined) {
var center = this.calculateCenterRotate(rotation, opt_anchor);
this.setCenter(center);
@@ -1010,8 +1015,8 @@ ol.View.prototype.rotate = function(rotation, opt_anchor) {
* @observable
* @api
*/
ol.View.prototype.setCenter = function(center) {
this.set(ol.ViewProperty.CENTER, center);
_ol_View_.prototype.setCenter = function(center) {
this.set(_ol_ViewProperty_.CENTER, center);
if (this.getAnimating()) {
this.cancelAnimations();
}
@@ -1023,7 +1028,7 @@ ol.View.prototype.setCenter = function(center) {
* @param {number} delta Delta.
* @return {number} New value.
*/
ol.View.prototype.setHint = function(hint, delta) {
_ol_View_.prototype.setHint = function(hint, delta) {
this.hints_[hint] += delta;
this.changed();
return this.hints_[hint];
@@ -1036,8 +1041,8 @@ ol.View.prototype.setHint = function(hint, delta) {
* @observable
* @api
*/
ol.View.prototype.setResolution = function(resolution) {
this.set(ol.ViewProperty.RESOLUTION, resolution);
_ol_View_.prototype.setResolution = function(resolution) {
this.set(_ol_ViewProperty_.RESOLUTION, resolution);
if (this.getAnimating()) {
this.cancelAnimations();
}
@@ -1050,8 +1055,8 @@ ol.View.prototype.setResolution = function(resolution) {
* @observable
* @api
*/
ol.View.prototype.setRotation = function(rotation) {
this.set(ol.ViewProperty.ROTATION, rotation);
_ol_View_.prototype.setRotation = function(rotation) {
this.set(_ol_ViewProperty_.ROTATION, rotation);
if (this.getAnimating()) {
this.cancelAnimations();
}
@@ -1063,7 +1068,7 @@ ol.View.prototype.setRotation = function(rotation) {
* @param {number} zoom Zoom level.
* @api
*/
ol.View.prototype.setZoom = function(zoom) {
_ol_View_.prototype.setZoom = function(zoom) {
this.setResolution(this.getResolutionForZoom(zoom));
};
@@ -1073,11 +1078,11 @@ ol.View.prototype.setZoom = function(zoom) {
* @private
* @return {ol.CenterConstraintType} The constraint.
*/
ol.View.createCenterConstraint_ = function(options) {
_ol_View_.createCenterConstraint_ = function(options) {
if (options.extent !== undefined) {
return ol.CenterConstraint.createExtent(options.extent);
return _ol_CenterConstraint_.createExtent(options.extent);
} else {
return ol.CenterConstraint.none;
return _ol_CenterConstraint_.none;
}
};
@@ -1088,7 +1093,7 @@ ol.View.createCenterConstraint_ = function(options) {
* @return {{constraint: ol.ResolutionConstraintType, maxResolution: number,
* minResolution: number, zoomFactor: number}} The constraint.
*/
ol.View.createResolutionConstraint_ = function(options) {
_ol_View_.createResolutionConstraint_ = function(options) {
var resolutionConstraint;
var maxResolution;
var minResolution;
@@ -1099,7 +1104,7 @@ ol.View.createResolutionConstraint_ = function(options) {
var defaultZoomFactor = 2;
var minZoom = options.minZoom !== undefined ?
options.minZoom : ol.DEFAULT_MIN_ZOOM;
options.minZoom : _ol_.DEFAULT_MIN_ZOOM;
var maxZoom = options.maxZoom !== undefined ?
options.maxZoom : defaultMaxZoom;
@@ -1112,23 +1117,23 @@ ol.View.createResolutionConstraint_ = function(options) {
maxResolution = resolutions[minZoom];
minResolution = resolutions[maxZoom] !== undefined ?
resolutions[maxZoom] : resolutions[resolutions.length - 1];
resolutionConstraint = ol.ResolutionConstraint.createSnapToResolutions(
resolutionConstraint = _ol_ResolutionConstraint_.createSnapToResolutions(
resolutions);
} else {
// calculate the default min and max resolution
var projection = ol.proj.createProjection(options.projection, 'EPSG:3857');
var projection = _ol_proj_.createProjection(options.projection, 'EPSG:3857');
var extent = projection.getExtent();
var size = !extent ?
// use an extent that can fit the whole world if need be
360 * ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES] /
360 * _ol_proj_.METERS_PER_UNIT[_ol_proj_Units_.DEGREES] /
projection.getMetersPerUnit() :
Math.max(ol.extent.getWidth(extent), ol.extent.getHeight(extent));
Math.max(_ol_extent_.getWidth(extent), _ol_extent_.getHeight(extent));
var defaultMaxResolution = size / ol.DEFAULT_TILE_SIZE / Math.pow(
defaultZoomFactor, ol.DEFAULT_MIN_ZOOM);
var defaultMaxResolution = size / _ol_.DEFAULT_TILE_SIZE / Math.pow(
defaultZoomFactor, _ol_.DEFAULT_MIN_ZOOM);
var defaultMinResolution = defaultMaxResolution / Math.pow(
defaultZoomFactor, defaultMaxZoom - ol.DEFAULT_MIN_ZOOM);
defaultZoomFactor, defaultMaxZoom - _ol_.DEFAULT_MIN_ZOOM);
// user provided maxResolution takes precedence
maxResolution = options.maxResolution;
@@ -1157,7 +1162,7 @@ ol.View.createResolutionConstraint_ = function(options) {
Math.log(maxResolution / minResolution) / Math.log(zoomFactor));
minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);
resolutionConstraint = ol.ResolutionConstraint.createSnapToPower(
resolutionConstraint = _ol_ResolutionConstraint_.createSnapToPower(
zoomFactor, maxResolution, maxZoom - minZoom);
}
return {constraint: resolutionConstraint, maxResolution: maxResolution,
@@ -1170,22 +1175,22 @@ ol.View.createResolutionConstraint_ = function(options) {
* @param {olx.ViewOptions} options View options.
* @return {ol.RotationConstraintType} Rotation constraint.
*/
ol.View.createRotationConstraint_ = function(options) {
_ol_View_.createRotationConstraint_ = function(options) {
var enableRotation = options.enableRotation !== undefined ?
options.enableRotation : true;
if (enableRotation) {
var constrainRotation = options.constrainRotation;
if (constrainRotation === undefined || constrainRotation === true) {
return ol.RotationConstraint.createSnapToZero();
return _ol_RotationConstraint_.createSnapToZero();
} else if (constrainRotation === false) {
return ol.RotationConstraint.none;
return _ol_RotationConstraint_.none;
} else if (typeof constrainRotation === 'number') {
return ol.RotationConstraint.createSnapToN(constrainRotation);
return _ol_RotationConstraint_.createSnapToN(constrainRotation);
} else {
return ol.RotationConstraint.none;
return _ol_RotationConstraint_.none;
}
} else {
return ol.RotationConstraint.disable;
return _ol_RotationConstraint_.disable;
}
};
@@ -1195,9 +1200,9 @@ ol.View.createRotationConstraint_ = function(options) {
* @param {ol.ViewAnimation} animation The animation.
* @return {boolean} The animation involves no view change.
*/
ol.View.isNoopAnimation = function(animation) {
_ol_View_.isNoopAnimation = function(animation) {
if (animation.sourceCenter && animation.targetCenter) {
if (!ol.coordinate.equals(animation.sourceCenter, animation.targetCenter)) {
if (!_ol_coordinate_.equals(animation.sourceCenter, animation.targetCenter)) {
return false;
}
}
@@ -1209,3 +1214,4 @@ ol.View.isNoopAnimation = function(animation) {
}
return true;
};
export default _ol_View_;

View File

@@ -1,9 +1,12 @@
goog.provide('ol.ViewHint');
/**
* @module ol/ViewHint
*/
/**
* @enum {number}
*/
ol.ViewHint = {
var _ol_ViewHint_ = {
ANIMATING: 0,
INTERACTING: 1
};
export default _ol_ViewHint_;

View File

@@ -1,10 +1,13 @@
goog.provide('ol.ViewProperty');
/**
* @module ol/ViewProperty
*/
/**
* @enum {string}
*/
ol.ViewProperty = {
var _ol_ViewProperty_ = {
CENTER: 'center',
RESOLUTION: 'resolution',
ROTATION: 'rotation'
};
export default _ol_ViewProperty_;

View File

@@ -1,4 +1,7 @@
goog.provide('ol.array');
/**
* @module ol/array
*/
var _ol_array_ = {};
/**
@@ -10,9 +13,9 @@ goog.provide('ol.array');
* @param {Function=} opt_comparator Comparator function.
* @return {number} The index of the item if found, -1 if not.
*/
ol.array.binarySearch = function(haystack, needle, opt_comparator) {
_ol_array_.binarySearch = function(haystack, needle, opt_comparator) {
var mid, cmp;
var comparator = opt_comparator || ol.array.numberSafeCompareFunction;
var comparator = opt_comparator || _ol_array_.numberSafeCompareFunction;
var low = 0;
var high = haystack.length;
var found = false;
@@ -44,7 +47,7 @@ ol.array.binarySearch = function(haystack, needle, opt_comparator) {
* @return {number} A negative number, zero, or a positive number as the first
* argument is less than, equal to, or greater than the second.
*/
ol.array.numberSafeCompareFunction = function(a, b) {
_ol_array_.numberSafeCompareFunction = function(a, b) {
return a > b ? 1 : a < b ? -1 : 0;
};
@@ -55,7 +58,7 @@ ol.array.numberSafeCompareFunction = function(a, b) {
* @param {*} obj The object for which to test.
* @return {boolean} The object is in the array.
*/
ol.array.includes = function(arr, obj) {
_ol_array_.includes = function(arr, obj) {
return arr.indexOf(obj) >= 0;
};
@@ -68,7 +71,7 @@ ol.array.includes = function(arr, obj) {
* smallest nearest.
* @return {number} Index.
*/
ol.array.linearFindNearest = function(arr, target, direction) {
_ol_array_.linearFindNearest = function(arr, target, direction) {
var n = arr.length;
if (arr[0] <= target) {
return 0;
@@ -111,7 +114,7 @@ ol.array.linearFindNearest = function(arr, target, direction) {
* @param {number} begin Begin index.
* @param {number} end End index.
*/
ol.array.reverseSubArray = function(arr, begin, end) {
_ol_array_.reverseSubArray = function(arr, begin, end) {
while (begin < end) {
var tmp = arr[begin];
arr[begin] = arr[end];
@@ -128,7 +131,7 @@ ol.array.reverseSubArray = function(arr, begin, end) {
* to add to arr.
* @template VALUE
*/
ol.array.extend = function(arr, data) {
_ol_array_.extend = function(arr, data) {
var i;
var extension = Array.isArray(data) ? data : [data];
var length = extension.length;
@@ -144,7 +147,7 @@ ol.array.extend = function(arr, data) {
* @template VALUE
* @return {boolean} If the element was removed.
*/
ol.array.remove = function(arr, obj) {
_ol_array_.remove = function(arr, obj) {
var i = arr.indexOf(obj);
var found = i > -1;
if (found) {
@@ -160,7 +163,7 @@ ol.array.remove = function(arr, obj) {
* @template VALUE
* @return {VALUE} The element found.
*/
ol.array.find = function(arr, func) {
_ol_array_.find = function(arr, func) {
var length = arr.length >>> 0;
var value;
@@ -179,7 +182,7 @@ ol.array.find = function(arr, func) {
* @param {Array|Uint8ClampedArray} arr2 The second array to compare.
* @return {boolean} Whether the two arrays are equal.
*/
ol.array.equals = function(arr1, arr2) {
_ol_array_.equals = function(arr1, arr2) {
var len1 = arr1.length;
if (len1 !== arr2.length) {
return false;
@@ -197,7 +200,7 @@ ol.array.equals = function(arr1, arr2) {
* @param {Array.<*>} arr The array to sort (modifies original).
* @param {Function} compareFnc Comparison function.
*/
ol.array.stableSort = function(arr, compareFnc) {
_ol_array_.stableSort = function(arr, compareFnc) {
var length = arr.length;
var tmp = Array(arr.length);
var i;
@@ -218,7 +221,7 @@ ol.array.stableSort = function(arr, compareFnc) {
* @param {Function} func Comparison function.
* @return {number} Return index.
*/
ol.array.findIndex = function(arr, func) {
_ol_array_.findIndex = function(arr, func) {
var index;
var found = !arr.every(function(el, idx) {
index = idx;
@@ -234,8 +237,8 @@ ol.array.findIndex = function(arr, func) {
* @param {boolean=} opt_strict Strictly sorted (default false).
* @return {boolean} Return index.
*/
ol.array.isSorted = function(arr, opt_func, opt_strict) {
var compare = opt_func || ol.array.numberSafeCompareFunction;
_ol_array_.isSorted = function(arr, opt_func, opt_strict) {
var compare = opt_func || _ol_array_.numberSafeCompareFunction;
return arr.every(function(currentVal, index) {
if (index === 0) {
return true;
@@ -244,3 +247,4 @@ ol.array.isSorted = function(arr, opt_func, opt_strict) {
return !(res > 0 || opt_strict && res === 0);
});
};
export default _ol_array_;

View File

@@ -1,14 +1,17 @@
goog.provide('ol.asserts');
goog.require('ol.AssertionError');
/**
* @module ol/asserts
*/
import _ol_AssertionError_ from './AssertionError.js';
var _ol_asserts_ = {};
/**
* @param {*} assertion Assertion we expected to be truthy.
* @param {number} errorCode Error code.
*/
ol.asserts.assert = function(assertion, errorCode) {
_ol_asserts_.assert = function(assertion, errorCode) {
if (!assertion) {
throw new ol.AssertionError(errorCode);
throw new _ol_AssertionError_(errorCode);
}
};
export default _ol_asserts_;

View File

@@ -1,7 +1,9 @@
goog.provide('ol.color');
goog.require('ol.asserts');
goog.require('ol.math');
/**
* @module ol/color
*/
import _ol_asserts_ from './asserts.js';
import _ol_math_ from './math.js';
var _ol_color_ = {};
/**
@@ -10,7 +12,7 @@ goog.require('ol.math');
* @type {RegExp}
* @private
*/
ol.color.HEX_COLOR_RE_ = /^#(?:[0-9a-f]{3,4}){1,2}$/i;
_ol_color_.HEX_COLOR_RE_ = /^#(?:[0-9a-f]{3,4}){1,2}$/i;
/**
@@ -19,7 +21,7 @@ ol.color.HEX_COLOR_RE_ = /^#(?:[0-9a-f]{3,4}){1,2}$/i;
* @type {RegExp}
* @private
*/
ol.color.NAMED_COLOR_RE_ = /^([a-z]*)$/i;
_ol_color_.NAMED_COLOR_RE_ = /^([a-z]*)$/i;
/**
@@ -29,11 +31,11 @@ ol.color.NAMED_COLOR_RE_ = /^([a-z]*)$/i;
* @return {ol.Color} Color.
* @api
*/
ol.color.asArray = function(color) {
_ol_color_.asArray = function(color) {
if (Array.isArray(color)) {
return color;
} else {
return ol.color.fromString(/** @type {string} */ (color));
return _ol_color_.fromString(/** @type {string} */ (color));
}
};
@@ -44,11 +46,11 @@ ol.color.asArray = function(color) {
* @return {string} Rgba string.
* @api
*/
ol.color.asString = function(color) {
_ol_color_.asString = function(color) {
if (typeof color === 'string') {
return color;
} else {
return ol.color.toString(color);
return _ol_color_.toString(color);
}
};
@@ -57,7 +59,7 @@ ol.color.asString = function(color) {
* @param {string} color Named color.
* @return {string} Rgb string.
*/
ol.color.fromNamed = function(color) {
_ol_color_.fromNamed = function(color) {
var el = document.createElement('div');
el.style.color = color;
document.body.appendChild(el);
@@ -71,7 +73,7 @@ ol.color.fromNamed = function(color) {
* @param {string} s String.
* @return {ol.Color} Color.
*/
ol.color.fromString = (
_ol_color_.fromString = (
function() {
// We maintain a small cache of parsed strings. To provide cheap LRU-like
@@ -114,12 +116,13 @@ ol.color.fromString = (
}
}
}
color = ol.color.fromStringInternal_(s);
color = _ol_color_.fromStringInternal_(s);
cache[s] = color;
++cacheSize;
}
return color;
});
}
);
})();
@@ -129,14 +132,14 @@ ol.color.fromString = (
* @private
* @return {ol.Color} Color.
*/
ol.color.fromStringInternal_ = function(s) {
_ol_color_.fromStringInternal_ = function(s) {
var r, g, b, a, color, parts;
if (ol.color.NAMED_COLOR_RE_.exec(s)) {
s = ol.color.fromNamed(s);
if (_ol_color_.NAMED_COLOR_RE_.exec(s)) {
s = _ol_color_.fromNamed(s);
}
if (ol.color.HEX_COLOR_RE_.exec(s)) { // hex
if (_ol_color_.HEX_COLOR_RE_.exec(s)) { // hex
var n = s.length - 1; // number of hex digits
var d; // number of digits per channel
if (n <= 4) {
@@ -164,13 +167,13 @@ ol.color.fromStringInternal_ = function(s) {
color = [r, g, b, a / 255];
} else if (s.indexOf('rgba(') == 0) { // rgba()
parts = s.slice(5, -1).split(',').map(Number);
color = ol.color.normalize(parts);
color = _ol_color_.normalize(parts);
} else if (s.indexOf('rgb(') == 0) { // rgb()
parts = s.slice(4, -1).split(',').map(Number);
parts.push(1);
color = ol.color.normalize(parts);
color = _ol_color_.normalize(parts);
} else {
ol.asserts.assert(false, 14); // Invalid color
_ol_asserts_.assert(false, 14); // Invalid color
}
return /** @type {ol.Color} */ (color);
};
@@ -181,12 +184,12 @@ ol.color.fromStringInternal_ = function(s) {
* @param {ol.Color=} opt_color Color.
* @return {ol.Color} Clamped color.
*/
ol.color.normalize = function(color, opt_color) {
_ol_color_.normalize = function(color, opt_color) {
var result = opt_color || [];
result[0] = ol.math.clamp((color[0] + 0.5) | 0, 0, 255);
result[1] = ol.math.clamp((color[1] + 0.5) | 0, 0, 255);
result[2] = ol.math.clamp((color[2] + 0.5) | 0, 0, 255);
result[3] = ol.math.clamp(color[3], 0, 1);
result[0] = _ol_math_.clamp((color[0] + 0.5) | 0, 0, 255);
result[1] = _ol_math_.clamp((color[1] + 0.5) | 0, 0, 255);
result[2] = _ol_math_.clamp((color[2] + 0.5) | 0, 0, 255);
result[3] = _ol_math_.clamp(color[3], 0, 1);
return result;
};
@@ -195,7 +198,7 @@ ol.color.normalize = function(color, opt_color) {
* @param {ol.Color} color Color.
* @return {string} String.
*/
ol.color.toString = function(color) {
_ol_color_.toString = function(color) {
var r = color[0];
if (r != (r | 0)) {
r = (r + 0.5) | 0;
@@ -211,3 +214,4 @@ ol.color.toString = function(color) {
var a = color[3] === undefined ? 1 : color[3];
return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
};
export default _ol_color_;

View File

@@ -1,6 +1,8 @@
goog.provide('ol.colorlike');
goog.require('ol.color');
/**
* @module ol/colorlike
*/
import _ol_color_ from './color.js';
var _ol_colorlike_ = {};
/**
@@ -8,11 +10,11 @@ goog.require('ol.color');
* @return {ol.ColorLike} The color as an ol.ColorLike
* @api
*/
ol.colorlike.asColorLike = function(color) {
if (ol.colorlike.isColorLike(color)) {
_ol_colorlike_.asColorLike = function(color) {
if (_ol_colorlike_.isColorLike(color)) {
return /** @type {string|CanvasPattern|CanvasGradient} */ (color);
} else {
return ol.color.asString(/** @type {ol.Color} */ (color));
return _ol_color_.asString(/** @type {ol.Color} */ (color));
}
};
@@ -21,10 +23,11 @@ ol.colorlike.asColorLike = function(color) {
* @param {?} color The value that is potentially an ol.ColorLike
* @return {boolean} Whether the color is an ol.ColorLike
*/
ol.colorlike.isColorLike = function(color) {
_ol_colorlike_.isColorLike = function(color) {
return (
typeof color === 'string' ||
color instanceof CanvasPattern ||
color instanceof CanvasGradient
);
};
export default _ol_colorlike_;

View File

@@ -1,9 +1,11 @@
goog.provide('ol.control');
goog.require('ol.Collection');
goog.require('ol.control.Attribution');
goog.require('ol.control.Rotate');
goog.require('ol.control.Zoom');
/**
* @module ol/control
*/
import _ol_Collection_ from './Collection.js';
import _ol_control_Attribution_ from './control/Attribution.js';
import _ol_control_Rotate_ from './control/Rotate.js';
import _ol_control_Zoom_ from './control/Zoom.js';
var _ol_control_ = {};
/**
@@ -18,28 +20,29 @@ goog.require('ol.control.Zoom');
* @return {ol.Collection.<ol.control.Control>} Controls.
* @api
*/
ol.control.defaults = function(opt_options) {
_ol_control_.defaults = function(opt_options) {
var options = opt_options ? opt_options : {};
var controls = new ol.Collection();
var controls = new _ol_Collection_();
var zoomControl = options.zoom !== undefined ? options.zoom : true;
if (zoomControl) {
controls.push(new ol.control.Zoom(options.zoomOptions));
controls.push(new _ol_control_Zoom_(options.zoomOptions));
}
var rotateControl = options.rotate !== undefined ? options.rotate : true;
if (rotateControl) {
controls.push(new ol.control.Rotate(options.rotateOptions));
controls.push(new _ol_control_Rotate_(options.rotateOptions));
}
var attributionControl = options.attribution !== undefined ?
options.attribution : true;
if (attributionControl) {
controls.push(new ol.control.Attribution(options.attributionOptions));
controls.push(new _ol_control_Attribution_(options.attributionOptions));
}
return controls;
};
export default _ol_control_;

View File

@@ -1,17 +1,17 @@
/**
* @module ol/control/Attribution
*/
// FIXME handle date line wrap
goog.provide('ol.control.Attribution');
goog.require('ol');
goog.require('ol.array');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.layer.Layer');
goog.require('ol.obj');
import _ol_ from '../index.js';
import _ol_array_ from '../array.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_css_ from '../css.js';
import _ol_dom_ from '../dom.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_layer_Layer_ from '../layer/Layer.js';
import _ol_obj_ from '../obj.js';
/**
* @classdesc
@@ -25,7 +25,7 @@ goog.require('ol.obj');
* @param {olx.control.AttributionOptions=} opt_options Attribution options.
* @api
*/
ol.control.Attribution = function(opt_options) {
var _ol_control_Attribution_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -99,10 +99,10 @@ ol.control.Attribution = function(opt_options) {
button.title = tipLabel;
button.appendChild(activeLabel);
ol.events.listen(button, ol.events.EventType.CLICK, this.handleClick_, this);
_ol_events_.listen(button, _ol_events_EventType_.CLICK, this.handleClick_, this);
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL +
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
_ol_css_.CLASS_CONTROL +
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
(this.collapsible_ ? '' : ' ol-uncollapsible');
var element = document.createElement('div');
@@ -110,9 +110,9 @@ ol.control.Attribution = function(opt_options) {
element.appendChild(this.ulElement_);
element.appendChild(button);
var render = options.render ? options.render : ol.control.Attribution.render;
var render = options.render ? options.render : _ol_control_Attribution_.render;
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: element,
render: render,
target: options.target
@@ -138,7 +138,8 @@ ol.control.Attribution = function(opt_options) {
this.logoElements_ = {};
};
ol.inherits(ol.control.Attribution, ol.control.Control);
_ol_.inherits(_ol_control_Attribution_, _ol_control_Control_);
/**
@@ -147,7 +148,7 @@ ol.inherits(ol.control.Attribution, ol.control.Control);
* @return {Array.<string>} Attributions.
* @private
*/
ol.control.Attribution.prototype.getSourceAttributions_ = function(frameState) {
_ol_control_Attribution_.prototype.getSourceAttributions_ = function(frameState) {
/**
* Used to determine if an attribution already exists.
* @type {Object.<string, boolean>}
@@ -164,7 +165,7 @@ ol.control.Attribution.prototype.getSourceAttributions_ = function(frameState) {
var resolution = frameState.viewState.resolution;
for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
var layerState = layerStatesArray[i];
if (!ol.layer.Layer.visibleAtResolution(layerState, resolution)) {
if (!_ol_layer_Layer_.visibleAtResolution(layerState, resolution)) {
continue;
}
@@ -207,7 +208,7 @@ ol.control.Attribution.prototype.getSourceAttributions_ = function(frameState) {
* @this {ol.control.Attribution}
* @api
*/
ol.control.Attribution.render = function(mapEvent) {
_ol_control_Attribution_.render = function(mapEvent) {
this.updateElement_(mapEvent.frameState);
};
@@ -216,7 +217,7 @@ ol.control.Attribution.render = function(mapEvent) {
* @private
* @param {?olx.FrameState} frameState Frame state.
*/
ol.control.Attribution.prototype.updateElement_ = function(frameState) {
_ol_control_Attribution_.prototype.updateElement_ = function(frameState) {
if (!frameState) {
if (this.renderedVisible_) {
this.element.style.display = 'none';
@@ -226,7 +227,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
}
var attributions = this.getSourceAttributions_(frameState);
if (ol.array.equals(attributions, this.renderedAttributions_)) {
if (_ol_array_.equals(attributions, this.renderedAttributions_)) {
return;
}
@@ -249,7 +250,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
this.element.classList.remove('ol-logo-only');
}
var visible = attributions.length > 0 || !ol.obj.isEmpty(frameState.logos);
var visible = attributions.length > 0 || !_ol_obj_.isEmpty(frameState.logos);
if (this.renderedVisible_ != visible) {
this.element.style.display = visible ? '' : 'none';
this.renderedVisible_ = visible;
@@ -264,7 +265,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
* @param {?olx.FrameState} frameState Frame state.
* @private
*/
ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
_ol_control_Attribution_.prototype.insertLogos_ = function(frameState) {
var logo;
var logos = frameState.logos;
@@ -272,7 +273,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
for (logo in logoElements) {
if (!(logo in logos)) {
ol.dom.removeNode(logoElements[logo]);
_ol_dom_.removeNode(logoElements[logo]);
delete logoElements[logo];
}
}
@@ -299,7 +300,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
}
}
this.logoLi_.style.display = !ol.obj.isEmpty(logos) ? '' : 'none';
this.logoLi_.style.display = !_ol_obj_.isEmpty(logos) ? '' : 'none';
};
@@ -308,7 +309,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
* @param {Event} event The event to handle
* @private
*/
ol.control.Attribution.prototype.handleClick_ = function(event) {
_ol_control_Attribution_.prototype.handleClick_ = function(event) {
event.preventDefault();
this.handleToggle_();
};
@@ -317,12 +318,12 @@ ol.control.Attribution.prototype.handleClick_ = function(event) {
/**
* @private
*/
ol.control.Attribution.prototype.handleToggle_ = function() {
_ol_control_Attribution_.prototype.handleToggle_ = function() {
this.element.classList.toggle('ol-collapsed');
if (this.collapsed_) {
ol.dom.replaceNode(this.collapseLabel_, this.label_);
_ol_dom_.replaceNode(this.collapseLabel_, this.label_);
} else {
ol.dom.replaceNode(this.label_, this.collapseLabel_);
_ol_dom_.replaceNode(this.label_, this.collapseLabel_);
}
this.collapsed_ = !this.collapsed_;
};
@@ -333,7 +334,7 @@ ol.control.Attribution.prototype.handleToggle_ = function() {
* @return {boolean} True if the widget is collapsible.
* @api
*/
ol.control.Attribution.prototype.getCollapsible = function() {
_ol_control_Attribution_.prototype.getCollapsible = function() {
return this.collapsible_;
};
@@ -343,7 +344,7 @@ ol.control.Attribution.prototype.getCollapsible = function() {
* @param {boolean} collapsible True if the widget is collapsible.
* @api
*/
ol.control.Attribution.prototype.setCollapsible = function(collapsible) {
_ol_control_Attribution_.prototype.setCollapsible = function(collapsible) {
if (this.collapsible_ === collapsible) {
return;
}
@@ -362,7 +363,7 @@ ol.control.Attribution.prototype.setCollapsible = function(collapsible) {
* @param {boolean} collapsed True if the widget is collapsed.
* @api
*/
ol.control.Attribution.prototype.setCollapsed = function(collapsed) {
_ol_control_Attribution_.prototype.setCollapsed = function(collapsed) {
if (!this.collapsible_ || this.collapsed_ === collapsed) {
return;
}
@@ -376,6 +377,7 @@ ol.control.Attribution.prototype.setCollapsed = function(collapsed) {
* @return {boolean} True if the widget is collapsed.
* @api
*/
ol.control.Attribution.prototype.getCollapsed = function() {
_ol_control_Attribution_.prototype.getCollapsed = function() {
return this.collapsed_;
};
export default _ol_control_Attribution_;

View File

@@ -1,11 +1,11 @@
goog.provide('ol.control.Control');
goog.require('ol');
goog.require('ol.MapEventType');
goog.require('ol.Object');
goog.require('ol.dom');
goog.require('ol.events');
/**
* @module ol/control/Control
*/
import _ol_ from '../index.js';
import _ol_MapEventType_ from '../MapEventType.js';
import _ol_Object_ from '../Object.js';
import _ol_dom_ from '../dom.js';
import _ol_events_ from '../events.js';
/**
* @classdesc
@@ -36,9 +36,9 @@ goog.require('ol.events');
* @param {olx.control.ControlOptions} options Control options.
* @api
*/
ol.control.Control = function(options) {
var _ol_control_Control_ = function(options) {
ol.Object.call(this);
_ol_Object_.call(this);
/**
* @protected
@@ -67,22 +67,23 @@ ol.control.Control = function(options) {
/**
* @type {function(ol.MapEvent)}
*/
this.render = options.render ? options.render : ol.nullFunction;
this.render = options.render ? options.render : _ol_.nullFunction;
if (options.target) {
this.setTarget(options.target);
}
};
ol.inherits(ol.control.Control, ol.Object);
_ol_.inherits(_ol_control_Control_, _ol_Object_);
/**
* @inheritDoc
*/
ol.control.Control.prototype.disposeInternal = function() {
ol.dom.removeNode(this.element);
ol.Object.prototype.disposeInternal.call(this);
_ol_control_Control_.prototype.disposeInternal = function() {
_ol_dom_.removeNode(this.element);
_ol_Object_.prototype.disposeInternal.call(this);
};
@@ -91,7 +92,7 @@ ol.control.Control.prototype.disposeInternal = function() {
* @return {ol.PluggableMap} Map.
* @api
*/
ol.control.Control.prototype.getMap = function() {
_ol_control_Control_.prototype.getMap = function() {
return this.map_;
};
@@ -104,12 +105,12 @@ ol.control.Control.prototype.getMap = function() {
* @override
* @api
*/
ol.control.Control.prototype.setMap = function(map) {
_ol_control_Control_.prototype.setMap = function(map) {
if (this.map_) {
ol.dom.removeNode(this.element);
_ol_dom_.removeNode(this.element);
}
for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
ol.events.unlistenByKey(this.listenerKeys[i]);
_ol_events_.unlistenByKey(this.listenerKeys[i]);
}
this.listenerKeys.length = 0;
this.map_ = map;
@@ -117,9 +118,9 @@ ol.control.Control.prototype.setMap = function(map) {
var target = this.target_ ?
this.target_ : map.getOverlayContainerStopEvent();
target.appendChild(this.element);
if (this.render !== ol.nullFunction) {
this.listenerKeys.push(ol.events.listen(map,
ol.MapEventType.POSTRENDER, this.render, this));
if (this.render !== _ol_.nullFunction) {
this.listenerKeys.push(_ol_events_.listen(map,
_ol_MapEventType_.POSTRENDER, this.render, this));
}
map.render();
}
@@ -135,8 +136,9 @@ ol.control.Control.prototype.setMap = function(map) {
* @param {Element|string} target Target.
* @api
*/
ol.control.Control.prototype.setTarget = function(target) {
_ol_control_Control_.prototype.setTarget = function(target) {
this.target_ = typeof target === 'string' ?
document.getElementById(target) :
target;
};
export default _ol_control_Control_;

View File

@@ -1,12 +1,12 @@
goog.provide('ol.control.FullScreen');
goog.require('ol');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.events.EventType');
/**
* @module ol/control/FullScreen
*/
import _ol_ from '../index.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_css_ from '../css.js';
import _ol_dom_ from '../dom.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
/**
* @classdesc
@@ -25,7 +25,7 @@ goog.require('ol.events.EventType');
* @param {olx.control.FullScreenOptions=} opt_options Options.
* @api
*/
ol.control.FullScreen = function(opt_options) {
var _ol_control_FullScreen_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -56,22 +56,22 @@ ol.control.FullScreen = function(opt_options) {
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
var button = document.createElement('button');
button.className = this.cssClassName_ + '-' + ol.control.FullScreen.isFullScreen();
button.className = this.cssClassName_ + '-' + _ol_control_FullScreen_.isFullScreen();
button.setAttribute('type', 'button');
button.title = tipLabel;
button.appendChild(this.labelNode_);
ol.events.listen(button, ol.events.EventType.CLICK,
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
this.handleClick_, this);
var cssClasses = this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE +
' ' + ol.css.CLASS_CONTROL + ' ' +
(!ol.control.FullScreen.isFullScreenSupported() ? ol.css.CLASS_UNSUPPORTED : '');
var cssClasses = this.cssClassName_ + ' ' + _ol_css_.CLASS_UNSELECTABLE +
' ' + _ol_css_.CLASS_CONTROL + ' ' +
(!_ol_control_FullScreen_.isFullScreenSupported() ? _ol_css_.CLASS_UNSUPPORTED : '');
var element = document.createElement('div');
element.className = cssClasses;
element.appendChild(button);
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: element,
target: options.target
});
@@ -89,14 +89,15 @@ ol.control.FullScreen = function(opt_options) {
this.source_ = options.source;
};
ol.inherits(ol.control.FullScreen, ol.control.Control);
_ol_.inherits(_ol_control_FullScreen_, _ol_control_Control_);
/**
* @param {Event} event The event to handle
* @private
*/
ol.control.FullScreen.prototype.handleClick_ = function(event) {
_ol_control_FullScreen_.prototype.handleClick_ = function(event) {
event.preventDefault();
this.handleFullScreen_();
};
@@ -105,16 +106,16 @@ ol.control.FullScreen.prototype.handleClick_ = function(event) {
/**
* @private
*/
ol.control.FullScreen.prototype.handleFullScreen_ = function() {
if (!ol.control.FullScreen.isFullScreenSupported()) {
_ol_control_FullScreen_.prototype.handleFullScreen_ = function() {
if (!_ol_control_FullScreen_.isFullScreenSupported()) {
return;
}
var map = this.getMap();
if (!map) {
return;
}
if (ol.control.FullScreen.isFullScreen()) {
ol.control.FullScreen.exitFullScreen();
if (_ol_control_FullScreen_.isFullScreen()) {
_ol_control_FullScreen_.exitFullScreen();
} else {
var element;
if (this.source_) {
@@ -125,10 +126,10 @@ ol.control.FullScreen.prototype.handleFullScreen_ = function() {
element = map.getTargetElement();
}
if (this.keys_) {
ol.control.FullScreen.requestFullScreenWithKeys(element);
_ol_control_FullScreen_.requestFullScreenWithKeys(element);
} else {
ol.control.FullScreen.requestFullScreen(element);
_ol_control_FullScreen_.requestFullScreen(element);
}
}
};
@@ -137,15 +138,15 @@ ol.control.FullScreen.prototype.handleFullScreen_ = function() {
/**
* @private
*/
ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
_ol_control_FullScreen_.prototype.handleFullScreenChange_ = function() {
var button = this.element.firstElementChild;
var map = this.getMap();
if (ol.control.FullScreen.isFullScreen()) {
if (_ol_control_FullScreen_.isFullScreen()) {
button.className = this.cssClassName_ + '-true';
ol.dom.replaceNode(this.labelActiveNode_, this.labelNode_);
_ol_dom_.replaceNode(this.labelActiveNode_, this.labelNode_);
} else {
button.className = this.cssClassName_ + '-false';
ol.dom.replaceNode(this.labelNode_, this.labelActiveNode_);
_ol_dom_.replaceNode(this.labelNode_, this.labelActiveNode_);
}
if (map) {
map.updateSize();
@@ -157,11 +158,11 @@ ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
* @inheritDoc
* @api
*/
ol.control.FullScreen.prototype.setMap = function(map) {
ol.control.Control.prototype.setMap.call(this, map);
_ol_control_FullScreen_.prototype.setMap = function(map) {
_ol_control_Control_.prototype.setMap.call(this, map);
if (map) {
this.listenerKeys.push(ol.events.listen(document,
ol.control.FullScreen.getChangeType_(),
this.listenerKeys.push(_ol_events_.listen(document,
_ol_control_FullScreen_.getChangeType_(),
this.handleFullScreenChange_, this)
);
}
@@ -170,7 +171,7 @@ ol.control.FullScreen.prototype.setMap = function(map) {
/**
* @return {boolean} Fullscreen is supported by the current platform.
*/
ol.control.FullScreen.isFullScreenSupported = function() {
_ol_control_FullScreen_.isFullScreenSupported = function() {
var body = document.body;
return !!(
body.webkitRequestFullscreen ||
@@ -183,7 +184,7 @@ ol.control.FullScreen.isFullScreenSupported = function() {
/**
* @return {boolean} Element is currently in fullscreen.
*/
ol.control.FullScreen.isFullScreen = function() {
_ol_control_FullScreen_.isFullScreen = function() {
return !!(
document.webkitIsFullScreen || document.mozFullScreen ||
document.msFullscreenElement || document.fullscreenElement
@@ -194,7 +195,7 @@ ol.control.FullScreen.isFullScreen = function() {
* Request to fullscreen an element.
* @param {Node} element Element to request fullscreen
*/
ol.control.FullScreen.requestFullScreen = function(element) {
_ol_control_FullScreen_.requestFullScreen = function(element) {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.msRequestFullscreen) {
@@ -210,20 +211,20 @@ ol.control.FullScreen.requestFullScreen = function(element) {
* Request to fullscreen an element with keyboard input.
* @param {Node} element Element to request fullscreen
*/
ol.control.FullScreen.requestFullScreenWithKeys = function(element) {
_ol_control_FullScreen_.requestFullScreenWithKeys = function(element) {
if (element.mozRequestFullScreenWithKeys) {
element.mozRequestFullScreenWithKeys();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
} else {
ol.control.FullScreen.requestFullScreen(element);
_ol_control_FullScreen_.requestFullScreen(element);
}
};
/**
* Exit fullscreen.
*/
ol.control.FullScreen.exitFullScreen = function() {
_ol_control_FullScreen_.exitFullScreen = function() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
@@ -239,7 +240,7 @@ ol.control.FullScreen.exitFullScreen = function() {
* @return {string} Change type.
* @private
*/
ol.control.FullScreen.getChangeType_ = (function() {
_ol_control_FullScreen_.getChangeType_ = (function() {
var changeType;
return function() {
if (!changeType) {
@@ -257,3 +258,4 @@ ol.control.FullScreen.getChangeType_ = (function() {
return changeType;
};
})();
export default _ol_control_FullScreen_;

View File

@@ -1,14 +1,14 @@
/**
* @module ol/control/MousePosition
*/
// FIXME should listen on appropriate pane, once it is defined
goog.provide('ol.control.MousePosition');
goog.require('ol');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.Object');
goog.require('ol.control.Control');
goog.require('ol.proj');
import _ol_ from '../index.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_Object_ from '../Object.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -23,7 +23,7 @@ goog.require('ol.proj');
* options.
* @api
*/
ol.control.MousePosition = function(opt_options) {
var _ol_control_MousePosition_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -31,16 +31,16 @@ ol.control.MousePosition = function(opt_options) {
element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
var render = options.render ?
options.render : ol.control.MousePosition.render;
options.render : _ol_control_MousePosition_.render;
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: element,
render: render,
target: options.target
});
ol.events.listen(this,
ol.Object.getChangeEventType(ol.control.MousePosition.Property_.PROJECTION),
_ol_events_.listen(this,
_ol_Object_.getChangeEventType(_ol_control_MousePosition_.Property_.PROJECTION),
this.handleProjectionChanged_, this);
if (options.coordinateFormat) {
@@ -81,7 +81,8 @@ ol.control.MousePosition = function(opt_options) {
this.lastMouseMovePixel_ = null;
};
ol.inherits(ol.control.MousePosition, ol.control.Control);
_ol_.inherits(_ol_control_MousePosition_, _ol_control_Control_);
/**
@@ -90,7 +91,7 @@ ol.inherits(ol.control.MousePosition, ol.control.Control);
* @this {ol.control.MousePosition}
* @api
*/
ol.control.MousePosition.render = function(mapEvent) {
_ol_control_MousePosition_.render = function(mapEvent) {
var frameState = mapEvent.frameState;
if (!frameState) {
this.mapProjection_ = null;
@@ -107,7 +108,7 @@ ol.control.MousePosition.render = function(mapEvent) {
/**
* @private
*/
ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
_ol_control_MousePosition_.prototype.handleProjectionChanged_ = function() {
this.transform_ = null;
};
@@ -120,9 +121,10 @@ ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
* @observable
* @api
*/
ol.control.MousePosition.prototype.getCoordinateFormat = function() {
return /** @type {ol.CoordinateFormatType|undefined} */ (
this.get(ol.control.MousePosition.Property_.COORDINATE_FORMAT));
_ol_control_MousePosition_.prototype.getCoordinateFormat = function() {
return (
/** @type {ol.CoordinateFormatType|undefined} */ this.get(_ol_control_MousePosition_.Property_.COORDINATE_FORMAT)
);
};
@@ -133,9 +135,10 @@ ol.control.MousePosition.prototype.getCoordinateFormat = function() {
* @observable
* @api
*/
ol.control.MousePosition.prototype.getProjection = function() {
return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.control.MousePosition.Property_.PROJECTION));
_ol_control_MousePosition_.prototype.getProjection = function() {
return (
/** @type {ol.proj.Projection|undefined} */ this.get(_ol_control_MousePosition_.Property_.PROJECTION)
);
};
@@ -143,7 +146,7 @@ ol.control.MousePosition.prototype.getProjection = function() {
* @param {Event} event Browser event.
* @protected
*/
ol.control.MousePosition.prototype.handleMouseMove = function(event) {
_ol_control_MousePosition_.prototype.handleMouseMove = function(event) {
var map = this.getMap();
this.lastMouseMovePixel_ = map.getEventPixel(event);
this.updateHTML_(this.lastMouseMovePixel_);
@@ -154,7 +157,7 @@ ol.control.MousePosition.prototype.handleMouseMove = function(event) {
* @param {Event} event Browser event.
* @protected
*/
ol.control.MousePosition.prototype.handleMouseOut = function(event) {
_ol_control_MousePosition_.prototype.handleMouseOut = function(event) {
this.updateHTML_(null);
this.lastMouseMovePixel_ = null;
};
@@ -164,14 +167,14 @@ ol.control.MousePosition.prototype.handleMouseOut = function(event) {
* @inheritDoc
* @api
*/
ol.control.MousePosition.prototype.setMap = function(map) {
ol.control.Control.prototype.setMap.call(this, map);
_ol_control_MousePosition_.prototype.setMap = function(map) {
_ol_control_Control_.prototype.setMap.call(this, map);
if (map) {
var viewport = map.getViewport();
this.listenerKeys.push(
ol.events.listen(viewport, ol.events.EventType.MOUSEMOVE,
_ol_events_.listen(viewport, _ol_events_EventType_.MOUSEMOVE,
this.handleMouseMove, this),
ol.events.listen(viewport, ol.events.EventType.MOUSEOUT,
_ol_events_.listen(viewport, _ol_events_EventType_.MOUSEOUT,
this.handleMouseOut, this)
);
}
@@ -185,8 +188,8 @@ ol.control.MousePosition.prototype.setMap = function(map) {
* @observable
* @api
*/
ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
this.set(ol.control.MousePosition.Property_.COORDINATE_FORMAT, format);
_ol_control_MousePosition_.prototype.setCoordinateFormat = function(format) {
this.set(_ol_control_MousePosition_.Property_.COORDINATE_FORMAT, format);
};
@@ -197,8 +200,8 @@ ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
* @observable
* @api
*/
ol.control.MousePosition.prototype.setProjection = function(projection) {
this.set(ol.control.MousePosition.Property_.PROJECTION, ol.proj.get(projection));
_ol_control_MousePosition_.prototype.setProjection = function(projection) {
this.set(_ol_control_MousePosition_.Property_.PROJECTION, _ol_proj_.get(projection));
};
@@ -206,16 +209,16 @@ ol.control.MousePosition.prototype.setProjection = function(projection) {
* @param {?ol.Pixel} pixel Pixel.
* @private
*/
ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
_ol_control_MousePosition_.prototype.updateHTML_ = function(pixel) {
var html = this.undefinedHTML_;
if (pixel && this.mapProjection_) {
if (!this.transform_) {
var projection = this.getProjection();
if (projection) {
this.transform_ = ol.proj.getTransformFromProjections(
this.transform_ = _ol_proj_.getTransformFromProjections(
this.mapProjection_, projection);
} else {
this.transform_ = ol.proj.identityTransform;
this.transform_ = _ol_proj_.identityTransform;
}
}
var map = this.getMap();
@@ -241,7 +244,8 @@ ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
* @enum {string}
* @private
*/
ol.control.MousePosition.Property_ = {
_ol_control_MousePosition_.Property_ = {
PROJECTION: 'projection',
COORDINATE_FORMAT: 'coordinateFormat'
};
export default _ol_control_MousePosition_;

View File

@@ -1,23 +1,23 @@
goog.provide('ol.control.OverviewMap');
goog.require('ol');
goog.require('ol.Collection');
goog.require('ol.PluggableMap');
goog.require('ol.MapEventType');
goog.require('ol.MapProperty');
goog.require('ol.Object');
goog.require('ol.ObjectEventType');
goog.require('ol.Overlay');
goog.require('ol.OverlayPositioning');
goog.require('ol.ViewProperty');
goog.require('ol.control.Control');
goog.require('ol.coordinate');
goog.require('ol.css');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.extent');
/**
* @module ol/control/OverviewMap
*/
import _ol_ from '../index.js';
import _ol_Collection_ from '../Collection.js';
import _ol_PluggableMap_ from '../PluggableMap.js';
import _ol_MapEventType_ from '../MapEventType.js';
import _ol_MapProperty_ from '../MapProperty.js';
import _ol_Object_ from '../Object.js';
import _ol_ObjectEventType_ from '../ObjectEventType.js';
import _ol_Overlay_ from '../Overlay.js';
import _ol_OverlayPositioning_ from '../OverlayPositioning.js';
import _ol_ViewProperty_ from '../ViewProperty.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_coordinate_ from '../coordinate.js';
import _ol_css_ from '../css.js';
import _ol_dom_ from '../dom.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_extent_ from '../extent.js';
/**
* Create a new control with a map acting as an overview map for an other
@@ -27,7 +27,7 @@ goog.require('ol.extent');
* @param {olx.control.OverviewMapOptions=} opt_options OverviewMap options.
* @api
*/
ol.control.OverviewMap = function(opt_options) {
var _ol_control_OverviewMap_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -86,7 +86,7 @@ ol.control.OverviewMap = function(opt_options) {
button.title = tipLabel;
button.appendChild(activeLabel);
ol.events.listen(button, ol.events.EventType.CLICK,
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
this.handleClick_, this);
/**
@@ -100,9 +100,9 @@ ol.control.OverviewMap = function(opt_options) {
* @type {ol.PluggableMap}
* @private
*/
this.ovmap_ = new ol.PluggableMap({
controls: new ol.Collection(),
interactions: new ol.Collection(),
this.ovmap_ = new _ol_PluggableMap_({
controls: new _ol_Collection_(),
interactions: new _ol_Collection_(),
view: options.view
});
var ovmap = this.ovmap_;
@@ -125,15 +125,15 @@ ol.control.OverviewMap = function(opt_options) {
* @type {ol.Overlay}
* @private
*/
this.boxOverlay_ = new ol.Overlay({
this.boxOverlay_ = new _ol_Overlay_({
position: [0, 0],
positioning: ol.OverlayPositioning.BOTTOM_LEFT,
positioning: _ol_OverlayPositioning_.BOTTOM_LEFT,
element: box
});
this.ovmap_.addOverlay(this.boxOverlay_);
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL +
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
_ol_css_.CLASS_CONTROL +
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
(this.collapsible_ ? '' : ' ol-uncollapsible');
var element = document.createElement('div');
@@ -141,9 +141,9 @@ ol.control.OverviewMap = function(opt_options) {
element.appendChild(this.ovmapDiv_);
element.appendChild(button);
var render = options.render ? options.render : ol.control.OverviewMap.render;
var render = options.render ? options.render : _ol_control_OverviewMap_.render;
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: element,
render: render,
target: options.target
@@ -187,14 +187,15 @@ ol.control.OverviewMap = function(opt_options) {
window.addEventListener('mouseup', endMoving);
});
};
ol.inherits(ol.control.OverviewMap, ol.control.Control);
_ol_.inherits(_ol_control_OverviewMap_, _ol_control_Control_);
/**
* @inheritDoc
* @api
*/
ol.control.OverviewMap.prototype.setMap = function(map) {
_ol_control_OverviewMap_.prototype.setMap = function(map) {
var oldMap = this.getMap();
if (map === oldMap) {
return;
@@ -206,12 +207,12 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
}
this.ovmap_.setTarget(null);
}
ol.control.Control.prototype.setMap.call(this, map);
_ol_control_Control_.prototype.setMap.call(this, map);
if (map) {
this.ovmap_.setTarget(this.ovmapDiv_);
this.listenerKeys.push(ol.events.listen(
map, ol.ObjectEventType.PROPERTYCHANGE,
this.listenerKeys.push(_ol_events_.listen(
map, _ol_ObjectEventType_.PROPERTYCHANGE,
this.handleMapPropertyChange_, this));
// TODO: to really support map switching, this would need to be reworked
@@ -236,8 +237,8 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
* @param {ol.Object.Event} event The propertychange event.
* @private
*/
ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
if (event.key === ol.MapProperty.VIEW) {
_ol_control_OverviewMap_.prototype.handleMapPropertyChange_ = function(event) {
if (event.key === _ol_MapProperty_.VIEW) {
var oldView = /** @type {ol.View} */ (event.oldValue);
if (oldView) {
this.unbindView_(oldView);
@@ -253,9 +254,9 @@ ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
* @param {ol.View} view The view.
* @private
*/
ol.control.OverviewMap.prototype.bindView_ = function(view) {
ol.events.listen(view,
ol.Object.getChangeEventType(ol.ViewProperty.ROTATION),
_ol_control_OverviewMap_.prototype.bindView_ = function(view) {
_ol_events_.listen(view,
_ol_Object_.getChangeEventType(_ol_ViewProperty_.ROTATION),
this.handleRotationChanged_, this);
};
@@ -265,9 +266,9 @@ ol.control.OverviewMap.prototype.bindView_ = function(view) {
* @param {ol.View} view The view.
* @private
*/
ol.control.OverviewMap.prototype.unbindView_ = function(view) {
ol.events.unlisten(view,
ol.Object.getChangeEventType(ol.ViewProperty.ROTATION),
_ol_control_OverviewMap_.prototype.unbindView_ = function(view) {
_ol_events_.unlisten(view,
_ol_Object_.getChangeEventType(_ol_ViewProperty_.ROTATION),
this.handleRotationChanged_, this);
};
@@ -278,7 +279,7 @@ ol.control.OverviewMap.prototype.unbindView_ = function(view) {
* overview map's view.
* @private
*/
ol.control.OverviewMap.prototype.handleRotationChanged_ = function() {
_ol_control_OverviewMap_.prototype.handleRotationChanged_ = function() {
this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());
};
@@ -289,7 +290,7 @@ ol.control.OverviewMap.prototype.handleRotationChanged_ = function() {
* @this {ol.control.OverviewMap}
* @api
*/
ol.control.OverviewMap.render = function(mapEvent) {
_ol_control_OverviewMap_.render = function(mapEvent) {
this.validateExtent_();
this.updateBox_();
};
@@ -306,7 +307,7 @@ ol.control.OverviewMap.render = function(mapEvent) {
* main map center location.
* @private
*/
ol.control.OverviewMap.prototype.validateExtent_ = function() {
_ol_control_OverviewMap_.prototype.validateExtent_ = function() {
var map = this.getMap();
var ovmap = this.ovmap_;
@@ -325,9 +326,9 @@ ol.control.OverviewMap.prototype.validateExtent_ = function() {
var ovextent = ovview.calculateExtent(ovmapSize);
var topLeftPixel =
ovmap.getPixelFromCoordinate(ol.extent.getTopLeft(extent));
ovmap.getPixelFromCoordinate(_ol_extent_.getTopLeft(extent));
var bottomRightPixel =
ovmap.getPixelFromCoordinate(ol.extent.getBottomRight(extent));
ovmap.getPixelFromCoordinate(_ol_extent_.getBottomRight(extent));
var boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);
var boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);
@@ -335,12 +336,12 @@ ol.control.OverviewMap.prototype.validateExtent_ = function() {
var ovmapWidth = ovmapSize[0];
var ovmapHeight = ovmapSize[1];
if (boxWidth < ovmapWidth * ol.OVERVIEWMAP_MIN_RATIO ||
boxHeight < ovmapHeight * ol.OVERVIEWMAP_MIN_RATIO ||
boxWidth > ovmapWidth * ol.OVERVIEWMAP_MAX_RATIO ||
boxHeight > ovmapHeight * ol.OVERVIEWMAP_MAX_RATIO) {
if (boxWidth < ovmapWidth * _ol_.OVERVIEWMAP_MIN_RATIO ||
boxHeight < ovmapHeight * _ol_.OVERVIEWMAP_MIN_RATIO ||
boxWidth > ovmapWidth * _ol_.OVERVIEWMAP_MAX_RATIO ||
boxHeight > ovmapHeight * _ol_.OVERVIEWMAP_MAX_RATIO) {
this.resetExtent_();
} else if (!ol.extent.containsExtent(ovextent, extent)) {
} else if (!_ol_extent_.containsExtent(ovextent, extent)) {
this.recenter_();
}
};
@@ -351,8 +352,8 @@ ol.control.OverviewMap.prototype.validateExtent_ = function() {
* the extent of the main map.
* @private
*/
ol.control.OverviewMap.prototype.resetExtent_ = function() {
if (ol.OVERVIEWMAP_MAX_RATIO === 0 || ol.OVERVIEWMAP_MIN_RATIO === 0) {
_ol_control_OverviewMap_.prototype.resetExtent_ = function() {
if (_ol_.OVERVIEWMAP_MAX_RATIO === 0 || _ol_.OVERVIEWMAP_MIN_RATIO === 0) {
return;
}
@@ -370,9 +371,9 @@ ol.control.OverviewMap.prototype.resetExtent_ = function() {
// box sizes using the min and max ratio, pick the step in the middle used
// to calculate the extent from the main map to set it to the overview map,
var steps = Math.log(
ol.OVERVIEWMAP_MAX_RATIO / ol.OVERVIEWMAP_MIN_RATIO) / Math.LN2;
var ratio = 1 / (Math.pow(2, steps / 2) * ol.OVERVIEWMAP_MIN_RATIO);
ol.extent.scaleFromCenter(extent, ratio);
_ol_.OVERVIEWMAP_MAX_RATIO / _ol_.OVERVIEWMAP_MIN_RATIO) / Math.LN2;
var ratio = 1 / (Math.pow(2, steps / 2) * _ol_.OVERVIEWMAP_MIN_RATIO);
_ol_extent_.scaleFromCenter(extent, ratio);
ovview.fit(extent);
};
@@ -382,7 +383,7 @@ ol.control.OverviewMap.prototype.resetExtent_ = function() {
* resolution.
* @private
*/
ol.control.OverviewMap.prototype.recenter_ = function() {
_ol_control_OverviewMap_.prototype.recenter_ = function() {
var map = this.getMap();
var ovmap = this.ovmap_;
@@ -398,7 +399,7 @@ ol.control.OverviewMap.prototype.recenter_ = function() {
* Update the box using the main map extent
* @private
*/
ol.control.OverviewMap.prototype.updateBox_ = function() {
_ol_control_OverviewMap_.prototype.updateBox_ = function() {
var map = this.getMap();
var ovmap = this.ovmap_;
@@ -418,8 +419,8 @@ ol.control.OverviewMap.prototype.updateBox_ = function() {
var box = this.boxOverlay_.getElement();
var extent = view.calculateExtent(mapSize);
var ovresolution = ovview.getResolution();
var bottomLeft = ol.extent.getBottomLeft(extent);
var topRight = ol.extent.getTopRight(extent);
var bottomLeft = _ol_extent_.getBottomLeft(extent);
var topRight = _ol_extent_.getTopRight(extent);
// set position using bottom left coordinates
var rotateBottomLeft = this.calculateCoordinateRotate_(rotation, bottomLeft);
@@ -439,7 +440,7 @@ ol.control.OverviewMap.prototype.updateBox_ = function() {
* @return {ol.Coordinate|undefined} Coordinate for rotation and center anchor.
* @private
*/
ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function(
_ol_control_OverviewMap_.prototype.calculateCoordinateRotate_ = function(
rotation, coordinate) {
var coordinateRotate;
@@ -453,8 +454,8 @@ ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function(
coordinate[0] - currentCenter[0],
coordinate[1] - currentCenter[1]
];
ol.coordinate.rotate(coordinateRotate, rotation);
ol.coordinate.add(coordinateRotate, currentCenter);
_ol_coordinate_.rotate(coordinateRotate, rotation);
_ol_coordinate_.add(coordinateRotate, currentCenter);
}
return coordinateRotate;
};
@@ -464,7 +465,7 @@ ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function(
* @param {Event} event The event to handle
* @private
*/
ol.control.OverviewMap.prototype.handleClick_ = function(event) {
_ol_control_OverviewMap_.prototype.handleClick_ = function(event) {
event.preventDefault();
this.handleToggle_();
};
@@ -473,12 +474,12 @@ ol.control.OverviewMap.prototype.handleClick_ = function(event) {
/**
* @private
*/
ol.control.OverviewMap.prototype.handleToggle_ = function() {
_ol_control_OverviewMap_.prototype.handleToggle_ = function() {
this.element.classList.toggle('ol-collapsed');
if (this.collapsed_) {
ol.dom.replaceNode(this.collapseLabel_, this.label_);
_ol_dom_.replaceNode(this.collapseLabel_, this.label_);
} else {
ol.dom.replaceNode(this.label_, this.collapseLabel_);
_ol_dom_.replaceNode(this.label_, this.collapseLabel_);
}
this.collapsed_ = !this.collapsed_;
@@ -488,7 +489,7 @@ ol.control.OverviewMap.prototype.handleToggle_ = function() {
if (!this.collapsed_ && !ovmap.isRendered()) {
ovmap.updateSize();
this.resetExtent_();
ol.events.listenOnce(ovmap, ol.MapEventType.POSTRENDER,
_ol_events_.listenOnce(ovmap, _ol_MapEventType_.POSTRENDER,
function(event) {
this.updateBox_();
},
@@ -502,7 +503,7 @@ ol.control.OverviewMap.prototype.handleToggle_ = function() {
* @return {boolean} True if the widget is collapsible.
* @api
*/
ol.control.OverviewMap.prototype.getCollapsible = function() {
_ol_control_OverviewMap_.prototype.getCollapsible = function() {
return this.collapsible_;
};
@@ -512,7 +513,7 @@ ol.control.OverviewMap.prototype.getCollapsible = function() {
* @param {boolean} collapsible True if the widget is collapsible.
* @api
*/
ol.control.OverviewMap.prototype.setCollapsible = function(collapsible) {
_ol_control_OverviewMap_.prototype.setCollapsible = function(collapsible) {
if (this.collapsible_ === collapsible) {
return;
}
@@ -531,7 +532,7 @@ ol.control.OverviewMap.prototype.setCollapsible = function(collapsible) {
* @param {boolean} collapsed True if the widget is collapsed.
* @api
*/
ol.control.OverviewMap.prototype.setCollapsed = function(collapsed) {
_ol_control_OverviewMap_.prototype.setCollapsed = function(collapsed) {
if (!this.collapsible_ || this.collapsed_ === collapsed) {
return;
}
@@ -544,7 +545,7 @@ ol.control.OverviewMap.prototype.setCollapsed = function(collapsed) {
* @return {boolean} The overview map is collapsed.
* @api
*/
ol.control.OverviewMap.prototype.getCollapsed = function() {
_ol_control_OverviewMap_.prototype.getCollapsed = function() {
return this.collapsed_;
};
@@ -554,6 +555,7 @@ ol.control.OverviewMap.prototype.getCollapsed = function() {
* @return {ol.PluggableMap} Overview map.
* @api
*/
ol.control.OverviewMap.prototype.getOverviewMap = function() {
_ol_control_OverviewMap_.prototype.getOverviewMap = function() {
return this.ovmap_;
};
export default _ol_control_OverviewMap_;

View File

@@ -1,12 +1,12 @@
goog.provide('ol.control.Rotate');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
/**
* @module ol/control/Rotate
*/
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_ from '../index.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_css_ from '../css.js';
import _ol_easing_ from '../easing.js';
/**
* @classdesc
@@ -19,7 +19,7 @@ goog.require('ol.easing');
* @param {olx.control.RotateOptions=} opt_options Rotate options.
* @api
*/
ol.control.Rotate = function(opt_options) {
var _ol_control_Rotate_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -50,20 +50,20 @@ ol.control.Rotate = function(opt_options) {
button.title = tipLabel;
button.appendChild(this.label_);
ol.events.listen(button, ol.events.EventType.CLICK,
ol.control.Rotate.prototype.handleClick_, this);
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
_ol_control_Rotate_.prototype.handleClick_, this);
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL;
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
_ol_css_.CLASS_CONTROL;
var element = document.createElement('div');
element.className = cssClasses;
element.appendChild(button);
var render = options.render ? options.render : ol.control.Rotate.render;
var render = options.render ? options.render : _ol_control_Rotate_.render;
this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: element,
render: render,
target: options.target
@@ -88,18 +88,19 @@ ol.control.Rotate = function(opt_options) {
this.rotation_ = undefined;
if (this.autoHide_) {
this.element.classList.add(ol.css.CLASS_HIDDEN);
this.element.classList.add(_ol_css_.CLASS_HIDDEN);
}
};
ol.inherits(ol.control.Rotate, ol.control.Control);
_ol_.inherits(_ol_control_Rotate_, _ol_control_Control_);
/**
* @param {Event} event The event to handle
* @private
*/
ol.control.Rotate.prototype.handleClick_ = function(event) {
_ol_control_Rotate_.prototype.handleClick_ = function(event) {
event.preventDefault();
if (this.callResetNorth_ !== undefined) {
this.callResetNorth_();
@@ -112,7 +113,7 @@ ol.control.Rotate.prototype.handleClick_ = function(event) {
/**
* @private
*/
ol.control.Rotate.prototype.resetNorth_ = function() {
_ol_control_Rotate_.prototype.resetNorth_ = function() {
var map = this.getMap();
var view = map.getView();
if (!view) {
@@ -125,7 +126,7 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
view.animate({
rotation: 0,
duration: this.duration_,
easing: ol.easing.easeOut
easing: _ol_easing_.easeOut
});
} else {
view.setRotation(0);
@@ -140,7 +141,7 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
* @this {ol.control.Rotate}
* @api
*/
ol.control.Rotate.render = function(mapEvent) {
_ol_control_Rotate_.render = function(mapEvent) {
var frameState = mapEvent.frameState;
if (!frameState) {
return;
@@ -149,11 +150,11 @@ ol.control.Rotate.render = function(mapEvent) {
if (rotation != this.rotation_) {
var transform = 'rotate(' + rotation + 'rad)';
if (this.autoHide_) {
var contains = this.element.classList.contains(ol.css.CLASS_HIDDEN);
var contains = this.element.classList.contains(_ol_css_.CLASS_HIDDEN);
if (!contains && rotation === 0) {
this.element.classList.add(ol.css.CLASS_HIDDEN);
this.element.classList.add(_ol_css_.CLASS_HIDDEN);
} else if (contains && rotation !== 0) {
this.element.classList.remove(ol.css.CLASS_HIDDEN);
this.element.classList.remove(_ol_css_.CLASS_HIDDEN);
}
}
this.label_.style.msTransform = transform;
@@ -162,3 +163,4 @@ ol.control.Rotate.render = function(mapEvent) {
}
this.rotation_ = rotation;
};
export default _ol_control_Rotate_;

View File

@@ -1,15 +1,15 @@
goog.provide('ol.control.ScaleLine');
goog.require('ol');
goog.require('ol.Object');
goog.require('ol.asserts');
goog.require('ol.control.Control');
goog.require('ol.control.ScaleLineUnits');
goog.require('ol.css');
goog.require('ol.events');
goog.require('ol.proj');
goog.require('ol.proj.Units');
/**
* @module ol/control/ScaleLine
*/
import _ol_ from '../index.js';
import _ol_Object_ from '../Object.js';
import _ol_asserts_ from '../asserts.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_control_ScaleLineUnits_ from '../control/ScaleLineUnits.js';
import _ol_css_ from '../css.js';
import _ol_events_ from '../events.js';
import _ol_proj_ from '../proj.js';
import _ol_proj_Units_ from '../proj/Units.js';
/**
* @classdesc
@@ -26,7 +26,7 @@ goog.require('ol.proj.Units');
* @param {olx.control.ScaleLineOptions=} opt_options Scale line options.
* @api
*/
ol.control.ScaleLine = function(opt_options) {
var _ol_control_ScaleLine_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -44,7 +44,7 @@ ol.control.ScaleLine = function(opt_options) {
* @type {Element}
*/
this.element_ = document.createElement('DIV');
this.element_.className = className + ' ' + ol.css.CLASS_UNSELECTABLE;
this.element_.className = className + ' ' + _ol_css_.CLASS_UNSELECTABLE;
this.element_.appendChild(this.innerElement_);
/**
@@ -77,30 +77,31 @@ ol.control.ScaleLine = function(opt_options) {
*/
this.renderedHTML_ = '';
var render = options.render ? options.render : ol.control.ScaleLine.render;
var render = options.render ? options.render : _ol_control_ScaleLine_.render;
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: this.element_,
render: render,
target: options.target
});
ol.events.listen(
this, ol.Object.getChangeEventType(ol.control.ScaleLine.Property_.UNITS),
_ol_events_.listen(
this, _ol_Object_.getChangeEventType(_ol_control_ScaleLine_.Property_.UNITS),
this.handleUnitsChanged_, this);
this.setUnits(/** @type {ol.control.ScaleLineUnits} */ (options.units) ||
ol.control.ScaleLineUnits.METRIC);
_ol_control_ScaleLineUnits_.METRIC);
};
ol.inherits(ol.control.ScaleLine, ol.control.Control);
_ol_.inherits(_ol_control_ScaleLine_, _ol_control_Control_);
/**
* @const
* @type {Array.<number>}
*/
ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
_ol_control_ScaleLine_.LEADING_DIGITS = [1, 2, 5];
/**
@@ -110,9 +111,10 @@ ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
* @observable
* @api
*/
ol.control.ScaleLine.prototype.getUnits = function() {
return /** @type {ol.control.ScaleLineUnits|undefined} */ (
this.get(ol.control.ScaleLine.Property_.UNITS));
_ol_control_ScaleLine_.prototype.getUnits = function() {
return (
/** @type {ol.control.ScaleLineUnits|undefined} */ this.get(_ol_control_ScaleLine_.Property_.UNITS)
);
};
@@ -122,7 +124,7 @@ ol.control.ScaleLine.prototype.getUnits = function() {
* @this {ol.control.ScaleLine}
* @api
*/
ol.control.ScaleLine.render = function(mapEvent) {
_ol_control_ScaleLine_.render = function(mapEvent) {
var frameState = mapEvent.frameState;
if (!frameState) {
this.viewState_ = null;
@@ -136,7 +138,7 @@ ol.control.ScaleLine.render = function(mapEvent) {
/**
* @private
*/
ol.control.ScaleLine.prototype.handleUnitsChanged_ = function() {
_ol_control_ScaleLine_.prototype.handleUnitsChanged_ = function() {
this.updateElement_();
};
@@ -147,15 +149,15 @@ ol.control.ScaleLine.prototype.handleUnitsChanged_ = function() {
* @observable
* @api
*/
ol.control.ScaleLine.prototype.setUnits = function(units) {
this.set(ol.control.ScaleLine.Property_.UNITS, units);
_ol_control_ScaleLine_.prototype.setUnits = function(units) {
this.set(_ol_control_ScaleLine_.Property_.UNITS, units);
};
/**
* @private
*/
ol.control.ScaleLine.prototype.updateElement_ = function() {
_ol_control_ScaleLine_.prototype.updateElement_ = function() {
var viewState = this.viewState_;
if (!viewState) {
@@ -169,20 +171,20 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
var center = viewState.center;
var projection = viewState.projection;
var units = this.getUnits();
var pointResolutionUnits = units == ol.control.ScaleLineUnits.DEGREES ?
ol.proj.Units.DEGREES :
ol.proj.Units.METERS;
var pointResolutionUnits = units == _ol_control_ScaleLineUnits_.DEGREES ?
_ol_proj_Units_.DEGREES :
_ol_proj_Units_.METERS;
var pointResolution =
ol.proj.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
if (units != ol.control.ScaleLineUnits.DEGREES) {
_ol_proj_.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
if (units != _ol_control_ScaleLineUnits_.DEGREES) {
pointResolution *= projection.getMetersPerUnit();
}
var nominalCount = this.minWidth_ * pointResolution;
var suffix = '';
if (units == ol.control.ScaleLineUnits.DEGREES) {
var metersPerDegree = ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES];
if (projection.getUnits() == ol.proj.Units.DEGREES) {
if (units == _ol_control_ScaleLineUnits_.DEGREES) {
var metersPerDegree = _ol_proj_.METERS_PER_UNIT[_ol_proj_Units_.DEGREES];
if (projection.getUnits() == _ol_proj_Units_.DEGREES) {
nominalCount *= metersPerDegree;
} else {
pointResolution /= metersPerDegree;
@@ -196,7 +198,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
} else {
suffix = '\u00b0'; // degrees
}
} else if (units == ol.control.ScaleLineUnits.IMPERIAL) {
} else if (units == _ol_control_ScaleLineUnits_.IMPERIAL) {
if (nominalCount < 0.9144) {
suffix = 'in';
pointResolution /= 0.0254;
@@ -207,10 +209,10 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
suffix = 'mi';
pointResolution /= 1609.344;
}
} else if (units == ol.control.ScaleLineUnits.NAUTICAL) {
} else if (units == _ol_control_ScaleLineUnits_.NAUTICAL) {
pointResolution /= 1852;
suffix = 'nm';
} else if (units == ol.control.ScaleLineUnits.METRIC) {
} else if (units == _ol_control_ScaleLineUnits_.METRIC) {
if (nominalCount < 0.001) {
suffix = 'μm';
pointResolution *= 1000000;
@@ -223,7 +225,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
suffix = 'km';
pointResolution /= 1000;
}
} else if (units == ol.control.ScaleLineUnits.US) {
} else if (units == _ol_control_ScaleLineUnits_.US) {
if (nominalCount < 0.9144) {
suffix = 'in';
pointResolution *= 39.37;
@@ -235,14 +237,14 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
pointResolution /= 1609.3472;
}
} else {
ol.asserts.assert(false, 33); // Invalid units
_ol_asserts_.assert(false, 33); // Invalid units
}
var i = 3 * Math.floor(
Math.log(this.minWidth_ * pointResolution) / Math.log(10));
var count, width;
while (true) {
count = ol.control.ScaleLine.LEADING_DIGITS[((i % 3) + 3) % 3] *
count = _ol_control_ScaleLine_.LEADING_DIGITS[((i % 3) + 3) % 3] *
Math.pow(10, Math.floor(i / 3));
width = Math.round(count / pointResolution);
if (isNaN(width)) {
@@ -278,6 +280,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
* @enum {string}
* @private
*/
ol.control.ScaleLine.Property_ = {
_ol_control_ScaleLine_.Property_ = {
UNITS: 'units'
};
export default _ol_control_ScaleLine_;

View File

@@ -1,14 +1,17 @@
goog.provide('ol.control.ScaleLineUnits');
/**
* @module ol/control/ScaleLineUnits
*/
/**
* Units for the scale line. Supported values are `'degrees'`, `'imperial'`,
* `'nautical'`, `'metric'`, `'us'`.
* @enum {string}
*/
ol.control.ScaleLineUnits = {
var _ol_control_ScaleLineUnits_ = {
DEGREES: 'degrees',
IMPERIAL: 'imperial',
NAUTICAL: 'nautical',
METRIC: 'metric',
US: 'us'
};
export default _ol_control_ScaleLineUnits_;

View File

@@ -1,12 +1,12 @@
goog.provide('ol.control.Zoom');
goog.require('ol');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
/**
* @module ol/control/Zoom
*/
import _ol_ from '../index.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_css_ from '../css.js';
import _ol_easing_ from '../easing.js';
/**
* @classdesc
@@ -19,7 +19,7 @@ goog.require('ol.easing');
* @param {olx.control.ZoomOptions=} opt_options Zoom options.
* @api
*/
ol.control.Zoom = function(opt_options) {
var _ol_control_Zoom_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -43,8 +43,8 @@ ol.control.Zoom = function(opt_options) {
typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel
);
ol.events.listen(inElement, ol.events.EventType.CLICK,
ol.control.Zoom.prototype.handleClick_.bind(this, delta));
_ol_events_.listen(inElement, _ol_events_EventType_.CLICK,
_ol_control_Zoom_.prototype.handleClick_.bind(this, delta));
var outElement = document.createElement('button');
outElement.className = className + '-out';
@@ -54,17 +54,17 @@ ol.control.Zoom = function(opt_options) {
typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel
);
ol.events.listen(outElement, ol.events.EventType.CLICK,
ol.control.Zoom.prototype.handleClick_.bind(this, -delta));
_ol_events_.listen(outElement, _ol_events_EventType_.CLICK,
_ol_control_Zoom_.prototype.handleClick_.bind(this, -delta));
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL;
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
_ol_css_.CLASS_CONTROL;
var element = document.createElement('div');
element.className = cssClasses;
element.appendChild(inElement);
element.appendChild(outElement);
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: element,
target: options.target
});
@@ -76,7 +76,8 @@ ol.control.Zoom = function(opt_options) {
this.duration_ = options.duration !== undefined ? options.duration : 250;
};
ol.inherits(ol.control.Zoom, ol.control.Control);
_ol_.inherits(_ol_control_Zoom_, _ol_control_Control_);
/**
@@ -84,7 +85,7 @@ ol.inherits(ol.control.Zoom, ol.control.Control);
* @param {Event} event The event to handle
* @private
*/
ol.control.Zoom.prototype.handleClick_ = function(delta, event) {
_ol_control_Zoom_.prototype.handleClick_ = function(delta, event) {
event.preventDefault();
this.zoomByDelta_(delta);
};
@@ -94,7 +95,7 @@ ol.control.Zoom.prototype.handleClick_ = function(delta, event) {
* @param {number} delta Zoom delta.
* @private
*/
ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
_ol_control_Zoom_.prototype.zoomByDelta_ = function(delta) {
var map = this.getMap();
var view = map.getView();
if (!view) {
@@ -112,10 +113,11 @@ ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
view.animate({
resolution: newResolution,
duration: this.duration_,
easing: ol.easing.easeOut
easing: _ol_easing_.easeOut
});
} else {
view.setResolution(newResolution);
}
}
};
export default _ol_control_Zoom_;

View File

@@ -1,19 +1,19 @@
/**
* @module ol/control/ZoomSlider
*/
// FIXME should possibly show tooltip when dragging?
goog.provide('ol.control.ZoomSlider');
goog.require('ol');
goog.require('ol.ViewHint');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
goog.require('ol.events');
goog.require('ol.events.Event');
goog.require('ol.events.EventType');
goog.require('ol.math');
goog.require('ol.pointer.EventType');
goog.require('ol.pointer.PointerEventHandler');
import _ol_ from '../index.js';
import _ol_ViewHint_ from '../ViewHint.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_css_ from '../css.js';
import _ol_easing_ from '../easing.js';
import _ol_events_ from '../events.js';
import _ol_events_Event_ from '../events/Event.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_math_ from '../math.js';
import _ol_pointer_EventType_ from '../pointer/EventType.js';
import _ol_pointer_PointerEventHandler_ from '../pointer/PointerEventHandler.js';
/**
* @classdesc
@@ -28,7 +28,7 @@ goog.require('ol.pointer.PointerEventHandler');
* @param {olx.control.ZoomSliderOptions=} opt_options Zoom slider options.
* @api
*/
ol.control.ZoomSlider = function(opt_options) {
var _ol_control_ZoomSlider_ = function(opt_options) {
var options = opt_options ? opt_options : {};
@@ -47,7 +47,7 @@ ol.control.ZoomSlider = function(opt_options) {
* @type {ol.control.ZoomSlider.Direction_}
* @private
*/
this.direction_ = ol.control.ZoomSlider.Direction_.VERTICAL;
this.direction_ = _ol_control_ZoomSlider_.Direction_.VERTICAL;
/**
* @type {boolean}
@@ -103,44 +103,45 @@ ol.control.ZoomSlider = function(opt_options) {
var className = options.className !== undefined ? options.className : 'ol-zoomslider';
var thumbElement = document.createElement('button');
thumbElement.setAttribute('type', 'button');
thumbElement.className = className + '-thumb ' + ol.css.CLASS_UNSELECTABLE;
thumbElement.className = className + '-thumb ' + _ol_css_.CLASS_UNSELECTABLE;
var containerElement = document.createElement('div');
containerElement.className = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + ol.css.CLASS_CONTROL;
containerElement.className = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' + _ol_css_.CLASS_CONTROL;
containerElement.appendChild(thumbElement);
/**
* @type {ol.pointer.PointerEventHandler}
* @private
*/
this.dragger_ = new ol.pointer.PointerEventHandler(containerElement);
this.dragger_ = new _ol_pointer_PointerEventHandler_(containerElement);
ol.events.listen(this.dragger_, ol.pointer.EventType.POINTERDOWN,
_ol_events_.listen(this.dragger_, _ol_pointer_EventType_.POINTERDOWN,
this.handleDraggerStart_, this);
ol.events.listen(this.dragger_, ol.pointer.EventType.POINTERMOVE,
_ol_events_.listen(this.dragger_, _ol_pointer_EventType_.POINTERMOVE,
this.handleDraggerDrag_, this);
ol.events.listen(this.dragger_, ol.pointer.EventType.POINTERUP,
_ol_events_.listen(this.dragger_, _ol_pointer_EventType_.POINTERUP,
this.handleDraggerEnd_, this);
ol.events.listen(containerElement, ol.events.EventType.CLICK,
_ol_events_.listen(containerElement, _ol_events_EventType_.CLICK,
this.handleContainerClick_, this);
ol.events.listen(thumbElement, ol.events.EventType.CLICK,
ol.events.Event.stopPropagation);
_ol_events_.listen(thumbElement, _ol_events_EventType_.CLICK,
_ol_events_Event_.stopPropagation);
var render = options.render ? options.render : ol.control.ZoomSlider.render;
var render = options.render ? options.render : _ol_control_ZoomSlider_.render;
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: containerElement,
render: render
});
};
ol.inherits(ol.control.ZoomSlider, ol.control.Control);
_ol_.inherits(_ol_control_ZoomSlider_, _ol_control_Control_);
/**
* @inheritDoc
*/
ol.control.ZoomSlider.prototype.disposeInternal = function() {
_ol_control_ZoomSlider_.prototype.disposeInternal = function() {
this.dragger_.dispose();
ol.control.Control.prototype.disposeInternal.call(this);
_ol_control_Control_.prototype.disposeInternal.call(this);
};
@@ -150,7 +151,7 @@ ol.control.ZoomSlider.prototype.disposeInternal = function() {
* @enum {number}
* @private
*/
ol.control.ZoomSlider.Direction_ = {
_ol_control_ZoomSlider_.Direction_ = {
VERTICAL: 0,
HORIZONTAL: 1
};
@@ -159,8 +160,8 @@ ol.control.ZoomSlider.Direction_ = {
/**
* @inheritDoc
*/
ol.control.ZoomSlider.prototype.setMap = function(map) {
ol.control.Control.prototype.setMap.call(this, map);
_ol_control_ZoomSlider_.prototype.setMap = function(map) {
_ol_control_Control_.prototype.setMap.call(this, map);
if (map) {
map.render();
}
@@ -174,7 +175,7 @@ ol.control.ZoomSlider.prototype.setMap = function(map) {
*
* @private
*/
ol.control.ZoomSlider.prototype.initSlider_ = function() {
_ol_control_ZoomSlider_.prototype.initSlider_ = function() {
var container = this.element;
var containerSize = {
width: container.offsetWidth, height: container.offsetHeight
@@ -191,10 +192,10 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
this.thumbSize_ = [thumbWidth, thumbHeight];
if (containerSize.width > containerSize.height) {
this.direction_ = ol.control.ZoomSlider.Direction_.HORIZONTAL;
this.direction_ = _ol_control_ZoomSlider_.Direction_.HORIZONTAL;
this.widthLimit_ = containerSize.width - thumbWidth;
} else {
this.direction_ = ol.control.ZoomSlider.Direction_.VERTICAL;
this.direction_ = _ol_control_ZoomSlider_.Direction_.VERTICAL;
this.heightLimit_ = containerSize.height - thumbHeight;
}
this.sliderInitialized_ = true;
@@ -207,7 +208,7 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
* @this {ol.control.ZoomSlider}
* @api
*/
ol.control.ZoomSlider.render = function(mapEvent) {
_ol_control_ZoomSlider_.render = function(mapEvent) {
if (!mapEvent.frameState) {
return;
}
@@ -226,7 +227,7 @@ ol.control.ZoomSlider.render = function(mapEvent) {
* @param {Event} event The browser event to handle.
* @private
*/
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
_ol_control_ZoomSlider_.prototype.handleContainerClick_ = function(event) {
var view = this.getMap().getView();
var relativePosition = this.getRelativePosition_(
@@ -238,7 +239,7 @@ ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
view.animate({
resolution: view.constrainResolution(resolution),
duration: this.duration_,
easing: ol.easing.easeOut
easing: _ol_easing_.easeOut
});
};
@@ -248,9 +249,9 @@ ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
* @param {ol.pointer.PointerEvent} event The drag event.
* @private
*/
ol.control.ZoomSlider.prototype.handleDraggerStart_ = function(event) {
_ol_control_ZoomSlider_.prototype.handleDraggerStart_ = function(event) {
if (!this.dragging_ && event.originalEvent.target === this.element.firstElementChild) {
this.getMap().getView().setHint(ol.ViewHint.INTERACTING, 1);
this.getMap().getView().setHint(_ol_ViewHint_.INTERACTING, 1);
this.previousX_ = event.clientX;
this.previousY_ = event.clientY;
this.dragging_ = true;
@@ -264,7 +265,7 @@ ol.control.ZoomSlider.prototype.handleDraggerStart_ = function(event) {
* @param {ol.pointer.PointerEvent|Event} event The drag event.
* @private
*/
ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
_ol_control_ZoomSlider_.prototype.handleDraggerDrag_ = function(event) {
if (this.dragging_) {
var element = this.element.firstElementChild;
var deltaX = event.clientX - this.previousX_ + parseInt(element.style.left, 10);
@@ -284,15 +285,15 @@ ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
* @param {ol.pointer.PointerEvent|Event} event The drag event.
* @private
*/
ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
_ol_control_ZoomSlider_.prototype.handleDraggerEnd_ = function(event) {
if (this.dragging_) {
var view = this.getMap().getView();
view.setHint(ol.ViewHint.INTERACTING, -1);
view.setHint(_ol_ViewHint_.INTERACTING, -1);
view.animate({
resolution: view.constrainResolution(this.currentResolution_),
duration: this.duration_,
easing: ol.easing.easeOut
easing: _ol_easing_.easeOut
});
this.dragging_ = false;
@@ -308,11 +309,11 @@ ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
* @param {number} res The res.
* @private
*/
ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) {
_ol_control_ZoomSlider_.prototype.setThumbPosition_ = function(res) {
var position = this.getPositionForResolution_(res);
var thumb = this.element.firstElementChild;
if (this.direction_ == ol.control.ZoomSlider.Direction_.HORIZONTAL) {
if (this.direction_ == _ol_control_ZoomSlider_.Direction_.HORIZONTAL) {
thumb.style.left = this.widthLimit_ * position + 'px';
} else {
thumb.style.top = this.heightLimit_ * position + 'px';
@@ -330,14 +331,14 @@ ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) {
* @return {number} The relative position of the thumb.
* @private
*/
ol.control.ZoomSlider.prototype.getRelativePosition_ = function(x, y) {
_ol_control_ZoomSlider_.prototype.getRelativePosition_ = function(x, y) {
var amount;
if (this.direction_ === ol.control.ZoomSlider.Direction_.HORIZONTAL) {
if (this.direction_ === _ol_control_ZoomSlider_.Direction_.HORIZONTAL) {
amount = x / this.widthLimit_;
} else {
amount = y / this.heightLimit_;
}
return ol.math.clamp(amount, 0, 1);
return _ol_math_.clamp(amount, 0, 1);
};
@@ -349,7 +350,7 @@ ol.control.ZoomSlider.prototype.getRelativePosition_ = function(x, y) {
* @return {number} The corresponding resolution.
* @private
*/
ol.control.ZoomSlider.prototype.getResolutionForPosition_ = function(position) {
_ol_control_ZoomSlider_.prototype.getResolutionForPosition_ = function(position) {
var fn = this.getMap().getView().getResolutionForValueFunction();
return fn(1 - position);
};
@@ -364,7 +365,8 @@ ol.control.ZoomSlider.prototype.getResolutionForPosition_ = function(position) {
* @return {number} The relative position value (between 0 and 1).
* @private
*/
ol.control.ZoomSlider.prototype.getPositionForResolution_ = function(res) {
_ol_control_ZoomSlider_.prototype.getPositionForResolution_ = function(res) {
var fn = this.getMap().getView().getValueForResolutionFunction();
return 1 - fn(res);
};
export default _ol_control_ZoomSlider_;

View File

@@ -1,11 +1,11 @@
goog.provide('ol.control.ZoomToExtent');
goog.require('ol');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.control.Control');
goog.require('ol.css');
/**
* @module ol/control/ZoomToExtent
*/
import _ol_ from '../index.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_control_Control_ from '../control/Control.js';
import _ol_css_ from '../css.js';
/**
* @classdesc
@@ -17,7 +17,7 @@ goog.require('ol.css');
* @param {olx.control.ZoomToExtentOptions=} opt_options Options.
* @api
*/
ol.control.ZoomToExtent = function(opt_options) {
var _ol_control_ZoomToExtent_ = function(opt_options) {
var options = opt_options ? opt_options : {};
/**
@@ -39,28 +39,29 @@ ol.control.ZoomToExtent = function(opt_options) {
typeof label === 'string' ? document.createTextNode(label) : label
);
ol.events.listen(button, ol.events.EventType.CLICK,
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
this.handleClick_, this);
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL;
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
_ol_css_.CLASS_CONTROL;
var element = document.createElement('div');
element.className = cssClasses;
element.appendChild(button);
ol.control.Control.call(this, {
_ol_control_Control_.call(this, {
element: element,
target: options.target
});
};
ol.inherits(ol.control.ZoomToExtent, ol.control.Control);
_ol_.inherits(_ol_control_ZoomToExtent_, _ol_control_Control_);
/**
* @param {Event} event The event to handle
* @private
*/
ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
_ol_control_ZoomToExtent_.prototype.handleClick_ = function(event) {
event.preventDefault();
this.handleZoomToExtent();
};
@@ -69,9 +70,10 @@ ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
/**
* @protected
*/
ol.control.ZoomToExtent.prototype.handleZoomToExtent = function() {
_ol_control_ZoomToExtent_.prototype.handleZoomToExtent = function() {
var map = this.getMap();
var view = map.getView();
var extent = !this.extent ? view.getProjection().getExtent() : this.extent;
view.fit(extent);
};
export default _ol_control_ZoomToExtent_;

View File

@@ -1,7 +1,9 @@
goog.provide('ol.coordinate');
goog.require('ol.math');
goog.require('ol.string');
/**
* @module ol/coordinate
*/
import _ol_math_ from './math.js';
import _ol_string_ from './string.js';
var _ol_coordinate_ = {};
/**
@@ -19,7 +21,7 @@ goog.require('ol.string');
* @return {ol.Coordinate} The input coordinate adjusted by the given delta.
* @api
*/
ol.coordinate.add = function(coordinate, delta) {
_ol_coordinate_.add = function(coordinate, delta) {
coordinate[0] += delta[0];
coordinate[1] += delta[1];
return coordinate;
@@ -33,7 +35,7 @@ ol.coordinate.add = function(coordinate, delta) {
* @param {ol.geom.Circle} circle The circle.
* @return {ol.Coordinate} Closest point on the circumference
*/
ol.coordinate.closestOnCircle = function(coordinate, circle) {
_ol_coordinate_.closestOnCircle = function(coordinate, circle) {
var r = circle.getRadius();
var center = circle.getCenter();
var x0 = center[0];
@@ -68,7 +70,7 @@ ol.coordinate.closestOnCircle = function(coordinate, circle) {
* @return {ol.Coordinate} The foot of the perpendicular of the coordinate to
* the segment.
*/
ol.coordinate.closestOnSegment = function(coordinate, segment) {
_ol_coordinate_.closestOnSegment = function(coordinate, segment) {
var x0 = coordinate[0];
var y0 = coordinate[1];
var start = segment[0];
@@ -119,15 +121,16 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
* @return {ol.CoordinateFormatType} Coordinate format.
* @api
*/
ol.coordinate.createStringXY = function(opt_fractionDigits) {
_ol_coordinate_.createStringXY = function(opt_fractionDigits) {
return (
/**
* @param {ol.Coordinate|undefined} coordinate Coordinate.
* @return {string} String XY.
*/
function(coordinate) {
return ol.coordinate.toStringXY(coordinate, opt_fractionDigits);
});
return _ol_coordinate_.toStringXY(coordinate, opt_fractionDigits);
}
);
};
@@ -138,8 +141,8 @@ ol.coordinate.createStringXY = function(opt_fractionDigits) {
* after the decimal point. Default is `0`.
* @return {string} String.
*/
ol.coordinate.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionDigits) {
var normalizedDegrees = ol.math.modulo(degrees + 180, 360) - 180;
_ol_coordinate_.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionDigits) {
var normalizedDegrees = _ol_math_.modulo(degrees + 180, 360) - 180;
var x = Math.abs(3600 * normalizedDegrees);
var dflPrecision = opt_fractionDigits || 0;
var precision = Math.pow(10, dflPrecision);
@@ -159,8 +162,8 @@ ol.coordinate.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionD
deg += 1;
}
return deg + '\u00b0 ' + ol.string.padNumber(min, 2) + '\u2032 ' +
ol.string.padNumber(sec, 2, dflPrecision) + '\u2033' +
return deg + '\u00b0 ' + _ol_string_.padNumber(min, 2) + '\u2032 ' +
_ol_string_.padNumber(sec, 2, dflPrecision) + '\u2033' +
(normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0));
};
@@ -192,7 +195,7 @@ ol.coordinate.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionD
* @return {string} Formatted coordinate.
* @api
*/
ol.coordinate.format = function(coordinate, template, opt_fractionDigits) {
_ol_coordinate_.format = function(coordinate, template, opt_fractionDigits) {
if (coordinate) {
return template
.replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
@@ -208,7 +211,7 @@ ol.coordinate.format = function(coordinate, template, opt_fractionDigits) {
* @param {ol.Coordinate} coordinate2 Second coordinate.
* @return {boolean} Whether the passed coordinates are equal.
*/
ol.coordinate.equals = function(coordinate1, coordinate2) {
_ol_coordinate_.equals = function(coordinate1, coordinate2) {
var equals = true;
for (var i = coordinate1.length - 1; i >= 0; --i) {
if (coordinate1[i] != coordinate2[i]) {
@@ -236,7 +239,7 @@ ol.coordinate.equals = function(coordinate1, coordinate2) {
* @return {ol.Coordinate} Coordinate.
* @api
*/
ol.coordinate.rotate = function(coordinate, angle) {
_ol_coordinate_.rotate = function(coordinate, angle) {
var cosAngle = Math.cos(angle);
var sinAngle = Math.sin(angle);
var x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;
@@ -262,7 +265,7 @@ ol.coordinate.rotate = function(coordinate, angle) {
* @param {number} scale Scale factor.
* @return {ol.Coordinate} Coordinate.
*/
ol.coordinate.scale = function(coordinate, scale) {
_ol_coordinate_.scale = function(coordinate, scale) {
coordinate[0] *= scale;
coordinate[1] *= scale;
return coordinate;
@@ -277,7 +280,7 @@ ol.coordinate.scale = function(coordinate, scale) {
* @param {ol.Coordinate} delta Delta.
* @return {ol.Coordinate} Coordinate.
*/
ol.coordinate.sub = function(coordinate, delta) {
_ol_coordinate_.sub = function(coordinate, delta) {
coordinate[0] -= delta[0];
coordinate[1] -= delta[1];
return coordinate;
@@ -289,7 +292,7 @@ ol.coordinate.sub = function(coordinate, delta) {
* @param {ol.Coordinate} coord2 Second coordinate.
* @return {number} Squared distance between coord1 and coord2.
*/
ol.coordinate.squaredDistance = function(coord1, coord2) {
_ol_coordinate_.squaredDistance = function(coord1, coord2) {
var dx = coord1[0] - coord2[0];
var dy = coord1[1] - coord2[1];
return dx * dx + dy * dy;
@@ -301,8 +304,8 @@ ol.coordinate.squaredDistance = function(coord1, coord2) {
* @param {ol.Coordinate} coord2 Second coordinate.
* @return {number} Distance between coord1 and coord2.
*/
ol.coordinate.distance = function(coord1, coord2) {
return Math.sqrt(ol.coordinate.squaredDistance(coord1, coord2));
_ol_coordinate_.distance = function(coord1, coord2) {
return Math.sqrt(_ol_coordinate_.squaredDistance(coord1, coord2));
};
@@ -313,9 +316,9 @@ ol.coordinate.distance = function(coord1, coord2) {
* @param {Array.<ol.Coordinate>} segment Line segment (2 coordinates).
* @return {number} Squared distance from the point to the line segment.
*/
ol.coordinate.squaredDistanceToSegment = function(coordinate, segment) {
return ol.coordinate.squaredDistance(coordinate,
ol.coordinate.closestOnSegment(coordinate, segment));
_ol_coordinate_.squaredDistanceToSegment = function(coordinate, segment) {
return _ol_coordinate_.squaredDistance(coordinate,
_ol_coordinate_.closestOnSegment(coordinate, segment));
};
@@ -341,10 +344,10 @@ ol.coordinate.squaredDistanceToSegment = function(coordinate, segment) {
* @return {string} Hemisphere, degrees, minutes and seconds.
* @api
*/
ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) {
_ol_coordinate_.toStringHDMS = function(coordinate, opt_fractionDigits) {
if (coordinate) {
return ol.coordinate.degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' +
ol.coordinate.degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits);
return _ol_coordinate_.degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' +
_ol_coordinate_.degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits);
} else {
return '';
}
@@ -372,6 +375,7 @@ ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) {
* @return {string} XY.
* @api
*/
ol.coordinate.toStringXY = function(coordinate, opt_fractionDigits) {
return ol.coordinate.format(coordinate, '{x}, {y}', opt_fractionDigits);
_ol_coordinate_.toStringXY = function(coordinate, opt_fractionDigits) {
return _ol_coordinate_.format(coordinate, '{x}, {y}', opt_fractionDigits);
};
export default _ol_coordinate_;

View File

@@ -1,4 +1,7 @@
goog.provide('ol.css');
/**
* @module ol/css
*/
var _ol_css_ = {};
/**
@@ -7,7 +10,7 @@ goog.provide('ol.css');
* @const
* @type {string}
*/
ol.css.CLASS_HIDDEN = 'ol-hidden';
_ol_css_.CLASS_HIDDEN = 'ol-hidden';
/**
@@ -16,7 +19,7 @@ ol.css.CLASS_HIDDEN = 'ol-hidden';
* @const
* @type {string}
*/
ol.css.CLASS_SELECTABLE = 'ol-selectable';
_ol_css_.CLASS_SELECTABLE = 'ol-selectable';
/**
* The CSS class that we'll give the DOM elements to have them unselectable.
@@ -24,7 +27,7 @@ ol.css.CLASS_SELECTABLE = 'ol-selectable';
* @const
* @type {string}
*/
ol.css.CLASS_UNSELECTABLE = 'ol-unselectable';
_ol_css_.CLASS_UNSELECTABLE = 'ol-unselectable';
/**
@@ -33,7 +36,7 @@ ol.css.CLASS_UNSELECTABLE = 'ol-unselectable';
* @const
* @type {string}
*/
ol.css.CLASS_UNSUPPORTED = 'ol-unsupported';
_ol_css_.CLASS_UNSUPPORTED = 'ol-unsupported';
/**
@@ -42,7 +45,7 @@ ol.css.CLASS_UNSUPPORTED = 'ol-unsupported';
* @const
* @type {string}
*/
ol.css.CLASS_CONTROL = 'ol-control';
_ol_css_.CLASS_CONTROL = 'ol-control';
/**
@@ -51,7 +54,7 @@ ol.css.CLASS_CONTROL = 'ol-control';
* @param {string} The CSS font property.
* @return {Object.<string>} The font families (or null if the input spec is invalid).
*/
ol.css.getFontFamilies = (function() {
_ol_css_.getFontFamilies = (function() {
var style;
var cache = {};
return function(font) {
@@ -70,3 +73,4 @@ ol.css.getFontFamilies = (function() {
return cache[font];
};
})();
export default _ol_css_;

View File

@@ -1,4 +1,7 @@
goog.provide('ol.dom');
/**
* @module ol/dom
*/
var _ol_dom_ = {};
/**
@@ -7,7 +10,7 @@ goog.provide('ol.dom');
* @param {number=} opt_height Canvas height.
* @return {CanvasRenderingContext2D} The context.
*/
ol.dom.createCanvasContext2D = function(opt_width, opt_height) {
_ol_dom_.createCanvasContext2D = function(opt_width, opt_height) {
var canvas = document.createElement('CANVAS');
if (opt_width) {
canvas.width = opt_width;
@@ -26,7 +29,7 @@ ol.dom.createCanvasContext2D = function(opt_width, opt_height) {
* @param {!Element} element Element.
* @return {number} The width.
*/
ol.dom.outerWidth = function(element) {
_ol_dom_.outerWidth = function(element) {
var width = element.offsetWidth;
var style = getComputedStyle(element);
width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
@@ -42,7 +45,7 @@ ol.dom.outerWidth = function(element) {
* @param {!Element} element Element.
* @return {number} The height.
*/
ol.dom.outerHeight = function(element) {
_ol_dom_.outerHeight = function(element) {
var height = element.offsetHeight;
var style = getComputedStyle(element);
height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
@@ -54,7 +57,7 @@ ol.dom.outerHeight = function(element) {
* @param {Node} newNode Node to replace old node
* @param {Node} oldNode The node to be replaced
*/
ol.dom.replaceNode = function(newNode, oldNode) {
_ol_dom_.replaceNode = function(newNode, oldNode) {
var parent = oldNode.parentNode;
if (parent) {
parent.replaceChild(newNode, oldNode);
@@ -65,15 +68,16 @@ ol.dom.replaceNode = function(newNode, oldNode) {
* @param {Node} node The node to remove.
* @returns {Node} The node that was removed or null.
*/
ol.dom.removeNode = function(node) {
_ol_dom_.removeNode = function(node) {
return node && node.parentNode ? node.parentNode.removeChild(node) : null;
};
/**
* @param {Node} node The node to remove the children from.
*/
ol.dom.removeChildren = function(node) {
_ol_dom_.removeChildren = function(node) {
while (node.lastChild) {
node.removeChild(node.lastChild);
}
};
export default _ol_dom_;

View File

@@ -1,4 +1,7 @@
goog.provide('ol.easing');
/**
* @module ol/easing
*/
var _ol_easing_ = {};
/**
@@ -7,7 +10,7 @@ goog.provide('ol.easing');
* @return {number} Output between 0 and 1.
* @api
*/
ol.easing.easeIn = function(t) {
_ol_easing_.easeIn = function(t) {
return Math.pow(t, 3);
};
@@ -18,8 +21,8 @@ ol.easing.easeIn = function(t) {
* @return {number} Output between 0 and 1.
* @api
*/
ol.easing.easeOut = function(t) {
return 1 - ol.easing.easeIn(1 - t);
_ol_easing_.easeOut = function(t) {
return 1 - _ol_easing_.easeIn(1 - t);
};
@@ -29,7 +32,7 @@ ol.easing.easeOut = function(t) {
* @return {number} Output between 0 and 1.
* @api
*/
ol.easing.inAndOut = function(t) {
_ol_easing_.inAndOut = function(t) {
return 3 * t * t - 2 * t * t * t;
};
@@ -40,7 +43,7 @@ ol.easing.inAndOut = function(t) {
* @return {number} Output between 0 and 1.
* @api
*/
ol.easing.linear = function(t) {
_ol_easing_.linear = function(t) {
return t;
};
@@ -53,10 +56,11 @@ ol.easing.linear = function(t) {
* @return {number} Output between 0 and 1.
* @api
*/
ol.easing.upAndDown = function(t) {
_ol_easing_.upAndDown = function(t) {
if (t < 0.5) {
return ol.easing.inAndOut(2 * t);
return _ol_easing_.inAndOut(2 * t);
} else {
return 1 - ol.easing.inAndOut(2 * (t - 0.5));
return 1 - _ol_easing_.inAndOut(2 * (t - 0.5));
}
};
export default _ol_easing_;

View File

@@ -1,18 +1,20 @@
goog.provide('ol.events');
goog.require('ol.obj');
/**
* @module ol/events
*/
import _ol_obj_ from './obj.js';
var _ol_events_ = {};
/**
* @param {ol.EventsKey} listenerObj Listener object.
* @return {ol.EventsListenerFunctionType} Bound listener.
*/
ol.events.bindListener_ = function(listenerObj) {
_ol_events_.bindListener_ = function(listenerObj) {
var boundListener = function(evt) {
var listener = listenerObj.listener;
var bindTo = listenerObj.bindTo || listenerObj.target;
if (listenerObj.callOnce) {
ol.events.unlistenByKey(listenerObj);
_ol_events_.unlistenByKey(listenerObj);
}
return listener.call(bindTo, evt);
};
@@ -33,7 +35,7 @@ ol.events.bindListener_ = function(listenerObj) {
* @return {ol.EventsKey|undefined} The matching listener object.
* @private
*/
ol.events.findListener_ = function(listeners, listener, opt_this,
_ol_events_.findListener_ = function(listeners, listener, opt_this,
opt_setDeleteIndex) {
var listenerObj;
for (var i = 0, ii = listeners.length; i < ii; ++i) {
@@ -55,7 +57,7 @@ ol.events.findListener_ = function(listeners, listener, opt_this,
* @param {string} type Type.
* @return {Array.<ol.EventsKey>|undefined} Listeners.
*/
ol.events.getListeners = function(target, type) {
_ol_events_.getListeners = function(target, type) {
var listenerMap = target.ol_lm;
return listenerMap ? listenerMap[type] : undefined;
};
@@ -69,7 +71,7 @@ ol.events.getListeners = function(target, type) {
* listeners by event type.
* @private
*/
ol.events.getListenerMap_ = function(target) {
_ol_events_.getListenerMap_ = function(target) {
var listenerMap = target.ol_lm;
if (!listenerMap) {
listenerMap = target.ol_lm = {};
@@ -86,12 +88,12 @@ ol.events.getListenerMap_ = function(target) {
* @param {string} type Type.
* @private
*/
ol.events.removeListeners_ = function(target, type) {
var listeners = ol.events.getListeners(target, type);
_ol_events_.removeListeners_ = function(target, type) {
var listeners = _ol_events_.getListeners(target, type);
if (listeners) {
for (var i = 0, ii = listeners.length; i < ii; ++i) {
target.removeEventListener(type, listeners[i].boundListener);
ol.obj.clear(listeners[i]);
_ol_obj_.clear(listeners[i]);
}
listeners.length = 0;
var listenerMap = target.ol_lm;
@@ -120,13 +122,13 @@ ol.events.removeListeners_ = function(target, type) {
* @param {boolean=} opt_once If true, add the listener as one-off listener.
* @return {ol.EventsKey} Unique key for the listener.
*/
ol.events.listen = function(target, type, listener, opt_this, opt_once) {
var listenerMap = ol.events.getListenerMap_(target);
_ol_events_.listen = function(target, type, listener, opt_this, opt_once) {
var listenerMap = _ol_events_.getListenerMap_(target);
var listeners = listenerMap[type];
if (!listeners) {
listeners = listenerMap[type] = [];
}
var listenerObj = ol.events.findListener_(listeners, listener, opt_this,
var listenerObj = _ol_events_.findListener_(listeners, listener, opt_this,
false);
if (listenerObj) {
if (!opt_once) {
@@ -141,7 +143,7 @@ ol.events.listen = function(target, type, listener, opt_this, opt_once) {
target: target,
type: type
});
target.addEventListener(type, ol.events.bindListener_(listenerObj));
target.addEventListener(type, _ol_events_.bindListener_(listenerObj));
listeners.push(listenerObj);
}
@@ -169,8 +171,8 @@ ol.events.listen = function(target, type, listener, opt_this, opt_once) {
* listener. Default is the `target`.
* @return {ol.EventsKey} Key for unlistenByKey.
*/
ol.events.listenOnce = function(target, type, listener, opt_this) {
return ol.events.listen(target, type, listener, opt_this, true);
_ol_events_.listenOnce = function(target, type, listener, opt_this) {
return _ol_events_.listen(target, type, listener, opt_this, true);
};
@@ -187,13 +189,13 @@ ol.events.listenOnce = function(target, type, listener, opt_this) {
* @param {Object=} opt_this Object referenced by the `this` keyword in the
* listener. Default is the `target`.
*/
ol.events.unlisten = function(target, type, listener, opt_this) {
var listeners = ol.events.getListeners(target, type);
_ol_events_.unlisten = function(target, type, listener, opt_this) {
var listeners = _ol_events_.getListeners(target, type);
if (listeners) {
var listenerObj = ol.events.findListener_(listeners, listener, opt_this,
var listenerObj = _ol_events_.findListener_(listeners, listener, opt_this,
true);
if (listenerObj) {
ol.events.unlistenByKey(listenerObj);
_ol_events_.unlistenByKey(listenerObj);
}
}
};
@@ -208,20 +210,20 @@ ol.events.unlisten = function(target, type, listener, opt_this) {
*
* @param {ol.EventsKey} key The key.
*/
ol.events.unlistenByKey = function(key) {
_ol_events_.unlistenByKey = function(key) {
if (key && key.target) {
key.target.removeEventListener(key.type, key.boundListener);
var listeners = ol.events.getListeners(key.target, key.type);
var listeners = _ol_events_.getListeners(key.target, key.type);
if (listeners) {
var i = 'deleteIndex' in key ? key.deleteIndex : listeners.indexOf(key);
if (i !== -1) {
listeners.splice(i, 1);
}
if (listeners.length === 0) {
ol.events.removeListeners_(key.target, key.type);
_ol_events_.removeListeners_(key.target, key.type);
}
}
ol.obj.clear(key);
_ol_obj_.clear(key);
}
};
@@ -232,9 +234,10 @@ ol.events.unlistenByKey = function(key) {
*
* @param {ol.EventTargetLike} target Target.
*/
ol.events.unlistenAll = function(target) {
var listenerMap = ol.events.getListenerMap_(target);
_ol_events_.unlistenAll = function(target) {
var listenerMap = _ol_events_.getListenerMap_(target);
for (var type in listenerMap) {
ol.events.removeListeners_(target, type);
_ol_events_.removeListeners_(target, type);
}
};
export default _ol_events_;

View File

@@ -1,6 +1,6 @@
goog.provide('ol.events.Event');
/**
* @module ol/events/Event
*/
/**
* @classdesc
* Stripped down implementation of the W3C DOM Level 2 Event interface.
@@ -15,7 +15,7 @@ goog.provide('ol.events.Event');
* @implements {oli.events.Event}
* @param {string} type Type.
*/
ol.events.Event = function(type) {
var _ol_events_Event_ = function(type) {
/**
* @type {boolean}
@@ -45,7 +45,7 @@ ol.events.Event = function(type) {
* @override
* @api
*/
ol.events.Event.prototype.preventDefault =
_ol_events_Event_.prototype.preventDefault =
/**
* Stop event propagation.
@@ -53,7 +53,7 @@ ol.events.Event.prototype.preventDefault =
* @override
* @api
*/
ol.events.Event.prototype.stopPropagation = function() {
_ol_events_Event_.prototype.stopPropagation = function() {
this.propagationStopped = true;
};
@@ -61,7 +61,7 @@ ol.events.Event.prototype.preventDefault =
/**
* @param {Event|ol.events.Event} evt Event
*/
ol.events.Event.stopPropagation = function(evt) {
_ol_events_Event_.stopPropagation = function(evt) {
evt.stopPropagation();
};
@@ -69,6 +69,7 @@ ol.events.Event.stopPropagation = function(evt) {
/**
* @param {Event|ol.events.Event} evt Event
*/
ol.events.Event.preventDefault = function(evt) {
_ol_events_Event_.preventDefault = function(evt) {
evt.preventDefault();
};
export default _ol_events_Event_;

View File

@@ -1,10 +1,10 @@
goog.provide('ol.events.EventTarget');
goog.require('ol');
goog.require('ol.Disposable');
goog.require('ol.events');
goog.require('ol.events.Event');
/**
* @module ol/events/EventTarget
*/
import _ol_ from '../index.js';
import _ol_Disposable_ from '../Disposable.js';
import _ol_events_ from '../events.js';
import _ol_events_Event_ from '../events/Event.js';
/**
* @classdesc
@@ -24,9 +24,9 @@ goog.require('ol.events.Event');
* @constructor
* @extends {ol.Disposable}
*/
ol.events.EventTarget = function() {
var _ol_events_EventTarget_ = function() {
ol.Disposable.call(this);
_ol_Disposable_.call(this);
/**
* @private
@@ -47,14 +47,15 @@ ol.events.EventTarget = function() {
this.listeners_ = {};
};
ol.inherits(ol.events.EventTarget, ol.Disposable);
_ol_.inherits(_ol_events_EventTarget_, _ol_Disposable_);
/**
* @param {string} type Type.
* @param {ol.EventsListenerFunctionType} listener Listener.
*/
ol.events.EventTarget.prototype.addEventListener = function(type, listener) {
_ol_events_EventTarget_.prototype.addEventListener = function(type, listener) {
var listeners = this.listeners_[type];
if (!listeners) {
listeners = this.listeners_[type] = [];
@@ -72,8 +73,8 @@ ol.events.EventTarget.prototype.addEventListener = function(type, listener) {
* @return {boolean|undefined} `false` if anyone called preventDefault on the
* event object or if any of the listeners returned false.
*/
ol.events.EventTarget.prototype.dispatchEvent = function(event) {
var evt = typeof event === 'string' ? new ol.events.Event(event) : event;
_ol_events_EventTarget_.prototype.dispatchEvent = function(event) {
var evt = typeof event === 'string' ? new _ol_events_Event_(event) : event;
var type = evt.type;
evt.target = this;
var listeners = this.listeners_[type];
@@ -95,7 +96,7 @@ ol.events.EventTarget.prototype.dispatchEvent = function(event) {
var pendingRemovals = this.pendingRemovals_[type];
delete this.pendingRemovals_[type];
while (pendingRemovals--) {
this.removeEventListener(type, ol.nullFunction);
this.removeEventListener(type, _ol_.nullFunction);
}
delete this.dispatching_[type];
}
@@ -107,8 +108,8 @@ ol.events.EventTarget.prototype.dispatchEvent = function(event) {
/**
* @inheritDoc
*/
ol.events.EventTarget.prototype.disposeInternal = function() {
ol.events.unlistenAll(this);
_ol_events_EventTarget_.prototype.disposeInternal = function() {
_ol_events_.unlistenAll(this);
};
@@ -119,7 +120,7 @@ ol.events.EventTarget.prototype.disposeInternal = function() {
* @param {string} type Type.
* @return {Array.<ol.EventsListenerFunctionType>} Listeners.
*/
ol.events.EventTarget.prototype.getListeners = function(type) {
_ol_events_EventTarget_.prototype.getListeners = function(type) {
return this.listeners_[type];
};
@@ -129,7 +130,7 @@ ol.events.EventTarget.prototype.getListeners = function(type) {
* `true` will be returned if this EventTarget has any listeners.
* @return {boolean} Has listeners.
*/
ol.events.EventTarget.prototype.hasListener = function(opt_type) {
_ol_events_EventTarget_.prototype.hasListener = function(opt_type) {
return opt_type ?
opt_type in this.listeners_ :
Object.keys(this.listeners_).length > 0;
@@ -140,13 +141,13 @@ ol.events.EventTarget.prototype.hasListener = function(opt_type) {
* @param {string} type Type.
* @param {ol.EventsListenerFunctionType} listener Listener.
*/
ol.events.EventTarget.prototype.removeEventListener = function(type, listener) {
_ol_events_EventTarget_.prototype.removeEventListener = function(type, listener) {
var listeners = this.listeners_[type];
if (listeners) {
var index = listeners.indexOf(listener);
if (type in this.pendingRemovals_) {
// make listener a no-op, and remove later in #dispatchEvent()
listeners[index] = ol.nullFunction;
listeners[index] = _ol_.nullFunction;
++this.pendingRemovals_[type];
} else {
listeners.splice(index, 1);
@@ -156,3 +157,4 @@ ol.events.EventTarget.prototype.removeEventListener = function(type, listener) {
}
}
};
export default _ol_events_EventTarget_;

View File

@@ -1,10 +1,11 @@
goog.provide('ol.events.EventType');
/**
* @module ol/events/EventType
*/
/**
* @enum {string}
* @const
*/
ol.events.EventType = {
var _ol_events_EventType_ = {
/**
* Generic change event. Triggered when the revision counter is increased.
* @event ol.events.Event#change
@@ -34,3 +35,5 @@ ol.events.EventType = {
TOUCHEND: 'touchend',
WHEEL: 'wheel'
};
export default _ol_events_EventType_;

View File

@@ -1,12 +1,15 @@
goog.provide('ol.events.KeyCode');
/**
* @module ol/events/KeyCode
*/
/**
* @enum {number}
* @const
*/
ol.events.KeyCode = {
var _ol_events_KeyCode_ = {
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
export default _ol_events_KeyCode_;

View File

@@ -1,9 +1,11 @@
goog.provide('ol.events.condition');
goog.require('ol.MapBrowserEventType');
goog.require('ol.asserts');
goog.require('ol.functions');
goog.require('ol.has');
/**
* @module ol/events/condition
*/
import _ol_MapBrowserEventType_ from '../MapBrowserEventType.js';
import _ol_asserts_ from '../asserts.js';
import _ol_functions_ from '../functions.js';
import _ol_has_ from '../has.js';
var _ol_events_condition_ = {};
/**
@@ -14,7 +16,7 @@ goog.require('ol.has');
* @return {boolean} True if only the alt key is pressed.
* @api
*/
ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
_ol_events_condition_.altKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
originalEvent.altKey &&
@@ -31,7 +33,7 @@ ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
* @return {boolean} True if only the alt and shift keys are pressed.
* @api
*/
ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
_ol_events_condition_.altShiftKeysOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
originalEvent.altKey &&
@@ -48,7 +50,7 @@ ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
* @function
* @api
*/
ol.events.condition.always = ol.functions.TRUE;
_ol_events_condition_.always = _ol_functions_.TRUE;
/**
@@ -58,8 +60,8 @@ ol.events.condition.always = ol.functions.TRUE;
* @return {boolean} True if the event is a map `click` event.
* @api
*/
ol.events.condition.click = function(mapBrowserEvent) {
return mapBrowserEvent.type == ol.MapBrowserEventType.CLICK;
_ol_events_condition_.click = function(mapBrowserEvent) {
return mapBrowserEvent.type == _ol_MapBrowserEventType_.CLICK;
};
@@ -72,10 +74,10 @@ ol.events.condition.click = function(mapBrowserEvent) {
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} The result.
*/
ol.events.condition.mouseActionButton = function(mapBrowserEvent) {
_ol_events_condition_.mouseActionButton = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return originalEvent.button == 0 &&
!(ol.has.WEBKIT && ol.has.MAC && originalEvent.ctrlKey);
!(_ol_has_.WEBKIT && _ol_has_.MAC && originalEvent.ctrlKey);
};
@@ -87,7 +89,7 @@ ol.events.condition.mouseActionButton = function(mapBrowserEvent) {
* @function
* @api
*/
ol.events.condition.never = ol.functions.FALSE;
_ol_events_condition_.never = _ol_functions_.FALSE;
/**
@@ -98,7 +100,7 @@ ol.events.condition.never = ol.functions.FALSE;
* @return {boolean} True if the browser event is a `pointermove` event.
* @api
*/
ol.events.condition.pointerMove = function(mapBrowserEvent) {
_ol_events_condition_.pointerMove = function(mapBrowserEvent) {
return mapBrowserEvent.type == 'pointermove';
};
@@ -110,8 +112,8 @@ ol.events.condition.pointerMove = function(mapBrowserEvent) {
* @return {boolean} True if the event is a map `singleclick` event.
* @api
*/
ol.events.condition.singleClick = function(mapBrowserEvent) {
return mapBrowserEvent.type == ol.MapBrowserEventType.SINGLECLICK;
_ol_events_condition_.singleClick = function(mapBrowserEvent) {
return mapBrowserEvent.type == _ol_MapBrowserEventType_.SINGLECLICK;
};
@@ -122,8 +124,8 @@ ol.events.condition.singleClick = function(mapBrowserEvent) {
* @return {boolean} True if the event is a map `dblclick` event.
* @api
*/
ol.events.condition.doubleClick = function(mapBrowserEvent) {
return mapBrowserEvent.type == ol.MapBrowserEventType.DBLCLICK;
_ol_events_condition_.doubleClick = function(mapBrowserEvent) {
return mapBrowserEvent.type == _ol_MapBrowserEventType_.DBLCLICK;
};
@@ -135,7 +137,7 @@ ol.events.condition.doubleClick = function(mapBrowserEvent) {
* @return {boolean} True only if there no modifier keys are pressed.
* @api
*/
ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
_ol_events_condition_.noModifierKeys = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
!originalEvent.altKey &&
@@ -153,12 +155,11 @@ ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
* @return {boolean} True if only the platform modifier key is pressed.
* @api
*/
ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
_ol_events_condition_.platformModifierKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
!originalEvent.altKey &&
(ol.has.MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
!originalEvent.shiftKey);
return !originalEvent.altKey &&
(_ol_has_.MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
!originalEvent.shiftKey;
};
@@ -170,7 +171,7 @@ ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
* @return {boolean} True if only the shift key is pressed.
* @api
*/
ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
_ol_events_condition_.shiftKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
!originalEvent.altKey &&
@@ -187,7 +188,7 @@ ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
* @return {boolean} True only if the target element is not editable.
* @api
*/
ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
_ol_events_condition_.targetNotEditable = function(mapBrowserEvent) {
var target = mapBrowserEvent.originalEvent.target;
var tagName = target.tagName;
return (
@@ -204,8 +205,8 @@ ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
* @return {boolean} True if the event originates from a mouse device.
* @api
*/
ol.events.condition.mouseOnly = function(mapBrowserEvent) {
ol.asserts.assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
_ol_events_condition_.mouseOnly = function(mapBrowserEvent) {
_ol_asserts_.assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
return /** @type {ol.MapBrowserEvent} */ (mapBrowserEvent).pointerEvent.pointerType == 'mouse';
};
@@ -220,7 +221,8 @@ ol.events.condition.mouseOnly = function(mapBrowserEvent) {
* @return {boolean} True if the event originates from a primary pointer.
* @api
*/
ol.events.condition.primaryAction = function(mapBrowserEvent) {
_ol_events_condition_.primaryAction = function(mapBrowserEvent) {
var pointerEvent = mapBrowserEvent.pointerEvent;
return pointerEvent.isPrimary && pointerEvent.button === 0;
};
export default _ol_events_condition_;

View File

@@ -1,8 +1,10 @@
goog.provide('ol.extent');
goog.require('ol.asserts');
goog.require('ol.extent.Corner');
goog.require('ol.extent.Relationship');
/**
* @module ol/extent
*/
import _ol_asserts_ from './asserts.js';
import _ol_extent_Corner_ from './extent/Corner.js';
import _ol_extent_Relationship_ from './extent/Relationship.js';
var _ol_extent_ = {};
/**
@@ -12,10 +14,10 @@ goog.require('ol.extent.Relationship');
* @return {ol.Extent} Bounding extent.
* @api
*/
ol.extent.boundingExtent = function(coordinates) {
var extent = ol.extent.createEmpty();
_ol_extent_.boundingExtent = function(coordinates) {
var extent = _ol_extent_.createEmpty();
for (var i = 0, ii = coordinates.length; i < ii; ++i) {
ol.extent.extendCoordinate(extent, coordinates[i]);
_ol_extent_.extendCoordinate(extent, coordinates[i]);
}
return extent;
};
@@ -28,12 +30,12 @@ ol.extent.boundingExtent = function(coordinates) {
* @private
* @return {ol.Extent} Extent.
*/
ol.extent.boundingExtentXYs_ = function(xs, ys, opt_extent) {
_ol_extent_.boundingExtentXYs_ = function(xs, ys, opt_extent) {
var minX = Math.min.apply(null, xs);
var minY = Math.min.apply(null, ys);
var maxX = Math.max.apply(null, xs);
var maxY = Math.max.apply(null, ys);
return ol.extent.createOrUpdate(minX, minY, maxX, maxY, opt_extent);
return _ol_extent_.createOrUpdate(minX, minY, maxX, maxY, opt_extent);
};
@@ -45,7 +47,7 @@ ol.extent.boundingExtentXYs_ = function(xs, ys, opt_extent) {
* @return {ol.Extent} Extent.
* @api
*/
ol.extent.buffer = function(extent, value, opt_extent) {
_ol_extent_.buffer = function(extent, value, opt_extent) {
if (opt_extent) {
opt_extent[0] = extent[0] - value;
opt_extent[1] = extent[1] - value;
@@ -70,7 +72,7 @@ ol.extent.buffer = function(extent, value, opt_extent) {
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} The clone.
*/
ol.extent.clone = function(extent, opt_extent) {
_ol_extent_.clone = function(extent, opt_extent) {
if (opt_extent) {
opt_extent[0] = extent[0];
opt_extent[1] = extent[1];
@@ -89,7 +91,7 @@ ol.extent.clone = function(extent, opt_extent) {
* @param {number} y Y.
* @return {number} Closest squared distance.
*/
ol.extent.closestSquaredDistanceXY = function(extent, x, y) {
_ol_extent_.closestSquaredDistanceXY = function(extent, x, y) {
var dx, dy;
if (x < extent[0]) {
dx = extent[0] - x;
@@ -117,8 +119,8 @@ ol.extent.closestSquaredDistanceXY = function(extent, x, y) {
* @return {boolean} The coordinate is contained in the extent.
* @api
*/
ol.extent.containsCoordinate = function(extent, coordinate) {
return ol.extent.containsXY(extent, coordinate[0], coordinate[1]);
_ol_extent_.containsCoordinate = function(extent, coordinate) {
return _ol_extent_.containsXY(extent, coordinate[0], coordinate[1]);
};
@@ -134,7 +136,7 @@ ol.extent.containsCoordinate = function(extent, coordinate) {
* first.
* @api
*/
ol.extent.containsExtent = function(extent1, extent2) {
_ol_extent_.containsExtent = function(extent1, extent2) {
return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] &&
extent1[1] <= extent2[1] && extent2[3] <= extent1[3];
};
@@ -149,7 +151,7 @@ ol.extent.containsExtent = function(extent1, extent2) {
* @return {boolean} The x, y values are contained in the extent.
* @api
*/
ol.extent.containsXY = function(extent, x, y) {
_ol_extent_.containsXY = function(extent, x, y) {
return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];
};
@@ -161,26 +163,26 @@ ol.extent.containsXY = function(extent, x, y) {
* @return {number} The relationship (bitwise compare with
* ol.extent.Relationship).
*/
ol.extent.coordinateRelationship = function(extent, coordinate) {
_ol_extent_.coordinateRelationship = function(extent, coordinate) {
var minX = extent[0];
var minY = extent[1];
var maxX = extent[2];
var maxY = extent[3];
var x = coordinate[0];
var y = coordinate[1];
var relationship = ol.extent.Relationship.UNKNOWN;
var relationship = _ol_extent_Relationship_.UNKNOWN;
if (x < minX) {
relationship = relationship | ol.extent.Relationship.LEFT;
relationship = relationship | _ol_extent_Relationship_.LEFT;
} else if (x > maxX) {
relationship = relationship | ol.extent.Relationship.RIGHT;
relationship = relationship | _ol_extent_Relationship_.RIGHT;
}
if (y < minY) {
relationship = relationship | ol.extent.Relationship.BELOW;
relationship = relationship | _ol_extent_Relationship_.BELOW;
} else if (y > maxY) {
relationship = relationship | ol.extent.Relationship.ABOVE;
relationship = relationship | _ol_extent_Relationship_.ABOVE;
}
if (relationship === ol.extent.Relationship.UNKNOWN) {
relationship = ol.extent.Relationship.INTERSECTING;
if (relationship === _ol_extent_Relationship_.UNKNOWN) {
relationship = _ol_extent_Relationship_.INTERSECTING;
}
return relationship;
};
@@ -191,7 +193,7 @@ ol.extent.coordinateRelationship = function(extent, coordinate) {
* @return {ol.Extent} Empty extent.
* @api
*/
ol.extent.createEmpty = function() {
_ol_extent_.createEmpty = function() {
return [Infinity, Infinity, -Infinity, -Infinity];
};
@@ -205,7 +207,7 @@ ol.extent.createEmpty = function() {
* @param {ol.Extent=} opt_extent Destination extent.
* @return {ol.Extent} Extent.
*/
ol.extent.createOrUpdate = function(minX, minY, maxX, maxY, opt_extent) {
_ol_extent_.createOrUpdate = function(minX, minY, maxX, maxY, opt_extent) {
if (opt_extent) {
opt_extent[0] = minX;
opt_extent[1] = minY;
@@ -223,8 +225,8 @@ ol.extent.createOrUpdate = function(minX, minY, maxX, maxY, opt_extent) {
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.createOrUpdateEmpty = function(opt_extent) {
return ol.extent.createOrUpdate(
_ol_extent_.createOrUpdateEmpty = function(opt_extent) {
return _ol_extent_.createOrUpdate(
Infinity, Infinity, -Infinity, -Infinity, opt_extent);
};
@@ -234,10 +236,10 @@ ol.extent.createOrUpdateEmpty = function(opt_extent) {
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.createOrUpdateFromCoordinate = function(coordinate, opt_extent) {
_ol_extent_.createOrUpdateFromCoordinate = function(coordinate, opt_extent) {
var x = coordinate[0];
var y = coordinate[1];
return ol.extent.createOrUpdate(x, y, x, y, opt_extent);
return _ol_extent_.createOrUpdate(x, y, x, y, opt_extent);
};
@@ -246,9 +248,9 @@ ol.extent.createOrUpdateFromCoordinate = function(coordinate, opt_extent) {
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.createOrUpdateFromCoordinates = function(coordinates, opt_extent) {
var extent = ol.extent.createOrUpdateEmpty(opt_extent);
return ol.extent.extendCoordinates(extent, coordinates);
_ol_extent_.createOrUpdateFromCoordinates = function(coordinates, opt_extent) {
var extent = _ol_extent_.createOrUpdateEmpty(opt_extent);
return _ol_extent_.extendCoordinates(extent, coordinates);
};
@@ -260,9 +262,9 @@ ol.extent.createOrUpdateFromCoordinates = function(coordinates, opt_extent) {
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.createOrUpdateFromFlatCoordinates = function(flatCoordinates, offset, end, stride, opt_extent) {
var extent = ol.extent.createOrUpdateEmpty(opt_extent);
return ol.extent.extendFlatCoordinates(
_ol_extent_.createOrUpdateFromFlatCoordinates = function(flatCoordinates, offset, end, stride, opt_extent) {
var extent = _ol_extent_.createOrUpdateEmpty(opt_extent);
return _ol_extent_.extendFlatCoordinates(
extent, flatCoordinates, offset, end, stride);
};
@@ -272,9 +274,9 @@ ol.extent.createOrUpdateFromFlatCoordinates = function(flatCoordinates, offset,
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.createOrUpdateFromRings = function(rings, opt_extent) {
var extent = ol.extent.createOrUpdateEmpty(opt_extent);
return ol.extent.extendRings(extent, rings);
_ol_extent_.createOrUpdateFromRings = function(rings, opt_extent) {
var extent = _ol_extent_.createOrUpdateEmpty(opt_extent);
return _ol_extent_.extendRings(extent, rings);
};
@@ -285,7 +287,7 @@ ol.extent.createOrUpdateFromRings = function(rings, opt_extent) {
* @return {boolean} The two extents are equivalent.
* @api
*/
ol.extent.equals = function(extent1, extent2) {
_ol_extent_.equals = function(extent1, extent2) {
return extent1[0] == extent2[0] && extent1[2] == extent2[2] &&
extent1[1] == extent2[1] && extent1[3] == extent2[3];
};
@@ -298,7 +300,7 @@ ol.extent.equals = function(extent1, extent2) {
* @return {ol.Extent} A reference to the first (extended) extent.
* @api
*/
ol.extent.extend = function(extent1, extent2) {
_ol_extent_.extend = function(extent1, extent2) {
if (extent2[0] < extent1[0]) {
extent1[0] = extent2[0];
}
@@ -319,7 +321,7 @@ ol.extent.extend = function(extent1, extent2) {
* @param {ol.Extent} extent Extent.
* @param {ol.Coordinate} coordinate Coordinate.
*/
ol.extent.extendCoordinate = function(extent, coordinate) {
_ol_extent_.extendCoordinate = function(extent, coordinate) {
if (coordinate[0] < extent[0]) {
extent[0] = coordinate[0];
}
@@ -340,10 +342,10 @@ ol.extent.extendCoordinate = function(extent, coordinate) {
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
* @return {ol.Extent} Extent.
*/
ol.extent.extendCoordinates = function(extent, coordinates) {
_ol_extent_.extendCoordinates = function(extent, coordinates) {
var i, ii;
for (i = 0, ii = coordinates.length; i < ii; ++i) {
ol.extent.extendCoordinate(extent, coordinates[i]);
_ol_extent_.extendCoordinate(extent, coordinates[i]);
}
return extent;
};
@@ -357,9 +359,9 @@ ol.extent.extendCoordinates = function(extent, coordinates) {
* @param {number} stride Stride.
* @return {ol.Extent} Extent.
*/
ol.extent.extendFlatCoordinates = function(extent, flatCoordinates, offset, end, stride) {
_ol_extent_.extendFlatCoordinates = function(extent, flatCoordinates, offset, end, stride) {
for (; offset < end; offset += stride) {
ol.extent.extendXY(
_ol_extent_.extendXY(
extent, flatCoordinates[offset], flatCoordinates[offset + 1]);
}
return extent;
@@ -371,10 +373,10 @@ ol.extent.extendFlatCoordinates = function(extent, flatCoordinates, offset, end,
* @param {Array.<Array.<ol.Coordinate>>} rings Rings.
* @return {ol.Extent} Extent.
*/
ol.extent.extendRings = function(extent, rings) {
_ol_extent_.extendRings = function(extent, rings) {
var i, ii;
for (i = 0, ii = rings.length; i < ii; ++i) {
ol.extent.extendCoordinates(extent, rings[i]);
_ol_extent_.extendCoordinates(extent, rings[i]);
}
return extent;
};
@@ -385,7 +387,7 @@ ol.extent.extendRings = function(extent, rings) {
* @param {number} x X.
* @param {number} y Y.
*/
ol.extent.extendXY = function(extent, x, y) {
_ol_extent_.extendXY = function(extent, x, y) {
extent[0] = Math.min(extent[0], x);
extent[1] = Math.min(extent[1], y);
extent[2] = Math.max(extent[2], x);
@@ -403,21 +405,21 @@ ol.extent.extendXY = function(extent, x, y) {
* @return {S|boolean} Value.
* @template S, T
*/
ol.extent.forEachCorner = function(extent, callback, opt_this) {
_ol_extent_.forEachCorner = function(extent, callback, opt_this) {
var val;
val = callback.call(opt_this, ol.extent.getBottomLeft(extent));
val = callback.call(opt_this, _ol_extent_.getBottomLeft(extent));
if (val) {
return val;
}
val = callback.call(opt_this, ol.extent.getBottomRight(extent));
val = callback.call(opt_this, _ol_extent_.getBottomRight(extent));
if (val) {
return val;
}
val = callback.call(opt_this, ol.extent.getTopRight(extent));
val = callback.call(opt_this, _ol_extent_.getTopRight(extent));
if (val) {
return val;
}
val = callback.call(opt_this, ol.extent.getTopLeft(extent));
val = callback.call(opt_this, _ol_extent_.getTopLeft(extent));
if (val) {
return val;
}
@@ -431,10 +433,10 @@ ol.extent.forEachCorner = function(extent, callback, opt_this) {
* @return {number} Area.
* @api
*/
ol.extent.getArea = function(extent) {
_ol_extent_.getArea = function(extent) {
var area = 0;
if (!ol.extent.isEmpty(extent)) {
area = ol.extent.getWidth(extent) * ol.extent.getHeight(extent);
if (!_ol_extent_.isEmpty(extent)) {
area = _ol_extent_.getWidth(extent) * _ol_extent_.getHeight(extent);
}
return area;
};
@@ -446,7 +448,7 @@ ol.extent.getArea = function(extent) {
* @return {ol.Coordinate} Bottom left coordinate.
* @api
*/
ol.extent.getBottomLeft = function(extent) {
_ol_extent_.getBottomLeft = function(extent) {
return [extent[0], extent[1]];
};
@@ -457,7 +459,7 @@ ol.extent.getBottomLeft = function(extent) {
* @return {ol.Coordinate} Bottom right coordinate.
* @api
*/
ol.extent.getBottomRight = function(extent) {
_ol_extent_.getBottomRight = function(extent) {
return [extent[2], extent[1]];
};
@@ -468,7 +470,7 @@ ol.extent.getBottomRight = function(extent) {
* @return {ol.Coordinate} Center.
* @api
*/
ol.extent.getCenter = function(extent) {
_ol_extent_.getCenter = function(extent) {
return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];
};
@@ -479,18 +481,18 @@ ol.extent.getCenter = function(extent) {
* @param {ol.extent.Corner} corner Corner.
* @return {ol.Coordinate} Corner coordinate.
*/
ol.extent.getCorner = function(extent, corner) {
_ol_extent_.getCorner = function(extent, corner) {
var coordinate;
if (corner === ol.extent.Corner.BOTTOM_LEFT) {
coordinate = ol.extent.getBottomLeft(extent);
} else if (corner === ol.extent.Corner.BOTTOM_RIGHT) {
coordinate = ol.extent.getBottomRight(extent);
} else if (corner === ol.extent.Corner.TOP_LEFT) {
coordinate = ol.extent.getTopLeft(extent);
} else if (corner === ol.extent.Corner.TOP_RIGHT) {
coordinate = ol.extent.getTopRight(extent);
if (corner === _ol_extent_Corner_.BOTTOM_LEFT) {
coordinate = _ol_extent_.getBottomLeft(extent);
} else if (corner === _ol_extent_Corner_.BOTTOM_RIGHT) {
coordinate = _ol_extent_.getBottomRight(extent);
} else if (corner === _ol_extent_Corner_.TOP_LEFT) {
coordinate = _ol_extent_.getTopLeft(extent);
} else if (corner === _ol_extent_Corner_.TOP_RIGHT) {
coordinate = _ol_extent_.getTopRight(extent);
} else {
ol.asserts.assert(false, 13); // Invalid corner
_ol_asserts_.assert(false, 13); // Invalid corner
}
return /** @type {!ol.Coordinate} */ (coordinate);
};
@@ -501,7 +503,7 @@ ol.extent.getCorner = function(extent, corner) {
* @param {ol.Extent} extent2 Extent 2.
* @return {number} Enlarged area.
*/
ol.extent.getEnlargedArea = function(extent1, extent2) {
_ol_extent_.getEnlargedArea = function(extent1, extent2) {
var minX = Math.min(extent1[0], extent2[0]);
var minY = Math.min(extent1[1], extent2[1]);
var maxX = Math.max(extent1[2], extent2[2]);
@@ -518,7 +520,7 @@ ol.extent.getEnlargedArea = function(extent1, extent2) {
* @param {ol.Extent=} opt_extent Destination extent.
* @return {ol.Extent} Extent.
*/
ol.extent.getForViewAndSize = function(center, resolution, rotation, size, opt_extent) {
_ol_extent_.getForViewAndSize = function(center, resolution, rotation, size, opt_extent) {
var dx = resolution * size[0] / 2;
var dy = resolution * size[1] / 2;
var cosRotation = Math.cos(rotation);
@@ -537,7 +539,7 @@ ol.extent.getForViewAndSize = function(center, resolution, rotation, size, opt_e
var y1 = y - xSin + yCos;
var y2 = y + xSin + yCos;
var y3 = y + xSin - yCos;
return ol.extent.createOrUpdate(
return _ol_extent_.createOrUpdate(
Math.min(x0, x1, x2, x3), Math.min(y0, y1, y2, y3),
Math.max(x0, x1, x2, x3), Math.max(y0, y1, y2, y3),
opt_extent);
@@ -550,7 +552,7 @@ ol.extent.getForViewAndSize = function(center, resolution, rotation, size, opt_e
* @return {number} Height.
* @api
*/
ol.extent.getHeight = function(extent) {
_ol_extent_.getHeight = function(extent) {
return extent[3] - extent[1];
};
@@ -560,9 +562,9 @@ ol.extent.getHeight = function(extent) {
* @param {ol.Extent} extent2 Extent 2.
* @return {number} Intersection area.
*/
ol.extent.getIntersectionArea = function(extent1, extent2) {
var intersection = ol.extent.getIntersection(extent1, extent2);
return ol.extent.getArea(intersection);
_ol_extent_.getIntersectionArea = function(extent1, extent2) {
var intersection = _ol_extent_.getIntersection(extent1, extent2);
return _ol_extent_.getArea(intersection);
};
@@ -574,9 +576,9 @@ ol.extent.getIntersectionArea = function(extent1, extent2) {
* @return {ol.Extent} Intersecting extent.
* @api
*/
ol.extent.getIntersection = function(extent1, extent2, opt_extent) {
var intersection = opt_extent ? opt_extent : ol.extent.createEmpty();
if (ol.extent.intersects(extent1, extent2)) {
_ol_extent_.getIntersection = function(extent1, extent2, opt_extent) {
var intersection = opt_extent ? opt_extent : _ol_extent_.createEmpty();
if (_ol_extent_.intersects(extent1, extent2)) {
if (extent1[0] > extent2[0]) {
intersection[0] = extent1[0];
} else {
@@ -606,8 +608,8 @@ ol.extent.getIntersection = function(extent1, extent2, opt_extent) {
* @param {ol.Extent} extent Extent.
* @return {number} Margin.
*/
ol.extent.getMargin = function(extent) {
return ol.extent.getWidth(extent) + ol.extent.getHeight(extent);
_ol_extent_.getMargin = function(extent) {
return _ol_extent_.getWidth(extent) + _ol_extent_.getHeight(extent);
};
@@ -617,7 +619,7 @@ ol.extent.getMargin = function(extent) {
* @return {ol.Size} The extent size.
* @api
*/
ol.extent.getSize = function(extent) {
_ol_extent_.getSize = function(extent) {
return [extent[2] - extent[0], extent[3] - extent[1]];
};
@@ -628,7 +630,7 @@ ol.extent.getSize = function(extent) {
* @return {ol.Coordinate} Top left coordinate.
* @api
*/
ol.extent.getTopLeft = function(extent) {
_ol_extent_.getTopLeft = function(extent) {
return [extent[0], extent[3]];
};
@@ -639,7 +641,7 @@ ol.extent.getTopLeft = function(extent) {
* @return {ol.Coordinate} Top right coordinate.
* @api
*/
ol.extent.getTopRight = function(extent) {
_ol_extent_.getTopRight = function(extent) {
return [extent[2], extent[3]];
};
@@ -650,7 +652,7 @@ ol.extent.getTopRight = function(extent) {
* @return {number} Width.
* @api
*/
ol.extent.getWidth = function(extent) {
_ol_extent_.getWidth = function(extent) {
return extent[2] - extent[0];
};
@@ -662,7 +664,7 @@ ol.extent.getWidth = function(extent) {
* @return {boolean} The two extents intersect.
* @api
*/
ol.extent.intersects = function(extent1, extent2) {
_ol_extent_.intersects = function(extent1, extent2) {
return extent1[0] <= extent2[2] &&
extent1[2] >= extent2[0] &&
extent1[1] <= extent2[3] &&
@@ -676,7 +678,7 @@ ol.extent.intersects = function(extent1, extent2) {
* @return {boolean} Is empty.
* @api
*/
ol.extent.isEmpty = function(extent) {
_ol_extent_.isEmpty = function(extent) {
return extent[2] < extent[0] || extent[3] < extent[1];
};
@@ -686,7 +688,7 @@ ol.extent.isEmpty = function(extent) {
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.returnOrUpdate = function(extent, opt_extent) {
_ol_extent_.returnOrUpdate = function(extent, opt_extent) {
if (opt_extent) {
opt_extent[0] = extent[0];
opt_extent[1] = extent[1];
@@ -703,7 +705,7 @@ ol.extent.returnOrUpdate = function(extent, opt_extent) {
* @param {ol.Extent} extent Extent.
* @param {number} value Value.
*/
ol.extent.scaleFromCenter = function(extent, value) {
_ol_extent_.scaleFromCenter = function(extent, value) {
var deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);
var deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);
extent[0] -= deltaX;
@@ -721,12 +723,12 @@ ol.extent.scaleFromCenter = function(extent, value) {
* @param {ol.Coordinate} end Segment end coordinate.
* @return {boolean} The segment intersects the extent.
*/
ol.extent.intersectsSegment = function(extent, start, end) {
_ol_extent_.intersectsSegment = function(extent, start, end) {
var intersects = false;
var startRel = ol.extent.coordinateRelationship(extent, start);
var endRel = ol.extent.coordinateRelationship(extent, end);
if (startRel === ol.extent.Relationship.INTERSECTING ||
endRel === ol.extent.Relationship.INTERSECTING) {
var startRel = _ol_extent_.coordinateRelationship(extent, start);
var endRel = _ol_extent_.coordinateRelationship(extent, end);
if (startRel === _ol_extent_Relationship_.INTERSECTING ||
endRel === _ol_extent_Relationship_.INTERSECTING) {
intersects = true;
} else {
var minX = extent[0];
@@ -739,26 +741,26 @@ ol.extent.intersectsSegment = function(extent, start, end) {
var endY = end[1];
var slope = (endY - startY) / (endX - startX);
var x, y;
if (!!(endRel & ol.extent.Relationship.ABOVE) &&
!(startRel & ol.extent.Relationship.ABOVE)) {
if (!!(endRel & _ol_extent_Relationship_.ABOVE) &&
!(startRel & _ol_extent_Relationship_.ABOVE)) {
// potentially intersects top
x = endX - ((endY - maxY) / slope);
intersects = x >= minX && x <= maxX;
}
if (!intersects && !!(endRel & ol.extent.Relationship.RIGHT) &&
!(startRel & ol.extent.Relationship.RIGHT)) {
if (!intersects && !!(endRel & _ol_extent_Relationship_.RIGHT) &&
!(startRel & _ol_extent_Relationship_.RIGHT)) {
// potentially intersects right
y = endY - ((endX - maxX) * slope);
intersects = y >= minY && y <= maxY;
}
if (!intersects && !!(endRel & ol.extent.Relationship.BELOW) &&
!(startRel & ol.extent.Relationship.BELOW)) {
if (!intersects && !!(endRel & _ol_extent_Relationship_.BELOW) &&
!(startRel & _ol_extent_Relationship_.BELOW)) {
// potentially intersects bottom
x = endX - ((endY - minY) / slope);
intersects = x >= minX && x <= maxX;
}
if (!intersects && !!(endRel & ol.extent.Relationship.LEFT) &&
!(startRel & ol.extent.Relationship.LEFT)) {
if (!intersects && !!(endRel & _ol_extent_Relationship_.LEFT) &&
!(startRel & _ol_extent_Relationship_.LEFT)) {
// potentially intersects left
y = endY - ((endX - minX) * slope);
intersects = y >= minY && y <= maxY;
@@ -778,7 +780,7 @@ ol.extent.intersectsSegment = function(extent, start, end) {
* @return {ol.Extent} Extent.
* @api
*/
ol.extent.applyTransform = function(extent, transformFn, opt_extent) {
_ol_extent_.applyTransform = function(extent, transformFn, opt_extent) {
var coordinates = [
extent[0], extent[1],
extent[0], extent[3],
@@ -788,5 +790,6 @@ ol.extent.applyTransform = function(extent, transformFn, opt_extent) {
transformFn(coordinates, coordinates, 2);
var xs = [coordinates[0], coordinates[2], coordinates[4], coordinates[6]];
var ys = [coordinates[1], coordinates[3], coordinates[5], coordinates[7]];
return ol.extent.boundingExtentXYs_(xs, ys, opt_extent);
return _ol_extent_.boundingExtentXYs_(xs, ys, opt_extent);
};
export default _ol_extent_;

View File

@@ -1,12 +1,15 @@
goog.provide('ol.extent.Corner');
/**
* @module ol/extent/Corner
*/
/**
* Extent corner.
* @enum {string}
*/
ol.extent.Corner = {
var _ol_extent_Corner_ = {
BOTTOM_LEFT: 'bottom-left',
BOTTOM_RIGHT: 'bottom-right',
TOP_LEFT: 'top-left',
TOP_RIGHT: 'top-right'
};
export default _ol_extent_Corner_;

View File

@@ -1,11 +1,11 @@
goog.provide('ol.extent.Relationship');
/**
* @module ol/extent/Relationship
*/
/**
* Relationship to an extent.
* @enum {number}
*/
ol.extent.Relationship = {
var _ol_extent_Relationship_ = {
UNKNOWN: 0,
INTERSECTING: 1,
ABOVE: 2,
@@ -13,3 +13,5 @@ ol.extent.Relationship = {
BELOW: 8,
LEFT: 16
};
export default _ol_extent_Relationship_;

View File

@@ -1,8 +1,10 @@
goog.provide('ol.featureloader');
goog.require('ol');
goog.require('ol.format.FormatType');
goog.require('ol.xml');
/**
* @module ol/featureloader
*/
import _ol_ from './index.js';
import _ol_format_FormatType_ from './format/FormatType.js';
import _ol_xml_ from './xml.js';
var _ol_featureloader_ = {};
/**
@@ -16,7 +18,7 @@ goog.require('ol.xml');
* source as `this`.
* @return {ol.FeatureLoader} The feature loader.
*/
ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
_ol_featureloader_.loadFeaturesXhr = function(url, format, success, failure) {
return (
/**
* @param {ol.Extent} extent Extent.
@@ -29,7 +31,7 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
xhr.open('GET',
typeof url === 'function' ? url(extent, resolution, projection) : url,
true);
if (format.getType() == ol.format.FormatType.ARRAY_BUFFER) {
if (format.getType() == _ol_format_FormatType_.ARRAY_BUFFER) {
xhr.responseType = 'arraybuffer';
}
/**
@@ -42,15 +44,15 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
var type = format.getType();
/** @type {Document|Node|Object|string|undefined} */
var source;
if (type == ol.format.FormatType.JSON ||
type == ol.format.FormatType.TEXT) {
if (type == _ol_format_FormatType_.JSON ||
type == _ol_format_FormatType_.TEXT) {
source = xhr.responseText;
} else if (type == ol.format.FormatType.XML) {
} else if (type == _ol_format_FormatType_.XML) {
source = xhr.responseXML;
if (!source) {
source = ol.xml.parse(xhr.responseText);
source = _ol_xml_.parse(xhr.responseText);
}
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
} else if (type == _ol_format_FormatType_.ARRAY_BUFFER) {
source = /** @type {ArrayBuffer} */ (xhr.response);
}
if (source) {
@@ -71,7 +73,8 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
failure.call(this);
}.bind(this);
xhr.send();
});
}
);
};
@@ -84,8 +87,8 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
* @return {ol.FeatureLoader} The feature loader.
* @api
*/
ol.featureloader.xhr = function(url, format) {
return ol.featureloader.loadFeaturesXhr(url, format,
_ol_featureloader_.xhr = function(url, format) {
return _ol_featureloader_.loadFeaturesXhr(url, format,
/**
* @param {Array.<ol.Feature>} features The loaded features.
* @param {ol.proj.Projection} dataProjection Data projection.
@@ -93,5 +96,6 @@ ol.featureloader.xhr = function(url, format) {
*/
function(features, dataProjection) {
this.addFeatures(features);
}, /* FIXME handle error */ ol.nullFunction);
}, /* FIXME handle error */ _ol_.nullFunction);
};
export default _ol_featureloader_;

View File

@@ -1,25 +1,25 @@
goog.provide('ol.format.EsriJSON');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.asserts');
goog.require('ol.extent');
goog.require('ol.format.Feature');
goog.require('ol.format.JSONFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.flat.deflate');
goog.require('ol.geom.flat.orient');
goog.require('ol.obj');
goog.require('ol.proj');
/**
* @module ol/format/EsriJSON
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_asserts_ from '../asserts.js';
import _ol_extent_ from '../extent.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -30,11 +30,11 @@ goog.require('ol.proj');
* @param {olx.format.EsriJSONOptions=} opt_options Options.
* @api
*/
ol.format.EsriJSON = function(opt_options) {
var _ol_format_EsriJSON_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.JSONFeature.call(this);
_ol_format_JSONFeature_.call(this);
/**
* Name of the geometry attribute for features.
@@ -44,7 +44,8 @@ ol.format.EsriJSON = function(opt_options) {
this.geometryName_ = options.geometryName;
};
ol.inherits(ol.format.EsriJSON, ol.format.JSONFeature);
_ol_.inherits(_ol_format_EsriJSON_, _ol_format_JSONFeature_);
/**
@@ -53,38 +54,39 @@ ol.inherits(ol.format.EsriJSON, ol.format.JSONFeature);
* @private
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
_ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) {
if (!object) {
return null;
}
/** @type {ol.geom.GeometryType} */
var type;
if (typeof object.x === 'number' && typeof object.y === 'number') {
type = ol.geom.GeometryType.POINT;
type = _ol_geom_GeometryType_.POINT;
} else if (object.points) {
type = ol.geom.GeometryType.MULTI_POINT;
type = _ol_geom_GeometryType_.MULTI_POINT;
} else if (object.paths) {
if (object.paths.length === 1) {
type = ol.geom.GeometryType.LINE_STRING;
type = _ol_geom_GeometryType_.LINE_STRING;
} else {
type = ol.geom.GeometryType.MULTI_LINE_STRING;
type = _ol_geom_GeometryType_.MULTI_LINE_STRING;
}
} else if (object.rings) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
var rings = ol.format.EsriJSON.convertRings_(object.rings, layout);
object = /** @type {EsriJSONGeometry} */(ol.obj.assign({}, object));
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
var rings = _ol_format_EsriJSON_.convertRings_(object.rings, layout);
object = /** @type {EsriJSONGeometry} */(_ol_obj_.assign({}, object));
if (rings.length === 1) {
type = ol.geom.GeometryType.POLYGON;
type = _ol_geom_GeometryType_.POLYGON;
object.rings = rings[0];
} else {
type = ol.geom.GeometryType.MULTI_POLYGON;
type = _ol_geom_GeometryType_.MULTI_POLYGON;
object.rings = rings;
}
}
var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type];
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options));
var geometryReader = _ol_format_EsriJSON_.GEOMETRY_READERS_[type];
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(
geometryReader(object), false, opt_options)
);
};
@@ -98,16 +100,16 @@ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
* @private
* @return {Array.<!Array.<!Array.<number>>>} Transformed rings.
*/
ol.format.EsriJSON.convertRings_ = function(rings, layout) {
_ol_format_EsriJSON_.convertRings_ = function(rings, layout) {
var flatRing = [];
var outerRings = [];
var holes = [];
var i, ii;
for (i = 0, ii = rings.length; i < ii; ++i) {
flatRing.length = 0;
ol.geom.flat.deflate.coordinates(flatRing, 0, rings[i], layout.length);
_ol_geom_flat_deflate_.coordinates(flatRing, 0, rings[i], layout.length);
// is this ring an outer ring? is it clockwise?
var clockwise = ol.geom.flat.orient.linearRingIsClockwise(flatRing, 0,
var clockwise = _ol_geom_flat_orient_.linearRingIsClockwise(flatRing, 0,
flatRing.length, layout.length);
if (clockwise) {
outerRings.push([rings[i]]);
@@ -121,9 +123,9 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
// loop over all outer rings and see if they contain our hole.
for (i = outerRings.length - 1; i >= 0; i--) {
var outerRing = outerRings[i][0];
var containsHole = ol.extent.containsExtent(
new ol.geom.LinearRing(outerRing).getExtent(),
new ol.geom.LinearRing(hole).getExtent()
var containsHole = _ol_extent_.containsExtent(
new _ol_geom_LinearRing_(outerRing).getExtent(),
new _ol_geom_LinearRing_(hole).getExtent()
);
if (containsHole) {
// the hole is contained push it into our polygon
@@ -147,19 +149,19 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
* @private
* @return {ol.geom.Geometry} Point.
*/
ol.format.EsriJSON.readPointGeometry_ = function(object) {
_ol_format_EsriJSON_.readPointGeometry_ = function(object) {
var point;
if (object.m !== undefined && object.z !== undefined) {
point = new ol.geom.Point([object.x, object.y, object.z, object.m],
ol.geom.GeometryLayout.XYZM);
point = new _ol_geom_Point_([object.x, object.y, object.z, object.m],
_ol_geom_GeometryLayout_.XYZM);
} else if (object.z !== undefined) {
point = new ol.geom.Point([object.x, object.y, object.z],
ol.geom.GeometryLayout.XYZ);
point = new _ol_geom_Point_([object.x, object.y, object.z],
_ol_geom_GeometryLayout_.XYZ);
} else if (object.m !== undefined) {
point = new ol.geom.Point([object.x, object.y, object.m],
ol.geom.GeometryLayout.XYM);
point = new _ol_geom_Point_([object.x, object.y, object.m],
_ol_geom_GeometryLayout_.XYM);
} else {
point = new ol.geom.Point([object.x, object.y]);
point = new _ol_geom_Point_([object.x, object.y]);
}
return point;
};
@@ -170,9 +172,9 @@ ol.format.EsriJSON.readPointGeometry_ = function(object) {
* @private
* @return {ol.geom.Geometry} LineString.
*/
ol.format.EsriJSON.readLineStringGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.LineString(object.paths[0], layout);
_ol_format_EsriJSON_.readLineStringGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_LineString_(object.paths[0], layout);
};
@@ -181,9 +183,9 @@ ol.format.EsriJSON.readLineStringGeometry_ = function(object) {
* @private
* @return {ol.geom.Geometry} MultiLineString.
*/
ol.format.EsriJSON.readMultiLineStringGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.MultiLineString(object.paths, layout);
_ol_format_EsriJSON_.readMultiLineStringGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_MultiLineString_(object.paths, layout);
};
@@ -192,14 +194,14 @@ ol.format.EsriJSON.readMultiLineStringGeometry_ = function(object) {
* @private
* @return {ol.geom.GeometryLayout} The geometry layout to use.
*/
ol.format.EsriJSON.getGeometryLayout_ = function(object) {
var layout = ol.geom.GeometryLayout.XY;
_ol_format_EsriJSON_.getGeometryLayout_ = function(object) {
var layout = _ol_geom_GeometryLayout_.XY;
if (object.hasZ === true && object.hasM === true) {
layout = ol.geom.GeometryLayout.XYZM;
layout = _ol_geom_GeometryLayout_.XYZM;
} else if (object.hasZ === true) {
layout = ol.geom.GeometryLayout.XYZ;
layout = _ol_geom_GeometryLayout_.XYZ;
} else if (object.hasM === true) {
layout = ol.geom.GeometryLayout.XYM;
layout = _ol_geom_GeometryLayout_.XYM;
}
return layout;
};
@@ -210,9 +212,9 @@ ol.format.EsriJSON.getGeometryLayout_ = function(object) {
* @private
* @return {ol.geom.Geometry} MultiPoint.
*/
ol.format.EsriJSON.readMultiPointGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.MultiPoint(object.points, layout);
_ol_format_EsriJSON_.readMultiPointGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_MultiPoint_(object.points, layout);
};
@@ -221,9 +223,9 @@ ol.format.EsriJSON.readMultiPointGeometry_ = function(object) {
* @private
* @return {ol.geom.Geometry} MultiPolygon.
*/
ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.MultiPolygon(
_ol_format_EsriJSON_.readMultiPolygonGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_MultiPolygon_(
/** @type {Array.<Array.<Array.<Array.<number>>>>} */(object.rings),
layout);
};
@@ -234,9 +236,9 @@ ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) {
* @private
* @return {ol.geom.Geometry} Polygon.
*/
ol.format.EsriJSON.readPolygonGeometry_ = function(object) {
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.Polygon(object.rings, layout);
_ol_format_EsriJSON_.readPolygonGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
return new _ol_geom_Polygon_(object.rings, layout);
};
@@ -246,36 +248,36 @@ ol.format.EsriJSON.readPolygonGeometry_ = function(object) {
* @private
* @return {EsriJSONGeometry} EsriJSON geometry.
*/
ol.format.EsriJSON.writePointGeometry_ = function(geometry, opt_options) {
_ol_format_EsriJSON_.writePointGeometry_ = function(geometry, opt_options) {
var coordinates = /** @type {ol.geom.Point} */ (geometry).getCoordinates();
var esriJSON;
var layout = /** @type {ol.geom.Point} */ (geometry).getLayout();
if (layout === ol.geom.GeometryLayout.XYZ) {
if (layout === _ol_geom_GeometryLayout_.XYZ) {
esriJSON = /** @type {EsriJSONPoint} */ ({
x: coordinates[0],
y: coordinates[1],
z: coordinates[2]
});
} else if (layout === ol.geom.GeometryLayout.XYM) {
} else if (layout === _ol_geom_GeometryLayout_.XYM) {
esriJSON = /** @type {EsriJSONPoint} */ ({
x: coordinates[0],
y: coordinates[1],
m: coordinates[2]
});
} else if (layout === ol.geom.GeometryLayout.XYZM) {
} else if (layout === _ol_geom_GeometryLayout_.XYZM) {
esriJSON = /** @type {EsriJSONPoint} */ ({
x: coordinates[0],
y: coordinates[1],
z: coordinates[2],
m: coordinates[3]
});
} else if (layout === ol.geom.GeometryLayout.XY) {
} else if (layout === _ol_geom_GeometryLayout_.XY) {
esriJSON = /** @type {EsriJSONPoint} */ ({
x: coordinates[0],
y: coordinates[1]
});
} else {
ol.asserts.assert(false, 34); // Invalid geometry layout
_ol_asserts_.assert(false, 34); // Invalid geometry layout
}
return /** @type {EsriJSONGeometry} */ (esriJSON);
};
@@ -286,13 +288,13 @@ ol.format.EsriJSON.writePointGeometry_ = function(geometry, opt_options) {
* @private
* @return {Object} Object with boolean hasZ and hasM keys.
*/
ol.format.EsriJSON.getHasZM_ = function(geometry) {
_ol_format_EsriJSON_.getHasZM_ = function(geometry) {
var layout = geometry.getLayout();
return {
hasZ: (layout === ol.geom.GeometryLayout.XYZ ||
layout === ol.geom.GeometryLayout.XYZM),
hasM: (layout === ol.geom.GeometryLayout.XYM ||
layout === ol.geom.GeometryLayout.XYZM)
hasZ: (layout === _ol_geom_GeometryLayout_.XYZ ||
layout === _ol_geom_GeometryLayout_.XYZM),
hasM: (layout === _ol_geom_GeometryLayout_.XYM ||
layout === _ol_geom_GeometryLayout_.XYZM)
};
};
@@ -303,8 +305,8 @@ ol.format.EsriJSON.getHasZM_ = function(geometry) {
* @private
* @return {EsriJSONPolyline} EsriJSON geometry.
*/
ol.format.EsriJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.LineString} */(geometry));
_ol_format_EsriJSON_.writeLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.LineString} */(geometry));
return /** @type {EsriJSONPolyline} */ ({
hasZ: hasZM.hasZ,
hasM: hasZM.hasM,
@@ -321,9 +323,9 @@ ol.format.EsriJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
* @private
* @return {EsriJSONPolygon} EsriJSON geometry.
*/
ol.format.EsriJSON.writePolygonGeometry_ = function(geometry, opt_options) {
_ol_format_EsriJSON_.writePolygonGeometry_ = function(geometry, opt_options) {
// Esri geometries use the left-hand rule
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.Polygon} */(geometry));
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.Polygon} */(geometry));
return /** @type {EsriJSONPolygon} */ ({
hasZ: hasZM.hasZ,
hasM: hasZM.hasM,
@@ -338,8 +340,8 @@ ol.format.EsriJSON.writePolygonGeometry_ = function(geometry, opt_options) {
* @private
* @return {EsriJSONPolyline} EsriJSON geometry.
*/
ol.format.EsriJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.MultiLineString} */(geometry));
_ol_format_EsriJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiLineString} */(geometry));
return /** @type {EsriJSONPolyline} */ ({
hasZ: hasZM.hasZ,
hasM: hasZM.hasM,
@@ -354,8 +356,8 @@ ol.format.EsriJSON.writeMultiLineStringGeometry_ = function(geometry, opt_option
* @private
* @return {EsriJSONMultipoint} EsriJSON geometry.
*/
ol.format.EsriJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.MultiPoint} */(geometry));
_ol_format_EsriJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiPoint} */(geometry));
return /** @type {EsriJSONMultipoint} */ ({
hasZ: hasZM.hasZ,
hasM: hasZM.hasM,
@@ -370,9 +372,9 @@ ol.format.EsriJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
* @private
* @return {EsriJSONPolygon} EsriJSON geometry.
*/
ol.format.EsriJSON.writeMultiPolygonGeometry_ = function(geometry,
_ol_format_EsriJSON_.writeMultiPolygonGeometry_ = function(geometry,
opt_options) {
var hasZM = ol.format.EsriJSON.getHasZM_(/** @type {ol.geom.MultiPolygon} */(geometry));
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiPolygon} */(geometry));
var coordinates = /** @type {ol.geom.MultiPolygon} */ (geometry).getCoordinates(false);
var output = [];
for (var i = 0; i < coordinates.length; i++) {
@@ -393,19 +395,19 @@ ol.format.EsriJSON.writeMultiPolygonGeometry_ = function(geometry,
* @private
* @type {Object.<ol.geom.GeometryType, function(EsriJSONGeometry): ol.geom.Geometry>}
*/
ol.format.EsriJSON.GEOMETRY_READERS_ = {};
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.POINT] =
ol.format.EsriJSON.readPointGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.LINE_STRING] =
ol.format.EsriJSON.readLineStringGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.POLYGON] =
ol.format.EsriJSON.readPolygonGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_POINT] =
ol.format.EsriJSON.readMultiPointGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_LINE_STRING] =
ol.format.EsriJSON.readMultiLineStringGeometry_;
ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_POLYGON] =
ol.format.EsriJSON.readMultiPolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_ = {};
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.POINT] =
_ol_format_EsriJSON_.readPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.LINE_STRING] =
_ol_format_EsriJSON_.readLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.POLYGON] =
_ol_format_EsriJSON_.readPolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_POINT] =
_ol_format_EsriJSON_.readMultiPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.readMultiLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_POLYGON] =
_ol_format_EsriJSON_.readMultiPolygonGeometry_;
/**
@@ -413,19 +415,19 @@ ol.format.EsriJSON.GEOMETRY_READERS_[ol.geom.GeometryType.MULTI_POLYGON] =
* @private
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (EsriJSONGeometry)>}
*/
ol.format.EsriJSON.GEOMETRY_WRITERS_ = {};
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.POINT] =
ol.format.EsriJSON.writePointGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.LINE_STRING] =
ol.format.EsriJSON.writeLineStringGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.POLYGON] =
ol.format.EsriJSON.writePolygonGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_POINT] =
ol.format.EsriJSON.writeMultiPointGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_LINE_STRING] =
ol.format.EsriJSON.writeMultiLineStringGeometry_;
ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_POLYGON] =
ol.format.EsriJSON.writeMultiPolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_ = {};
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.POINT] =
_ol_format_EsriJSON_.writePointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.LINE_STRING] =
_ol_format_EsriJSON_.writeLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.POLYGON] =
_ol_format_EsriJSON_.writePolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_POINT] =
_ol_format_EsriJSON_.writeMultiPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.writeMultiLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_POLYGON] =
_ol_format_EsriJSON_.writeMultiPolygonGeometry_;
/**
@@ -438,7 +440,7 @@ ol.format.EsriJSON.GEOMETRY_WRITERS_[ol.geom.GeometryType.MULTI_POLYGON] =
* @return {ol.Feature} Feature.
* @api
*/
ol.format.EsriJSON.prototype.readFeature;
_ol_format_EsriJSON_.prototype.readFeature;
/**
@@ -451,18 +453,18 @@ ol.format.EsriJSON.prototype.readFeature;
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.EsriJSON.prototype.readFeatures;
_ol_format_EsriJSON_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.EsriJSON.prototype.readFeatureFromObject = function(
_ol_format_EsriJSON_.prototype.readFeatureFromObject = function(
object, opt_options) {
var esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
var geometry = ol.format.EsriJSON.readGeometry_(esriJSONFeature.geometry,
var geometry = _ol_format_EsriJSON_.readGeometry_(esriJSONFeature.geometry,
opt_options);
var feature = new ol.Feature();
var feature = new _ol_Feature_();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
}
@@ -482,7 +484,7 @@ ol.format.EsriJSON.prototype.readFeatureFromObject = function(
/**
* @inheritDoc
*/
ol.format.EsriJSON.prototype.readFeaturesFromObject = function(
_ol_format_EsriJSON_.prototype.readFeaturesFromObject = function(
object, opt_options) {
var esriJSONObject = /** @type {EsriJSONObject} */ (object);
var options = opt_options ? opt_options : {};
@@ -514,15 +516,15 @@ ol.format.EsriJSON.prototype.readFeaturesFromObject = function(
* @return {ol.geom.Geometry} Geometry.
* @api
*/
ol.format.EsriJSON.prototype.readGeometry;
_ol_format_EsriJSON_.prototype.readGeometry;
/**
* @inheritDoc
*/
ol.format.EsriJSON.prototype.readGeometryFromObject = function(
_ol_format_EsriJSON_.prototype.readGeometryFromObject = function(
object, opt_options) {
return ol.format.EsriJSON.readGeometry_(
return _ol_format_EsriJSON_.readGeometry_(
/** @type {EsriJSONGeometry} */(object), opt_options);
};
@@ -535,17 +537,17 @@ ol.format.EsriJSON.prototype.readGeometryFromObject = function(
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.EsriJSON.prototype.readProjection;
_ol_format_EsriJSON_.prototype.readProjection;
/**
* @inheritDoc
*/
ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) {
_ol_format_EsriJSON_.prototype.readProjectionFromObject = function(object) {
var esriJSONObject = /** @type {EsriJSONObject} */ (object);
if (esriJSONObject.spatialReference && esriJSONObject.spatialReference.wkid) {
var crs = esriJSONObject.spatialReference.wkid;
return ol.proj.get('EPSG:' + crs);
return _ol_proj_.get('EPSG:' + crs);
} else {
return null;
}
@@ -558,10 +560,10 @@ ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) {
* @private
* @return {EsriJSONGeometry} EsriJSON geometry.
*/
ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()];
_ol_format_EsriJSON_.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = _ol_format_EsriJSON_.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */(
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options)),
opt_options);
};
@@ -575,7 +577,7 @@ ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) {
* @return {string} EsriJSON.
* @api
*/
ol.format.EsriJSON.prototype.writeGeometry;
_ol_format_EsriJSON_.prototype.writeGeometry;
/**
@@ -587,9 +589,9 @@ ol.format.EsriJSON.prototype.writeGeometry;
* @override
* @api
*/
ol.format.EsriJSON.prototype.writeGeometryObject = function(geometry,
_ol_format_EsriJSON_.prototype.writeGeometryObject = function(geometry,
opt_options) {
return ol.format.EsriJSON.writeGeometry_(geometry,
return _ol_format_EsriJSON_.writeGeometry_(geometry,
this.adaptOptions(opt_options));
};
@@ -603,7 +605,7 @@ ol.format.EsriJSON.prototype.writeGeometryObject = function(geometry,
* @return {string} EsriJSON.
* @api
*/
ol.format.EsriJSON.prototype.writeFeature;
_ol_format_EsriJSON_.prototype.writeFeature;
/**
@@ -615,24 +617,24 @@ ol.format.EsriJSON.prototype.writeFeature;
* @override
* @api
*/
ol.format.EsriJSON.prototype.writeFeatureObject = function(
_ol_format_EsriJSON_.prototype.writeFeatureObject = function(
feature, opt_options) {
opt_options = this.adaptOptions(opt_options);
var object = {};
var geometry = feature.getGeometry();
if (geometry) {
object['geometry'] =
ol.format.EsriJSON.writeGeometry_(geometry, opt_options);
_ol_format_EsriJSON_.writeGeometry_(geometry, opt_options);
if (opt_options && opt_options.featureProjection) {
object['geometry']['spatialReference'] = /** @type {EsriJSONCRS} */({
wkid: ol.proj.get(
wkid: _ol_proj_.get(
opt_options.featureProjection).getCode().split(':').pop()
});
}
}
var properties = feature.getProperties();
delete properties[feature.getGeometryName()];
if (!ol.obj.isEmpty(properties)) {
if (!_ol_obj_.isEmpty(properties)) {
object['attributes'] = properties;
} else {
object['attributes'] = {};
@@ -650,7 +652,7 @@ ol.format.EsriJSON.prototype.writeFeatureObject = function(
* @return {string} EsriJSON.
* @api
*/
ol.format.EsriJSON.prototype.writeFeatures;
_ol_format_EsriJSON_.prototype.writeFeatures;
/**
@@ -662,7 +664,7 @@ ol.format.EsriJSON.prototype.writeFeatures;
* @override
* @api
*/
ol.format.EsriJSON.prototype.writeFeaturesObject = function(features, opt_options) {
_ol_format_EsriJSON_.prototype.writeFeaturesObject = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
var objects = [];
var i, ii;
@@ -673,3 +675,4 @@ ol.format.EsriJSON.prototype.writeFeaturesObject = function(features, opt_option
'features': objects
});
};
export default _ol_format_EsriJSON_;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.format.Feature');
goog.require('ol.geom.Geometry');
goog.require('ol.obj');
goog.require('ol.proj');
/**
* @module ol/format/Feature
*/
import _ol_geom_Geometry_ from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -18,7 +18,7 @@ goog.require('ol.proj');
* @abstract
* @api
*/
ol.format.Feature = function() {
var _ol_format_Feature_ = function() {
/**
* @protected
@@ -42,7 +42,7 @@ ol.format.Feature = function() {
* @return {olx.format.ReadOptions|undefined} Options.
* @protected
*/
ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
_ol_format_Feature_.prototype.getReadOptions = function(source, opt_options) {
var options;
if (opt_options) {
options = {
@@ -64,8 +64,8 @@ ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
* @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined}
* Updated options.
*/
ol.format.Feature.prototype.adaptOptions = function(options) {
return ol.obj.assign({
_ol_format_Feature_.prototype.adaptOptions = function(options) {
return _ol_obj_.assign({
dataProjection: this.defaultDataProjection,
featureProjection: this.defaultFeatureProjection
}, options);
@@ -76,7 +76,7 @@ ol.format.Feature.prototype.adaptOptions = function(options) {
* Get the extent from the source of the last {@link readFeatures} call.
* @return {ol.Extent} Tile extent.
*/
ol.format.Feature.prototype.getLastExtent = function() {
_ol_format_Feature_.prototype.getLastExtent = function() {
return null;
};
@@ -85,7 +85,7 @@ ol.format.Feature.prototype.getLastExtent = function() {
* @abstract
* @return {ol.format.FormatType} Format.
*/
ol.format.Feature.prototype.getType = function() {};
_ol_format_Feature_.prototype.getType = function() {};
/**
@@ -96,7 +96,7 @@ ol.format.Feature.prototype.getType = function() {};
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature} Feature.
*/
ol.format.Feature.prototype.readFeature = function(source, opt_options) {};
_ol_format_Feature_.prototype.readFeature = function(source, opt_options) {};
/**
@@ -107,7 +107,7 @@ ol.format.Feature.prototype.readFeature = function(source, opt_options) {};
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.Feature.prototype.readFeatures = function(source, opt_options) {};
_ol_format_Feature_.prototype.readFeatures = function(source, opt_options) {};
/**
@@ -118,7 +118,7 @@ ol.format.Feature.prototype.readFeatures = function(source, opt_options) {};
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.Feature.prototype.readGeometry = function(source, opt_options) {};
_ol_format_Feature_.prototype.readGeometry = function(source, opt_options) {};
/**
@@ -128,7 +128,7 @@ ol.format.Feature.prototype.readGeometry = function(source, opt_options) {};
* @param {Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.Feature.prototype.readProjection = function(source) {};
_ol_format_Feature_.prototype.readProjection = function(source) {};
/**
@@ -139,7 +139,7 @@ ol.format.Feature.prototype.readProjection = function(source) {};
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeFeature = function(feature, opt_options) {};
_ol_format_Feature_.prototype.writeFeature = function(feature, opt_options) {};
/**
@@ -150,7 +150,7 @@ ol.format.Feature.prototype.writeFeature = function(feature, opt_options) {};
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeFeatures = function(features, opt_options) {};
_ol_format_Feature_.prototype.writeFeatures = function(features, opt_options) {};
/**
@@ -161,7 +161,7 @@ ol.format.Feature.prototype.writeFeatures = function(features, opt_options) {};
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeGeometry = function(geometry, opt_options) {};
_ol_format_Feature_.prototype.writeGeometry = function(geometry, opt_options) {};
/**
@@ -172,26 +172,26 @@ ol.format.Feature.prototype.writeGeometry = function(geometry, opt_options) {};
* @return {ol.geom.Geometry|ol.Extent} Transformed geometry.
* @protected
*/
ol.format.Feature.transformWithOptions = function(
_ol_format_Feature_.transformWithOptions = function(
geometry, write, opt_options) {
var featureProjection = opt_options ?
ol.proj.get(opt_options.featureProjection) : null;
_ol_proj_.get(opt_options.featureProjection) : null;
var dataProjection = opt_options ?
ol.proj.get(opt_options.dataProjection) : null;
_ol_proj_.get(opt_options.dataProjection) : null;
/**
* @type {ol.geom.Geometry|ol.Extent}
*/
var transformed;
if (featureProjection && dataProjection &&
!ol.proj.equivalent(featureProjection, dataProjection)) {
if (geometry instanceof ol.geom.Geometry) {
!_ol_proj_.equivalent(featureProjection, dataProjection)) {
if (geometry instanceof _ol_geom_Geometry_) {
transformed = (write ? geometry.clone() : geometry).transform(
write ? featureProjection : dataProjection,
write ? dataProjection : featureProjection);
} else {
// FIXME this is necessary because ol.format.GML treats extents
// as geometries
transformed = ol.proj.transformExtent(
transformed = _ol_proj_.transformExtent(
geometry,
dataProjection,
featureProjection);
@@ -219,3 +219,4 @@ ol.format.Feature.transformWithOptions = function(
}
return transformed;
};
export default _ol_format_Feature_;

View File

@@ -1,12 +1,14 @@
goog.provide('ol.format.FormatType');
/**
* @module ol/format/FormatType
*/
/**
* @enum {string}
*/
ol.format.FormatType = {
var _ol_format_FormatType_ = {
ARRAY_BUFFER: 'arraybuffer',
JSON: 'json',
TEXT: 'text',
XML: 'xml'
};
export default _ol_format_FormatType_;

View File

@@ -1,7 +1,7 @@
goog.provide('ol.format.GML');
goog.require('ol.format.GML3');
/**
* @module ol/format/GML
*/
import _ol_format_GML3_ from '../format/GML3.js';
/**
* @classdesc
@@ -15,7 +15,7 @@ goog.require('ol.format.GML3');
* @extends {ol.format.GMLBase}
* @api
*/
ol.format.GML = ol.format.GML3;
var _ol_format_GML_ = _ol_format_GML3_;
/**
@@ -27,7 +27,7 @@ ol.format.GML = ol.format.GML3;
* @return {string} Result.
* @api
*/
ol.format.GML.prototype.writeFeatures;
_ol_format_GML_.prototype.writeFeatures;
/**
@@ -39,4 +39,5 @@ ol.format.GML.prototype.writeFeatures;
* @return {Node} Node.
* @api
*/
ol.format.GML.prototype.writeFeaturesNode;
_ol_format_GML_.prototype.writeFeaturesNode;
export default _ol_format_GML_;

View File

@@ -1,15 +1,15 @@
goog.provide('ol.format.GML2');
goog.require('ol');
goog.require('ol.extent');
goog.require('ol.format.Feature');
goog.require('ol.format.GMLBase');
goog.require('ol.format.XSD');
goog.require('ol.geom.Geometry');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.xml');
/**
* @module ol/format/GML2
*/
import _ol_ from '../index.js';
import _ol_extent_ from '../extent.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_GMLBase_ from '../format/GMLBase.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_geom_Geometry_ from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -21,24 +21,25 @@ goog.require('ol.xml');
* @extends {ol.format.GMLBase}
* @api
*/
ol.format.GML2 = function(opt_options) {
var _ol_format_GML2_ = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {});
ol.format.GMLBase.call(this, options);
_ol_format_GMLBase_.call(this, options);
this.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS][
this.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS][
'featureMember'] =
ol.xml.makeArrayPusher(ol.format.GMLBase.prototype.readFeaturesInternal);
_ol_xml_.makeArrayPusher(_ol_format_GMLBase_.prototype.readFeaturesInternal);
/**
* @inheritDoc
*/
this.schemaLocation = options.schemaLocation ?
options.schemaLocation : ol.format.GML2.schemaLocation_;
options.schemaLocation : _ol_format_GML2_.schemaLocation_;
};
ol.inherits(ol.format.GML2, ol.format.GMLBase);
_ol_.inherits(_ol_format_GML2_, _ol_format_GMLBase_);
/**
@@ -46,7 +47,7 @@ ol.inherits(ol.format.GML2, ol.format.GMLBase);
* @type {string}
* @private
*/
ol.format.GML2.schemaLocation_ = ol.format.GMLBase.GMLNS +
_ol_format_GML2_.schemaLocation_ = _ol_format_GMLBase_.GMLNS +
' http://schemas.opengis.net/gml/2.1.2/feature.xsd';
@@ -56,13 +57,13 @@ ol.format.GML2.schemaLocation_ = ol.format.GMLBase.GMLNS +
* @private
* @return {Array.<number>|undefined} Flat coordinates.
*/
ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
_ol_format_GML2_.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]);
var containerSrs = context['srsName'];
var axisOrientation = 'enu';
if (containerSrs) {
var proj = ol.proj.get(containerSrs);
var proj = _ol_proj_.get(containerSrs);
if (proj) {
axisOrientation = proj.getAxisOrientation();
}
@@ -91,11 +92,11 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
* @private
* @return {ol.Extent|undefined} Envelope.
*/
ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
_ol_format_GML2_.prototype.readBox_ = function(node, objectStack) {
/** @type {Array.<number>} */
var flatCoordinates = ol.xml.pushParseAndPop([null],
var flatCoordinates = _ol_xml_.pushParseAndPop([null],
this.BOX_PARSERS_, node, objectStack, this);
return ol.extent.createOrUpdate(flatCoordinates[1][0],
return _ol_extent_.createOrUpdate(flatCoordinates[1][0],
flatCoordinates[1][1], flatCoordinates[1][3],
flatCoordinates[1][4]);
};
@@ -106,9 +107,9 @@ ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
_ol_format_GML2_.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
@@ -123,9 +124,9 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
_ol_format_GML2_.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
@@ -140,10 +141,10 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
_ol_format_GML2_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
'http://www.opengis.net/gml': {
'coordinates': ol.xml.makeReplacer(
ol.format.GML2.prototype.readFlatCoordinates_)
'coordinates': _ol_xml_.makeReplacer(
_ol_format_GML2_.prototype.readFlatCoordinates_)
}
};
@@ -153,10 +154,10 @@ ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
_ol_format_GML2_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
'http://www.opengis.net/gml': {
'innerBoundaryIs': ol.format.GML2.prototype.innerBoundaryIsParser_,
'outerBoundaryIs': ol.format.GML2.prototype.outerBoundaryIsParser_
'innerBoundaryIs': _ol_format_GML2_.prototype.innerBoundaryIsParser_,
'outerBoundaryIs': _ol_format_GML2_.prototype.outerBoundaryIsParser_
}
};
@@ -166,10 +167,10 @@ ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GML2.prototype.BOX_PARSERS_ = {
_ol_format_GML2_.prototype.BOX_PARSERS_ = {
'http://www.opengis.net/gml': {
'coordinates': ol.xml.makeArrayPusher(
ol.format.GML2.prototype.readFlatCoordinates_)
'coordinates': _ol_xml_.makeArrayPusher(
_ol_format_GML2_.prototype.readFlatCoordinates_)
}
};
@@ -179,21 +180,21 @@ ol.format.GML2.prototype.BOX_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {
_ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = {
'http://www.opengis.net/gml': {
'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint),
'MultiPoint': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiPoint),
'LineString': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readLineString),
'MultiLineString': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiLineString),
'LinearRing': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readLinearRing),
'Polygon': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPolygon),
'MultiPolygon': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiPolygon),
'Box': ol.xml.makeReplacer(ol.format.GML2.prototype.readBox_)
'Point': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPoint),
'MultiPoint': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPoint),
'LineString': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readLineString),
'MultiLineString': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiLineString),
'LinearRing': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readLinearRing),
'Polygon': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPolygon),
'MultiPolygon': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPolygon),
'Box': _ol_xml_.makeReplacer(_ol_format_GML2_.prototype.readBox_)
}
};
@@ -206,7 +207,7 @@ ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {
* @return {Node|undefined} Node.
* @private
*/
ol.format.GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
_ol_format_GML2_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1];
var multiSurface = context['multiSurface'];
var surface = context['surface'];
@@ -224,7 +225,7 @@ ol.format.GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o
} else {
nodeName = 'Envelope';
}
return ol.xml.createElementNS('http://www.opengis.net/gml',
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
nodeName);
};
@@ -234,7 +235,7 @@ ol.format.GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o
* @param {ol.Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
*/
ol.format.GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
_ol_format_GML2_.prototype.writeFeatureElement = function(node, feature, objectStack) {
var fid = feature.getId();
if (fid) {
node.setAttribute('fid', fid);
@@ -253,24 +254,24 @@ ol.format.GML2.prototype.writeFeatureElement = function(node, feature, objectSta
if (value !== null) {
keys.push(key);
values.push(value);
if (key == geometryName || value instanceof ol.geom.Geometry) {
if (key == geometryName || value instanceof _ol_geom_Geometry_) {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = ol.xml.makeChildAppender(
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
this.writeGeometryElement, this);
}
} else {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = ol.xml.makeChildAppender(
ol.format.XSD.writeStringTextNode);
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeStringTextNode);
}
}
}
}
var item = ol.obj.assign({}, context);
var item = _ol_obj_.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), context.serializers,
ol.xml.makeSimpleNodeFactory(undefined, featureNS),
_ol_xml_.makeSimpleNodeFactory(undefined, featureNS),
values,
objectStack, keys);
};
@@ -281,24 +282,24 @@ ol.format.GML2.prototype.writeFeatureElement = function(node, feature, objectSta
* @param {ol.geom.Geometry|ol.Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack.
*/
ol.format.GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objectStack) {
var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
var item = ol.obj.assign({}, context);
var item = _ol_obj_.assign({}, context);
item.node = node;
var value;
if (Array.isArray(geometry)) {
if (context.dataProjection) {
value = ol.proj.transformExtent(
value = _ol_proj_.transformExtent(
geometry, context.featureProjection, context.dataProjection);
} else {
value = geometry;
}
} else {
value =
ol.format.Feature.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
_ol_format_Feature_.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
}
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), ol.format.GML2.GEOMETRY_SERIALIZERS_,
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), _ol_format_GML2_.GEOMETRY_SERIALIZERS_,
this.GEOMETRY_NODE_FACTORY_, [value],
objectStack, undefined, this);
};
@@ -310,7 +311,7 @@ ol.format.GML2.prototype.writeGeometryElement = function(node, geometry, objectS
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) {
@@ -322,7 +323,7 @@ ol.format.GML2.prototype.writeCurveOrLineString_ = function(node, geometry, obje
node.appendChild(coordinates);
this.writeCoordinates_(coordinates, geometry, objectStack);
} else if (node.nodeName === 'Curve') {
var segments = ol.xml.createElementNS(node.namespaceURI, 'segments');
var segments = _ol_xml_.createElementNS(node.namespaceURI, 'segments');
node.appendChild(segments);
this.writeCurveSegments_(segments,
geometry, objectStack);
@@ -335,8 +336,8 @@ ol.format.GML2.prototype.writeCurveOrLineString_ = function(node, geometry, obje
* @returns {Node} coordinates node.
* @private
*/
ol.format.GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
var coordinates = ol.xml.createElementNS(namespaceURI, 'coordinates');
_ol_format_GML2_.prototype.createCoordinatesNode_ = function(namespaceURI) {
var coordinates = _ol_xml_.createElementNS(namespaceURI, 'coordinates');
coordinates.setAttribute('decimal', '.');
coordinates.setAttribute('cs', ',');
coordinates.setAttribute('ts', ' ');
@@ -351,7 +352,7 @@ ol.format.GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
_ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -364,7 +365,7 @@ ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack)
point = points[i];
parts[i] = this.getCoords_(point, srsName, hasZ);
}
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
_ol_format_XSD_.writeStringTextNode(node, parts.join(' '));
};
@@ -374,8 +375,8 @@ ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack)
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI,
_ol_format_GML2_.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI,
'LineStringSegment');
node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack);
@@ -388,7 +389,7 @@ ol.format.GML2.prototype.writeCurveSegments_ = function(node, line, objectStack)
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -397,13 +398,13 @@ ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
}
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
var rings = geometry.getLinearRings();
ol.xml.pushSerializeAndPop(
_ol_xml_.pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML2.RING_SERIALIZERS_,
_ol_format_GML2_.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this);
} else if (node.nodeName === 'Surface') {
var patches = ol.xml.createElementNS(node.namespaceURI, 'patches');
var patches = _ol_xml_.createElementNS(node.namespaceURI, 'patches');
node.appendChild(patches);
this.writeSurfacePatches_(
patches, geometry, objectStack);
@@ -418,14 +419,14 @@ ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
* @return {Node} Node.
* @private
*/
ol.format.GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
_ol_format_GML2_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1];
var parentNode = context.node;
var exteriorWritten = context['exteriorWritten'];
if (exteriorWritten === undefined) {
context['exteriorWritten'] = true;
}
return ol.xml.createElementNS(parentNode.namespaceURI,
return _ol_xml_.createElementNS(parentNode.namespaceURI,
exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs');
};
@@ -436,8 +437,8 @@ ol.format.GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_n
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI, 'PolygonPatch');
_ol_format_GML2_.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
};
@@ -449,8 +450,8 @@ ol.format.GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectSt
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeRing_ = function(node, ring, objectStack) {
var linearRing = ol.xml.createElementNS(node.namespaceURI, 'LinearRing');
_ol_format_GML2_.prototype.writeRing_ = function(node, ring, objectStack) {
var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack);
};
@@ -463,10 +464,10 @@ ol.format.GML2.prototype.writeRing_ = function(node, ring, objectStack) {
* @return {string} The coords string.
* @private
*/
ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
_ol_format_GML2_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
axisOrientation = _ol_proj_.get(opt_srsName).getAxisOrientation();
}
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ',' + point[1] :
@@ -487,7 +488,7 @@ ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -496,8 +497,8 @@ ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry,
node.setAttribute('srsName', srsName);
}
var lines = geometry.getLineStrings();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
_ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this);
};
@@ -509,7 +510,7 @@ ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -520,7 +521,7 @@ ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
node.appendChild(coordinates);
var point = geometry.getCoordinates();
var coord = this.getCoords_(point, srsName, hasZ);
ol.format.XSD.writeStringTextNode(coordinates, coord);
_ol_format_XSD_.writeStringTextNode(coordinates, coord);
};
@@ -530,7 +531,7 @@ ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
_ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
@@ -539,9 +540,9 @@ ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
node.setAttribute('srsName', srsName);
}
var points = geometry.getPoints();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML2.POINTMEMBER_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('pointMember'), points,
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
_ol_format_GML2_.POINTMEMBER_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this);
};
@@ -552,8 +553,8 @@ ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writePointMember_ = function(node, point, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI, 'Point');
_ol_format_GML2_.prototype.writePointMember_ = function(node, point, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
node.appendChild(child);
this.writePoint_(child, point, objectStack);
};
@@ -565,7 +566,7 @@ ol.format.GML2.prototype.writePointMember_ = function(node, point, objectStack)
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) {
node.appendChild(child);
@@ -580,7 +581,7 @@ ol.format.GML2.prototype.writeLineStringOrCurveMember_ = function(node, line, ob
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
@@ -598,7 +599,7 @@ ol.format.GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
@@ -607,8 +608,8 @@ ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry,
node.setAttribute('srsName', srsName);
}
var polygons = geometry.getPolygons();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
_ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this);
};
@@ -620,7 +621,7 @@ ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(
polygon, objectStack);
if (child) {
@@ -636,7 +637,7 @@ ol.format.GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon,
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
_ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
@@ -644,9 +645,9 @@ ol.format.GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
}
var keys = ['lowerCorner', 'upperCorner'];
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), ol.format.GML2.ENVELOPE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), _ol_format_GML2_.ENVELOPE_SERIALIZERS_,
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values,
objectStack, keys, this);
};
@@ -657,31 +658,31 @@ ol.format.GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.GEOMETRY_SERIALIZERS_ = {
_ol_format_GML2_.GEOMETRY_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'Curve': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeCurveOrLineString_),
'MultiCurve': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiCurveOrLineString_),
'Point': ol.xml.makeChildAppender(ol.format.GML2.prototype.writePoint_),
'MultiPoint': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiPoint_),
'LineString': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeCurveOrLineString_),
'MultiLineString': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiCurveOrLineString_),
'LinearRing': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLinearRing_),
'Polygon': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_),
'Surface': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygon_),
'MultiSurface': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeEnvelope)
'Curve': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeCurveOrLineString_),
'MultiCurve': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_),
'Point': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writePoint_),
'MultiPoint': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiPoint_),
'LineString': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeCurveOrLineString_),
'MultiLineString': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_),
'LinearRing': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLinearRing_),
'Polygon': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_),
'Surface': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_),
'MultiSurface': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeEnvelope)
}
};
@@ -690,10 +691,10 @@ ol.format.GML2.GEOMETRY_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.RING_SERIALIZERS_ = {
_ol_format_GML2_.RING_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'outerBoundaryIs': ol.xml.makeChildAppender(ol.format.GML2.prototype.writeRing_),
'innerBoundaryIs': ol.xml.makeChildAppender(ol.format.GML2.prototype.writeRing_)
'outerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_),
'innerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_)
}
};
@@ -702,10 +703,10 @@ ol.format.GML2.RING_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.POINTMEMBER_SERIALIZERS_ = {
_ol_format_GML2_.POINTMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'pointMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writePointMember_)
'pointMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writePointMember_)
}
};
@@ -714,12 +715,12 @@ ol.format.GML2.POINTMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
_ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'lineStringMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLineStringOrCurveMember_),
'curveMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLineStringOrCurveMember_)
'lineStringMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_),
'curveMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_)
}
};
@@ -732,10 +733,10 @@ ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
* @return {Node|undefined} Node.
* @private
*/
ol.format.GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
_ol_format_GML2_.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var parentNode = objectStack[objectStack.length - 1].node;
return ol.xml.createElementNS('http://www.opengis.net/gml',
ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
_ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
};
/**
@@ -743,7 +744,7 @@ ol.format.GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, ob
* @type {Object.<string, string>}
* @private
*/
ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
_ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
'MultiLineString': 'lineStringMember',
'MultiCurve': 'curveMember',
'MultiPolygon': 'polygonMember',
@@ -756,12 +757,12 @@ ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
_ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'surfaceMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_)
'surfaceMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_)
}
};
@@ -770,9 +771,10 @@ ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.ENVELOPE_SERIALIZERS_ = {
_ol_format_GML2_.ENVELOPE_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'lowerCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'upperCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode)
'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode)
}
};
export default _ol_format_GML2_;

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,25 @@
/**
* @module ol/format/GMLBase
*/
// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part
// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect
// envelopes/extents, only geometries!
goog.provide('ol.format.GMLBase');
goog.require('ol');
goog.require('ol.array');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.XMLFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.xml');
import _ol_ from '../index.js';
import _ol_array_ from '../array.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -36,7 +36,7 @@ goog.require('ol.xml');
* Optional configuration object.
* @extends {ol.format.XMLFeature}
*/
ol.format.GMLBase = function(opt_options) {
var _ol_format_GMLBase_ = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {});
@@ -68,23 +68,24 @@ ol.format.GMLBase = function(opt_options) {
* @type {Object.<string, Object.<string, Object>>}
*/
this.FEATURE_COLLECTION_PARSERS = {};
this.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS] = {
'featureMember': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFeaturesInternal),
'featureMembers': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFeaturesInternal)
this.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS] = {
'featureMember': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readFeaturesInternal),
'featureMembers': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readFeaturesInternal)
};
ol.format.XMLFeature.call(this);
_ol_format_XMLFeature_.call(this);
};
ol.inherits(ol.format.GMLBase, ol.format.XMLFeature);
_ol_.inherits(_ol_format_GMLBase_, _ol_format_XMLFeature_);
/**
* @const
* @type {string}
*/
ol.format.GMLBase.GMLNS = 'http://www.opengis.net/gml';
_ol_format_GMLBase_.GMLNS = 'http://www.opengis.net/gml';
/**
@@ -99,7 +100,7 @@ ol.format.GMLBase.GMLNS = 'http://www.opengis.net/gml';
* @type {RegExp}
* @private
*/
ol.format.GMLBase.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/;
_ol_format_GMLBase_.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/;
/**
@@ -107,16 +108,16 @@ ol.format.GMLBase.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/;
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<ol.Feature> | undefined} Features.
*/
ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readFeaturesInternal = function(node, objectStack) {
var localName = node.localName;
var features = null;
if (localName == 'FeatureCollection') {
if (node.namespaceURI === 'http://www.opengis.net/wfs') {
features = ol.xml.pushParseAndPop([],
features = _ol_xml_.pushParseAndPop([],
this.FEATURE_COLLECTION_PARSERS, node,
objectStack, this);
} else {
features = ol.xml.pushParseAndPop(null,
features = _ol_xml_.pushParseAndPop(null,
this.FEATURE_COLLECTION_PARSERS, node,
objectStack, this);
}
@@ -171,16 +172,16 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
if (featurePrefix === p) {
parsers[featureTypes[i].split(':').pop()] =
(localName == 'featureMembers') ?
ol.xml.makeArrayPusher(this.readFeatureElement, this) :
ol.xml.makeReplacer(this.readFeatureElement, this);
_ol_xml_.makeArrayPusher(this.readFeatureElement, this) :
_ol_xml_.makeReplacer(this.readFeatureElement, this);
}
}
parsersNS[featureNS[p]] = parsers;
}
if (localName == 'featureMember') {
features = ol.xml.pushParseAndPop(undefined, parsersNS, node, objectStack);
features = _ol_xml_.pushParseAndPop(undefined, parsersNS, node, objectStack);
} else {
features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack);
features = _ol_xml_.pushParseAndPop([], parsersNS, node, objectStack);
}
}
if (features === null) {
@@ -195,16 +196,17 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Geometry|undefined} Geometry.
*/
ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readGeometryElement = function(node, objectStack) {
var context = /** @type {Object} */ (objectStack[0]);
context['srsName'] = node.firstElementChild.getAttribute('srsName');
context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension');
/** @type {ol.geom.Geometry} */
var geometry = ol.xml.pushParseAndPop(null,
var geometry = _ol_xml_.pushParseAndPop(null,
this.GEOMETRY_PARSERS_, node, objectStack, this);
if (geometry) {
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, context));
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(geometry, false, context)
);
} else {
return undefined;
}
@@ -216,10 +218,10 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.Feature} Feature.
*/
ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readFeatureElement = function(node, objectStack) {
var n;
var fid = node.getAttribute('fid') ||
ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id');
_ol_xml_.getAttributeNS(node, _ol_format_GMLBase_.GMLNS, 'id');
var values = {}, geometryName;
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
var localName = n.localName;
@@ -229,8 +231,8 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
if (n.childNodes.length === 0 ||
(n.childNodes.length === 1 &&
(n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) {
var value = ol.xml.getAllTextContent(n, false);
if (ol.format.GMLBase.ONLY_WHITESPACE_RE_.test(value)) {
var value = _ol_xml_.getAllTextContent(n, false);
if (_ol_format_GMLBase_.ONLY_WHITESPACE_RE_.test(value)) {
value = undefined;
}
values[localName] = value;
@@ -242,7 +244,7 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
values[localName] = this.readGeometryElement(n, objectStack);
}
}
var feature = new ol.Feature(values);
var feature = new _ol_Feature_(values);
if (geometryName) {
feature.setGeometryName(geometryName);
}
@@ -258,12 +260,12 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Point|undefined} Point.
*/
ol.format.GMLBase.prototype.readPoint = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readPoint = function(node, objectStack) {
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
var point = new ol.geom.Point(null);
point.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
var point = new _ol_geom_Point_(null);
point.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates);
return point;
}
};
@@ -274,12 +276,12 @@ ol.format.GMLBase.prototype.readPoint = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiPoint|undefined} MultiPoint.
*/
ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readMultiPoint = function(node, objectStack) {
/** @type {Array.<Array.<number>>} */
var coordinates = ol.xml.pushParseAndPop([],
var coordinates = _ol_xml_.pushParseAndPop([],
this.MULTIPOINT_PARSERS_, node, objectStack, this);
if (coordinates) {
return new ol.geom.MultiPoint(coordinates);
return new _ol_geom_MultiPoint_(coordinates);
} else {
return undefined;
}
@@ -291,12 +293,12 @@ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiLineString|undefined} MultiLineString.
*/
ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readMultiLineString = function(node, objectStack) {
/** @type {Array.<ol.geom.LineString>} */
var lineStrings = ol.xml.pushParseAndPop([],
var lineStrings = _ol_xml_.pushParseAndPop([],
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
if (lineStrings) {
var multiLineString = new ol.geom.MultiLineString(null);
var multiLineString = new _ol_geom_MultiLineString_(null);
multiLineString.setLineStrings(lineStrings);
return multiLineString;
} else {
@@ -310,12 +312,12 @@ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiPolygon|undefined} MultiPolygon.
*/
ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readMultiPolygon = function(node, objectStack) {
/** @type {Array.<ol.geom.Polygon>} */
var polygons = ol.xml.pushParseAndPop([],
var polygons = _ol_xml_.pushParseAndPop([],
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
if (polygons) {
var multiPolygon = new ol.geom.MultiPolygon(null);
var multiPolygon = new _ol_geom_MultiPolygon_(null);
multiPolygon.setPolygons(polygons);
return multiPolygon;
} else {
@@ -329,8 +331,8 @@ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
ol.xml.parseNode(this.POINTMEMBER_PARSERS_,
_ol_format_GMLBase_.prototype.pointMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.POINTMEMBER_PARSERS_,
node, objectStack, this);
};
@@ -340,8 +342,8 @@ ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) {
ol.xml.parseNode(this.LINESTRINGMEMBER_PARSERS_,
_ol_format_GMLBase_.prototype.lineStringMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.LINESTRINGMEMBER_PARSERS_,
node, objectStack, this);
};
@@ -351,8 +353,8 @@ ol.format.GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
ol.xml.parseNode(this.POLYGONMEMBER_PARSERS_, node,
_ol_format_GMLBase_.prototype.polygonMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.POLYGONMEMBER_PARSERS_, node,
objectStack, this);
};
@@ -362,12 +364,12 @@ ol.format.GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.LineString|undefined} LineString.
*/
ol.format.GMLBase.prototype.readLineString = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readLineString = function(node, objectStack) {
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
var lineString = new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
var lineString = new _ol_geom_LineString_(null);
lineString.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates);
return lineString;
} else {
return undefined;
@@ -381,8 +383,8 @@ ol.format.GMLBase.prototype.readLineString = function(node, objectStack) {
* @private
* @return {Array.<number>|undefined} LinearRing flat coordinates.
*/
ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
var ring = ol.xml.pushParseAndPop(null,
_ol_format_GMLBase_.prototype.readFlatLinearRing_ = function(node, objectStack) {
var ring = _ol_xml_.pushParseAndPop(null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this);
if (ring) {
@@ -398,12 +400,12 @@ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.LinearRing|undefined} LinearRing.
*/
ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readLinearRing = function(node, objectStack) {
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
var ring = new ol.geom.LinearRing(null);
ring.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
var ring = new _ol_geom_LinearRing_(null);
ring.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates);
return ring;
} else {
return undefined;
@@ -416,21 +418,21 @@ ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Polygon|undefined} Polygon.
*/
ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
_ol_format_GMLBase_.prototype.readPolygon = function(node, objectStack) {
/** @type {Array.<Array.<number>>} */
var flatLinearRings = ol.xml.pushParseAndPop([null],
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
if (flatLinearRings && flatLinearRings[0]) {
var polygon = new ol.geom.Polygon(null);
var polygon = new _ol_geom_Polygon_(null);
var flatCoordinates = flatLinearRings[0];
var ends = [flatCoordinates.length];
var i, ii;
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
ol.array.extend(flatCoordinates, flatLinearRings[i]);
_ol_array_.extend(flatCoordinates, flatLinearRings[i]);
ends.push(flatCoordinates.length);
}
polygon.setFlatCoordinates(
ol.geom.GeometryLayout.XYZ, flatCoordinates, ends);
_ol_geom_GeometryLayout_.XYZ, flatCoordinates, ends);
return polygon;
} else {
return undefined;
@@ -444,8 +446,8 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
* @private
* @return {Array.<number>} Flat coordinates.
*/
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(null,
_ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this);
};
@@ -456,12 +458,12 @@ ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, object
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = {
_ol_format_GMLBase_.prototype.MULTIPOINT_PARSERS_ = {
'http://www.opengis.net/gml': {
'pointMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.pointMemberParser_),
'pointMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.pointMemberParser_)
'pointMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.pointMemberParser_),
'pointMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.pointMemberParser_)
}
};
@@ -471,12 +473,12 @@ ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
_ol_format_GMLBase_.prototype.MULTILINESTRING_PARSERS_ = {
'http://www.opengis.net/gml': {
'lineStringMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.lineStringMemberParser_),
'lineStringMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.lineStringMemberParser_)
'lineStringMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.lineStringMemberParser_),
'lineStringMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.lineStringMemberParser_)
}
};
@@ -486,12 +488,12 @@ ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
_ol_format_GMLBase_.prototype.MULTIPOLYGON_PARSERS_ = {
'http://www.opengis.net/gml': {
'polygonMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.polygonMemberParser_),
'polygonMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.polygonMemberParser_)
'polygonMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.polygonMemberParser_),
'polygonMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.polygonMemberParser_)
}
};
@@ -501,10 +503,10 @@ ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = {
_ol_format_GMLBase_.prototype.POINTMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'Point': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_)
'Point': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_)
}
};
@@ -514,10 +516,10 @@ ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
_ol_format_GMLBase_.prototype.LINESTRINGMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'LineString': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readLineString)
'LineString': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readLineString)
}
};
@@ -527,10 +529,10 @@ ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
_ol_format_GMLBase_.prototype.POLYGONMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'Polygon': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readPolygon)
'Polygon': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readPolygon)
}
};
@@ -540,10 +542,10 @@ ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @protected
*/
ol.format.GMLBase.prototype.RING_PARSERS = {
_ol_format_GMLBase_.prototype.RING_PARSERS = {
'http://www.opengis.net/gml': {
'LinearRing': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFlatLinearRing_)
'LinearRing': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readFlatLinearRing_)
}
};
@@ -551,7 +553,7 @@ ol.format.GMLBase.prototype.RING_PARSERS = {
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readGeometryFromNode = function(node, opt_options) {
_ol_format_GMLBase_.prototype.readGeometryFromNode = function(node, opt_options) {
var geometry = this.readGeometryElement(node,
[this.getReadOptions(node, opt_options ? opt_options : {})]);
return geometry ? geometry : null;
@@ -567,19 +569,19 @@ ol.format.GMLBase.prototype.readGeometryFromNode = function(node, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.GMLBase.prototype.readFeatures;
_ol_format_GMLBase_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
_ol_format_GMLBase_.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = {
featureType: this.featureType,
featureNS: this.featureNS
};
if (opt_options) {
ol.obj.assign(options, this.getReadOptions(node, opt_options));
_ol_obj_.assign(options, this.getReadOptions(node, opt_options));
}
var features = this.readFeaturesInternal(node, [options]);
return features || [];
@@ -589,7 +591,8 @@ ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readProjectionFromNode = function(node) {
return ol.proj.get(this.srsName ? this.srsName :
_ol_format_GMLBase_.prototype.readProjectionFromNode = function(node) {
return _ol_proj_.get(this.srsName ? this.srsName :
node.firstElementChild.getAttribute('srsName'));
};
export default _ol_format_GMLBase_;

View File

@@ -1,18 +1,18 @@
goog.provide('ol.format.GPX');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.array');
goog.require('ol.format.Feature');
goog.require('ol.format.XMLFeature');
goog.require('ol.format.XSD');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.Point');
goog.require('ol.proj');
goog.require('ol.xml');
/**
* @module ol/format/GPX
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_array_ from '../array.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_proj_ from '../proj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -23,16 +23,16 @@ goog.require('ol.xml');
* @param {olx.format.GPXOptions=} opt_options Options.
* @api
*/
ol.format.GPX = function(opt_options) {
var _ol_format_GPX_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.XMLFeature.call(this);
_ol_format_XMLFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get('EPSG:4326');
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
/**
* @type {function(ol.Feature, Node)|undefined}
@@ -40,7 +40,8 @@ ol.format.GPX = function(opt_options) {
*/
this.readExtensions_ = options.readExtensions;
};
ol.inherits(ol.format.GPX, ol.format.XMLFeature);
_ol_.inherits(_ol_format_GPX_, _ol_format_XMLFeature_);
/**
@@ -48,7 +49,7 @@ ol.inherits(ol.format.GPX, ol.format.XMLFeature);
* @private
* @type {Array.<string>}
*/
ol.format.GPX.NAMESPACE_URIS_ = [
_ol_format_GPX_.NAMESPACE_URIS_ = [
null,
'http://www.topografix.com/GPX/1/0',
'http://www.topografix.com/GPX/1/1'
@@ -60,7 +61,7 @@ ol.format.GPX.NAMESPACE_URIS_ = [
* @type {string}
* @private
*/
ol.format.GPX.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' +
_ol_format_GPX_.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' +
'http://www.topografix.com/GPX/1/1/gpx.xsd';
@@ -72,7 +73,7 @@ ol.format.GPX.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' +
* @private
* @return {Array.<number>} Flat coordinates.
*/
ol.format.GPX.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) {
_ol_format_GPX_.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) {
flatCoordinates.push(
parseFloat(node.getAttribute('lon')),
parseFloat(node.getAttribute('lat')));
@@ -103,17 +104,17 @@ ol.format.GPX.appendCoordinate_ = function(flatCoordinates, layoutOptions, node,
* @param {Array.<number>=} ends Ends.
* @return {ol.geom.GeometryLayout} Layout.
*/
ol.format.GPX.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) {
var layout = ol.geom.GeometryLayout.XY;
_ol_format_GPX_.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) {
var layout = _ol_geom_GeometryLayout_.XY;
var stride = 2;
if (layoutOptions.hasZ && layoutOptions.hasM) {
layout = ol.geom.GeometryLayout.XYZM;
layout = _ol_geom_GeometryLayout_.XYZM;
stride = 4;
} else if (layoutOptions.hasZ) {
layout = ol.geom.GeometryLayout.XYZ;
layout = _ol_geom_GeometryLayout_.XYZ;
stride = 3;
} else if (layoutOptions.hasM) {
layout = ol.geom.GeometryLayout.XYM;
layout = _ol_geom_GeometryLayout_.XYM;
stride = 3;
}
if (stride !== 4) {
@@ -144,13 +145,13 @@ ol.format.GPX.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, end
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseLink_ = function(node, objectStack) {
_ol_format_GPX_.parseLink_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var href = node.getAttribute('href');
if (href !== null) {
values['link'] = href;
}
ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack);
_ol_xml_.parseNode(_ol_format_GPX_.LINK_PARSERS_, node, objectStack);
};
@@ -159,7 +160,7 @@ ol.format.GPX.parseLink_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseExtensions_ = function(node, objectStack) {
_ol_format_GPX_.parseExtensions_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values['extensionsNode_'] = node;
};
@@ -170,16 +171,16 @@ ol.format.GPX.parseExtensions_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseRtePt_ = function(node, objectStack) {
var values = ol.xml.pushParseAndPop(
{}, ol.format.GPX.RTEPT_PARSERS_, node, objectStack);
_ol_format_GPX_.parseRtePt_ = function(node, objectStack) {
var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.RTEPT_PARSERS_, node, objectStack);
if (values) {
var rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var flatCoordinates = /** @type {Array.<number>} */
(rteValues['flatCoordinates']);
var layoutOptions = /** @type {ol.LayoutOptions} */
(rteValues['layoutOptions']);
ol.format.GPX.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
_ol_format_GPX_.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
}
};
@@ -189,16 +190,16 @@ ol.format.GPX.parseRtePt_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseTrkPt_ = function(node, objectStack) {
var values = ol.xml.pushParseAndPop(
{}, ol.format.GPX.TRKPT_PARSERS_, node, objectStack);
_ol_format_GPX_.parseTrkPt_ = function(node, objectStack) {
var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.TRKPT_PARSERS_, node, objectStack);
if (values) {
var trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var flatCoordinates = /** @type {Array.<number>} */
(trkValues['flatCoordinates']);
var layoutOptions = /** @type {ol.LayoutOptions} */
(trkValues['layoutOptions']);
ol.format.GPX.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
_ol_format_GPX_.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
}
};
@@ -208,9 +209,9 @@ ol.format.GPX.parseTrkPt_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.parseTrkSeg_ = function(node, objectStack) {
_ol_format_GPX_.parseTrkSeg_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
ol.xml.parseNode(ol.format.GPX.TRKSEG_PARSERS_, node, objectStack);
_ol_xml_.parseNode(_ol_format_GPX_.TRKSEG_PARSERS_, node, objectStack);
var flatCoordinates = /** @type {Array.<number>} */
(values['flatCoordinates']);
var ends = /** @type {Array.<number>} */ (values['ends']);
@@ -224,12 +225,12 @@ ol.format.GPX.parseTrkSeg_ = function(node, objectStack) {
* @private
* @return {ol.Feature|undefined} Track.
*/
ol.format.GPX.readRte_ = function(node, objectStack) {
_ol_format_GPX_.readRte_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = ol.xml.pushParseAndPop({
var values = _ol_xml_.pushParseAndPop({
'flatCoordinates': [],
'layoutOptions': {}
}, ol.format.GPX.RTE_PARSERS_, node, objectStack);
}, _ol_format_GPX_.RTE_PARSERS_, node, objectStack);
if (!values) {
return undefined;
}
@@ -238,11 +239,11 @@ ol.format.GPX.readRte_ = function(node, objectStack) {
delete values['flatCoordinates'];
var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']);
delete values['layoutOptions'];
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, flatCoordinates);
var geometry = new ol.geom.LineString(null);
var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, flatCoordinates);
var geometry = new _ol_geom_LineString_(null);
geometry.setFlatCoordinates(layout, flatCoordinates);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setProperties(values);
return feature;
};
@@ -254,13 +255,13 @@ ol.format.GPX.readRte_ = function(node, objectStack) {
* @private
* @return {ol.Feature|undefined} Track.
*/
ol.format.GPX.readTrk_ = function(node, objectStack) {
_ol_format_GPX_.readTrk_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = ol.xml.pushParseAndPop({
var values = _ol_xml_.pushParseAndPop({
'flatCoordinates': [],
'ends': [],
'layoutOptions': {}
}, ol.format.GPX.TRK_PARSERS_, node, objectStack);
}, _ol_format_GPX_.TRK_PARSERS_, node, objectStack);
if (!values) {
return undefined;
}
@@ -271,11 +272,11 @@ ol.format.GPX.readTrk_ = function(node, objectStack) {
delete values['ends'];
var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']);
delete values['layoutOptions'];
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, flatCoordinates, ends);
var geometry = new ol.geom.MultiLineString(null);
var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, flatCoordinates, ends);
var geometry = new _ol_geom_MultiLineString_(null);
geometry.setFlatCoordinates(layout, flatCoordinates, ends);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setProperties(values);
return feature;
};
@@ -287,19 +288,19 @@ ol.format.GPX.readTrk_ = function(node, objectStack) {
* @private
* @return {ol.Feature|undefined} Waypoint.
*/
ol.format.GPX.readWpt_ = function(node, objectStack) {
_ol_format_GPX_.readWpt_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = ol.xml.pushParseAndPop(
{}, ol.format.GPX.WPT_PARSERS_, node, objectStack);
var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.WPT_PARSERS_, node, objectStack);
if (!values) {
return undefined;
}
var layoutOptions = /** @type {ol.LayoutOptions} */ ({});
var coordinates = ol.format.GPX.appendCoordinate_([], layoutOptions, node, values);
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, coordinates);
var geometry = new ol.geom.Point(coordinates, layout);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
var coordinates = _ol_format_GPX_.appendCoordinate_([], layoutOptions, node, values);
var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, coordinates);
var geometry = new _ol_geom_Point_(coordinates, layout);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setProperties(values);
return feature;
};
@@ -310,10 +311,10 @@ ol.format.GPX.readWpt_ = function(node, objectStack) {
* @type {Object.<string, function(Node, Array.<*>): (ol.Feature|undefined)>}
* @private
*/
ol.format.GPX.FEATURE_READER_ = {
'rte': ol.format.GPX.readRte_,
'trk': ol.format.GPX.readTrk_,
'wpt': ol.format.GPX.readWpt_
_ol_format_GPX_.FEATURE_READER_ = {
'rte': _ol_format_GPX_.readRte_,
'trk': _ol_format_GPX_.readTrk_,
'wpt': _ol_format_GPX_.readWpt_
};
@@ -322,11 +323,11 @@ ol.format.GPX.FEATURE_READER_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.GPX_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'rte': ol.xml.makeArrayPusher(ol.format.GPX.readRte_),
'trk': ol.xml.makeArrayPusher(ol.format.GPX.readTrk_),
'wpt': ol.xml.makeArrayPusher(ol.format.GPX.readWpt_)
_ol_format_GPX_.GPX_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'rte': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readRte_),
'trk': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readTrk_),
'wpt': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readWpt_)
});
@@ -335,12 +336,12 @@ ol.format.GPX.GPX_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.LINK_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
_ol_format_GPX_.LINK_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'text':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readString, 'linkText'),
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkText'),
'type':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readString, 'linkType')
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkType')
});
@@ -349,18 +350,18 @@ ol.format.GPX.LINK_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.RTE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'link': ol.format.GPX.parseLink_,
_ol_format_GPX_.RTE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'link': _ol_format_GPX_.parseLink_,
'number':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger),
'extensions': ol.format.GPX.parseExtensions_,
'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'rtept': ol.format.GPX.parseRtePt_
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger),
'extensions': _ol_format_GPX_.parseExtensions_,
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'rtept': _ol_format_GPX_.parseRtePt_
});
@@ -369,10 +370,10 @@ ol.format.GPX.RTE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.RTEPT_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime)
_ol_format_GPX_.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime)
});
@@ -381,18 +382,18 @@ ol.format.GPX.RTEPT_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.TRK_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'link': ol.format.GPX.parseLink_,
_ol_format_GPX_.TRK_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'link': _ol_format_GPX_.parseLink_,
'number':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger),
'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'extensions': ol.format.GPX.parseExtensions_,
'trkseg': ol.format.GPX.parseTrkSeg_
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger),
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'extensions': _ol_format_GPX_.parseExtensions_,
'trkseg': _ol_format_GPX_.parseTrkSeg_
});
@@ -401,9 +402,9 @@ ol.format.GPX.TRK_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.TRKSEG_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'trkpt': ol.format.GPX.parseTrkPt_
_ol_format_GPX_.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'trkpt': _ol_format_GPX_.parseTrkPt_
});
@@ -412,10 +413,10 @@ ol.format.GPX.TRKSEG_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.TRKPT_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime)
_ol_format_GPX_.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime)
});
@@ -424,30 +425,30 @@ ol.format.GPX.TRKPT_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'ele': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'time': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDateTime),
'magvar': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'geoidheight': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'cmt': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'desc': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'src': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'link': ol.format.GPX.parseLink_,
'sym': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'type': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'fix': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'sat': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'hdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'vdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'pdop': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
_ol_format_GPX_.WPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime),
'magvar': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'geoidheight': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'link': _ol_format_GPX_.parseLink_,
'sym': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'fix': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'sat': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'hdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'vdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'pdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'ageofdgpsdata':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal),
'dgpsid':
ol.xml.makeObjectPropertySetter(ol.format.XSD.readNonNegativeInteger),
'extensions': ol.format.GPX.parseExtensions_
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger),
'extensions': _ol_format_GPX_.parseExtensions_
});
@@ -455,7 +456,7 @@ ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS(
* @param {Array.<ol.Feature>} features List of features.
* @private
*/
ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
_ol_format_GPX_.prototype.handleReadExtensions_ = function(features) {
if (!features) {
features = [];
}
@@ -481,17 +482,17 @@ ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
* @return {ol.Feature} Feature.
* @api
*/
ol.format.GPX.prototype.readFeature;
_ol_format_GPX_.prototype.readFeature;
/**
* @inheritDoc
*/
ol.format.GPX.prototype.readFeatureFromNode = function(node, opt_options) {
if (!ol.array.includes(ol.format.GPX.NAMESPACE_URIS_, node.namespaceURI)) {
_ol_format_GPX_.prototype.readFeatureFromNode = function(node, opt_options) {
if (!_ol_array_.includes(_ol_format_GPX_.NAMESPACE_URIS_, node.namespaceURI)) {
return null;
}
var featureReader = ol.format.GPX.FEATURE_READER_[node.localName];
var featureReader = _ol_format_GPX_.FEATURE_READER_[node.localName];
if (!featureReader) {
return null;
}
@@ -515,19 +516,19 @@ ol.format.GPX.prototype.readFeatureFromNode = function(node, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.GPX.prototype.readFeatures;
_ol_format_GPX_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
if (!ol.array.includes(ol.format.GPX.NAMESPACE_URIS_, node.namespaceURI)) {
_ol_format_GPX_.prototype.readFeaturesFromNode = function(node, opt_options) {
if (!_ol_array_.includes(_ol_format_GPX_.NAMESPACE_URIS_, node.namespaceURI)) {
return [];
}
if (node.localName == 'gpx') {
/** @type {Array.<ol.Feature>} */
var features = ol.xml.pushParseAndPop([], ol.format.GPX.GPX_PARSERS_,
var features = _ol_xml_.pushParseAndPop([], _ol_format_GPX_.GPX_PARSERS_,
node, [this.getReadOptions(node, opt_options)]);
if (features) {
this.handleReadExtensions_(features);
@@ -548,7 +549,7 @@ ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.GPX.prototype.readProjection;
_ol_format_GPX_.prototype.readProjection;
/**
@@ -557,7 +558,7 @@ ol.format.GPX.prototype.readProjection;
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GPX.writeLink_ = function(node, value, objectStack) {
_ol_format_GPX_.writeLink_ = function(node, value, objectStack) {
node.setAttribute('href', value);
var context = objectStack[objectStack.length - 1];
var properties = context['properties'];
@@ -565,9 +566,9 @@ ol.format.GPX.writeLink_ = function(node, value, objectStack) {
properties['linkText'],
properties['linkType']
];
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}),
ol.format.GPX.LINK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
link, objectStack, ol.format.GPX.LINK_SEQUENCE_);
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}),
_ol_format_GPX_.LINK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
link, objectStack, _ol_format_GPX_.LINK_SEQUENCE_);
};
@@ -577,27 +578,27 @@ ol.format.GPX.writeLink_ = function(node, value, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
_ol_format_GPX_.writeWptType_ = function(node, coordinate, objectStack) {
var context = objectStack[objectStack.length - 1];
var parentNode = context.node;
var namespaceURI = parentNode.namespaceURI;
var properties = context['properties'];
//FIXME Projection handling
ol.xml.setAttributeNS(node, null, 'lat', coordinate[1]);
ol.xml.setAttributeNS(node, null, 'lon', coordinate[0]);
_ol_xml_.setAttributeNS(node, null, 'lat', coordinate[1]);
_ol_xml_.setAttributeNS(node, null, 'lon', coordinate[0]);
var geometryLayout = context['geometryLayout'];
switch (geometryLayout) {
case ol.geom.GeometryLayout.XYZM:
case _ol_geom_GeometryLayout_.XYZM:
if (coordinate[3] !== 0) {
properties['time'] = coordinate[3];
}
// fall through
case ol.geom.GeometryLayout.XYZ:
case _ol_geom_GeometryLayout_.XYZ:
if (coordinate[2] !== 0) {
properties['ele'] = coordinate[2];
}
break;
case ol.geom.GeometryLayout.XYM:
case _ol_geom_GeometryLayout_.XYM:
if (coordinate[2] !== 0) {
properties['time'] = coordinate[2];
}
@@ -606,12 +607,12 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
// pass
}
var orderedKeys = (node.nodeName == 'rtept') ?
ol.format.GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
_ol_format_GPX_.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
_ol_format_GPX_.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node, 'properties': properties}),
ol.format.GPX.WPT_TYPE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
_ol_format_GPX_.WPT_TYPE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, objectStack, orderedKeys);
};
@@ -622,22 +623,22 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
_ol_format_GPX_.writeRte_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var properties = feature.getProperties();
var context = {node: node, 'properties': properties};
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.LineString} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(_ol_format_Feature_.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout();
properties['rtept'] = geometry.getCoordinates();
}
var parentNode = objectStack[objectStack.length - 1].node;
var orderedKeys = ol.format.GPX.RTE_SEQUENCE_[parentNode.namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(context,
ol.format.GPX.RTE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
var orderedKeys = _ol_format_GPX_.RTE_SEQUENCE_[parentNode.namespaceURI];
var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(context,
_ol_format_GPX_.RTE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, objectStack, orderedKeys);
};
@@ -648,7 +649,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
_ol_format_GPX_.writeTrk_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var properties = feature.getProperties();
/** @type {ol.XmlNodeStackItem} */
@@ -656,14 +657,14 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.MultiLineString} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(_ol_format_Feature_.transformWithOptions(geometry, true, options));
properties['trkseg'] = geometry.getLineStrings();
}
var parentNode = objectStack[objectStack.length - 1].node;
var orderedKeys = ol.format.GPX.TRK_SEQUENCE_[parentNode.namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(context,
ol.format.GPX.TRK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
var orderedKeys = _ol_format_GPX_.TRK_SEQUENCE_[parentNode.namespaceURI];
var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(context,
_ol_format_GPX_.TRK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, objectStack, orderedKeys);
};
@@ -674,12 +675,12 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
_ol_format_GPX_.writeTrkSeg_ = function(node, lineString, objectStack) {
/** @type {ol.XmlNodeStackItem} */
var context = {node: node, 'geometryLayout': lineString.getLayout(),
'properties': {}};
ol.xml.pushSerializeAndPop(context,
ol.format.GPX.TRKSEG_SERIALIZERS_, ol.format.GPX.TRKSEG_NODE_FACTORY_,
_ol_xml_.pushSerializeAndPop(context,
_ol_format_GPX_.TRKSEG_SERIALIZERS_, _ol_format_GPX_.TRKSEG_NODE_FACTORY_,
lineString.getCoordinates(), objectStack);
};
@@ -690,16 +691,16 @@ ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GPX.writeWpt_ = function(node, feature, objectStack) {
_ol_format_GPX_.writeWpt_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var context = objectStack[objectStack.length - 1];
context['properties'] = feature.getProperties();
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.Point} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(_ol_format_Feature_.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout();
ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack);
_ol_format_GPX_.writeWptType_(node, geometry.getCoordinates(), objectStack);
}
};
@@ -709,17 +710,17 @@ ol.format.GPX.writeWpt_ = function(node, feature, objectStack) {
* @type {Array.<string>}
* @private
*/
ol.format.GPX.LINK_SEQUENCE_ = ['text', 'type'];
_ol_format_GPX_.LINK_SEQUENCE_ = ['text', 'type'];
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.LINK_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'text': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode)
_ol_format_GPX_.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'text': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode)
});
@@ -728,8 +729,8 @@ ol.format.GPX.LINK_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Array.<string>>}
* @private
*/
ol.format.GPX.RTE_SEQUENCE_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, [
_ol_format_GPX_.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [
'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'rtept'
]);
@@ -739,18 +740,18 @@ ol.format.GPX.RTE_SEQUENCE_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.RTE_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_),
'number': ol.xml.makeChildAppender(
ol.format.XSD.writeNonNegativeIntegerTextNode),
'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'rtept': ol.xml.makeArraySerializer(ol.xml.makeChildAppender(
ol.format.GPX.writeWptType_))
_ol_format_GPX_.RTE_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_),
'number': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'rtept': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender(
_ol_format_GPX_.writeWptType_))
});
@@ -759,8 +760,8 @@ ol.format.GPX.RTE_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Array.<string>>}
* @private
*/
ol.format.GPX.RTEPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, [
_ol_format_GPX_.RTEPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [
'ele', 'time'
]);
@@ -770,8 +771,8 @@ ol.format.GPX.RTEPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
* @type {Object.<string, Array.<string>>}
* @private
*/
ol.format.GPX.TRK_SEQUENCE_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, [
_ol_format_GPX_.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [
'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'trkseg'
]);
@@ -781,18 +782,18 @@ ol.format.GPX.TRK_SEQUENCE_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.TRK_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_),
'number': ol.xml.makeChildAppender(
ol.format.XSD.writeNonNegativeIntegerTextNode),
'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'trkseg': ol.xml.makeArraySerializer(ol.xml.makeChildAppender(
ol.format.GPX.writeTrkSeg_))
_ol_format_GPX_.TRK_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_),
'number': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'trkseg': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender(
_ol_format_GPX_.writeTrkSeg_))
});
@@ -801,7 +802,7 @@ ol.format.GPX.TRK_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {function(*, Array.<*>, string=): (Node|undefined)}
* @private
*/
ol.format.GPX.TRKSEG_NODE_FACTORY_ = ol.xml.makeSimpleNodeFactory('trkpt');
_ol_format_GPX_.TRKSEG_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('trkpt');
/**
@@ -809,9 +810,9 @@ ol.format.GPX.TRKSEG_NODE_FACTORY_ = ol.xml.makeSimpleNodeFactory('trkpt');
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.TRKSEG_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'trkpt': ol.xml.makeChildAppender(ol.format.GPX.writeWptType_)
_ol_format_GPX_.TRKSEG_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'trkpt': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeWptType_)
});
@@ -820,8 +821,8 @@ ol.format.GPX.TRKSEG_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Array.<string>>}
* @private
*/
ol.format.GPX.WPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, [
_ol_format_GPX_.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [
'ele', 'time', 'magvar', 'geoidheight', 'name', 'cmt', 'desc', 'src',
'link', 'sym', 'type', 'fix', 'sat', 'hdop', 'vdop', 'pdop',
'ageofdgpsdata', 'dgpsid'
@@ -832,30 +833,30 @@ ol.format.GPX.WPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.WPT_TYPE_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'ele': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'time': ol.xml.makeChildAppender(ol.format.XSD.writeDateTimeTextNode),
'magvar': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'geoidheight': ol.xml.makeChildAppender(
ol.format.XSD.writeDecimalTextNode),
'name': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'cmt': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'desc': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'src': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'link': ol.xml.makeChildAppender(ol.format.GPX.writeLink_),
'sym': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'type': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'fix': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'sat': ol.xml.makeChildAppender(
ol.format.XSD.writeNonNegativeIntegerTextNode),
'hdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'vdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'pdop': ol.xml.makeChildAppender(ol.format.XSD.writeDecimalTextNode),
'ageofdgpsdata': ol.xml.makeChildAppender(
ol.format.XSD.writeDecimalTextNode),
'dgpsid': ol.xml.makeChildAppender(
ol.format.XSD.writeNonNegativeIntegerTextNode)
_ol_format_GPX_.WPT_TYPE_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'time': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDateTimeTextNode),
'magvar': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'geoidheight': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeDecimalTextNode),
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_),
'sym': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'fix': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'sat': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode),
'hdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'vdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'pdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode),
'ageofdgpsdata': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeDecimalTextNode),
'dgpsid': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode)
});
@@ -864,7 +865,7 @@ ol.format.GPX.WPT_TYPE_SERIALIZERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, string>}
* @private
*/
ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_ = {
_ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_ = {
'Point': 'wpt',
'LineString': 'rte',
'MultiLineString': 'trk'
@@ -879,13 +880,13 @@ ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_ = {
* @return {Node|undefined} Node.
* @private
*/
ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
_ol_format_GPX_.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var geometry = /** @type {ol.Feature} */ (value).getGeometry();
if (geometry) {
var nodeName = ol.format.GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()];
var nodeName = _ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()];
if (nodeName) {
var parentNode = objectStack[objectStack.length - 1].node;
return ol.xml.createElementNS(parentNode.namespaceURI, nodeName);
return _ol_xml_.createElementNS(parentNode.namespaceURI, nodeName);
}
}
};
@@ -896,11 +897,11 @@ ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GPX.GPX_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.GPX.NAMESPACE_URIS_, {
'rte': ol.xml.makeChildAppender(ol.format.GPX.writeRte_),
'trk': ol.xml.makeChildAppender(ol.format.GPX.writeTrk_),
'wpt': ol.xml.makeChildAppender(ol.format.GPX.writeWpt_)
_ol_format_GPX_.GPX_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, {
'rte': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeRte_),
'trk': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeTrk_),
'wpt': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeWpt_)
});
@@ -915,7 +916,7 @@ ol.format.GPX.GPX_SERIALIZERS_ = ol.xml.makeStructureNS(
* @return {string} Result.
* @api
*/
ol.format.GPX.prototype.writeFeatures;
_ol_format_GPX_.prototype.writeFeatures;
/**
@@ -929,20 +930,21 @@ ol.format.GPX.prototype.writeFeatures;
* @override
* @api
*/
ol.format.GPX.prototype.writeFeaturesNode = function(features, opt_options) {
_ol_format_GPX_.prototype.writeFeaturesNode = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
//FIXME Serialize metadata
var gpx = ol.xml.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
var gpx = _ol_xml_.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
var xmlnsUri = 'http://www.w3.org/2000/xmlns/';
var xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance';
ol.xml.setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri);
ol.xml.setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation',
ol.format.GPX.SCHEMA_LOCATION_);
_ol_xml_.setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri);
_ol_xml_.setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation',
_ol_format_GPX_.SCHEMA_LOCATION_);
gpx.setAttribute('version', '1.1');
gpx.setAttribute('creator', 'OpenLayers');
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: gpx}), ol.format.GPX.GPX_SERIALIZERS_,
ol.format.GPX.GPX_NODE_FACTORY_, features, [opt_options]);
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: gpx}), _ol_format_GPX_.GPX_SERIALIZERS_,
_ol_format_GPX_.GPX_NODE_FACTORY_, features, [opt_options]);
return gpx;
};
export default _ol_format_GPX_;

View File

@@ -1,23 +1,23 @@
/**
* @module ol/format/GeoJSON
*/
// TODO: serialize dataProjection as crs member when writing
// see https://github.com/openlayers/openlayers/issues/2078
goog.provide('ol.format.GeoJSON');
goog.require('ol');
goog.require('ol.asserts');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.JSONFeature');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.obj');
goog.require('ol.proj');
import _ol_ from '../index.js';
import _ol_asserts_ from '../asserts.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
import _ol_geom_GeometryCollection_ from '../geom/GeometryCollection.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -28,22 +28,22 @@ goog.require('ol.proj');
* @param {olx.format.GeoJSONOptions=} opt_options Options.
* @api
*/
ol.format.GeoJSON = function(opt_options) {
var _ol_format_GeoJSON_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.JSONFeature.call(this);
_ol_format_JSONFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get(
this.defaultDataProjection = _ol_proj_.get(
options.defaultDataProjection ?
options.defaultDataProjection : 'EPSG:4326');
if (options.featureProjection) {
this.defaultFeatureProjection = ol.proj.get(options.featureProjection);
this.defaultFeatureProjection = _ol_proj_.get(options.featureProjection);
}
/**
@@ -61,7 +61,8 @@ ol.format.GeoJSON = function(opt_options) {
this.extractGeometryName_ = options.extractGeometryName;
};
ol.inherits(ol.format.GeoJSON, ol.format.JSONFeature);
_ol_.inherits(_ol_format_GeoJSON_, _ol_format_JSONFeature_);
/**
@@ -70,14 +71,15 @@ ol.inherits(ol.format.GeoJSON, ol.format.JSONFeature);
* @private
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
_ol_format_GeoJSON_.readGeometry_ = function(object, opt_options) {
if (!object) {
return null;
}
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options));
var geometryReader = _ol_format_GeoJSON_.GEOMETRY_READERS_[object.type];
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(
geometryReader(object), false, opt_options)
);
};
@@ -87,7 +89,7 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
* @private
* @return {ol.geom.GeometryCollection} Geometry collection.
*/
ol.format.GeoJSON.readGeometryCollectionGeometry_ = function(
_ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function(
object, opt_options) {
var geometries = object.geometries.map(
/**
@@ -95,9 +97,9 @@ ol.format.GeoJSON.readGeometryCollectionGeometry_ = function(
* @return {ol.geom.Geometry} geometry Geometry.
*/
function(geometry) {
return ol.format.GeoJSON.readGeometry_(geometry, opt_options);
return _ol_format_GeoJSON_.readGeometry_(geometry, opt_options);
});
return new ol.geom.GeometryCollection(geometries);
return new _ol_geom_GeometryCollection_(geometries);
};
@@ -106,8 +108,8 @@ ol.format.GeoJSON.readGeometryCollectionGeometry_ = function(
* @private
* @return {ol.geom.Point} Point.
*/
ol.format.GeoJSON.readPointGeometry_ = function(object) {
return new ol.geom.Point(object.coordinates);
_ol_format_GeoJSON_.readPointGeometry_ = function(object) {
return new _ol_geom_Point_(object.coordinates);
};
@@ -116,8 +118,8 @@ ol.format.GeoJSON.readPointGeometry_ = function(object) {
* @private
* @return {ol.geom.LineString} LineString.
*/
ol.format.GeoJSON.readLineStringGeometry_ = function(object) {
return new ol.geom.LineString(object.coordinates);
_ol_format_GeoJSON_.readLineStringGeometry_ = function(object) {
return new _ol_geom_LineString_(object.coordinates);
};
@@ -126,8 +128,8 @@ ol.format.GeoJSON.readLineStringGeometry_ = function(object) {
* @private
* @return {ol.geom.MultiLineString} MultiLineString.
*/
ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) {
return new ol.geom.MultiLineString(object.coordinates);
_ol_format_GeoJSON_.readMultiLineStringGeometry_ = function(object) {
return new _ol_geom_MultiLineString_(object.coordinates);
};
@@ -136,8 +138,8 @@ ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) {
* @private
* @return {ol.geom.MultiPoint} MultiPoint.
*/
ol.format.GeoJSON.readMultiPointGeometry_ = function(object) {
return new ol.geom.MultiPoint(object.coordinates);
_ol_format_GeoJSON_.readMultiPointGeometry_ = function(object) {
return new _ol_geom_MultiPoint_(object.coordinates);
};
@@ -146,8 +148,8 @@ ol.format.GeoJSON.readMultiPointGeometry_ = function(object) {
* @private
* @return {ol.geom.MultiPolygon} MultiPolygon.
*/
ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) {
return new ol.geom.MultiPolygon(object.coordinates);
_ol_format_GeoJSON_.readMultiPolygonGeometry_ = function(object) {
return new _ol_geom_MultiPolygon_(object.coordinates);
};
@@ -156,8 +158,8 @@ ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) {
* @private
* @return {ol.geom.Polygon} Polygon.
*/
ol.format.GeoJSON.readPolygonGeometry_ = function(object) {
return new ol.geom.Polygon(object.coordinates);
_ol_format_GeoJSON_.readPolygonGeometry_ = function(object) {
return new _ol_geom_Polygon_(object.coordinates);
};
@@ -167,10 +169,10 @@ ol.format.GeoJSON.readPolygonGeometry_ = function(object) {
* @private
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry.
*/
ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()];
_ol_format_GeoJSON_.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = _ol_format_GeoJSON_.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options)),
opt_options);
};
@@ -180,7 +182,7 @@ ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometryCollection} Empty GeoJSON geometry collection.
*/
ol.format.GeoJSON.writeEmptyGeometryCollectionGeometry_ = function(geometry) {
_ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_ = function(geometry) {
return /** @type {GeoJSONGeometryCollection} */ ({
type: 'GeometryCollection',
geometries: []
@@ -194,12 +196,12 @@ ol.format.GeoJSON.writeEmptyGeometryCollectionGeometry_ = function(geometry) {
* @private
* @return {GeoJSONGeometryCollection} GeoJSON geometry collection.
*/
ol.format.GeoJSON.writeGeometryCollectionGeometry_ = function(
_ol_format_GeoJSON_.writeGeometryCollectionGeometry_ = function(
geometry, opt_options) {
var geometries = geometry.getGeometriesArray().map(function(geometry) {
var options = ol.obj.assign({}, opt_options);
var options = _ol_obj_.assign({}, opt_options);
delete options.featureProjection;
return ol.format.GeoJSON.writeGeometry_(geometry, options);
return _ol_format_GeoJSON_.writeGeometry_(geometry, options);
});
return /** @type {GeoJSONGeometryCollection} */ ({
type: 'GeometryCollection',
@@ -214,7 +216,7 @@ ol.format.GeoJSON.writeGeometryCollectionGeometry_ = function(
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writeLineStringGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({
type: 'LineString',
coordinates: geometry.getCoordinates()
@@ -228,7 +230,7 @@ ol.format.GeoJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({
type: 'MultiLineString',
coordinates: geometry.getCoordinates()
@@ -242,7 +244,7 @@ ol.format.GeoJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({
type: 'MultiPoint',
coordinates: geometry.getCoordinates()
@@ -256,7 +258,7 @@ ol.format.GeoJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writeMultiPolygonGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writeMultiPolygonGeometry_ = function(geometry, opt_options) {
var right;
if (opt_options) {
right = opt_options.rightHanded;
@@ -274,7 +276,7 @@ ol.format.GeoJSON.writeMultiPolygonGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writePointGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writePointGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({
type: 'Point',
coordinates: geometry.getCoordinates()
@@ -288,7 +290,7 @@ ol.format.GeoJSON.writePointGeometry_ = function(geometry, opt_options) {
* @private
* @return {GeoJSONGeometry} GeoJSON geometry.
*/
ol.format.GeoJSON.writePolygonGeometry_ = function(geometry, opt_options) {
_ol_format_GeoJSON_.writePolygonGeometry_ = function(geometry, opt_options) {
var right;
if (opt_options) {
right = opt_options.rightHanded;
@@ -305,14 +307,14 @@ ol.format.GeoJSON.writePolygonGeometry_ = function(geometry, opt_options) {
* @private
* @type {Object.<string, function(GeoJSONObject): ol.geom.Geometry>}
*/
ol.format.GeoJSON.GEOMETRY_READERS_ = {
'Point': ol.format.GeoJSON.readPointGeometry_,
'LineString': ol.format.GeoJSON.readLineStringGeometry_,
'Polygon': ol.format.GeoJSON.readPolygonGeometry_,
'MultiPoint': ol.format.GeoJSON.readMultiPointGeometry_,
'MultiLineString': ol.format.GeoJSON.readMultiLineStringGeometry_,
'MultiPolygon': ol.format.GeoJSON.readMultiPolygonGeometry_,
'GeometryCollection': ol.format.GeoJSON.readGeometryCollectionGeometry_
_ol_format_GeoJSON_.GEOMETRY_READERS_ = {
'Point': _ol_format_GeoJSON_.readPointGeometry_,
'LineString': _ol_format_GeoJSON_.readLineStringGeometry_,
'Polygon': _ol_format_GeoJSON_.readPolygonGeometry_,
'MultiPoint': _ol_format_GeoJSON_.readMultiPointGeometry_,
'MultiLineString': _ol_format_GeoJSON_.readMultiLineStringGeometry_,
'MultiPolygon': _ol_format_GeoJSON_.readMultiPolygonGeometry_,
'GeometryCollection': _ol_format_GeoJSON_.readGeometryCollectionGeometry_
};
@@ -321,15 +323,15 @@ ol.format.GeoJSON.GEOMETRY_READERS_ = {
* @private
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>}
*/
ol.format.GeoJSON.GEOMETRY_WRITERS_ = {
'Point': ol.format.GeoJSON.writePointGeometry_,
'LineString': ol.format.GeoJSON.writeLineStringGeometry_,
'Polygon': ol.format.GeoJSON.writePolygonGeometry_,
'MultiPoint': ol.format.GeoJSON.writeMultiPointGeometry_,
'MultiLineString': ol.format.GeoJSON.writeMultiLineStringGeometry_,
'MultiPolygon': ol.format.GeoJSON.writeMultiPolygonGeometry_,
'GeometryCollection': ol.format.GeoJSON.writeGeometryCollectionGeometry_,
'Circle': ol.format.GeoJSON.writeEmptyGeometryCollectionGeometry_
_ol_format_GeoJSON_.GEOMETRY_WRITERS_ = {
'Point': _ol_format_GeoJSON_.writePointGeometry_,
'LineString': _ol_format_GeoJSON_.writeLineStringGeometry_,
'Polygon': _ol_format_GeoJSON_.writePolygonGeometry_,
'MultiPoint': _ol_format_GeoJSON_.writeMultiPointGeometry_,
'MultiLineString': _ol_format_GeoJSON_.writeMultiLineStringGeometry_,
'MultiPolygon': _ol_format_GeoJSON_.writeMultiPolygonGeometry_,
'GeometryCollection': _ol_format_GeoJSON_.writeGeometryCollectionGeometry_,
'Circle': _ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_
};
@@ -345,7 +347,7 @@ ol.format.GeoJSON.GEOMETRY_WRITERS_ = {
* @return {ol.Feature} Feature.
* @api
*/
ol.format.GeoJSON.prototype.readFeature;
_ol_format_GeoJSON_.prototype.readFeature;
/**
@@ -359,13 +361,13 @@ ol.format.GeoJSON.prototype.readFeature;
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.GeoJSON.prototype.readFeatures;
_ol_format_GeoJSON_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.GeoJSON.prototype.readFeatureFromObject = function(
_ol_format_GeoJSON_.prototype.readFeatureFromObject = function(
object, opt_options) {
/**
* @type {GeoJSONFeature}
@@ -380,8 +382,8 @@ ol.format.GeoJSON.prototype.readFeatureFromObject = function(
});
}
var geometry = ol.format.GeoJSON.readGeometry_(geoJSONFeature.geometry, opt_options);
var feature = new ol.Feature();
var geometry = _ol_format_GeoJSON_.readGeometry_(geoJSONFeature.geometry, opt_options);
var feature = new _ol_Feature_();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
} else if (this.extractGeometryName_ && geoJSONFeature.geometry_name !== undefined) {
@@ -401,7 +403,7 @@ ol.format.GeoJSON.prototype.readFeatureFromObject = function(
/**
* @inheritDoc
*/
ol.format.GeoJSON.prototype.readFeaturesFromObject = function(
_ol_format_GeoJSON_.prototype.readFeaturesFromObject = function(
object, opt_options) {
var geoJSONObject = /** @type {GeoJSONObject} */ (object);
/** @type {Array.<ol.Feature>} */
@@ -432,15 +434,15 @@ ol.format.GeoJSON.prototype.readFeaturesFromObject = function(
* @return {ol.geom.Geometry} Geometry.
* @api
*/
ol.format.GeoJSON.prototype.readGeometry;
_ol_format_GeoJSON_.prototype.readGeometry;
/**
* @inheritDoc
*/
ol.format.GeoJSON.prototype.readGeometryFromObject = function(
_ol_format_GeoJSON_.prototype.readGeometryFromObject = function(
object, opt_options) {
return ol.format.GeoJSON.readGeometry_(
return _ol_format_GeoJSON_.readGeometry_(
/** @type {GeoJSONGeometry} */ (object), opt_options);
};
@@ -453,21 +455,21 @@ ol.format.GeoJSON.prototype.readGeometryFromObject = function(
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.GeoJSON.prototype.readProjection;
_ol_format_GeoJSON_.prototype.readProjection;
/**
* @inheritDoc
*/
ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
_ol_format_GeoJSON_.prototype.readProjectionFromObject = function(object) {
var geoJSONObject = /** @type {GeoJSONObject} */ (object);
var crs = geoJSONObject.crs;
var projection;
if (crs) {
if (crs.type == 'name') {
projection = ol.proj.get(crs.properties.name);
projection = _ol_proj_.get(crs.properties.name);
} else {
ol.asserts.assert(false, 36); // Unknown SRS type
_ol_asserts_.assert(false, 36); // Unknown SRS type
}
} else {
projection = this.defaultDataProjection;
@@ -486,7 +488,7 @@ ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
* @override
* @api
*/
ol.format.GeoJSON.prototype.writeFeature;
_ol_format_GeoJSON_.prototype.writeFeature;
/**
@@ -498,7 +500,7 @@ ol.format.GeoJSON.prototype.writeFeature;
* @override
* @api
*/
ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) {
_ol_format_GeoJSON_.prototype.writeFeatureObject = function(feature, opt_options) {
opt_options = this.adaptOptions(opt_options);
var object = /** @type {GeoJSONFeature} */ ({
@@ -511,13 +513,13 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options)
var geometry = feature.getGeometry();
if (geometry) {
object.geometry =
ol.format.GeoJSON.writeGeometry_(geometry, opt_options);
_ol_format_GeoJSON_.writeGeometry_(geometry, opt_options);
} else {
object.geometry = null;
}
var properties = feature.getProperties();
delete properties[feature.getGeometryName()];
if (!ol.obj.isEmpty(properties)) {
if (!_ol_obj_.isEmpty(properties)) {
object.properties = properties;
} else {
object.properties = null;
@@ -535,7 +537,7 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options)
* @return {string} GeoJSON.
* @api
*/
ol.format.GeoJSON.prototype.writeFeatures;
_ol_format_GeoJSON_.prototype.writeFeatures;
/**
@@ -547,7 +549,7 @@ ol.format.GeoJSON.prototype.writeFeatures;
* @override
* @api
*/
ol.format.GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) {
_ol_format_GeoJSON_.prototype.writeFeaturesObject = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
var objects = [];
var i, ii;
@@ -570,7 +572,7 @@ ol.format.GeoJSON.prototype.writeFeaturesObject = function(features, opt_options
* @return {string} GeoJSON.
* @api
*/
ol.format.GeoJSON.prototype.writeGeometry;
_ol_format_GeoJSON_.prototype.writeGeometry;
/**
@@ -582,8 +584,9 @@ ol.format.GeoJSON.prototype.writeGeometry;
* @override
* @api
*/
ol.format.GeoJSON.prototype.writeGeometryObject = function(geometry,
_ol_format_GeoJSON_.prototype.writeGeometryObject = function(geometry,
opt_options) {
return ol.format.GeoJSON.writeGeometry_(geometry,
return _ol_format_GeoJSON_.writeGeometry_(geometry,
this.adaptOptions(opt_options));
};
export default _ol_format_GeoJSON_;

View File

@@ -1,14 +1,14 @@
goog.provide('ol.format.IGC');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.IGCZ');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.proj');
/**
* @module ol/format/IGC
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_IGCZ_ from '../format/IGCZ.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -19,26 +19,27 @@ goog.require('ol.proj');
* @param {olx.format.IGCOptions=} opt_options Options.
* @api
*/
ol.format.IGC = function(opt_options) {
var _ol_format_IGC_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.TextFeature.call(this);
_ol_format_TextFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get('EPSG:4326');
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
/**
* @private
* @type {ol.format.IGCZ}
*/
this.altitudeMode_ = options.altitudeMode ?
options.altitudeMode : ol.format.IGCZ.NONE;
options.altitudeMode : _ol_format_IGCZ_.NONE;
};
ol.inherits(ol.format.IGC, ol.format.TextFeature);
_ol_.inherits(_ol_format_IGC_, _ol_format_TextFeature_);
/**
@@ -46,7 +47,7 @@ ol.inherits(ol.format.IGC, ol.format.TextFeature);
* @type {RegExp}
* @private
*/
ol.format.IGC.B_RECORD_RE_ =
_ol_format_IGC_.B_RECORD_RE_ =
/^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/;
@@ -55,7 +56,7 @@ ol.format.IGC.B_RECORD_RE_ =
* @type {RegExp}
* @private
*/
ol.format.IGC.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/;
_ol_format_IGC_.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/;
/**
@@ -63,7 +64,7 @@ ol.format.IGC.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/;
* @type {RegExp}
* @private
*/
ol.format.IGC.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/;
_ol_format_IGC_.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/;
/**
@@ -73,7 +74,7 @@ ol.format.IGC.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/;
* @type {RegExp}
* @private
*/
ol.format.IGC.NEWLINE_RE_ = /\r\n|\r|\n/;
_ol_format_IGC_.NEWLINE_RE_ = /\r\n|\r|\n/;
/**
@@ -85,15 +86,15 @@ ol.format.IGC.NEWLINE_RE_ = /\r\n|\r|\n/;
* @return {ol.Feature} Feature.
* @api
*/
ol.format.IGC.prototype.readFeature;
_ol_format_IGC_.prototype.readFeature;
/**
* @inheritDoc
*/
ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
_ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) {
var altitudeMode = this.altitudeMode_;
var lines = text.split(ol.format.IGC.NEWLINE_RE_);
var lines = text.split(_ol_format_IGC_.NEWLINE_RE_);
/** @type {Object.<string, string>} */
var properties = {};
var flatCoordinates = [];
@@ -106,7 +107,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
var line = lines[i];
var m;
if (line.charAt(0) == 'B') {
m = ol.format.IGC.B_RECORD_RE_.exec(line);
m = _ol_format_IGC_.B_RECORD_RE_.exec(line);
if (m) {
var hour = parseInt(m[1], 10);
var minute = parseInt(m[2], 10);
@@ -120,11 +121,11 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
x = -x;
}
flatCoordinates.push(x, y);
if (altitudeMode != ol.format.IGCZ.NONE) {
if (altitudeMode != _ol_format_IGCZ_.NONE) {
var z;
if (altitudeMode == ol.format.IGCZ.GPS) {
if (altitudeMode == _ol_format_IGCZ_.GPS) {
z = parseInt(m[11], 10);
} else if (altitudeMode == ol.format.IGCZ.BAROMETRIC) {
} else if (altitudeMode == _ol_format_IGCZ_.BAROMETRIC) {
z = parseInt(m[12], 10);
} else {
z = 0;
@@ -140,13 +141,13 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
lastDateTime = dateTime;
}
} else if (line.charAt(0) == 'H') {
m = ol.format.IGC.HFDTE_RECORD_RE_.exec(line);
m = _ol_format_IGC_.HFDTE_RECORD_RE_.exec(line);
if (m) {
day = parseInt(m[1], 10);
month = parseInt(m[2], 10) - 1;
year = 2000 + parseInt(m[3], 10);
} else {
m = ol.format.IGC.H_RECORD_RE_.exec(line);
m = _ol_format_IGC_.H_RECORD_RE_.exec(line);
if (m) {
properties[m[1]] = m[2].trim();
}
@@ -156,11 +157,11 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
if (flatCoordinates.length === 0) {
return null;
}
var lineString = new ol.geom.LineString(null);
var layout = altitudeMode == ol.format.IGCZ.NONE ?
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
var lineString = new _ol_geom_LineString_(null);
var layout = altitudeMode == _ol_format_IGCZ_.NONE ?
_ol_geom_GeometryLayout_.XYM : _ol_geom_GeometryLayout_.XYZM;
lineString.setFlatCoordinates(layout, flatCoordinates);
var feature = new ol.Feature(ol.format.Feature.transformWithOptions(
var feature = new _ol_Feature_(_ol_format_Feature_.transformWithOptions(
lineString, false, opt_options));
feature.setProperties(properties);
return feature;
@@ -177,13 +178,13 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.IGC.prototype.readFeatures;
_ol_format_IGC_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
_ol_format_IGC_.prototype.readFeaturesFromText = function(text, opt_options) {
var feature = this.readFeatureFromText(text, opt_options);
if (feature) {
return [feature];
@@ -201,32 +202,33 @@ ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.IGC.prototype.readProjection;
_ol_format_IGC_.prototype.readProjection;
/**
* Not implemented.
* @inheritDoc
*/
ol.format.IGC.prototype.writeFeatureText = function(feature, opt_options) {};
_ol_format_IGC_.prototype.writeFeatureText = function(feature, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.IGC.prototype.writeFeaturesText = function(features, opt_options) {};
_ol_format_IGC_.prototype.writeFeaturesText = function(features, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.IGC.prototype.writeGeometryText = function(geometry, opt_options) {};
_ol_format_IGC_.prototype.writeGeometryText = function(geometry, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.IGC.prototype.readGeometryFromText = function(text, opt_options) {};
_ol_format_IGC_.prototype.readGeometryFromText = function(text, opt_options) {};
export default _ol_format_IGC_;

View File

@@ -1,11 +1,14 @@
goog.provide('ol.format.IGCZ');
/**
* @module ol/format/IGCZ
*/
/**
* IGC altitude/z. One of 'barometric', 'gps', 'none'.
* @enum {string}
*/
ol.format.IGCZ = {
var _ol_format_IGCZ_ = {
BAROMETRIC: 'barometric',
GPS: 'gps',
NONE: 'none'
};
export default _ol_format_IGCZ_;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.format.JSONFeature');
goog.require('ol');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
/**
* @module ol/format/JSONFeature
*/
import _ol_ from '../index.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_FormatType_ from '../format/FormatType.js';
/**
* @classdesc
@@ -15,10 +15,11 @@ goog.require('ol.format.FormatType');
* @abstract
* @extends {ol.format.Feature}
*/
ol.format.JSONFeature = function() {
ol.format.Feature.call(this);
var _ol_format_JSONFeature_ = function() {
_ol_format_Feature_.call(this);
};
ol.inherits(ol.format.JSONFeature, ol.format.Feature);
_ol_.inherits(_ol_format_JSONFeature_, _ol_format_Feature_);
/**
@@ -26,7 +27,7 @@ ol.inherits(ol.format.JSONFeature, ol.format.Feature);
* @private
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.getObject_ = function(source) {
_ol_format_JSONFeature_.prototype.getObject_ = function(source) {
if (typeof source === 'string') {
var object = JSON.parse(source);
return object ? /** @type {Object} */ (object) : null;
@@ -41,15 +42,15 @@ ol.format.JSONFeature.prototype.getObject_ = function(source) {
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.getType = function() {
return ol.format.FormatType.JSON;
_ol_format_JSONFeature_.prototype.getType = function() {
return _ol_format_FormatType_.JSON;
};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.readFeature = function(source, opt_options) {
_ol_format_JSONFeature_.prototype.readFeature = function(source, opt_options) {
return this.readFeatureFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options));
};
@@ -58,7 +59,7 @@ ol.format.JSONFeature.prototype.readFeature = function(source, opt_options) {
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.readFeatures = function(source, opt_options) {
_ol_format_JSONFeature_.prototype.readFeatures = function(source, opt_options) {
return this.readFeaturesFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options));
};
@@ -71,7 +72,7 @@ ol.format.JSONFeature.prototype.readFeatures = function(source, opt_options) {
* @protected
* @return {ol.Feature} Feature.
*/
ol.format.JSONFeature.prototype.readFeatureFromObject = function(object, opt_options) {};
_ol_format_JSONFeature_.prototype.readFeatureFromObject = function(object, opt_options) {};
/**
@@ -81,13 +82,13 @@ ol.format.JSONFeature.prototype.readFeatureFromObject = function(object, opt_opt
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.JSONFeature.prototype.readFeaturesFromObject = function(object, opt_options) {};
_ol_format_JSONFeature_.prototype.readFeaturesFromObject = function(object, opt_options) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.readGeometry = function(source, opt_options) {
_ol_format_JSONFeature_.prototype.readGeometry = function(source, opt_options) {
return this.readGeometryFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options));
};
@@ -100,13 +101,13 @@ ol.format.JSONFeature.prototype.readGeometry = function(source, opt_options) {
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.JSONFeature.prototype.readGeometryFromObject = function(object, opt_options) {};
_ol_format_JSONFeature_.prototype.readGeometryFromObject = function(object, opt_options) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.readProjection = function(source) {
_ol_format_JSONFeature_.prototype.readProjection = function(source) {
return this.readProjectionFromObject(this.getObject_(source));
};
@@ -117,13 +118,13 @@ ol.format.JSONFeature.prototype.readProjection = function(source) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.JSONFeature.prototype.readProjectionFromObject = function(object) {};
_ol_format_JSONFeature_.prototype.readProjectionFromObject = function(object) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.writeFeature = function(feature, opt_options) {
_ol_format_JSONFeature_.prototype.writeFeature = function(feature, opt_options) {
return JSON.stringify(this.writeFeatureObject(feature, opt_options));
};
@@ -134,13 +135,13 @@ ol.format.JSONFeature.prototype.writeFeature = function(feature, opt_options) {
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeFeatureObject = function(feature, opt_options) {};
_ol_format_JSONFeature_.prototype.writeFeatureObject = function(feature, opt_options) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.writeFeatures = function(features, opt_options) {
_ol_format_JSONFeature_.prototype.writeFeatures = function(features, opt_options) {
return JSON.stringify(this.writeFeaturesObject(features, opt_options));
};
@@ -151,13 +152,13 @@ ol.format.JSONFeature.prototype.writeFeatures = function(features, opt_options)
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeFeaturesObject = function(features, opt_options) {};
_ol_format_JSONFeature_.prototype.writeFeaturesObject = function(features, opt_options) {};
/**
* @inheritDoc
*/
ol.format.JSONFeature.prototype.writeGeometry = function(geometry, opt_options) {
_ol_format_JSONFeature_.prototype.writeGeometry = function(geometry, opt_options) {
return JSON.stringify(this.writeGeometryObject(geometry, opt_options));
};
@@ -168,4 +169,5 @@ ol.format.JSONFeature.prototype.writeGeometry = function(geometry, opt_options)
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeGeometryObject = function(geometry, opt_options) {};
_ol_format_JSONFeature_.prototype.writeGeometryObject = function(geometry, opt_options) {};
export default _ol_format_JSONFeature_;

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,25 @@
/**
* @module ol/format/MVT
*/
//FIXME Implement projection handling
goog.provide('ol.format.MVT');
goog.require('ol');
goog.require('ol.asserts');
goog.require('ol.ext.PBF');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.flat.orient');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.render.Feature');
import _ol_ from '../index.js';
import _ol_asserts_ from '../asserts.js';
import _ol_ext_PBF_ from 'pbf';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_FormatType_ from '../format/FormatType.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
import _ol_proj_Projection_ from '../proj/Projection.js';
import _ol_proj_Units_ from '../proj/Units.js';
import _ol_render_Feature_ from '../render/Feature.js';
/**
* @classdesc
@@ -30,18 +30,18 @@ goog.require('ol.render.Feature');
* @param {olx.format.MVTOptions=} opt_options Options.
* @api
*/
ol.format.MVT = function(opt_options) {
var _ol_format_MVT_ = function(opt_options) {
ol.format.Feature.call(this);
_ol_format_Feature_.call(this);
var options = opt_options ? opt_options : {};
/**
* @type {ol.proj.Projection}
*/
this.defaultDataProjection = new ol.proj.Projection({
this.defaultDataProjection = new _ol_proj_Projection_({
code: '',
units: ol.proj.Units.TILE_PIXELS
units: _ol_proj_Units_.TILE_PIXELS
});
/**
@@ -51,7 +51,7 @@ ol.format.MVT = function(opt_options) {
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
*/
this.featureClass_ = options.featureClass ?
options.featureClass : ol.render.Feature;
options.featureClass : _ol_render_Feature_;
/**
* @private
@@ -78,14 +78,15 @@ ol.format.MVT = function(opt_options) {
this.extent_ = null;
};
ol.inherits(ol.format.MVT, ol.format.Feature);
_ol_.inherits(_ol_format_MVT_, _ol_format_Feature_);
/**
* Reader callbacks for parsing the PBF.
* @type {Object.<string, function(number, Object, ol.ext.PBF)>}
*/
ol.format.MVT.pbfReaders_ = {
_ol_format_MVT_.pbfReaders_ = {
layers: function(tag, layers, pbf) {
if (tag === 3) {
var layer = {
@@ -94,7 +95,7 @@ ol.format.MVT.pbfReaders_ = {
features: []
};
var end = pbf.readVarint() + pbf.pos;
pbf.readFields(ol.format.MVT.pbfReaders_.layer, layer, end);
pbf.readFields(_ol_format_MVT_.pbfReaders_.layer, layer, end);
layer.length = layer.features.length;
if (layer.length) {
layers[layer.name] = layer;
@@ -156,7 +157,7 @@ ol.format.MVT.pbfReaders_ = {
* @param {number} i Index of the feature in the raw layer's `features` array.
* @return {Object} Raw feature.
*/
ol.format.MVT.readRawFeature_ = function(pbf, layer, i) {
_ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) {
pbf.pos = layer.features[i];
var end = pbf.readVarint() + pbf.pos;
@@ -165,7 +166,7 @@ ol.format.MVT.readRawFeature_ = function(pbf, layer, i) {
type: 0,
properties: {}
};
pbf.readFields(ol.format.MVT.pbfReaders_.feature, feature, end);
pbf.readFields(_ol_format_MVT_.pbfReaders_.feature, feature, end);
return feature;
};
@@ -180,7 +181,7 @@ ol.format.MVT.readRawFeature_ = function(pbf, layer, i) {
* @param {Array.<number>} flatCoordinates Array to store flat coordinates in.
* @param {Array.<number>} ends Array to store ends in.
*/
ol.format.MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
_ol_format_MVT_.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
pbf.pos = feature.geometry;
var end = pbf.readVarint() + pbf.pos;
@@ -224,7 +225,7 @@ ol.format.MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
}
} else {
ol.asserts.assert(false, 59); // Invalid command found in the PBF
_ol_asserts_.assert(false, 59); // Invalid command found in the PBF
}
}
@@ -244,18 +245,18 @@ ol.format.MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
* geometry.
* @return {ol.geom.GeometryType} The geometry type.
*/
ol.format.MVT.getGeometryType_ = function(type, numEnds) {
_ol_format_MVT_.getGeometryType_ = function(type, numEnds) {
/** @type {ol.geom.GeometryType} */
var geometryType;
if (type === 1) {
geometryType = numEnds === 1 ?
ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT;
_ol_geom_GeometryType_.POINT : _ol_geom_GeometryType_.MULTI_POINT;
} else if (type === 2) {
geometryType = numEnds === 1 ?
ol.geom.GeometryType.LINE_STRING :
ol.geom.GeometryType.MULTI_LINE_STRING;
_ol_geom_GeometryType_.LINE_STRING :
_ol_geom_GeometryType_.MULTI_LINE_STRING;
} else if (type === 3) {
geometryType = ol.geom.GeometryType.POLYGON;
geometryType = _ol_geom_GeometryType_.POLYGON;
// MultiPolygon not relevant for rendering - winding order determines
// outer rings of polygons.
}
@@ -269,7 +270,7 @@ ol.format.MVT.getGeometryType_ = function(type, numEnds) {
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature|ol.render.Feature} Feature.
*/
ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
_ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
var type = rawFeature.type;
if (type === 0) {
return null;
@@ -282,21 +283,21 @@ ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options)
var flatCoordinates = [];
var ends = [];
ol.format.MVT.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
_ol_format_MVT_.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
var geometryType = ol.format.MVT.getGeometryType_(type, ends.length);
var geometryType = _ol_format_MVT_.getGeometryType_(type, ends.length);
if (this.featureClass_ === ol.render.Feature) {
if (this.featureClass_ === _ol_render_Feature_) {
feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
} else {
var geom;
if (geometryType == ol.geom.GeometryType.POLYGON) {
if (geometryType == _ol_geom_GeometryType_.POLYGON) {
var endss = [];
var offset = 0;
var prevEndIndex = 0;
for (var i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
if (!ol.geom.flat.orient.linearRingIsClockwise(flatCoordinates, offset, end, 2)) {
if (!_ol_geom_flat_orient_.linearRingIsClockwise(flatCoordinates, offset, end, 2)) {
endss.push(ends.slice(prevEndIndex, i));
prevEndIndex = i;
}
@@ -304,24 +305,24 @@ ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options)
}
if (endss.length > 1) {
ends = endss;
geom = new ol.geom.MultiPolygon(null);
geom = new _ol_geom_MultiPolygon_(null);
} else {
geom = new ol.geom.Polygon(null);
geom = new _ol_geom_Polygon_(null);
}
} else {
geom = geometryType === ol.geom.GeometryType.POINT ? new ol.geom.Point(null) :
geometryType === ol.geom.GeometryType.LINE_STRING ? new ol.geom.LineString(null) :
geometryType === ol.geom.GeometryType.POLYGON ? new ol.geom.Polygon(null) :
geometryType === ol.geom.GeometryType.MULTI_POINT ? new ol.geom.MultiPoint (null) :
geometryType === ol.geom.GeometryType.MULTI_LINE_STRING ? new ol.geom.MultiLineString(null) :
geom = geometryType === _ol_geom_GeometryType_.POINT ? new _ol_geom_Point_(null) :
geometryType === _ol_geom_GeometryType_.LINE_STRING ? new _ol_geom_LineString_(null) :
geometryType === _ol_geom_GeometryType_.POLYGON ? new _ol_geom_Polygon_(null) :
geometryType === _ol_geom_GeometryType_.MULTI_POINT ? new _ol_geom_MultiPoint_ (null) :
geometryType === _ol_geom_GeometryType_.MULTI_LINE_STRING ? new _ol_geom_MultiLineString_(null) :
null;
}
geom.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates, ends);
geom.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates, ends);
feature = new this.featureClass_();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
}
var geometry = ol.format.Feature.transformWithOptions(geom, false, this.adaptOptions(opt_options));
var geometry = _ol_format_Feature_.transformWithOptions(geom, false, this.adaptOptions(opt_options));
feature.setGeometry(geometry);
feature.setId(id);
feature.setProperties(values);
@@ -335,7 +336,7 @@ ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options)
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.getLastExtent = function() {
_ol_format_MVT_.prototype.getLastExtent = function() {
return this.extent_;
};
@@ -343,8 +344,8 @@ ol.format.MVT.prototype.getLastExtent = function() {
/**
* @inheritDoc
*/
ol.format.MVT.prototype.getType = function() {
return ol.format.FormatType.ARRAY_BUFFER;
_ol_format_MVT_.prototype.getType = function() {
return _ol_format_FormatType_.ARRAY_BUFFER;
};
@@ -352,11 +353,11 @@ ol.format.MVT.prototype.getType = function() {
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
_ol_format_MVT_.prototype.readFeatures = function(source, opt_options) {
var layers = this.layers_;
var pbf = new ol.ext.PBF(/** @type {ArrayBuffer} */ (source));
var pbfLayers = pbf.readFields(ol.format.MVT.pbfReaders_.layers, {});
var pbf = new _ol_ext_PBF_(/** @type {ArrayBuffer} */ (source));
var pbfLayers = pbf.readFields(_ol_format_MVT_.pbfReaders_.layers, {});
/** @type {Array.<ol.Feature|ol.render.Feature>} */
var features = [];
var pbfLayer;
@@ -368,7 +369,7 @@ ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
var rawFeature;
for (var i = 0, ii = pbfLayer.length; i < ii; ++i) {
rawFeature = ol.format.MVT.readRawFeature_(pbf, pbfLayer, i);
rawFeature = _ol_format_MVT_.readRawFeature_(pbf, pbfLayer, i);
features.push(this.createFeature_(pbf, rawFeature));
}
this.extent_ = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null;
@@ -382,7 +383,7 @@ ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.readProjection = function(source) {
_ol_format_MVT_.prototype.readProjection = function(source) {
return this.defaultDataProjection;
};
@@ -392,7 +393,7 @@ ol.format.MVT.prototype.readProjection = function(source) {
* @param {Array.<string>} layers Layers.
* @api
*/
ol.format.MVT.prototype.setLayers = function(layers) {
_ol_format_MVT_.prototype.setLayers = function(layers) {
this.layers_ = layers;
};
@@ -401,32 +402,33 @@ ol.format.MVT.prototype.setLayers = function(layers) {
* Not implemented.
* @override
*/
ol.format.MVT.prototype.readFeature = function() {};
_ol_format_MVT_.prototype.readFeature = function() {};
/**
* Not implemented.
* @override
*/
ol.format.MVT.prototype.readGeometry = function() {};
_ol_format_MVT_.prototype.readGeometry = function() {};
/**
* Not implemented.
* @override
*/
ol.format.MVT.prototype.writeFeature = function() {};
_ol_format_MVT_.prototype.writeFeature = function() {};
/**
* Not implemented.
* @override
*/
ol.format.MVT.prototype.writeGeometry = function() {};
_ol_format_MVT_.prototype.writeGeometry = function() {};
/**
* Not implemented.
* @override
*/
ol.format.MVT.prototype.writeFeatures = function() {};
_ol_format_MVT_.prototype.writeFeatures = function() {};
export default _ol_format_MVT_;

View File

@@ -1,19 +1,19 @@
/**
* @module ol/format/OSMXML
*/
// FIXME add typedef for stack state objects
goog.provide('ol.format.OSMXML');
goog.require('ol');
goog.require('ol.array');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.XMLFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.xml');
import _ol_ from '../index.js';
import _ol_array_ from '../array.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_obj_ from '../obj.js';
import _ol_proj_ from '../proj.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -24,15 +24,16 @@ goog.require('ol.xml');
* @extends {ol.format.XMLFeature}
* @api
*/
ol.format.OSMXML = function() {
ol.format.XMLFeature.call(this);
var _ol_format_OSMXML_ = function() {
_ol_format_XMLFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get('EPSG:4326');
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
};
ol.inherits(ol.format.OSMXML, ol.format.XMLFeature);
_ol_.inherits(_ol_format_OSMXML_, _ol_format_XMLFeature_);
/**
@@ -40,7 +41,7 @@ ol.inherits(ol.format.OSMXML, ol.format.XMLFeature);
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.OSMXML.readNode_ = function(node, objectStack) {
_ol_format_OSMXML_.readNode_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var id = node.getAttribute('id');
@@ -51,13 +52,13 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) {
];
state.nodes[id] = coordinates;
var values = ol.xml.pushParseAndPop({
var values = _ol_xml_.pushParseAndPop({
tags: {}
}, ol.format.OSMXML.NODE_PARSERS_, node, objectStack);
if (!ol.obj.isEmpty(values.tags)) {
var geometry = new ol.geom.Point(coordinates);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
}, _ol_format_OSMXML_.NODE_PARSERS_, node, objectStack);
if (!_ol_obj_.isEmpty(values.tags)) {
var geometry = new _ol_geom_Point_(coordinates);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setId(id);
feature.setProperties(values.tags);
state.features.push(feature);
@@ -70,13 +71,13 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.OSMXML.readWay_ = function(node, objectStack) {
_ol_format_OSMXML_.readWay_ = function(node, objectStack) {
var id = node.getAttribute('id');
var values = ol.xml.pushParseAndPop({
var values = _ol_xml_.pushParseAndPop({
id: id,
ndrefs: [],
tags: {}
}, ol.format.OSMXML.WAY_PARSERS_, node, objectStack);
}, _ol_format_OSMXML_.WAY_PARSERS_, node, objectStack);
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
state.ways.push(values);
};
@@ -87,7 +88,7 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.OSMXML.readNd_ = function(node, objectStack) {
_ol_format_OSMXML_.readNd_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values.ndrefs.push(node.getAttribute('ref'));
};
@@ -98,7 +99,7 @@ ol.format.OSMXML.readNd_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.OSMXML.readTag_ = function(node, objectStack) {
_ol_format_OSMXML_.readTag_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values.tags[node.getAttribute('k')] = node.getAttribute('v');
};
@@ -109,7 +110,7 @@ ol.format.OSMXML.readTag_ = function(node, objectStack) {
* @private
* @type {Array.<string>}
*/
ol.format.OSMXML.NAMESPACE_URIS_ = [
_ol_format_OSMXML_.NAMESPACE_URIS_ = [
null
];
@@ -119,10 +120,10 @@ ol.format.OSMXML.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OSMXML.WAY_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OSMXML.NAMESPACE_URIS_, {
'nd': ol.format.OSMXML.readNd_,
'tag': ol.format.OSMXML.readTag_
_ol_format_OSMXML_.WAY_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, {
'nd': _ol_format_OSMXML_.readNd_,
'tag': _ol_format_OSMXML_.readTag_
});
@@ -131,10 +132,10 @@ ol.format.OSMXML.WAY_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OSMXML.PARSERS_ = ol.xml.makeStructureNS(
ol.format.OSMXML.NAMESPACE_URIS_, {
'node': ol.format.OSMXML.readNode_,
'way': ol.format.OSMXML.readWay_
_ol_format_OSMXML_.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, {
'node': _ol_format_OSMXML_.readNode_,
'way': _ol_format_OSMXML_.readWay_
});
@@ -143,9 +144,9 @@ ol.format.OSMXML.PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OSMXML.NODE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OSMXML.NAMESPACE_URIS_, {
'tag': ol.format.OSMXML.readTag_
_ol_format_OSMXML_.NODE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, {
'tag': _ol_format_OSMXML_.readTag_
});
@@ -158,20 +159,20 @@ ol.format.OSMXML.NODE_PARSERS_ = ol.xml.makeStructureNS(
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.OSMXML.prototype.readFeatures;
_ol_format_OSMXML_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
_ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = this.getReadOptions(node, opt_options);
if (node.localName == 'osm') {
var state = ol.xml.pushParseAndPop({
var state = _ol_xml_.pushParseAndPop({
nodes: {},
ways: [],
features: []
}, ol.format.OSMXML.PARSERS_, node, [options]);
}, _ol_format_OSMXML_.PARSERS_, node, [options]);
// parse nodes in ways
for (var j = 0; j < state.ways.length; j++) {
var values = /** @type {Object} */ (state.ways[j]);
@@ -179,20 +180,20 @@ ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
var flatCoordinates = [];
for (var i = 0, ii = values.ndrefs.length; i < ii; i++) {
var point = state.nodes[values.ndrefs[i]];
ol.array.extend(flatCoordinates, point);
_ol_array_.extend(flatCoordinates, point);
}
var geometry;
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {
// closed way
geometry = new ol.geom.Polygon(null);
geometry.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates,
geometry = new _ol_geom_Polygon_(null);
geometry.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates,
[flatCoordinates.length]);
} else {
geometry = new ol.geom.LineString(null);
geometry.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
geometry = new _ol_geom_LineString_(null);
geometry.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates);
}
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
_ol_format_Feature_.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
feature.setId(values.id);
feature.setProperties(values.tags);
state.features.push(feature);
@@ -213,25 +214,26 @@ ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.OSMXML.prototype.readProjection;
_ol_format_OSMXML_.prototype.readProjection;
/**
* Not implemented.
* @inheritDoc
*/
ol.format.OSMXML.prototype.writeFeatureNode = function(feature, opt_options) {};
_ol_format_OSMXML_.prototype.writeFeatureNode = function(feature, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.OSMXML.prototype.writeFeaturesNode = function(features, opt_options) {};
_ol_format_OSMXML_.prototype.writeFeaturesNode = function(features, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.OSMXML.prototype.writeGeometryNode = function(geometry, opt_options) {};
_ol_format_OSMXML_.prototype.writeGeometryNode = function(geometry, opt_options) {};
export default _ol_format_OSMXML_;

View File

@@ -1,26 +1,27 @@
goog.provide('ol.format.OWS');
goog.require('ol');
goog.require('ol.format.XLink');
goog.require('ol.format.XML');
goog.require('ol.format.XSD');
goog.require('ol.xml');
/**
* @module ol/format/OWS
*/
import _ol_ from '../index.js';
import _ol_format_XLink_ from '../format/XLink.js';
import _ol_format_XML_ from '../format/XML.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_xml_ from '../xml.js';
/**
* @constructor
* @extends {ol.format.XML}
*/
ol.format.OWS = function() {
ol.format.XML.call(this);
var _ol_format_OWS_ = function() {
_ol_format_XML_.call(this);
};
ol.inherits(ol.format.OWS, ol.format.XML);
_ol_.inherits(_ol_format_OWS_, _ol_format_XML_);
/**
* @inheritDoc
*/
ol.format.OWS.prototype.readFromDocument = function(doc) {
_ol_format_OWS_.prototype.readFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
@@ -33,9 +34,9 @@ ol.format.OWS.prototype.readFromDocument = function(doc) {
/**
* @inheritDoc
*/
ol.format.OWS.prototype.readFromNode = function(node) {
var owsObject = ol.xml.pushParseAndPop({},
ol.format.OWS.PARSERS_, node, []);
_ol_format_OWS_.prototype.readFromNode = function(node) {
var owsObject = _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.PARSERS_, node, []);
return owsObject ? owsObject : null;
};
@@ -46,9 +47,9 @@ ol.format.OWS.prototype.readFromNode = function(node) {
* @private
* @return {Object|undefined} The address.
*/
ol.format.OWS.readAddress_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.ADDRESS_PARSERS_, node, objectStack);
_ol_format_OWS_.readAddress_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.ADDRESS_PARSERS_, node, objectStack);
};
@@ -58,9 +59,9 @@ ol.format.OWS.readAddress_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The values.
*/
ol.format.OWS.readAllowedValues_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.ALLOWED_VALUES_PARSERS_, node, objectStack);
_ol_format_OWS_.readAllowedValues_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.ALLOWED_VALUES_PARSERS_, node, objectStack);
};
@@ -70,13 +71,13 @@ ol.format.OWS.readAllowedValues_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The constraint.
*/
ol.format.OWS.readConstraint_ = function(node, objectStack) {
_ol_format_OWS_.readConstraint_ = function(node, objectStack) {
var name = node.getAttribute('name');
if (!name) {
return undefined;
}
return ol.xml.pushParseAndPop({'name': name},
ol.format.OWS.CONSTRAINT_PARSERS_, node,
return _ol_xml_.pushParseAndPop({'name': name},
_ol_format_OWS_.CONSTRAINT_PARSERS_, node,
objectStack);
};
@@ -87,9 +88,9 @@ ol.format.OWS.readConstraint_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The contact info.
*/
ol.format.OWS.readContactInfo_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.CONTACT_INFO_PARSERS_, node, objectStack);
_ol_format_OWS_.readContactInfo_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.CONTACT_INFO_PARSERS_, node, objectStack);
};
@@ -99,9 +100,9 @@ ol.format.OWS.readContactInfo_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The DCP.
*/
ol.format.OWS.readDcp_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.DCP_PARSERS_, node, objectStack);
_ol_format_OWS_.readDcp_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.DCP_PARSERS_, node, objectStack);
};
@@ -111,13 +112,13 @@ ol.format.OWS.readDcp_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The GET object.
*/
ol.format.OWS.readGet_ = function(node, objectStack) {
var href = ol.format.XLink.readHref(node);
_ol_format_OWS_.readGet_ = function(node, objectStack) {
var href = _ol_format_XLink_.readHref(node);
if (!href) {
return undefined;
}
return ol.xml.pushParseAndPop({'href': href},
ol.format.OWS.REQUEST_METHOD_PARSERS_, node, objectStack);
return _ol_xml_.pushParseAndPop({'href': href},
_ol_format_OWS_.REQUEST_METHOD_PARSERS_, node, objectStack);
};
@@ -127,8 +128,8 @@ ol.format.OWS.readGet_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The HTTP object.
*/
ol.format.OWS.readHttp_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({}, ol.format.OWS.HTTP_PARSERS_,
_ol_format_OWS_.readHttp_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, _ol_format_OWS_.HTTP_PARSERS_,
node, objectStack);
};
@@ -139,10 +140,10 @@ ol.format.OWS.readHttp_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The operation.
*/
ol.format.OWS.readOperation_ = function(node, objectStack) {
_ol_format_OWS_.readOperation_ = function(node, objectStack) {
var name = node.getAttribute('name');
var value = ol.xml.pushParseAndPop({},
ol.format.OWS.OPERATION_PARSERS_, node, objectStack);
var value = _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.OPERATION_PARSERS_, node, objectStack);
if (!value) {
return undefined;
}
@@ -158,10 +159,10 @@ ol.format.OWS.readOperation_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The operations metadata.
*/
ol.format.OWS.readOperationsMetadata_ = function(node,
_ol_format_OWS_.readOperationsMetadata_ = function(node,
objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.OPERATIONS_METADATA_PARSERS_, node,
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.OPERATIONS_METADATA_PARSERS_, node,
objectStack);
};
@@ -172,9 +173,9 @@ ol.format.OWS.readOperationsMetadata_ = function(node,
* @private
* @return {Object|undefined} The phone.
*/
ol.format.OWS.readPhone_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.OWS.PHONE_PARSERS_, node, objectStack);
_ol_format_OWS_.readPhone_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.PHONE_PARSERS_, node, objectStack);
};
@@ -184,10 +185,10 @@ ol.format.OWS.readPhone_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The service identification.
*/
ol.format.OWS.readServiceIdentification_ = function(node,
_ol_format_OWS_.readServiceIdentification_ = function(node,
objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_, node,
return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_, node,
objectStack);
};
@@ -198,9 +199,9 @@ ol.format.OWS.readServiceIdentification_ = function(node,
* @private
* @return {Object|undefined} The service contact.
*/
ol.format.OWS.readServiceContact_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.OWS.SERVICE_CONTACT_PARSERS_, node,
_ol_format_OWS_.readServiceContact_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_CONTACT_PARSERS_, node,
objectStack);
};
@@ -211,9 +212,9 @@ ol.format.OWS.readServiceContact_ = function(node, objectStack) {
* @private
* @return {Object|undefined} The service provider.
*/
ol.format.OWS.readServiceProvider_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.OWS.SERVICE_PROVIDER_PARSERS_, node,
_ol_format_OWS_.readServiceProvider_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_PROVIDER_PARSERS_, node,
objectStack);
};
@@ -224,8 +225,8 @@ ol.format.OWS.readServiceProvider_ = function(node, objectStack) {
* @private
* @return {string|undefined} The value.
*/
ol.format.OWS.readValue_ = function(node, objectStack) {
return ol.format.XSD.readString(node);
_ol_format_OWS_.readValue_ = function(node, objectStack) {
return _ol_format_XSD_.readString(node);
};
@@ -234,7 +235,7 @@ ol.format.OWS.readValue_ = function(node, objectStack) {
* @type {Array.<string>}
* @private
*/
ol.format.OWS.NAMESPACE_URIS_ = [
_ol_format_OWS_.NAMESPACE_URIS_ = [
null,
'http://www.opengis.net/ows/1.1'
];
@@ -245,14 +246,14 @@ ol.format.OWS.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'ServiceIdentification': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceIdentification_),
'ServiceProvider': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceProvider_),
'OperationsMetadata': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readOperationsMetadata_)
_ol_format_OWS_.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'ServiceIdentification': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceIdentification_),
'ServiceProvider': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceProvider_),
'OperationsMetadata': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readOperationsMetadata_)
});
@@ -261,17 +262,17 @@ ol.format.OWS.PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'DeliveryPoint': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'City': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'AdministrativeArea': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'PostalCode': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Country': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ElectronicMailAddress': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_OWS_.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'DeliveryPoint': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'AdministrativeArea': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'PostalCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'ElectronicMailAddress': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
});
@@ -280,9 +281,9 @@ ol.format.OWS.ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.ALLOWED_VALUES_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Value': ol.xml.makeObjectPropertyPusher(ol.format.OWS.readValue_)
_ol_format_OWS_.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Value': _ol_xml_.makeObjectPropertyPusher(_ol_format_OWS_.readValue_)
});
@@ -291,10 +292,10 @@ ol.format.OWS.ALLOWED_VALUES_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.CONSTRAINT_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'AllowedValues': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readAllowedValues_)
_ol_format_OWS_.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'AllowedValues': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readAllowedValues_)
});
@@ -303,10 +304,10 @@ ol.format.OWS.CONSTRAINT_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.CONTACT_INFO_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Phone': ol.xml.makeObjectPropertySetter(ol.format.OWS.readPhone_),
'Address': ol.xml.makeObjectPropertySetter(ol.format.OWS.readAddress_)
_ol_format_OWS_.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Phone': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readPhone_),
'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readAddress_)
});
@@ -315,9 +316,9 @@ ol.format.OWS.CONTACT_INFO_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.DCP_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'HTTP': ol.xml.makeObjectPropertySetter(ol.format.OWS.readHttp_)
_ol_format_OWS_.DCP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'HTTP': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readHttp_)
});
@@ -326,9 +327,9 @@ ol.format.OWS.DCP_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.HTTP_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Get': ol.xml.makeObjectPropertyPusher(ol.format.OWS.readGet_),
_ol_format_OWS_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Get': _ol_xml_.makeObjectPropertyPusher(_ol_format_OWS_.readGet_),
'Post': undefined // TODO
});
@@ -338,9 +339,9 @@ ol.format.OWS.HTTP_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.OPERATION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'DCP': ol.xml.makeObjectPropertySetter(ol.format.OWS.readDcp_)
_ol_format_OWS_.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'DCP': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readDcp_)
});
@@ -349,9 +350,9 @@ ol.format.OWS.OPERATION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.OPERATIONS_METADATA_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Operation': ol.format.OWS.readOperation_
_ol_format_OWS_.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Operation': _ol_format_OWS_.readOperation_
});
@@ -360,10 +361,10 @@ ol.format.OWS.OPERATIONS_METADATA_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.PHONE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Voice': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Facsimile': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
_ol_format_OWS_.PHONE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Voice': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Facsimile': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString)
});
@@ -372,10 +373,10 @@ ol.format.OWS.PHONE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Constraint': ol.xml.makeObjectPropertyPusher(
ol.format.OWS.readConstraint_)
_ol_format_OWS_.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Constraint': _ol_xml_.makeObjectPropertyPusher(
_ol_format_OWS_.readConstraint_)
});
@@ -384,14 +385,14 @@ ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'IndividualName': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ContactInfo': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readContactInfo_)
_ol_format_OWS_.SERVICE_CONTACT_PARSERS_ =
_ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'IndividualName': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'PositionName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'ContactInfo': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readContactInfo_)
});
@@ -400,16 +401,16 @@ ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'AccessConstraints': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Fees': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ServiceTypeVersion': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
_ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_ =
_ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'AccessConstraints': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'ServiceTypeVersion': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ServiceType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString)
});
@@ -418,11 +419,12 @@ ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_PROVIDER_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref),
'ServiceContact': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceContact_)
_ol_format_OWS_.SERVICE_PROVIDER_PARSERS_ =
_ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, {
'ProviderName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'ProviderSite': _ol_xml_.makeObjectPropertySetter(_ol_format_XLink_.readHref),
'ServiceContact': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceContact_)
});
export default _ol_format_OWS_;

View File

@@ -1,17 +1,17 @@
goog.provide('ol.format.Polyline');
goog.require('ol');
goog.require('ol.asserts');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.SimpleGeometry');
goog.require('ol.geom.flat.flip');
goog.require('ol.geom.flat.inflate');
goog.require('ol.proj');
/**
* @module ol/format/Polyline
*/
import _ol_ from '../index.js';
import _ol_asserts_ from '../asserts.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
import _ol_geom_flat_flip_ from '../geom/flat/flip.js';
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -24,16 +24,16 @@ goog.require('ol.proj');
* Optional configuration object.
* @api
*/
ol.format.Polyline = function(opt_options) {
var _ol_format_Polyline_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.TextFeature.call(this);
_ol_format_TextFeature_.call(this);
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get('EPSG:4326');
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
/**
* @private
@@ -46,9 +46,10 @@ ol.format.Polyline = function(opt_options) {
* @type {ol.geom.GeometryLayout}
*/
this.geometryLayout_ = options.geometryLayout ?
options.geometryLayout : ol.geom.GeometryLayout.XY;
options.geometryLayout : _ol_geom_GeometryLayout_.XY;
};
ol.inherits(ol.format.Polyline, ol.format.TextFeature);
_ol_.inherits(_ol_format_Polyline_, _ol_format_TextFeature_);
/**
@@ -64,7 +65,7 @@ ol.inherits(ol.format.Polyline, ol.format.TextFeature);
* @return {string} The encoded string.
* @api
*/
ol.format.Polyline.encodeDeltas = function(numbers, stride, opt_factor) {
_ol_format_Polyline_.encodeDeltas = function(numbers, stride, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5;
var d;
@@ -84,7 +85,7 @@ ol.format.Polyline.encodeDeltas = function(numbers, stride, opt_factor) {
}
}
return ol.format.Polyline.encodeFloats(numbers, factor);
return _ol_format_Polyline_.encodeFloats(numbers, factor);
};
@@ -99,7 +100,7 @@ ol.format.Polyline.encodeDeltas = function(numbers, stride, opt_factor) {
* @return {Array.<number>} A list of n-dimensional points.
* @api
*/
ol.format.Polyline.decodeDeltas = function(encoded, stride, opt_factor) {
_ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5;
var d;
@@ -109,7 +110,7 @@ ol.format.Polyline.decodeDeltas = function(encoded, stride, opt_factor) {
lastNumbers[d] = 0;
}
var numbers = ol.format.Polyline.decodeFloats(encoded, factor);
var numbers = _ol_format_Polyline_.decodeFloats(encoded, factor);
var i, ii;
for (i = 0, ii = numbers.length; i < ii;) {
@@ -136,14 +137,14 @@ ol.format.Polyline.decodeDeltas = function(encoded, stride, opt_factor) {
* @return {string} The encoded string.
* @api
*/
ol.format.Polyline.encodeFloats = function(numbers, opt_factor) {
_ol_format_Polyline_.encodeFloats = function(numbers, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5;
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
numbers[i] = Math.round(numbers[i] * factor);
}
return ol.format.Polyline.encodeSignedIntegers(numbers);
return _ol_format_Polyline_.encodeSignedIntegers(numbers);
};
@@ -156,9 +157,9 @@ ol.format.Polyline.encodeFloats = function(numbers, opt_factor) {
* @return {Array.<number>} A list of floating point numbers.
* @api
*/
ol.format.Polyline.decodeFloats = function(encoded, opt_factor) {
_ol_format_Polyline_.decodeFloats = function(encoded, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5;
var numbers = ol.format.Polyline.decodeSignedIntegers(encoded);
var numbers = _ol_format_Polyline_.decodeSignedIntegers(encoded);
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
numbers[i] /= factor;
@@ -175,13 +176,13 @@ ol.format.Polyline.decodeFloats = function(encoded, opt_factor) {
* @param {Array.<number>} numbers A list of signed integers.
* @return {string} The encoded string.
*/
ol.format.Polyline.encodeSignedIntegers = function(numbers) {
_ol_format_Polyline_.encodeSignedIntegers = function(numbers) {
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
var num = numbers[i];
numbers[i] = (num < 0) ? ~(num << 1) : (num << 1);
}
return ol.format.Polyline.encodeUnsignedIntegers(numbers);
return _ol_format_Polyline_.encodeUnsignedIntegers(numbers);
};
@@ -191,8 +192,8 @@ ol.format.Polyline.encodeSignedIntegers = function(numbers) {
* @param {string} encoded An encoded string.
* @return {Array.<number>} A list of signed integers.
*/
ol.format.Polyline.decodeSignedIntegers = function(encoded) {
var numbers = ol.format.Polyline.decodeUnsignedIntegers(encoded);
_ol_format_Polyline_.decodeSignedIntegers = function(encoded) {
var numbers = _ol_format_Polyline_.decodeUnsignedIntegers(encoded);
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
var num = numbers[i];
@@ -208,11 +209,11 @@ ol.format.Polyline.decodeSignedIntegers = function(encoded) {
* @param {Array.<number>} numbers A list of unsigned integers.
* @return {string} The encoded string.
*/
ol.format.Polyline.encodeUnsignedIntegers = function(numbers) {
_ol_format_Polyline_.encodeUnsignedIntegers = function(numbers) {
var encoded = '';
var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) {
encoded += ol.format.Polyline.encodeUnsignedInteger(numbers[i]);
encoded += _ol_format_Polyline_.encodeUnsignedInteger(numbers[i]);
}
return encoded;
};
@@ -224,7 +225,7 @@ ol.format.Polyline.encodeUnsignedIntegers = function(numbers) {
* @param {string} encoded An encoded string.
* @return {Array.<number>} A list of unsigned integers.
*/
ol.format.Polyline.decodeUnsignedIntegers = function(encoded) {
_ol_format_Polyline_.decodeUnsignedIntegers = function(encoded) {
var numbers = [];
var current = 0;
var shift = 0;
@@ -250,7 +251,7 @@ ol.format.Polyline.decodeUnsignedIntegers = function(encoded) {
* @param {number} num Unsigned integer that should be encoded.
* @return {string} The encoded string.
*/
ol.format.Polyline.encodeUnsignedInteger = function(num) {
_ol_format_Polyline_.encodeUnsignedInteger = function(num) {
var value, encoded = '';
while (num >= 0x20) {
value = (0x20 | (num & 0x1f)) + 63;
@@ -273,15 +274,15 @@ ol.format.Polyline.encodeUnsignedInteger = function(num) {
* @return {ol.Feature} Feature.
* @api
*/
ol.format.Polyline.prototype.readFeature;
_ol_format_Polyline_.prototype.readFeature;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.readFeatureFromText = function(text, opt_options) {
_ol_format_Polyline_.prototype.readFeatureFromText = function(text, opt_options) {
var geometry = this.readGeometryFromText(text, opt_options);
return new ol.Feature(geometry);
return new _ol_Feature_(geometry);
};
@@ -295,13 +296,13 @@ ol.format.Polyline.prototype.readFeatureFromText = function(text, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.Polyline.prototype.readFeatures;
_ol_format_Polyline_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.readFeaturesFromText = function(text, opt_options) {
_ol_format_Polyline_.prototype.readFeaturesFromText = function(text, opt_options) {
var feature = this.readFeatureFromText(text, opt_options);
return [feature];
};
@@ -316,25 +317,26 @@ ol.format.Polyline.prototype.readFeaturesFromText = function(text, opt_options)
* @return {ol.geom.Geometry} Geometry.
* @api
*/
ol.format.Polyline.prototype.readGeometry;
_ol_format_Polyline_.prototype.readGeometry;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.readGeometryFromText = function(text, opt_options) {
var stride = ol.geom.SimpleGeometry.getStrideForLayout(this.geometryLayout_);
var flatCoordinates = ol.format.Polyline.decodeDeltas(
_ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options) {
var stride = _ol_geom_SimpleGeometry_.getStrideForLayout(this.geometryLayout_);
var flatCoordinates = _ol_format_Polyline_.decodeDeltas(
text, stride, this.factor_);
ol.geom.flat.flip.flipXY(
_ol_geom_flat_flip_.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
var coordinates = ol.geom.flat.inflate.coordinates(
var coordinates = _ol_geom_flat_inflate_.coordinates(
flatCoordinates, 0, flatCoordinates.length, stride);
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
new ol.geom.LineString(coordinates, this.geometryLayout_), false,
this.adaptOptions(opt_options)));
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(
new _ol_geom_LineString_(coordinates, this.geometryLayout_), false,
this.adaptOptions(opt_options))
);
};
@@ -346,18 +348,18 @@ ol.format.Polyline.prototype.readGeometryFromText = function(text, opt_options)
* @return {ol.proj.Projection} Projection.
* @api
*/
ol.format.Polyline.prototype.readProjection;
_ol_format_Polyline_.prototype.readProjection;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.writeFeatureText = function(feature, opt_options) {
_ol_format_Polyline_.prototype.writeFeatureText = function(feature, opt_options) {
var geometry = feature.getGeometry();
if (geometry) {
return this.writeGeometryText(geometry, opt_options);
} else {
ol.asserts.assert(false, 40); // Expected `feature` to have a geometry
_ol_asserts_.assert(false, 40); // Expected `feature` to have a geometry
return '';
}
};
@@ -366,7 +368,7 @@ ol.format.Polyline.prototype.writeFeatureText = function(feature, opt_options) {
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.writeFeaturesText = function(features, opt_options) {
_ol_format_Polyline_.prototype.writeFeaturesText = function(features, opt_options) {
return this.writeFeatureText(features[0], opt_options);
};
@@ -380,19 +382,20 @@ ol.format.Polyline.prototype.writeFeaturesText = function(features, opt_options)
* @return {string} Geometry.
* @api
*/
ol.format.Polyline.prototype.writeGeometry;
_ol_format_Polyline_.prototype.writeGeometry;
/**
* @inheritDoc
*/
ol.format.Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
_ol_format_Polyline_.prototype.writeGeometryText = function(geometry, opt_options) {
geometry = /** @type {ol.geom.LineString} */
(ol.format.Feature.transformWithOptions(
(_ol_format_Feature_.transformWithOptions(
geometry, true, this.adaptOptions(opt_options)));
var flatCoordinates = geometry.getFlatCoordinates();
var stride = geometry.getStride();
ol.geom.flat.flip.flipXY(
_ol_geom_flat_flip_.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
return ol.format.Polyline.encodeDeltas(flatCoordinates, stride, this.factor_);
return _ol_format_Polyline_.encodeDeltas(flatCoordinates, stride, this.factor_);
};
export default _ol_format_Polyline_;

View File

@@ -1,9 +1,9 @@
goog.provide('ol.format.TextFeature');
goog.require('ol');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
/**
* @module ol/format/TextFeature
*/
import _ol_ from '../index.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_FormatType_ from '../format/FormatType.js';
/**
* @classdesc
@@ -15,10 +15,11 @@ goog.require('ol.format.FormatType');
* @abstract
* @extends {ol.format.Feature}
*/
ol.format.TextFeature = function() {
ol.format.Feature.call(this);
var _ol_format_TextFeature_ = function() {
_ol_format_Feature_.call(this);
};
ol.inherits(ol.format.TextFeature, ol.format.Feature);
_ol_.inherits(_ol_format_TextFeature_, _ol_format_Feature_);
/**
@@ -26,7 +27,7 @@ ol.inherits(ol.format.TextFeature, ol.format.Feature);
* @private
* @return {string} Text.
*/
ol.format.TextFeature.prototype.getText_ = function(source) {
_ol_format_TextFeature_.prototype.getText_ = function(source) {
if (typeof source === 'string') {
return source;
} else {
@@ -38,15 +39,15 @@ ol.format.TextFeature.prototype.getText_ = function(source) {
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.getType = function() {
return ol.format.FormatType.TEXT;
_ol_format_TextFeature_.prototype.getType = function() {
return _ol_format_FormatType_.TEXT;
};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.readFeature = function(source, opt_options) {
_ol_format_TextFeature_.prototype.readFeature = function(source, opt_options) {
return this.readFeatureFromText(
this.getText_(source), this.adaptOptions(opt_options));
};
@@ -59,13 +60,13 @@ ol.format.TextFeature.prototype.readFeature = function(source, opt_options) {
* @protected
* @return {ol.Feature} Feature.
*/
ol.format.TextFeature.prototype.readFeatureFromText = function(text, opt_options) {};
_ol_format_TextFeature_.prototype.readFeatureFromText = function(text, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.readFeatures = function(source, opt_options) {
_ol_format_TextFeature_.prototype.readFeatures = function(source, opt_options) {
return this.readFeaturesFromText(
this.getText_(source), this.adaptOptions(opt_options));
};
@@ -78,13 +79,13 @@ ol.format.TextFeature.prototype.readFeatures = function(source, opt_options) {
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.TextFeature.prototype.readFeaturesFromText = function(text, opt_options) {};
_ol_format_TextFeature_.prototype.readFeaturesFromText = function(text, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.readGeometry = function(source, opt_options) {
_ol_format_TextFeature_.prototype.readGeometry = function(source, opt_options) {
return this.readGeometryFromText(
this.getText_(source), this.adaptOptions(opt_options));
};
@@ -97,13 +98,13 @@ ol.format.TextFeature.prototype.readGeometry = function(source, opt_options) {
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.TextFeature.prototype.readGeometryFromText = function(text, opt_options) {};
_ol_format_TextFeature_.prototype.readGeometryFromText = function(text, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.readProjection = function(source) {
_ol_format_TextFeature_.prototype.readProjection = function(source) {
return this.readProjectionFromText(this.getText_(source));
};
@@ -113,7 +114,7 @@ ol.format.TextFeature.prototype.readProjection = function(source) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.TextFeature.prototype.readProjectionFromText = function(text) {
_ol_format_TextFeature_.prototype.readProjectionFromText = function(text) {
return this.defaultDataProjection;
};
@@ -121,7 +122,7 @@ ol.format.TextFeature.prototype.readProjectionFromText = function(text) {
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.writeFeature = function(feature, opt_options) {
_ol_format_TextFeature_.prototype.writeFeature = function(feature, opt_options) {
return this.writeFeatureText(feature, this.adaptOptions(opt_options));
};
@@ -133,13 +134,13 @@ ol.format.TextFeature.prototype.writeFeature = function(feature, opt_options) {
* @protected
* @return {string} Text.
*/
ol.format.TextFeature.prototype.writeFeatureText = function(feature, opt_options) {};
_ol_format_TextFeature_.prototype.writeFeatureText = function(feature, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.writeFeatures = function(
_ol_format_TextFeature_.prototype.writeFeatures = function(
features, opt_options) {
return this.writeFeaturesText(features, this.adaptOptions(opt_options));
};
@@ -152,13 +153,13 @@ ol.format.TextFeature.prototype.writeFeatures = function(
* @protected
* @return {string} Text.
*/
ol.format.TextFeature.prototype.writeFeaturesText = function(features, opt_options) {};
_ol_format_TextFeature_.prototype.writeFeaturesText = function(features, opt_options) {};
/**
* @inheritDoc
*/
ol.format.TextFeature.prototype.writeGeometry = function(
_ol_format_TextFeature_.prototype.writeGeometry = function(
geometry, opt_options) {
return this.writeGeometryText(geometry, this.adaptOptions(opt_options));
};
@@ -171,4 +172,5 @@ ol.format.TextFeature.prototype.writeGeometry = function(
* @protected
* @return {string} Text.
*/
ol.format.TextFeature.prototype.writeGeometryText = function(geometry, opt_options) {};
_ol_format_TextFeature_.prototype.writeGeometryText = function(geometry, opt_options) {};
export default _ol_format_TextFeature_;

View File

@@ -1,17 +1,17 @@
goog.provide('ol.format.TopoJSON');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.JSONFeature');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.proj');
/**
* @module ol/format/TopoJSON
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -22,11 +22,11 @@ goog.require('ol.proj');
* @param {olx.format.TopoJSONOptions=} opt_options Options.
* @api
*/
ol.format.TopoJSON = function(opt_options) {
var _ol_format_TopoJSON_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.JSONFeature.call(this);
_ol_format_JSONFeature_.call(this);
/**
* @private
@@ -43,12 +43,13 @@ ol.format.TopoJSON = function(opt_options) {
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get(
this.defaultDataProjection = _ol_proj_.get(
options.defaultDataProjection ?
options.defaultDataProjection : 'EPSG:4326');
};
ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
_ol_.inherits(_ol_format_TopoJSON_, _ol_format_JSONFeature_);
/**
@@ -60,7 +61,7 @@ ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
* @return {Array.<ol.Coordinate>} Coordinates array.
* @private
*/
ol.format.TopoJSON.concatenateArcs_ = function(indices, arcs) {
_ol_format_TopoJSON_.concatenateArcs_ = function(indices, arcs) {
/** @type {Array.<ol.Coordinate>} */
var coordinates = [];
var index, arc;
@@ -98,12 +99,12 @@ ol.format.TopoJSON.concatenateArcs_ = function(indices, arcs) {
* @return {ol.geom.Point} Geometry.
* @private
*/
ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) {
_ol_format_TopoJSON_.readPointGeometry_ = function(object, scale, translate) {
var coordinates = object.coordinates;
if (scale && translate) {
ol.format.TopoJSON.transformVertex_(coordinates, scale, translate);
_ol_format_TopoJSON_.transformVertex_(coordinates, scale, translate);
}
return new ol.geom.Point(coordinates);
return new _ol_geom_Point_(coordinates);
};
@@ -116,16 +117,16 @@ ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) {
* @return {ol.geom.MultiPoint} Geometry.
* @private
*/
ol.format.TopoJSON.readMultiPointGeometry_ = function(object, scale,
_ol_format_TopoJSON_.readMultiPointGeometry_ = function(object, scale,
translate) {
var coordinates = object.coordinates;
var i, ii;
if (scale && translate) {
for (i = 0, ii = coordinates.length; i < ii; ++i) {
ol.format.TopoJSON.transformVertex_(coordinates[i], scale, translate);
_ol_format_TopoJSON_.transformVertex_(coordinates[i], scale, translate);
}
}
return new ol.geom.MultiPoint(coordinates);
return new _ol_geom_MultiPoint_(coordinates);
};
@@ -137,9 +138,9 @@ ol.format.TopoJSON.readMultiPointGeometry_ = function(object, scale,
* @return {ol.geom.LineString} Geometry.
* @private
*/
ol.format.TopoJSON.readLineStringGeometry_ = function(object, arcs) {
var coordinates = ol.format.TopoJSON.concatenateArcs_(object.arcs, arcs);
return new ol.geom.LineString(coordinates);
_ol_format_TopoJSON_.readLineStringGeometry_ = function(object, arcs) {
var coordinates = _ol_format_TopoJSON_.concatenateArcs_(object.arcs, arcs);
return new _ol_geom_LineString_(coordinates);
};
@@ -151,13 +152,13 @@ ol.format.TopoJSON.readLineStringGeometry_ = function(object, arcs) {
* @return {ol.geom.MultiLineString} Geometry.
* @private
*/
ol.format.TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) {
_ol_format_TopoJSON_.readMultiLineStringGeometry_ = function(object, arcs) {
var coordinates = [];
var i, ii;
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
coordinates[i] = ol.format.TopoJSON.concatenateArcs_(object.arcs[i], arcs);
coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs);
}
return new ol.geom.MultiLineString(coordinates);
return new _ol_geom_MultiLineString_(coordinates);
};
@@ -169,13 +170,13 @@ ol.format.TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) {
* @return {ol.geom.Polygon} Geometry.
* @private
*/
ol.format.TopoJSON.readPolygonGeometry_ = function(object, arcs) {
_ol_format_TopoJSON_.readPolygonGeometry_ = function(object, arcs) {
var coordinates = [];
var i, ii;
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
coordinates[i] = ol.format.TopoJSON.concatenateArcs_(object.arcs[i], arcs);
coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs);
}
return new ol.geom.Polygon(coordinates);
return new _ol_geom_Polygon_(coordinates);
};
@@ -187,7 +188,7 @@ ol.format.TopoJSON.readPolygonGeometry_ = function(object, arcs) {
* @return {ol.geom.MultiPolygon} Geometry.
* @private
*/
ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
_ol_format_TopoJSON_.readMultiPolygonGeometry_ = function(object, arcs) {
var coordinates = [];
var polyArray, ringCoords, j, jj;
var i, ii;
@@ -197,11 +198,11 @@ ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
ringCoords = [];
for (j = 0, jj = polyArray.length; j < jj; ++j) {
// for each ring
ringCoords[j] = ol.format.TopoJSON.concatenateArcs_(polyArray[j], arcs);
ringCoords[j] = _ol_format_TopoJSON_.concatenateArcs_(polyArray[j], arcs);
}
coordinates[i] = ringCoords;
}
return new ol.geom.MultiPolygon(coordinates);
return new _ol_geom_MultiPolygon_(coordinates);
};
@@ -220,13 +221,13 @@ ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
* @return {Array.<ol.Feature>} Array of features.
* @private
*/
ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
_ol_format_TopoJSON_.readFeaturesFromGeometryCollection_ = function(
collection, arcs, scale, translate, property, name, opt_options) {
var geometries = collection.geometries;
var features = [];
var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) {
features[i] = ol.format.TopoJSON.readFeatureFromGeometry_(
features[i] = _ol_format_TopoJSON_.readFeatureFromGeometry_(
geometries[i], arcs, scale, translate, property, name, opt_options);
}
return features;
@@ -247,19 +248,19 @@ ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
* @return {ol.Feature} Feature.
* @private
*/
ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
_ol_format_TopoJSON_.readFeatureFromGeometry_ = function(object, arcs,
scale, translate, property, name, opt_options) {
var geometry;
var type = object.type;
var geometryReader = ol.format.TopoJSON.GEOMETRY_READERS_[type];
var geometryReader = _ol_format_TopoJSON_.GEOMETRY_READERS_[type];
if ((type === 'Point') || (type === 'MultiPoint')) {
geometry = geometryReader(object, scale, translate);
} else {
geometry = geometryReader(object, arcs);
}
var feature = new ol.Feature();
var feature = new _ol_Feature_();
feature.setGeometry(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options)));
_ol_format_Feature_.transformWithOptions(geometry, false, opt_options)));
if (object.id !== undefined) {
feature.setId(object.id);
}
@@ -285,13 +286,13 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.TopoJSON.prototype.readFeatures;
_ol_format_TopoJSON_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
_ol_format_TopoJSON_.prototype.readFeaturesFromObject = function(
object, opt_options) {
if (object.type == 'Topology') {
var topoJSONTopology = /** @type {TopoJSONTopology} */ (object);
@@ -303,7 +304,7 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
}
var arcs = topoJSONTopology.arcs;
if (transform) {
ol.format.TopoJSON.transformArcs_(arcs, scale, translate);
_ol_format_TopoJSON_.transformArcs_(arcs, scale, translate);
}
/** @type {Array.<ol.Feature>} */
var features = [];
@@ -318,12 +319,12 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
feature = /** @type {TopoJSONGeometryCollection} */
(topoJSONFeatures[objectName]);
features.push.apply(features,
ol.format.TopoJSON.readFeaturesFromGeometryCollection_(
_ol_format_TopoJSON_.readFeaturesFromGeometryCollection_(
feature, arcs, scale, translate, property, objectName, opt_options));
} else {
feature = /** @type {TopoJSONGeometry} */
(topoJSONFeatures[objectName]);
features.push(ol.format.TopoJSON.readFeatureFromGeometry_(
features.push(_ol_format_TopoJSON_.readFeatureFromGeometry_(
feature, arcs, scale, translate, property, objectName, opt_options));
}
}
@@ -343,10 +344,10 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
* @param {Array.<number>} translate Translation for each dimension.
* @private
*/
ol.format.TopoJSON.transformArcs_ = function(arcs, scale, translate) {
_ol_format_TopoJSON_.transformArcs_ = function(arcs, scale, translate) {
var i, ii;
for (i = 0, ii = arcs.length; i < ii; ++i) {
ol.format.TopoJSON.transformArc_(arcs[i], scale, translate);
_ol_format_TopoJSON_.transformArc_(arcs[i], scale, translate);
}
};
@@ -359,7 +360,7 @@ ol.format.TopoJSON.transformArcs_ = function(arcs, scale, translate) {
* @param {Array.<number>} translate Translation for each dimension.
* @private
*/
ol.format.TopoJSON.transformArc_ = function(arc, scale, translate) {
_ol_format_TopoJSON_.transformArc_ = function(arc, scale, translate) {
var x = 0;
var y = 0;
var vertex;
@@ -370,7 +371,7 @@ ol.format.TopoJSON.transformArc_ = function(arc, scale, translate) {
y += vertex[1];
vertex[0] = x;
vertex[1] = y;
ol.format.TopoJSON.transformVertex_(vertex, scale, translate);
_ol_format_TopoJSON_.transformVertex_(vertex, scale, translate);
}
};
@@ -384,7 +385,7 @@ ol.format.TopoJSON.transformArc_ = function(arc, scale, translate) {
* @param {Array.<number>} translate Translation for each dimension.
* @private
*/
ol.format.TopoJSON.transformVertex_ = function(vertex, scale, translate) {
_ol_format_TopoJSON_.transformVertex_ = function(vertex, scale, translate) {
vertex[0] = vertex[0] * scale[0] + translate[0];
vertex[1] = vertex[1] * scale[1] + translate[1];
};
@@ -398,13 +399,13 @@ ol.format.TopoJSON.transformVertex_ = function(vertex, scale, translate) {
* @override
* @api
*/
ol.format.TopoJSON.prototype.readProjection;
_ol_format_TopoJSON_.prototype.readProjection;
/**
* @inheritDoc
*/
ol.format.TopoJSON.prototype.readProjectionFromObject = function(object) {
_ol_format_TopoJSON_.prototype.readProjectionFromObject = function(object) {
return this.defaultDataProjection;
};
@@ -414,13 +415,13 @@ ol.format.TopoJSON.prototype.readProjectionFromObject = function(object) {
* @private
* @type {Object.<string, function(TopoJSONGeometry, Array, ...Array): ol.geom.Geometry>}
*/
ol.format.TopoJSON.GEOMETRY_READERS_ = {
'Point': ol.format.TopoJSON.readPointGeometry_,
'LineString': ol.format.TopoJSON.readLineStringGeometry_,
'Polygon': ol.format.TopoJSON.readPolygonGeometry_,
'MultiPoint': ol.format.TopoJSON.readMultiPointGeometry_,
'MultiLineString': ol.format.TopoJSON.readMultiLineStringGeometry_,
'MultiPolygon': ol.format.TopoJSON.readMultiPolygonGeometry_
_ol_format_TopoJSON_.GEOMETRY_READERS_ = {
'Point': _ol_format_TopoJSON_.readPointGeometry_,
'LineString': _ol_format_TopoJSON_.readLineStringGeometry_,
'Polygon': _ol_format_TopoJSON_.readPolygonGeometry_,
'MultiPoint': _ol_format_TopoJSON_.readMultiPointGeometry_,
'MultiLineString': _ol_format_TopoJSON_.readMultiLineStringGeometry_,
'MultiPolygon': _ol_format_TopoJSON_.readMultiPolygonGeometry_
};
@@ -428,32 +429,33 @@ ol.format.TopoJSON.GEOMETRY_READERS_ = {
* Not implemented.
* @inheritDoc
*/
ol.format.TopoJSON.prototype.writeFeatureObject = function(feature, opt_options) {};
_ol_format_TopoJSON_.prototype.writeFeatureObject = function(feature, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.TopoJSON.prototype.writeFeaturesObject = function(features, opt_options) {};
_ol_format_TopoJSON_.prototype.writeFeaturesObject = function(features, opt_options) {};
/**
* Not implemented.
* @inheritDoc
*/
ol.format.TopoJSON.prototype.writeGeometryObject = function(geometry, opt_options) {};
_ol_format_TopoJSON_.prototype.writeGeometryObject = function(geometry, opt_options) {};
/**
* Not implemented.
* @override
*/
ol.format.TopoJSON.prototype.readGeometryFromObject = function() {};
_ol_format_TopoJSON_.prototype.readGeometryFromObject = function() {};
/**
* Not implemented.
* @override
*/
ol.format.TopoJSON.prototype.readFeatureFromObject = function() {};
_ol_format_TopoJSON_.prototype.readFeatureFromObject = function() {};
export default _ol_format_TopoJSON_;

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +1,20 @@
goog.provide('ol.format.WKT');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.SimpleGeometry');
/**
* @module ol/format/WKT
*/
import _ol_ from '../index.js';
import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js';
import _ol_geom_GeometryCollection_ from '../geom/GeometryCollection.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
import _ol_geom_LineString_ from '../geom/LineString.js';
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
import _ol_geom_Point_ from '../geom/Point.js';
import _ol_geom_Polygon_ from '../geom/Polygon.js';
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
/**
* @classdesc
@@ -26,11 +26,11 @@ goog.require('ol.geom.SimpleGeometry');
* @param {olx.format.WKTOptions=} opt_options Options.
* @api
*/
ol.format.WKT = function(opt_options) {
var _ol_format_WKT_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.format.TextFeature.call(this);
_ol_format_TextFeature_.call(this);
/**
* Split GeometryCollection into multiple features.
@@ -41,35 +41,36 @@ ol.format.WKT = function(opt_options) {
options.splitCollection : false;
};
ol.inherits(ol.format.WKT, ol.format.TextFeature);
_ol_.inherits(_ol_format_WKT_, _ol_format_TextFeature_);
/**
* @const
* @type {string}
*/
ol.format.WKT.EMPTY = 'EMPTY';
_ol_format_WKT_.EMPTY = 'EMPTY';
/**
* @const
* @type {string}
*/
ol.format.WKT.Z = 'Z';
_ol_format_WKT_.Z = 'Z';
/**
* @const
* @type {string}
*/
ol.format.WKT.M = 'M';
_ol_format_WKT_.M = 'M';
/**
* @const
* @type {string}
*/
ol.format.WKT.ZM = 'ZM';
_ol_format_WKT_.ZM = 'ZM';
/**
@@ -77,7 +78,7 @@ ol.format.WKT.ZM = 'ZM';
* @return {string} Coordinates part of Point as WKT.
* @private
*/
ol.format.WKT.encodePointGeometry_ = function(geom) {
_ol_format_WKT_.encodePointGeometry_ = function(geom) {
var coordinates = geom.getCoordinates();
if (coordinates.length === 0) {
return '';
@@ -91,11 +92,11 @@ ol.format.WKT.encodePointGeometry_ = function(geom) {
* @return {string} Coordinates part of MultiPoint as WKT.
* @private
*/
ol.format.WKT.encodeMultiPointGeometry_ = function(geom) {
_ol_format_WKT_.encodeMultiPointGeometry_ = function(geom) {
var array = [];
var components = geom.getPoints();
for (var i = 0, ii = components.length; i < ii; ++i) {
array.push('(' + ol.format.WKT.encodePointGeometry_(components[i]) + ')');
array.push('(' + _ol_format_WKT_.encodePointGeometry_(components[i]) + ')');
}
return array.join(',');
};
@@ -106,11 +107,11 @@ ol.format.WKT.encodeMultiPointGeometry_ = function(geom) {
* @return {string} Coordinates part of GeometryCollection as WKT.
* @private
*/
ol.format.WKT.encodeGeometryCollectionGeometry_ = function(geom) {
_ol_format_WKT_.encodeGeometryCollectionGeometry_ = function(geom) {
var array = [];
var geoms = geom.getGeometries();
for (var i = 0, ii = geoms.length; i < ii; ++i) {
array.push(ol.format.WKT.encode_(geoms[i]));
array.push(_ol_format_WKT_.encode_(geoms[i]));
}
return array.join(',');
};
@@ -121,7 +122,7 @@ ol.format.WKT.encodeGeometryCollectionGeometry_ = function(geom) {
* @return {string} Coordinates part of LineString as WKT.
* @private
*/
ol.format.WKT.encodeLineStringGeometry_ = function(geom) {
_ol_format_WKT_.encodeLineStringGeometry_ = function(geom) {
var coordinates = geom.getCoordinates();
var array = [];
for (var i = 0, ii = coordinates.length; i < ii; ++i) {
@@ -136,11 +137,11 @@ ol.format.WKT.encodeLineStringGeometry_ = function(geom) {
* @return {string} Coordinates part of MultiLineString as WKT.
* @private
*/
ol.format.WKT.encodeMultiLineStringGeometry_ = function(geom) {
_ol_format_WKT_.encodeMultiLineStringGeometry_ = function(geom) {
var array = [];
var components = geom.getLineStrings();
for (var i = 0, ii = components.length; i < ii; ++i) {
array.push('(' + ol.format.WKT.encodeLineStringGeometry_(
array.push('(' + _ol_format_WKT_.encodeLineStringGeometry_(
components[i]) + ')');
}
return array.join(',');
@@ -152,11 +153,11 @@ ol.format.WKT.encodeMultiLineStringGeometry_ = function(geom) {
* @return {string} Coordinates part of Polygon as WKT.
* @private
*/
ol.format.WKT.encodePolygonGeometry_ = function(geom) {
_ol_format_WKT_.encodePolygonGeometry_ = function(geom) {
var array = [];
var rings = geom.getLinearRings();
for (var i = 0, ii = rings.length; i < ii; ++i) {
array.push('(' + ol.format.WKT.encodeLineStringGeometry_(
array.push('(' + _ol_format_WKT_.encodeLineStringGeometry_(
rings[i]) + ')');
}
return array.join(',');
@@ -168,11 +169,11 @@ ol.format.WKT.encodePolygonGeometry_ = function(geom) {
* @return {string} Coordinates part of MultiPolygon as WKT.
* @private
*/
ol.format.WKT.encodeMultiPolygonGeometry_ = function(geom) {
_ol_format_WKT_.encodeMultiPolygonGeometry_ = function(geom) {
var array = [];
var components = geom.getPolygons();
for (var i = 0, ii = components.length; i < ii; ++i) {
array.push('(' + ol.format.WKT.encodePolygonGeometry_(
array.push('(' + _ol_format_WKT_.encodePolygonGeometry_(
components[i]) + ')');
}
return array.join(',');
@@ -183,14 +184,14 @@ ol.format.WKT.encodeMultiPolygonGeometry_ = function(geom) {
* @return {string} Potential dimensional information for WKT type.
* @private
*/
ol.format.WKT.encodeGeometryLayout_ = function(geom) {
_ol_format_WKT_.encodeGeometryLayout_ = function(geom) {
var layout = geom.getLayout();
var dimInfo = '';
if (layout === ol.geom.GeometryLayout.XYZ || layout === ol.geom.GeometryLayout.XYZM) {
dimInfo += ol.format.WKT.Z;
if (layout === _ol_geom_GeometryLayout_.XYZ || layout === _ol_geom_GeometryLayout_.XYZM) {
dimInfo += _ol_format_WKT_.Z;
}
if (layout === ol.geom.GeometryLayout.XYM || layout === ol.geom.GeometryLayout.XYZM) {
dimInfo += ol.format.WKT.M;
if (layout === _ol_geom_GeometryLayout_.XYM || layout === _ol_geom_GeometryLayout_.XYZM) {
dimInfo += _ol_format_WKT_.M;
}
return dimInfo;
};
@@ -202,19 +203,19 @@ ol.format.WKT.encodeGeometryLayout_ = function(geom) {
* @return {string} WKT string for the geometry.
* @private
*/
ol.format.WKT.encode_ = function(geom) {
_ol_format_WKT_.encode_ = function(geom) {
var type = geom.getType();
var geometryEncoder = ol.format.WKT.GeometryEncoder_[type];
var geometryEncoder = _ol_format_WKT_.GeometryEncoder_[type];
var enc = geometryEncoder(geom);
type = type.toUpperCase();
if (geom instanceof ol.geom.SimpleGeometry) {
var dimInfo = ol.format.WKT.encodeGeometryLayout_(geom);
if (geom instanceof _ol_geom_SimpleGeometry_) {
var dimInfo = _ol_format_WKT_.encodeGeometryLayout_(geom);
if (dimInfo.length > 0) {
type += ' ' + dimInfo;
}
}
if (enc.length === 0) {
return type + ' ' + ol.format.WKT.EMPTY;
return type + ' ' + _ol_format_WKT_.EMPTY;
}
return type + '(' + enc + ')';
};
@@ -225,14 +226,14 @@ ol.format.WKT.encode_ = function(geom) {
* @type {Object.<string, function(ol.geom.Geometry): string>}
* @private
*/
ol.format.WKT.GeometryEncoder_ = {
'Point': ol.format.WKT.encodePointGeometry_,
'LineString': ol.format.WKT.encodeLineStringGeometry_,
'Polygon': ol.format.WKT.encodePolygonGeometry_,
'MultiPoint': ol.format.WKT.encodeMultiPointGeometry_,
'MultiLineString': ol.format.WKT.encodeMultiLineStringGeometry_,
'MultiPolygon': ol.format.WKT.encodeMultiPolygonGeometry_,
'GeometryCollection': ol.format.WKT.encodeGeometryCollectionGeometry_
_ol_format_WKT_.GeometryEncoder_ = {
'Point': _ol_format_WKT_.encodePointGeometry_,
'LineString': _ol_format_WKT_.encodeLineStringGeometry_,
'Polygon': _ol_format_WKT_.encodePolygonGeometry_,
'MultiPoint': _ol_format_WKT_.encodeMultiPointGeometry_,
'MultiLineString': _ol_format_WKT_.encodeMultiLineStringGeometry_,
'MultiPolygon': _ol_format_WKT_.encodeMultiPolygonGeometry_,
'GeometryCollection': _ol_format_WKT_.encodeGeometryCollectionGeometry_
};
@@ -243,9 +244,9 @@ ol.format.WKT.GeometryEncoder_ = {
* The geometry created.
* @private
*/
ol.format.WKT.prototype.parse_ = function(wkt) {
var lexer = new ol.format.WKT.Lexer(wkt);
var parser = new ol.format.WKT.Parser(lexer);
_ol_format_WKT_.prototype.parse_ = function(wkt) {
var lexer = new _ol_format_WKT_.Lexer(wkt);
var parser = new _ol_format_WKT_.Parser(lexer);
return parser.parse();
};
@@ -259,16 +260,16 @@ ol.format.WKT.prototype.parse_ = function(wkt) {
* @return {ol.Feature} Feature.
* @api
*/
ol.format.WKT.prototype.readFeature;
_ol_format_WKT_.prototype.readFeature;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.readFeatureFromText = function(text, opt_options) {
_ol_format_WKT_.prototype.readFeatureFromText = function(text, opt_options) {
var geom = this.readGeometryFromText(text, opt_options);
if (geom) {
var feature = new ol.Feature();
var feature = new _ol_Feature_();
feature.setGeometry(geom);
return feature;
}
@@ -285,17 +286,17 @@ ol.format.WKT.prototype.readFeatureFromText = function(text, opt_options) {
* @return {Array.<ol.Feature>} Features.
* @api
*/
ol.format.WKT.prototype.readFeatures;
_ol_format_WKT_.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.readFeaturesFromText = function(text, opt_options) {
_ol_format_WKT_.prototype.readFeaturesFromText = function(text, opt_options) {
var geometries = [];
var geometry = this.readGeometryFromText(text, opt_options);
if (this.splitCollection_ &&
geometry.getType() == ol.geom.GeometryType.GEOMETRY_COLLECTION) {
geometry.getType() == _ol_geom_GeometryType_.GEOMETRY_COLLECTION) {
geometries = (/** @type {ol.geom.GeometryCollection} */ (geometry))
.getGeometriesArray();
} else {
@@ -303,7 +304,7 @@ ol.format.WKT.prototype.readFeaturesFromText = function(text, opt_options) {
}
var feature, features = [];
for (var i = 0, ii = geometries.length; i < ii; ++i) {
feature = new ol.Feature();
feature = new _ol_Feature_();
feature.setGeometry(geometries[i]);
features.push(feature);
}
@@ -320,17 +321,18 @@ ol.format.WKT.prototype.readFeaturesFromText = function(text, opt_options) {
* @return {ol.geom.Geometry} Geometry.
* @api
*/
ol.format.WKT.prototype.readGeometry;
_ol_format_WKT_.prototype.readGeometry;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) {
_ol_format_WKT_.prototype.readGeometryFromText = function(text, opt_options) {
var geometry = this.parse_(text);
if (geometry) {
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options));
return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(geometry, false, opt_options)
);
} else {
return null;
}
@@ -346,13 +348,13 @@ ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) {
* @return {string} WKT string.
* @api
*/
ol.format.WKT.prototype.writeFeature;
_ol_format_WKT_.prototype.writeFeature;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.writeFeatureText = function(feature, opt_options) {
_ol_format_WKT_.prototype.writeFeatureText = function(feature, opt_options) {
var geometry = feature.getGeometry();
if (geometry) {
return this.writeGeometryText(geometry, opt_options);
@@ -370,13 +372,13 @@ ol.format.WKT.prototype.writeFeatureText = function(feature, opt_options) {
* @return {string} WKT string.
* @api
*/
ol.format.WKT.prototype.writeFeatures;
_ol_format_WKT_.prototype.writeFeatures;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.writeFeaturesText = function(features, opt_options) {
_ol_format_WKT_.prototype.writeFeaturesText = function(features, opt_options) {
if (features.length == 1) {
return this.writeFeatureText(features[0], opt_options);
}
@@ -384,7 +386,7 @@ ol.format.WKT.prototype.writeFeaturesText = function(features, opt_options) {
for (var i = 0, ii = features.length; i < ii; ++i) {
geometries.push(features[i].getGeometry());
}
var collection = new ol.geom.GeometryCollection(geometries);
var collection = new _ol_geom_GeometryCollection_(geometries);
return this.writeGeometryText(collection, opt_options);
};
@@ -398,15 +400,15 @@ ol.format.WKT.prototype.writeFeaturesText = function(features, opt_options) {
* @return {string} WKT string.
* @api
*/
ol.format.WKT.prototype.writeGeometry;
_ol_format_WKT_.prototype.writeGeometry;
/**
* @inheritDoc
*/
ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)));
_ol_format_WKT_.prototype.writeGeometryText = function(geometry, opt_options) {
return _ol_format_WKT_.encode_(/** @type {ol.geom.Geometry} */ (
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options)));
};
@@ -415,7 +417,7 @@ ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
* @enum {number}
* @private
*/
ol.format.WKT.TokenType_ = {
_ol_format_WKT_.TokenType_ = {
TEXT: 1,
LEFT_PAREN: 2,
RIGHT_PAREN: 3,
@@ -431,7 +433,7 @@ ol.format.WKT.TokenType_ = {
* @constructor
* @protected
*/
ol.format.WKT.Lexer = function(wkt) {
_ol_format_WKT_.Lexer = function(wkt) {
/**
* @type {string}
@@ -451,7 +453,7 @@ ol.format.WKT.Lexer = function(wkt) {
* @return {boolean} Whether the character is alphabetic.
* @private
*/
ol.format.WKT.Lexer.prototype.isAlpha_ = function(c) {
_ol_format_WKT_.Lexer.prototype.isAlpha_ = function(c) {
return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
};
@@ -463,7 +465,7 @@ ol.format.WKT.Lexer.prototype.isAlpha_ = function(c) {
* @return {boolean} Whether the character is numeric.
* @private
*/
ol.format.WKT.Lexer.prototype.isNumeric_ = function(c, opt_decimal) {
_ol_format_WKT_.Lexer.prototype.isNumeric_ = function(c, opt_decimal) {
var decimal = opt_decimal !== undefined ? opt_decimal : false;
return c >= '0' && c <= '9' || c == '.' && !decimal;
};
@@ -474,7 +476,7 @@ ol.format.WKT.Lexer.prototype.isNumeric_ = function(c, opt_decimal) {
* @return {boolean} Whether the character is whitespace.
* @private
*/
ol.format.WKT.Lexer.prototype.isWhiteSpace_ = function(c) {
_ol_format_WKT_.Lexer.prototype.isWhiteSpace_ = function(c) {
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
};
@@ -483,7 +485,7 @@ ol.format.WKT.Lexer.prototype.isWhiteSpace_ = function(c) {
* @return {string} Next string character.
* @private
*/
ol.format.WKT.Lexer.prototype.nextChar_ = function() {
_ol_format_WKT_.Lexer.prototype.nextChar_ = function() {
return this.wkt.charAt(++this.index_);
};
@@ -492,26 +494,26 @@ ol.format.WKT.Lexer.prototype.nextChar_ = function() {
* Fetch and return the next token.
* @return {!ol.WKTToken} Next string token.
*/
ol.format.WKT.Lexer.prototype.nextToken = function() {
_ol_format_WKT_.Lexer.prototype.nextToken = function() {
var c = this.nextChar_();
var token = {position: this.index_, value: c};
if (c == '(') {
token.type = ol.format.WKT.TokenType_.LEFT_PAREN;
token.type = _ol_format_WKT_.TokenType_.LEFT_PAREN;
} else if (c == ',') {
token.type = ol.format.WKT.TokenType_.COMMA;
token.type = _ol_format_WKT_.TokenType_.COMMA;
} else if (c == ')') {
token.type = ol.format.WKT.TokenType_.RIGHT_PAREN;
token.type = _ol_format_WKT_.TokenType_.RIGHT_PAREN;
} else if (this.isNumeric_(c) || c == '-') {
token.type = ol.format.WKT.TokenType_.NUMBER;
token.type = _ol_format_WKT_.TokenType_.NUMBER;
token.value = this.readNumber_();
} else if (this.isAlpha_(c)) {
token.type = ol.format.WKT.TokenType_.TEXT;
token.type = _ol_format_WKT_.TokenType_.TEXT;
token.value = this.readText_();
} else if (this.isWhiteSpace_(c)) {
return this.nextToken();
} else if (c === '') {
token.type = ol.format.WKT.TokenType_.EOF;
token.type = _ol_format_WKT_.TokenType_.EOF;
} else {
throw new Error('Unexpected character: ' + c);
}
@@ -524,7 +526,7 @@ ol.format.WKT.Lexer.prototype.nextToken = function() {
* @return {number} Numeric token value.
* @private
*/
ol.format.WKT.Lexer.prototype.readNumber_ = function() {
_ol_format_WKT_.Lexer.prototype.readNumber_ = function() {
var c, index = this.index_;
var decimal = false;
var scientificNotation = false;
@@ -552,7 +554,7 @@ ol.format.WKT.Lexer.prototype.readNumber_ = function() {
* @return {string} String token value.
* @private
*/
ol.format.WKT.Lexer.prototype.readText_ = function() {
_ol_format_WKT_.Lexer.prototype.readText_ = function() {
var c, index = this.index_;
do {
c = this.nextChar_();
@@ -567,7 +569,7 @@ ol.format.WKT.Lexer.prototype.readText_ = function() {
* @constructor
* @protected
*/
ol.format.WKT.Parser = function(lexer) {
_ol_format_WKT_.Parser = function(lexer) {
/**
* @type {ol.format.WKT.Lexer}
@@ -585,7 +587,7 @@ ol.format.WKT.Parser = function(lexer) {
* @type {ol.geom.GeometryLayout}
* @private
*/
this.layout_ = ol.geom.GeometryLayout.XY;
this.layout_ = _ol_geom_GeometryLayout_.XY;
};
@@ -593,7 +595,7 @@ ol.format.WKT.Parser = function(lexer) {
* Fetch the next token form the lexer and replace the active token.
* @private
*/
ol.format.WKT.Parser.prototype.consume_ = function() {
_ol_format_WKT_.Parser.prototype.consume_ = function() {
this.token_ = this.lexer_.nextToken();
};
@@ -602,7 +604,7 @@ ol.format.WKT.Parser.prototype.consume_ = function() {
* @param {ol.format.WKT.TokenType_} type Token type.
* @return {boolean} Whether the token matches the given type.
*/
ol.format.WKT.Parser.prototype.isTokenType = function(type) {
_ol_format_WKT_.Parser.prototype.isTokenType = function(type) {
var isMatch = this.token_.type == type;
return isMatch;
};
@@ -613,7 +615,7 @@ ol.format.WKT.Parser.prototype.isTokenType = function(type) {
* @param {ol.format.WKT.TokenType_} type Token type.
* @return {boolean} Whether the token matches the given type.
*/
ol.format.WKT.Parser.prototype.match = function(type) {
_ol_format_WKT_.Parser.prototype.match = function(type) {
var isMatch = this.isTokenType(type);
if (isMatch) {
this.consume_();
@@ -626,7 +628,7 @@ ol.format.WKT.Parser.prototype.match = function(type) {
* Try to parse the tokens provided by the lexer.
* @return {ol.geom.Geometry} The geometry.
*/
ol.format.WKT.Parser.prototype.parse = function() {
_ol_format_WKT_.Parser.prototype.parse = function() {
this.consume_();
var geometry = this.parseGeometry_();
return geometry;
@@ -638,19 +640,19 @@ ol.format.WKT.Parser.prototype.parse = function() {
* @return {ol.geom.GeometryLayout} The layout.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometryLayout_ = function() {
var layout = ol.geom.GeometryLayout.XY;
_ol_format_WKT_.Parser.prototype.parseGeometryLayout_ = function() {
var layout = _ol_geom_GeometryLayout_.XY;
var dimToken = this.token_;
if (this.isTokenType(ol.format.WKT.TokenType_.TEXT)) {
if (this.isTokenType(_ol_format_WKT_.TokenType_.TEXT)) {
var dimInfo = dimToken.value;
if (dimInfo === ol.format.WKT.Z) {
layout = ol.geom.GeometryLayout.XYZ;
} else if (dimInfo === ol.format.WKT.M) {
layout = ol.geom.GeometryLayout.XYM;
} else if (dimInfo === ol.format.WKT.ZM) {
layout = ol.geom.GeometryLayout.XYZM;
if (dimInfo === _ol_format_WKT_.Z) {
layout = _ol_geom_GeometryLayout_.XYZ;
} else if (dimInfo === _ol_format_WKT_.M) {
layout = _ol_geom_GeometryLayout_.XYM;
} else if (dimInfo === _ol_format_WKT_.ZM) {
layout = _ol_geom_GeometryLayout_.XYZM;
}
if (layout !== ol.geom.GeometryLayout.XY) {
if (layout !== _ol_geom_GeometryLayout_.XY) {
this.consume_();
}
}
@@ -662,17 +664,17 @@ ol.format.WKT.Parser.prototype.parseGeometryLayout_ = function() {
* @return {!ol.geom.Geometry} The geometry.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
_ol_format_WKT_.Parser.prototype.parseGeometry_ = function() {
var token = this.token_;
if (this.match(ol.format.WKT.TokenType_.TEXT)) {
if (this.match(_ol_format_WKT_.TokenType_.TEXT)) {
var geomType = token.value;
this.layout_ = this.parseGeometryLayout_();
if (geomType == ol.geom.GeometryType.GEOMETRY_COLLECTION.toUpperCase()) {
if (geomType == _ol_geom_GeometryType_.GEOMETRY_COLLECTION.toUpperCase()) {
var geometries = this.parseGeometryCollectionText_();
return new ol.geom.GeometryCollection(geometries);
return new _ol_geom_GeometryCollection_(geometries);
} else {
var parser = ol.format.WKT.Parser.GeometryParser_[geomType];
var ctor = ol.format.WKT.Parser.GeometryConstructor_[geomType];
var parser = _ol_format_WKT_.Parser.GeometryParser_[geomType];
var ctor = _ol_format_WKT_.Parser.GeometryConstructor_[geomType];
if (!parser || !ctor) {
throw new Error('Invalid geometry type: ' + geomType);
}
@@ -688,13 +690,13 @@ ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
* @return {!Array.<ol.geom.Geometry>} A collection of geometries.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseGeometryCollectionText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var geometries = [];
do {
geometries.push(this.parseGeometry_());
} while (this.match(ol.format.WKT.TokenType_.COMMA));
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
} while (this.match(_ol_format_WKT_.TokenType_.COMMA));
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return geometries;
}
} else if (this.isEmptyGeometry_()) {
@@ -708,10 +710,10 @@ ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
* @return {Array.<number>} All values in a point.
* @private
*/
ol.format.WKT.Parser.prototype.parsePointText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parsePointText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePoint_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -725,10 +727,10 @@ ol.format.WKT.Parser.prototype.parsePointText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a linestring.
* @private
*/
ol.format.WKT.Parser.prototype.parseLineStringText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseLineStringText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePointList_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -742,10 +744,10 @@ ol.format.WKT.Parser.prototype.parseLineStringText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a polygon.
* @private
*/
ol.format.WKT.Parser.prototype.parsePolygonText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parsePolygonText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parseLineStringTextList_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -759,15 +761,15 @@ ol.format.WKT.Parser.prototype.parsePolygonText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a multipoint.
* @private
*/
ol.format.WKT.Parser.prototype.parseMultiPointText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseMultiPointText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates;
if (this.token_.type == ol.format.WKT.TokenType_.LEFT_PAREN) {
if (this.token_.type == _ol_format_WKT_.TokenType_.LEFT_PAREN) {
coordinates = this.parsePointTextList_();
} else {
coordinates = this.parsePointList_();
}
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -782,10 +784,10 @@ ol.format.WKT.Parser.prototype.parseMultiPointText_ = function() {
* in a multilinestring.
* @private
*/
ol.format.WKT.Parser.prototype.parseMultiLineStringText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseMultiLineStringText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parseLineStringTextList_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -799,10 +801,10 @@ ol.format.WKT.Parser.prototype.parseMultiLineStringText_ = function() {
* @return {!Array.<!Array.<number>>} All polygon points in a multipolygon.
* @private
*/
ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() {
if (this.match(ol.format.WKT.TokenType_.LEFT_PAREN)) {
_ol_format_WKT_.Parser.prototype.parseMultiPolygonText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePolygonTextList_();
if (this.match(ol.format.WKT.TokenType_.RIGHT_PAREN)) {
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) {
return coordinates;
}
} else if (this.isEmptyGeometry_()) {
@@ -816,12 +818,12 @@ ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() {
* @return {!Array.<number>} A point.
* @private
*/
ol.format.WKT.Parser.prototype.parsePoint_ = function() {
_ol_format_WKT_.Parser.prototype.parsePoint_ = function() {
var coordinates = [];
var dimensions = this.layout_.length;
for (var i = 0; i < dimensions; ++i) {
var token = this.token_;
if (this.match(ol.format.WKT.TokenType_.NUMBER)) {
if (this.match(_ol_format_WKT_.TokenType_.NUMBER)) {
coordinates.push(token.value);
} else {
break;
@@ -838,9 +840,9 @@ ol.format.WKT.Parser.prototype.parsePoint_ = function() {
* @return {!Array.<!Array.<number>>} An array of points.
* @private
*/
ol.format.WKT.Parser.prototype.parsePointList_ = function() {
_ol_format_WKT_.Parser.prototype.parsePointList_ = function() {
var coordinates = [this.parsePoint_()];
while (this.match(ol.format.WKT.TokenType_.COMMA)) {
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) {
coordinates.push(this.parsePoint_());
}
return coordinates;
@@ -851,9 +853,9 @@ ol.format.WKT.Parser.prototype.parsePointList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points.
* @private
*/
ol.format.WKT.Parser.prototype.parsePointTextList_ = function() {
_ol_format_WKT_.Parser.prototype.parsePointTextList_ = function() {
var coordinates = [this.parsePointText_()];
while (this.match(ol.format.WKT.TokenType_.COMMA)) {
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) {
coordinates.push(this.parsePointText_());
}
return coordinates;
@@ -864,9 +866,9 @@ ol.format.WKT.Parser.prototype.parsePointTextList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points.
* @private
*/
ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() {
_ol_format_WKT_.Parser.prototype.parseLineStringTextList_ = function() {
var coordinates = [this.parseLineStringText_()];
while (this.match(ol.format.WKT.TokenType_.COMMA)) {
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) {
coordinates.push(this.parseLineStringText_());
}
return coordinates;
@@ -877,9 +879,9 @@ ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points.
* @private
*/
ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() {
_ol_format_WKT_.Parser.prototype.parsePolygonTextList_ = function() {
var coordinates = [this.parsePolygonText_()];
while (this.match(ol.format.WKT.TokenType_.COMMA)) {
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) {
coordinates.push(this.parsePolygonText_());
}
return coordinates;
@@ -890,9 +892,9 @@ ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() {
* @return {boolean} Whether the token implies an empty geometry.
* @private
*/
ol.format.WKT.Parser.prototype.isEmptyGeometry_ = function() {
var isEmpty = this.isTokenType(ol.format.WKT.TokenType_.TEXT) &&
this.token_.value == ol.format.WKT.EMPTY;
_ol_format_WKT_.Parser.prototype.isEmptyGeometry_ = function() {
var isEmpty = this.isTokenType(_ol_format_WKT_.TokenType_.TEXT) &&
this.token_.value == _ol_format_WKT_.EMPTY;
if (isEmpty) {
this.consume_();
}
@@ -905,7 +907,7 @@ ol.format.WKT.Parser.prototype.isEmptyGeometry_ = function() {
* @return {string} Error message.
* @private
*/
ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() {
_ol_format_WKT_.Parser.prototype.formatErrorMessage_ = function() {
return 'Unexpected `' + this.token_.value + '` at position ' +
this.token_.position + ' in `' + this.lexer_.wkt + '`';
};
@@ -915,13 +917,13 @@ ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() {
* @enum {function (new:ol.geom.Geometry, Array, ol.geom.GeometryLayout)}
* @private
*/
ol.format.WKT.Parser.GeometryConstructor_ = {
'POINT': ol.geom.Point,
'LINESTRING': ol.geom.LineString,
'POLYGON': ol.geom.Polygon,
'MULTIPOINT': ol.geom.MultiPoint,
'MULTILINESTRING': ol.geom.MultiLineString,
'MULTIPOLYGON': ol.geom.MultiPolygon
_ol_format_WKT_.Parser.GeometryConstructor_ = {
'POINT': _ol_geom_Point_,
'LINESTRING': _ol_geom_LineString_,
'POLYGON': _ol_geom_Polygon_,
'MULTIPOINT': _ol_geom_MultiPoint_,
'MULTILINESTRING': _ol_geom_MultiLineString_,
'MULTIPOLYGON': _ol_geom_MultiPolygon_
};
@@ -929,11 +931,12 @@ ol.format.WKT.Parser.GeometryConstructor_ = {
* @enum {(function(): Array)}
* @private
*/
ol.format.WKT.Parser.GeometryParser_ = {
'POINT': ol.format.WKT.Parser.prototype.parsePointText_,
'LINESTRING': ol.format.WKT.Parser.prototype.parseLineStringText_,
'POLYGON': ol.format.WKT.Parser.prototype.parsePolygonText_,
'MULTIPOINT': ol.format.WKT.Parser.prototype.parseMultiPointText_,
'MULTILINESTRING': ol.format.WKT.Parser.prototype.parseMultiLineStringText_,
'MULTIPOLYGON': ol.format.WKT.Parser.prototype.parseMultiPolygonText_
_ol_format_WKT_.Parser.GeometryParser_ = {
'POINT': _ol_format_WKT_.Parser.prototype.parsePointText_,
'LINESTRING': _ol_format_WKT_.Parser.prototype.parseLineStringText_,
'POLYGON': _ol_format_WKT_.Parser.prototype.parsePolygonText_,
'MULTIPOINT': _ol_format_WKT_.Parser.prototype.parseMultiPointText_,
'MULTILINESTRING': _ol_format_WKT_.Parser.prototype.parseMultiLineStringText_,
'MULTIPOLYGON': _ol_format_WKT_.Parser.prototype.parseMultiPolygonText_
};
export default _ol_format_WKT_;

View File

@@ -1,11 +1,11 @@
goog.provide('ol.format.WMSCapabilities');
goog.require('ol');
goog.require('ol.format.XLink');
goog.require('ol.format.XML');
goog.require('ol.format.XSD');
goog.require('ol.xml');
/**
* @module ol/format/WMSCapabilities
*/
import _ol_ from '../index.js';
import _ol_format_XLink_ from '../format/XLink.js';
import _ol_format_XML_ from '../format/XML.js';
import _ol_format_XSD_ from '../format/XSD.js';
import _ol_xml_ from '../xml.js';
/**
* @classdesc
@@ -15,16 +15,17 @@ goog.require('ol.xml');
* @extends {ol.format.XML}
* @api
*/
ol.format.WMSCapabilities = function() {
var _ol_format_WMSCapabilities_ = function() {
ol.format.XML.call(this);
_ol_format_XML_.call(this);
/**
* @type {string|undefined}
*/
this.version = undefined;
};
ol.inherits(ol.format.WMSCapabilities, ol.format.XML);
_ol_.inherits(_ol_format_WMSCapabilities_, _ol_format_XML_);
/**
@@ -35,13 +36,13 @@ ol.inherits(ol.format.WMSCapabilities, ol.format.XML);
* @return {Object} An object representing the WMS capabilities.
* @api
*/
ol.format.WMSCapabilities.prototype.read;
_ol_format_WMSCapabilities_.prototype.read;
/**
* @inheritDoc
*/
ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) {
_ol_format_WMSCapabilities_.prototype.readFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
@@ -54,11 +55,11 @@ ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) {
/**
* @inheritDoc
*/
ol.format.WMSCapabilities.prototype.readFromNode = function(node) {
_ol_format_WMSCapabilities_.prototype.readFromNode = function(node) {
this.version = node.getAttribute('version').trim();
var wmsCapabilityObject = ol.xml.pushParseAndPop({
var wmsCapabilityObject = _ol_xml_.pushParseAndPop({
'version': this.version
}, ol.format.WMSCapabilities.PARSERS_, node, []);
}, _ol_format_WMSCapabilities_.PARSERS_, node, []);
return wmsCapabilityObject ? wmsCapabilityObject : null;
};
@@ -69,9 +70,9 @@ ol.format.WMSCapabilities.prototype.readFromNode = function(node) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Attribution object.
*/
ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readAttribution_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_, node, objectStack);
};
@@ -81,17 +82,17 @@ ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object} Bounding box object.
*/
ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readBoundingBox_ = function(node, objectStack) {
var extent = [
ol.format.XSD.readDecimalString(node.getAttribute('minx')),
ol.format.XSD.readDecimalString(node.getAttribute('miny')),
ol.format.XSD.readDecimalString(node.getAttribute('maxx')),
ol.format.XSD.readDecimalString(node.getAttribute('maxy'))
_ol_format_XSD_.readDecimalString(node.getAttribute('minx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('miny')),
_ol_format_XSD_.readDecimalString(node.getAttribute('maxx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('maxy'))
];
var resolutions = [
ol.format.XSD.readDecimalString(node.getAttribute('resx')),
ol.format.XSD.readDecimalString(node.getAttribute('resy'))
_ol_format_XSD_.readDecimalString(node.getAttribute('resx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('resy'))
];
return {
@@ -108,10 +109,10 @@ ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {ol.Extent|undefined} Bounding box object.
*/
ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
var geographicBoundingBox = ol.xml.pushParseAndPop(
_ol_format_WMSCapabilities_.readEXGeographicBoundingBox_ = function(node, objectStack) {
var geographicBoundingBox = _ol_xml_.pushParseAndPop(
{},
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
_ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
node, objectStack);
if (!geographicBoundingBox) {
return undefined;
@@ -141,9 +142,9 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt
* @private
* @return {Object|undefined} Capability object.
*/
ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readCapability_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CAPABILITY_PARSERS_, node, objectStack);
};
@@ -153,9 +154,9 @@ ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
* @private
* @return {Object|undefined} Service object.
*/
ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readService_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.SERVICE_PARSERS_, node, objectStack);
};
@@ -165,9 +166,9 @@ ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
* @private
* @return {Object|undefined} Contact information object.
*/
ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
_ol_format_WMSCapabilities_.readContactInformation_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_,
node, objectStack);
};
@@ -178,9 +179,9 @@ ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack)
* @private
* @return {Object|undefined} Contact person object.
*/
ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_,
_ol_format_WMSCapabilities_.readContactPersonPrimary_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_,
node, objectStack);
};
@@ -191,9 +192,9 @@ ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack
* @private
* @return {Object|undefined} Contact address object.
*/
ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
_ol_format_WMSCapabilities_.readContactAddress_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_,
node, objectStack);
};
@@ -204,9 +205,9 @@ ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
* @private
* @return {Array.<string>|undefined} Format array.
*/
ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
[], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readException_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
[], _ol_format_WMSCapabilities_.EXCEPTION_PARSERS_, node, objectStack);
};
@@ -216,9 +217,9 @@ ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
* @private
* @return {Object|undefined} Layer object.
*/
ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readCapabilityLayer_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.LAYER_PARSERS_, node, objectStack);
};
@@ -228,52 +229,52 @@ ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Layer object.
*/
ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readLayer_ = function(node, objectStack) {
var parentLayerObject = /** @type {Object.<string,*>} */
(objectStack[objectStack.length - 1]);
var layerObject = ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
var layerObject = _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.LAYER_PARSERS_, node, objectStack);
if (!layerObject) {
return undefined;
}
var queryable =
ol.format.XSD.readBooleanString(node.getAttribute('queryable'));
_ol_format_XSD_.readBooleanString(node.getAttribute('queryable'));
if (queryable === undefined) {
queryable = parentLayerObject['queryable'];
}
layerObject['queryable'] = queryable !== undefined ? queryable : false;
var cascaded = ol.format.XSD.readNonNegativeIntegerString(
var cascaded = _ol_format_XSD_.readNonNegativeIntegerString(
node.getAttribute('cascaded'));
if (cascaded === undefined) {
cascaded = parentLayerObject['cascaded'];
}
layerObject['cascaded'] = cascaded;
var opaque = ol.format.XSD.readBooleanString(node.getAttribute('opaque'));
var opaque = _ol_format_XSD_.readBooleanString(node.getAttribute('opaque'));
if (opaque === undefined) {
opaque = parentLayerObject['opaque'];
}
layerObject['opaque'] = opaque !== undefined ? opaque : false;
var noSubsets =
ol.format.XSD.readBooleanString(node.getAttribute('noSubsets'));
_ol_format_XSD_.readBooleanString(node.getAttribute('noSubsets'));
if (noSubsets === undefined) {
noSubsets = parentLayerObject['noSubsets'];
}
layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false;
var fixedWidth =
ol.format.XSD.readDecimalString(node.getAttribute('fixedWidth'));
_ol_format_XSD_.readDecimalString(node.getAttribute('fixedWidth'));
if (!fixedWidth) {
fixedWidth = parentLayerObject['fixedWidth'];
}
layerObject['fixedWidth'] = fixedWidth;
var fixedHeight =
ol.format.XSD.readDecimalString(node.getAttribute('fixedHeight'));
_ol_format_XSD_.readDecimalString(node.getAttribute('fixedHeight'));
if (!fixedHeight) {
fixedHeight = parentLayerObject['fixedHeight'];
}
@@ -307,18 +308,18 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object} Dimension object.
*/
ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readDimension_ = function(node, objectStack) {
var dimensionObject = {
'name': node.getAttribute('name'),
'units': node.getAttribute('units'),
'unitSymbol': node.getAttribute('unitSymbol'),
'default': node.getAttribute('default'),
'multipleValues': ol.format.XSD.readBooleanString(
'multipleValues': _ol_format_XSD_.readBooleanString(
node.getAttribute('multipleValues')),
'nearestValue': ol.format.XSD.readBooleanString(
'nearestValue': _ol_format_XSD_.readBooleanString(
node.getAttribute('nearestValue')),
'current': ol.format.XSD.readBooleanString(node.getAttribute('current')),
'values': ol.format.XSD.readString(node)
'current': _ol_format_XSD_.readBooleanString(node.getAttribute('current')),
'values': _ol_format_XSD_.readString(node)
};
return dimensionObject;
};
@@ -330,9 +331,9 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Online resource object.
*/
ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
_ol_format_WMSCapabilities_.readFormatOnlineresource_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_,
node, objectStack);
};
@@ -343,9 +344,9 @@ ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Request object.
*/
ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readRequest_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.REQUEST_PARSERS_, node, objectStack);
};
@@ -355,9 +356,9 @@ ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} DCP type object.
*/
ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readDCPType_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.DCPTYPE_PARSERS_, node, objectStack);
};
@@ -367,9 +368,9 @@ ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} HTTP object.
*/
ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readHTTP_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.HTTP_PARSERS_, node, objectStack);
};
@@ -379,9 +380,9 @@ ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Operation type object.
*/
ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readOperationType_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_, node, objectStack);
};
@@ -391,13 +392,13 @@ ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Online resource object.
*/
ol.format.WMSCapabilities.readSizedFormatOnlineresource_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_ = function(node, objectStack) {
var formatOnlineresource =
ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack);
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack);
if (formatOnlineresource) {
var size = [
ol.format.XSD.readNonNegativeIntegerString(node.getAttribute('width')),
ol.format.XSD.readNonNegativeIntegerString(node.getAttribute('height'))
_ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('width')),
_ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('height'))
];
formatOnlineresource['size'] = size;
return formatOnlineresource;
@@ -412,9 +413,9 @@ ol.format.WMSCapabilities.readSizedFormatOnlineresource_ = function(node, object
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Authority URL object.
*/
ol.format.WMSCapabilities.readAuthorityURL_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readAuthorityURL_ = function(node, objectStack) {
var authorityObject =
ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack);
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack);
if (authorityObject) {
authorityObject['name'] = node.getAttribute('name');
return authorityObject;
@@ -429,9 +430,9 @@ ol.format.WMSCapabilities.readAuthorityURL_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Metadata URL object.
*/
ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
_ol_format_WMSCapabilities_.readMetadataURL_ = function(node, objectStack) {
var metadataObject =
ol.format.WMSCapabilities.readFormatOnlineresource_(node, objectStack);
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack);
if (metadataObject) {
metadataObject['type'] = node.getAttribute('type');
return metadataObject;
@@ -446,9 +447,9 @@ ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Style object.
*/
ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readStyle_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.STYLE_PARSERS_, node, objectStack);
};
@@ -458,9 +459,9 @@ ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<string>|undefined} Keyword list.
*/
ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
[], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack);
_ol_format_WMSCapabilities_.readKeywordList_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(
[], _ol_format_WMSCapabilities_.KEYWORDLIST_PARSERS_, node, objectStack);
};
@@ -469,7 +470,7 @@ ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) {
* @private
* @type {Array.<string>}
*/
ol.format.WMSCapabilities.NAMESPACE_URIS_ = [
_ol_format_WMSCapabilities_.NAMESPACE_URIS_ = [
null,
'http://www.opengis.net/wms'
];
@@ -480,12 +481,12 @@ ol.format.WMSCapabilities.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Service': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readService_),
'Capability': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readCapability_)
_ol_format_WMSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Service': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readService_),
'Capability': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readCapability_)
});
@@ -494,14 +495,14 @@ ol.format.WMSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CAPABILITY_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Request': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readRequest_),
'Exception': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readException_),
'Layer': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readCapabilityLayer_)
_ol_format_WMSCapabilities_.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Request': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readRequest_),
'Exception': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readException_),
'Layer': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readCapabilityLayer_)
});
@@ -510,26 +511,26 @@ ol.format.WMSCapabilities.CAPABILITY_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.SERVICE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'KeywordList': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readKeywordList_),
'OnlineResource': ol.xml.makeObjectPropertySetter(
ol.format.XLink.readHref),
'ContactInformation': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readContactInformation_),
'Fees': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'AccessConstraints': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'LayerLimit': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MaxWidth': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MaxHeight': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger)
_ol_format_WMSCapabilities_.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'KeywordList': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readKeywordList_),
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref),
'ContactInformation': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactInformation_),
'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'AccessConstraints': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'LayerLimit': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MaxWidth': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger),
'MaxHeight': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger)
});
@@ -538,20 +539,20 @@ ol.format.WMSCapabilities.SERVICE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'ContactPersonPrimary': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readContactPersonPrimary_),
'ContactPosition': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ContactAddress': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readContactAddress_),
'ContactVoiceTelephone': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ContactFacsimileTelephone': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ContactElectronicMailAddress': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'ContactPersonPrimary': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactPersonPrimary_),
'ContactPosition': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ContactAddress': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactAddress_),
'ContactVoiceTelephone': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ContactFacsimileTelephone': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ContactElectronicMailAddress': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
});
@@ -560,12 +561,12 @@ ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'ContactPerson': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ContactOrganization': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
_ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'ContactPerson': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'ContactOrganization': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString)
});
@@ -574,15 +575,15 @@ ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'AddressType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Address': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'City': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'StateOrProvince': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'PostCode': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Country': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
_ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'AddressType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'StateOrProvince': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString),
'PostCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString)
});
@@ -591,9 +592,9 @@ ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.EXCEPTION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Format': ol.xml.makeArrayPusher(ol.format.XSD.readString)
_ol_format_WMSCapabilities_.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString)
});
@@ -602,39 +603,39 @@ ol.format.WMSCapabilities.EXCEPTION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'KeywordList': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readKeywordList_),
'CRS': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString),
'EX_GeographicBoundingBox': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readEXGeographicBoundingBox_),
'BoundingBox': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readBoundingBox_),
'Dimension': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readDimension_),
'Attribution': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readAttribution_),
'AuthorityURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readAuthorityURL_),
'Identifier': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString),
'MetadataURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readMetadataURL_),
'DataURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readFormatOnlineresource_),
'FeatureListURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readFormatOnlineresource_),
'Style': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readStyle_),
'MinScaleDenominator': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'MaxScaleDenominator': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'Layer': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readLayer_)
_ol_format_WMSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'KeywordList': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readKeywordList_),
'CRS': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString),
'EX_GeographicBoundingBox': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readEXGeographicBoundingBox_),
'BoundingBox': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readBoundingBox_),
'Dimension': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readDimension_),
'Attribution': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readAttribution_),
'AuthorityURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readAuthorityURL_),
'Identifier': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString),
'MetadataURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readMetadataURL_),
'DataURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readFormatOnlineresource_),
'FeatureListURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readFormatOnlineresource_),
'Style': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readStyle_),
'MinScaleDenominator': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'MaxScaleDenominator': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'Layer': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readLayer_)
});
@@ -643,13 +644,13 @@ ol.format.WMSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'OnlineResource': ol.xml.makeObjectPropertySetter(
ol.format.XLink.readHref),
'LogoURL': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readSizedFormatOnlineresource_)
_ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref),
'LogoURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_)
});
@@ -658,16 +659,16 @@ ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
ol.xml.makeStructureNS(ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'westBoundLongitude': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'eastBoundLongitude': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'southBoundLatitude': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal),
'northBoundLatitude': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readDecimal)
_ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
_ol_xml_.makeStructureNS(_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'westBoundLongitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'eastBoundLongitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'southBoundLatitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal),
'northBoundLatitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal)
});
@@ -676,14 +677,14 @@ ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.REQUEST_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'GetCapabilities': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readOperationType_),
'GetMap': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readOperationType_),
'GetFeatureInfo': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readOperationType_)
_ol_format_WMSCapabilities_.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'GetCapabilities': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_),
'GetMap': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_),
'GetFeatureInfo': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_)
});
@@ -692,11 +693,11 @@ ol.format.WMSCapabilities.REQUEST_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Format': ol.xml.makeObjectPropertyPusher(ol.format.XSD.readString),
'DCPType': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readDCPType_)
_ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString),
'DCPType': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readDCPType_)
});
@@ -705,10 +706,10 @@ ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.DCPTYPE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'HTTP': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readHTTP_)
_ol_format_WMSCapabilities_.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'HTTP': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readHTTP_)
});
@@ -717,12 +718,12 @@ ol.format.WMSCapabilities.DCPTYPE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.HTTP_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Get': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readFormatOnlineresource_),
'Post': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readFormatOnlineresource_)
_ol_format_WMSCapabilities_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Get': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_),
'Post': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_)
});
@@ -731,17 +732,17 @@ ol.format.WMSCapabilities.HTTP_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Name': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'LegendURL': ol.xml.makeObjectPropertyPusher(
ol.format.WMSCapabilities.readSizedFormatOnlineresource_),
'StyleSheetURL': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readFormatOnlineresource_),
'StyleURL': ol.xml.makeObjectPropertySetter(
ol.format.WMSCapabilities.readFormatOnlineresource_)
_ol_format_WMSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'LegendURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_),
'StyleSheetURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_),
'StyleURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_)
});
@@ -750,11 +751,11 @@ ol.format.WMSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
ol.xml.makeStructureNS(ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Format': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'OnlineResource': ol.xml.makeObjectPropertySetter(
ol.format.XLink.readHref)
_ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_ =
_ol_xml_.makeStructureNS(_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString),
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref)
});
@@ -763,7 +764,8 @@ ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMSCapabilities.NAMESPACE_URIS_, {
'Keyword': ol.xml.makeArrayPusher(ol.format.XSD.readString)
_ol_format_WMSCapabilities_.KEYWORDLIST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, {
'Keyword': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString)
});
export default _ol_format_WMSCapabilities_;

Some files were not shown because too many files have changed in this diff Show More