Merge pull request #7705 from fredj/rename

More renaming
This commit is contained in:
Frédéric Junod
2018-01-15 14:49:25 +01:00
committed by GitHub
44 changed files with 528 additions and 528 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import * as _ol_extent_ from '../src/ol/extent.js'; import * as _ol_extent_ from '../src/ol/extent.js';
import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js'; import WMTSCapabilities from '../src/ol/format/WMTSCapabilities.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
import {register} from '../src/ol/proj/proj4.js'; import {register} from '../src/ol/proj/proj4.js';
@@ -97,7 +97,7 @@ layers['wms21781'] = new TileLayer({
}) })
}); });
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
const url = 'https://map1.vis.earthdata.nasa.gov/wmts-arctic/' + const url = 'https://map1.vis.earthdata.nasa.gov/wmts-arctic/' +
'wmts.cgi?SERVICE=WMTS&request=GetCapabilities'; 'wmts.cgi?SERVICE=WMTS&request=GetCapabilities';
fetch(url).then(function(response) { fetch(url).then(function(response) {
+2 -2
View File
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
import GeoJSON from '../src/ol/format/GeoJSON.js'; import GeoJSON from '../src/ol/format/GeoJSON.js';
import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js';
import Select from '../src/ol/interaction/Select.js'; import Select from '../src/ol/interaction/Select.js';
import _ol_interaction_Translate_ from '../src/ol/interaction/Translate.js'; import Translate from '../src/ol/interaction/Translate.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import VectorLayer from '../src/ol/layer/Vector.js'; import VectorLayer from '../src/ol/layer/Vector.js';
import OSM from '../src/ol/source/OSM.js'; import OSM from '../src/ol/source/OSM.js';
@@ -23,7 +23,7 @@ const vector = new VectorLayer({
const select = new Select(); const select = new Select();
const translate = new _ol_interaction_Translate_({ const translate = new Translate({
features: select.getFeatures() features: select.getFeatures()
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js'; import WMTSCapabilities from '../src/ol/format/WMTSCapabilities.js';
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
fetch('data/WMTSCapabilities.xml').then(function(response) { fetch('data/WMTSCapabilities.xml').then(function(response) {
return response.text(); return response.text();
+2 -2
View File
@@ -1,6 +1,6 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js'; import WMTSCapabilities from '../src/ol/format/WMTSCapabilities.js';
import _ol_has_ from '../src/ol/has.js'; import _ol_has_ from '../src/ol/has.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import WMTS from '../src/ol/source/WMTS.js'; import WMTS from '../src/ol/source/WMTS.js';
@@ -26,7 +26,7 @@ const map = new Map({
fetch(capabilitiesUrl).then(function(response) { fetch(capabilitiesUrl).then(function(response) {
return response.text(); return response.text();
}).then(function(text) { }).then(function(text) {
const result = new _ol_format_WMTSCapabilities_().read(text); const result = new WMTSCapabilities().read(text);
const options = WMTS.optionsFromCapabilities(result, { const options = WMTS.optionsFromCapabilities(result, {
layer: layer, layer: layer,
matrixSet: 'google3857', matrixSet: 'google3857',
+2 -2
View File
@@ -1,11 +1,11 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import _ol_format_WMTSCapabilities_ from '../src/ol/format/WMTSCapabilities.js'; import WMTSCapabilities from '../src/ol/format/WMTSCapabilities.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js'; import OSM from '../src/ol/source/OSM.js';
import WMTS from '../src/ol/source/WMTS.js'; import WMTS from '../src/ol/source/WMTS.js';
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
let map; let map;
fetch('data/WMTSCapabilities.xml').then(function(response) { fetch('data/WMTSCapabilities.xml').then(function(response) {
+3 -3
View File
@@ -72,7 +72,7 @@ registerMultiple(PluginType.LAYER_RENDERER, [
* @fires ol.render.Event#precompose * @fires ol.render.Event#precompose
* @api * @api
*/ */
const _ol_CanvasMap_ = function(options) { const CanvasMap = function(options) {
options = _ol_obj_.assign({}, options); options = _ol_obj_.assign({}, options);
delete options.renderer; delete options.renderer;
if (!options.controls) { if (!options.controls) {
@@ -85,6 +85,6 @@ const _ol_CanvasMap_ = function(options) {
PluggableMap.call(this, options); PluggableMap.call(this, options);
}; };
inherits(_ol_CanvasMap_, PluggableMap); inherits(CanvasMap, PluggableMap);
export default _ol_CanvasMap_; export default CanvasMap;
+74 -74
View File
@@ -17,7 +17,7 @@ import _ol_xml_ from '../xml.js';
* @extends {ol.format.XML} * @extends {ol.format.XML}
* @api * @api
*/ */
const _ol_format_WMTSCapabilities_ = function() { const WMTSCapabilities = function() {
XML.call(this); XML.call(this);
/** /**
@@ -27,7 +27,7 @@ const _ol_format_WMTSCapabilities_ = function() {
this.owsParser_ = new OWS(); this.owsParser_ = new OWS();
}; };
inherits(_ol_format_WMTSCapabilities_, XML); inherits(WMTSCapabilities, XML);
/** /**
@@ -38,13 +38,13 @@ inherits(_ol_format_WMTSCapabilities_, XML);
* @return {Object} An object representing the WMTS capabilities. * @return {Object} An object representing the WMTS capabilities.
* @api * @api
*/ */
_ol_format_WMTSCapabilities_.prototype.read; WMTSCapabilities.prototype.read;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WMTSCapabilities_.prototype.readFromDocument = function(doc) { WMTSCapabilities.prototype.readFromDocument = function(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) { for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n); return this.readFromNode(n);
@@ -57,7 +57,7 @@ _ol_format_WMTSCapabilities_.prototype.readFromDocument = function(doc) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WMTSCapabilities_.prototype.readFromNode = function(node) { WMTSCapabilities.prototype.readFromNode = function(node) {
const version = node.getAttribute('version').trim(); const version = node.getAttribute('version').trim();
let WMTSCapabilityObject = this.owsParser_.readFromNode(node); let WMTSCapabilityObject = this.owsParser_.readFromNode(node);
if (!WMTSCapabilityObject) { if (!WMTSCapabilityObject) {
@@ -65,7 +65,7 @@ _ol_format_WMTSCapabilities_.prototype.readFromNode = function(node) {
} }
WMTSCapabilityObject['version'] = version; WMTSCapabilityObject['version'] = version;
WMTSCapabilityObject = _ol_xml_.pushParseAndPop(WMTSCapabilityObject, WMTSCapabilityObject = _ol_xml_.pushParseAndPop(WMTSCapabilityObject,
_ol_format_WMTSCapabilities_.PARSERS_, node, []); WMTSCapabilities.PARSERS_, node, []);
return WMTSCapabilityObject ? WMTSCapabilityObject : null; return WMTSCapabilityObject ? WMTSCapabilityObject : null;
}; };
@@ -76,9 +76,9 @@ _ol_format_WMTSCapabilities_.prototype.readFromNode = function(node) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Attribution object. * @return {Object|undefined} Attribution object.
*/ */
_ol_format_WMTSCapabilities_.readContents_ = function(node, objectStack) { WMTSCapabilities.readContents_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.CONTENTS_PARSERS_, node, objectStack); WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);
}; };
@@ -88,9 +88,9 @@ _ol_format_WMTSCapabilities_.readContents_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Layers object. * @return {Object|undefined} Layers object.
*/ */
_ol_format_WMTSCapabilities_.readLayer_ = function(node, objectStack) { WMTSCapabilities.readLayer_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.LAYER_PARSERS_, node, objectStack); WMTSCapabilities.LAYER_PARSERS_, node, objectStack);
}; };
@@ -100,9 +100,9 @@ _ol_format_WMTSCapabilities_.readLayer_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Tile Matrix Set object. * @return {Object|undefined} Tile Matrix Set object.
*/ */
_ol_format_WMTSCapabilities_.readTileMatrixSet_ = function(node, objectStack) { WMTSCapabilities.readTileMatrixSet_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_PARSERS_, node, objectStack); WMTSCapabilities.TMS_PARSERS_, node, objectStack);
}; };
@@ -112,9 +112,9 @@ _ol_format_WMTSCapabilities_.readTileMatrixSet_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Style object. * @return {Object|undefined} Style object.
*/ */
_ol_format_WMTSCapabilities_.readStyle_ = function(node, objectStack) { WMTSCapabilities.readStyle_ = function(node, objectStack) {
const style = _ol_xml_.pushParseAndPop({}, const style = _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.STYLE_PARSERS_, node, objectStack); WMTSCapabilities.STYLE_PARSERS_, node, objectStack);
if (!style) { if (!style) {
return undefined; return undefined;
} }
@@ -131,10 +131,10 @@ _ol_format_WMTSCapabilities_.readStyle_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Tile Matrix Set Link object. * @return {Object|undefined} Tile Matrix Set Link object.
*/ */
_ol_format_WMTSCapabilities_.readTileMatrixSetLink_ = function(node, WMTSCapabilities.readTileMatrixSetLink_ = function(node,
objectStack) { objectStack) {
return _ol_xml_.pushParseAndPop({}, return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_, node, objectStack); WMTSCapabilities.TMS_LINKS_PARSERS_, node, objectStack);
}; };
@@ -144,9 +144,9 @@ _ol_format_WMTSCapabilities_.readTileMatrixSetLink_ = function(node,
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Dimension object. * @return {Object|undefined} Dimension object.
*/ */
_ol_format_WMTSCapabilities_.readDimensions_ = function(node, objectStack) { WMTSCapabilities.readDimensions_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.DIMENSION_PARSERS_, node, objectStack); WMTSCapabilities.DIMENSION_PARSERS_, node, objectStack);
}; };
@@ -156,7 +156,7 @@ _ol_format_WMTSCapabilities_.readDimensions_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Resource URL object. * @return {Object|undefined} Resource URL object.
*/ */
_ol_format_WMTSCapabilities_.readResourceUrl_ = function(node, objectStack) { WMTSCapabilities.readResourceUrl_ = function(node, objectStack) {
const format = node.getAttribute('format'); const format = node.getAttribute('format');
const template = node.getAttribute('template'); const template = node.getAttribute('template');
const resourceType = node.getAttribute('resourceType'); const resourceType = node.getAttribute('resourceType');
@@ -180,9 +180,9 @@ _ol_format_WMTSCapabilities_.readResourceUrl_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} WGS84 BBox object. * @return {Object|undefined} WGS84 BBox object.
*/ */
_ol_format_WMTSCapabilities_.readWgs84BoundingBox_ = function(node, objectStack) { WMTSCapabilities.readWgs84BoundingBox_ = function(node, objectStack) {
const coordinates = _ol_xml_.pushParseAndPop([], const coordinates = _ol_xml_.pushParseAndPop([],
_ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_, node, objectStack); WMTSCapabilities.WGS84_BBOX_READERS_, node, objectStack);
if (coordinates.length != 2) { if (coordinates.length != 2) {
return undefined; return undefined;
} }
@@ -196,7 +196,7 @@ _ol_format_WMTSCapabilities_.readWgs84BoundingBox_ = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Legend object. * @return {Object|undefined} Legend object.
*/ */
_ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) { WMTSCapabilities.readLegendUrl_ = function(node, objectStack) {
const legend = {}; const legend = {};
legend['format'] = node.getAttribute('format'); legend['format'] = node.getAttribute('format');
legend['href'] = XLink.readHref(node); legend['href'] = XLink.readHref(node);
@@ -210,7 +210,7 @@ _ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Coordinates object. * @return {Object|undefined} Coordinates object.
*/ */
_ol_format_WMTSCapabilities_.readCoordinates_ = function(node, objectStack) { WMTSCapabilities.readCoordinates_ = function(node, objectStack) {
const coordinates = XSD.readString(node).split(' '); const coordinates = XSD.readString(node).split(' ');
if (!coordinates || coordinates.length != 2) { if (!coordinates || coordinates.length != 2) {
return undefined; return undefined;
@@ -230,9 +230,9 @@ _ol_format_WMTSCapabilities_.readCoordinates_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrix object. * @return {Object|undefined} TileMatrix object.
*/ */
_ol_format_WMTSCapabilities_.readTileMatrix_ = function(node, objectStack) { WMTSCapabilities.readTileMatrix_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TM_PARSERS_, node, objectStack); WMTSCapabilities.TM_PARSERS_, node, objectStack);
}; };
@@ -242,10 +242,10 @@ _ol_format_WMTSCapabilities_.readTileMatrix_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixSetLimits Object. * @return {Object|undefined} TileMatrixSetLimits Object.
*/ */
_ol_format_WMTSCapabilities_.readTileMatrixLimitsList_ = function(node, WMTSCapabilities.readTileMatrixLimitsList_ = function(node,
objectStack) { objectStack) {
return _ol_xml_.pushParseAndPop([], return _ol_xml_.pushParseAndPop([],
_ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_, node, WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_, node,
objectStack); objectStack);
}; };
@@ -256,9 +256,9 @@ _ol_format_WMTSCapabilities_.readTileMatrixLimitsList_ = function(node,
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixLimits Array. * @return {Object|undefined} TileMatrixLimits Array.
*/ */
_ol_format_WMTSCapabilities_.readTileMatrixLimits_ = function(node, objectStack) { WMTSCapabilities.readTileMatrixLimits_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, return _ol_xml_.pushParseAndPop({},
_ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_, node, objectStack); WMTSCapabilities.TMS_LIMITS_PARSERS_, node, objectStack);
}; };
@@ -267,7 +267,7 @@ _ol_format_WMTSCapabilities_.readTileMatrixLimits_ = function(node, objectStack)
* @private * @private
* @type {Array.<string>} * @type {Array.<string>}
*/ */
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_ = [ WMTSCapabilities.NAMESPACE_URIS_ = [
null, null,
'http://www.opengis.net/wmts/1.0' 'http://www.opengis.net/wmts/1.0'
]; ];
@@ -278,7 +278,7 @@ _ol_format_WMTSCapabilities_.NAMESPACE_URIS_ = [
* @private * @private
* @type {Array.<string>} * @type {Array.<string>}
*/ */
_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_ = [ WMTSCapabilities.OWS_NAMESPACE_URIS_ = [
null, null,
'http://www.opengis.net/ows/1.1' 'http://www.opengis.net/ows/1.1'
]; ];
@@ -289,10 +289,10 @@ _ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'Contents': _ol_xml_.makeObjectPropertySetter( 'Contents': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readContents_) WMTSCapabilities.readContents_)
}); });
@@ -301,12 +301,12 @@ _ol_format_WMTSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.CONTENTS_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.CONTENTS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'Layer': _ol_xml_.makeObjectPropertyPusher( 'Layer': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readLayer_), WMTSCapabilities.readLayer_),
'TileMatrixSet': _ol_xml_.makeObjectPropertyPusher( 'TileMatrixSet': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSet_) WMTSCapabilities.readTileMatrixSet_)
}); });
@@ -315,25 +315,25 @@ _ol_format_WMTSCapabilities_.CONTENTS_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'Style': _ol_xml_.makeObjectPropertyPusher( 'Style': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readStyle_), WMTSCapabilities.readStyle_),
'Format': _ol_xml_.makeObjectPropertyPusher( 'Format': _ol_xml_.makeObjectPropertyPusher(
XSD.readString), XSD.readString),
'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher( 'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSetLink_), WMTSCapabilities.readTileMatrixSetLink_),
'Dimension': _ol_xml_.makeObjectPropertyPusher( 'Dimension': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readDimensions_), WMTSCapabilities.readDimensions_),
'ResourceURL': _ol_xml_.makeObjectPropertyPusher( 'ResourceURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readResourceUrl_) WMTSCapabilities.readResourceUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter( 'Title': _ol_xml_.makeObjectPropertySetter(
XSD.readString), XSD.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter( 'Abstract': _ol_xml_.makeObjectPropertySetter(
XSD.readString), XSD.readString),
'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter( 'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readWgs84BoundingBox_), WMTSCapabilities.readWgs84BoundingBox_),
'Identifier': _ol_xml_.makeObjectPropertySetter( 'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString) XSD.readString)
})); }));
@@ -344,11 +344,11 @@ _ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'LegendURL': _ol_xml_.makeObjectPropertyPusher( 'LegendURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readLegendUrl_) WMTSCapabilities.readLegendUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter( 'Title': _ol_xml_.makeObjectPropertySetter(
XSD.readString), XSD.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter( 'Identifier': _ol_xml_.makeObjectPropertySetter(
@@ -361,12 +361,12 @@ _ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrixSet': _ol_xml_.makeObjectPropertySetter( 'TileMatrixSet': _ol_xml_.makeObjectPropertySetter(
XSD.readString), XSD.readString),
'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter( 'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readTileMatrixLimitsList_) WMTSCapabilities.readTileMatrixLimitsList_)
}); });
/** /**
@@ -374,10 +374,10 @@ _ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrixLimits': _ol_xml_.makeArrayPusher( 'TileMatrixLimits': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readTileMatrixLimits_) WMTSCapabilities.readTileMatrixLimits_)
}); });
@@ -386,8 +386,8 @@ _ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrix': _ol_xml_.makeObjectPropertySetter( 'TileMatrix': _ol_xml_.makeObjectPropertySetter(
XSD.readString), XSD.readString),
'MinTileRow': _ol_xml_.makeObjectPropertySetter( 'MinTileRow': _ol_xml_.makeObjectPropertySetter(
@@ -406,13 +406,13 @@ _ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'Default': _ol_xml_.makeObjectPropertySetter( 'Default': _ol_xml_.makeObjectPropertySetter(
XSD.readString), XSD.readString),
'Value': _ol_xml_.makeObjectPropertyPusher( 'Value': _ol_xml_.makeObjectPropertyPusher(
XSD.readString) XSD.readString)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter( 'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString) XSD.readString)
})); }));
@@ -423,12 +423,12 @@ _ol_format_WMTSCapabilities_.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'LowerCorner': _ol_xml_.makeArrayPusher( 'LowerCorner': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readCoordinates_), WMTSCapabilities.readCoordinates_),
'UpperCorner': _ol_xml_.makeArrayPusher( 'UpperCorner': _ol_xml_.makeArrayPusher(
_ol_format_WMTSCapabilities_.readCoordinates_) WMTSCapabilities.readCoordinates_)
}); });
@@ -437,13 +437,13 @@ _ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.TMS_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.TMS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter( 'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter(
XSD.readString), XSD.readString),
'TileMatrix': _ol_xml_.makeObjectPropertyPusher( 'TileMatrix': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrix_) WMTSCapabilities.readTileMatrix_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'SupportedCRS': _ol_xml_.makeObjectPropertySetter( 'SupportedCRS': _ol_xml_.makeObjectPropertySetter(
XSD.readString), XSD.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter( 'Identifier': _ol_xml_.makeObjectPropertySetter(
@@ -456,10 +456,10 @@ _ol_format_WMTSCapabilities_.TMS_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMTSCapabilities_.TM_PARSERS_ = _ol_xml_.makeStructureNS( WMTSCapabilities.TM_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { WMTSCapabilities.NAMESPACE_URIS_, {
'TopLeftCorner': _ol_xml_.makeObjectPropertySetter( 'TopLeftCorner': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readCoordinates_), WMTSCapabilities.readCoordinates_),
'ScaleDenominator': _ol_xml_.makeObjectPropertySetter( 'ScaleDenominator': _ol_xml_.makeObjectPropertySetter(
XSD.readDecimal), XSD.readDecimal),
'TileWidth': _ol_xml_.makeObjectPropertySetter( 'TileWidth': _ol_xml_.makeObjectPropertySetter(
@@ -470,8 +470,8 @@ _ol_format_WMTSCapabilities_.TM_PARSERS_ = _ol_xml_.makeStructureNS(
XSD.readNonNegativeInteger), XSD.readNonNegativeInteger),
'MatrixHeight': _ol_xml_.makeObjectPropertySetter( 'MatrixHeight': _ol_xml_.makeObjectPropertySetter(
XSD.readNonNegativeInteger) XSD.readNonNegativeInteger)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter( 'Identifier': _ol_xml_.makeObjectPropertySetter(
XSD.readString) XSD.readString)
})); }));
export default _ol_format_WMTSCapabilities_; export default WMTSCapabilities;
+2 -2
View File
@@ -11,7 +11,7 @@ import {boundingExtent, getArea} from '../extent.js';
import GeometryType from '../geom/GeometryType.js'; import GeometryType from '../geom/GeometryType.js';
import Point from '../geom/Point.js'; import Point from '../geom/Point.js';
import {fromExtent as polygonFromExtent} from '../geom/Polygon.js'; import {fromExtent as polygonFromExtent} from '../geom/Polygon.js';
import _ol_interaction_ExtentEventType_ from '../interaction/ExtentEventType.js'; import ExtentEventType from '../interaction/ExtentEventType.js';
import PointerInteraction from '../interaction/Pointer.js'; import PointerInteraction from '../interaction/Pointer.js';
import VectorLayer from '../layer/Vector.js'; import VectorLayer from '../layer/Vector.js';
import VectorSource from '../source/Vector.js'; import VectorSource from '../source/Vector.js';
@@ -454,7 +454,7 @@ ExtentInteraction.prototype.setExtent = function(extent) {
* @extends {ol.events.Event} * @extends {ol.events.Event}
*/ */
ExtentInteraction.Event = function(extent) { ExtentInteraction.Event = function(extent) {
Event.call(this, _ol_interaction_ExtentEventType_.EXTENTCHANGED); Event.call(this, ExtentEventType.EXTENTCHANGED);
/** /**
* The current extent. * The current extent.
+24 -24
View File
@@ -22,12 +22,12 @@ import TranslateEventType from '../interaction/TranslateEventType.js';
* @param {olx.interaction.TranslateOptions=} opt_options Options. * @param {olx.interaction.TranslateOptions=} opt_options Options.
* @api * @api
*/ */
const _ol_interaction_Translate_ = function(opt_options) { const Translate = function(opt_options) {
PointerInteraction.call(this, { PointerInteraction.call(this, {
handleDownEvent: _ol_interaction_Translate_.handleDownEvent_, handleDownEvent: Translate.handleDownEvent_,
handleDragEvent: _ol_interaction_Translate_.handleDragEvent_, handleDragEvent: Translate.handleDragEvent_,
handleMoveEvent: _ol_interaction_Translate_.handleMoveEvent_, handleMoveEvent: Translate.handleMoveEvent_,
handleUpEvent: _ol_interaction_Translate_.handleUpEvent_ handleUpEvent: Translate.handleUpEvent_
}); });
const options = opt_options ? opt_options : {}; const options = opt_options ? opt_options : {};
@@ -85,7 +85,7 @@ const _ol_interaction_Translate_ = function(opt_options) {
}; };
inherits(_ol_interaction_Translate_, PointerInteraction); inherits(Translate, PointerInteraction);
/** /**
@@ -94,16 +94,16 @@ inherits(_ol_interaction_Translate_, PointerInteraction);
* @this {ol.interaction.Translate} * @this {ol.interaction.Translate}
* @private * @private
*/ */
_ol_interaction_Translate_.handleDownEvent_ = function(event) { Translate.handleDownEvent_ = function(event) {
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map); this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
if (!this.lastCoordinate_ && this.lastFeature_) { if (!this.lastCoordinate_ && this.lastFeature_) {
this.lastCoordinate_ = event.coordinate; this.lastCoordinate_ = event.coordinate;
_ol_interaction_Translate_.handleMoveEvent_.call(this, event); Translate.handleMoveEvent_.call(this, event);
const features = this.features_ || new Collection([this.lastFeature_]); const features = this.features_ || new Collection([this.lastFeature_]);
this.dispatchEvent( this.dispatchEvent(
new _ol_interaction_Translate_.Event( new Translate.Event(
TranslateEventType.TRANSLATESTART, features, TranslateEventType.TRANSLATESTART, features,
event.coordinate)); event.coordinate));
return true; return true;
@@ -118,15 +118,15 @@ _ol_interaction_Translate_.handleDownEvent_ = function(event) {
* @this {ol.interaction.Translate} * @this {ol.interaction.Translate}
* @private * @private
*/ */
_ol_interaction_Translate_.handleUpEvent_ = function(event) { Translate.handleUpEvent_ = function(event) {
if (this.lastCoordinate_) { if (this.lastCoordinate_) {
this.lastCoordinate_ = null; this.lastCoordinate_ = null;
_ol_interaction_Translate_.handleMoveEvent_.call(this, event); Translate.handleMoveEvent_.call(this, event);
const features = this.features_ || new Collection([this.lastFeature_]); const features = this.features_ || new Collection([this.lastFeature_]);
this.dispatchEvent( this.dispatchEvent(
new _ol_interaction_Translate_.Event( new Translate.Event(
TranslateEventType.TRANSLATEEND, features, TranslateEventType.TRANSLATEEND, features,
event.coordinate)); event.coordinate));
return true; return true;
@@ -140,7 +140,7 @@ _ol_interaction_Translate_.handleUpEvent_ = function(event) {
* @this {ol.interaction.Translate} * @this {ol.interaction.Translate}
* @private * @private
*/ */
_ol_interaction_Translate_.handleDragEvent_ = function(event) { Translate.handleDragEvent_ = function(event) {
if (this.lastCoordinate_) { if (this.lastCoordinate_) {
const newCoordinate = event.coordinate; const newCoordinate = event.coordinate;
const deltaX = newCoordinate[0] - this.lastCoordinate_[0]; const deltaX = newCoordinate[0] - this.lastCoordinate_[0];
@@ -156,7 +156,7 @@ _ol_interaction_Translate_.handleDragEvent_ = function(event) {
this.lastCoordinate_ = newCoordinate; this.lastCoordinate_ = newCoordinate;
this.dispatchEvent( this.dispatchEvent(
new _ol_interaction_Translate_.Event( new Translate.Event(
TranslateEventType.TRANSLATING, features, TranslateEventType.TRANSLATING, features,
newCoordinate)); newCoordinate));
} }
@@ -168,7 +168,7 @@ _ol_interaction_Translate_.handleDragEvent_ = function(event) {
* @this {ol.interaction.Translate} * @this {ol.interaction.Translate}
* @private * @private
*/ */
_ol_interaction_Translate_.handleMoveEvent_ = function(event) { Translate.handleMoveEvent_ = function(event) {
const elem = event.map.getViewport(); const elem = event.map.getViewport();
// Change the cursor to grab/grabbing if hovering any of the features managed // Change the cursor to grab/grabbing if hovering any of the features managed
@@ -191,7 +191,7 @@ _ol_interaction_Translate_.handleMoveEvent_ = function(event) {
* coordinates. * coordinates.
* @private * @private
*/ */
_ol_interaction_Translate_.prototype.featuresAtPixel_ = function(pixel, map) { Translate.prototype.featuresAtPixel_ = function(pixel, map) {
return map.forEachFeatureAtPixel(pixel, return map.forEachFeatureAtPixel(pixel,
function(feature) { function(feature) {
if (!this.features_ || includes(this.features_.getArray(), feature)) { if (!this.features_ || includes(this.features_.getArray(), feature)) {
@@ -209,7 +209,7 @@ _ol_interaction_Translate_.prototype.featuresAtPixel_ = function(pixel, map) {
* @returns {number} Hit tolerance in pixels. * @returns {number} Hit tolerance in pixels.
* @api * @api
*/ */
_ol_interaction_Translate_.prototype.getHitTolerance = function() { Translate.prototype.getHitTolerance = function() {
return this.hitTolerance_; return this.hitTolerance_;
}; };
@@ -221,7 +221,7 @@ _ol_interaction_Translate_.prototype.getHitTolerance = function() {
* @param {number} hitTolerance Hit tolerance in pixels. * @param {number} hitTolerance Hit tolerance in pixels.
* @api * @api
*/ */
_ol_interaction_Translate_.prototype.setHitTolerance = function(hitTolerance) { Translate.prototype.setHitTolerance = function(hitTolerance) {
this.hitTolerance_ = hitTolerance; this.hitTolerance_ = hitTolerance;
}; };
@@ -229,7 +229,7 @@ _ol_interaction_Translate_.prototype.setHitTolerance = function(hitTolerance) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_Translate_.prototype.setMap = function(map) { Translate.prototype.setMap = function(map) {
const oldMap = this.getMap(); const oldMap = this.getMap();
PointerInteraction.prototype.setMap.call(this, map); PointerInteraction.prototype.setMap.call(this, map);
this.updateState_(oldMap); this.updateState_(oldMap);
@@ -239,7 +239,7 @@ _ol_interaction_Translate_.prototype.setMap = function(map) {
/** /**
* @private * @private
*/ */
_ol_interaction_Translate_.prototype.handleActiveChanged_ = function() { Translate.prototype.handleActiveChanged_ = function() {
this.updateState_(null); this.updateState_(null);
}; };
@@ -248,7 +248,7 @@ _ol_interaction_Translate_.prototype.handleActiveChanged_ = function() {
* @param {ol.PluggableMap} oldMap Old map. * @param {ol.PluggableMap} oldMap Old map.
* @private * @private
*/ */
_ol_interaction_Translate_.prototype.updateState_ = function(oldMap) { Translate.prototype.updateState_ = function(oldMap) {
let map = this.getMap(); let map = this.getMap();
const active = this.getActive(); const active = this.getActive();
if (!map || !active) { if (!map || !active) {
@@ -273,7 +273,7 @@ _ol_interaction_Translate_.prototype.updateState_ = function(oldMap) {
* @param {ol.Collection.<ol.Feature>} features The features translated. * @param {ol.Collection.<ol.Feature>} features The features translated.
* @param {ol.Coordinate} coordinate The event coordinate. * @param {ol.Coordinate} coordinate The event coordinate.
*/ */
_ol_interaction_Translate_.Event = function(type, features, coordinate) { Translate.Event = function(type, features, coordinate) {
Event.call(this, type); Event.call(this, type);
@@ -292,5 +292,5 @@ _ol_interaction_Translate_.Event = function(type, features, coordinate) {
*/ */
this.coordinate = coordinate; this.coordinate = coordinate;
}; };
inherits(_ol_interaction_Translate_.Event, Event); inherits(Translate.Event, Event);
export default _ol_interaction_Translate_; export default Translate;
+4 -4
View File
@@ -6,7 +6,7 @@
* @constructor * @constructor
* @abstract * @abstract
*/ */
const _ol_render_ReplayGroup_ = function() {}; const ReplayGroup = function() {};
/** /**
@@ -15,12 +15,12 @@ const _ol_render_ReplayGroup_ = function() {};
* @param {ol.render.ReplayType} replayType Replay type. * @param {ol.render.ReplayType} replayType Replay type.
* @return {ol.render.VectorContext} Replay. * @return {ol.render.VectorContext} Replay.
*/ */
_ol_render_ReplayGroup_.prototype.getReplay = function(zIndex, replayType) {}; ReplayGroup.prototype.getReplay = function(zIndex, replayType) {};
/** /**
* @abstract * @abstract
* @return {boolean} Is empty. * @return {boolean} Is empty.
*/ */
_ol_render_ReplayGroup_.prototype.isEmpty = function() {}; ReplayGroup.prototype.isEmpty = function() {};
export default _ol_render_ReplayGroup_; export default ReplayGroup;
+10 -10
View File
@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../../index.js'; import {inherits} from '../../index.js';
import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js';
import _ol_render_canvas_Replay_ from '../canvas/Replay.js'; import CanvasReplay from '../canvas/Replay.js';
/** /**
* @constructor * @constructor
@@ -16,9 +16,9 @@ import _ol_render_canvas_Replay_ from '../canvas/Replay.js';
* @param {?} declutterTree Declutter tree. * @param {?} declutterTree Declutter tree.
* @struct * @struct
*/ */
const _ol_render_canvas_ImageReplay_ = function( const CanvasImageReplay = function(
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) { tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
_ol_render_canvas_Replay_.call(this, CanvasReplay.call(this,
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree); tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree);
/** /**
@@ -107,7 +107,7 @@ const _ol_render_canvas_ImageReplay_ = function(
}; };
inherits(_ol_render_canvas_ImageReplay_, _ol_render_canvas_Replay_); inherits(CanvasImageReplay, CanvasReplay);
/** /**
@@ -118,7 +118,7 @@ inherits(_ol_render_canvas_ImageReplay_, _ol_render_canvas_Replay_);
* @private * @private
* @return {number} My end. * @return {number} My end.
*/ */
_ol_render_canvas_ImageReplay_.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) { CanvasImageReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
return this.appendFlatCoordinates( return this.appendFlatCoordinates(
flatCoordinates, offset, end, stride, false, false); flatCoordinates, offset, end, stride, false, false);
}; };
@@ -127,7 +127,7 @@ _ol_render_canvas_ImageReplay_.prototype.drawCoordinates_ = function(flatCoordin
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_ImageReplay_.prototype.drawPoint = function(pointGeometry, feature) { CanvasImageReplay.prototype.drawPoint = function(pointGeometry, feature) {
if (!this.image_) { if (!this.image_) {
return; return;
} }
@@ -159,7 +159,7 @@ _ol_render_canvas_ImageReplay_.prototype.drawPoint = function(pointGeometry, fea
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_ImageReplay_.prototype.drawMultiPoint = function(multiPointGeometry, feature) { CanvasImageReplay.prototype.drawMultiPoint = function(multiPointGeometry, feature) {
if (!this.image_) { if (!this.image_) {
return; return;
} }
@@ -191,7 +191,7 @@ _ol_render_canvas_ImageReplay_.prototype.drawMultiPoint = function(multiPointGeo
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_ImageReplay_.prototype.finish = function() { CanvasImageReplay.prototype.finish = function() {
this.reverseHitDetectionInstructions(); this.reverseHitDetectionInstructions();
// FIXME this doesn't really protect us against further calls to draw*Geometry // FIXME this doesn't really protect us against further calls to draw*Geometry
this.anchorX_ = undefined; this.anchorX_ = undefined;
@@ -213,7 +213,7 @@ _ol_render_canvas_ImageReplay_.prototype.finish = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_ImageReplay_.prototype.setImageStyle = function(imageStyle, declutterGroup) { CanvasImageReplay.prototype.setImageStyle = function(imageStyle, declutterGroup) {
const anchor = imageStyle.getAnchor(); const anchor = imageStyle.getAnchor();
const size = imageStyle.getSize(); const size = imageStyle.getSize();
const hitDetectionImage = imageStyle.getHitDetectionImage(1); const hitDetectionImage = imageStyle.getHitDetectionImage(1);
@@ -234,4 +234,4 @@ _ol_render_canvas_ImageReplay_.prototype.setImageStyle = function(imageStyle, de
this.snapToPixel_ = imageStyle.getSnapToPixel(); this.snapToPixel_ = imageStyle.getSnapToPixel();
this.width_ = size[0]; this.width_ = size[0];
}; };
export default _ol_render_canvas_ImageReplay_; export default CanvasImageReplay;
+11 -11
View File
@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../../index.js'; import {inherits} from '../../index.js';
import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js';
import _ol_render_canvas_Replay_ from '../canvas/Replay.js'; import CanvasReplay from '../canvas/Replay.js';
/** /**
* @constructor * @constructor
@@ -16,13 +16,13 @@ import _ol_render_canvas_Replay_ from '../canvas/Replay.js';
* @param {?} declutterTree Declutter tree. * @param {?} declutterTree Declutter tree.
* @struct * @struct
*/ */
const _ol_render_canvas_LineStringReplay_ = function( const CanvasLineStringReplay = function(
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) { tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
_ol_render_canvas_Replay_.call(this, CanvasReplay.call(this,
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree); tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree);
}; };
inherits(_ol_render_canvas_LineStringReplay_, _ol_render_canvas_Replay_); inherits(CanvasLineStringReplay, CanvasReplay);
/** /**
@@ -33,7 +33,7 @@ inherits(_ol_render_canvas_LineStringReplay_, _ol_render_canvas_Replay_);
* @private * @private
* @return {number} end. * @return {number} end.
*/ */
_ol_render_canvas_LineStringReplay_.prototype.drawFlatCoordinates_ = function(flatCoordinates, offset, end, stride) { CanvasLineStringReplay.prototype.drawFlatCoordinates_ = function(flatCoordinates, offset, end, stride) {
const myBegin = this.coordinates.length; const myBegin = this.coordinates.length;
const myEnd = this.appendFlatCoordinates( const myEnd = this.appendFlatCoordinates(
flatCoordinates, offset, end, stride, false, false); flatCoordinates, offset, end, stride, false, false);
@@ -48,7 +48,7 @@ _ol_render_canvas_LineStringReplay_.prototype.drawFlatCoordinates_ = function(fl
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_LineStringReplay_.prototype.drawLineString = function(lineStringGeometry, feature) { CanvasLineStringReplay.prototype.drawLineString = function(lineStringGeometry, feature) {
const state = this.state; const state = this.state;
const strokeStyle = state.strokeStyle; const strokeStyle = state.strokeStyle;
const lineWidth = state.lineWidth; const lineWidth = state.lineWidth;
@@ -75,7 +75,7 @@ _ol_render_canvas_LineStringReplay_.prototype.drawLineString = function(lineStri
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_LineStringReplay_.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) { CanvasLineStringReplay.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) {
const state = this.state; const state = this.state;
const strokeStyle = state.strokeStyle; const strokeStyle = state.strokeStyle;
const lineWidth = state.lineWidth; const lineWidth = state.lineWidth;
@@ -108,7 +108,7 @@ _ol_render_canvas_LineStringReplay_.prototype.drawMultiLineString = function(mul
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_LineStringReplay_.prototype.finish = function() { CanvasLineStringReplay.prototype.finish = function() {
const state = this.state; const state = this.state;
if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) { if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) {
this.instructions.push([_ol_render_canvas_Instruction_.STROKE]); this.instructions.push([_ol_render_canvas_Instruction_.STROKE]);
@@ -121,13 +121,13 @@ _ol_render_canvas_LineStringReplay_.prototype.finish = function() {
/** /**
* @inheritDoc. * @inheritDoc.
*/ */
_ol_render_canvas_LineStringReplay_.prototype.applyStroke = function(state) { CanvasLineStringReplay.prototype.applyStroke = function(state) {
if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) { if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) {
this.instructions.push([_ol_render_canvas_Instruction_.STROKE]); this.instructions.push([_ol_render_canvas_Instruction_.STROKE]);
state.lastStroke = this.coordinates.length; state.lastStroke = this.coordinates.length;
} }
state.lastStroke = 0; state.lastStroke = 0;
_ol_render_canvas_Replay_.prototype.applyStroke.call(this, state); CanvasReplay.prototype.applyStroke.call(this, state);
this.instructions.push([_ol_render_canvas_Instruction_.BEGIN_PATH]); this.instructions.push([_ol_render_canvas_Instruction_.BEGIN_PATH]);
}; };
export default _ol_render_canvas_LineStringReplay_; export default CanvasLineStringReplay;
+11 -11
View File
@@ -6,7 +6,7 @@ import {asString} from '../../color.js';
import _ol_geom_flat_simplify_ from '../../geom/flat/simplify.js'; import _ol_geom_flat_simplify_ from '../../geom/flat/simplify.js';
import _ol_render_canvas_ from '../canvas.js'; import _ol_render_canvas_ from '../canvas.js';
import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js';
import _ol_render_canvas_Replay_ from '../canvas/Replay.js'; import CanvasReplay from '../canvas/Replay.js';
/** /**
* @constructor * @constructor
@@ -19,13 +19,13 @@ import _ol_render_canvas_Replay_ from '../canvas/Replay.js';
* @param {?} declutterTree Declutter tree. * @param {?} declutterTree Declutter tree.
* @struct * @struct
*/ */
const _ol_render_canvas_PolygonReplay_ = function( const CanvasPolygonReplay = function(
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) { tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
_ol_render_canvas_Replay_.call(this, CanvasReplay.call(this,
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree); tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree);
}; };
inherits(_ol_render_canvas_PolygonReplay_, _ol_render_canvas_Replay_); inherits(CanvasPolygonReplay, CanvasReplay);
/** /**
@@ -36,7 +36,7 @@ inherits(_ol_render_canvas_PolygonReplay_, _ol_render_canvas_Replay_);
* @private * @private
* @return {number} End. * @return {number} End.
*/ */
_ol_render_canvas_PolygonReplay_.prototype.drawFlatCoordinatess_ = function(flatCoordinates, offset, ends, stride) { CanvasPolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCoordinates, offset, ends, stride) {
const state = this.state; const state = this.state;
const fill = state.fillStyle !== undefined; const fill = state.fillStyle !== undefined;
const stroke = state.strokeStyle != undefined; const stroke = state.strokeStyle != undefined;
@@ -79,7 +79,7 @@ _ol_render_canvas_PolygonReplay_.prototype.drawFlatCoordinatess_ = function(flat
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_PolygonReplay_.prototype.drawCircle = function(circleGeometry, feature) { CanvasPolygonReplay.prototype.drawCircle = function(circleGeometry, feature) {
const state = this.state; const state = this.state;
const fillStyle = state.fillStyle; const fillStyle = state.fillStyle;
const strokeStyle = state.strokeStyle; const strokeStyle = state.strokeStyle;
@@ -126,7 +126,7 @@ _ol_render_canvas_PolygonReplay_.prototype.drawCircle = function(circleGeometry,
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_PolygonReplay_.prototype.drawPolygon = function(polygonGeometry, feature) { CanvasPolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) {
const state = this.state; const state = this.state;
this.setFillStrokeStyles_(polygonGeometry); this.setFillStrokeStyles_(polygonGeometry);
this.beginGeometry(polygonGeometry, feature); this.beginGeometry(polygonGeometry, feature);
@@ -153,7 +153,7 @@ _ol_render_canvas_PolygonReplay_.prototype.drawPolygon = function(polygonGeometr
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_PolygonReplay_.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) { CanvasPolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) {
const state = this.state; const state = this.state;
const fillStyle = state.fillStyle; const fillStyle = state.fillStyle;
const strokeStyle = state.strokeStyle; const strokeStyle = state.strokeStyle;
@@ -190,7 +190,7 @@ _ol_render_canvas_PolygonReplay_.prototype.drawMultiPolygon = function(multiPoly
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_PolygonReplay_.prototype.finish = function() { CanvasPolygonReplay.prototype.finish = function() {
this.reverseHitDetectionInstructions(); this.reverseHitDetectionInstructions();
this.state = null; this.state = null;
// We want to preserve topology when drawing polygons. Polygons are // We want to preserve topology when drawing polygons. Polygons are
@@ -212,7 +212,7 @@ _ol_render_canvas_PolygonReplay_.prototype.finish = function() {
* @private * @private
* @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry. * @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry.
*/ */
_ol_render_canvas_PolygonReplay_.prototype.setFillStrokeStyles_ = function(geometry) { CanvasPolygonReplay.prototype.setFillStrokeStyles_ = function(geometry) {
const state = this.state; const state = this.state;
const fillStyle = state.fillStyle; const fillStyle = state.fillStyle;
if (fillStyle !== undefined) { if (fillStyle !== undefined) {
@@ -222,4 +222,4 @@ _ol_render_canvas_PolygonReplay_.prototype.setFillStrokeStyles_ = function(geome
this.updateStrokeStyle(state, this.applyStroke); this.updateStrokeStyle(state, this.applyStroke);
} }
}; };
export default _ol_render_canvas_PolygonReplay_; export default CanvasPolygonReplay;
+26 -26
View File
@@ -31,7 +31,7 @@ import _ol_transform_ from '../../transform.js';
* @param {?} declutterTree Declutter tree. * @param {?} declutterTree Declutter tree.
* @struct * @struct
*/ */
const _ol_render_canvas_Replay_ = function(tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) { const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
VectorContext.call(this); VectorContext.call(this);
/** /**
@@ -168,7 +168,7 @@ const _ol_render_canvas_Replay_ = function(tolerance, maxExtent, resolution, pix
this.resetTransform_ = _ol_transform_.create(); this.resetTransform_ = _ol_transform_.create();
}; };
inherits(_ol_render_canvas_Replay_, VectorContext); inherits(CanvasReplay, VectorContext);
/** /**
@@ -180,7 +180,7 @@ inherits(_ol_render_canvas_Replay_, VectorContext);
* @param {Array.<*>} fillInstruction Fill instruction. * @param {Array.<*>} fillInstruction Fill instruction.
* @param {Array.<*>} strokeInstruction Stroke instruction. * @param {Array.<*>} strokeInstruction Stroke instruction.
*/ */
_ol_render_canvas_Replay_.prototype.replayTextBackground_ = function(context, p1, p2, p3, p4, CanvasReplay.prototype.replayTextBackground_ = function(context, p1, p2, p3, p4,
fillInstruction, strokeInstruction) { fillInstruction, strokeInstruction) {
context.beginPath(); context.beginPath();
context.moveTo.apply(context, p1); context.moveTo.apply(context, p1);
@@ -219,7 +219,7 @@ _ol_render_canvas_Replay_.prototype.replayTextBackground_ = function(context, p1
* @param {Array.<*>} fillInstruction Fill instruction. * @param {Array.<*>} fillInstruction Fill instruction.
* @param {Array.<*>} strokeInstruction Stroke instruction. * @param {Array.<*>} strokeInstruction Stroke instruction.
*/ */
_ol_render_canvas_Replay_.prototype.replayImage_ = function(context, x, y, image, CanvasReplay.prototype.replayImage_ = function(context, x, y, image,
anchorX, anchorY, declutterGroup, height, opacity, originX, originY, anchorX, anchorY, declutterGroup, height, opacity, originX, originY,
rotation, scale, snapToPixel, width, padding, fillInstruction, strokeInstruction) { rotation, scale, snapToPixel, width, padding, fillInstruction, strokeInstruction) {
const fillStroke = fillInstruction || strokeInstruction; const fillStroke = fillInstruction || strokeInstruction;
@@ -306,7 +306,7 @@ _ol_render_canvas_Replay_.prototype.replayImage_ = function(context, x, y, image
* @param {Array.<number>} dashArray Dash array. * @param {Array.<number>} dashArray Dash array.
* @return {Array.<number>} Dash array with pixel ratio applied * @return {Array.<number>} Dash array with pixel ratio applied
*/ */
_ol_render_canvas_Replay_.prototype.applyPixelRatio = function(dashArray) { CanvasReplay.prototype.applyPixelRatio = function(dashArray) {
const pixelRatio = this.pixelRatio; const pixelRatio = this.pixelRatio;
return pixelRatio == 1 ? dashArray : dashArray.map(function(dash) { return pixelRatio == 1 ? dashArray : dashArray.map(function(dash) {
return dash * pixelRatio; return dash * pixelRatio;
@@ -324,7 +324,7 @@ _ol_render_canvas_Replay_.prototype.applyPixelRatio = function(dashArray) {
* @protected * @protected
* @return {number} My end. * @return {number} My end.
*/ */
_ol_render_canvas_Replay_.prototype.appendFlatCoordinates = function(flatCoordinates, offset, end, stride, closed, skipFirst) { CanvasReplay.prototype.appendFlatCoordinates = function(flatCoordinates, offset, end, stride, closed, skipFirst) {
let myEnd = this.coordinates.length; let myEnd = this.coordinates.length;
const extent = this.getBufferedMaxExtent(); const extent = this.getBufferedMaxExtent();
@@ -377,7 +377,7 @@ _ol_render_canvas_Replay_.prototype.appendFlatCoordinates = function(flatCoordin
* @param {Array.<number>} replayEnds Replay ends. * @param {Array.<number>} replayEnds Replay ends.
* @return {number} Offset. * @return {number} Offset.
*/ */
_ol_render_canvas_Replay_.prototype.drawCustomCoordinates_ = function(flatCoordinates, offset, ends, stride, replayEnds) { CanvasReplay.prototype.drawCustomCoordinates_ = function(flatCoordinates, offset, ends, stride, replayEnds) {
for (let i = 0, ii = ends.length; i < ii; ++i) { for (let i = 0, ii = ends.length; i < ii; ++i) {
const end = ends[i]; const end = ends[i];
const replayEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false); const replayEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false);
@@ -391,7 +391,7 @@ _ol_render_canvas_Replay_.prototype.drawCustomCoordinates_ = function(flatCoordi
/** /**
* @inheritDoc. * @inheritDoc.
*/ */
_ol_render_canvas_Replay_.prototype.drawCustom = function(geometry, feature, renderer) { CanvasReplay.prototype.drawCustom = function(geometry, feature, renderer) {
this.beginGeometry(geometry, feature); this.beginGeometry(geometry, feature);
const type = geometry.getType(); const type = geometry.getType();
const stride = geometry.getStride(); const stride = geometry.getStride();
@@ -443,7 +443,7 @@ _ol_render_canvas_Replay_.prototype.drawCustom = function(geometry, feature, ren
* @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry. * @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry.
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
*/ */
_ol_render_canvas_Replay_.prototype.beginGeometry = function(geometry, feature) { CanvasReplay.prototype.beginGeometry = function(geometry, feature) {
this.beginGeometryInstruction1_ = this.beginGeometryInstruction1_ =
[_ol_render_canvas_Instruction_.BEGIN_GEOMETRY, feature, 0]; [_ol_render_canvas_Instruction_.BEGIN_GEOMETRY, feature, 0];
this.instructions.push(this.beginGeometryInstruction1_); this.instructions.push(this.beginGeometryInstruction1_);
@@ -457,7 +457,7 @@ _ol_render_canvas_Replay_.prototype.beginGeometry = function(geometry, feature)
* @private * @private
* @param {CanvasRenderingContext2D} context Context. * @param {CanvasRenderingContext2D} context Context.
*/ */
_ol_render_canvas_Replay_.prototype.fill_ = function(context) { CanvasReplay.prototype.fill_ = function(context) {
if (this.fillOrigin_) { if (this.fillOrigin_) {
const origin = _ol_transform_.apply(this.renderedTransform_, this.fillOrigin_.slice()); const origin = _ol_transform_.apply(this.renderedTransform_, this.fillOrigin_.slice());
context.translate(origin[0], origin[1]); context.translate(origin[0], origin[1]);
@@ -475,7 +475,7 @@ _ol_render_canvas_Replay_.prototype.fill_ = function(context) {
* @param {CanvasRenderingContext2D} context Context. * @param {CanvasRenderingContext2D} context Context.
* @param {Array.<*>} instruction Instruction. * @param {Array.<*>} instruction Instruction.
*/ */
_ol_render_canvas_Replay_.prototype.setStrokeStyle_ = function(context, instruction) { CanvasReplay.prototype.setStrokeStyle_ = function(context, instruction) {
context.strokeStyle = /** @type {ol.ColorLike} */ (instruction[1]); context.strokeStyle = /** @type {ol.ColorLike} */ (instruction[1]);
context.lineWidth = /** @type {number} */ (instruction[2]); context.lineWidth = /** @type {number} */ (instruction[2]);
context.lineCap = /** @type {string} */ (instruction[3]); context.lineCap = /** @type {string} */ (instruction[3]);
@@ -492,7 +492,7 @@ _ol_render_canvas_Replay_.prototype.setStrokeStyle_ = function(context, instruct
* @param {ol.DeclutterGroup} declutterGroup Declutter group. * @param {ol.DeclutterGroup} declutterGroup Declutter group.
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
*/ */
_ol_render_canvas_Replay_.prototype.renderDeclutter_ = function(declutterGroup, feature) { CanvasReplay.prototype.renderDeclutter_ = function(declutterGroup, feature) {
if (declutterGroup && declutterGroup.length > 5) { if (declutterGroup && declutterGroup.length > 5) {
const groupCount = declutterGroup[4]; const groupCount = declutterGroup[4];
if (groupCount == 1 || groupCount == declutterGroup.length - 5) { if (groupCount == 1 || groupCount == declutterGroup.length - 5) {
@@ -540,7 +540,7 @@ _ol_render_canvas_Replay_.prototype.renderDeclutter_ = function(declutterGroup,
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_canvas_Replay_.prototype.replay_ = function( CanvasReplay.prototype.replay_ = function(
context, transform, skippedFeaturesHash, context, transform, skippedFeaturesHash,
instructions, featureCallback, opt_hitExtent) { instructions, featureCallback, opt_hitExtent) {
/** @type {Array.<number>} */ /** @type {Array.<number>} */
@@ -852,7 +852,7 @@ _ol_render_canvas_Replay_.prototype.replay_ = function(
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip. * to skip.
*/ */
_ol_render_canvas_Replay_.prototype.replay = function( CanvasReplay.prototype.replay = function(
context, transform, viewRotation, skippedFeaturesHash) { context, transform, viewRotation, skippedFeaturesHash) {
this.viewRotation_ = viewRotation; this.viewRotation_ = viewRotation;
this.replay_(context, transform, this.replay_(context, transform,
@@ -873,7 +873,7 @@ _ol_render_canvas_Replay_.prototype.replay = function(
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_canvas_Replay_.prototype.replayHitDetection = function( CanvasReplay.prototype.replayHitDetection = function(
context, transform, viewRotation, skippedFeaturesHash, context, transform, viewRotation, skippedFeaturesHash,
opt_featureCallback, opt_hitExtent) { opt_featureCallback, opt_hitExtent) {
this.viewRotation_ = viewRotation; this.viewRotation_ = viewRotation;
@@ -885,7 +885,7 @@ _ol_render_canvas_Replay_.prototype.replayHitDetection = function(
/** /**
* Reverse the hit detection instructions. * Reverse the hit detection instructions.
*/ */
_ol_render_canvas_Replay_.prototype.reverseHitDetectionInstructions = function() { CanvasReplay.prototype.reverseHitDetectionInstructions = function() {
const hitDetectionInstructions = this.hitDetectionInstructions; const hitDetectionInstructions = this.hitDetectionInstructions;
// step 1 - reverse array // step 1 - reverse array
hitDetectionInstructions.reverse(); hitDetectionInstructions.reverse();
@@ -912,7 +912,7 @@ _ol_render_canvas_Replay_.prototype.reverseHitDetectionInstructions = function()
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_Replay_.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { CanvasReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
const state = this.state; const state = this.state;
if (fillStyle) { if (fillStyle) {
const fillStyleColor = fillStyle.getColor(); const fillStyleColor = fillStyle.getColor();
@@ -966,7 +966,7 @@ _ol_render_canvas_Replay_.prototype.setFillStrokeStyle = function(fillStyle, str
* @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry. * @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry.
* @return {Array.<*>} Fill instruction. * @return {Array.<*>} Fill instruction.
*/ */
_ol_render_canvas_Replay_.prototype.createFill = function(state, geometry) { CanvasReplay.prototype.createFill = function(state, geometry) {
const fillStyle = state.fillStyle; const fillStyle = state.fillStyle;
const fillInstruction = [_ol_render_canvas_Instruction_.SET_FILL_STYLE, fillStyle]; const fillInstruction = [_ol_render_canvas_Instruction_.SET_FILL_STYLE, fillStyle];
if (typeof fillStyle !== 'string') { if (typeof fillStyle !== 'string') {
@@ -980,7 +980,7 @@ _ol_render_canvas_Replay_.prototype.createFill = function(state, geometry) {
/** /**
* @param {ol.CanvasFillStrokeState} state State. * @param {ol.CanvasFillStrokeState} state State.
*/ */
_ol_render_canvas_Replay_.prototype.applyStroke = function(state) { CanvasReplay.prototype.applyStroke = function(state) {
this.instructions.push(this.createStroke(state)); this.instructions.push(this.createStroke(state));
}; };
@@ -989,7 +989,7 @@ _ol_render_canvas_Replay_.prototype.applyStroke = function(state) {
* @param {ol.CanvasFillStrokeState} state State. * @param {ol.CanvasFillStrokeState} state State.
* @return {Array.<*>} Stroke instruction. * @return {Array.<*>} Stroke instruction.
*/ */
_ol_render_canvas_Replay_.prototype.createStroke = function(state) { CanvasReplay.prototype.createStroke = function(state) {
return [ return [
_ol_render_canvas_Instruction_.SET_STROKE_STYLE, _ol_render_canvas_Instruction_.SET_STROKE_STYLE,
state.strokeStyle, state.lineWidth * this.pixelRatio, state.lineCap, state.strokeStyle, state.lineWidth * this.pixelRatio, state.lineCap,
@@ -1004,7 +1004,7 @@ _ol_render_canvas_Replay_.prototype.createStroke = function(state) {
* @param {function(this:ol.render.canvas.Replay, ol.CanvasFillStrokeState, (ol.geom.Geometry|ol.render.Feature)):Array.<*>} createFill Create fill. * @param {function(this:ol.render.canvas.Replay, ol.CanvasFillStrokeState, (ol.geom.Geometry|ol.render.Feature)):Array.<*>} createFill Create fill.
* @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry. * @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry.
*/ */
_ol_render_canvas_Replay_.prototype.updateFillStyle = function(state, createFill, geometry) { CanvasReplay.prototype.updateFillStyle = function(state, createFill, geometry) {
const fillStyle = state.fillStyle; const fillStyle = state.fillStyle;
if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) { if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {
if (fillStyle !== undefined) { if (fillStyle !== undefined) {
@@ -1019,7 +1019,7 @@ _ol_render_canvas_Replay_.prototype.updateFillStyle = function(state, createFill
* @param {ol.CanvasFillStrokeState} state State. * @param {ol.CanvasFillStrokeState} state State.
* @param {function(this:ol.render.canvas.Replay, ol.CanvasFillStrokeState)} applyStroke Apply stroke. * @param {function(this:ol.render.canvas.Replay, ol.CanvasFillStrokeState)} applyStroke Apply stroke.
*/ */
_ol_render_canvas_Replay_.prototype.updateStrokeStyle = function(state, applyStroke) { CanvasReplay.prototype.updateStrokeStyle = function(state, applyStroke) {
const strokeStyle = state.strokeStyle; const strokeStyle = state.strokeStyle;
const lineCap = state.lineCap; const lineCap = state.lineCap;
const lineDash = state.lineDash; const lineDash = state.lineDash;
@@ -1052,7 +1052,7 @@ _ol_render_canvas_Replay_.prototype.updateStrokeStyle = function(state, applyStr
* @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry. * @param {ol.geom.Geometry|ol.render.Feature} geometry Geometry.
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
*/ */
_ol_render_canvas_Replay_.prototype.endGeometry = function(geometry, feature) { CanvasReplay.prototype.endGeometry = function(geometry, feature) {
this.beginGeometryInstruction1_[2] = this.instructions.length; this.beginGeometryInstruction1_[2] = this.instructions.length;
this.beginGeometryInstruction1_ = null; this.beginGeometryInstruction1_ = null;
this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length; this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
@@ -1067,7 +1067,7 @@ _ol_render_canvas_Replay_.prototype.endGeometry = function(geometry, feature) {
/** /**
* FIXME empty description for jsdoc * FIXME empty description for jsdoc
*/ */
_ol_render_canvas_Replay_.prototype.finish = nullFunction; CanvasReplay.prototype.finish = nullFunction;
/** /**
@@ -1077,7 +1077,7 @@ _ol_render_canvas_Replay_.prototype.finish = nullFunction;
* @return {ol.Extent} The buffered rendering extent. * @return {ol.Extent} The buffered rendering extent.
* @protected * @protected
*/ */
_ol_render_canvas_Replay_.prototype.getBufferedMaxExtent = function() { CanvasReplay.prototype.getBufferedMaxExtent = function() {
if (!this.bufferedMaxExtent_) { if (!this.bufferedMaxExtent_) {
this.bufferedMaxExtent_ = clone(this.maxExtent); this.bufferedMaxExtent_ = clone(this.maxExtent);
if (this.maxLineWidth > 0) { if (this.maxLineWidth > 0) {
@@ -1087,4 +1087,4 @@ _ol_render_canvas_Replay_.prototype.getBufferedMaxExtent = function() {
} }
return this.bufferedMaxExtent_; return this.bufferedMaxExtent_;
}; };
export default _ol_render_canvas_Replay_; export default CanvasReplay;
+44 -44
View File
@@ -7,13 +7,13 @@ import {createCanvasContext2D} from '../../dom.js';
import {buffer, createEmpty, extendCoordinate} from '../../extent.js'; import {buffer, createEmpty, extendCoordinate} from '../../extent.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import _ol_obj_ from '../../obj.js'; import _ol_obj_ from '../../obj.js';
import _ol_render_ReplayGroup_ from '../ReplayGroup.js'; import ReplayGroup from '../ReplayGroup.js';
import ReplayType from '../ReplayType.js'; import ReplayType from '../ReplayType.js';
import _ol_render_canvas_Replay_ from '../canvas/Replay.js'; import CanvasReplay from '../canvas/Replay.js';
import _ol_render_canvas_ImageReplay_ from '../canvas/ImageReplay.js'; import CanvasImageReplay from '../canvas/ImageReplay.js';
import _ol_render_canvas_LineStringReplay_ from '../canvas/LineStringReplay.js'; import CanvasLineStringReplay from '../canvas/LineStringReplay.js';
import _ol_render_canvas_PolygonReplay_ from '../canvas/PolygonReplay.js'; import CanvasPolygonReplay from '../canvas/PolygonReplay.js';
import _ol_render_canvas_TextReplay_ from '../canvas/TextReplay.js'; import CanvasTextReplay from '../canvas/TextReplay.js';
import _ol_render_replay_ from '../replay.js'; import _ol_render_replay_ from '../replay.js';
import _ol_transform_ from '../../transform.js'; import _ol_transform_ from '../../transform.js';
@@ -30,9 +30,9 @@ import _ol_transform_ from '../../transform.js';
* @param {number=} opt_renderBuffer Optional rendering buffer. * @param {number=} opt_renderBuffer Optional rendering buffer.
* @struct * @struct
*/ */
const _ol_render_canvas_ReplayGroup_ = function( const CanvasReplayGroup = function(
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree, opt_renderBuffer) { tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree, opt_renderBuffer) {
_ol_render_ReplayGroup_.call(this); ReplayGroup.call(this);
/** /**
* Declutter tree. * Declutter tree.
@@ -102,7 +102,7 @@ const _ol_render_canvas_ReplayGroup_ = function(
this.hitDetectionTransform_ = _ol_transform_.create(); this.hitDetectionTransform_ = _ol_transform_.create();
}; };
inherits(_ol_render_canvas_ReplayGroup_, _ol_render_ReplayGroup_); inherits(CanvasReplayGroup, ReplayGroup);
/** /**
@@ -111,7 +111,7 @@ inherits(_ol_render_canvas_ReplayGroup_, _ol_render_ReplayGroup_);
* @type {Object.<number, Array.<Array.<(boolean|undefined)>>>} * @type {Object.<number, Array.<Array.<(boolean|undefined)>>>}
* @private * @private
*/ */
_ol_render_canvas_ReplayGroup_.circleArrayCache_ = { CanvasReplayGroup.circleArrayCache_ = {
0: [[true]] 0: [[true]]
}; };
@@ -124,7 +124,7 @@ _ol_render_canvas_ReplayGroup_.circleArrayCache_ = {
* @param {number} y Y coordinate. * @param {number} y Y coordinate.
* @private * @private
*/ */
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_ = function(array, x, y) { CanvasReplayGroup.fillCircleArrayRowToMiddle_ = function(array, x, y) {
let i; let i;
const radius = Math.floor(array.length / 2); const radius = Math.floor(array.length / 2);
if (x >= radius) { if (x >= radius) {
@@ -148,9 +148,9 @@ _ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_ = function(array, x,
* @returns {Array.<Array.<(boolean|undefined)>>} An array with marked circle points. * @returns {Array.<Array.<(boolean|undefined)>>} An array with marked circle points.
* @private * @private
*/ */
_ol_render_canvas_ReplayGroup_.getCircleArray_ = function(radius) { CanvasReplayGroup.getCircleArray_ = function(radius) {
if (_ol_render_canvas_ReplayGroup_.circleArrayCache_[radius] !== undefined) { if (CanvasReplayGroup.circleArrayCache_[radius] !== undefined) {
return _ol_render_canvas_ReplayGroup_.circleArrayCache_[radius]; return CanvasReplayGroup.circleArrayCache_[radius];
} }
const arraySize = radius * 2 + 1; const arraySize = radius * 2 + 1;
@@ -164,14 +164,14 @@ _ol_render_canvas_ReplayGroup_.getCircleArray_ = function(radius) {
let error = 0; let error = 0;
while (x >= y) { while (x >= y) {
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_(arr, radius + x, radius + y); CanvasReplayGroup.fillCircleArrayRowToMiddle_(arr, radius + x, radius + y);
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_(arr, radius + y, radius + x); CanvasReplayGroup.fillCircleArrayRowToMiddle_(arr, radius + y, radius + x);
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_(arr, radius - y, radius + x); CanvasReplayGroup.fillCircleArrayRowToMiddle_(arr, radius - y, radius + x);
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_(arr, radius - x, radius + y); CanvasReplayGroup.fillCircleArrayRowToMiddle_(arr, radius - x, radius + y);
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_(arr, radius - x, radius - y); CanvasReplayGroup.fillCircleArrayRowToMiddle_(arr, radius - x, radius - y);
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_(arr, radius - y, radius - x); CanvasReplayGroup.fillCircleArrayRowToMiddle_(arr, radius - y, radius - x);
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_(arr, radius + y, radius - x); CanvasReplayGroup.fillCircleArrayRowToMiddle_(arr, radius + y, radius - x);
_ol_render_canvas_ReplayGroup_.fillCircleArrayRowToMiddle_(arr, radius + x, radius - y); CanvasReplayGroup.fillCircleArrayRowToMiddle_(arr, radius + x, radius - y);
y++; y++;
error += 1 + 2 * y; error += 1 + 2 * y;
@@ -181,7 +181,7 @@ _ol_render_canvas_ReplayGroup_.getCircleArray_ = function(radius) {
} }
} }
_ol_render_canvas_ReplayGroup_.circleArrayCache_[radius] = arr; CanvasReplayGroup.circleArrayCache_[radius] = arr;
return arr; return arr;
}; };
@@ -191,7 +191,7 @@ _ol_render_canvas_ReplayGroup_.getCircleArray_ = function(radius) {
* @param {CanvasRenderingContext2D} context Context. * @param {CanvasRenderingContext2D} context Context.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.
*/ */
_ol_render_canvas_ReplayGroup_.replayDeclutter = function(declutterReplays, context, rotation) { CanvasReplayGroup.replayDeclutter = function(declutterReplays, context, rotation) {
const zs = Object.keys(declutterReplays).map(Number).sort(numberSafeCompareFunction); const zs = Object.keys(declutterReplays).map(Number).sort(numberSafeCompareFunction);
const skippedFeatureUids = {}; const skippedFeatureUids = {};
for (let z = 0, zz = zs.length; z < zz; ++z) { for (let z = 0, zz = zs.length; z < zz; ++z) {
@@ -209,7 +209,7 @@ _ol_render_canvas_ReplayGroup_.replayDeclutter = function(declutterReplays, cont
* @param {boolean} group Group with previous replay. * @param {boolean} group Group with previous replay.
* @return {ol.DeclutterGroup} Declutter instruction group. * @return {ol.DeclutterGroup} Declutter instruction group.
*/ */
_ol_render_canvas_ReplayGroup_.prototype.addDeclutter = function(group) { CanvasReplayGroup.prototype.addDeclutter = function(group) {
let declutter = null; let declutter = null;
if (this.declutterTree_) { if (this.declutterTree_) {
if (group) { if (group) {
@@ -228,7 +228,7 @@ _ol_render_canvas_ReplayGroup_.prototype.addDeclutter = function(group) {
* @param {CanvasRenderingContext2D} context Context. * @param {CanvasRenderingContext2D} context Context.
* @param {ol.Transform} transform Transform. * @param {ol.Transform} transform Transform.
*/ */
_ol_render_canvas_ReplayGroup_.prototype.clip = function(context, transform) { CanvasReplayGroup.prototype.clip = function(context, transform) {
const flatClipCoords = this.getClipCoords(transform); const flatClipCoords = this.getClipCoords(transform);
context.beginPath(); context.beginPath();
context.moveTo(flatClipCoords[0], flatClipCoords[1]); context.moveTo(flatClipCoords[0], flatClipCoords[1]);
@@ -243,7 +243,7 @@ _ol_render_canvas_ReplayGroup_.prototype.clip = function(context, transform) {
* @param {Array.<ol.render.ReplayType>} replays Replays. * @param {Array.<ol.render.ReplayType>} replays Replays.
* @return {boolean} Has replays of the provided types. * @return {boolean} Has replays of the provided types.
*/ */
_ol_render_canvas_ReplayGroup_.prototype.hasReplays = function(replays) { CanvasReplayGroup.prototype.hasReplays = function(replays) {
for (const zIndex in this.replaysByZIndex_) { for (const zIndex in this.replaysByZIndex_) {
const candidates = this.replaysByZIndex_[zIndex]; const candidates = this.replaysByZIndex_[zIndex];
for (let i = 0, ii = replays.length; i < ii; ++i) { for (let i = 0, ii = replays.length; i < ii; ++i) {
@@ -259,7 +259,7 @@ _ol_render_canvas_ReplayGroup_.prototype.hasReplays = function(replays) {
/** /**
* FIXME empty description for jsdoc * FIXME empty description for jsdoc
*/ */
_ol_render_canvas_ReplayGroup_.prototype.finish = function() { CanvasReplayGroup.prototype.finish = function() {
let zKey; let zKey;
for (zKey in this.replaysByZIndex_) { for (zKey in this.replaysByZIndex_) {
const replays = this.replaysByZIndex_[zKey]; const replays = this.replaysByZIndex_[zKey];
@@ -284,7 +284,7 @@ _ol_render_canvas_ReplayGroup_.prototype.finish = function() {
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_canvas_ReplayGroup_.prototype.forEachFeatureAtCoordinate = function( CanvasReplayGroup.prototype.forEachFeatureAtCoordinate = function(
coordinate, resolution, rotation, hitTolerance, skippedFeaturesHash, callback, declutterReplays) { coordinate, resolution, rotation, hitTolerance, skippedFeaturesHash, callback, declutterReplays) {
hitTolerance = Math.round(hitTolerance); hitTolerance = Math.round(hitTolerance);
@@ -313,7 +313,7 @@ _ol_render_canvas_ReplayGroup_.prototype.forEachFeatureAtCoordinate = function(
buffer(hitExtent, resolution * (this.renderBuffer_ + hitTolerance), hitExtent); buffer(hitExtent, resolution * (this.renderBuffer_ + hitTolerance), hitExtent);
} }
const mask = _ol_render_canvas_ReplayGroup_.getCircleArray_(hitTolerance); const mask = CanvasReplayGroup.getCircleArray_(hitTolerance);
let declutteredFeatures; let declutteredFeatures;
if (this.declutterTree_) { if (this.declutterTree_) {
declutteredFeatures = this.declutterTree_.all().map(function(entry) { declutteredFeatures = this.declutterTree_.all().map(function(entry) {
@@ -388,7 +388,7 @@ _ol_render_canvas_ReplayGroup_.prototype.forEachFeatureAtCoordinate = function(
* @param {ol.Transform} transform Transform. * @param {ol.Transform} transform Transform.
* @return {Array.<number>} Clip coordinates. * @return {Array.<number>} Clip coordinates.
*/ */
_ol_render_canvas_ReplayGroup_.prototype.getClipCoords = function(transform) { CanvasReplayGroup.prototype.getClipCoords = function(transform) {
const maxExtent = this.maxExtent_; const maxExtent = this.maxExtent_;
const minX = maxExtent[0]; const minX = maxExtent[0];
const minY = maxExtent[1]; const minY = maxExtent[1];
@@ -404,7 +404,7 @@ _ol_render_canvas_ReplayGroup_.prototype.getClipCoords = function(transform) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_ReplayGroup_.prototype.getReplay = function(zIndex, replayType) { CanvasReplayGroup.prototype.getReplay = function(zIndex, replayType) {
const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0'; const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
let replays = this.replaysByZIndex_[zIndexKey]; let replays = this.replaysByZIndex_[zIndexKey];
if (replays === undefined) { if (replays === undefined) {
@@ -413,7 +413,7 @@ _ol_render_canvas_ReplayGroup_.prototype.getReplay = function(zIndex, replayType
} }
let replay = replays[replayType]; let replay = replays[replayType];
if (replay === undefined) { if (replay === undefined) {
const Constructor = _ol_render_canvas_ReplayGroup_.BATCH_CONSTRUCTORS_[replayType]; const Constructor = CanvasReplayGroup.BATCH_CONSTRUCTORS_[replayType];
replay = new Constructor(this.tolerance_, this.maxExtent_, replay = new Constructor(this.tolerance_, this.maxExtent_,
this.resolution_, this.pixelRatio_, this.overlaps_, this.declutterTree_); this.resolution_, this.pixelRatio_, this.overlaps_, this.declutterTree_);
replays[replayType] = replay; replays[replayType] = replay;
@@ -425,7 +425,7 @@ _ol_render_canvas_ReplayGroup_.prototype.getReplay = function(zIndex, replayType
/** /**
* @return {Object.<string, Object.<ol.render.ReplayType, ol.render.canvas.Replay>>} Replays. * @return {Object.<string, Object.<ol.render.ReplayType, ol.render.canvas.Replay>>} Replays.
*/ */
_ol_render_canvas_ReplayGroup_.prototype.getReplays = function() { CanvasReplayGroup.prototype.getReplays = function() {
return this.replaysByZIndex_; return this.replaysByZIndex_;
}; };
@@ -433,7 +433,7 @@ _ol_render_canvas_ReplayGroup_.prototype.getReplays = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_ReplayGroup_.prototype.isEmpty = function() { CanvasReplayGroup.prototype.isEmpty = function() {
return _ol_obj_.isEmpty(this.replaysByZIndex_); return _ol_obj_.isEmpty(this.replaysByZIndex_);
}; };
@@ -449,7 +449,7 @@ _ol_render_canvas_ReplayGroup_.prototype.isEmpty = function() {
* @param {Object.<string, ol.DeclutterGroup>=} opt_declutterReplays Declutter * @param {Object.<string, ol.DeclutterGroup>=} opt_declutterReplays Declutter
* replays. * replays.
*/ */
_ol_render_canvas_ReplayGroup_.prototype.replay = function(context, CanvasReplayGroup.prototype.replay = function(context,
transform, viewRotation, skippedFeaturesHash, opt_replayTypes, opt_declutterReplays) { transform, viewRotation, skippedFeaturesHash, opt_replayTypes, opt_declutterReplays) {
/** @type {Array.<number>} */ /** @type {Array.<number>} */
@@ -496,12 +496,12 @@ _ol_render_canvas_ReplayGroup_.prototype.replay = function(context,
* function(new: ol.render.canvas.Replay, number, ol.Extent, * function(new: ol.render.canvas.Replay, number, ol.Extent,
* number, number, boolean, Array.<ol.DeclutterGroup>)>} * number, number, boolean, Array.<ol.DeclutterGroup>)>}
*/ */
_ol_render_canvas_ReplayGroup_.BATCH_CONSTRUCTORS_ = { CanvasReplayGroup.BATCH_CONSTRUCTORS_ = {
'Circle': _ol_render_canvas_PolygonReplay_, 'Circle': CanvasPolygonReplay,
'Default': _ol_render_canvas_Replay_, 'Default': CanvasReplay,
'Image': _ol_render_canvas_ImageReplay_, 'Image': CanvasImageReplay,
'LineString': _ol_render_canvas_LineStringReplay_, 'LineString': CanvasLineStringReplay,
'Polygon': _ol_render_canvas_PolygonReplay_, 'Polygon': CanvasPolygonReplay,
'Text': _ol_render_canvas_TextReplay_ 'Text': CanvasTextReplay
}; };
export default _ol_render_canvas_ReplayGroup_; export default CanvasReplayGroup;
+12 -12
View File
@@ -10,7 +10,7 @@ import GeometryType from '../../geom/GeometryType.js';
import _ol_has_ from '../../has.js'; import _ol_has_ from '../../has.js';
import _ol_render_canvas_ from '../canvas.js'; import _ol_render_canvas_ from '../canvas.js';
import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js';
import _ol_render_canvas_Replay_ from '../canvas/Replay.js'; import CanvasReplay from '../canvas/Replay.js';
import _ol_render_replay_ from '../replay.js'; import _ol_render_replay_ from '../replay.js';
import TextPlacement from '../../style/TextPlacement.js'; import TextPlacement from '../../style/TextPlacement.js';
@@ -25,9 +25,9 @@ import TextPlacement from '../../style/TextPlacement.js';
* @param {?} declutterTree Declutter tree. * @param {?} declutterTree Declutter tree.
* @struct * @struct
*/ */
const _ol_render_canvas_TextReplay_ = function( const CanvasTextReplay = function(
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) { tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree) {
_ol_render_canvas_Replay_.call(this, CanvasReplay.call(this,
tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree); tolerance, maxExtent, resolution, pixelRatio, overlaps, declutterTree);
/** /**
@@ -134,7 +134,7 @@ const _ol_render_canvas_TextReplay_ = function(
}; };
inherits(_ol_render_canvas_TextReplay_, _ol_render_canvas_Replay_); inherits(CanvasTextReplay, CanvasReplay);
/** /**
@@ -144,7 +144,7 @@ inherits(_ol_render_canvas_TextReplay_, _ol_render_canvas_Replay_);
* each line. * each line.
* @return {number} Width of the whole text. * @return {number} Width of the whole text.
*/ */
_ol_render_canvas_TextReplay_.measureTextWidths = function(font, lines, widths) { CanvasTextReplay.measureTextWidths = function(font, lines, widths) {
const numLines = lines.length; const numLines = lines.length;
let width = 0; let width = 0;
let currentWidth, i; let currentWidth, i;
@@ -160,7 +160,7 @@ _ol_render_canvas_TextReplay_.measureTextWidths = function(font, lines, widths)
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_TextReplay_.prototype.drawText = function(geometry, feature) { CanvasTextReplay.prototype.drawText = function(geometry, feature) {
const fillState = this.textFillState_; const fillState = this.textFillState_;
const strokeState = this.textStrokeState_; const strokeState = this.textStrokeState_;
const textState = this.textState_; const textState = this.textState_;
@@ -282,7 +282,7 @@ _ol_render_canvas_TextReplay_.prototype.drawText = function(geometry, feature) {
* @param {string} strokeKey Stroke style key. * @param {string} strokeKey Stroke style key.
* @return {HTMLCanvasElement} Image. * @return {HTMLCanvasElement} Image.
*/ */
_ol_render_canvas_TextReplay_.prototype.getImage = function(text, textKey, fillKey, strokeKey) { CanvasTextReplay.prototype.getImage = function(text, textKey, fillKey, strokeKey) {
let label; let label;
const key = strokeKey + textKey + text + fillKey + this.pixelRatio; const key = strokeKey + textKey + text + fillKey + this.pixelRatio;
@@ -299,7 +299,7 @@ _ol_render_canvas_TextReplay_.prototype.getImage = function(text, textKey, fillK
const lines = text.split('\n'); const lines = text.split('\n');
const numLines = lines.length; const numLines = lines.length;
const widths = []; const widths = [];
const width = _ol_render_canvas_TextReplay_.measureTextWidths(textState.font, lines, widths); const width = CanvasTextReplay.measureTextWidths(textState.font, lines, widths);
const lineHeight = _ol_render_canvas_.measureTextHeight(textState.font); const lineHeight = _ol_render_canvas_.measureTextHeight(textState.font);
const height = lineHeight * numLines; const height = lineHeight * numLines;
const renderWidth = (width + strokeWidth); const renderWidth = (width + strokeWidth);
@@ -352,7 +352,7 @@ _ol_render_canvas_TextReplay_.prototype.getImage = function(text, textKey, fillK
* @param {number} begin Begin. * @param {number} begin Begin.
* @param {number} end End. * @param {number} end End.
*/ */
_ol_render_canvas_TextReplay_.prototype.drawTextImage_ = function(label, begin, end) { CanvasTextReplay.prototype.drawTextImage_ = function(label, begin, end) {
const textState = this.textState_; const textState = this.textState_;
const strokeState = this.textStrokeState_; const strokeState = this.textStrokeState_;
const pixelRatio = this.pixelRatio; const pixelRatio = this.pixelRatio;
@@ -387,7 +387,7 @@ _ol_render_canvas_TextReplay_.prototype.drawTextImage_ = function(label, begin,
* @param {number} end End. * @param {number} end End.
* @param {ol.DeclutterGroup} declutterGroup Declutter group. * @param {ol.DeclutterGroup} declutterGroup Declutter group.
*/ */
_ol_render_canvas_TextReplay_.prototype.drawChars_ = function(begin, end, declutterGroup) { CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) {
const strokeState = this.textStrokeState_; const strokeState = this.textStrokeState_;
const textState = this.textState_; const textState = this.textState_;
const fillState = this.textFillState_; const fillState = this.textFillState_;
@@ -465,7 +465,7 @@ _ol_render_canvas_TextReplay_.prototype.drawChars_ = function(begin, end, declut
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_canvas_TextReplay_.prototype.setTextStyle = function(textStyle, declutterGroup) { CanvasTextReplay.prototype.setTextStyle = function(textStyle, declutterGroup) {
let textState, fillState, strokeState; let textState, fillState, strokeState;
if (!textStyle) { if (!textStyle) {
this.text_ = ''; this.text_ = '';
@@ -545,4 +545,4 @@ _ol_render_canvas_TextReplay_.prototype.setTextStyle = function(textStyle, declu
''; '';
} }
}; };
export default _ol_render_canvas_TextReplay_; export default CanvasTextReplay;
+17 -17
View File
@@ -9,7 +9,7 @@ import _ol_obj_ from '../../obj.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import _ol_render_webgl_circlereplay_defaultshader_ from '../webgl/circlereplay/defaultshader.js'; import _ol_render_webgl_circlereplay_defaultshader_ from '../webgl/circlereplay/defaultshader.js';
import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../webgl/circlereplay/defaultshader/Locations.js'; import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../webgl/circlereplay/defaultshader/Locations.js';
import _ol_render_webgl_Replay_ from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
@@ -21,8 +21,8 @@ import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
* @param {ol.Extent} maxExtent Max extent. * @param {ol.Extent} maxExtent Max extent.
* @struct * @struct
*/ */
const _ol_render_webgl_CircleReplay_ = function(tolerance, maxExtent) { const WebGLCircleReplay = function(tolerance, maxExtent) {
_ol_render_webgl_Replay_.call(this, tolerance, maxExtent); WebGLReplay.call(this, tolerance, maxExtent);
/** /**
* @private * @private
@@ -68,7 +68,7 @@ const _ol_render_webgl_CircleReplay_ = function(tolerance, maxExtent) {
}; };
inherits(_ol_render_webgl_CircleReplay_, _ol_render_webgl_Replay_); inherits(WebGLCircleReplay, WebGLReplay);
/** /**
@@ -78,7 +78,7 @@ inherits(_ol_render_webgl_CircleReplay_, _ol_render_webgl_Replay_);
* @param {number} end End. * @param {number} end End.
* @param {number} stride Stride. * @param {number} stride Stride.
*/ */
_ol_render_webgl_CircleReplay_.prototype.drawCoordinates_ = function( WebGLCircleReplay.prototype.drawCoordinates_ = function(
flatCoordinates, offset, end, stride) { flatCoordinates, offset, end, stride) {
let numVertices = this.vertices.length; let numVertices = this.vertices.length;
let numIndices = this.indices.length; let numIndices = this.indices.length;
@@ -121,7 +121,7 @@ _ol_render_webgl_CircleReplay_.prototype.drawCoordinates_ = function(
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_CircleReplay_.prototype.drawCircle = function(circleGeometry, feature) { WebGLCircleReplay.prototype.drawCircle = function(circleGeometry, feature) {
const radius = circleGeometry.getRadius(); const radius = circleGeometry.getRadius();
const stride = circleGeometry.getStride(); const stride = circleGeometry.getStride();
if (radius) { if (radius) {
@@ -155,7 +155,7 @@ _ol_render_webgl_CircleReplay_.prototype.drawCircle = function(circleGeometry, f
/** /**
* @inheritDoc * @inheritDoc
**/ **/
_ol_render_webgl_CircleReplay_.prototype.finish = function(context) { WebGLCircleReplay.prototype.finish = function(context) {
// create, bind, and populate the vertices buffer // create, bind, and populate the vertices buffer
this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices); this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices);
@@ -177,7 +177,7 @@ _ol_render_webgl_CircleReplay_.prototype.finish = function(context) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_CircleReplay_.prototype.getDeleteResourcesFunction = function(context) { WebGLCircleReplay.prototype.getDeleteResourcesFunction = function(context) {
// We only delete our stuff here. The shaders and the program may // We only delete our stuff here. The shaders and the program may
// be used by other CircleReplay instances (for other layers). And // be used by other CircleReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context // they will be deleted when disposing of the ol.webgl.Context
@@ -194,7 +194,7 @@ _ol_render_webgl_CircleReplay_.prototype.getDeleteResourcesFunction = function(c
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_CircleReplay_.prototype.setUpProgram = function(gl, context, size, pixelRatio) { WebGLCircleReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
// get the program // get the program
const fragmentShader = _ol_render_webgl_circlereplay_defaultshader_.fragment; const fragmentShader = _ol_render_webgl_circlereplay_defaultshader_.fragment;
const vertexShader = _ol_render_webgl_circlereplay_defaultshader_.vertex; const vertexShader = _ol_render_webgl_circlereplay_defaultshader_.vertex;
@@ -235,7 +235,7 @@ _ol_render_webgl_CircleReplay_.prototype.setUpProgram = function(gl, context, si
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_CircleReplay_.prototype.shutDownProgram = function(gl, locations) { WebGLCircleReplay.prototype.shutDownProgram = function(gl, locations) {
gl.disableVertexAttribArray(locations.a_position); gl.disableVertexAttribArray(locations.a_position);
gl.disableVertexAttribArray(locations.a_instruction); gl.disableVertexAttribArray(locations.a_instruction);
gl.disableVertexAttribArray(locations.a_radius); gl.disableVertexAttribArray(locations.a_radius);
@@ -245,7 +245,7 @@ _ol_render_webgl_CircleReplay_.prototype.shutDownProgram = function(gl, location
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_CircleReplay_.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) { WebGLCircleReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { if (!_ol_obj_.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash); this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else { } else {
@@ -268,7 +268,7 @@ _ol_render_webgl_CircleReplay_.prototype.drawReplay = function(gl, context, skip
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_CircleReplay_.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash, WebGLCircleReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) { featureCallback, opt_hitExtent) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex; let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2; featureIndex = this.startIndices.length - 2;
@@ -315,7 +315,7 @@ _ol_render_webgl_CircleReplay_.prototype.drawHitDetectionReplayOneByOne = functi
* @param {ol.webgl.Context} context Context. * @param {ol.webgl.Context} context Context.
* @param {Object} skippedFeaturesHash Ids of features to skip. * @param {Object} skippedFeaturesHash Ids of features to skip.
*/ */
_ol_render_webgl_CircleReplay_.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) { WebGLCircleReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart; let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2; featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1]; end = start = this.startIndices[featureIndex + 1];
@@ -354,7 +354,7 @@ _ol_render_webgl_CircleReplay_.prototype.drawReplaySkipping_ = function(gl, cont
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {Array.<number>} color Color. * @param {Array.<number>} color Color.
*/ */
_ol_render_webgl_CircleReplay_.prototype.setFillStyle_ = function(gl, color) { WebGLCircleReplay.prototype.setFillStyle_ = function(gl, color) {
gl.uniform4fv(this.defaultLocations_.u_fillColor, color); gl.uniform4fv(this.defaultLocations_.u_fillColor, color);
}; };
@@ -365,7 +365,7 @@ _ol_render_webgl_CircleReplay_.prototype.setFillStyle_ = function(gl, color) {
* @param {Array.<number>} color Color. * @param {Array.<number>} color Color.
* @param {number} lineWidth Line width. * @param {number} lineWidth Line width.
*/ */
_ol_render_webgl_CircleReplay_.prototype.setStrokeStyle_ = function(gl, color, lineWidth) { WebGLCircleReplay.prototype.setStrokeStyle_ = function(gl, color, lineWidth) {
gl.uniform4fv(this.defaultLocations_.u_strokeColor, color); gl.uniform4fv(this.defaultLocations_.u_strokeColor, color);
gl.uniform1f(this.defaultLocations_.u_lineWidth, lineWidth); gl.uniform1f(this.defaultLocations_.u_lineWidth, lineWidth);
}; };
@@ -374,7 +374,7 @@ _ol_render_webgl_CircleReplay_.prototype.setStrokeStyle_ = function(gl, color, l
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_CircleReplay_.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { WebGLCircleReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
let strokeStyleColor, strokeStyleWidth; let strokeStyleColor, strokeStyleWidth;
if (strokeStyle) { if (strokeStyle) {
const strokeStyleLineDash = strokeStyle.getLineDash(); const strokeStyleLineDash = strokeStyle.getLineDash();
@@ -418,4 +418,4 @@ _ol_render_webgl_CircleReplay_.prototype.setFillStrokeStyle = function(fillStyle
this.styles_.push([fillStyleColor, strokeStyleColor, strokeStyleWidth]); this.styles_.push([fillStyleColor, strokeStyleColor, strokeStyleWidth]);
} }
}; };
export default _ol_render_webgl_CircleReplay_; export default WebGLCircleReplay;
+12 -12
View File
@@ -2,7 +2,7 @@
* @module ol/render/webgl/ImageReplay * @module ol/render/webgl/ImageReplay
*/ */
import {getUid, inherits} from '../../index.js'; import {getUid, inherits} from '../../index.js';
import _ol_render_webgl_TextureReplay_ from '../webgl/TextureReplay.js'; import WebGLTextureReplay from '../webgl/TextureReplay.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
/** /**
@@ -12,8 +12,8 @@ import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
* @param {ol.Extent} maxExtent Max extent. * @param {ol.Extent} maxExtent Max extent.
* @struct * @struct
*/ */
const _ol_render_webgl_ImageReplay_ = function(tolerance, maxExtent) { const WebGLImageReplay = function(tolerance, maxExtent) {
_ol_render_webgl_TextureReplay_.call(this, tolerance, maxExtent); WebGLTextureReplay.call(this, tolerance, maxExtent);
/** /**
* @type {Array.<HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>} * @type {Array.<HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>}
@@ -41,13 +41,13 @@ const _ol_render_webgl_ImageReplay_ = function(tolerance, maxExtent) {
}; };
inherits(_ol_render_webgl_ImageReplay_, _ol_render_webgl_TextureReplay_); inherits(WebGLImageReplay, WebGLTextureReplay);
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_ImageReplay_.prototype.drawMultiPoint = function(multiPointGeometry, feature) { WebGLImageReplay.prototype.drawMultiPoint = function(multiPointGeometry, feature) {
this.startIndices.push(this.indices.length); this.startIndices.push(this.indices.length);
this.startIndicesFeature.push(feature); this.startIndicesFeature.push(feature);
const flatCoordinates = multiPointGeometry.getFlatCoordinates(); const flatCoordinates = multiPointGeometry.getFlatCoordinates();
@@ -60,7 +60,7 @@ _ol_render_webgl_ImageReplay_.prototype.drawMultiPoint = function(multiPointGeom
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_ImageReplay_.prototype.drawPoint = function(pointGeometry, feature) { WebGLImageReplay.prototype.drawPoint = function(pointGeometry, feature) {
this.startIndices.push(this.indices.length); this.startIndices.push(this.indices.length);
this.startIndicesFeature.push(feature); this.startIndicesFeature.push(feature);
const flatCoordinates = pointGeometry.getFlatCoordinates(); const flatCoordinates = pointGeometry.getFlatCoordinates();
@@ -73,7 +73,7 @@ _ol_render_webgl_ImageReplay_.prototype.drawPoint = function(pointGeometry, feat
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_ImageReplay_.prototype.finish = function(context) { WebGLImageReplay.prototype.finish = function(context) {
const gl = context.getGL(); const gl = context.getGL();
this.groupIndices.push(this.indices.length); this.groupIndices.push(this.indices.length);
@@ -98,14 +98,14 @@ _ol_render_webgl_ImageReplay_.prototype.finish = function(context) {
this.images_ = null; this.images_ = null;
this.hitDetectionImages_ = null; this.hitDetectionImages_ = null;
_ol_render_webgl_TextureReplay_.prototype.finish.call(this, context); WebGLTextureReplay.prototype.finish.call(this, context);
}; };
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_ImageReplay_.prototype.setImageStyle = function(imageStyle) { WebGLImageReplay.prototype.setImageStyle = function(imageStyle) {
const anchor = imageStyle.getAnchor(); const anchor = imageStyle.getAnchor();
const image = imageStyle.getImage(1); const image = imageStyle.getImage(1);
const imageSize = imageStyle.getImageSize(); const imageSize = imageStyle.getImageSize();
@@ -157,7 +157,7 @@ _ol_render_webgl_ImageReplay_.prototype.setImageStyle = function(imageStyle) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_ImageReplay_.prototype.getTextures = function(opt_all) { WebGLImageReplay.prototype.getTextures = function(opt_all) {
return opt_all ? this.textures_.concat(this.hitDetectionTextures_) : this.textures_; return opt_all ? this.textures_.concat(this.hitDetectionTextures_) : this.textures_;
}; };
@@ -165,7 +165,7 @@ _ol_render_webgl_ImageReplay_.prototype.getTextures = function(opt_all) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_ImageReplay_.prototype.getHitDetectionTextures = function() { WebGLImageReplay.prototype.getHitDetectionTextures = function() {
return this.hitDetectionTextures_; return this.hitDetectionTextures_;
}; };
export default _ol_render_webgl_ImageReplay_; export default WebGLImageReplay;
+8 -8
View File
@@ -6,7 +6,7 @@ import {intersects} from '../../extent.js';
import GeometryType from '../../geom/GeometryType.js'; import GeometryType from '../../geom/GeometryType.js';
import ReplayType from '../ReplayType.js'; import ReplayType from '../ReplayType.js';
import VectorContext from '../VectorContext.js'; import VectorContext from '../VectorContext.js';
import _ol_render_webgl_ReplayGroup_ from '../webgl/ReplayGroup.js'; import WebGLReplayGroup from '../webgl/ReplayGroup.js';
/** /**
* @constructor * @constructor
@@ -198,7 +198,7 @@ _ol_render_webgl_Immediate_.prototype.drawGeometryCollection = function(geometry
*/ */
_ol_render_webgl_Immediate_.prototype.drawPoint = function(geometry, data) { _ol_render_webgl_Immediate_.prototype.drawPoint = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new _ol_render_webgl_ReplayGroup_(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.ImageReplay} */ ( const replay = /** @type {ol.render.webgl.ImageReplay} */ (
replayGroup.getReplay(0, ReplayType.IMAGE)); replayGroup.getReplay(0, ReplayType.IMAGE));
replay.setImageStyle(this.imageStyle_); replay.setImageStyle(this.imageStyle_);
@@ -225,7 +225,7 @@ _ol_render_webgl_Immediate_.prototype.drawPoint = function(geometry, data) {
*/ */
_ol_render_webgl_Immediate_.prototype.drawMultiPoint = function(geometry, data) { _ol_render_webgl_Immediate_.prototype.drawMultiPoint = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new _ol_render_webgl_ReplayGroup_(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.ImageReplay} */ ( const replay = /** @type {ol.render.webgl.ImageReplay} */ (
replayGroup.getReplay(0, ReplayType.IMAGE)); replayGroup.getReplay(0, ReplayType.IMAGE));
replay.setImageStyle(this.imageStyle_); replay.setImageStyle(this.imageStyle_);
@@ -251,7 +251,7 @@ _ol_render_webgl_Immediate_.prototype.drawMultiPoint = function(geometry, data)
*/ */
_ol_render_webgl_Immediate_.prototype.drawLineString = function(geometry, data) { _ol_render_webgl_Immediate_.prototype.drawLineString = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new _ol_render_webgl_ReplayGroup_(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.LineStringReplay} */ ( const replay = /** @type {ol.render.webgl.LineStringReplay} */ (
replayGroup.getReplay(0, ReplayType.LINE_STRING)); replayGroup.getReplay(0, ReplayType.LINE_STRING));
replay.setFillStrokeStyle(null, this.strokeStyle_); replay.setFillStrokeStyle(null, this.strokeStyle_);
@@ -277,7 +277,7 @@ _ol_render_webgl_Immediate_.prototype.drawLineString = function(geometry, data)
*/ */
_ol_render_webgl_Immediate_.prototype.drawMultiLineString = function(geometry, data) { _ol_render_webgl_Immediate_.prototype.drawMultiLineString = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new _ol_render_webgl_ReplayGroup_(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.LineStringReplay} */ ( const replay = /** @type {ol.render.webgl.LineStringReplay} */ (
replayGroup.getReplay(0, ReplayType.LINE_STRING)); replayGroup.getReplay(0, ReplayType.LINE_STRING));
replay.setFillStrokeStyle(null, this.strokeStyle_); replay.setFillStrokeStyle(null, this.strokeStyle_);
@@ -303,7 +303,7 @@ _ol_render_webgl_Immediate_.prototype.drawMultiLineString = function(geometry, d
*/ */
_ol_render_webgl_Immediate_.prototype.drawPolygon = function(geometry, data) { _ol_render_webgl_Immediate_.prototype.drawPolygon = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new _ol_render_webgl_ReplayGroup_(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.PolygonReplay} */ ( const replay = /** @type {ol.render.webgl.PolygonReplay} */ (
replayGroup.getReplay(0, ReplayType.POLYGON)); replayGroup.getReplay(0, ReplayType.POLYGON));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
@@ -329,7 +329,7 @@ _ol_render_webgl_Immediate_.prototype.drawPolygon = function(geometry, data) {
*/ */
_ol_render_webgl_Immediate_.prototype.drawMultiPolygon = function(geometry, data) { _ol_render_webgl_Immediate_.prototype.drawMultiPolygon = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new _ol_render_webgl_ReplayGroup_(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.PolygonReplay} */ ( const replay = /** @type {ol.render.webgl.PolygonReplay} */ (
replayGroup.getReplay(0, ReplayType.POLYGON)); replayGroup.getReplay(0, ReplayType.POLYGON));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
@@ -355,7 +355,7 @@ _ol_render_webgl_Immediate_.prototype.drawMultiPolygon = function(geometry, data
*/ */
_ol_render_webgl_Immediate_.prototype.drawCircle = function(geometry, data) { _ol_render_webgl_Immediate_.prototype.drawCircle = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new _ol_render_webgl_ReplayGroup_(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.CircleReplay} */ ( const replay = /** @type {ol.render.webgl.CircleReplay} */ (
replayGroup.getReplay(0, ReplayType.CIRCLE)); replayGroup.getReplay(0, ReplayType.CIRCLE));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
+37 -37
View File
@@ -10,7 +10,7 @@ import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import _ol_geom_flat_topology_ from '../../geom/flat/topology.js'; import _ol_geom_flat_topology_ from '../../geom/flat/topology.js';
import _ol_obj_ from '../../obj.js'; import _ol_obj_ from '../../obj.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import _ol_render_webgl_Replay_ from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_render_webgl_linestringreplay_defaultshader_ from '../webgl/linestringreplay/defaultshader.js'; import _ol_render_webgl_linestringreplay_defaultshader_ from '../webgl/linestringreplay/defaultshader.js';
import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../webgl/linestringreplay/defaultshader/Locations.js'; import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../webgl/linestringreplay/defaultshader/Locations.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
@@ -23,8 +23,8 @@ import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
* @param {ol.Extent} maxExtent Max extent. * @param {ol.Extent} maxExtent Max extent.
* @struct * @struct
*/ */
const _ol_render_webgl_LineStringReplay_ = function(tolerance, maxExtent) { const WebGLLineStringReplay = function(tolerance, maxExtent) {
_ol_render_webgl_Replay_.call(this, tolerance, maxExtent); WebGLReplay.call(this, tolerance, maxExtent);
/** /**
* @private * @private
@@ -68,7 +68,7 @@ const _ol_render_webgl_LineStringReplay_ = function(tolerance, maxExtent) {
}; };
inherits(_ol_render_webgl_LineStringReplay_, _ol_render_webgl_Replay_); inherits(WebGLLineStringReplay, WebGLReplay);
/** /**
@@ -79,7 +79,7 @@ inherits(_ol_render_webgl_LineStringReplay_, _ol_render_webgl_Replay_);
* @param {number} end End. * @param {number} end End.
* @param {number} stride Stride. * @param {number} stride Stride.
*/ */
_ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) { WebGLLineStringReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
let i, ii; let i, ii;
let numVertices = this.vertices.length; let numVertices = this.vertices.length;
@@ -121,10 +121,10 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
if (lineCap) { if (lineCap) {
numVertices = this.addVertices_([0, 0], p1, p2, numVertices = this.addVertices_([0, 0], p1, p2,
lastSign * _ol_render_webgl_LineStringReplay_.Instruction_.BEGIN_LINE_CAP * lineCap, numVertices); lastSign * WebGLLineStringReplay.Instruction_.BEGIN_LINE_CAP * lineCap, numVertices);
numVertices = this.addVertices_([0, 0], p1, p2, numVertices = this.addVertices_([0, 0], p1, p2,
-lastSign * _ol_render_webgl_LineStringReplay_.Instruction_.BEGIN_LINE_CAP * lineCap, numVertices); -lastSign * WebGLLineStringReplay.Instruction_.BEGIN_LINE_CAP * lineCap, numVertices);
this.indices[numIndices++] = n + 2; this.indices[numIndices++] = n + 2;
this.indices[numIndices++] = n; this.indices[numIndices++] = n;
@@ -137,10 +137,10 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
} }
numVertices = this.addVertices_([0, 0], p1, p2, numVertices = this.addVertices_([0, 0], p1, p2,
lastSign * _ol_render_webgl_LineStringReplay_.Instruction_.BEGIN_LINE * (lineCap || 1), numVertices); lastSign * WebGLLineStringReplay.Instruction_.BEGIN_LINE * (lineCap || 1), numVertices);
numVertices = this.addVertices_([0, 0], p1, p2, numVertices = this.addVertices_([0, 0], p1, p2,
-lastSign * _ol_render_webgl_LineStringReplay_.Instruction_.BEGIN_LINE * (lineCap || 1), numVertices); -lastSign * WebGLLineStringReplay.Instruction_.BEGIN_LINE * (lineCap || 1), numVertices);
lastIndex = numVertices / 7 - 1; lastIndex = numVertices / 7 - 1;
@@ -156,10 +156,10 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
p0 = p0 || [0, 0]; p0 = p0 || [0, 0];
numVertices = this.addVertices_(p0, p1, [0, 0], numVertices = this.addVertices_(p0, p1, [0, 0],
lastSign * _ol_render_webgl_LineStringReplay_.Instruction_.END_LINE * (lineCap || 1), numVertices); lastSign * WebGLLineStringReplay.Instruction_.END_LINE * (lineCap || 1), numVertices);
numVertices = this.addVertices_(p0, p1, [0, 0], numVertices = this.addVertices_(p0, p1, [0, 0],
-lastSign * _ol_render_webgl_LineStringReplay_.Instruction_.END_LINE * (lineCap || 1), numVertices); -lastSign * WebGLLineStringReplay.Instruction_.END_LINE * (lineCap || 1), numVertices);
this.indices[numIndices++] = n; this.indices[numIndices++] = n;
this.indices[numIndices++] = lastIndex - 1; this.indices[numIndices++] = lastIndex - 1;
@@ -171,10 +171,10 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
if (lineCap) { if (lineCap) {
numVertices = this.addVertices_(p0, p1, [0, 0], numVertices = this.addVertices_(p0, p1, [0, 0],
lastSign * _ol_render_webgl_LineStringReplay_.Instruction_.END_LINE_CAP * lineCap, numVertices); lastSign * WebGLLineStringReplay.Instruction_.END_LINE_CAP * lineCap, numVertices);
numVertices = this.addVertices_(p0, p1, [0, 0], numVertices = this.addVertices_(p0, p1, [0, 0],
-lastSign * _ol_render_webgl_LineStringReplay_.Instruction_.END_LINE_CAP * lineCap, numVertices); -lastSign * WebGLLineStringReplay.Instruction_.END_LINE_CAP * lineCap, numVertices);
this.indices[numIndices++] = n + 2; this.indices[numIndices++] = n + 2;
this.indices[numIndices++] = n; this.indices[numIndices++] = n;
@@ -197,13 +197,13 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
? -1 : 1; ? -1 : 1;
numVertices = this.addVertices_(p0, p1, p2, numVertices = this.addVertices_(p0, p1, p2,
sign * _ol_render_webgl_LineStringReplay_.Instruction_.BEVEL_FIRST * (lineJoin || 1), numVertices); sign * WebGLLineStringReplay.Instruction_.BEVEL_FIRST * (lineJoin || 1), numVertices);
numVertices = this.addVertices_(p0, p1, p2, numVertices = this.addVertices_(p0, p1, p2,
sign * _ol_render_webgl_LineStringReplay_.Instruction_.BEVEL_SECOND * (lineJoin || 1), numVertices); sign * WebGLLineStringReplay.Instruction_.BEVEL_SECOND * (lineJoin || 1), numVertices);
numVertices = this.addVertices_(p0, p1, p2, numVertices = this.addVertices_(p0, p1, p2,
-sign * _ol_render_webgl_LineStringReplay_.Instruction_.MITER_BOTTOM * (lineJoin || 1), numVertices); -sign * WebGLLineStringReplay.Instruction_.MITER_BOTTOM * (lineJoin || 1), numVertices);
if (i > offset) { if (i > offset) {
this.indices[numIndices++] = n; this.indices[numIndices++] = n;
@@ -225,7 +225,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
//Add miter //Add miter
if (lineJoin) { if (lineJoin) {
numVertices = this.addVertices_(p0, p1, p2, numVertices = this.addVertices_(p0, p1, p2,
sign * _ol_render_webgl_LineStringReplay_.Instruction_.MITER_TOP * lineJoin, numVertices); sign * WebGLLineStringReplay.Instruction_.MITER_TOP * lineJoin, numVertices);
this.indices[numIndices++] = n + 1; this.indices[numIndices++] = n + 1;
this.indices[numIndices++] = n + 3; this.indices[numIndices++] = n + 3;
@@ -239,10 +239,10 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
? 1 : -1; ? 1 : -1;
numVertices = this.addVertices_(p0, p1, p2, numVertices = this.addVertices_(p0, p1, p2,
sign * _ol_render_webgl_LineStringReplay_.Instruction_.BEVEL_FIRST * (lineJoin || 1), numVertices); sign * WebGLLineStringReplay.Instruction_.BEVEL_FIRST * (lineJoin || 1), numVertices);
numVertices = this.addVertices_(p0, p1, p2, numVertices = this.addVertices_(p0, p1, p2,
-sign * _ol_render_webgl_LineStringReplay_.Instruction_.MITER_BOTTOM * (lineJoin || 1), numVertices); -sign * WebGLLineStringReplay.Instruction_.MITER_BOTTOM * (lineJoin || 1), numVertices);
this.indices[numIndices++] = n; this.indices[numIndices++] = n;
this.indices[numIndices++] = lastIndex - 1; this.indices[numIndices++] = lastIndex - 1;
@@ -263,7 +263,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawCoordinates_ = function(flatCoo
* @return {number} Vertex counter. * @return {number} Vertex counter.
* @private * @private
*/ */
_ol_render_webgl_LineStringReplay_.prototype.addVertices_ = function(p0, p1, p2, product, numVertices) { WebGLLineStringReplay.prototype.addVertices_ = function(p0, p1, p2, product, numVertices) {
this.vertices[numVertices++] = p0[0]; this.vertices[numVertices++] = p0[0];
this.vertices[numVertices++] = p0[1]; this.vertices[numVertices++] = p0[1];
this.vertices[numVertices++] = p1[0]; this.vertices[numVertices++] = p1[0];
@@ -284,7 +284,7 @@ _ol_render_webgl_LineStringReplay_.prototype.addVertices_ = function(p0, p1, p2,
* @return {boolean} The linestring can be drawn. * @return {boolean} The linestring can be drawn.
* @private * @private
*/ */
_ol_render_webgl_LineStringReplay_.prototype.isValid_ = function(flatCoordinates, offset, end, stride) { WebGLLineStringReplay.prototype.isValid_ = function(flatCoordinates, offset, end, stride) {
const range = end - offset; const range = end - offset;
if (range < stride * 2) { if (range < stride * 2) {
return false; return false;
@@ -301,7 +301,7 @@ _ol_render_webgl_LineStringReplay_.prototype.isValid_ = function(flatCoordinates
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_LineStringReplay_.prototype.drawLineString = function(lineStringGeometry, feature) { WebGLLineStringReplay.prototype.drawLineString = function(lineStringGeometry, feature) {
let flatCoordinates = lineStringGeometry.getFlatCoordinates(); let flatCoordinates = lineStringGeometry.getFlatCoordinates();
const stride = lineStringGeometry.getStride(); const stride = lineStringGeometry.getStride();
if (this.isValid_(flatCoordinates, 0, flatCoordinates.length, stride)) { if (this.isValid_(flatCoordinates, 0, flatCoordinates.length, stride)) {
@@ -322,7 +322,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawLineString = function(lineStrin
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_LineStringReplay_.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) { WebGLLineStringReplay.prototype.drawMultiLineString = function(multiLineStringGeometry, feature) {
const indexCount = this.indices.length; const indexCount = this.indices.length;
const ends = multiLineStringGeometry.getEnds(); const ends = multiLineStringGeometry.getEnds();
ends.unshift(0); ends.unshift(0);
@@ -355,7 +355,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawMultiLineString = function(mult
* @param {Array.<Array.<number>>} holeFlatCoordinates Hole flat coordinates. * @param {Array.<Array.<number>>} holeFlatCoordinates Hole flat coordinates.
* @param {number} stride Stride. * @param {number} stride Stride.
*/ */
_ol_render_webgl_LineStringReplay_.prototype.drawPolygonCoordinates = function( WebGLLineStringReplay.prototype.drawPolygonCoordinates = function(
flatCoordinates, holeFlatCoordinates, stride) { flatCoordinates, holeFlatCoordinates, stride) {
if (!_ol_geom_flat_topology_.lineStringIsClosed(flatCoordinates, 0, if (!_ol_geom_flat_topology_.lineStringIsClosed(flatCoordinates, 0,
flatCoordinates.length, stride)) { flatCoordinates.length, stride)) {
@@ -382,7 +382,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawPolygonCoordinates = function(
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
* @param {number=} opt_index Index count. * @param {number=} opt_index Index count.
*/ */
_ol_render_webgl_LineStringReplay_.prototype.setPolygonStyle = function(feature, opt_index) { WebGLLineStringReplay.prototype.setPolygonStyle = function(feature, opt_index) {
const index = opt_index === undefined ? this.indices.length : opt_index; const index = opt_index === undefined ? this.indices.length : opt_index;
this.startIndices.push(index); this.startIndices.push(index);
this.startIndicesFeature.push(feature); this.startIndicesFeature.push(feature);
@@ -396,7 +396,7 @@ _ol_render_webgl_LineStringReplay_.prototype.setPolygonStyle = function(feature,
/** /**
* @return {number} Current index. * @return {number} Current index.
*/ */
_ol_render_webgl_LineStringReplay_.prototype.getCurrentIndex = function() { WebGLLineStringReplay.prototype.getCurrentIndex = function() {
return this.indices.length; return this.indices.length;
}; };
@@ -404,7 +404,7 @@ _ol_render_webgl_LineStringReplay_.prototype.getCurrentIndex = function() {
/** /**
* @inheritDoc * @inheritDoc
**/ **/
_ol_render_webgl_LineStringReplay_.prototype.finish = function(context) { WebGLLineStringReplay.prototype.finish = function(context) {
// create, bind, and populate the vertices buffer // create, bind, and populate the vertices buffer
this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices); this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices);
@@ -426,7 +426,7 @@ _ol_render_webgl_LineStringReplay_.prototype.finish = function(context) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_LineStringReplay_.prototype.getDeleteResourcesFunction = function(context) { WebGLLineStringReplay.prototype.getDeleteResourcesFunction = function(context) {
const verticesBuffer = this.verticesBuffer; const verticesBuffer = this.verticesBuffer;
const indicesBuffer = this.indicesBuffer; const indicesBuffer = this.indicesBuffer;
return function() { return function() {
@@ -439,7 +439,7 @@ _ol_render_webgl_LineStringReplay_.prototype.getDeleteResourcesFunction = functi
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_LineStringReplay_.prototype.setUpProgram = function(gl, context, size, pixelRatio) { WebGLLineStringReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
// get the program // get the program
const fragmentShader = _ol_render_webgl_linestringreplay_defaultshader_.fragment; const fragmentShader = _ol_render_webgl_linestringreplay_defaultshader_.fragment;
const vertexShader = _ol_render_webgl_linestringreplay_defaultshader_.vertex; const vertexShader = _ol_render_webgl_linestringreplay_defaultshader_.vertex;
@@ -484,7 +484,7 @@ _ol_render_webgl_LineStringReplay_.prototype.setUpProgram = function(gl, context
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_LineStringReplay_.prototype.shutDownProgram = function(gl, locations) { WebGLLineStringReplay.prototype.shutDownProgram = function(gl, locations) {
gl.disableVertexAttribArray(locations.a_lastPos); gl.disableVertexAttribArray(locations.a_lastPos);
gl.disableVertexAttribArray(locations.a_position); gl.disableVertexAttribArray(locations.a_position);
gl.disableVertexAttribArray(locations.a_nextPos); gl.disableVertexAttribArray(locations.a_nextPos);
@@ -495,7 +495,7 @@ _ol_render_webgl_LineStringReplay_.prototype.shutDownProgram = function(gl, loca
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_LineStringReplay_.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) { WebGLLineStringReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
//Save GL parameters. //Save GL parameters.
const tmpDepthFunc = /** @type {number} */ (gl.getParameter(gl.DEPTH_FUNC)); const tmpDepthFunc = /** @type {number} */ (gl.getParameter(gl.DEPTH_FUNC));
const tmpDepthMask = /** @type {boolean} */ (gl.getParameter(gl.DEPTH_WRITEMASK)); const tmpDepthMask = /** @type {boolean} */ (gl.getParameter(gl.DEPTH_WRITEMASK));
@@ -537,7 +537,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawReplay = function(gl, context,
* @param {ol.webgl.Context} context Context. * @param {ol.webgl.Context} context Context.
* @param {Object} skippedFeaturesHash Ids of features to skip. * @param {Object} skippedFeaturesHash Ids of features to skip.
*/ */
_ol_render_webgl_LineStringReplay_.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) { WebGLLineStringReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart; let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2; featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1]; end = start = this.startIndices[featureIndex + 1];
@@ -574,7 +574,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawReplaySkipping_ = function(gl,
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_LineStringReplay_.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash, WebGLLineStringReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) { featureCallback, opt_hitExtent) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex; let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2; featureIndex = this.startIndices.length - 2;
@@ -620,7 +620,7 @@ _ol_render_webgl_LineStringReplay_.prototype.drawHitDetectionReplayOneByOne = fu
* @param {number} lineWidth Line width. * @param {number} lineWidth Line width.
* @param {number} miterLimit Miter limit. * @param {number} miterLimit Miter limit.
*/ */
_ol_render_webgl_LineStringReplay_.prototype.setStrokeStyle_ = function(gl, color, lineWidth, miterLimit) { WebGLLineStringReplay.prototype.setStrokeStyle_ = function(gl, color, lineWidth, miterLimit) {
gl.uniform4fv(this.defaultLocations_.u_color, color); gl.uniform4fv(this.defaultLocations_.u_color, color);
gl.uniform1f(this.defaultLocations_.u_lineWidth, lineWidth); gl.uniform1f(this.defaultLocations_.u_lineWidth, lineWidth);
gl.uniform1f(this.defaultLocations_.u_miterLimit, miterLimit); gl.uniform1f(this.defaultLocations_.u_miterLimit, miterLimit);
@@ -630,7 +630,7 @@ _ol_render_webgl_LineStringReplay_.prototype.setStrokeStyle_ = function(gl, colo
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_LineStringReplay_.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { WebGLLineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
const strokeStyleLineCap = strokeStyle.getLineCap(); const strokeStyleLineCap = strokeStyle.getLineCap();
this.state_.lineCap = strokeStyleLineCap !== undefined ? this.state_.lineCap = strokeStyleLineCap !== undefined ?
strokeStyleLineCap : _ol_render_webgl_.defaultLineCap; strokeStyleLineCap : _ol_render_webgl_.defaultLineCap;
@@ -672,7 +672,7 @@ _ol_render_webgl_LineStringReplay_.prototype.setFillStrokeStyle = function(fillS
* @enum {number} * @enum {number}
* @private * @private
*/ */
_ol_render_webgl_LineStringReplay_.Instruction_ = { WebGLLineStringReplay.Instruction_ = {
ROUND: 2, ROUND: 2,
BEGIN_LINE: 3, BEGIN_LINE: 3,
END_LINE: 5, END_LINE: 5,
@@ -683,4 +683,4 @@ _ol_render_webgl_LineStringReplay_.Instruction_ = {
MITER_BOTTOM: 19, MITER_BOTTOM: 19,
MITER_TOP: 23 MITER_TOP: 23
}; };
export default _ol_render_webgl_LineStringReplay_; export default WebGLLineStringReplay;
+36 -36
View File
@@ -11,8 +11,8 @@ import _ol_geom_flat_orient_ from '../../geom/flat/orient.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import _ol_render_webgl_polygonreplay_defaultshader_ from '../webgl/polygonreplay/defaultshader.js'; import _ol_render_webgl_polygonreplay_defaultshader_ from '../webgl/polygonreplay/defaultshader.js';
import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../webgl/polygonreplay/defaultshader/Locations.js'; import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../webgl/polygonreplay/defaultshader/Locations.js';
import _ol_render_webgl_LineStringReplay_ from '../webgl/LineStringReplay.js'; import WebGLLineStringReplay from '../webgl/LineStringReplay.js';
import _ol_render_webgl_Replay_ from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import Stroke from '../../style/Stroke.js'; import Stroke from '../../style/Stroke.js';
import LinkedList from '../../structs/LinkedList.js'; import LinkedList from '../../structs/LinkedList.js';
@@ -27,10 +27,10 @@ import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
* @param {ol.Extent} maxExtent Max extent. * @param {ol.Extent} maxExtent Max extent.
* @struct * @struct
*/ */
const _ol_render_webgl_PolygonReplay_ = function(tolerance, maxExtent) { const WebGLPolygonReplay = function(tolerance, maxExtent) {
_ol_render_webgl_Replay_.call(this, tolerance, maxExtent); WebGLReplay.call(this, tolerance, maxExtent);
this.lineStringReplay = new _ol_render_webgl_LineStringReplay_( this.lineStringReplay = new WebGLLineStringReplay(
tolerance, maxExtent); tolerance, maxExtent);
/** /**
@@ -63,7 +63,7 @@ const _ol_render_webgl_PolygonReplay_ = function(tolerance, maxExtent) {
}; };
inherits(_ol_render_webgl_PolygonReplay_, _ol_render_webgl_Replay_); inherits(WebGLPolygonReplay, WebGLReplay);
/** /**
@@ -73,7 +73,7 @@ inherits(_ol_render_webgl_PolygonReplay_, _ol_render_webgl_Replay_);
* @param {number} stride Stride. * @param {number} stride Stride.
* @private * @private
*/ */
_ol_render_webgl_PolygonReplay_.prototype.drawCoordinates_ = function( WebGLPolygonReplay.prototype.drawCoordinates_ = function(
flatCoordinates, holeFlatCoordinates, stride) { flatCoordinates, holeFlatCoordinates, stride) {
// Triangulate the polygon // Triangulate the polygon
const outerRing = new LinkedList(); const outerRing = new LinkedList();
@@ -138,7 +138,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawCoordinates_ = function(
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
* @param {boolean} clockwise Coordinate order should be clockwise. * @param {boolean} clockwise Coordinate order should be clockwise.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.processFlatCoordinates_ = function( WebGLPolygonReplay.prototype.processFlatCoordinates_ = function(
flatCoordinates, stride, list, rtree, clockwise) { flatCoordinates, stride, list, rtree, clockwise) {
const isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(flatCoordinates, const isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(flatCoordinates,
0, flatCoordinates.length, stride); 0, flatCoordinates.length, stride);
@@ -190,7 +190,7 @@ _ol_render_webgl_PolygonReplay_.prototype.processFlatCoordinates_ = function(
* @param {ol.structs.LinkedList} list Polygons ring. * @param {ol.structs.LinkedList} list Polygons ring.
* @return {Array.<number>} Max X coordinates. * @return {Array.<number>} Max X coordinates.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.getMaxCoords_ = function(list) { WebGLPolygonReplay.prototype.getMaxCoords_ = function(list) {
const start = list.firstItem(); const start = list.firstItem();
let seg = start; let seg = start;
let maxCoords = [seg.p0.x, seg.p0.y]; let maxCoords = [seg.p0.x, seg.p0.y];
@@ -214,7 +214,7 @@ _ol_render_webgl_PolygonReplay_.prototype.getMaxCoords_ = function(list) {
* @param {boolean} ccw The orientation of the polygon is counter-clockwise. * @param {boolean} ccw The orientation of the polygon is counter-clockwise.
* @return {boolean} There were reclassified points. * @return {boolean} There were reclassified points.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.classifyPoints_ = function(list, rtree, ccw) { WebGLPolygonReplay.prototype.classifyPoints_ = function(list, rtree, ccw) {
let start = list.firstItem(); let start = list.firstItem();
let s0 = start; let s0 = start;
let s1 = list.nextItem(); let s1 = list.nextItem();
@@ -252,7 +252,7 @@ _ol_render_webgl_PolygonReplay_.prototype.classifyPoints_ = function(list, rtree
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
* @return {boolean} Bridging was successful. * @return {boolean} Bridging was successful.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.bridgeHole_ = function(hole, holeMaxX, WebGLPolygonReplay.prototype.bridgeHole_ = function(hole, holeMaxX,
list, listMaxX, rtree) { list, listMaxX, rtree) {
let seg = hole.firstItem(); let seg = hole.firstItem();
while (seg.p1.x !== holeMaxX) { while (seg.p1.x !== holeMaxX) {
@@ -325,7 +325,7 @@ _ol_render_webgl_PolygonReplay_.prototype.bridgeHole_ = function(hole, holeMaxX,
* @param {ol.structs.LinkedList} list Linked list of the polygon. * @param {ol.structs.LinkedList} list Linked list of the polygon.
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.triangulate_ = function(list, rtree) { WebGLPolygonReplay.prototype.triangulate_ = function(list, rtree) {
let ccw = false; let ccw = false;
let simple = this.isSimple_(list, rtree); let simple = this.isSimple_(list, rtree);
@@ -378,7 +378,7 @@ _ol_render_webgl_PolygonReplay_.prototype.triangulate_ = function(list, rtree) {
* @param {boolean} ccw Orientation of the polygon is counter-clockwise. * @param {boolean} ccw Orientation of the polygon is counter-clockwise.
* @return {boolean} There were processed ears. * @return {boolean} There were processed ears.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.clipEars_ = function(list, rtree, simple, ccw) { WebGLPolygonReplay.prototype.clipEars_ = function(list, rtree, simple, ccw) {
let numIndices = this.indices.length; let numIndices = this.indices.length;
let start = list.firstItem(); let start = list.firstItem();
let s0 = list.getPrevItem(); let s0 = list.getPrevItem();
@@ -436,7 +436,7 @@ _ol_render_webgl_PolygonReplay_.prototype.clipEars_ = function(list, rtree, simp
* @param {boolean=} opt_touch Resolve touching segments. * @param {boolean=} opt_touch Resolve touching segments.
* @return {boolean} There were resolved intersections. * @return {boolean} There were resolved intersections.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.resolveSelfIntersections_ = function( WebGLPolygonReplay.prototype.resolveSelfIntersections_ = function(
list, rtree, opt_touch) { list, rtree, opt_touch) {
const start = list.firstItem(); const start = list.firstItem();
list.nextItem(); list.nextItem();
@@ -504,7 +504,7 @@ _ol_render_webgl_PolygonReplay_.prototype.resolveSelfIntersections_ = function(
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
* @return {boolean} The polygon is simple. * @return {boolean} The polygon is simple.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.isSimple_ = function(list, rtree) { WebGLPolygonReplay.prototype.isSimple_ = function(list, rtree) {
const start = list.firstItem(); const start = list.firstItem();
let seg = start; let seg = start;
do { do {
@@ -522,7 +522,7 @@ _ol_render_webgl_PolygonReplay_.prototype.isSimple_ = function(list, rtree) {
* @param {ol.structs.LinkedList} list Linked list of the polygon. * @param {ol.structs.LinkedList} list Linked list of the polygon.
* @return {boolean} Orientation is clockwise. * @return {boolean} Orientation is clockwise.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.isClockwise_ = function(list) { WebGLPolygonReplay.prototype.isClockwise_ = function(list) {
const length = list.getLength() * 2; const length = list.getLength() * 2;
const flatCoordinates = new Array(length); const flatCoordinates = new Array(length);
const start = list.firstItem(); const start = list.firstItem();
@@ -542,7 +542,7 @@ _ol_render_webgl_PolygonReplay_.prototype.isClockwise_ = function(list) {
* @param {ol.structs.LinkedList} list Linked list of the polygon. * @param {ol.structs.LinkedList} list Linked list of the polygon.
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.splitPolygon_ = function(list, rtree) { WebGLPolygonReplay.prototype.splitPolygon_ = function(list, rtree) {
const start = list.firstItem(); const start = list.firstItem();
let s0 = start; let s0 = start;
do { do {
@@ -588,7 +588,7 @@ _ol_render_webgl_PolygonReplay_.prototype.splitPolygon_ = function(list, rtree)
* @param {number} i Index. * @param {number} i Index.
* @return {ol.WebglPolygonVertex} List item. * @return {ol.WebglPolygonVertex} List item.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.createPoint_ = function(x, y, i) { WebGLPolygonReplay.prototype.createPoint_ = function(x, y, i) {
let numVertices = this.vertices.length; let numVertices = this.vertices.length;
this.vertices[numVertices++] = x; this.vertices[numVertices++] = x;
this.vertices[numVertices++] = y; this.vertices[numVertices++] = y;
@@ -611,7 +611,7 @@ _ol_render_webgl_PolygonReplay_.prototype.createPoint_ = function(x, y, i) {
* @param {ol.structs.RBush=} opt_rtree Insert the segment into the R-Tree. * @param {ol.structs.RBush=} opt_rtree Insert the segment into the R-Tree.
* @return {ol.WebglPolygonSegment} segment. * @return {ol.WebglPolygonSegment} segment.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.insertItem_ = function(p0, p1, list, opt_rtree) { WebGLPolygonReplay.prototype.insertItem_ = function(p0, p1, list, opt_rtree) {
const seg = { const seg = {
p0: p0, p0: p0,
p1: p1 p1: p1
@@ -632,7 +632,7 @@ _ol_render_webgl_PolygonReplay_.prototype.insertItem_ = function(p0, p1, list, o
* @param {ol.structs.LinkedList} list Polygon ring. * @param {ol.structs.LinkedList} list Polygon ring.
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.removeItem_ = function(s0, s1, list, rtree) { WebGLPolygonReplay.prototype.removeItem_ = function(s0, s1, list, rtree) {
if (list.getCurrItem() === s1) { if (list.getCurrItem() === s1) {
list.removeItem(); list.removeItem();
s0.p1 = s1.p1; s0.p1 = s1.p1;
@@ -652,7 +652,7 @@ _ol_render_webgl_PolygonReplay_.prototype.removeItem_ = function(s0, s1, list, r
* @param {boolean=} opt_reflex Only include reflex points. * @param {boolean=} opt_reflex Only include reflex points.
* @return {Array.<ol.WebglPolygonVertex>} Points in the triangle. * @return {Array.<ol.WebglPolygonVertex>} Points in the triangle.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.getPointsInTriangle_ = function(p0, p1, WebGLPolygonReplay.prototype.getPointsInTriangle_ = function(p0, p1,
p2, rtree, opt_reflex) { p2, rtree, opt_reflex) {
let i, ii, j, p; let i, ii, j, p;
const result = []; const result = [];
@@ -683,7 +683,7 @@ _ol_render_webgl_PolygonReplay_.prototype.getPointsInTriangle_ = function(p0, p1
* @param {boolean=} opt_touch Touching segments should be considered an intersection. * @param {boolean=} opt_touch Touching segments should be considered an intersection.
* @return {Array.<ol.WebglPolygonSegment>} Intersecting segments. * @return {Array.<ol.WebglPolygonSegment>} Intersecting segments.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.getIntersections_ = function(segment, rtree, opt_touch) { WebGLPolygonReplay.prototype.getIntersections_ = function(segment, rtree, opt_touch) {
const p0 = segment.p0; const p0 = segment.p0;
const p1 = segment.p1; const p1 = segment.p1;
const segmentsInExtent = rtree.getInExtent([Math.min(p0.x, p1.x), const segmentsInExtent = rtree.getInExtent([Math.min(p0.x, p1.x),
@@ -713,7 +713,7 @@ _ol_render_webgl_PolygonReplay_.prototype.getIntersections_ = function(segment,
* @param {boolean=} opt_touch Touching segments should be considered an intersection. * @param {boolean=} opt_touch Touching segments should be considered an intersection.
* @return {Array.<number>|undefined} Intersection coordinates. * @return {Array.<number>|undefined} Intersection coordinates.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.calculateIntersection_ = function(p0, WebGLPolygonReplay.prototype.calculateIntersection_ = function(p0,
p1, p2, p3, opt_touch) { p1, p2, p3, opt_touch) {
const denom = (p3.y - p2.y) * (p1.x - p0.x) - (p3.x - p2.x) * (p1.y - p0.y); const denom = (p3.y - p2.y) * (p1.x - p0.x) - (p3.x - p2.x) * (p1.y - p0.y);
if (denom !== 0) { if (denom !== 0) {
@@ -738,7 +738,7 @@ _ol_render_webgl_PolygonReplay_.prototype.calculateIntersection_ = function(p0,
* @param {ol.WebglPolygonVertex} p4 Point after the end of the diagonal. * @param {ol.WebglPolygonVertex} p4 Point after the end of the diagonal.
* @return {boolean} Diagonal is inside the polygon. * @return {boolean} Diagonal is inside the polygon.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.diagonalIsInside_ = function(p0, p1, p2, p3, p4) { WebGLPolygonReplay.prototype.diagonalIsInside_ = function(p0, p1, p2, p3, p4) {
if (p1.reflex === undefined || p3.reflex === undefined) { if (p1.reflex === undefined || p3.reflex === undefined) {
return false; return false;
} }
@@ -755,7 +755,7 @@ _ol_render_webgl_PolygonReplay_.prototype.diagonalIsInside_ = function(p0, p1, p
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_PolygonReplay_.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) { WebGLPolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, feature) {
const endss = multiPolygonGeometry.getEndss(); const endss = multiPolygonGeometry.getEndss();
const stride = multiPolygonGeometry.getStride(); const stride = multiPolygonGeometry.getStride();
const currIndex = this.indices.length; const currIndex = this.indices.length;
@@ -801,7 +801,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawMultiPolygon = function(multiPolyg
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_PolygonReplay_.prototype.drawPolygon = function(polygonGeometry, feature) { WebGLPolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) {
const ends = polygonGeometry.getEnds(); const ends = polygonGeometry.getEnds();
const stride = polygonGeometry.getStride(); const stride = polygonGeometry.getStride();
if (ends.length > 0) { if (ends.length > 0) {
@@ -837,7 +837,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawPolygon = function(polygonGeometry
/** /**
* @inheritDoc * @inheritDoc
**/ **/
_ol_render_webgl_PolygonReplay_.prototype.finish = function(context) { WebGLPolygonReplay.prototype.finish = function(context) {
// create, bind, and populate the vertices buffer // create, bind, and populate the vertices buffer
this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices); this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices);
@@ -861,7 +861,7 @@ _ol_render_webgl_PolygonReplay_.prototype.finish = function(context) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_PolygonReplay_.prototype.getDeleteResourcesFunction = function(context) { WebGLPolygonReplay.prototype.getDeleteResourcesFunction = function(context) {
const verticesBuffer = this.verticesBuffer; const verticesBuffer = this.verticesBuffer;
const indicesBuffer = this.indicesBuffer; const indicesBuffer = this.indicesBuffer;
const lineDeleter = this.lineStringReplay.getDeleteResourcesFunction(context); const lineDeleter = this.lineStringReplay.getDeleteResourcesFunction(context);
@@ -876,7 +876,7 @@ _ol_render_webgl_PolygonReplay_.prototype.getDeleteResourcesFunction = function(
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_PolygonReplay_.prototype.setUpProgram = function(gl, context, size, pixelRatio) { WebGLPolygonReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
// get the program // get the program
const fragmentShader = _ol_render_webgl_polygonreplay_defaultshader_.fragment; const fragmentShader = _ol_render_webgl_polygonreplay_defaultshader_.fragment;
const vertexShader = _ol_render_webgl_polygonreplay_defaultshader_.vertex; const vertexShader = _ol_render_webgl_polygonreplay_defaultshader_.vertex;
@@ -905,7 +905,7 @@ _ol_render_webgl_PolygonReplay_.prototype.setUpProgram = function(gl, context, s
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_PolygonReplay_.prototype.shutDownProgram = function(gl, locations) { WebGLPolygonReplay.prototype.shutDownProgram = function(gl, locations) {
gl.disableVertexAttribArray(locations.a_position); gl.disableVertexAttribArray(locations.a_position);
}; };
@@ -913,7 +913,7 @@ _ol_render_webgl_PolygonReplay_.prototype.shutDownProgram = function(gl, locatio
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_PolygonReplay_.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) { WebGLPolygonReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
//Save GL parameters. //Save GL parameters.
const tmpDepthFunc = /** @type {number} */ (gl.getParameter(gl.DEPTH_FUNC)); const tmpDepthFunc = /** @type {number} */ (gl.getParameter(gl.DEPTH_FUNC));
const tmpDepthMask = /** @type {boolean} */ (gl.getParameter(gl.DEPTH_WRITEMASK)); const tmpDepthMask = /** @type {boolean} */ (gl.getParameter(gl.DEPTH_WRITEMASK));
@@ -951,7 +951,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawReplay = function(gl, context, ski
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_PolygonReplay_.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash, WebGLPolygonReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) { featureCallback, opt_hitExtent) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex; let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2; featureIndex = this.startIndices.length - 2;
@@ -996,7 +996,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawHitDetectionReplayOneByOne = funct
* @param {ol.webgl.Context} context Context. * @param {ol.webgl.Context} context Context.
* @param {Object} skippedFeaturesHash Ids of features to skip. * @param {Object} skippedFeaturesHash Ids of features to skip.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) { WebGLPolygonReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart; let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2; featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1]; end = start = this.startIndices[featureIndex + 1];
@@ -1035,7 +1035,7 @@ _ol_render_webgl_PolygonReplay_.prototype.drawReplaySkipping_ = function(gl, con
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {Array.<number>} color Color. * @param {Array.<number>} color Color.
*/ */
_ol_render_webgl_PolygonReplay_.prototype.setFillStyle_ = function(gl, color) { WebGLPolygonReplay.prototype.setFillStyle_ = function(gl, color) {
gl.uniform4fv(this.defaultLocations_.u_color, color); gl.uniform4fv(this.defaultLocations_.u_color, color);
}; };
@@ -1043,7 +1043,7 @@ _ol_render_webgl_PolygonReplay_.prototype.setFillStyle_ = function(gl, color) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_PolygonReplay_.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { WebGLPolygonReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
let fillStyleColor = fillStyle ? fillStyle.getColor() : [0, 0, 0, 0]; let fillStyleColor = fillStyle ? fillStyle.getColor() : [0, 0, 0, 0];
if (!(fillStyleColor instanceof CanvasGradient) && if (!(fillStyleColor instanceof CanvasGradient) &&
!(fillStyleColor instanceof CanvasPattern)) { !(fillStyleColor instanceof CanvasPattern)) {
@@ -1069,4 +1069,4 @@ _ol_render_webgl_PolygonReplay_.prototype.setFillStrokeStyle = function(fillStyl
this.lineStringReplay.setFillStrokeStyle(null, nullStrokeStyle); this.lineStringReplay.setFillStrokeStyle(null, nullStrokeStyle);
} }
}; };
export default _ol_render_webgl_PolygonReplay_; export default WebGLPolygonReplay;
+13 -13
View File
@@ -16,7 +16,7 @@ import _ol_webgl_ from '../../webgl.js';
* @param {ol.Extent} maxExtent Max extent. * @param {ol.Extent} maxExtent Max extent.
* @struct * @struct
*/ */
const _ol_render_webgl_Replay_ = function(tolerance, maxExtent) { const WebGLReplay = function(tolerance, maxExtent) {
VectorContext.call(this); VectorContext.call(this);
/** /**
@@ -113,7 +113,7 @@ const _ol_render_webgl_Replay_ = function(tolerance, maxExtent) {
}; };
inherits(_ol_render_webgl_Replay_, VectorContext); inherits(WebGLReplay, VectorContext);
/** /**
@@ -121,14 +121,14 @@ inherits(_ol_render_webgl_Replay_, VectorContext);
* @param {ol.webgl.Context} context WebGL context. * @param {ol.webgl.Context} context WebGL context.
* @return {function()} Delete resources function. * @return {function()} Delete resources function.
*/ */
_ol_render_webgl_Replay_.prototype.getDeleteResourcesFunction = function(context) {}; WebGLReplay.prototype.getDeleteResourcesFunction = function(context) {};
/** /**
* @abstract * @abstract
* @param {ol.webgl.Context} context Context. * @param {ol.webgl.Context} context Context.
*/ */
_ol_render_webgl_Replay_.prototype.finish = function(context) {}; WebGLReplay.prototype.finish = function(context) {};
/** /**
@@ -143,7 +143,7 @@ _ol_render_webgl_Replay_.prototype.finish = function(context) {};
ol.render.webgl.polygonreplay.defaultshader.Locations| ol.render.webgl.polygonreplay.defaultshader.Locations|
ol.render.webgl.texturereplay.defaultshader.Locations} Locations. ol.render.webgl.texturereplay.defaultshader.Locations} Locations.
*/ */
_ol_render_webgl_Replay_.prototype.setUpProgram = function(gl, context, size, pixelRatio) {}; WebGLReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {};
/** /**
@@ -155,7 +155,7 @@ _ol_render_webgl_Replay_.prototype.setUpProgram = function(gl, context, size, pi
ol.render.webgl.polygonreplay.defaultshader.Locations| ol.render.webgl.polygonreplay.defaultshader.Locations|
ol.render.webgl.texturereplay.defaultshader.Locations} locations Locations. ol.render.webgl.texturereplay.defaultshader.Locations} locations Locations.
*/ */
_ol_render_webgl_Replay_.prototype.shutDownProgram = function(gl, locations) {}; WebGLReplay.prototype.shutDownProgram = function(gl, locations) {};
/** /**
@@ -167,7 +167,7 @@ _ol_render_webgl_Replay_.prototype.shutDownProgram = function(gl, locations) {};
* to skip. * to skip.
* @param {boolean} hitDetection Hit detection mode. * @param {boolean} hitDetection Hit detection mode.
*/ */
_ol_render_webgl_Replay_.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {}; WebGLReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {};
/** /**
@@ -183,7 +183,7 @@ _ol_render_webgl_Replay_.prototype.drawReplay = function(gl, context, skippedFea
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_webgl_Replay_.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {}; WebGLReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {};
/** /**
@@ -199,7 +199,7 @@ _ol_render_webgl_Replay_.prototype.drawHitDetectionReplayOneByOne = function(gl,
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_webgl_Replay_.prototype.drawHitDetectionReplay = function(gl, context, skippedFeaturesHash, WebGLReplay.prototype.drawHitDetectionReplay = function(gl, context, skippedFeaturesHash,
featureCallback, oneByOne, opt_hitExtent) { featureCallback, oneByOne, opt_hitExtent) {
if (!oneByOne) { if (!oneByOne) {
// draw all hit-detection features in "once" (by texture group) // draw all hit-detection features in "once" (by texture group)
@@ -223,7 +223,7 @@ _ol_render_webgl_Replay_.prototype.drawHitDetectionReplay = function(gl, context
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_webgl_Replay_.prototype.drawHitDetectionReplayAll = function(gl, context, skippedFeaturesHash, WebGLReplay.prototype.drawHitDetectionReplayAll = function(gl, context, skippedFeaturesHash,
featureCallback) { featureCallback) {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
this.drawReplay(gl, context, skippedFeaturesHash, true); this.drawReplay(gl, context, skippedFeaturesHash, true);
@@ -254,7 +254,7 @@ _ol_render_webgl_Replay_.prototype.drawHitDetectionReplayAll = function(gl, cont
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_webgl_Replay_.prototype.replay = function(context, WebGLReplay.prototype.replay = function(context,
center, resolution, rotation, size, pixelRatio, center, resolution, rotation, size, pixelRatio,
opacity, skippedFeaturesHash, opacity, skippedFeaturesHash,
featureCallback, oneByOne, opt_hitExtent) { featureCallback, oneByOne, opt_hitExtent) {
@@ -350,7 +350,7 @@ _ol_render_webgl_Replay_.prototype.replay = function(context,
* @param {number} start Start index. * @param {number} start Start index.
* @param {number} end End index. * @param {number} end End index.
*/ */
_ol_render_webgl_Replay_.prototype.drawElements = function( WebGLReplay.prototype.drawElements = function(
gl, context, start, end) { gl, context, start, end) {
const elementType = context.hasOESElementIndexUint ? const elementType = context.hasOESElementIndexUint ?
_ol_webgl_.UNSIGNED_INT : _ol_webgl_.UNSIGNED_SHORT; _ol_webgl_.UNSIGNED_INT : _ol_webgl_.UNSIGNED_SHORT;
@@ -360,4 +360,4 @@ _ol_render_webgl_Replay_.prototype.drawElements = function(
const offsetInBytes = start * elementSize; const offsetInBytes = start * elementSize;
gl.drawElements(_ol_webgl_.TRIANGLES, numItems, elementType, offsetInBytes); gl.drawElements(_ol_webgl_.TRIANGLES, numItems, elementType, offsetInBytes);
}; };
export default _ol_render_webgl_Replay_; export default WebGLReplay;
+29 -29
View File
@@ -6,12 +6,12 @@ import {numberSafeCompareFunction} from '../../array.js';
import {buffer, createOrUpdateFromCoordinate} from '../../extent.js'; import {buffer, createOrUpdateFromCoordinate} from '../../extent.js';
import _ol_obj_ from '../../obj.js'; import _ol_obj_ from '../../obj.js';
import _ol_render_replay_ from '../replay.js'; import _ol_render_replay_ from '../replay.js';
import _ol_render_ReplayGroup_ from '../ReplayGroup.js'; import ReplayGroup from '../ReplayGroup.js';
import _ol_render_webgl_CircleReplay_ from '../webgl/CircleReplay.js'; import WebGLCircleReplay from '../webgl/CircleReplay.js';
import _ol_render_webgl_ImageReplay_ from '../webgl/ImageReplay.js'; import WebGLImageReplay from '../webgl/ImageReplay.js';
import _ol_render_webgl_LineStringReplay_ from '../webgl/LineStringReplay.js'; import WebGLLineStringReplay from '../webgl/LineStringReplay.js';
import _ol_render_webgl_PolygonReplay_ from '../webgl/PolygonReplay.js'; import WebGLPolygonReplay from '../webgl/PolygonReplay.js';
import _ol_render_webgl_TextReplay_ from '../webgl/TextReplay.js'; import WebGLTextReplay from '../webgl/TextReplay.js';
/** /**
* @constructor * @constructor
@@ -21,8 +21,8 @@ import _ol_render_webgl_TextReplay_ from '../webgl/TextReplay.js';
* @param {number=} opt_renderBuffer Render buffer. * @param {number=} opt_renderBuffer Render buffer.
* @struct * @struct
*/ */
const _ol_render_webgl_ReplayGroup_ = function(tolerance, maxExtent, opt_renderBuffer) { const WebGLReplayGroup = function(tolerance, maxExtent, opt_renderBuffer) {
_ol_render_ReplayGroup_.call(this); ReplayGroup.call(this);
/** /**
* @type {ol.Extent} * @type {ol.Extent}
@@ -51,21 +51,21 @@ const _ol_render_webgl_ReplayGroup_ = function(tolerance, maxExtent, opt_renderB
}; };
inherits(_ol_render_webgl_ReplayGroup_, _ol_render_ReplayGroup_); inherits(WebGLReplayGroup, ReplayGroup);
/** /**
* @param {ol.style.Style} style Style. * @param {ol.style.Style} style Style.
* @param {boolean} group Group with previous replay. * @param {boolean} group Group with previous replay.
*/ */
_ol_render_webgl_ReplayGroup_.prototype.addDeclutter = function(style, group) {}; WebGLReplayGroup.prototype.addDeclutter = function(style, group) {};
/** /**
* @param {ol.webgl.Context} context WebGL context. * @param {ol.webgl.Context} context WebGL context.
* @return {function()} Delete resources function. * @return {function()} Delete resources function.
*/ */
_ol_render_webgl_ReplayGroup_.prototype.getDeleteResourcesFunction = function(context) { WebGLReplayGroup.prototype.getDeleteResourcesFunction = function(context) {
const functions = []; const functions = [];
let zKey; let zKey;
for (zKey in this.replaysByZIndex_) { for (zKey in this.replaysByZIndex_) {
@@ -89,7 +89,7 @@ _ol_render_webgl_ReplayGroup_.prototype.getDeleteResourcesFunction = function(co
/** /**
* @param {ol.webgl.Context} context Context. * @param {ol.webgl.Context} context Context.
*/ */
_ol_render_webgl_ReplayGroup_.prototype.finish = function(context) { WebGLReplayGroup.prototype.finish = function(context) {
let zKey; let zKey;
for (zKey in this.replaysByZIndex_) { for (zKey in this.replaysByZIndex_) {
const replays = this.replaysByZIndex_[zKey]; const replays = this.replaysByZIndex_[zKey];
@@ -103,7 +103,7 @@ _ol_render_webgl_ReplayGroup_.prototype.finish = function(context) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_ReplayGroup_.prototype.getReplay = function(zIndex, replayType) { WebGLReplayGroup.prototype.getReplay = function(zIndex, replayType) {
const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0'; const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
let replays = this.replaysByZIndex_[zIndexKey]; let replays = this.replaysByZIndex_[zIndexKey];
if (replays === undefined) { if (replays === undefined) {
@@ -115,7 +115,7 @@ _ol_render_webgl_ReplayGroup_.prototype.getReplay = function(zIndex, replayType)
/** /**
* @type {Function} * @type {Function}
*/ */
const Constructor = _ol_render_webgl_ReplayGroup_.BATCH_CONSTRUCTORS_[replayType]; const Constructor = WebGLReplayGroup.BATCH_CONSTRUCTORS_[replayType];
replay = new Constructor(this.tolerance_, this.maxExtent_); replay = new Constructor(this.tolerance_, this.maxExtent_);
replays[replayType] = replay; replays[replayType] = replay;
} }
@@ -126,7 +126,7 @@ _ol_render_webgl_ReplayGroup_.prototype.getReplay = function(zIndex, replayType)
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_ReplayGroup_.prototype.isEmpty = function() { WebGLReplayGroup.prototype.isEmpty = function() {
return _ol_obj_.isEmpty(this.replaysByZIndex_); return _ol_obj_.isEmpty(this.replaysByZIndex_);
}; };
@@ -142,7 +142,7 @@ _ol_render_webgl_ReplayGroup_.prototype.isEmpty = function() {
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip. * to skip.
*/ */
_ol_render_webgl_ReplayGroup_.prototype.replay = function(context, WebGLReplayGroup.prototype.replay = function(context,
center, resolution, rotation, size, pixelRatio, center, resolution, rotation, size, pixelRatio,
opacity, skippedFeaturesHash) { opacity, skippedFeaturesHash) {
/** @type {Array.<number>} */ /** @type {Array.<number>} */
@@ -183,7 +183,7 @@ _ol_render_webgl_ReplayGroup_.prototype.replay = function(context,
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_webgl_ReplayGroup_.prototype.replayHitDetection_ = function(context, WebGLReplayGroup.prototype.replayHitDetection_ = function(context,
center, resolution, rotation, size, pixelRatio, opacity, center, resolution, rotation, size, pixelRatio, opacity,
skippedFeaturesHash, featureCallback, oneByOne, opt_hitExtent) { skippedFeaturesHash, featureCallback, oneByOne, opt_hitExtent) {
/** @type {Array.<number>} */ /** @type {Array.<number>} */
@@ -226,7 +226,7 @@ _ol_render_webgl_ReplayGroup_.prototype.replayHitDetection_ = function(context,
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template T * @template T
*/ */
_ol_render_webgl_ReplayGroup_.prototype.forEachFeatureAtCoordinate = function( WebGLReplayGroup.prototype.forEachFeatureAtCoordinate = function(
coordinate, context, center, resolution, rotation, size, pixelRatio, coordinate, context, center, resolution, rotation, size, pixelRatio,
opacity, skippedFeaturesHash, opacity, skippedFeaturesHash,
callback) { callback) {
@@ -246,7 +246,7 @@ _ol_render_webgl_ReplayGroup_.prototype.forEachFeatureAtCoordinate = function(
} }
return this.replayHitDetection_(context, return this.replayHitDetection_(context,
coordinate, resolution, rotation, _ol_render_webgl_ReplayGroup_.HIT_DETECTION_SIZE_, coordinate, resolution, rotation, WebGLReplayGroup.HIT_DETECTION_SIZE_,
pixelRatio, opacity, skippedFeaturesHash, pixelRatio, opacity, skippedFeaturesHash,
/** /**
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
@@ -279,7 +279,7 @@ _ol_render_webgl_ReplayGroup_.prototype.forEachFeatureAtCoordinate = function(
* to skip. * to skip.
* @return {boolean} Is there a feature at the given coordinate? * @return {boolean} Is there a feature at the given coordinate?
*/ */
_ol_render_webgl_ReplayGroup_.prototype.hasFeatureAtCoordinate = function( WebGLReplayGroup.prototype.hasFeatureAtCoordinate = function(
coordinate, context, center, resolution, rotation, size, pixelRatio, coordinate, context, center, resolution, rotation, size, pixelRatio,
opacity, skippedFeaturesHash) { opacity, skippedFeaturesHash) {
const gl = context.getGL(); const gl = context.getGL();
@@ -287,7 +287,7 @@ _ol_render_webgl_ReplayGroup_.prototype.hasFeatureAtCoordinate = function(
gl.FRAMEBUFFER, context.getHitDetectionFramebuffer()); gl.FRAMEBUFFER, context.getHitDetectionFramebuffer());
const hasFeature = this.replayHitDetection_(context, const hasFeature = this.replayHitDetection_(context,
coordinate, resolution, rotation, _ol_render_webgl_ReplayGroup_.HIT_DETECTION_SIZE_, coordinate, resolution, rotation, WebGLReplayGroup.HIT_DETECTION_SIZE_,
pixelRatio, opacity, skippedFeaturesHash, pixelRatio, opacity, skippedFeaturesHash,
/** /**
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
@@ -307,7 +307,7 @@ _ol_render_webgl_ReplayGroup_.prototype.hasFeatureAtCoordinate = function(
* @private * @private
* @type {Array.<number>} * @type {Array.<number>}
*/ */
_ol_render_webgl_ReplayGroup_.HIT_DETECTION_SIZE_ = [1, 1]; WebGLReplayGroup.HIT_DETECTION_SIZE_ = [1, 1];
/** /**
* @const * @const
@@ -316,11 +316,11 @@ _ol_render_webgl_ReplayGroup_.HIT_DETECTION_SIZE_ = [1, 1];
* function(new: ol.render.webgl.Replay, number, * function(new: ol.render.webgl.Replay, number,
* ol.Extent)>} * ol.Extent)>}
*/ */
_ol_render_webgl_ReplayGroup_.BATCH_CONSTRUCTORS_ = { WebGLReplayGroup.BATCH_CONSTRUCTORS_ = {
'Circle': _ol_render_webgl_CircleReplay_, 'Circle': WebGLCircleReplay,
'Image': _ol_render_webgl_ImageReplay_, 'Image': WebGLImageReplay,
'LineString': _ol_render_webgl_LineStringReplay_, 'LineString': WebGLLineStringReplay,
'Polygon': _ol_render_webgl_PolygonReplay_, 'Polygon': WebGLPolygonReplay,
'Text': _ol_render_webgl_TextReplay_ 'Text': WebGLTextReplay
}; };
export default _ol_render_webgl_ReplayGroup_; export default WebGLReplayGroup;
+16 -16
View File
@@ -8,7 +8,7 @@ import GeometryType from '../../geom/GeometryType.js';
import _ol_has_ from '../../has.js'; import _ol_has_ from '../../has.js';
import _ol_render_replay_ from '../replay.js'; import _ol_render_replay_ from '../replay.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import _ol_render_webgl_TextureReplay_ from '../webgl/TextureReplay.js'; import WebGLTextureReplay from '../webgl/TextureReplay.js';
import AtlasManager from '../../style/AtlasManager.js'; import AtlasManager from '../../style/AtlasManager.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
@@ -19,8 +19,8 @@ import _ol_webgl_Buffer_ from '../../webgl/Buffer.js';
* @param {ol.Extent} maxExtent Max extent. * @param {ol.Extent} maxExtent Max extent.
* @struct * @struct
*/ */
const _ol_render_webgl_TextReplay_ = function(tolerance, maxExtent) { const WebGLTextReplay = function(tolerance, maxExtent) {
_ol_render_webgl_TextureReplay_.call(this, tolerance, maxExtent); WebGLTextureReplay.call(this, tolerance, maxExtent);
/** /**
* @private * @private
@@ -114,13 +114,13 @@ const _ol_render_webgl_TextReplay_ = function(tolerance, maxExtent) {
}; };
inherits(_ol_render_webgl_TextReplay_, _ol_render_webgl_TextureReplay_); inherits(WebGLTextReplay, WebGLTextureReplay);
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextReplay_.prototype.drawText = function(geometry, feature) { WebGLTextReplay.prototype.drawText = function(geometry, feature) {
if (this.text_) { if (this.text_) {
let flatCoordinates = null; let flatCoordinates = null;
const offset = 0; const offset = 0;
@@ -208,7 +208,7 @@ _ol_render_webgl_TextReplay_.prototype.drawText = function(geometry, feature) {
* @param {Array.<string>} lines Label to draw split to lines. * @param {Array.<string>} lines Label to draw split to lines.
* @return {Array.<number>} Size of the label in pixels. * @return {Array.<number>} Size of the label in pixels.
*/ */
_ol_render_webgl_TextReplay_.prototype.getTextSize_ = function(lines) { WebGLTextReplay.prototype.getTextSize_ = function(lines) {
const self = this; const self = this;
const glyphAtlas = this.currAtlas_; const glyphAtlas = this.currAtlas_;
const textHeight = lines.length * glyphAtlas.height; const textHeight = lines.length * glyphAtlas.height;
@@ -239,7 +239,7 @@ _ol_render_webgl_TextReplay_.prototype.getTextSize_ = function(lines) {
* @param {number} end End. * @param {number} end End.
* @param {number} stride Stride. * @param {number} stride Stride.
*/ */
_ol_render_webgl_TextReplay_.prototype.drawText_ = function(flatCoordinates, offset, WebGLTextReplay.prototype.drawText_ = function(flatCoordinates, offset,
end, stride) { end, stride) {
let i, ii; let i, ii;
for (i = offset, ii = end; i < ii; i += stride) { for (i = offset, ii = end; i < ii; i += stride) {
@@ -252,7 +252,7 @@ _ol_render_webgl_TextReplay_.prototype.drawText_ = function(flatCoordinates, off
* @private * @private
* @param {string} char Character. * @param {string} char Character.
*/ */
_ol_render_webgl_TextReplay_.prototype.addCharToAtlas_ = function(char) { WebGLTextReplay.prototype.addCharToAtlas_ = function(char) {
if (char.length === 1) { if (char.length === 1) {
const glyphAtlas = this.currAtlas_; const glyphAtlas = this.currAtlas_;
const state = this.state_; const state = this.state_;
@@ -302,7 +302,7 @@ _ol_render_webgl_TextReplay_.prototype.addCharToAtlas_ = function(char) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextReplay_.prototype.finish = function(context) { WebGLTextReplay.prototype.finish = function(context) {
const gl = context.getGL(); const gl = context.getGL();
this.groupIndices.push(this.indices.length); this.groupIndices.push(this.indices.length);
@@ -340,14 +340,14 @@ _ol_render_webgl_TextReplay_.prototype.finish = function(context) {
this.images_ = null; this.images_ = null;
this.atlases_ = {}; this.atlases_ = {};
this.currAtlas_ = undefined; this.currAtlas_ = undefined;
_ol_render_webgl_TextureReplay_.prototype.finish.call(this, context); WebGLTextureReplay.prototype.finish.call(this, context);
}; };
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextReplay_.prototype.setTextStyle = function(textStyle) { WebGLTextReplay.prototype.setTextStyle = function(textStyle) {
const state = this.state_; const state = this.state_;
const textFillStyle = textStyle.getFill(); const textFillStyle = textStyle.getFill();
const textStrokeStyle = textStyle.getStroke(); const textStrokeStyle = textStyle.getStroke();
@@ -400,7 +400,7 @@ _ol_render_webgl_TextReplay_.prototype.setTextStyle = function(textStyle) {
* @param {Object} state Font attributes. * @param {Object} state Font attributes.
* @return {ol.WebglGlyphAtlas} Glyph atlas. * @return {ol.WebglGlyphAtlas} Glyph atlas.
*/ */
_ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) { WebGLTextReplay.prototype.getAtlas_ = function(state) {
let params = []; let params = [];
let i; let i;
for (i in state) { for (i in state) {
@@ -436,7 +436,7 @@ _ol_render_webgl_TextReplay_.prototype.getAtlas_ = function(state) {
* @param {Array.<string|number>} params Array of parameters. * @param {Array.<string|number>} params Array of parameters.
* @return {string} Hash string. * @return {string} Hash string.
*/ */
_ol_render_webgl_TextReplay_.prototype.calculateHash_ = function(params) { WebGLTextReplay.prototype.calculateHash_ = function(params) {
//TODO: Create a more performant, reliable, general hash function. //TODO: Create a more performant, reliable, general hash function.
let i, ii; let i, ii;
let hash = ''; let hash = '';
@@ -450,7 +450,7 @@ _ol_render_webgl_TextReplay_.prototype.calculateHash_ = function(params) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextReplay_.prototype.getTextures = function(opt_all) { WebGLTextReplay.prototype.getTextures = function(opt_all) {
return this.textures_; return this.textures_;
}; };
@@ -458,7 +458,7 @@ _ol_render_webgl_TextReplay_.prototype.getTextures = function(opt_all) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextReplay_.prototype.getHitDetectionTextures = function() { WebGLTextReplay.prototype.getHitDetectionTextures = function() {
return this.textures_; return this.textures_;
}; };
export default _ol_render_webgl_TextReplay_; export default WebGLTextReplay;
+16 -16
View File
@@ -6,7 +6,7 @@ import {intersects} from '../../extent.js';
import _ol_obj_ from '../../obj.js'; import _ol_obj_ from '../../obj.js';
import _ol_render_webgl_texturereplay_defaultshader_ from '../webgl/texturereplay/defaultshader.js'; import _ol_render_webgl_texturereplay_defaultshader_ from '../webgl/texturereplay/defaultshader.js';
import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../webgl/texturereplay/defaultshader/Locations.js'; import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../webgl/texturereplay/defaultshader/Locations.js';
import _ol_render_webgl_Replay_ from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Context_ from '../../webgl/Context.js'; import _ol_webgl_Context_ from '../../webgl/Context.js';
@@ -18,8 +18,8 @@ import _ol_webgl_Context_ from '../../webgl/Context.js';
* @param {ol.Extent} maxExtent Max extent. * @param {ol.Extent} maxExtent Max extent.
* @struct * @struct
*/ */
const _ol_render_webgl_TextureReplay_ = function(tolerance, maxExtent) { const WebGLTextureReplay = function(tolerance, maxExtent) {
_ol_render_webgl_Replay_.call(this, tolerance, maxExtent); WebGLReplay.call(this, tolerance, maxExtent);
/** /**
* @type {number|undefined} * @type {number|undefined}
@@ -112,13 +112,13 @@ const _ol_render_webgl_TextureReplay_ = function(tolerance, maxExtent) {
this.width = undefined; this.width = undefined;
}; };
inherits(_ol_render_webgl_TextureReplay_, _ol_render_webgl_Replay_); inherits(WebGLTextureReplay, WebGLReplay);
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextureReplay_.prototype.getDeleteResourcesFunction = function(context) { WebGLTextureReplay.prototype.getDeleteResourcesFunction = function(context) {
const verticesBuffer = this.verticesBuffer; const verticesBuffer = this.verticesBuffer;
const indicesBuffer = this.indicesBuffer; const indicesBuffer = this.indicesBuffer;
const textures = this.getTextures(true); const textures = this.getTextures(true);
@@ -144,7 +144,7 @@ _ol_render_webgl_TextureReplay_.prototype.getDeleteResourcesFunction = function(
* @return {number} My end. * @return {number} My end.
* @protected * @protected
*/ */
_ol_render_webgl_TextureReplay_.prototype.drawCoordinates = function(flatCoordinates, offset, end, stride) { WebGLTextureReplay.prototype.drawCoordinates = function(flatCoordinates, offset, end, stride) {
const anchorX = /** @type {number} */ (this.anchorX); const anchorX = /** @type {number} */ (this.anchorX);
const anchorY = /** @type {number} */ (this.anchorY); const anchorY = /** @type {number} */ (this.anchorY);
const height = /** @type {number} */ (this.height); const height = /** @type {number} */ (this.height);
@@ -247,7 +247,7 @@ _ol_render_webgl_TextureReplay_.prototype.drawCoordinates = function(flatCoordin
* @param {Object.<string, WebGLTexture>} texturePerImage Texture cache. * @param {Object.<string, WebGLTexture>} texturePerImage Texture cache.
* @param {WebGLRenderingContext} gl Gl. * @param {WebGLRenderingContext} gl Gl.
*/ */
_ol_render_webgl_TextureReplay_.prototype.createTextures = function(textures, images, texturePerImage, gl) { WebGLTextureReplay.prototype.createTextures = function(textures, images, texturePerImage, gl) {
let texture, image, uid, i; let texture, image, uid, i;
const ii = images.length; const ii = images.length;
for (i = 0; i < ii; ++i) { for (i = 0; i < ii; ++i) {
@@ -269,7 +269,7 @@ _ol_render_webgl_TextureReplay_.prototype.createTextures = function(textures, im
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextureReplay_.prototype.setUpProgram = function(gl, context, size, pixelRatio) { WebGLTextureReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {
// get the program // get the program
const fragmentShader = _ol_render_webgl_texturereplay_defaultshader_.fragment; const fragmentShader = _ol_render_webgl_texturereplay_defaultshader_.fragment;
const vertexShader = _ol_render_webgl_texturereplay_defaultshader_.vertex; const vertexShader = _ol_render_webgl_texturereplay_defaultshader_.vertex;
@@ -315,7 +315,7 @@ _ol_render_webgl_TextureReplay_.prototype.setUpProgram = function(gl, context, s
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextureReplay_.prototype.shutDownProgram = function(gl, locations) { WebGLTextureReplay.prototype.shutDownProgram = function(gl, locations) {
gl.disableVertexAttribArray(locations.a_position); gl.disableVertexAttribArray(locations.a_position);
gl.disableVertexAttribArray(locations.a_offsets); gl.disableVertexAttribArray(locations.a_offsets);
gl.disableVertexAttribArray(locations.a_texCoord); gl.disableVertexAttribArray(locations.a_texCoord);
@@ -327,7 +327,7 @@ _ol_render_webgl_TextureReplay_.prototype.shutDownProgram = function(gl, locatio
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextureReplay_.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) { WebGLTextureReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
const textures = hitDetection ? this.getHitDetectionTextures() : this.getTextures(); const textures = hitDetection ? this.getHitDetectionTextures() : this.getTextures();
const groupIndices = hitDetection ? this.hitDetectionGroupIndices : this.groupIndices; const groupIndices = hitDetection ? this.hitDetectionGroupIndices : this.groupIndices;
@@ -372,7 +372,7 @@ _ol_render_webgl_TextureReplay_.prototype.drawReplay = function(gl, context, ski
* @param {Array.<WebGLTexture>} textures Textures. * @param {Array.<WebGLTexture>} textures Textures.
* @param {Array.<number>} groupIndices Texture group indices. * @param {Array.<number>} groupIndices Texture group indices.
*/ */
_ol_render_webgl_TextureReplay_.prototype.drawReplaySkipping = function(gl, context, skippedFeaturesHash, textures, WebGLTextureReplay.prototype.drawReplaySkipping = function(gl, context, skippedFeaturesHash, textures,
groupIndices) { groupIndices) {
let featureIndex = 0; let featureIndex = 0;
@@ -419,7 +419,7 @@ _ol_render_webgl_TextureReplay_.prototype.drawReplaySkipping = function(gl, cont
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextureReplay_.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash, WebGLTextureReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) { featureCallback, opt_hitExtent) {
let i, groupStart, start, end, feature, featureUid; let i, groupStart, start, end, feature, featureUid;
let featureIndex = this.startIndices.length - 1; let featureIndex = this.startIndices.length - 1;
@@ -461,7 +461,7 @@ _ol_render_webgl_TextureReplay_.prototype.drawHitDetectionReplayOneByOne = funct
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_render_webgl_TextureReplay_.prototype.finish = function(context) { WebGLTextureReplay.prototype.finish = function(context) {
this.anchorX = undefined; this.anchorX = undefined;
this.anchorY = undefined; this.anchorY = undefined;
this.height = undefined; this.height = undefined;
@@ -485,7 +485,7 @@ _ol_render_webgl_TextureReplay_.prototype.finish = function(context) {
* @param {boolean=} opt_all Return hit detection textures with regular ones. * @param {boolean=} opt_all Return hit detection textures with regular ones.
* @returns {Array.<WebGLTexture>} Textures. * @returns {Array.<WebGLTexture>} Textures.
*/ */
_ol_render_webgl_TextureReplay_.prototype.getTextures = function(opt_all) {}; WebGLTextureReplay.prototype.getTextures = function(opt_all) {};
/** /**
@@ -493,5 +493,5 @@ _ol_render_webgl_TextureReplay_.prototype.getTextures = function(opt_all) {};
* @protected * @protected
* @returns {Array.<WebGLTexture>} Textures. * @returns {Array.<WebGLTexture>} Textures.
*/ */
_ol_render_webgl_TextureReplay_.prototype.getHitDetectionTextures = function() {}; WebGLTextureReplay.prototype.getHitDetectionTextures = function() {};
export default _ol_render_webgl_TextureReplay_; export default WebGLTextureReplay;
+2 -2
View File
@@ -11,7 +11,7 @@ import rbush from 'rbush';
import {buffer, createEmpty, containsExtent, getWidth} from '../../extent.js'; import {buffer, createEmpty, containsExtent, getWidth} from '../../extent.js';
import RenderEventType from '../../render/EventType.js'; import RenderEventType from '../../render/EventType.js';
import _ol_render_canvas_ from '../../render/canvas.js'; import _ol_render_canvas_ from '../../render/canvas.js';
import _ol_render_canvas_ReplayGroup_ from '../../render/canvas/ReplayGroup.js'; import CanvasReplayGroup from '../../render/canvas/ReplayGroup.js';
import RendererType from '../Type.js'; import RendererType from '../Type.js';
import CanvasLayerRenderer from '../canvas/Layer.js'; import CanvasLayerRenderer from '../canvas/Layer.js';
import _ol_renderer_vector_ from '../vector.js'; import _ol_renderer_vector_ from '../vector.js';
@@ -354,7 +354,7 @@ CanvasVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerSta
this.dirty_ = false; this.dirty_ = false;
const replayGroup = new _ol_render_canvas_ReplayGroup_( const replayGroup = new CanvasReplayGroup(
_ol_renderer_vector_.getTolerance(resolution, pixelRatio), extent, resolution, _ol_renderer_vector_.getTolerance(resolution, pixelRatio), extent, resolution,
pixelRatio, vectorSource.getOverlaps(), this.declutterTree_, vectorLayer.getRenderBuffer()); pixelRatio, vectorSource.getOverlaps(), this.declutterTree_, vectorLayer.getRenderBuffer());
vectorSource.loadFeatures(extent, resolution, projection); vectorSource.loadFeatures(extent, resolution, projection);
+3 -3
View File
@@ -14,7 +14,7 @@ import {equivalent as equivalentProjection} from '../../proj.js';
import Units from '../../proj/Units.js'; import Units from '../../proj/Units.js';
import ReplayType from '../../render/ReplayType.js'; import ReplayType from '../../render/ReplayType.js';
import _ol_render_canvas_ from '../../render/canvas.js'; import _ol_render_canvas_ from '../../render/canvas.js';
import _ol_render_canvas_ReplayGroup_ from '../../render/canvas/ReplayGroup.js'; import CanvasReplayGroup from '../../render/canvas/ReplayGroup.js';
import _ol_render_replay_ from '../../render/replay.js'; import _ol_render_replay_ from '../../render/replay.js';
import RendererType from '../Type.js'; import RendererType from '../Type.js';
import CanvasTileLayerRenderer from '../canvas/TileLayer.js'; import CanvasTileLayerRenderer from '../canvas/TileLayer.js';
@@ -190,7 +190,7 @@ CanvasVectorTileLayerRenderer.prototype.createReplayGroup_ = function(
sourceTile.setProjection(projection); sourceTile.setProjection(projection);
} }
replayState.dirty = false; replayState.dirty = false;
const replayGroup = new _ol_render_canvas_ReplayGroup_(0, sharedExtent, resolution, const replayGroup = new CanvasReplayGroup(0, sharedExtent, resolution,
pixelRatio, source.getOverlaps(), this.declutterTree_, layer.getRenderBuffer()); pixelRatio, source.getOverlaps(), this.declutterTree_, layer.getRenderBuffer());
const squaredTolerance = _ol_renderer_vector_.getSquaredTolerance( const squaredTolerance = _ol_renderer_vector_.getSquaredTolerance(
resolution, pixelRatio); resolution, pixelRatio);
@@ -441,7 +441,7 @@ CanvasVectorTileLayerRenderer.prototype.postCompose = function(context, frameSta
} }
} }
if (declutterReplays) { if (declutterReplays) {
_ol_render_canvas_ReplayGroup_.replayDeclutter(declutterReplays, context, rotation); CanvasReplayGroup.replayDeclutter(declutterReplays, context, rotation);
} }
if (rotation) { if (rotation) {
_ol_render_canvas_.rotateAtOffset(context, rotation, _ol_render_canvas_.rotateAtOffset(context, rotation,
+2 -2
View File
@@ -5,7 +5,7 @@ import {getUid, inherits} from '../../index.js';
import LayerType from '../../LayerType.js'; import LayerType from '../../LayerType.js';
import ViewHint from '../../ViewHint.js'; import ViewHint from '../../ViewHint.js';
import {buffer, containsExtent, createEmpty} from '../../extent.js'; import {buffer, containsExtent, createEmpty} from '../../extent.js';
import _ol_render_webgl_ReplayGroup_ from '../../render/webgl/ReplayGroup.js'; import WebGLReplayGroup from '../../render/webgl/ReplayGroup.js';
import RendererType from '../Type.js'; import RendererType from '../Type.js';
import _ol_renderer_vector_ from '../vector.js'; import _ol_renderer_vector_ from '../vector.js';
import WebGLLayerRenderer from '../webgl/Layer.js'; import WebGLLayerRenderer from '../webgl/Layer.js';
@@ -256,7 +256,7 @@ WebGLVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerStat
this.dirty_ = false; this.dirty_ = false;
const replayGroup = new _ol_render_webgl_ReplayGroup_( const replayGroup = new WebGLReplayGroup(
_ol_renderer_vector_.getTolerance(resolution, pixelRatio), _ol_renderer_vector_.getTolerance(resolution, pixelRatio),
extent, vectorLayer.getRenderBuffer()); extent, vectorLayer.getRenderBuffer());
vectorSource.loadFeatures(extent, resolution, projection); vectorSource.loadFeatures(extent, resolution, projection);
+3 -3
View File
@@ -1,11 +1,11 @@
import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js'; import WMTSCapabilities from '../../../../src/ol/format/WMTSCapabilities.js';
describe('ol.format.WMTSCapabilities', function() { describe('ol.format.WMTSCapabilities', function() {
describe('when parsing ogcsample.xml', function() { describe('when parsing ogcsample.xml', function() {
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
let capabilities; let capabilities;
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) { afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) {
@@ -116,7 +116,7 @@ describe('ol.format.WMTSCapabilities', function() {
describe('when parsing ign.xml', function() { describe('when parsing ign.xml', function() {
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
let capabilities; let capabilities;
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) { afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) {
+9 -9
View File
@@ -4,7 +4,7 @@ import Map from '../../../../src/ol/Map.js';
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js'; import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
import View from '../../../../src/ol/View.js'; import View from '../../../../src/ol/View.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import _ol_interaction_Translate_ from '../../../../src/ol/interaction/Translate.js'; import Translate from '../../../../src/ol/interaction/Translate.js';
import Interaction from '../../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../../src/ol/interaction/Interaction.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js';
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js'; import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
@@ -109,11 +109,11 @@ describe('ol.interaction.Translate', function() {
const endevent = events[events.length - 1]; const endevent = events[events.length - 1];
// first event should be translatestart // first event should be translatestart
expect(startevent).to.be.an(_ol_interaction_Translate_.Event); expect(startevent).to.be.an(Translate.Event);
expect(startevent.type).to.eql('translatestart'); expect(startevent.type).to.eql('translatestart');
// last event should be translateend // last event should be translateend
expect(endevent).to.be.an(_ol_interaction_Translate_.Event); expect(endevent).to.be.an(Translate.Event);
expect(endevent.type).to.eql('translateend'); expect(endevent.type).to.eql('translateend');
// make sure we get change events to events array // make sure we get change events to events array
@@ -132,10 +132,10 @@ describe('ol.interaction.Translate', function() {
describe('constructor', function() { describe('constructor', function() {
it('creates a new interaction', function() { it('creates a new interaction', function() {
const translate = new _ol_interaction_Translate_({ const translate = new Translate({
features: features features: features
}); });
expect(translate).to.be.a(_ol_interaction_Translate_); expect(translate).to.be.a(Translate);
expect(translate).to.be.a(Interaction); expect(translate).to.be.a(Interaction);
}); });
@@ -144,7 +144,7 @@ describe('ol.interaction.Translate', function() {
describe('setActive', function() { describe('setActive', function() {
it('works when the map is not set', function() { it('works when the map is not set', function() {
const translate = new _ol_interaction_Translate_({ const translate = new Translate({
features: features features: features
}); });
expect(translate.getActive()).to.be(true); expect(translate.getActive()).to.be(true);
@@ -158,7 +158,7 @@ describe('ol.interaction.Translate', function() {
let translate; let translate;
beforeEach(function() { beforeEach(function() {
translate = new _ol_interaction_Translate_({ translate = new Translate({
features: new Collection([features[0]]) features: new Collection([features[0]])
}); });
map.addInteraction(translate); map.addInteraction(translate);
@@ -197,7 +197,7 @@ describe('ol.interaction.Translate', function() {
let translate; let translate;
beforeEach(function() { beforeEach(function() {
translate = new _ol_interaction_Translate_(); translate = new Translate();
map.addInteraction(translate); map.addInteraction(translate);
}); });
@@ -219,7 +219,7 @@ describe('ol.interaction.Translate', function() {
let element, translate; let element, translate;
beforeEach(function() { beforeEach(function() {
translate = new _ol_interaction_Translate_(); translate = new Translate();
map.addInteraction(translate); map.addInteraction(translate);
element = map.getViewport(); element = map.getViewport();
}); });
@@ -1,4 +1,4 @@
import _ol_render_canvas_ReplayGroup_ from '../../../../../src/ol/render/canvas/ReplayGroup.js'; import CanvasReplayGroup from '../../../../../src/ol/render/canvas/ReplayGroup.js';
describe('ol.render.canvas.ReplayGroup', function() { describe('ol.render.canvas.ReplayGroup', function() {
@@ -8,7 +8,7 @@ describe('ol.render.canvas.ReplayGroup', function() {
const radius = 10; const radius = 10;
const minRadiusSq = Math.pow(radius - Math.SQRT2, 2); const minRadiusSq = Math.pow(radius - Math.SQRT2, 2);
const maxRadiusSq = Math.pow(radius + Math.SQRT2, 2); const maxRadiusSq = Math.pow(radius + Math.SQRT2, 2);
const circleArray = _ol_render_canvas_ReplayGroup_.getCircleArray_(radius); const circleArray = CanvasReplayGroup.getCircleArray_(radius);
const size = radius * 2 + 1; const size = radius * 2 + 1;
expect(circleArray.length).to.be(size); expect(circleArray.length).to.be(size);
@@ -1,13 +1,13 @@
import Feature from '../../../../../src/ol/Feature.js'; import Feature from '../../../../../src/ol/Feature.js';
import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
import Polygon from '../../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js';
import _ol_render_canvas_TextReplay_ from '../../../../../src/ol/render/canvas/TextReplay.js'; import CanvasTextReplay from '../../../../../src/ol/render/canvas/TextReplay.js';
import Text from '../../../../../src/ol/style/Text.js'; import Text from '../../../../../src/ol/style/Text.js';
describe('ol.render.canvas.TextReplay', function() { describe('ol.render.canvas.TextReplay', function() {
it('renders polygon labels only when they fit', function() { it('renders polygon labels only when they fit', function() {
const replay = new _ol_render_canvas_TextReplay_(1, [-180, -90, 180, 90], 0.02, 1, true); const replay = new CanvasTextReplay(1, [-180, -90, 180, 90], 0.02, 1, true);
const geometry = new Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]); const geometry = new Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]);
const feature = new Feature(geometry); const feature = new Feature(geometry);
@@ -25,7 +25,7 @@ describe('ol.render.canvas.TextReplay', function() {
}); });
it('renders multipolygon labels only when they fit', function() { it('renders multipolygon labels only when they fit', function() {
const replay = new _ol_render_canvas_TextReplay_(1, [-180, -90, 180, 90], 0.02, 1, true); const replay = new CanvasTextReplay(1, [-180, -90, 180, 90], 0.02, 1, true);
const geometry = new MultiPolygon([ const geometry = new MultiPolygon([
[[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]], [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]],
[[[1, 1], [1, 2], [2, 2], [2, 1], [1, 1]]] [[[1, 1], [1, 2], [2, 2], [2, 1], [1, 1]]]
@@ -1,7 +1,7 @@
import {getUid} from '../../../../../src/ol/index.js'; import {getUid} from '../../../../../src/ol/index.js';
import Feature from '../../../../../src/ol/Feature.js'; import Feature from '../../../../../src/ol/Feature.js';
import Circle from '../../../../../src/ol/geom/Circle.js'; import Circle from '../../../../../src/ol/geom/Circle.js';
import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/CircleReplay.js'; import WebGLCircleReplay from '../../../../../src/ol/render/webgl/CircleReplay.js';
import _ol_render_webgl_circlereplay_defaultshader_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js'; import _ol_render_webgl_circlereplay_defaultshader_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js';
import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader/Locations.js'; import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader/Locations.js';
import Fill from '../../../../../src/ol/style/Fill.js'; import Fill from '../../../../../src/ol/style/Fill.js';
@@ -21,7 +21,7 @@ describe('ol.render.webgl.CircleReplay', function() {
beforeEach(function() { beforeEach(function() {
const tolerance = 0.1; const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000]; const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_CircleReplay_(tolerance, maxExtent); replay = new WebGLCircleReplay(tolerance, maxExtent);
}); });
describe('#setFillStrokeStyle', function() { describe('#setFillStrokeStyle', function() {
@@ -1,6 +1,6 @@
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js'; import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
import Point from '../../../../../src/ol/geom/Point.js'; import Point from '../../../../../src/ol/geom/Point.js';
import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/ImageReplay.js'; import WebGLImageReplay from '../../../../../src/ol/render/webgl/ImageReplay.js';
import ImageStyle from '../../../../../src/ol/style/Image.js'; import ImageStyle from '../../../../../src/ol/style/Image.js';
describe('ol.render.webgl.ImageReplay', function() { describe('ol.render.webgl.ImageReplay', function() {
@@ -40,7 +40,7 @@ describe('ol.render.webgl.ImageReplay', function() {
beforeEach(function() { beforeEach(function() {
const tolerance = 0.1; const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000]; const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_ImageReplay_(tolerance, maxExtent); replay = new WebGLImageReplay(tolerance, maxExtent);
}); });
describe('#setImageStyle', function() { describe('#setImageStyle', function() {
+54 -54
View File
@@ -7,11 +7,11 @@ import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
import Point from '../../../../../src/ol/geom/Point.js'; import Point from '../../../../../src/ol/geom/Point.js';
import Polygon from '../../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js';
import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/CircleReplay.js'; import WebGLCircleReplay from '../../../../../src/ol/render/webgl/CircleReplay.js';
import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/ImageReplay.js'; import WebGLImageReplay from '../../../../../src/ol/render/webgl/ImageReplay.js';
import _ol_render_webgl_Immediate_ from '../../../../../src/ol/render/webgl/Immediate.js'; import _ol_render_webgl_Immediate_ from '../../../../../src/ol/render/webgl/Immediate.js';
import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js'; import WebGLLineStringReplay from '../../../../../src/ol/render/webgl/LineStringReplay.js';
import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js'; import WebGLPolygonReplay from '../../../../../src/ol/render/webgl/PolygonReplay.js';
import CircleStyle from '../../../../../src/ol/style/Circle.js'; import CircleStyle from '../../../../../src/ol/style/Circle.js';
import Fill from '../../../../../src/ol/style/Fill.js'; import Fill from '../../../../../src/ol/style/Fill.js';
import Stroke from '../../../../../src/ol/style/Stroke.js'; import Stroke from '../../../../../src/ol/style/Stroke.js';
@@ -111,7 +111,7 @@ describe('ol.render.webgl.Immediate', function() {
return function() {}; return function() {};
}); });
sinon.spy(ctor.prototype.getDeleteResourcesFunction); sinon.spy(ctor.prototype.getDeleteResourcesFunction);
if (ctor === _ol_render_webgl_ImageReplay_) { if (ctor === WebGLImageReplay) {
tmpObj.setImageStyle = ctor.prototype.setImageStyle; tmpObj.setImageStyle = ctor.prototype.setImageStyle;
ctor.prototype.setImageStyle = sinon.spy(); ctor.prototype.setImageStyle = sinon.spy();
} else { } else {
@@ -132,140 +132,140 @@ describe('ol.render.webgl.Immediate', function() {
describe('#drawPoint', function() { describe('#drawPoint', function() {
let tmpObj; let tmpObj;
beforeEach(function() { beforeEach(function() {
tmpObj = mock(_ol_render_webgl_ImageReplay_, 'drawPoint'); tmpObj = mock(WebGLImageReplay, 'drawPoint');
}); });
it('draws a point', function() { it('draws a point', function() {
context.drawGeometry(point); context.drawGeometry(point);
expect(_ol_render_webgl_ImageReplay_.prototype.setImageStyle.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.setImageStyle.calledOnce).to.be(true);
expect(_ol_render_webgl_ImageReplay_.prototype.drawPoint.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.drawPoint.calledOnce).to.be(true);
expect(_ol_render_webgl_ImageReplay_.prototype.finish.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.finish.calledOnce).to.be(true);
expect(_ol_render_webgl_ImageReplay_.prototype.replay.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.replay.calledOnce).to.be(true);
expect(_ol_render_webgl_ImageReplay_.prototype.getDeleteResourcesFunction.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.getDeleteResourcesFunction.calledOnce).to.be(true);
}); });
after(function() { after(function() {
restore(_ol_render_webgl_ImageReplay_, tmpObj); restore(WebGLImageReplay, tmpObj);
}); });
}); });
describe('#drawMultiPoint', function() { describe('#drawMultiPoint', function() {
let tmpObj; let tmpObj;
beforeEach(function() { beforeEach(function() {
tmpObj = mock(_ol_render_webgl_ImageReplay_, 'drawMultiPoint'); tmpObj = mock(WebGLImageReplay, 'drawMultiPoint');
}); });
it('draws a multi point', function() { it('draws a multi point', function() {
context.drawGeometry(multiPoint); context.drawGeometry(multiPoint);
expect(_ol_render_webgl_ImageReplay_.prototype.setImageStyle.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.setImageStyle.calledOnce).to.be(true);
expect(_ol_render_webgl_ImageReplay_.prototype.drawMultiPoint.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.drawMultiPoint.calledOnce).to.be(true);
expect(_ol_render_webgl_ImageReplay_.prototype.finish.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.finish.calledOnce).to.be(true);
expect(_ol_render_webgl_ImageReplay_.prototype.replay.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.replay.calledOnce).to.be(true);
expect(_ol_render_webgl_ImageReplay_.prototype.getDeleteResourcesFunction.calledOnce).to.be(true); expect(WebGLImageReplay.prototype.getDeleteResourcesFunction.calledOnce).to.be(true);
}); });
after(function() { after(function() {
restore(_ol_render_webgl_ImageReplay_, tmpObj); restore(WebGLImageReplay, tmpObj);
}); });
}); });
describe('#drawLineString', function() { describe('#drawLineString', function() {
let tmpObj; let tmpObj;
beforeEach(function() { beforeEach(function() {
tmpObj = mock(_ol_render_webgl_LineStringReplay_, 'drawLineString'); tmpObj = mock(WebGLLineStringReplay, 'drawLineString');
}); });
it('draws a line string', function() { it('draws a line string', function() {
context.drawGeometry(line); context.drawGeometry(line);
expect(_ol_render_webgl_LineStringReplay_.prototype.setFillStrokeStyle.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.setFillStrokeStyle.calledOnce).to.be(true);
expect(_ol_render_webgl_LineStringReplay_.prototype.drawLineString.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.drawLineString.calledOnce).to.be(true);
expect(_ol_render_webgl_LineStringReplay_.prototype.finish.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.finish.calledOnce).to.be(true);
expect(_ol_render_webgl_LineStringReplay_.prototype.replay.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.replay.calledOnce).to.be(true);
expect(_ol_render_webgl_LineStringReplay_.prototype.getDeleteResourcesFunction.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.getDeleteResourcesFunction.calledOnce).to.be(true);
}); });
after(function() { after(function() {
restore(_ol_render_webgl_LineStringReplay_, tmpObj); restore(WebGLLineStringReplay, tmpObj);
}); });
}); });
describe('#drawMultiLineString', function() { describe('#drawMultiLineString', function() {
let tmpObj; let tmpObj;
beforeEach(function() { beforeEach(function() {
tmpObj = mock(_ol_render_webgl_LineStringReplay_, 'drawMultiLineString'); tmpObj = mock(WebGLLineStringReplay, 'drawMultiLineString');
}); });
it('draws a multi line string', function() { it('draws a multi line string', function() {
context.drawGeometry(multiLine); context.drawGeometry(multiLine);
expect(_ol_render_webgl_LineStringReplay_.prototype.setFillStrokeStyle.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.setFillStrokeStyle.calledOnce).to.be(true);
expect(_ol_render_webgl_LineStringReplay_.prototype.drawMultiLineString.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.drawMultiLineString.calledOnce).to.be(true);
expect(_ol_render_webgl_LineStringReplay_.prototype.finish.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.finish.calledOnce).to.be(true);
expect(_ol_render_webgl_LineStringReplay_.prototype.replay.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.replay.calledOnce).to.be(true);
expect(_ol_render_webgl_LineStringReplay_.prototype.getDeleteResourcesFunction.calledOnce).to.be(true); expect(WebGLLineStringReplay.prototype.getDeleteResourcesFunction.calledOnce).to.be(true);
}); });
after(function() { after(function() {
restore(_ol_render_webgl_LineStringReplay_, tmpObj); restore(WebGLLineStringReplay, tmpObj);
}); });
}); });
describe('#drawPolygon', function() { describe('#drawPolygon', function() {
let tmpObj; let tmpObj;
beforeEach(function() { beforeEach(function() {
tmpObj = mock(_ol_render_webgl_PolygonReplay_, 'drawPolygon'); tmpObj = mock(WebGLPolygonReplay, 'drawPolygon');
}); });
it('draws a polygon', function() { it('draws a polygon', function() {
context.drawGeometry(polygon); context.drawGeometry(polygon);
expect(_ol_render_webgl_PolygonReplay_.prototype.setFillStrokeStyle.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.setFillStrokeStyle.calledOnce).to.be(true);
expect(_ol_render_webgl_PolygonReplay_.prototype.drawPolygon.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.drawPolygon.calledOnce).to.be(true);
expect(_ol_render_webgl_PolygonReplay_.prototype.finish.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.finish.calledOnce).to.be(true);
expect(_ol_render_webgl_PolygonReplay_.prototype.replay.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.replay.calledOnce).to.be(true);
expect(_ol_render_webgl_PolygonReplay_.prototype.getDeleteResourcesFunction.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.getDeleteResourcesFunction.calledOnce).to.be(true);
}); });
after(function() { after(function() {
restore(_ol_render_webgl_PolygonReplay_, tmpObj); restore(WebGLPolygonReplay, tmpObj);
}); });
}); });
describe('#drawMultiPolygon', function() { describe('#drawMultiPolygon', function() {
let tmpObj; let tmpObj;
beforeEach(function() { beforeEach(function() {
tmpObj = mock(_ol_render_webgl_PolygonReplay_, 'drawMultiPolygon'); tmpObj = mock(WebGLPolygonReplay, 'drawMultiPolygon');
}); });
it('draws a multi polygon', function() { it('draws a multi polygon', function() {
context.drawGeometry(multiPolygon); context.drawGeometry(multiPolygon);
expect(_ol_render_webgl_PolygonReplay_.prototype.setFillStrokeStyle.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.setFillStrokeStyle.calledOnce).to.be(true);
expect(_ol_render_webgl_PolygonReplay_.prototype.drawMultiPolygon.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.drawMultiPolygon.calledOnce).to.be(true);
expect(_ol_render_webgl_PolygonReplay_.prototype.finish.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.finish.calledOnce).to.be(true);
expect(_ol_render_webgl_PolygonReplay_.prototype.replay.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.replay.calledOnce).to.be(true);
expect(_ol_render_webgl_PolygonReplay_.prototype.getDeleteResourcesFunction.calledOnce).to.be(true); expect(WebGLPolygonReplay.prototype.getDeleteResourcesFunction.calledOnce).to.be(true);
}); });
after(function() { after(function() {
restore(_ol_render_webgl_PolygonReplay_, tmpObj); restore(WebGLPolygonReplay, tmpObj);
}); });
}); });
describe('#drawCircle', function() { describe('#drawCircle', function() {
let tmpObj; let tmpObj;
beforeEach(function() { beforeEach(function() {
tmpObj = mock(_ol_render_webgl_CircleReplay_, 'drawCircle'); tmpObj = mock(WebGLCircleReplay, 'drawCircle');
}); });
it('draws a circle', function() { it('draws a circle', function() {
context.drawGeometry(circle); context.drawGeometry(circle);
expect(_ol_render_webgl_CircleReplay_.prototype.setFillStrokeStyle.calledOnce).to.be(true); expect(WebGLCircleReplay.prototype.setFillStrokeStyle.calledOnce).to.be(true);
expect(_ol_render_webgl_CircleReplay_.prototype.drawCircle.calledOnce).to.be(true); expect(WebGLCircleReplay.prototype.drawCircle.calledOnce).to.be(true);
expect(_ol_render_webgl_CircleReplay_.prototype.finish.calledOnce).to.be(true); expect(WebGLCircleReplay.prototype.finish.calledOnce).to.be(true);
expect(_ol_render_webgl_CircleReplay_.prototype.replay.calledOnce).to.be(true); expect(WebGLCircleReplay.prototype.replay.calledOnce).to.be(true);
expect(_ol_render_webgl_CircleReplay_.prototype.getDeleteResourcesFunction.calledOnce).to.be(true); expect(WebGLCircleReplay.prototype.getDeleteResourcesFunction.calledOnce).to.be(true);
}); });
after(function() { after(function() {
restore(_ol_render_webgl_CircleReplay_, tmpObj); restore(WebGLCircleReplay, tmpObj);
}); });
}); });
}); });
+2 -2
View File
@@ -1,9 +1,9 @@
import _ol_render_webgl_Replay_ from '../../../../../src/ol/render/webgl/Replay.js'; import WebGLReplay from '../../../../../src/ol/render/webgl/Replay.js';
describe('ol.render.Replay', function() { describe('ol.render.Replay', function() {
let replay; let replay;
beforeEach(function() { beforeEach(function() {
replay = new _ol_render_webgl_Replay_(5, [-180, -90, 180, 90]); replay = new WebGLReplay(5, [-180, -90, 180, 90]);
}); });
@@ -2,7 +2,7 @@ import {getUid} from '../../../../../src/ol/index.js';
import Feature from '../../../../../src/ol/Feature.js'; import Feature from '../../../../../src/ol/Feature.js';
import LineString from '../../../../../src/ol/geom/LineString.js'; import LineString from '../../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js'; import WebGLLineStringReplay from '../../../../../src/ol/render/webgl/LineStringReplay.js';
import _ol_render_webgl_linestringreplay_defaultshader_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader.js'; import _ol_render_webgl_linestringreplay_defaultshader_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader.js';
import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader/Locations.js'; import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader/Locations.js';
import Stroke from '../../../../../src/ol/style/Stroke.js'; import Stroke from '../../../../../src/ol/style/Stroke.js';
@@ -23,7 +23,7 @@ describe('ol.render.webgl.LineStringReplay', function() {
beforeEach(function() { beforeEach(function() {
const tolerance = 0.1; const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000]; const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_LineStringReplay_(tolerance, maxExtent); replay = new WebGLLineStringReplay(tolerance, maxExtent);
}); });
describe('#setFillStrokeStyle', function() { describe('#setFillStrokeStyle', function() {
@@ -2,7 +2,7 @@ import {getUid} from '../../../../../src/ol/index.js';
import Feature from '../../../../../src/ol/Feature.js'; import Feature from '../../../../../src/ol/Feature.js';
import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
import Polygon from '../../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js';
import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js'; import WebGLPolygonReplay from '../../../../../src/ol/render/webgl/PolygonReplay.js';
import _ol_render_webgl_polygonreplay_defaultshader_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader.js'; import _ol_render_webgl_polygonreplay_defaultshader_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader.js';
import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js'; import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js';
import LinkedList from '../../../../../src/ol/structs/LinkedList.js'; import LinkedList from '../../../../../src/ol/structs/LinkedList.js';
@@ -23,7 +23,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
beforeEach(function() { beforeEach(function() {
const tolerance = 0.1; const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000]; const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_PolygonReplay_(tolerance, maxExtent); replay = new WebGLPolygonReplay(tolerance, maxExtent);
}); });
describe('#drawPolygon', function() { describe('#drawPolygon', function() {
+2 -2
View File
@@ -1,6 +1,6 @@
import {createCanvasContext2D} from '../../../../../src/ol/dom.js'; import {createCanvasContext2D} from '../../../../../src/ol/dom.js';
import Point from '../../../../../src/ol/geom/Point.js'; import Point from '../../../../../src/ol/geom/Point.js';
import _ol_render_webgl_TextReplay_ from '../../../../../src/ol/render/webgl/TextReplay.js'; import WebGLTextReplay from '../../../../../src/ol/render/webgl/TextReplay.js';
import Fill from '../../../../../src/ol/style/Fill.js'; import Fill from '../../../../../src/ol/style/Fill.js';
import Stroke from '../../../../../src/ol/style/Stroke.js'; import Stroke from '../../../../../src/ol/style/Stroke.js';
import Text from '../../../../../src/ol/style/Text.js'; import Text from '../../../../../src/ol/style/Text.js';
@@ -28,7 +28,7 @@ describe('ol.render.webgl.TextReplay', function() {
beforeEach(function() { beforeEach(function() {
const tolerance = 0.1; const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000]; const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_TextReplay_(tolerance, maxExtent); replay = new WebGLTextReplay(tolerance, maxExtent);
}); });
describe('#setTextStyle', function() { describe('#setTextStyle', function() {
@@ -1,4 +1,4 @@
import _ol_render_webgl_TextureReplay_ from '../../../../../src/ol/render/webgl/TextureReplay.js'; import WebGLTextureReplay from '../../../../../src/ol/render/webgl/TextureReplay.js';
import _ol_render_webgl_texturereplay_defaultshader_ from '../../../../../src/ol/render/webgl/texturereplay/defaultshader.js'; import _ol_render_webgl_texturereplay_defaultshader_ from '../../../../../src/ol/render/webgl/texturereplay/defaultshader.js';
import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/texturereplay/defaultshader/Locations.js'; import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/texturereplay/defaultshader/Locations.js';
@@ -8,7 +8,7 @@ describe('ol.render.webgl.TextureReplay', function() {
beforeEach(function() { beforeEach(function() {
const tolerance = 0.1; const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000]; const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_TextureReplay_(tolerance, maxExtent); replay = new WebGLTextureReplay(tolerance, maxExtent);
}); });
describe('#setUpProgram', function() { describe('#setUpProgram', function() {
+13 -13
View File
@@ -7,10 +7,10 @@ import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
import Point from '../../../../../src/ol/geom/Point.js'; import Point from '../../../../../src/ol/geom/Point.js';
import Polygon from '../../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js';
import _ol_render_canvas_LineStringReplay_ from '../../../../../src/ol/render/canvas/LineStringReplay.js'; import CanvasLineStringReplay from '../../../../../src/ol/render/canvas/LineStringReplay.js';
import _ol_render_canvas_PolygonReplay_ from '../../../../../src/ol/render/canvas/PolygonReplay.js'; import CanvasPolygonReplay from '../../../../../src/ol/render/canvas/PolygonReplay.js';
import _ol_render_canvas_Replay_ from '../../../../../src/ol/render/canvas/Replay.js'; import CanvasReplay from '../../../../../src/ol/render/canvas/Replay.js';
import _ol_render_canvas_ReplayGroup_ from '../../../../../src/ol/render/canvas/ReplayGroup.js'; import CanvasReplayGroup from '../../../../../src/ol/render/canvas/ReplayGroup.js';
import _ol_renderer_vector_ from '../../../../../src/ol/renderer/vector.js'; import _ol_renderer_vector_ from '../../../../../src/ol/renderer/vector.js';
import Fill from '../../../../../src/ol/style/Fill.js'; import Fill from '../../../../../src/ol/style/Fill.js';
import Stroke from '../../../../../src/ol/style/Stroke.js'; import Stroke from '../../../../../src/ol/style/Stroke.js';
@@ -28,7 +28,7 @@ describe('ol.render.canvas.ReplayGroup', function() {
beforeEach(function() { beforeEach(function() {
transform = _ol_transform_.create(); transform = _ol_transform_.create();
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, false); replay = new CanvasReplayGroup(1, [-180, -90, 180, 90], 1, 1, false);
feature0 = new Feature(new Polygon( feature0 = new Feature(new Polygon(
[[[-90, 0], [-45, 45], [0, 0], [1, 1], [0, -45], [-90, 0]]])); [[[-90, 0], [-45, 45], [0, 0], [1, 1], [0, -45], [-90, 0]]]));
feature1 = new Feature(new Polygon( feature1 = new Feature(new Polygon(
@@ -172,7 +172,7 @@ describe('ol.render.canvas.ReplayGroup', function() {
}); });
it('does not batch when overlaps is set to true', function() { it('does not batch when overlaps is set to true', function() {
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, true); replay = new CanvasReplayGroup(1, [-180, -90, 180, 90], 1, 1, true);
_ol_renderer_vector_.renderFeature(replay, feature1, style1, 1); _ol_renderer_vector_.renderFeature(replay, feature1, style1, 1);
_ol_renderer_vector_.renderFeature(replay, feature2, style1, 1); _ol_renderer_vector_.renderFeature(replay, feature2, style1, 1);
_ol_renderer_vector_.renderFeature(replay, feature3, style1, 1); _ol_renderer_vector_.renderFeature(replay, feature3, style1, 1);
@@ -184,7 +184,7 @@ describe('ol.render.canvas.ReplayGroup', function() {
it('applies the pixelRatio to the linedash array and offset', function() { it('applies the pixelRatio to the linedash array and offset', function() {
// replay with a pixelRatio of 2 // replay with a pixelRatio of 2
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 2, true); replay = new CanvasReplayGroup(1, [-180, -90, 180, 90], 1, 2, true);
let lineDash, lineDashCount = 0, let lineDash, lineDashCount = 0,
lineDashOffset, lineDashOffsetCount = 0; lineDashOffset, lineDashOffsetCount = 0;
@@ -241,7 +241,7 @@ describe('ol.render.canvas.ReplayGroup', function() {
[polygon.getGeometry().getCoordinates(), polygon.getGeometry().getCoordinates()])); [polygon.getGeometry().getCoordinates(), polygon.getGeometry().getCoordinates()]));
const geometrycollection = new Feature(new GeometryCollection( const geometrycollection = new Feature(new GeometryCollection(
[point.getGeometry(), linestring.getGeometry(), polygon.getGeometry()])); [point.getGeometry(), linestring.getGeometry(), polygon.getGeometry()]));
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, true); replay = new CanvasReplayGroup(1, [-180, -90, 180, 90], 1, 1, true);
_ol_renderer_vector_.renderFeature(replay, point, style, 1); _ol_renderer_vector_.renderFeature(replay, point, style, 1);
_ol_renderer_vector_.renderFeature(replay, multipoint, style, 1); _ol_renderer_vector_.renderFeature(replay, multipoint, style, 1);
_ol_renderer_vector_.renderFeature(replay, linestring, style, 1); _ol_renderer_vector_.renderFeature(replay, linestring, style, 1);
@@ -285,8 +285,8 @@ describe('ol.render.canvas.Replay', function() {
it('creates a new replay batch', function() { it('creates a new replay batch', function() {
const tolerance = 10; const tolerance = 10;
const extent = [-180, -90, 180, 90]; const extent = [-180, -90, 180, 90];
const replay = new _ol_render_canvas_Replay_(tolerance, extent, 1, 1, true); const replay = new CanvasReplay(tolerance, extent, 1, 1, true);
expect(replay).to.be.a(_ol_render_canvas_Replay_); expect(replay).to.be.a(CanvasReplay);
}); });
}); });
@@ -295,7 +295,7 @@ describe('ol.render.canvas.Replay', function() {
let replay; let replay;
beforeEach(function() { beforeEach(function() {
replay = new _ol_render_canvas_Replay_(1, [-180, -90, 180, 90], 1, 1, true); replay = new CanvasReplay(1, [-180, -90, 180, 90], 1, 1, true);
}); });
it('appends coordinates that are within the max extent', function() { it('appends coordinates that are within the max extent', function() {
@@ -446,7 +446,7 @@ describe('ol.render.canvas.LineStringReplay', function() {
const tolerance = 1; const tolerance = 1;
const extent = [-180, -90, 180, 90]; const extent = [-180, -90, 180, 90];
const resolution = 10; const resolution = 10;
const replay = new _ol_render_canvas_LineStringReplay_(tolerance, extent, const replay = new CanvasLineStringReplay(tolerance, extent,
resolution); resolution);
const stroke = new Stroke({ const stroke = new Stroke({
width: 2 width: 2
@@ -468,7 +468,7 @@ describe('ol.render.canvas.PolygonReplay', function() {
const tolerance = 1; const tolerance = 1;
const extent = [-180, -90, 180, 90]; const extent = [-180, -90, 180, 90];
const resolution = 10; const resolution = 10;
replay = new _ol_render_canvas_PolygonReplay_(tolerance, extent, replay = new CanvasPolygonReplay(tolerance, extent,
resolution); resolution);
}); });
+2 -2
View File
@@ -6,7 +6,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js'; import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
import _ol_render_canvas_ReplayGroup_ from '../../../../src/ol/render/canvas/ReplayGroup.js'; import CanvasReplayGroup from '../../../../src/ol/render/canvas/ReplayGroup.js';
import _ol_renderer_vector_ from '../../../../src/ol/renderer/vector.js'; import _ol_renderer_vector_ from '../../../../src/ol/renderer/vector.js';
import Fill from '../../../../src/ol/style/Fill.js'; import Fill from '../../../../src/ol/style/Fill.js';
import Icon from '../../../../src/ol/style/Icon.js'; import Icon from '../../../../src/ol/style/Icon.js';
@@ -22,7 +22,7 @@ describe('ol.renderer.vector', function() {
let iconStyleLoadSpy; let iconStyleLoadSpy;
beforeEach(function() { beforeEach(function() {
replayGroup = new _ol_render_canvas_ReplayGroup_(1); replayGroup = new CanvasReplayGroup(1);
feature = new Feature(); feature = new Feature();
iconStyle = new Icon({ iconStyle = new Icon({
src: 'http://example.com/icon.png' src: 'http://example.com/icon.png'
+3 -3
View File
@@ -1,4 +1,4 @@
import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js'; import WMTSCapabilities from '../../../../src/ol/format/WMTSCapabilities.js';
import {get as getProjection} from '../../../../src/ol/proj.js'; import {get as getProjection} from '../../../../src/ol/proj.js';
import Projection from '../../../../src/ol/proj/Projection.js'; import Projection from '../../../../src/ol/proj/Projection.js';
import WMTSTileGrid from '../../../../src/ol/tilegrid/WMTS.js'; import WMTSTileGrid from '../../../../src/ol/tilegrid/WMTS.js';
@@ -8,7 +8,7 @@ import WMTS from '../../../../src/ol/source/WMTS.js';
describe('ol.source.WMTS', function() { describe('ol.source.WMTS', function() {
describe('when creating options from capabilities', function() { describe('when creating options from capabilities', function() {
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
let capabilities, content; let capabilities, content;
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) { afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) {
@@ -232,7 +232,7 @@ describe('ol.source.WMTS', function() {
}); });
describe('when creating options from Esri capabilities', function() { describe('when creating options from Esri capabilities', function() {
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
let capabilities; let capabilities;
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wmts/arcgis.xml', function(xml) { afterLoadText('spec/ol/format/wmts/arcgis.xml', function(xml) {
+3 -3
View File
@@ -1,11 +1,11 @@
import _ol_format_WMTSCapabilities_ from '../../../../src/ol/format/WMTSCapabilities.js'; import WMTSCapabilities from '../../../../src/ol/format/WMTSCapabilities.js';
import {createFromCapabilitiesMatrixSet} from '../../../../src/ol/tilegrid/WMTS.js'; import {createFromCapabilitiesMatrixSet} from '../../../../src/ol/tilegrid/WMTS.js';
describe('ol.tilegrid.WMTS', function() { describe('ol.tilegrid.WMTS', function() {
describe('when creating tileGrid from capabilities', function() { describe('when creating tileGrid from capabilities', function() {
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
let capabilities; let capabilities;
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) { afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) {
@@ -58,7 +58,7 @@ describe('ol.tilegrid.WMTS', function() {
describe('when creating tileGrid from capabilities with and without TileMatrixSetLimits', describe('when creating tileGrid from capabilities with and without TileMatrixSetLimits',
function() { function() {
const parser = new _ol_format_WMTSCapabilities_(); const parser = new WMTSCapabilities();
let capabilities; let capabilities;
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) { afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) {