Merge pull request #7826 from fredj/indent
Better code indentation and modules renaming
This commit is contained in:
@@ -145,7 +145,7 @@ Collection.prototype.item = function(index) {
|
||||
* @api
|
||||
*/
|
||||
Collection.prototype.getLength = function() {
|
||||
return (/** @type {number} */ this.get(Property.LENGTH));
|
||||
return /** @type {number} */ (this.get(Property.LENGTH));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -197,9 +197,7 @@ Geolocation.prototype.positionError_ = function(error) {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getAccuracy = function() {
|
||||
return (
|
||||
/** @type {number|undefined} */ this.get(GeolocationProperty.ACCURACY)
|
||||
);
|
||||
return /** @type {number|undefined} */ (this.get(GeolocationProperty.ACCURACY));
|
||||
};
|
||||
|
||||
|
||||
@@ -210,9 +208,7 @@ Geolocation.prototype.getAccuracy = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getAccuracyGeometry = function() {
|
||||
return (
|
||||
/** @type {?ol.geom.Polygon} */ this.get(GeolocationProperty.ACCURACY_GEOMETRY) || null
|
||||
);
|
||||
return /** @type {?ol.geom.Polygon} */ (this.get(GeolocationProperty.ACCURACY_GEOMETRY) || null);
|
||||
};
|
||||
|
||||
|
||||
@@ -224,9 +220,7 @@ Geolocation.prototype.getAccuracyGeometry = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getAltitude = function() {
|
||||
return (
|
||||
/** @type {number|undefined} */ this.get(GeolocationProperty.ALTITUDE)
|
||||
);
|
||||
return /** @type {number|undefined} */ (this.get(GeolocationProperty.ALTITUDE));
|
||||
};
|
||||
|
||||
|
||||
@@ -238,9 +232,7 @@ Geolocation.prototype.getAltitude = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getAltitudeAccuracy = function() {
|
||||
return (
|
||||
/** @type {number|undefined} */ this.get(GeolocationProperty.ALTITUDE_ACCURACY)
|
||||
);
|
||||
return /** @type {number|undefined} */ (this.get(GeolocationProperty.ALTITUDE_ACCURACY));
|
||||
};
|
||||
|
||||
|
||||
@@ -253,9 +245,7 @@ Geolocation.prototype.getAltitudeAccuracy = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getHeading = function() {
|
||||
return (
|
||||
/** @type {number|undefined} */ this.get(GeolocationProperty.HEADING)
|
||||
);
|
||||
return /** @type {number|undefined} */ (this.get(GeolocationProperty.HEADING));
|
||||
};
|
||||
|
||||
|
||||
@@ -267,9 +257,7 @@ Geolocation.prototype.getHeading = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getPosition = function() {
|
||||
return (
|
||||
/** @type {ol.Coordinate|undefined} */ this.get(GeolocationProperty.POSITION)
|
||||
);
|
||||
return /** @type {ol.Coordinate|undefined} */ (this.get(GeolocationProperty.POSITION));
|
||||
};
|
||||
|
||||
|
||||
@@ -281,9 +269,7 @@ Geolocation.prototype.getPosition = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getProjection = function() {
|
||||
return (
|
||||
/** @type {ol.proj.Projection|undefined} */ this.get(GeolocationProperty.PROJECTION)
|
||||
);
|
||||
return /** @type {ol.proj.Projection|undefined} */ (this.get(GeolocationProperty.PROJECTION));
|
||||
};
|
||||
|
||||
|
||||
@@ -295,9 +281,7 @@ Geolocation.prototype.getProjection = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getSpeed = function() {
|
||||
return (
|
||||
/** @type {number|undefined} */ this.get(GeolocationProperty.SPEED)
|
||||
);
|
||||
return /** @type {number|undefined} */ (this.get(GeolocationProperty.SPEED));
|
||||
};
|
||||
|
||||
|
||||
@@ -308,9 +292,7 @@ Geolocation.prototype.getSpeed = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getTracking = function() {
|
||||
return (
|
||||
/** @type {boolean} */ this.get(GeolocationProperty.TRACKING)
|
||||
);
|
||||
return /** @type {boolean} */ (this.get(GeolocationProperty.TRACKING));
|
||||
};
|
||||
|
||||
|
||||
@@ -324,9 +306,7 @@ Geolocation.prototype.getTracking = function() {
|
||||
* @api
|
||||
*/
|
||||
Geolocation.prototype.getTrackingOptions = function() {
|
||||
return (
|
||||
/** @type {GeolocationPositionOptions|undefined} */ this.get(GeolocationProperty.TRACKING_OPTIONS)
|
||||
);
|
||||
return /** @type {GeolocationPositionOptions|undefined} */ (this.get(GeolocationProperty.TRACKING_OPTIONS));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ inherits(Overlay, BaseObject);
|
||||
* @api
|
||||
*/
|
||||
Overlay.prototype.getElement = function() {
|
||||
return (/** @type {Element|undefined} */ this.get(Property.ELEMENT));
|
||||
return /** @type {Element|undefined} */ (this.get(Property.ELEMENT));
|
||||
};
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ Overlay.prototype.getId = function() {
|
||||
* @api
|
||||
*/
|
||||
Overlay.prototype.getMap = function() {
|
||||
return (/** @type {ol.PluggableMap|undefined} */ this.get(Property.MAP));
|
||||
return /** @type {ol.PluggableMap|undefined} */ (this.get(Property.MAP));
|
||||
};
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ Overlay.prototype.getMap = function() {
|
||||
* @api
|
||||
*/
|
||||
Overlay.prototype.getOffset = function() {
|
||||
return (/** @type {Array.<number>} */ this.get(Property.OFFSET));
|
||||
return /** @type {Array.<number>} */ (this.get(Property.OFFSET));
|
||||
};
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ Overlay.prototype.getOffset = function() {
|
||||
* @api
|
||||
*/
|
||||
Overlay.prototype.getPosition = function() {
|
||||
return (/** @type {ol.Coordinate|undefined} */ this.get(Property.POSITION));
|
||||
return /** @type {ol.Coordinate|undefined} */ (this.get(Property.POSITION));
|
||||
};
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ Overlay.prototype.getPosition = function() {
|
||||
* @api
|
||||
*/
|
||||
Overlay.prototype.getPositioning = function() {
|
||||
return (/** @type {ol.OverlayPositioning} */ this.get(Property.POSITIONING));
|
||||
return /** @type {ol.OverlayPositioning} */ (this.get(Property.POSITIONING));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -664,9 +664,7 @@ PluggableMap.prototype.getEventPixel = function(event) {
|
||||
* @api
|
||||
*/
|
||||
PluggableMap.prototype.getTarget = function() {
|
||||
return (
|
||||
/** @type {Element|string|undefined} */ this.get(MapProperty.TARGET)
|
||||
);
|
||||
return /** @type {Element|string|undefined} */ (this.get(MapProperty.TARGET));
|
||||
};
|
||||
|
||||
|
||||
@@ -762,9 +760,7 @@ PluggableMap.prototype.getInteractions = function() {
|
||||
* @api
|
||||
*/
|
||||
PluggableMap.prototype.getLayerGroup = function() {
|
||||
return (
|
||||
/** @type {ol.layer.Group} */ this.get(MapProperty.LAYERGROUP)
|
||||
);
|
||||
return /** @type {ol.layer.Group} */ (this.get(MapProperty.LAYERGROUP));
|
||||
};
|
||||
|
||||
|
||||
@@ -813,9 +809,7 @@ PluggableMap.prototype.getRenderer = function() {
|
||||
* @api
|
||||
*/
|
||||
PluggableMap.prototype.getSize = function() {
|
||||
return (
|
||||
/** @type {ol.Size|undefined} */ this.get(MapProperty.SIZE)
|
||||
);
|
||||
return /** @type {ol.Size|undefined} */ (this.get(MapProperty.SIZE));
|
||||
};
|
||||
|
||||
|
||||
@@ -827,9 +821,7 @@ PluggableMap.prototype.getSize = function() {
|
||||
* @api
|
||||
*/
|
||||
PluggableMap.prototype.getView = function() {
|
||||
return (
|
||||
/** @type {ol.View} */ this.get(MapProperty.VIEW)
|
||||
);
|
||||
return /** @type {ol.View} */ (this.get(MapProperty.VIEW));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -571,9 +571,7 @@ View.prototype.constrainRotation = function(rotation, opt_delta) {
|
||||
* @api
|
||||
*/
|
||||
View.prototype.getCenter = function() {
|
||||
return (
|
||||
/** @type {ol.Coordinate|undefined} */ this.get(ViewProperty.CENTER)
|
||||
);
|
||||
return /** @type {ol.Coordinate|undefined} */ (this.get(ViewProperty.CENTER));
|
||||
};
|
||||
|
||||
|
||||
@@ -700,9 +698,7 @@ View.prototype.getProjection = function() {
|
||||
* @api
|
||||
*/
|
||||
View.prototype.getResolution = function() {
|
||||
return (
|
||||
/** @type {number|undefined} */ this.get(ViewProperty.RESOLUTION)
|
||||
);
|
||||
return /** @type {number|undefined} */ (this.get(ViewProperty.RESOLUTION));
|
||||
};
|
||||
|
||||
|
||||
@@ -763,9 +759,7 @@ View.prototype.getResolutionForValueFunction = function(opt_power) {
|
||||
* @api
|
||||
*/
|
||||
View.prototype.getRotation = function() {
|
||||
return (
|
||||
/** @type {number} */ this.get(ViewProperty.ROTATION)
|
||||
);
|
||||
return /** @type {number} */ (this.get(ViewProperty.ROTATION));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -133,9 +133,7 @@ MousePosition.prototype.handleProjectionChanged_ = function() {
|
||||
* @api
|
||||
*/
|
||||
MousePosition.prototype.getCoordinateFormat = function() {
|
||||
return (
|
||||
/** @type {ol.CoordinateFormatType|undefined} */ this.get(COORDINATE_FORMAT)
|
||||
);
|
||||
return /** @type {ol.CoordinateFormatType|undefined} */ (this.get(COORDINATE_FORMAT));
|
||||
};
|
||||
|
||||
|
||||
@@ -147,9 +145,7 @@ MousePosition.prototype.getCoordinateFormat = function() {
|
||||
* @api
|
||||
*/
|
||||
MousePosition.prototype.getProjection = function() {
|
||||
return (
|
||||
/** @type {ol.proj.Projection|undefined} */ this.get(PROJECTION)
|
||||
);
|
||||
return /** @type {ol.proj.Projection|undefined} */ (this.get(PROJECTION));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -119,9 +119,7 @@ inherits(ScaleLine, Control);
|
||||
* @api
|
||||
*/
|
||||
ScaleLine.prototype.getUnits = function() {
|
||||
return (
|
||||
/** @type {ol.control.ScaleLineUnits|undefined} */ this.get(UNITS)
|
||||
);
|
||||
return /** @type {ol.control.ScaleLineUnits|undefined} */ (this.get(UNITS));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -199,12 +199,9 @@ GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
||||
context['srsName'] = node.firstElementChild.getAttribute('srsName');
|
||||
context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension');
|
||||
/** @type {ol.geom.Geometry} */
|
||||
const geometry = pushParseAndPop(null,
|
||||
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
||||
const geometry = pushParseAndPop(null, this.GEOMETRY_PARSERS_, node, objectStack, this);
|
||||
if (geometry) {
|
||||
return (
|
||||
/** @type {ol.geom.Geometry} */ transformWithOptions(geometry, false, context)
|
||||
);
|
||||
return /** @type {ol.geom.Geometry} */ (transformWithOptions(geometry, false, context));
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -796,9 +796,7 @@ WKT.prototype.readGeometry;
|
||||
WKT.prototype.readGeometryFromText = function(text, opt_options) {
|
||||
const geometry = this.parse_(text);
|
||||
if (geometry) {
|
||||
return (
|
||||
/** @type {ol.geom.Geometry} */ transformWithOptions(geometry, false, opt_options)
|
||||
);
|
||||
return /** @type {ol.geom.Geometry} */ (transformWithOptions(geometry, false, opt_options));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ inherits(Interaction, BaseObject);
|
||||
* @api
|
||||
*/
|
||||
Interaction.prototype.getActive = function() {
|
||||
return (/** @type {boolean} */ this.get(InteractionProperty.ACTIVE));
|
||||
return /** @type {boolean} */ (this.get(InteractionProperty.ACTIVE));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -114,9 +114,7 @@ BaseLayer.prototype.getLayerStatesArray = function(opt_states) {};
|
||||
* @api
|
||||
*/
|
||||
BaseLayer.prototype.getExtent = function() {
|
||||
return (
|
||||
/** @type {ol.Extent|undefined} */ this.get(LayerProperty.EXTENT)
|
||||
);
|
||||
return /** @type {ol.Extent|undefined} */ (this.get(LayerProperty.EXTENT));
|
||||
};
|
||||
|
||||
|
||||
@@ -127,9 +125,7 @@ BaseLayer.prototype.getExtent = function() {
|
||||
* @api
|
||||
*/
|
||||
BaseLayer.prototype.getMaxResolution = function() {
|
||||
return (
|
||||
/** @type {number} */ this.get(LayerProperty.MAX_RESOLUTION)
|
||||
);
|
||||
return /** @type {number} */ (this.get(LayerProperty.MAX_RESOLUTION));
|
||||
};
|
||||
|
||||
|
||||
@@ -140,9 +136,7 @@ BaseLayer.prototype.getMaxResolution = function() {
|
||||
* @api
|
||||
*/
|
||||
BaseLayer.prototype.getMinResolution = function() {
|
||||
return (
|
||||
/** @type {number} */ this.get(LayerProperty.MIN_RESOLUTION)
|
||||
);
|
||||
return /** @type {number} */ (this.get(LayerProperty.MIN_RESOLUTION));
|
||||
};
|
||||
|
||||
|
||||
@@ -153,9 +147,7 @@ BaseLayer.prototype.getMinResolution = function() {
|
||||
* @api
|
||||
*/
|
||||
BaseLayer.prototype.getOpacity = function() {
|
||||
return (
|
||||
/** @type {number} */ this.get(LayerProperty.OPACITY)
|
||||
);
|
||||
return /** @type {number} */ (this.get(LayerProperty.OPACITY));
|
||||
};
|
||||
|
||||
|
||||
@@ -173,9 +165,7 @@ BaseLayer.prototype.getSourceState = function() {};
|
||||
* @api
|
||||
*/
|
||||
BaseLayer.prototype.getVisible = function() {
|
||||
return (
|
||||
/** @type {boolean} */ this.get(LayerProperty.VISIBLE)
|
||||
);
|
||||
return /** @type {boolean} */ (this.get(LayerProperty.VISIBLE));
|
||||
};
|
||||
|
||||
|
||||
@@ -187,9 +177,7 @@ BaseLayer.prototype.getVisible = function() {
|
||||
* @api
|
||||
*/
|
||||
BaseLayer.prototype.getZIndex = function() {
|
||||
return (
|
||||
/** @type {number} */ this.get(LayerProperty.Z_INDEX)
|
||||
);
|
||||
return /** @type {number} */ (this.get(LayerProperty.Z_INDEX));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -98,10 +98,9 @@ LayerGroup.prototype.handleLayersChanged_ = function(event) {
|
||||
|
||||
const layers = this.getLayers();
|
||||
this.layersListenerKeys_.push(
|
||||
listen(layers, CollectionEventType.ADD,
|
||||
this.handleLayersAdd_, this),
|
||||
listen(layers, CollectionEventType.REMOVE,
|
||||
this.handleLayersRemove_, this));
|
||||
listen(layers, CollectionEventType.ADD, this.handleLayersAdd_, this),
|
||||
listen(layers, CollectionEventType.REMOVE, this.handleLayersRemove_, this)
|
||||
);
|
||||
|
||||
for (const id in this.listenerKeys_) {
|
||||
this.listenerKeys_[id].forEach(unlistenByKey);
|
||||
@@ -112,10 +111,8 @@ LayerGroup.prototype.handleLayersChanged_ = function(event) {
|
||||
for (let i = 0, ii = layersArray.length; i < ii; i++) {
|
||||
const layer = layersArray[i];
|
||||
this.listenerKeys_[getUid(layer).toString()] = [
|
||||
listen(layer, ObjectEventType.PROPERTYCHANGE,
|
||||
this.handleLayerChange_, this),
|
||||
listen(layer, EventType.CHANGE,
|
||||
this.handleLayerChange_, this)
|
||||
listen(layer, ObjectEventType.PROPERTYCHANGE, this.handleLayerChange_, this),
|
||||
listen(layer, EventType.CHANGE, this.handleLayerChange_, this)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -131,10 +128,8 @@ LayerGroup.prototype.handleLayersAdd_ = function(collectionEvent) {
|
||||
const layer = /** @type {ol.layer.Base} */ (collectionEvent.element);
|
||||
const key = getUid(layer).toString();
|
||||
this.listenerKeys_[key] = [
|
||||
listen(layer, ObjectEventType.PROPERTYCHANGE,
|
||||
this.handleLayerChange_, this),
|
||||
listen(layer, EventType.CHANGE,
|
||||
this.handleLayerChange_, this)
|
||||
listen(layer, ObjectEventType.PROPERTYCHANGE, this.handleLayerChange_, this),
|
||||
listen(layer, EventType.CHANGE, this.handleLayerChange_, this)
|
||||
];
|
||||
this.changed();
|
||||
};
|
||||
@@ -162,7 +157,7 @@ LayerGroup.prototype.handleLayersRemove_ = function(collectionEvent) {
|
||||
* @api
|
||||
*/
|
||||
LayerGroup.prototype.getLayers = function() {
|
||||
return (/** @type {!ol.Collection.<ol.layer.Base>} */ this.get(Property.LAYERS));
|
||||
return /** @type {!ol.Collection.<ol.layer.Base>} */ (this.get(Property.LAYERS));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ Heatmap.prototype.createCircle_ = function() {
|
||||
* @observable
|
||||
*/
|
||||
Heatmap.prototype.getBlur = function() {
|
||||
return (/** @type {number} */ this.get(Property.BLUR));
|
||||
return /** @type {number} */ (this.get(Property.BLUR));
|
||||
};
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ Heatmap.prototype.getBlur = function() {
|
||||
* @observable
|
||||
*/
|
||||
Heatmap.prototype.getGradient = function() {
|
||||
return (/** @type {Array.<string>} */ this.get(Property.GRADIENT));
|
||||
return /** @type {Array.<string>} */ (this.get(Property.GRADIENT));
|
||||
};
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ Heatmap.prototype.getGradient = function() {
|
||||
* @observable
|
||||
*/
|
||||
Heatmap.prototype.getRadius = function() {
|
||||
return (/** @type {number} */ this.get(Property.RADIUS));
|
||||
return /** @type {number} */ (this.get(Property.RADIUS));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -178,16 +178,14 @@ Layer.prototype.setMap = function(map) {
|
||||
this.mapRenderKey_ = null;
|
||||
}
|
||||
if (map) {
|
||||
this.mapPrecomposeKey_ = listen(
|
||||
map, RenderEventType.PRECOMPOSE, function(evt) {
|
||||
const layerState = this.getLayerState();
|
||||
layerState.managed = false;
|
||||
layerState.zIndex = Infinity;
|
||||
evt.frameState.layerStatesArray.push(layerState);
|
||||
evt.frameState.layerStates[getUid(this)] = layerState;
|
||||
}, this);
|
||||
this.mapRenderKey_ = listen(
|
||||
this, EventType.CHANGE, map.render, map);
|
||||
this.mapPrecomposeKey_ = listen(map, RenderEventType.PRECOMPOSE, function(evt) {
|
||||
const layerState = this.getLayerState();
|
||||
layerState.managed = false;
|
||||
layerState.zIndex = Infinity;
|
||||
evt.frameState.layerStatesArray.push(layerState);
|
||||
evt.frameState.layerStates[getUid(this)] = layerState;
|
||||
}, this);
|
||||
this.mapRenderKey_ = listen(this, EventType.CHANGE, map.render, map);
|
||||
this.changed();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import LayerType from '../LayerType.js';
|
||||
import Layer from '../layer/Layer.js';
|
||||
import _ol_layer_TileProperty_ from '../layer/TileProperty.js';
|
||||
import TileProperty from '../layer/TileProperty.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
/**
|
||||
@@ -53,9 +53,7 @@ inherits(TileLayer, Layer);
|
||||
* @api
|
||||
*/
|
||||
TileLayer.prototype.getPreload = function() {
|
||||
return (
|
||||
/** @type {number} */ this.get(_ol_layer_TileProperty_.PRELOAD)
|
||||
);
|
||||
return /** @type {number} */ (this.get(TileProperty.PRELOAD));
|
||||
};
|
||||
|
||||
|
||||
@@ -75,7 +73,7 @@ TileLayer.prototype.getSource;
|
||||
* @api
|
||||
*/
|
||||
TileLayer.prototype.setPreload = function(preload) {
|
||||
this.set(_ol_layer_TileProperty_.PRELOAD, preload);
|
||||
this.set(TileProperty.PRELOAD, preload);
|
||||
};
|
||||
|
||||
|
||||
@@ -86,9 +84,7 @@ TileLayer.prototype.setPreload = function(preload) {
|
||||
* @api
|
||||
*/
|
||||
TileLayer.prototype.getUseInterimTilesOnError = function() {
|
||||
return (
|
||||
/** @type {boolean} */ this.get(_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR)
|
||||
);
|
||||
return /** @type {boolean} */ (this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR));
|
||||
};
|
||||
|
||||
|
||||
@@ -99,7 +95,6 @@ TileLayer.prototype.getUseInterimTilesOnError = function() {
|
||||
* @api
|
||||
*/
|
||||
TileLayer.prototype.setUseInterimTilesOnError = function(useInterimTilesOnError) {
|
||||
this.set(
|
||||
_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
|
||||
this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
|
||||
};
|
||||
export default TileLayer;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import LayerType from '../LayerType.js';
|
||||
import Layer from '../layer/Layer.js';
|
||||
import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js';
|
||||
import VectorRenderType from '../layer/VectorRenderType.js';
|
||||
import {assign} from '../obj.js';
|
||||
import Style from '../style/Style.js';
|
||||
|
||||
@@ -90,7 +90,7 @@ const VectorLayer = function(opt_options) {
|
||||
* @private
|
||||
* @type {ol.layer.VectorTileRenderType|string}
|
||||
*/
|
||||
this.renderMode_ = options.renderMode || _ol_layer_VectorRenderType_.VECTOR;
|
||||
this.renderMode_ = options.renderMode || VectorRenderType.VECTOR;
|
||||
|
||||
/**
|
||||
* The layer type.
|
||||
@@ -133,7 +133,7 @@ VectorLayer.prototype.getRenderBuffer = function() {
|
||||
* order.
|
||||
*/
|
||||
VectorLayer.prototype.getRenderOrder = function() {
|
||||
return (/** @type {ol.RenderOrderFunction|null|undefined} */ this.get(Property.RENDER_ORDER));
|
||||
return /** @type {ol.RenderOrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
import {inherits} from '../index.js';
|
||||
import LayerType from '../LayerType.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_layer_TileProperty_ from '../layer/TileProperty.js';
|
||||
import TileProperty from '../layer/TileProperty.js';
|
||||
import VectorLayer from '../layer/Vector.js';
|
||||
import _ol_layer_VectorTileRenderType_ from '../layer/VectorTileRenderType.js';
|
||||
import VectorTileRenderType from '../layer/VectorTileRenderType.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
/**
|
||||
@@ -24,14 +24,14 @@ import {assign} from '../obj.js';
|
||||
const VectorTileLayer = function(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
let renderMode = options.renderMode || _ol_layer_VectorTileRenderType_.HYBRID;
|
||||
let renderMode = options.renderMode || VectorTileRenderType.HYBRID;
|
||||
assert(renderMode == undefined ||
|
||||
renderMode == _ol_layer_VectorTileRenderType_.IMAGE ||
|
||||
renderMode == _ol_layer_VectorTileRenderType_.HYBRID ||
|
||||
renderMode == _ol_layer_VectorTileRenderType_.VECTOR,
|
||||
renderMode == VectorTileRenderType.IMAGE ||
|
||||
renderMode == VectorTileRenderType.HYBRID ||
|
||||
renderMode == VectorTileRenderType.VECTOR,
|
||||
28); // `renderMode` must be `'image'`, `'hybrid'` or `'vector'`
|
||||
if (options.declutter && renderMode == _ol_layer_VectorTileRenderType_.IMAGE) {
|
||||
renderMode = _ol_layer_VectorTileRenderType_.HYBRID;
|
||||
if (options.declutter && renderMode == VectorTileRenderType.IMAGE) {
|
||||
renderMode = VectorTileRenderType.HYBRID;
|
||||
}
|
||||
options.renderMode = renderMode;
|
||||
|
||||
@@ -64,9 +64,7 @@ inherits(VectorTileLayer, VectorLayer);
|
||||
* @api
|
||||
*/
|
||||
VectorTileLayer.prototype.getPreload = function() {
|
||||
return (
|
||||
/** @type {number} */ this.get(_ol_layer_TileProperty_.PRELOAD)
|
||||
);
|
||||
return /** @type {number} */ (this.get(TileProperty.PRELOAD));
|
||||
};
|
||||
|
||||
|
||||
@@ -77,9 +75,7 @@ VectorTileLayer.prototype.getPreload = function() {
|
||||
* @api
|
||||
*/
|
||||
VectorTileLayer.prototype.getUseInterimTilesOnError = function() {
|
||||
return (
|
||||
/** @type {boolean} */ this.get(_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR)
|
||||
);
|
||||
return /** @type {boolean} */ (this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR));
|
||||
};
|
||||
|
||||
|
||||
@@ -90,7 +86,7 @@ VectorTileLayer.prototype.getUseInterimTilesOnError = function() {
|
||||
* @api
|
||||
*/
|
||||
VectorTileLayer.prototype.setPreload = function(preload) {
|
||||
this.set(_ol_layer_TileProperty_.PRELOAD, preload);
|
||||
this.set(TileProperty.PRELOAD, preload);
|
||||
};
|
||||
|
||||
|
||||
@@ -101,8 +97,7 @@ VectorTileLayer.prototype.setPreload = function(preload) {
|
||||
* @api
|
||||
*/
|
||||
VectorTileLayer.prototype.setUseInterimTilesOnError = function(useInterimTilesOnError) {
|
||||
this.set(
|
||||
_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
|
||||
this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import LayerType from '../../LayerType.js';
|
||||
import ViewHint from '../../ViewHint.js';
|
||||
import {equals} from '../../array.js';
|
||||
import {getHeight, getIntersection, getWidth, isEmpty} from '../../extent.js';
|
||||
import _ol_layer_VectorRenderType_ from '../../layer/VectorRenderType.js';
|
||||
import VectorRenderType from '../../layer/VectorRenderType.js';
|
||||
import {assign} from '../../obj.js';
|
||||
import {getLayerRendererPlugins} from '../../plugins.js';
|
||||
import RendererType from '../Type.js';
|
||||
@@ -62,7 +62,7 @@ inherits(CanvasImageLayerRenderer, IntermediateCanvasRenderer);
|
||||
CanvasImageLayerRenderer['handles'] = function(type, layer) {
|
||||
return type === RendererType.CANVAS && (layer.getType() === LayerType.IMAGE ||
|
||||
layer.getType() === LayerType.VECTOR &&
|
||||
/** @type {ol.layer.Vector} */ (layer).getRenderMode() === _ol_layer_VectorRenderType_.IMAGE);
|
||||
/** @type {ol.layer.Vector} */ (layer).getRenderMode() === VectorRenderType.IMAGE);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {listen, unlisten} from '../../events.js';
|
||||
import EventType from '../../events/EventType.js';
|
||||
import rbush from 'rbush';
|
||||
import {buffer, containsCoordinate, equals, getIntersection, getTopLeft, intersects} from '../../extent.js';
|
||||
import _ol_layer_VectorTileRenderType_ from '../../layer/VectorTileRenderType.js';
|
||||
import VectorTileRenderType from '../../layer/VectorTileRenderType.js';
|
||||
import {equivalent as equivalentProjection} from '../../proj.js';
|
||||
import Units from '../../proj/Units.js';
|
||||
import ReplayType from '../../render/ReplayType.js';
|
||||
@@ -82,8 +82,7 @@ const CanvasVectorTileLayerRenderer = function(layer) {
|
||||
this.tmpTransform_ = _ol_transform_.create();
|
||||
|
||||
// Use lower resolution for pure vector rendering. Closest resolution otherwise.
|
||||
this.zDirection =
|
||||
layer.getRenderMode() == _ol_layer_VectorTileRenderType_.VECTOR ? 1 : 0;
|
||||
this.zDirection = layer.getRenderMode() == VectorTileRenderType.VECTOR ? 1 : 0;
|
||||
|
||||
listen(labelCache, EventType.CLEAR, this.handleFontsChanged_, this);
|
||||
|
||||
@@ -132,10 +131,10 @@ CanvasVectorTileLayerRenderer.prototype.prepareFrame = function(frameState, laye
|
||||
if (this.renderedLayerRevision_ != layerRevision) {
|
||||
this.renderedTiles.length = 0;
|
||||
const renderMode = layer.getRenderMode();
|
||||
if (!this.context && renderMode != _ol_layer_VectorTileRenderType_.VECTOR) {
|
||||
if (!this.context && renderMode != VectorTileRenderType.VECTOR) {
|
||||
this.context = createCanvasContext2D();
|
||||
}
|
||||
if (this.context && renderMode == _ol_layer_VectorTileRenderType_.VECTOR) {
|
||||
if (this.context && renderMode == VectorTileRenderType.VECTOR) {
|
||||
this.context = null;
|
||||
}
|
||||
}
|
||||
@@ -398,7 +397,7 @@ CanvasVectorTileLayerRenderer.prototype.postCompose = function(context, frameSta
|
||||
continue;
|
||||
}
|
||||
const replayGroup = sourceTile.getReplayGroup(layer, tileCoord.toString());
|
||||
if (renderMode != _ol_layer_VectorTileRenderType_.VECTOR && !replayGroup.hasReplays(replayTypes)) {
|
||||
if (renderMode != VectorTileRenderType.VECTOR && !replayGroup.hasReplays(replayTypes)) {
|
||||
continue;
|
||||
}
|
||||
if (!transform) {
|
||||
|
||||
Reference in New Issue
Block a user