Merge pull request #489 from twpayne/consistent-options
Consistent options
This commit is contained in:
@@ -99,15 +99,15 @@
|
||||
@exportObjectLiteralProperty ol.control.ZoomSliderOptions.maxResolution number|undefined
|
||||
@exportObjectLiteralProperty ol.control.ZoomSliderOptions.minResolution number|undefined
|
||||
|
||||
@exportObjectLiteral ol.interaction.DefaultOptions
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.doubleClickZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.dragPan boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.keyboard boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.mouseWheelZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.shiftDragZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchPan boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchRotate boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchZoom boolean|undefined
|
||||
@exportObjectLiteral ol.interaction.DefaultsOptions
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultsOptions.doubleClickZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultsOptions.dragPan boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultsOptions.keyboard boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultsOptions.mouseWheelZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultsOptions.shiftDragZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultsOptions.touchPan boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultsOptions.touchRotate boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultsOptions.touchZoom boolean|undefined
|
||||
|
||||
@exportObjectLiteral ol.interaction.KeyboardPanOptions
|
||||
@exportObjectLiteralProperty ol.interaction.KeyboardPanOptions.pixelDelta number|undefined
|
||||
|
||||
@@ -8,7 +8,7 @@ goog.require('ol.easing');
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.animation.BounceOptions} options Options.
|
||||
* @param {ol.animation.BounceOptions} options Bounce options.
|
||||
* @return {ol.PreRenderFunction} Pre-render function.
|
||||
*/
|
||||
ol.animation.bounce = function(options) {
|
||||
@@ -37,7 +37,7 @@ ol.animation.bounce = function(options) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.animation.PanOptions} options Options.
|
||||
* @param {ol.animation.PanOptions} options Pan options.
|
||||
* @return {ol.PreRenderFunction} Pre-render function.
|
||||
*/
|
||||
ol.animation.pan = function(options) {
|
||||
@@ -70,7 +70,7 @@ ol.animation.pan = function(options) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.animation.RotateOptions} options Options.
|
||||
* @param {ol.animation.RotateOptions} options Rotate options.
|
||||
* @return {ol.PreRenderFunction} Pre-render function.
|
||||
*/
|
||||
ol.animation.rotate = function(options) {
|
||||
@@ -101,7 +101,7 @@ ol.animation.rotate = function(options) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.animation.ZoomOptions} options Options.
|
||||
* @param {ol.animation.ZoomOptions} options Zoom options.
|
||||
* @return {ol.PreRenderFunction} Pre-render function.
|
||||
*/
|
||||
ol.animation.zoom = function(options) {
|
||||
|
||||
@@ -20,7 +20,7 @@ goog.require('ol.source.Source');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
* @param {ol.control.AttributionOptions=} opt_options Options.
|
||||
* @param {ol.control.AttributionOptions=} opt_options Attribution options.
|
||||
*/
|
||||
ol.control.Attribution = function(opt_options) {
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ ol.control.ControlOptions;
|
||||
*
|
||||
* @constructor
|
||||
* @extends {goog.Disposable}
|
||||
* @param {ol.control.ControlOptions} controlOptions Control options.
|
||||
* @param {ol.control.ControlOptions} options Control options.
|
||||
*/
|
||||
ol.control.Control = function(controlOptions) {
|
||||
ol.control.Control = function(options) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
@@ -33,14 +33,13 @@ ol.control.Control = function(controlOptions) {
|
||||
* @protected
|
||||
* @type {Element}
|
||||
*/
|
||||
this.element = goog.isDef(controlOptions.element) ?
|
||||
controlOptions.element : null;
|
||||
this.element = goog.isDef(options.element) ? options.element : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Element|undefined}
|
||||
*/
|
||||
this.target_ = controlOptions.target;
|
||||
this.target_ = options.target;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -54,8 +53,8 @@ ol.control.Control = function(controlOptions) {
|
||||
*/
|
||||
this.listenerKeys = [];
|
||||
|
||||
if (goog.isDef(controlOptions.map)) {
|
||||
this.setMap(controlOptions.map);
|
||||
if (goog.isDef(options.map)) {
|
||||
this.setMap(options.map);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ goog.require('ol.control.Zoom');
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.control.DefaultsOptions=} opt_options Options.
|
||||
* @param {ol.control.DefaultsOptions=} opt_options Defaults options.
|
||||
* @param {Array.<ol.control.Control>=} opt_controls Additional controls.
|
||||
* @return {Array.<ol.control.Control>} Controls.
|
||||
*/
|
||||
|
||||
@@ -24,9 +24,9 @@ ol.control.DragBoxOptions;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
* @param {ol.control.DragBoxOptions} dragBoxOptions Drag box options.
|
||||
* @param {ol.control.DragBoxOptions} options Drag box options.
|
||||
*/
|
||||
ol.control.DragBox = function(dragBoxOptions) {
|
||||
ol.control.DragBox = function(options) {
|
||||
|
||||
var element = goog.dom.createDom(goog.dom.TagName.DIV, 'ol-dragbox');
|
||||
|
||||
@@ -40,11 +40,11 @@ ol.control.DragBox = function(dragBoxOptions) {
|
||||
* @private
|
||||
* @type {ol.Coordinate}
|
||||
*/
|
||||
this.startCoordinate_ = dragBoxOptions.startCoordinate;
|
||||
this.startCoordinate_ = options.startCoordinate;
|
||||
|
||||
goog.base(this, {
|
||||
element: element,
|
||||
map: dragBoxOptions.map
|
||||
map: options.map
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ goog.require('ol.css');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
* @param {ol.control.LogoOptions=} opt_options Options.
|
||||
* @param {ol.control.LogoOptions=} opt_options Logo options.
|
||||
*/
|
||||
ol.control.Logo = function(opt_options) {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ goog.require('ol.projection');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
* @param {ol.control.MousePositionOptions=} opt_options Options.
|
||||
* @param {ol.control.MousePositionOptions=} opt_options Mouse position options.
|
||||
*/
|
||||
ol.control.MousePosition = function(opt_options) {
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ ol.control.ScaleLineUnits = {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
* @param {ol.control.ScaleLineOptions=} opt_options Options.
|
||||
* @param {ol.control.ScaleLineOptions=} opt_options Scale line options.
|
||||
*/
|
||||
ol.control.ScaleLine = function(opt_options) {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ ol.control.ZOOM_DURATION = 250;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
* @param {ol.control.ZoomOptions=} opt_options Options.
|
||||
* @param {ol.control.ZoomOptions=} opt_options Zoom options.
|
||||
*/
|
||||
ol.control.Zoom = function(opt_options) {
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ goog.require('ol.css');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
* @param {ol.control.ZoomSliderOptions} zoomSliderOptions Zoom options.
|
||||
* @param {ol.control.ZoomSliderOptions} options Zoom slider options.
|
||||
*/
|
||||
ol.control.ZoomSlider = function(zoomSliderOptions) {
|
||||
ol.control.ZoomSlider = function(options) {
|
||||
// FIXME these should be read out from a map if not given, and only then
|
||||
// fallback to the constants if they weren't defined on the map.
|
||||
/**
|
||||
@@ -34,9 +34,8 @@ ol.control.ZoomSlider = function(zoomSliderOptions) {
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.maxResolution_ = goog.isDef(zoomSliderOptions.maxResolution) ?
|
||||
zoomSliderOptions.maxResolution :
|
||||
ol.control.ZoomSlider.DEFAULT_MAX_RESOLUTION;
|
||||
this.maxResolution_ = goog.isDef(options.maxResolution) ?
|
||||
options.maxResolution : ol.control.ZoomSlider.DEFAULT_MAX_RESOLUTION;
|
||||
|
||||
/**
|
||||
* The maximum resolution that one can set with this control.
|
||||
@@ -44,9 +43,8 @@ ol.control.ZoomSlider = function(zoomSliderOptions) {
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.minResolution_ = goog.isDef(zoomSliderOptions.minResolution) ?
|
||||
zoomSliderOptions.minResolution :
|
||||
ol.control.ZoomSlider.DEFAULT_MIN_RESOLUTION;
|
||||
this.minResolution_ = goog.isDef(options.minResolution) ?
|
||||
options.minResolution : ol.control.ZoomSlider.DEFAULT_MIN_RESOLUTION;
|
||||
|
||||
goog.asserts.assert(
|
||||
this.minResolution_ < this.maxResolution_,
|
||||
@@ -95,7 +93,7 @@ ol.control.ZoomSlider = function(zoomSliderOptions) {
|
||||
|
||||
goog.base(this, {
|
||||
element: elem,
|
||||
map: zoomSliderOptions.map
|
||||
map: options.map
|
||||
});
|
||||
};
|
||||
goog.inherits(ol.control.ZoomSlider, ol.control.Control);
|
||||
|
||||
@@ -256,7 +256,7 @@ goog.exportProperty(
|
||||
|
||||
|
||||
/**
|
||||
* @return {GeolocationPositionOptions|undefined} tracking options.
|
||||
* @return {GeolocationPositionOptions|undefined} Tracking options.
|
||||
*/
|
||||
ol.Geolocation.prototype.getTrackingOptions = function() {
|
||||
return /** @type {GeolocationPositionOptions} */ (
|
||||
|
||||
@@ -17,7 +17,7 @@ goog.require('ol.interaction.condition');
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.interaction.DefaultOptions=} opt_options Options.
|
||||
* @param {ol.interaction.DefaultsOptions=} opt_options Defaults options.
|
||||
* @param {Array.<ol.interaction.Interaction>=} opt_interactions Additional
|
||||
* interactions.
|
||||
* @return {ol.Collection} Interactions.
|
||||
|
||||
@@ -8,10 +8,10 @@ goog.require('ol.source.ImageSource');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.layer.Layer}
|
||||
* @param {ol.layer.LayerOptions} layerOptions Layer options.
|
||||
* @param {ol.layer.LayerOptions} options Layer options.
|
||||
*/
|
||||
ol.layer.ImageLayer = function(layerOptions) {
|
||||
goog.base(this, layerOptions);
|
||||
ol.layer.ImageLayer = function(options) {
|
||||
goog.base(this, options);
|
||||
};
|
||||
goog.inherits(ol.layer.ImageLayer, ol.layer.Layer);
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ ol.layer.LayerState;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Object}
|
||||
* @param {ol.layer.LayerOptions} layerOptions LayerOptions.
|
||||
* @param {ol.layer.LayerOptions} options Layer options.
|
||||
*/
|
||||
ol.layer.Layer = function(layerOptions) {
|
||||
ol.layer.Layer = function(options) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
@@ -48,20 +48,14 @@ ol.layer.Layer = function(layerOptions) {
|
||||
* @private
|
||||
* @type {ol.source.Source}
|
||||
*/
|
||||
this.source_ = layerOptions.source;
|
||||
this.source_ = options.source;
|
||||
|
||||
this.setBrightness(
|
||||
goog.isDef(layerOptions.brightness) ? layerOptions.brightness : 0);
|
||||
this.setContrast(
|
||||
goog.isDef(layerOptions.contrast) ? layerOptions.contrast : 1);
|
||||
this.setHue(
|
||||
goog.isDef(layerOptions.hue) ? layerOptions.hue : 0);
|
||||
this.setOpacity(
|
||||
goog.isDef(layerOptions.opacity) ? layerOptions.opacity : 1);
|
||||
this.setSaturation(
|
||||
goog.isDef(layerOptions.saturation) ? layerOptions.saturation : 1);
|
||||
this.setVisible(
|
||||
goog.isDef(layerOptions.visible) ? layerOptions.visible : true);
|
||||
this.setBrightness(goog.isDef(options.brightness) ? options.brightness : 0);
|
||||
this.setContrast(goog.isDef(options.contrast) ? options.contrast : 1);
|
||||
this.setHue(goog.isDef(options.hue) ? options.hue : 0);
|
||||
this.setOpacity(goog.isDef(options.opacity) ? options.opacity : 1);
|
||||
this.setSaturation(goog.isDef(options.saturation) ? options.saturation : 1);
|
||||
this.setVisible(goog.isDef(options.visible) ? options.visible : true);
|
||||
|
||||
if (!this.source_.isReady()) {
|
||||
goog.events.listenOnce(this.source_, goog.events.EventType.LOAD,
|
||||
|
||||
@@ -16,7 +16,7 @@ ol.layer.TileLayerProperty = {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.layer.Layer}
|
||||
* @param {ol.layer.TileLayerOptions} options Options.
|
||||
* @param {ol.layer.TileLayerOptions} options Tile layer options.
|
||||
*/
|
||||
ol.layer.TileLayer = function(options) {
|
||||
|
||||
|
||||
@@ -155,21 +155,21 @@ ol.layer.FeatureCache.prototype.getFeaturesByIds_ = function(ids) {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.layer.Layer}
|
||||
* @param {ol.layer.VectorLayerOptions} layerOptions Layer options.
|
||||
* @param {ol.layer.VectorLayerOptions} options Vector layer options.
|
||||
*/
|
||||
ol.layer.Vector = function(layerOptions) {
|
||||
ol.layer.Vector = function(options) {
|
||||
|
||||
goog.base(this, {
|
||||
opacity: layerOptions.opacity,
|
||||
source: layerOptions.source,
|
||||
visible: layerOptions.visible
|
||||
opacity: options.opacity,
|
||||
source: options.source,
|
||||
visible: options.visible
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.style.Style}
|
||||
*/
|
||||
this.style_ = goog.isDef(layerOptions.style) ? layerOptions.style : null;
|
||||
this.style_ = goog.isDef(options.style) ? options.style : null;
|
||||
|
||||
/**
|
||||
* @type {ol.layer.FeatureCache}
|
||||
|
||||
@@ -150,13 +150,13 @@ ol.MapProperty = {
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.Object}
|
||||
* @param {ol.MapOptions} mapOptions Map options.
|
||||
* @param {ol.MapOptions} options Map options.
|
||||
*/
|
||||
ol.Map = function(mapOptions) {
|
||||
ol.Map = function(options) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
var mapOptionsInternal = ol.Map.createOptionsInternal(mapOptions);
|
||||
var optionsInternal = ol.Map.createOptionsInternal(options);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -200,7 +200,7 @@ ol.Map = function(mapOptions) {
|
||||
* @private
|
||||
* @type {Element}
|
||||
*/
|
||||
this.target_ = mapOptionsInternal.target;
|
||||
this.target_ = optionsInternal.target;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -257,14 +257,14 @@ ol.Map = function(mapOptions) {
|
||||
* @type {ol.Collection}
|
||||
* @private
|
||||
*/
|
||||
this.interactions_ = mapOptionsInternal.interactions;
|
||||
this.interactions_ = optionsInternal.interactions;
|
||||
|
||||
/**
|
||||
* @type {ol.renderer.Map}
|
||||
* @private
|
||||
*/
|
||||
this.renderer_ =
|
||||
new mapOptionsInternal.rendererConstructor(this.viewport_, this);
|
||||
new optionsInternal.rendererConstructor(this.viewport_, this);
|
||||
this.registerDisposable(this.renderer_);
|
||||
|
||||
/**
|
||||
@@ -315,13 +315,13 @@ ol.Map = function(mapOptions) {
|
||||
goog.events.listen(
|
||||
this, ol.Object.getChangedEventType(ol.MapProperty.BACKGROUND_COLOR),
|
||||
this.handleBackgroundColorChanged_, false, this);
|
||||
this.setValues(mapOptionsInternal.values);
|
||||
this.setValues(optionsInternal.values);
|
||||
|
||||
// this gives the map an initial size
|
||||
this.handleBrowserWindowResize();
|
||||
|
||||
if (goog.isDef(mapOptionsInternal.controls)) {
|
||||
goog.array.forEach(mapOptionsInternal.controls,
|
||||
if (goog.isDef(optionsInternal.controls)) {
|
||||
goog.array.forEach(optionsInternal.controls,
|
||||
/**
|
||||
* @param {ol.control.Control} control Control.
|
||||
*/
|
||||
@@ -896,10 +896,10 @@ ol.MapOptionsInternal;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.MapOptions} mapOptions Map options.
|
||||
* @return {ol.MapOptionsInternal} Map options.
|
||||
* @param {ol.MapOptions} options Map options.
|
||||
* @return {ol.MapOptionsInternal} Internal map options.
|
||||
*/
|
||||
ol.Map.createOptionsInternal = function(mapOptions) {
|
||||
ol.Map.createOptionsInternal = function(options) {
|
||||
|
||||
/**
|
||||
* @type {Object.<string, *>}
|
||||
@@ -907,20 +907,20 @@ ol.Map.createOptionsInternal = function(mapOptions) {
|
||||
var values = {};
|
||||
|
||||
var layers;
|
||||
if (goog.isDef(mapOptions.layers)) {
|
||||
if (goog.isArray(mapOptions.layers)) {
|
||||
layers = new ol.Collection(goog.array.clone(mapOptions.layers));
|
||||
if (goog.isDef(options.layers)) {
|
||||
if (goog.isArray(options.layers)) {
|
||||
layers = new ol.Collection(goog.array.clone(options.layers));
|
||||
} else {
|
||||
goog.asserts.assert(mapOptions.layers instanceof ol.Collection);
|
||||
layers = mapOptions.layers;
|
||||
goog.asserts.assert(options.layers instanceof ol.Collection);
|
||||
layers = options.layers;
|
||||
}
|
||||
} else {
|
||||
layers = new ol.Collection();
|
||||
}
|
||||
values[ol.MapProperty.LAYERS] = layers;
|
||||
|
||||
values[ol.MapProperty.VIEW] = goog.isDef(mapOptions.view) ?
|
||||
mapOptions.view : new ol.View2D();
|
||||
values[ol.MapProperty.VIEW] = goog.isDef(options.view) ?
|
||||
options.view : new ol.View2D();
|
||||
|
||||
/**
|
||||
* @type {function(new: ol.renderer.Map, Element, ol.Map)}
|
||||
@@ -931,10 +931,10 @@ ol.Map.createOptionsInternal = function(mapOptions) {
|
||||
* @type {Array.<ol.RendererHint>}
|
||||
*/
|
||||
var rendererHints;
|
||||
if (goog.isDef(mapOptions.renderers)) {
|
||||
rendererHints = mapOptions.renderers;
|
||||
} else if (goog.isDef(mapOptions.renderer)) {
|
||||
rendererHints = [mapOptions.renderer];
|
||||
if (goog.isDef(options.renderers)) {
|
||||
rendererHints = options.renderers;
|
||||
} else if (goog.isDef(options.renderer)) {
|
||||
rendererHints = [options.renderer];
|
||||
} else {
|
||||
rendererHints = ol.DEFAULT_RENDERER_HINTS;
|
||||
}
|
||||
@@ -960,16 +960,16 @@ ol.Map.createOptionsInternal = function(mapOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
var controls = goog.isDef(mapOptions.controls) ?
|
||||
mapOptions.controls : ol.control.defaults();
|
||||
var controls = goog.isDef(options.controls) ?
|
||||
options.controls : ol.control.defaults();
|
||||
|
||||
var interactions = goog.isDef(mapOptions.interactions) ?
|
||||
mapOptions.interactions : ol.interaction.defaults();
|
||||
var interactions = goog.isDef(options.interactions) ?
|
||||
options.interactions : ol.interaction.defaults();
|
||||
|
||||
/**
|
||||
* @type {Element}
|
||||
*/
|
||||
var target = goog.dom.getElement(mapOptions.target);
|
||||
var target = goog.dom.getElement(options.target);
|
||||
|
||||
return {
|
||||
controls: controls,
|
||||
|
||||
@@ -39,7 +39,7 @@ ol.OverlayPositioning = {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Object}
|
||||
* @param {ol.OverlayOptions} options Options.
|
||||
* @param {ol.OverlayOptions} options Overlay options.
|
||||
*/
|
||||
ol.Overlay = function(options) {
|
||||
|
||||
|
||||
@@ -6,21 +6,21 @@ goog.require('ol.parser.ogc.ExceptionReport');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} formatOptions Options which will be set on this object.
|
||||
* @param {Object=} opt_options Options which will be set on this object.
|
||||
*/
|
||||
ol.parser.ogc.Versioned = function(formatOptions) {
|
||||
formatOptions = formatOptions || {};
|
||||
this.options = formatOptions;
|
||||
this.defaultVersion = formatOptions.defaultVersion || null;
|
||||
this.version = formatOptions.version;
|
||||
this.profile = formatOptions.profile;
|
||||
if (formatOptions.allowFallback !== undefined) {
|
||||
this.allowFallback = formatOptions.allowFallback;
|
||||
ol.parser.ogc.Versioned = function(opt_options) {
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
this.options = options;
|
||||
this.defaultVersion = options.defaultVersion || null;
|
||||
this.version = options.version;
|
||||
this.profile = options.profile;
|
||||
if (options.allowFallback !== undefined) {
|
||||
this.allowFallback = options.allowFallback;
|
||||
} else {
|
||||
this.allowFallback = false;
|
||||
}
|
||||
if (formatOptions.stringifyOutput !== undefined) {
|
||||
this.stringifyOutput = formatOptions.stringifyOutput;
|
||||
if (options.stringifyOutput !== undefined) {
|
||||
this.stringifyOutput = options.stringifyOutput;
|
||||
} else {
|
||||
this.stringifyOutput = false;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {ol.ProjectionOptions} options Options object.
|
||||
* @param {ol.ProjectionOptions} options Projection options.
|
||||
*/
|
||||
ol.Projection = function(options) {
|
||||
|
||||
@@ -175,7 +175,7 @@ ol.Projection.prototype.setDefaultTileGrid = function(tileGrid) {
|
||||
* @constructor
|
||||
* @extends {ol.Projection}
|
||||
* @param {Proj4js.Proj} proj4jsProj Proj4js projection.
|
||||
* @param {ol.Proj4jsProjectionOptions} options Projection config options.
|
||||
* @param {ol.Proj4jsProjectionOptions} options Proj4js projection options.
|
||||
* @private
|
||||
*/
|
||||
ol.Proj4jsProjection_ = function(proj4jsProj, options) {
|
||||
@@ -454,7 +454,7 @@ ol.projection.get = function(projectionLike) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Proj4jsProjectionOptions} options Projection config options.
|
||||
* @param {ol.Proj4jsProjectionOptions} options Proj4js projection options.
|
||||
* @private
|
||||
* @return {ol.Proj4jsProjection_} Proj4js projection.
|
||||
*/
|
||||
@@ -669,7 +669,7 @@ ol.projection.transformWithProjections =
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Proj4jsProjectionOptions} options Projection config options.
|
||||
* @param {ol.Proj4jsProjectionOptions} options Proj4js projection options.
|
||||
* @return {ol.Proj4jsProjection_} Proj4js projection.
|
||||
*/
|
||||
ol.projection.configureProj4jsProjection = function(options) {
|
||||
|
||||
@@ -20,9 +20,9 @@ goog.require('ol.tilegrid.XYZ');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.ImageTileSource}
|
||||
* @param {ol.source.BingMapsOptions} bingMapsOptions Bing Maps options.
|
||||
* @param {ol.source.BingMapsOptions} options Bing Maps options.
|
||||
*/
|
||||
ol.source.BingMaps = function(bingMapsOptions) {
|
||||
ol.source.BingMaps = function(options) {
|
||||
|
||||
goog.base(this, {
|
||||
crossOrigin: 'anonymous',
|
||||
@@ -34,8 +34,7 @@ ol.source.BingMaps = function(bingMapsOptions) {
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
this.culture_ = goog.isDef(bingMapsOptions.culture) ?
|
||||
bingMapsOptions.culture : 'en-us';
|
||||
this.culture_ = goog.isDef(options.culture) ? options.culture : 'en-us';
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -44,12 +43,11 @@ ol.source.BingMaps = function(bingMapsOptions) {
|
||||
this.ready_ = false;
|
||||
|
||||
var uri = new goog.Uri(
|
||||
'//dev.virtualearth.net/REST/v1/Imagery/Metadata/' +
|
||||
bingMapsOptions.style);
|
||||
'//dev.virtualearth.net/REST/v1/Imagery/Metadata/' + options.style);
|
||||
var jsonp = new goog.net.Jsonp(uri, 'jsonp');
|
||||
jsonp.send({
|
||||
'include': 'ImageryProviders',
|
||||
'key': bingMapsOptions.key
|
||||
'key': options.key
|
||||
}, goog.bind(this.handleImageryMetadataResponse, this));
|
||||
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ ol.DebugTile_.prototype.getImage = function(opt_context) {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.TileSource}
|
||||
* @param {ol.source.DebugTileSourceOptions} options Options.
|
||||
* @param {ol.source.DebugTileSourceOptions} options Debug tile options.
|
||||
*/
|
||||
ol.source.DebugTileSource = function(options) {
|
||||
|
||||
|
||||
@@ -30,8 +30,7 @@ ol.source.ImageSourceOptions;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.Source}
|
||||
* @param {ol.source.ImageSourceOptions} options Single
|
||||
* image source options.
|
||||
* @param {ol.source.ImageSourceOptions} options Single image source options.
|
||||
*/
|
||||
ol.source.ImageSource = function(options) {
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
goog.provide('ol.source.ImageTileSource');
|
||||
goog.provide('ol.source.ImageTileSourceOptions');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.Attribution');
|
||||
@@ -26,14 +25,14 @@ goog.require('ol.tilegrid.TileGrid');
|
||||
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
||||
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
|
||||
*/
|
||||
ol.source.ImageTileSourceOptions;
|
||||
ol.source.ImageTileOptions;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.TileSource}
|
||||
* @param {ol.source.ImageTileSourceOptions} options Options.
|
||||
* @param {ol.source.ImageTileOptions} options Image tile options.
|
||||
*/
|
||||
ol.source.ImageTileSource = function(options) {
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ goog.require('ol.projection');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {goog.events.EventTarget}
|
||||
* @param {ol.source.SourceOptions} sourceOptions Source options.
|
||||
* @param {ol.source.SourceOptions} options Source options.
|
||||
*/
|
||||
ol.source.Source = function(sourceOptions) {
|
||||
ol.source.Source = function(options) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
@@ -22,28 +22,28 @@ ol.source.Source = function(sourceOptions) {
|
||||
* @private
|
||||
* @type {ol.Projection}
|
||||
*/
|
||||
this.projection_ = ol.projection.get(sourceOptions.projection);
|
||||
this.projection_ = ol.projection.get(options.projection);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Extent}
|
||||
*/
|
||||
this.extent_ = goog.isDef(sourceOptions.extent) ?
|
||||
sourceOptions.extent : goog.isDef(sourceOptions.projection) ?
|
||||
this.extent_ = goog.isDef(options.extent) ?
|
||||
options.extent : goog.isDef(options.projection) ?
|
||||
this.projection_.getExtent() : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<ol.Attribution>}
|
||||
*/
|
||||
this.attributions_ = goog.isDef(sourceOptions.attributions) ?
|
||||
sourceOptions.attributions : null;
|
||||
this.attributions_ = goog.isDef(options.attributions) ?
|
||||
options.attributions : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.logo_ = sourceOptions.logo;
|
||||
this.logo_ = options.logo;
|
||||
|
||||
};
|
||||
goog.inherits(ol.source.Source, goog.events.EventTarget);
|
||||
|
||||
@@ -89,7 +89,7 @@ ol.source.STAMEN_ATTRIBUTIONS = [new ol.Attribution(
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.XYZ}
|
||||
* @param {ol.source.StamenOptions} options Options.
|
||||
* @param {ol.source.StamenOptions} options Stamen options.
|
||||
*/
|
||||
ol.source.Stamen = function(options) {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ goog.require('ol.source.ImageSource');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.ImageSource}
|
||||
* @param {ol.source.StaticImageOptions} options Options.
|
||||
* @param {ol.source.StaticImageOptions} options Static image options.
|
||||
*/
|
||||
ol.source.StaticImage = function(options) {
|
||||
|
||||
|
||||
@@ -15,32 +15,32 @@ goog.require('ol.source.wms');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.ImageTileSource}
|
||||
* @param {ol.source.TiledWMSOptions} tiledWMSOptions options.
|
||||
* @param {ol.source.TiledWMSOptions} options Tiled WMS options.
|
||||
*/
|
||||
ol.source.TiledWMS = function(tiledWMSOptions) {
|
||||
ol.source.TiledWMS = function(options) {
|
||||
var tileGrid;
|
||||
if (goog.isDef(tiledWMSOptions.tileGrid)) {
|
||||
tileGrid = tiledWMSOptions.tileGrid;
|
||||
if (goog.isDef(options.tileGrid)) {
|
||||
tileGrid = options.tileGrid;
|
||||
}
|
||||
|
||||
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
||||
var urls = tiledWMSOptions.urls;
|
||||
if (!goog.isDef(urls) && goog.isDef(tiledWMSOptions.url)) {
|
||||
urls = ol.TileUrlFunction.expandUrl(tiledWMSOptions.url);
|
||||
var urls = options.urls;
|
||||
if (!goog.isDef(urls) && goog.isDef(options.url)) {
|
||||
urls = ol.TileUrlFunction.expandUrl(options.url);
|
||||
}
|
||||
if (goog.isDef(urls)) {
|
||||
var tileUrlFunctions = goog.array.map(
|
||||
urls, function(url) {
|
||||
return ol.TileUrlFunction.createFromParamsFunction(
|
||||
url, tiledWMSOptions.params, ol.source.wms.getUrl);
|
||||
url, options.params, ol.source.wms.getUrl);
|
||||
});
|
||||
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
||||
tileUrlFunctions);
|
||||
}
|
||||
|
||||
var transparent = goog.isDef(tiledWMSOptions.params['TRANSPARENT']) ?
|
||||
tiledWMSOptions.params['TRANSPARENT'] : true;
|
||||
var extent = tiledWMSOptions.extent;
|
||||
var transparent = goog.isDef(options.params['TRANSPARENT']) ?
|
||||
options.params['TRANSPARENT'] : true;
|
||||
var extent = options.extent;
|
||||
|
||||
var tileCoordTransform = function(tileCoord, projection) {
|
||||
var tileGrid = this.getTileGrid();
|
||||
@@ -72,12 +72,12 @@ ol.source.TiledWMS = function(tiledWMSOptions) {
|
||||
};
|
||||
|
||||
goog.base(this, {
|
||||
attributions: tiledWMSOptions.attributions,
|
||||
crossOrigin: tiledWMSOptions.crossOrigin,
|
||||
attributions: options.attributions,
|
||||
crossOrigin: options.crossOrigin,
|
||||
extent: extent,
|
||||
tileGrid: tiledWMSOptions.tileGrid,
|
||||
tileGrid: options.tileGrid,
|
||||
opaque: !transparent,
|
||||
projection: tiledWMSOptions.projection,
|
||||
projection: options.projection,
|
||||
tileUrlFunction: ol.TileUrlFunction.withTileCoordTransform(
|
||||
tileCoordTransform, tileUrlFunction)
|
||||
});
|
||||
|
||||
@@ -42,12 +42,12 @@ goog.exportSymbol('grid', grid);
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.ImageTileSource}
|
||||
* @param {ol.source.TileJSONOptions} tileJsonOptions TileJSON optios.
|
||||
* @param {ol.source.TileJSONOptions} options TileJSON options.
|
||||
*/
|
||||
ol.source.TileJSON = function(tileJsonOptions) {
|
||||
ol.source.TileJSON = function(options) {
|
||||
|
||||
goog.base(this, {
|
||||
crossOrigin: tileJsonOptions.crossOrigin,
|
||||
crossOrigin: options.crossOrigin,
|
||||
projection: ol.projection.get('EPSG:3857')
|
||||
});
|
||||
|
||||
@@ -61,8 +61,7 @@ ol.source.TileJSON = function(tileJsonOptions) {
|
||||
* @private
|
||||
* @type {!goog.async.Deferred}
|
||||
*/
|
||||
this.deferred_ =
|
||||
goog.net.jsloader.load(tileJsonOptions.url, {cleanupWhenDone: true});
|
||||
this.deferred_ = goog.net.jsloader.load(options.url, {cleanupWhenDone: true});
|
||||
this.deferred_.addCallback(this.handleTileJSONResponse, this);
|
||||
|
||||
};
|
||||
|
||||
@@ -26,30 +26,28 @@ ol.source.TileSourceOptions;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.Source}
|
||||
* @param {ol.source.TileSourceOptions} tileSourceOptions Tile source options.
|
||||
* @param {ol.source.TileSourceOptions} options Tile source options.
|
||||
*/
|
||||
ol.source.TileSource = function(tileSourceOptions) {
|
||||
ol.source.TileSource = function(options) {
|
||||
|
||||
goog.base(this, {
|
||||
attributions: tileSourceOptions.attributions,
|
||||
extent: tileSourceOptions.extent,
|
||||
logo: tileSourceOptions.logo,
|
||||
projection: tileSourceOptions.projection
|
||||
attributions: options.attributions,
|
||||
extent: options.extent,
|
||||
logo: options.logo,
|
||||
projection: options.projection
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.opaque_ = goog.isDef(tileSourceOptions.opaque) ?
|
||||
tileSourceOptions.opaque : false;
|
||||
this.opaque_ = goog.isDef(options.opaque) ? options.opaque : false;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {ol.tilegrid.TileGrid}
|
||||
*/
|
||||
this.tileGrid = goog.isDef(tileSourceOptions.tileGrid) ?
|
||||
tileSourceOptions.tileGrid : null;
|
||||
this.tileGrid = goog.isDef(options.tileGrid) ? options.tileGrid : null;
|
||||
|
||||
};
|
||||
goog.inherits(ol.source.TileSource, ol.source.Source);
|
||||
|
||||
@@ -27,32 +27,30 @@ ol.source.WMTSRequestEncoding = {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.ImageTileSource}
|
||||
* @param {ol.source.WMTSOptions} wmtsOptions WMTS options.
|
||||
* @param {ol.source.WMTSOptions} options WMTS options.
|
||||
*/
|
||||
ol.source.WMTS = function(wmtsOptions) {
|
||||
ol.source.WMTS = function(options) {
|
||||
|
||||
// TODO: add support for TileMatrixLimits
|
||||
|
||||
var version = goog.isDef(wmtsOptions.version) ?
|
||||
wmtsOptions.version : '1.0.0';
|
||||
var format = goog.isDef(wmtsOptions.format) ?
|
||||
wmtsOptions.format : 'image/jpeg';
|
||||
var dimensions = wmtsOptions.dimensions || {};
|
||||
var version = goog.isDef(options.version) ? options.version : '1.0.0';
|
||||
var format = goog.isDef(options.format) ? options.format : 'image/jpeg';
|
||||
var dimensions = options.dimensions || {};
|
||||
|
||||
// FIXME: should we guess this requestEncoding from wmtsOptions.url(s)
|
||||
// FIXME: should we guess this requestEncoding from options.url(s)
|
||||
// structure? that would mean KVP only if a template is not provided.
|
||||
var requestEncoding = goog.isDef(wmtsOptions.requestEncoding) ?
|
||||
wmtsOptions.requestEncoding : ol.source.WMTSRequestEncoding.KVP;
|
||||
var requestEncoding = goog.isDef(options.requestEncoding) ?
|
||||
options.requestEncoding : ol.source.WMTSRequestEncoding.KVP;
|
||||
|
||||
// FIXME: should we create a default tileGrid?
|
||||
// we could issue a getCapabilities xhr to retrieve missing configuration
|
||||
var tileGrid = wmtsOptions.tileGrid;
|
||||
var tileGrid = options.tileGrid;
|
||||
|
||||
var context = {
|
||||
'Layer': wmtsOptions.layer,
|
||||
'style': wmtsOptions.style,
|
||||
'Style': wmtsOptions.style,
|
||||
'TileMatrixSet': wmtsOptions.matrixSet
|
||||
'Layer': options.layer,
|
||||
'style': options.style,
|
||||
'Style': options.style,
|
||||
'TileMatrixSet': options.matrixSet
|
||||
};
|
||||
goog.object.extend(context, dimensions);
|
||||
var kvpParams;
|
||||
@@ -98,9 +96,9 @@ ol.source.WMTS = function(wmtsOptions) {
|
||||
}
|
||||
|
||||
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
||||
var urls = wmtsOptions.urls;
|
||||
if (!goog.isDef(urls) && goog.isDef(wmtsOptions.url)) {
|
||||
urls = ol.TileUrlFunction.expandUrl(wmtsOptions.url);
|
||||
var urls = options.urls;
|
||||
if (!goog.isDef(urls) && goog.isDef(options.url)) {
|
||||
urls = ol.TileUrlFunction.expandUrl(options.url);
|
||||
}
|
||||
if (goog.isDef(urls)) {
|
||||
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
||||
@@ -126,8 +124,8 @@ ol.source.WMTS = function(wmtsOptions) {
|
||||
var y = -tileCoord.y - 1;
|
||||
var tileExtent = tileGrid.getTileCoordExtent(tileCoord);
|
||||
var projectionExtent = projection.getExtent();
|
||||
var extent = goog.isDef(wmtsOptions.extent) ?
|
||||
wmtsOptions.extent : projectionExtent;
|
||||
var extent = goog.isDef(options.extent) ?
|
||||
options.extent : projectionExtent;
|
||||
|
||||
if (!goog.isNull(extent) && projection.isGlobal() &&
|
||||
extent.minX === projectionExtent.minX &&
|
||||
@@ -147,10 +145,10 @@ ol.source.WMTS = function(wmtsOptions) {
|
||||
tileUrlFunction);
|
||||
|
||||
goog.base(this, {
|
||||
attributions: wmtsOptions.attributions,
|
||||
crossOrigin: wmtsOptions.crossOrigin,
|
||||
extent: wmtsOptions.extent,
|
||||
projection: wmtsOptions.projection,
|
||||
attributions: options.attributions,
|
||||
crossOrigin: options.crossOrigin,
|
||||
extent: options.extent,
|
||||
projection: options.projection,
|
||||
tileGrid: tileGrid,
|
||||
tileUrlFunction: tileUrlFunction
|
||||
});
|
||||
|
||||
@@ -33,38 +33,37 @@ ol.source.XYZOptions;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.ImageTileSource}
|
||||
* @param {ol.source.XYZOptions} xyzOptions XYZ options.
|
||||
* @param {ol.source.XYZOptions} options XYZ options.
|
||||
*/
|
||||
ol.source.XYZ = function(xyzOptions) {
|
||||
ol.source.XYZ = function(options) {
|
||||
|
||||
var projection = xyzOptions.projection ||
|
||||
ol.projection.get('EPSG:3857');
|
||||
var projection = options.projection || ol.projection.get('EPSG:3857');
|
||||
|
||||
/**
|
||||
* @type {ol.TileUrlFunctionType}
|
||||
*/
|
||||
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
||||
// FIXME use goog.nullFunction ?
|
||||
if (goog.isDef(xyzOptions.tileUrlFunction)) {
|
||||
tileUrlFunction = xyzOptions.tileUrlFunction;
|
||||
} else if (goog.isDef(xyzOptions.urls)) {
|
||||
tileUrlFunction = ol.TileUrlFunction.createFromTemplates(xyzOptions.urls);
|
||||
} else if (goog.isDef(xyzOptions.url)) {
|
||||
if (goog.isDef(options.tileUrlFunction)) {
|
||||
tileUrlFunction = options.tileUrlFunction;
|
||||
} else if (goog.isDef(options.urls)) {
|
||||
tileUrlFunction = ol.TileUrlFunction.createFromTemplates(options.urls);
|
||||
} else if (goog.isDef(options.url)) {
|
||||
tileUrlFunction = ol.TileUrlFunction.createFromTemplates(
|
||||
ol.TileUrlFunction.expandUrl(xyzOptions.url));
|
||||
ol.TileUrlFunction.expandUrl(options.url));
|
||||
}
|
||||
|
||||
var tileGrid = new ol.tilegrid.XYZ({
|
||||
maxZoom: xyzOptions.maxZoom
|
||||
maxZoom: options.maxZoom
|
||||
});
|
||||
|
||||
// FIXME factor out common code
|
||||
var extent = xyzOptions.extent;
|
||||
var extent = options.extent;
|
||||
if (goog.isDefAndNotNull(extent)) {
|
||||
|
||||
tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
|
||||
function(tileCoord) {
|
||||
if (xyzOptions.maxZoom < tileCoord.z) {
|
||||
if (options.maxZoom < tileCoord.z) {
|
||||
return null;
|
||||
}
|
||||
var n = 1 << tileCoord.z;
|
||||
@@ -87,7 +86,7 @@ ol.source.XYZ = function(xyzOptions) {
|
||||
|
||||
tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
|
||||
function(tileCoord) {
|
||||
if (xyzOptions.maxZoom < tileCoord.z) {
|
||||
if (options.maxZoom < tileCoord.z) {
|
||||
return null;
|
||||
}
|
||||
var n = 1 << tileCoord.z;
|
||||
@@ -103,10 +102,10 @@ ol.source.XYZ = function(xyzOptions) {
|
||||
}
|
||||
|
||||
goog.base(this, {
|
||||
attributions: xyzOptions.attributions,
|
||||
crossOrigin: xyzOptions.crossOrigin,
|
||||
extent: xyzOptions.extent,
|
||||
logo: xyzOptions.logo,
|
||||
attributions: options.attributions,
|
||||
crossOrigin: options.crossOrigin,
|
||||
extent: options.extent,
|
||||
logo: options.logo,
|
||||
projection: projection,
|
||||
tileGrid: tileGrid,
|
||||
tileUrlFunction: tileUrlFunction
|
||||
|
||||
@@ -23,24 +23,24 @@ ol.style.IconLiteralOptions;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.style.PointLiteral}
|
||||
* @param {ol.style.IconLiteralOptions} config Symbolizer properties.
|
||||
* @param {ol.style.IconLiteralOptions} options Icon literal options.
|
||||
*/
|
||||
ol.style.IconLiteral = function(config) {
|
||||
ol.style.IconLiteral = function(options) {
|
||||
|
||||
/** @type {string} */
|
||||
this.url = config.url;
|
||||
this.url = options.url;
|
||||
|
||||
/** @type {number|undefined} */
|
||||
this.width = config.width;
|
||||
this.width = options.width;
|
||||
|
||||
/** @type {number|undefined} */
|
||||
this.height = config.height;
|
||||
this.height = options.height;
|
||||
|
||||
/** @type {number} */
|
||||
this.opacity = config.opacity;
|
||||
this.opacity = options.opacity;
|
||||
|
||||
/** @type {number} */
|
||||
this.rotation = config.rotation;
|
||||
this.rotation = options.rotation;
|
||||
|
||||
};
|
||||
goog.inherits(ol.style.IconLiteral, ol.style.PointLiteral);
|
||||
@@ -62,7 +62,7 @@ ol.style.IconLiteral.prototype.equals = function(iconLiteral) {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.style.Point}
|
||||
* @param {ol.style.IconOptions} options Symbolizer properties.
|
||||
* @param {ol.style.IconOptions} options Icon options.
|
||||
*/
|
||||
ol.style.Icon = function(options) {
|
||||
|
||||
|
||||
@@ -20,22 +20,24 @@ ol.style.LineLiteralOptions;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.style.SymbolizerLiteral}
|
||||
* @param {ol.style.LineLiteralOptions} config Symbolizer properties.
|
||||
* @param {ol.style.LineLiteralOptions} options Line literal options.
|
||||
*/
|
||||
ol.style.LineLiteral = function(config) {
|
||||
ol.style.LineLiteral = function(options) {
|
||||
goog.base(this);
|
||||
|
||||
goog.asserts.assertString(config.strokeColor, 'strokeColor must be a string');
|
||||
goog.asserts.assertString(
|
||||
options.strokeColor, 'strokeColor must be a string');
|
||||
/** @type {string} */
|
||||
this.strokeColor = config.strokeColor;
|
||||
this.strokeColor = options.strokeColor;
|
||||
|
||||
goog.asserts.assertNumber(config.strokeWidth, 'strokeWidth must be a number');
|
||||
goog.asserts.assertNumber(
|
||||
options.strokeWidth, 'strokeWidth must be a number');
|
||||
/** @type {number} */
|
||||
this.strokeWidth = config.strokeWidth;
|
||||
this.strokeWidth = options.strokeWidth;
|
||||
|
||||
goog.asserts.assertNumber(config.opacity, 'opacity must be a number');
|
||||
goog.asserts.assertNumber(options.opacity, 'opacity must be a number');
|
||||
/** @type {number} */
|
||||
this.opacity = config.opacity;
|
||||
this.opacity = options.opacity;
|
||||
|
||||
};
|
||||
goog.inherits(ol.style.LineLiteral, ol.style.SymbolizerLiteral);
|
||||
@@ -55,7 +57,7 @@ ol.style.LineLiteral.prototype.equals = function(lineLiteral) {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.style.Symbolizer}
|
||||
* @param {ol.style.LineOptions} options Symbolizer properties.
|
||||
* @param {ol.style.LineOptions} options Line options.
|
||||
*/
|
||||
ol.style.Line = function(options) {
|
||||
goog.base(this);
|
||||
|
||||
@@ -21,26 +21,26 @@ ol.style.PolygonLiteralOptions;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.style.SymbolizerLiteral}
|
||||
* @param {ol.style.PolygonLiteralOptions} config Symbolizer properties.
|
||||
* @param {ol.style.PolygonLiteralOptions} options Polygon literal options.
|
||||
*/
|
||||
ol.style.PolygonLiteral = function(config) {
|
||||
ol.style.PolygonLiteral = function(options) {
|
||||
goog.base(this);
|
||||
|
||||
/** @type {string|undefined} */
|
||||
this.fillColor = config.fillColor;
|
||||
if (goog.isDef(config.fillColor)) {
|
||||
goog.asserts.assertString(config.fillColor, 'fillColor must be a string');
|
||||
this.fillColor = options.fillColor;
|
||||
if (goog.isDef(options.fillColor)) {
|
||||
goog.asserts.assertString(options.fillColor, 'fillColor must be a string');
|
||||
}
|
||||
|
||||
/** @type {string|undefined} */
|
||||
this.strokeColor = config.strokeColor;
|
||||
this.strokeColor = options.strokeColor;
|
||||
if (goog.isDef(this.strokeColor)) {
|
||||
goog.asserts.assertString(
|
||||
this.strokeColor, 'strokeColor must be a string');
|
||||
}
|
||||
|
||||
/** @type {number|undefined} */
|
||||
this.strokeWidth = config.strokeWidth;
|
||||
this.strokeWidth = options.strokeWidth;
|
||||
if (goog.isDef(this.strokeWidth)) {
|
||||
goog.asserts.assertNumber(
|
||||
this.strokeWidth, 'strokeWidth must be a number');
|
||||
@@ -51,9 +51,9 @@ ol.style.PolygonLiteral = function(config) {
|
||||
(goog.isDef(this.strokeColor) && goog.isDef(this.strokeWidth)),
|
||||
'Either fillColor or strokeColor and strokeWidth must be set');
|
||||
|
||||
goog.asserts.assertNumber(config.opacity, 'opacity must be a number');
|
||||
goog.asserts.assertNumber(options.opacity, 'opacity must be a number');
|
||||
/** @type {number} */
|
||||
this.opacity = config.opacity;
|
||||
this.opacity = options.opacity;
|
||||
|
||||
};
|
||||
goog.inherits(ol.style.PolygonLiteral, ol.style.SymbolizerLiteral);
|
||||
@@ -74,7 +74,7 @@ ol.style.PolygonLiteral.prototype.equals = function(polygonLiteral) {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.style.Symbolizer}
|
||||
* @param {ol.style.PolygonOptions} options Symbolizer properties.
|
||||
* @param {ol.style.PolygonOptions} options Polygon options.
|
||||
*/
|
||||
ol.style.Polygon = function(options) {
|
||||
goog.base(this);
|
||||
|
||||
@@ -32,33 +32,33 @@ ol.style.ShapeLiteralOptions;
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.style.PointLiteral}
|
||||
* @param {ol.style.ShapeLiteralOptions} config Symbolizer properties.
|
||||
* @param {ol.style.ShapeLiteralOptions} options Shape literal options.
|
||||
*/
|
||||
ol.style.ShapeLiteral = function(config) {
|
||||
ol.style.ShapeLiteral = function(options) {
|
||||
|
||||
goog.asserts.assertString(config.type, 'type must be a string');
|
||||
goog.asserts.assertString(options.type, 'type must be a string');
|
||||
/** @type {ol.style.ShapeType} */
|
||||
this.type = config.type;
|
||||
this.type = options.type;
|
||||
|
||||
goog.asserts.assertNumber(config.size, 'size must be a number');
|
||||
goog.asserts.assertNumber(options.size, 'size must be a number');
|
||||
/** @type {number} */
|
||||
this.size = config.size;
|
||||
this.size = options.size;
|
||||
|
||||
/** @type {string|undefined} */
|
||||
this.fillColor = config.fillColor;
|
||||
if (goog.isDef(config.fillColor)) {
|
||||
goog.asserts.assertString(config.fillColor, 'fillColor must be a string');
|
||||
this.fillColor = options.fillColor;
|
||||
if (goog.isDef(options.fillColor)) {
|
||||
goog.asserts.assertString(options.fillColor, 'fillColor must be a string');
|
||||
}
|
||||
|
||||
/** @type {string|undefined} */
|
||||
this.strokeColor = config.strokeColor;
|
||||
this.strokeColor = options.strokeColor;
|
||||
if (goog.isDef(this.strokeColor)) {
|
||||
goog.asserts.assertString(
|
||||
this.strokeColor, 'strokeColor must be a string');
|
||||
}
|
||||
|
||||
/** @type {number|undefined} */
|
||||
this.strokeWidth = config.strokeWidth;
|
||||
this.strokeWidth = options.strokeWidth;
|
||||
if (goog.isDef(this.strokeWidth)) {
|
||||
goog.asserts.assertNumber(
|
||||
this.strokeWidth, 'strokeWidth must be a number');
|
||||
@@ -69,9 +69,9 @@ ol.style.ShapeLiteral = function(config) {
|
||||
(goog.isDef(this.strokeColor) && goog.isDef(this.strokeWidth)),
|
||||
'Either fillColor or strokeColor and strokeWidth must be set');
|
||||
|
||||
goog.asserts.assertNumber(config.opacity, 'opacity must be a number');
|
||||
goog.asserts.assertNumber(options.opacity, 'opacity must be a number');
|
||||
/** @type {number} */
|
||||
this.opacity = config.opacity;
|
||||
this.opacity = options.opacity;
|
||||
|
||||
};
|
||||
goog.inherits(ol.style.ShapeLiteral, ol.style.PointLiteral);
|
||||
@@ -94,7 +94,7 @@ ol.style.ShapeLiteral.prototype.equals = function(shapeLiteral) {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.style.Point}
|
||||
* @param {ol.style.ShapeOptions} options Symbolizer properties.
|
||||
* @param {ol.style.ShapeOptions} options Shape options.
|
||||
*/
|
||||
ol.style.Shape = function(options) {
|
||||
|
||||
|
||||
@@ -29,15 +29,15 @@ ol.DEFAULT_MAX_ZOOM = 42;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {ol.tilegrid.TileGridOptions} tileGridOptions Tile grid options.
|
||||
* @param {ol.tilegrid.TileGridOptions} options Tile grid options.
|
||||
*/
|
||||
ol.tilegrid.TileGrid = function(tileGridOptions) {
|
||||
ol.tilegrid.TileGrid = function(options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Array.<number>}
|
||||
*/
|
||||
this.resolutions_ = tileGridOptions.resolutions;
|
||||
this.resolutions_ = options.resolutions;
|
||||
goog.asserts.assert(goog.array.isSorted(this.resolutions_, function(a, b) {
|
||||
return b - a;
|
||||
}, true));
|
||||
@@ -52,16 +52,15 @@ ol.tilegrid.TileGrid = function(tileGridOptions) {
|
||||
* @private
|
||||
* @type {ol.Coordinate}
|
||||
*/
|
||||
this.origin_ = goog.isDef(tileGridOptions.origin) ?
|
||||
tileGridOptions.origin : null;
|
||||
this.origin_ = goog.isDef(options.origin) ? options.origin : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<ol.Coordinate>}
|
||||
*/
|
||||
this.origins_ = null;
|
||||
if (goog.isDef(tileGridOptions.origins)) {
|
||||
this.origins_ = tileGridOptions.origins;
|
||||
if (goog.isDef(options.origins)) {
|
||||
this.origins_ = options.origins;
|
||||
goog.asserts.assert(this.origins_.length == this.resolutions_.length);
|
||||
}
|
||||
goog.asserts.assert(
|
||||
@@ -73,8 +72,8 @@ ol.tilegrid.TileGrid = function(tileGridOptions) {
|
||||
* @type {Array.<ol.Size>}
|
||||
*/
|
||||
this.tileSizes_ = null;
|
||||
if (goog.isDef(tileGridOptions.tileSizes)) {
|
||||
this.tileSizes_ = tileGridOptions.tileSizes;
|
||||
if (goog.isDef(options.tileSizes)) {
|
||||
this.tileSizes_ = options.tileSizes;
|
||||
goog.asserts.assert(this.tileSizes_.length == this.resolutions_.length);
|
||||
}
|
||||
|
||||
@@ -82,8 +81,8 @@ ol.tilegrid.TileGrid = function(tileGridOptions) {
|
||||
* @private
|
||||
* @type {ol.Size}
|
||||
*/
|
||||
this.tileSize_ = goog.isDef(tileGridOptions.tileSize) ?
|
||||
tileGridOptions.tileSize :
|
||||
this.tileSize_ = goog.isDef(options.tileSize) ?
|
||||
options.tileSize :
|
||||
goog.isNull(this.tileSizes_) ?
|
||||
new ol.Size(ol.DEFAULT_TILE_SIZE, ol.DEFAULT_TILE_SIZE) : null;
|
||||
goog.asserts.assert(
|
||||
|
||||
@@ -11,26 +11,26 @@ goog.require('ol.tilegrid.TileGrid');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.tilegrid.TileGrid}
|
||||
* @param {ol.tilegrid.WMTSOptions} wmtsOptions WMTS options.
|
||||
* @param {ol.tilegrid.WMTSOptions} options WMTS options.
|
||||
*/
|
||||
ol.tilegrid.WMTS = function(wmtsOptions) {
|
||||
ol.tilegrid.WMTS = function(options) {
|
||||
|
||||
goog.asserts.assert(
|
||||
wmtsOptions.resolutions.length == wmtsOptions.matrixIds.length);
|
||||
options.resolutions.length == options.matrixIds.length);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Array.<string>}
|
||||
*/
|
||||
this.matrixIds_ = wmtsOptions.matrixIds;
|
||||
this.matrixIds_ = options.matrixIds;
|
||||
// FIXME: should the matrixIds become optionnal?
|
||||
|
||||
goog.base(this, {
|
||||
origin: wmtsOptions.origin,
|
||||
origins: wmtsOptions.origins,
|
||||
resolutions: wmtsOptions.resolutions,
|
||||
tileSize: wmtsOptions.tileSize,
|
||||
tileSizes: wmtsOptions.tileSizes
|
||||
origin: options.origin,
|
||||
origins: options.origins,
|
||||
resolutions: options.resolutions,
|
||||
tileSize: options.tileSize,
|
||||
tileSizes: options.tileSizes
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@@ -11,14 +11,14 @@ goog.require('ol.tilegrid.TileGrid');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.tilegrid.TileGrid}
|
||||
* @param {ol.tilegrid.XYZOptions} xyzOptions XYZ options.
|
||||
* @param {ol.tilegrid.XYZOptions} options XYZ options.
|
||||
*/
|
||||
ol.tilegrid.XYZ = function(xyzOptions) {
|
||||
ol.tilegrid.XYZ = function(options) {
|
||||
|
||||
var resolutions = new Array(xyzOptions.maxZoom + 1);
|
||||
var resolutions = new Array(options.maxZoom + 1);
|
||||
var z;
|
||||
var size = 2 * ol.projection.EPSG3857.HALF_SIZE / ol.DEFAULT_TILE_SIZE;
|
||||
for (z = 0; z <= xyzOptions.maxZoom; ++z) {
|
||||
for (z = 0; z <= options.maxZoom; ++z) {
|
||||
resolutions[z] = size / Math.pow(2, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,38 +37,38 @@ ol.View2DProperty = {
|
||||
* @implements {ol.IView2D}
|
||||
* @implements {ol.IView3D}
|
||||
* @extends {ol.View}
|
||||
* @param {ol.View2DOptions=} opt_view2DOptions View2D options.
|
||||
* @param {ol.View2DOptions=} opt_options View2D options.
|
||||
*/
|
||||
ol.View2D = function(opt_view2DOptions) {
|
||||
ol.View2D = function(opt_options) {
|
||||
goog.base(this);
|
||||
var view2DOptions = opt_view2DOptions || {};
|
||||
var options = opt_options || {};
|
||||
|
||||
/**
|
||||
* @type {Object.<string, *>}
|
||||
*/
|
||||
var values = {};
|
||||
values[ol.View2DProperty.CENTER] = goog.isDef(view2DOptions.center) ?
|
||||
view2DOptions.center : null;
|
||||
values[ol.View2DProperty.CENTER] = goog.isDef(options.center) ?
|
||||
options.center : null;
|
||||
values[ol.View2DProperty.PROJECTION] = ol.projection.createProjection(
|
||||
view2DOptions.projection, 'EPSG:3857');
|
||||
if (goog.isDef(view2DOptions.resolution)) {
|
||||
values[ol.View2DProperty.RESOLUTION] = view2DOptions.resolution;
|
||||
} else if (goog.isDef(view2DOptions.zoom)) {
|
||||
options.projection, 'EPSG:3857');
|
||||
if (goog.isDef(options.resolution)) {
|
||||
values[ol.View2DProperty.RESOLUTION] = options.resolution;
|
||||
} else if (goog.isDef(options.zoom)) {
|
||||
var projectionExtent = values[ol.View2DProperty.PROJECTION].getExtent();
|
||||
var size = Math.max(
|
||||
projectionExtent.maxX - projectionExtent.minX,
|
||||
projectionExtent.maxY - projectionExtent.minY);
|
||||
values[ol.View2DProperty.RESOLUTION] =
|
||||
size / (ol.DEFAULT_TILE_SIZE * Math.pow(2, view2DOptions.zoom));
|
||||
size / (ol.DEFAULT_TILE_SIZE * Math.pow(2, options.zoom));
|
||||
}
|
||||
values[ol.View2DProperty.ROTATION] = view2DOptions.rotation;
|
||||
values[ol.View2DProperty.ROTATION] = options.rotation;
|
||||
this.setValues(values);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Constraints}
|
||||
*/
|
||||
this.constraints_ = ol.View2D.createConstraints_(view2DOptions);
|
||||
this.constraints_ = ol.View2D.createConstraints_(options);
|
||||
|
||||
};
|
||||
goog.inherits(ol.View2D, ol.View);
|
||||
@@ -419,25 +419,25 @@ ol.View2D.prototype.zoomWithoutConstraints =
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.View2DOptions} view2DOptions View2D options.
|
||||
* @param {ol.View2DOptions} options View2D options.
|
||||
* @return {ol.Constraints} Constraints.
|
||||
*/
|
||||
ol.View2D.createConstraints_ = function(view2DOptions) {
|
||||
ol.View2D.createConstraints_ = function(options) {
|
||||
var resolutionConstraint;
|
||||
if (goog.isDef(view2DOptions.resolutions)) {
|
||||
if (goog.isDef(options.resolutions)) {
|
||||
resolutionConstraint = ol.ResolutionConstraint.createSnapToResolutions(
|
||||
view2DOptions.resolutions);
|
||||
options.resolutions);
|
||||
} else {
|
||||
var maxResolution, numZoomLevels, zoomFactor;
|
||||
if (goog.isDef(view2DOptions.maxResolution) &&
|
||||
goog.isDef(view2DOptions.numZoomLevels) &&
|
||||
goog.isDef(view2DOptions.zoomFactor)) {
|
||||
maxResolution = view2DOptions.maxResolution;
|
||||
numZoomLevels = view2DOptions.numZoomLevels;
|
||||
zoomFactor = view2DOptions.zoomFactor;
|
||||
if (goog.isDef(options.maxResolution) &&
|
||||
goog.isDef(options.numZoomLevels) &&
|
||||
goog.isDef(options.zoomFactor)) {
|
||||
maxResolution = options.maxResolution;
|
||||
numZoomLevels = options.numZoomLevels;
|
||||
zoomFactor = options.zoomFactor;
|
||||
} else {
|
||||
var projectionExtent = ol.projection.createProjection(
|
||||
view2DOptions.projection, 'EPSG:3857').getExtent();
|
||||
options.projection, 'EPSG:3857').getExtent();
|
||||
maxResolution = Math.max(
|
||||
projectionExtent.maxX - projectionExtent.minX,
|
||||
projectionExtent.maxY - projectionExtent.minY) / ol.DEFAULT_TILE_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user