Merge pull request #7823 from fredj/f7801
Replace static members with named exports
This commit is contained in:
@@ -237,8 +237,7 @@ Feature.prototype.setGeometry = function(geometry) {
|
||||
*/
|
||||
Feature.prototype.setStyle = function(style) {
|
||||
this.style_ = style;
|
||||
this.styleFunction_ = !style ?
|
||||
undefined : Feature.createStyleFunction(style);
|
||||
this.styleFunction_ = !style ? undefined : createStyleFunction(style);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -285,7 +284,7 @@ Feature.prototype.setGeometryName = function(name) {
|
||||
* A feature style function, a single style, or an array of styles.
|
||||
* @return {ol.StyleFunction} A style function.
|
||||
*/
|
||||
Feature.createStyleFunction = function(obj) {
|
||||
export function createStyleFunction(obj) {
|
||||
if (typeof obj === 'function') {
|
||||
return obj;
|
||||
} else {
|
||||
@@ -304,5 +303,5 @@ Feature.createStyleFunction = function(obj) {
|
||||
return styles;
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
export default Feature;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
|
||||
import {removeChildren, replaceNode} from '../dom.js';
|
||||
import {listen} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import Layer from '../layer/Layer.js';
|
||||
import {visibleAtResolution} from '../layer/Layer.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -146,7 +146,7 @@ Attribution.prototype.getSourceAttributions_ = function(frameState) {
|
||||
const resolution = frameState.viewState.resolution;
|
||||
for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {
|
||||
const layerState = layerStatesArray[i];
|
||||
if (!Layer.visibleAtResolution(layerState, resolution)) {
|
||||
if (!visibleAtResolution(layerState, resolution)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/OWS
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import XLink from '../format/XLink.js';
|
||||
import {readHref} from '../format/XLink.js';
|
||||
import XML from '../format/XML.js';
|
||||
import XSD from '../format/XSD.js';
|
||||
import {makeObjectPropertyPusher, makeObjectPropertySetter, makeStructureNS, pushParseAndPop} from '../xml.js';
|
||||
@@ -193,7 +193,7 @@ const SERVICE_PROVIDER_PARSERS =
|
||||
makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'ProviderName': makeObjectPropertySetter(XSD.readString),
|
||||
'ProviderSite': makeObjectPropertySetter(XLink.readHref),
|
||||
'ProviderSite': makeObjectPropertySetter(readHref),
|
||||
'ServiceContact': makeObjectPropertySetter(
|
||||
readServiceContact)
|
||||
});
|
||||
@@ -288,7 +288,7 @@ function readDcp(node, objectStack) {
|
||||
* @return {Object|undefined} The GET object.
|
||||
*/
|
||||
function readGet(node, objectStack) {
|
||||
const href = XLink.readHref(node);
|
||||
const href = readHref(node);
|
||||
if (!href) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,53 @@ import {createElementNS, isDocument, isNode, makeArrayPusher, makeChildAppender,
|
||||
makeObjectPropertySetter, makeSimpleNodeFactory, parse, parseNode,
|
||||
pushParseAndPop, pushSerializeAndPop, setAttributeNS} from '../xml.js';
|
||||
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
const FEATURE_PREFIX = 'feature';
|
||||
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
const XMLNS = 'http://www.w3.org/2000/xmlns/';
|
||||
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
const OGCNS = 'http://www.opengis.net/ogc';
|
||||
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
const WFSNS = 'http://www.opengis.net/wfs';
|
||||
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
const FESNS = 'http://www.opengis.net/fes';
|
||||
|
||||
|
||||
/**
|
||||
* @type {Object.<string, string>}
|
||||
*/
|
||||
const SCHEMA_LOCATIONS = {
|
||||
'1.1.0': 'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',
|
||||
'1.0.0': 'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
const DEFAULT_VERSION = '1.1.0';
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading and writing data in the WFS format.
|
||||
@@ -56,8 +103,7 @@ const WFS = function(opt_options) {
|
||||
* @type {string}
|
||||
*/
|
||||
this.schemaLocation_ = options.schemaLocation ?
|
||||
options.schemaLocation :
|
||||
WFS.SCHEMA_LOCATIONS[WFS.DEFAULT_VERSION];
|
||||
options.schemaLocation : SCHEMA_LOCATIONS[DEFAULT_VERSION];
|
||||
|
||||
XMLFeature.call(this);
|
||||
};
|
||||
@@ -65,60 +111,6 @@ const WFS = function(opt_options) {
|
||||
inherits(WFS, XMLFeature);
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
WFS.FEATURE_PREFIX = 'feature';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
WFS.XMLNS = 'http://www.w3.org/2000/xmlns/';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
WFS.OGCNS = 'http://www.opengis.net/ogc';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
WFS.WFSNS = 'http://www.opengis.net/wfs';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
WFS.FESNS = 'http://www.opengis.net/fes';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Object.<string, string>}
|
||||
*/
|
||||
WFS.SCHEMA_LOCATIONS = {
|
||||
'1.1.0': 'http://www.opengis.net/wfs ' +
|
||||
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',
|
||||
'1.0.0': 'http://www.opengis.net/wfs ' +
|
||||
'http://schemas.opengis.net/wfs/1.0.0/wfs.xsd'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
WFS.DEFAULT_VERSION = '1.1.0';
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<string>|string|undefined} featureType
|
||||
*/
|
||||
@@ -405,8 +397,8 @@ function writeFeature(node, feature, objectStack) {
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
*/
|
||||
function writeOgcFidFilter(node, fid, objectStack) {
|
||||
const filter = createElementNS(WFS.OGCNS, 'Filter');
|
||||
const child = createElementNS(WFS.OGCNS, 'FeatureId');
|
||||
const filter = createElementNS(OGCNS, 'Filter');
|
||||
const child = createElementNS(OGCNS, 'FeatureId');
|
||||
filter.appendChild(child);
|
||||
child.setAttribute('fid', fid);
|
||||
node.appendChild(filter);
|
||||
@@ -419,8 +411,7 @@ function writeOgcFidFilter(node, fid, objectStack) {
|
||||
* @returns {string} The value of the typeName property.
|
||||
*/
|
||||
function getTypeName(featurePrefix, featureType) {
|
||||
featurePrefix = featurePrefix ? featurePrefix :
|
||||
WFS.FEATURE_PREFIX;
|
||||
featurePrefix = featurePrefix ? featurePrefix : FEATURE_PREFIX;
|
||||
const prefix = featurePrefix + ':';
|
||||
// The featureType already contains the prefix.
|
||||
if (featureType.indexOf(prefix) === 0) {
|
||||
@@ -444,8 +435,7 @@ function writeDelete(node, feature, objectStack) {
|
||||
const featureNS = context['featureNS'];
|
||||
const typeName = getTypeName(featurePrefix, featureType);
|
||||
node.setAttribute('typeName', typeName);
|
||||
setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
setAttributeNS(node, XMLNS, 'xmlns:' + featurePrefix, featureNS);
|
||||
const fid = feature.getId();
|
||||
if (fid !== undefined) {
|
||||
writeOgcFidFilter(node, fid, objectStack);
|
||||
@@ -481,8 +471,7 @@ function writeUpdate(node, feature, objectStack) {
|
||||
const typeName = getTypeName(featurePrefix, featureType);
|
||||
const geometryName = feature.getGeometryName();
|
||||
node.setAttribute('typeName', typeName);
|
||||
setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
setAttributeNS(node, XMLNS, 'xmlns:' + featurePrefix, featureNS);
|
||||
const fid = feature.getId();
|
||||
if (fid !== undefined) {
|
||||
const keys = feature.getKeys();
|
||||
@@ -514,13 +503,13 @@ function writeUpdate(node, feature, objectStack) {
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
*/
|
||||
function writeProperty(node, pair, objectStack) {
|
||||
const name = createElementNS(WFS.WFSNS, 'Name');
|
||||
const name = createElementNS(WFSNS, 'Name');
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const gmlVersion = context['gmlVersion'];
|
||||
node.appendChild(name);
|
||||
XSD.writeStringTextNode(name, pair.name);
|
||||
if (pair.value !== undefined && pair.value !== null) {
|
||||
const value = createElementNS(WFS.WFSNS, 'Value');
|
||||
const value = createElementNS(WFSNS, 'Value');
|
||||
node.appendChild(value);
|
||||
if (pair.value instanceof Geometry) {
|
||||
if (gmlVersion === 2) {
|
||||
@@ -608,8 +597,7 @@ function writeQuery(node, featureType, objectStack) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
if (featureNS) {
|
||||
setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
setAttributeNS(node, XMLNS, 'xmlns:' + featurePrefix, featureNS);
|
||||
}
|
||||
const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context));
|
||||
item.node = node;
|
||||
@@ -619,7 +607,7 @@ function writeQuery(node, featureType, objectStack) {
|
||||
objectStack);
|
||||
const filter = context['filter'];
|
||||
if (filter) {
|
||||
const child = createElementNS(WFS.OGCNS, 'Filter');
|
||||
const child = createElementNS(OGCNS, 'Filter');
|
||||
node.appendChild(child);
|
||||
writeFilterCondition(child, filter, objectStack);
|
||||
}
|
||||
@@ -704,7 +692,7 @@ function writeWithinFilter(node, filter, objectStack) {
|
||||
*/
|
||||
function writeDuringFilter(node, filter, objectStack) {
|
||||
|
||||
const valueReference = createElementNS(WFS.FESNS, 'ValueReference');
|
||||
const valueReference = createElementNS(FESNS, 'ValueReference');
|
||||
XSD.writeStringTextNode(valueReference, filter.propertyName);
|
||||
node.appendChild(valueReference);
|
||||
|
||||
@@ -789,11 +777,11 @@ function writeIsNullFilter(node, filter, objectStack) {
|
||||
function writeIsBetweenFilter(node, filter, objectStack) {
|
||||
writeOgcPropertyName(node, filter.propertyName);
|
||||
|
||||
const lowerBoundary = createElementNS(WFS.OGCNS, 'LowerBoundary');
|
||||
const lowerBoundary = createElementNS(OGCNS, 'LowerBoundary');
|
||||
node.appendChild(lowerBoundary);
|
||||
writeOgcLiteral(lowerBoundary, '' + filter.lowerBoundary);
|
||||
|
||||
const upperBoundary = createElementNS(WFS.OGCNS, 'UpperBoundary');
|
||||
const upperBoundary = createElementNS(OGCNS, 'UpperBoundary');
|
||||
node.appendChild(upperBoundary);
|
||||
writeOgcLiteral(upperBoundary, '' + filter.upperBoundary);
|
||||
}
|
||||
@@ -822,7 +810,7 @@ function writeIsLikeFilter(node, filter, objectStack) {
|
||||
* @param {string} value Value.
|
||||
*/
|
||||
function writeOgcExpression(tagName, node, value) {
|
||||
const property = createElementNS(WFS.OGCNS, tagName);
|
||||
const property = createElementNS(OGCNS, tagName);
|
||||
XSD.writeStringTextNode(property, value);
|
||||
node.appendChild(property);
|
||||
}
|
||||
@@ -867,11 +855,11 @@ function writeTimeInstant(node, time) {
|
||||
* @return {Node} Result.
|
||||
* @api
|
||||
*/
|
||||
WFS.writeFilter = function(filter) {
|
||||
const child = createElementNS(WFS.OGCNS, 'Filter');
|
||||
export function writeFilter(filter) {
|
||||
const child = createElementNS(OGCNS, 'Filter');
|
||||
writeFilterCondition(child, filter, []);
|
||||
return child;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -898,7 +886,7 @@ function writeGetFeature(node, featureTypes, objectStack) {
|
||||
* @api
|
||||
*/
|
||||
WFS.prototype.writeGetFeature = function(options) {
|
||||
const node = createElementNS(WFS.WFSNS, 'GetFeature');
|
||||
const node = createElementNS(WFSNS, 'GetFeature');
|
||||
node.setAttribute('service', 'WFS');
|
||||
node.setAttribute('version', '1.1.0');
|
||||
let filter;
|
||||
@@ -964,12 +952,10 @@ WFS.prototype.writeGetFeature = function(options) {
|
||||
* @return {Node} Result.
|
||||
* @api
|
||||
*/
|
||||
WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
options) {
|
||||
WFS.prototype.writeTransaction = function(inserts, updates, deletes, options) {
|
||||
const objectStack = [];
|
||||
const node = createElementNS(WFS.WFSNS, 'Transaction');
|
||||
const version = options.version ?
|
||||
options.version : WFS.DEFAULT_VERSION;
|
||||
const node = createElementNS(WFSNS, 'Transaction');
|
||||
const version = options.version ? options.version : DEFAULT_VERSION;
|
||||
const gmlVersion = version === '1.0.0' ? 2 : 3;
|
||||
node.setAttribute('service', 'WFS');
|
||||
node.setAttribute('version', version);
|
||||
@@ -982,10 +968,10 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
node.setAttribute('handle', options.handle);
|
||||
}
|
||||
}
|
||||
const schemaLocation = WFS.SCHEMA_LOCATIONS[version];
|
||||
const schemaLocation = SCHEMA_LOCATIONS[version];
|
||||
setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'xsi:schemaLocation', schemaLocation);
|
||||
const featurePrefix = options.featurePrefix ? options.featurePrefix : WFS.FEATURE_PREFIX;
|
||||
const featurePrefix = options.featurePrefix ? options.featurePrefix : FEATURE_PREFIX;
|
||||
if (inserts) {
|
||||
obj = {node: node, 'featureNS': options.featureNS,
|
||||
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/WMSCapabilities
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import XLink from '../format/XLink.js';
|
||||
import {readHref} from '../format/XLink.js';
|
||||
import XML from '../format/XML.js';
|
||||
import XSD from '../format/XSD.js';
|
||||
import {makeArrayPusher, makeObjectPropertyPusher, makeObjectPropertySetter,
|
||||
@@ -73,7 +73,7 @@ const SERVICE_PARSERS = makeStructureNS(
|
||||
'Title': makeObjectPropertySetter(XSD.readString),
|
||||
'Abstract': makeObjectPropertySetter(XSD.readString),
|
||||
'KeywordList': makeObjectPropertySetter(readKeywordList),
|
||||
'OnlineResource': makeObjectPropertySetter(XLink.readHref),
|
||||
'OnlineResource': makeObjectPropertySetter(readHref),
|
||||
'ContactInformation': makeObjectPropertySetter(readContactInformation),
|
||||
'Fees': makeObjectPropertySetter(XSD.readString),
|
||||
'AccessConstraints': makeObjectPropertySetter(XSD.readString),
|
||||
@@ -168,7 +168,7 @@ const LAYER_PARSERS = makeStructureNS(
|
||||
const ATTRIBUTION_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'Title': makeObjectPropertySetter(XSD.readString),
|
||||
'OnlineResource': makeObjectPropertySetter(XLink.readHref),
|
||||
'OnlineResource': makeObjectPropertySetter(readHref),
|
||||
'LogoURL': makeObjectPropertySetter(readSizedFormatOnlineresource)
|
||||
});
|
||||
|
||||
@@ -252,7 +252,7 @@ const STYLE_PARSERS = makeStructureNS(
|
||||
const FORMAT_ONLINERESOURCE_PARSERS =
|
||||
makeStructureNS(NAMESPACE_URIS, {
|
||||
'Format': makeObjectPropertySetter(XSD.readString),
|
||||
'OnlineResource': makeObjectPropertySetter(XLink.readHref)
|
||||
'OnlineResource': makeObjectPropertySetter(readHref)
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import {boundingExtent} from '../extent.js';
|
||||
import OWS from '../format/OWS.js';
|
||||
import XLink from '../format/XLink.js';
|
||||
import {readHref} from '../format/XLink.js';
|
||||
import XML from '../format/XML.js';
|
||||
import XSD from '../format/XSD.js';
|
||||
import {pushParseAndPop, makeStructureNS,
|
||||
@@ -344,7 +344,7 @@ function readWgs84BoundingBox(node, objectStack) {
|
||||
function readLegendUrl(node, objectStack) {
|
||||
const legend = {};
|
||||
legend['format'] = node.getAttribute('format');
|
||||
legend['href'] = XLink.readHref(node);
|
||||
legend['href'] = readHref(node);
|
||||
return legend;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @module ol/format/XLink
|
||||
*/
|
||||
const XLink = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,7 +14,6 @@ const NAMESPACE_URI = 'http://www.w3.org/1999/xlink';
|
||||
* @param {Node} node Node.
|
||||
* @return {boolean|undefined} Boolean.
|
||||
*/
|
||||
XLink.readHref = function(node) {
|
||||
export function readHref(node) {
|
||||
return node.getAttributeNS(NAMESPACE_URI, 'href');
|
||||
};
|
||||
export default XLink;
|
||||
}
|
||||
|
||||
@@ -81,10 +81,10 @@ inherits(Layer, BaseLayer);
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {boolean} The layer is visible at the given resolution.
|
||||
*/
|
||||
Layer.visibleAtResolution = function(layerState, resolution) {
|
||||
export function visibleAtResolution(layerState, resolution) {
|
||||
return layerState.visible && resolution >= layerState.minResolution &&
|
||||
resolution < layerState.maxResolution;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ import {listen, unlistenByKey} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {getWidth} from '../extent.js';
|
||||
import {TRUE} from '../functions.js';
|
||||
import Layer from '../layer/Layer.js';
|
||||
import {visibleAtResolution} from '../layer/Layer.js';
|
||||
import {getLayerRendererPlugins} from '../plugins.js';
|
||||
import {iconImageCache} from '../style.js';
|
||||
import _ol_transform_ from '../transform.js';
|
||||
@@ -139,8 +139,7 @@ MapRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameSta
|
||||
for (i = numLayers - 1; i >= 0; --i) {
|
||||
const layerState = layerStates[i];
|
||||
const layer = layerState.layer;
|
||||
if (Layer.visibleAtResolution(layerState, viewResolution) &&
|
||||
layerFilter.call(thisArg2, layer)) {
|
||||
if (visibleAtResolution(layerState, viewResolution) && layerFilter.call(thisArg2, layer)) {
|
||||
const layerRenderer = this.getLayerRenderer(layer);
|
||||
if (layer.getSource()) {
|
||||
result = layerRenderer.forEachFeatureAtCoordinate(
|
||||
@@ -337,7 +336,7 @@ MapRenderer.prototype.scheduleRemoveUnusedLayerRenderers = function(frameState)
|
||||
* @param {ol.LayerState} state2 Second layer state.
|
||||
* @return {number} The zIndex difference.
|
||||
*/
|
||||
MapRenderer.sortByZIndex = function(state1, state2) {
|
||||
export function sortByZIndex(state1, state2) {
|
||||
return state1.zIndex - state2.zIndex;
|
||||
};
|
||||
}
|
||||
export default MapRenderer;
|
||||
|
||||
@@ -8,12 +8,12 @@ import {inherits} from '../../index.js';
|
||||
import {stableSort} from '../../array.js';
|
||||
import {CLASS_UNSELECTABLE} from '../../css.js';
|
||||
import {createCanvasContext2D} from '../../dom.js';
|
||||
import Layer from '../../layer/Layer.js';
|
||||
import {visibleAtResolution} from '../../layer/Layer.js';
|
||||
import RenderEvent from '../../render/Event.js';
|
||||
import RenderEventType from '../../render/EventType.js';
|
||||
import _ol_render_canvas_ from '../../render/canvas.js';
|
||||
import CanvasImmediateRenderer from '../../render/canvas/Immediate.js';
|
||||
import MapRenderer from '../Map.js';
|
||||
import MapRenderer, {sortByZIndex} from '../Map.js';
|
||||
import RendererType from '../Type.js';
|
||||
import SourceState from '../../source/State.js';
|
||||
|
||||
@@ -166,7 +166,7 @@ CanvasMapRenderer.prototype.renderFrame = function(frameState) {
|
||||
this.dispatchComposeEvent_(RenderEventType.PRECOMPOSE, frameState);
|
||||
|
||||
const layerStatesArray = frameState.layerStatesArray;
|
||||
stableSort(layerStatesArray, MapRenderer.sortByZIndex);
|
||||
stableSort(layerStatesArray, sortByZIndex);
|
||||
|
||||
if (rotation) {
|
||||
context.save();
|
||||
@@ -179,7 +179,7 @@ CanvasMapRenderer.prototype.renderFrame = function(frameState) {
|
||||
layerState = layerStatesArray[i];
|
||||
layer = layerState.layer;
|
||||
layerRenderer = /** @type {ol.renderer.canvas.Layer} */ (this.getLayerRenderer(layer));
|
||||
if (!Layer.visibleAtResolution(layerState, viewResolution) ||
|
||||
if (!visibleAtResolution(layerState, viewResolution) ||
|
||||
layerState.sourceState != SourceState.READY) {
|
||||
continue;
|
||||
}
|
||||
@@ -223,8 +223,7 @@ CanvasMapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, ca
|
||||
for (i = numLayers - 1; i >= 0; --i) {
|
||||
const layerState = layerStates[i];
|
||||
const layer = layerState.layer;
|
||||
if (Layer.visibleAtResolution(layerState, viewResolution) &&
|
||||
layerFilter.call(thisArg2, layer)) {
|
||||
if (visibleAtResolution(layerState, viewResolution) && layerFilter.call(thisArg2, layer)) {
|
||||
const layerRenderer = /** @type {ol.renderer.canvas.Layer} */ (this.getLayerRenderer(layer));
|
||||
result = layerRenderer.forEachLayerAtCoordinate(
|
||||
coordinate, frameState, callback, thisArg);
|
||||
|
||||
@@ -21,6 +21,27 @@ import CanvasTileLayerRenderer from '../canvas/TileLayer.js';
|
||||
import {getSquaredTolerance as getSquaredRenderTolerance, renderFeature} from '../vector.js';
|
||||
import _ol_transform_ from '../../transform.js';
|
||||
|
||||
|
||||
/**
|
||||
* @type {!Object.<string, Array.<ol.render.ReplayType>>}
|
||||
*/
|
||||
const IMAGE_REPLAYS = {
|
||||
'image': [ReplayType.POLYGON, ReplayType.CIRCLE,
|
||||
ReplayType.LINE_STRING, ReplayType.IMAGE, ReplayType.TEXT],
|
||||
'hybrid': [ReplayType.POLYGON, ReplayType.LINE_STRING]
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @type {!Object.<string, Array.<ol.render.ReplayType>>}
|
||||
*/
|
||||
const VECTOR_REPLAYS = {
|
||||
'image': [ReplayType.DEFAULT],
|
||||
'hybrid': [ReplayType.IMAGE, ReplayType.TEXT, ReplayType.DEFAULT],
|
||||
'vector': _ol_render_replay_.ORDER
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.renderer.canvas.TileLayer}
|
||||
@@ -93,28 +114,6 @@ CanvasVectorTileLayerRenderer['create'] = function(mapRenderer, layer) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {!Object.<string, Array.<ol.render.ReplayType>>}
|
||||
*/
|
||||
CanvasVectorTileLayerRenderer.IMAGE_REPLAYS = {
|
||||
'image': [ReplayType.POLYGON, ReplayType.CIRCLE,
|
||||
ReplayType.LINE_STRING, ReplayType.IMAGE, ReplayType.TEXT],
|
||||
'hybrid': [ReplayType.POLYGON, ReplayType.LINE_STRING]
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {!Object.<string, Array.<ol.render.ReplayType>>}
|
||||
*/
|
||||
CanvasVectorTileLayerRenderer.VECTOR_REPLAYS = {
|
||||
'image': [ReplayType.DEFAULT],
|
||||
'hybrid': [ReplayType.IMAGE, ReplayType.TEXT, ReplayType.DEFAULT],
|
||||
'vector': _ol_render_replay_.ORDER
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -367,7 +366,7 @@ CanvasVectorTileLayerRenderer.prototype.postCompose = function(context, frameSta
|
||||
const declutterReplays = layer.getDeclutter() ? {} : null;
|
||||
const source = /** @type {ol.source.VectorTile} */ (layer.getSource());
|
||||
const renderMode = layer.getRenderMode();
|
||||
const replayTypes = CanvasVectorTileLayerRenderer.VECTOR_REPLAYS[renderMode];
|
||||
const replayTypes = VECTOR_REPLAYS[renderMode];
|
||||
const pixelRatio = frameState.pixelRatio;
|
||||
const rotation = frameState.viewState.rotation;
|
||||
const size = frameState.size;
|
||||
@@ -484,7 +483,7 @@ CanvasVectorTileLayerRenderer.prototype.renderTileImage_ = function(
|
||||
const layer = this.getLayer();
|
||||
const replayState = tile.getReplayState(layer);
|
||||
const revision = layer.getRevision();
|
||||
const replays = CanvasVectorTileLayerRenderer.IMAGE_REPLAYS[layer.getRenderMode()];
|
||||
const replays = IMAGE_REPLAYS[layer.getRenderMode()];
|
||||
if (replays && replayState.renderedTileRevision !== revision) {
|
||||
replayState.renderedTileRevision = revision;
|
||||
const tileCoord = tile.wrappedTileCoord;
|
||||
|
||||
@@ -12,7 +12,7 @@ import Layer from '../../layer/Layer.js';
|
||||
import RenderEvent from '../../render/Event.js';
|
||||
import RenderEventType from '../../render/EventType.js';
|
||||
import WebGLImmediateRenderer from '../../render/webgl/Immediate.js';
|
||||
import MapRenderer from '../Map.js';
|
||||
import MapRenderer, {sortByZIndex} from '../Map.js';
|
||||
import RendererType from '../Type.js';
|
||||
import SourceState from '../../source/State.js';
|
||||
import LRUCache from '../../structs/LRUCache.js';
|
||||
@@ -444,7 +444,7 @@ WebGLMapRenderer.prototype.renderFrame = function(frameState) {
|
||||
/** @type {Array.<ol.LayerState>} */
|
||||
const layerStatesToDraw = [];
|
||||
const layerStatesArray = frameState.layerStatesArray;
|
||||
stableSort(layerStatesArray, MapRenderer.sortByZIndex);
|
||||
stableSort(layerStatesArray, sortByZIndex);
|
||||
|
||||
const viewResolution = frameState.viewState.resolution;
|
||||
let i, ii, layerRenderer, layerState;
|
||||
|
||||
Reference in New Issue
Block a user