ol 10.7.1 → 10.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Collection.d.ts +1 -3
- package/Collection.d.ts.map +1 -1
- package/Feature.d.ts +6 -15
- package/Feature.d.ts.map +1 -1
- package/Feature.js +3 -6
- package/Geolocation.d.ts +1 -3
- package/Geolocation.d.ts.map +1 -1
- package/ImageTile.d.ts +2 -12
- package/ImageTile.d.ts.map +1 -1
- package/ImageTile.js +5 -32
- package/Map.d.ts +7 -27
- package/Map.d.ts.map +1 -1
- package/Map.js +3 -29
- package/Object.d.ts +18 -15
- package/Object.d.ts.map +1 -1
- package/Object.js +6 -9
- package/Overlay.d.ts +1 -3
- package/Overlay.d.ts.map +1 -1
- package/VectorRenderTile.d.ts +0 -4
- package/VectorRenderTile.d.ts.map +1 -1
- package/VectorRenderTile.js +0 -2
- package/View.d.ts +1 -40
- package/View.d.ts.map +1 -1
- package/View.js +0 -94
- package/colorlike.js +8 -4
- package/control/Control.d.ts +1 -3
- package/control/Control.d.ts.map +1 -1
- package/control/OverviewMap.d.ts +1 -5
- package/control/OverviewMap.d.ts.map +1 -1
- package/coordinate.d.ts +0 -8
- package/coordinate.d.ts.map +1 -1
- package/coordinate.js +1 -31
- package/dist/ol.d.ts +0 -24
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/dom.d.ts +0 -15
- package/dom.d.ts.map +1 -1
- package/dom.js +0 -6
- package/featureloader.d.ts +2 -6
- package/featureloader.d.ts.map +1 -1
- package/format/EsriJSON.d.ts +1 -3
- package/format/EsriJSON.d.ts.map +1 -1
- package/format/Feature.d.ts +1 -3
- package/format/Feature.d.ts.map +1 -1
- package/format/GeoJSON.d.ts +2 -6
- package/format/GeoJSON.d.ts.map +1 -1
- package/format/JSONFeature.d.ts +1 -3
- package/format/JSONFeature.d.ts.map +1 -1
- package/format/KML.d.ts +0 -9
- package/format/KML.d.ts.map +1 -1
- package/format/KML.js +0 -7
- package/format/TextFeature.d.ts +1 -3
- package/format/TextFeature.d.ts.map +1 -1
- package/format/TopoJSON.d.ts +1 -3
- package/format/TopoJSON.d.ts.map +1 -1
- package/format/WKB.d.ts +1 -3
- package/format/WKB.d.ts.map +1 -1
- package/format/XMLFeature.d.ts +1 -3
- package/format/XMLFeature.d.ts.map +1 -1
- package/geom/Geometry.d.ts +1 -3
- package/geom/Geometry.d.ts.map +1 -1
- package/interaction/DragAndDrop.d.ts +2 -6
- package/interaction/DragAndDrop.d.ts.map +1 -1
- package/interaction/Draw.d.ts +3 -9
- package/interaction/Draw.d.ts.map +1 -1
- package/interaction/Interaction.d.ts +1 -3
- package/interaction/Interaction.d.ts.map +1 -1
- package/interaction/Link.js +2 -2
- package/interaction/Modify.d.ts +28 -76
- package/interaction/Modify.d.ts.map +1 -1
- package/interaction/Modify.js +54 -248
- package/interaction/Select.d.ts +18 -10
- package/interaction/Select.d.ts.map +1 -1
- package/interaction/Select.js +89 -54
- package/interaction/Snap.d.ts +12 -18
- package/interaction/Snap.d.ts.map +1 -1
- package/interaction/Translate.d.ts +2 -6
- package/interaction/Translate.d.ts.map +1 -1
- package/layer/Base.d.ts +8 -19
- package/layer/Base.d.ts.map +1 -1
- package/layer/Base.js +3 -6
- package/layer/BaseImage.d.ts +1 -3
- package/layer/BaseImage.d.ts.map +1 -1
- package/layer/BaseTile.d.ts +1 -3
- package/layer/BaseTile.d.ts.map +1 -1
- package/layer/BaseVector.d.ts +1 -3
- package/layer/BaseVector.d.ts.map +1 -1
- package/layer/Flow.d.ts +2 -2
- package/layer/Graticule.d.ts +1 -5
- package/layer/Graticule.d.ts.map +1 -1
- package/layer/Group.d.ts +2 -8
- package/layer/Group.d.ts.map +1 -1
- package/layer/Heatmap.d.ts +2 -23
- package/layer/Heatmap.d.ts.map +1 -1
- package/layer/Heatmap.js +0 -29
- package/layer/Layer.d.ts +8 -17
- package/layer/Layer.d.ts.map +1 -1
- package/layer/Layer.js +2 -5
- package/layer/Tile.d.ts +1 -1
- package/layer/Vector.d.ts +2 -2
- package/layer/Vector.d.ts.map +1 -1
- package/layer/VectorImage.d.ts +2 -2
- package/layer/VectorImage.d.ts.map +1 -1
- package/layer/VectorTile.d.ts +2 -2
- package/layer/VectorTile.d.ts.map +1 -1
- package/layer/WebGLPoints.d.ts +1 -3
- package/layer/WebGLPoints.d.ts.map +1 -1
- package/layer/WebGLTile.d.ts +3 -3
- package/layer/WebGLTile.d.ts.map +1 -1
- package/layer/WebGLVector.d.ts +2 -4
- package/layer/WebGLVector.d.ts.map +1 -1
- package/layer/WebGLVectorTile.d.ts +2 -2
- package/layer/WebGLVectorTile.d.ts.map +1 -1
- package/package.json +3 -4
- package/proj/proj4.d.ts +6 -43
- package/proj/proj4.d.ts.map +1 -1
- package/proj/proj4.js +28 -89
- package/proj.js +2 -2
- package/render/canvas/Builder.d.ts.map +1 -1
- package/render/canvas/Builder.js +1 -8
- package/render/canvas/Executor.d.ts.map +1 -1
- package/render/canvas/Executor.js +3 -49
- package/render/canvas/ExecutorGroup.d.ts.map +1 -1
- package/render/canvas/ExecutorGroup.js +5 -41
- package/render/canvas/Immediate.d.ts +0 -2
- package/render/canvas/Immediate.d.ts.map +1 -1
- package/render/canvas/Immediate.js +4 -28
- package/render/canvas/LineStringBuilder.d.ts +0 -1
- package/render/canvas/LineStringBuilder.d.ts.map +1 -1
- package/render/canvas/LineStringBuilder.js +5 -15
- package/render/canvas/PolygonBuilder.d.ts +0 -2
- package/render/canvas/PolygonBuilder.d.ts.map +1 -1
- package/render/canvas/PolygonBuilder.js +6 -72
- package/render/canvas/style.d.ts.map +1 -1
- package/render/canvas/style.js +37 -118
- package/render/canvas.d.ts +2 -22
- package/render/canvas.d.ts.map +1 -1
- package/render/canvas.js +0 -9
- package/render/webgl/bufferUtil.d.ts.map +1 -1
- package/render/webgl/bufferUtil.js +31 -1
- package/renderer/Composite.js +4 -4
- package/renderer/canvas/ImageLayer.d.ts +1 -6
- package/renderer/canvas/ImageLayer.d.ts.map +1 -1
- package/renderer/canvas/ImageLayer.js +0 -14
- package/renderer/canvas/TileLayer.d.ts +1 -1
- package/renderer/canvas/VectorLayer.d.ts +1 -8
- package/renderer/canvas/VectorLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorLayer.js +14 -55
- package/renderer/canvas/VectorTileLayer.d.ts +1 -1
- package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorTileLayer.js +0 -2
- package/renderer/webgl/TileLayerBase.js +1 -1
- package/reproj/Tile.d.ts +2 -7
- package/reproj/Tile.d.ts.map +1 -1
- package/reproj/Tile.js +6 -12
- package/source/Cluster.d.ts +2 -8
- package/source/Cluster.d.ts.map +1 -1
- package/source/DataTile.d.ts +0 -15
- package/source/DataTile.d.ts.map +1 -1
- package/source/DataTile.js +0 -9
- package/source/GeoTIFF.d.ts +2 -7
- package/source/GeoTIFF.d.ts.map +1 -1
- package/source/GeoTIFF.js +10 -15
- package/source/ImageArcGISRest.d.ts +0 -10
- package/source/ImageArcGISRest.d.ts.map +1 -1
- package/source/ImageArcGISRest.js +0 -8
- package/source/ImageMapGuide.d.ts +0 -10
- package/source/ImageMapGuide.d.ts.map +1 -1
- package/source/ImageMapGuide.js +0 -8
- package/source/ImageStatic.d.ts +0 -5
- package/source/ImageStatic.d.ts.map +1 -1
- package/source/ImageStatic.js +0 -2
- package/source/ImageTile.d.ts +1 -5
- package/source/ImageTile.d.ts.map +1 -1
- package/source/ImageTile.js +0 -5
- package/source/ImageWMS.d.ts +0 -10
- package/source/ImageWMS.d.ts.map +1 -1
- package/source/ImageWMS.js +0 -10
- package/source/OGCMapTile.d.ts +0 -5
- package/source/OGCMapTile.d.ts.map +1 -1
- package/source/OGCMapTile.js +0 -2
- package/source/OSM.d.ts +0 -5
- package/source/OSM.d.ts.map +1 -1
- package/source/OSM.js +19 -5
- package/source/SentinelHub.d.ts +0 -1
- package/source/SentinelHub.d.ts.map +1 -1
- package/source/SentinelHub.js +0 -5
- package/source/Source.d.ts +1 -3
- package/source/Source.d.ts.map +1 -1
- package/source/TileArcGISRest.d.ts +1 -6
- package/source/TileArcGISRest.d.ts.map +1 -1
- package/source/TileArcGISRest.js +0 -2
- package/source/TileDebug.d.ts +1 -1
- package/source/TileImage.d.ts +0 -10
- package/source/TileImage.d.ts.map +1 -1
- package/source/TileImage.js +3 -16
- package/source/TileWMS.d.ts +1 -1
- package/source/UrlTile.d.ts +1 -1
- package/source/Vector.d.ts +8 -18
- package/source/Vector.d.ts.map +1 -1
- package/source/Vector.js +3 -3
- package/source/WMTS.d.ts +0 -5
- package/source/WMTS.d.ts.map +1 -1
- package/source/WMTS.js +0 -2
- package/source/XYZ.d.ts +0 -5
- package/source/XYZ.d.ts.map +1 -1
- package/source/XYZ.js +0 -2
- package/source/Zoomify.d.ts +2 -7
- package/source/Zoomify.d.ts.map +1 -1
- package/source/Zoomify.js +3 -5
- package/source/arcgisRest.d.ts +0 -5
- package/source/arcgisRest.d.ts.map +1 -1
- package/source/arcgisRest.js +0 -5
- package/source/mapguide.d.ts +0 -4
- package/source/mapguide.d.ts.map +1 -1
- package/source/mapguide.js +0 -5
- package/source/mapserver.d.ts +1 -5
- package/source/mapserver.d.ts.map +1 -1
- package/source/mapserver.js +0 -4
- package/source/ogcTileUtil.d.ts +12 -20
- package/source/ogcTileUtil.d.ts.map +1 -1
- package/source/ogcTileUtil.js +15 -27
- package/source/static.d.ts +0 -5
- package/source/static.d.ts.map +1 -1
- package/source/static.js +0 -4
- package/source/wms.d.ts +0 -5
- package/source/wms.d.ts.map +1 -1
- package/source/wms.js +0 -5
- package/style/Circle.d.ts +14 -0
- package/style/Circle.d.ts.map +1 -1
- package/style/Circle.js +11 -0
- package/style/Fill.js +1 -1
- package/style/Icon.d.ts +0 -19
- package/style/Icon.d.ts.map +1 -1
- package/style/Icon.js +2 -55
- package/style/IconImage.d.ts +5 -14
- package/style/IconImage.d.ts.map +1 -1
- package/style/IconImage.js +18 -28
- package/style/IconImageCache.d.ts +8 -4
- package/style/IconImageCache.d.ts.map +1 -1
- package/style/IconImageCache.js +13 -11
- package/style/RegularShape.d.ts +0 -12
- package/style/RegularShape.d.ts.map +1 -1
- package/style/RegularShape.js +4 -36
- package/style/Stroke.d.ts +0 -25
- package/style/Stroke.d.ts.map +1 -1
- package/style/Stroke.js +0 -28
- package/style/Style.d.ts +1 -1
- package/style/flat.d.ts +2 -2
- package/style/flat.js +1 -1
- package/tilegrid/TileGrid.d.ts +0 -5
- package/tilegrid/TileGrid.d.ts.map +1 -1
- package/tilegrid/TileGrid.js +0 -8
- package/util.js +1 -1
- package/worker/webgl.js +1 -1
- package/geom/flat/lineoffset.d.ts +0 -45
- package/geom/flat/lineoffset.d.ts.map +0 -1
- package/geom/flat/lineoffset.js +0 -173
- package/source/GeoZarr.d.ts +0 -163
- package/source/GeoZarr.d.ts.map +0 -1
- package/source/GeoZarr.js +0 -472
- package/source/OGCMap.d.ts +0 -180
- package/source/OGCMap.d.ts.map +0 -1
- package/source/OGCMap.js +0 -227
- package/source/ogcMapUtil.d.ts +0 -88
- package/source/ogcMapUtil.d.ts.map +0 -1
- package/source/ogcMapUtil.js +0 -121
package/proj/proj4.d.ts
CHANGED
|
@@ -30,61 +30,26 @@ export function register(proj4: typeof import("proj4/dist/lib/core.js").default
|
|
|
30
30
|
version: string;
|
|
31
31
|
}): void;
|
|
32
32
|
/**
|
|
33
|
-
* Set the lookup function for getting proj4
|
|
34
|
-
* projection code. By default, the {@link module:ol/proj/proj4.fromProjectionCode}
|
|
35
|
-
* function uses the spatialreference.org website for WKT definitions.
|
|
36
|
-
* This can be changed by providing a different lookup function.
|
|
37
|
-
*
|
|
38
|
-
* @param {function(string):Promise<string>} func The lookup function.
|
|
39
|
-
* @api
|
|
40
|
-
*/
|
|
41
|
-
export function setProjectionCodeLookup(func: (arg0: string) => Promise<string>): void;
|
|
42
|
-
/**
|
|
43
|
-
* Get the current projection code lookup function.
|
|
44
|
-
*
|
|
45
|
-
* @return {function(string):Promise<string>} The projection lookup function.
|
|
46
|
-
*/
|
|
47
|
-
export function getProjectionCodeLookup(): (arg0: string) => Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* Get a projection from a projection code (i.e., authority:number).
|
|
50
|
-
* This function fetches the projection definition from the
|
|
51
|
-
* https://spatialreference.org website, registers this definition for use with
|
|
52
|
-
* proj4, and returns a configured projection. You must call import proj4 and
|
|
53
|
-
* call {@link module:ol/proj/proj4.register} before using this function.
|
|
54
|
-
*
|
|
55
|
-
* If the projection definition is already registered with proj4, it will not
|
|
56
|
-
* be fetched again (so it is ok to call this function multiple times with the
|
|
57
|
-
* same code).
|
|
58
|
-
*
|
|
59
|
-
* @param {string} code The projection code (e.g., 'EPSG:4326' or 'OGC:CRS84').
|
|
60
|
-
* @return {Promise<Projection>} The projection.
|
|
61
|
-
* @api
|
|
62
|
-
*/
|
|
63
|
-
export function fromProjectionCode(code: string): Promise<Projection>;
|
|
64
|
-
/**
|
|
65
|
-
* Set the lookup function for getting proj4 or WKT definitions given an EPSG code.
|
|
33
|
+
* Set the lookup function for getting proj4 definitions given an EPSG code.
|
|
66
34
|
* By default, the {@link module:ol/proj/proj4.fromEPSGCode} function uses the
|
|
67
|
-
*
|
|
68
|
-
*
|
|
35
|
+
* epsg.io website for proj4 definitions. This can be changed by providing a
|
|
36
|
+
* different lookup function.
|
|
69
37
|
*
|
|
70
38
|
* @param {function(number):Promise<string>} func The lookup function.
|
|
71
39
|
* @api
|
|
72
|
-
* @deprecated Use {@link module:ol/proj/proj4.setProjectionCodeLookup} instead.
|
|
73
40
|
*/
|
|
74
41
|
export function setEPSGLookup(func: (arg0: number) => Promise<string>): void;
|
|
75
42
|
/**
|
|
76
43
|
* Get the current EPSG lookup function.
|
|
77
44
|
*
|
|
78
45
|
* @return {function(number):Promise<string>} The EPSG lookup function.
|
|
79
|
-
* @deprecated Use {@link module:ol/proj/proj4.getProjectionCodeLookup} instead.
|
|
80
46
|
*/
|
|
81
47
|
export function getEPSGLookup(): (arg0: number) => Promise<string>;
|
|
82
48
|
/**
|
|
83
49
|
* Get a projection from an EPSG code. This function fetches the projection
|
|
84
|
-
* definition from the
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* function.
|
|
50
|
+
* definition from the epsg.io website, registers this definition for use with
|
|
51
|
+
* proj4, and returns a configured projection. You must call import proj4 and
|
|
52
|
+
* call {@link module:ol/proj/proj4.register} before using this function.
|
|
88
53
|
*
|
|
89
54
|
* If the projection definition is already registered with proj4, it will not
|
|
90
55
|
* be fetched again (so it is ok to call this function multiple times with the
|
|
@@ -93,7 +58,6 @@ export function getEPSGLookup(): (arg0: number) => Promise<string>;
|
|
|
93
58
|
* @param {number|string} code The EPSG code (e.g. 4326 or 'EPSG:4326').
|
|
94
59
|
* @return {Promise<Projection>} The projection.
|
|
95
60
|
* @api
|
|
96
|
-
* @deprecated Use {@link module:ol/proj/proj4.fromProjectionCode} instead.
|
|
97
61
|
*/
|
|
98
62
|
export function fromEPSGCode(code: number | string): Promise<Projection>;
|
|
99
63
|
/**
|
|
@@ -105,7 +69,6 @@ export function fromEPSGCode(code: number | string): Promise<Projection>;
|
|
|
105
69
|
* @param {string} key MapTiler API key. Get your own API key at https://www.maptiler.com/cloud/.
|
|
106
70
|
* @return {function(number):Promise<string>} The EPSG lookup function.
|
|
107
71
|
* @api
|
|
108
|
-
* @deprecated Not needed any more, the default lookup provides this functionality now.
|
|
109
72
|
*/
|
|
110
73
|
export function epsgLookupMapTiler(key: string): (arg0: number) => Promise<string>;
|
|
111
74
|
import Projection from './Projection.js';
|
package/proj/proj4.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proj4.d.ts","sourceRoot":"","sources":["proj4.js"],"names":[],"mappings":"AAkBA;;GAEG;AACH,gCAFY,OAAO,CAIlB;AAED;;GAEG;AACH,mCAEC;AAED;;;;;;;;;;GAUG;AACH;;;;;;;;;;;SA6CC;
|
|
1
|
+
{"version":3,"file":"proj4.d.ts","sourceRoot":"","sources":["proj4.js"],"names":[],"mappings":"AAkBA;;GAEG;AACH,gCAFY,OAAO,CAIlB;AAED;;GAEG;AACH,mCAEC;AAED;;;;;;;;;;GAUG;AACH;;;;;;;;;;;SA6CC;AAcD;;;;;;;;GAQG;AACH,oCAHW,CAAS,IAAM,EAAN,MAAM,KAAE,OAAO,CAAC,MAAM,CAAC,QAK1C;AAED;;;;GAIG;AACH,iCAFY,CAAS,IAAM,EAAN,MAAM,KAAE,OAAO,CAAC,MAAM,CAAC,CAI3C;AAED;;;;;;;;;;;;;GAaG;AACH,mCAJW,MAAM,GAAC,MAAM,GACZ,OAAO,CAAC,UAAU,CAAC,CAsB9B;AAED;;;;;;;;;GASG;AACH,wCAJW,MAAM,GACL,CAAS,IAAM,EAAN,MAAM,KAAE,OAAO,CAAC,MAAM,CAAC,CA0D3C;uBAvNsB,iBAAiB"}
|
package/proj/proj4.js
CHANGED
|
@@ -89,96 +89,25 @@ export function register(proj4) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* @param {
|
|
93
|
-
* @return {Promise<string>} The
|
|
92
|
+
* @param {number} code The EPSG code.
|
|
93
|
+
* @return {Promise<string>} The proj4 definition.
|
|
94
94
|
*/
|
|
95
|
-
let
|
|
96
|
-
|
|
97
|
-
throw new Error('Invalid code');
|
|
98
|
-
}
|
|
99
|
-
const [authority, num] = code.toLowerCase().split(':', 2);
|
|
100
|
-
const response = await fetch(
|
|
101
|
-
`https://spatialreference.org/ref/${authority}/${num}/ogcwkt/`,
|
|
102
|
-
);
|
|
95
|
+
let epsgLookup = async function (code) {
|
|
96
|
+
const response = await fetch(`https://epsg.io/${code}.proj4`);
|
|
103
97
|
if (!response.ok) {
|
|
104
|
-
throw new Error(
|
|
105
|
-
`Unexpected response from spatialreference.org: ${response.status}`,
|
|
106
|
-
);
|
|
98
|
+
throw new Error(`Unexpected response from epsg.io: ${response.status}`);
|
|
107
99
|
}
|
|
108
100
|
return response.text();
|
|
109
101
|
};
|
|
110
102
|
|
|
111
103
|
/**
|
|
112
|
-
* Set the lookup function for getting proj4
|
|
113
|
-
* projection code. By default, the {@link module:ol/proj/proj4.fromProjectionCode}
|
|
114
|
-
* function uses the spatialreference.org website for WKT definitions.
|
|
115
|
-
* This can be changed by providing a different lookup function.
|
|
116
|
-
*
|
|
117
|
-
* @param {function(string):Promise<string>} func The lookup function.
|
|
118
|
-
* @api
|
|
119
|
-
*/
|
|
120
|
-
export function setProjectionCodeLookup(func) {
|
|
121
|
-
projLookup = func;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Get the current projection code lookup function.
|
|
126
|
-
*
|
|
127
|
-
* @return {function(string):Promise<string>} The projection lookup function.
|
|
128
|
-
*/
|
|
129
|
-
export function getProjectionCodeLookup() {
|
|
130
|
-
return projLookup;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Get a projection from a projection code (i.e., authority:number).
|
|
135
|
-
* This function fetches the projection definition from the
|
|
136
|
-
* https://spatialreference.org website, registers this definition for use with
|
|
137
|
-
* proj4, and returns a configured projection. You must call import proj4 and
|
|
138
|
-
* call {@link module:ol/proj/proj4.register} before using this function.
|
|
139
|
-
*
|
|
140
|
-
* If the projection definition is already registered with proj4, it will not
|
|
141
|
-
* be fetched again (so it is ok to call this function multiple times with the
|
|
142
|
-
* same code).
|
|
143
|
-
*
|
|
144
|
-
* @param {string} code The projection code (e.g., 'EPSG:4326' or 'OGC:CRS84').
|
|
145
|
-
* @return {Promise<Projection>} The projection.
|
|
146
|
-
* @api
|
|
147
|
-
*/
|
|
148
|
-
export async function fromProjectionCode(code) {
|
|
149
|
-
const proj4 = registered;
|
|
150
|
-
if (!proj4) {
|
|
151
|
-
throw new Error('Proj4 must be registered first with register(proj4)');
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (proj4.defs(code)) {
|
|
155
|
-
return getCachedProjection(code);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
proj4.defs(code, await projLookup(code));
|
|
159
|
-
register(proj4);
|
|
160
|
-
|
|
161
|
-
return getCachedProjection(code);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @param {number} code The EPSG code.
|
|
166
|
-
* @return {Promise<string>} The proj4 or WKT definition.
|
|
167
|
-
* @deprecated Use {@link module:ol/proj/proj4.projLookup} instead.
|
|
168
|
-
*/
|
|
169
|
-
let epsgLookup = async function (code) {
|
|
170
|
-
return await projLookup('EPSG:' + code);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Set the lookup function for getting proj4 or WKT definitions given an EPSG code.
|
|
104
|
+
* Set the lookup function for getting proj4 definitions given an EPSG code.
|
|
175
105
|
* By default, the {@link module:ol/proj/proj4.fromEPSGCode} function uses the
|
|
176
|
-
*
|
|
177
|
-
*
|
|
106
|
+
* epsg.io website for proj4 definitions. This can be changed by providing a
|
|
107
|
+
* different lookup function.
|
|
178
108
|
*
|
|
179
109
|
* @param {function(number):Promise<string>} func The lookup function.
|
|
180
110
|
* @api
|
|
181
|
-
* @deprecated Use {@link module:ol/proj/proj4.setProjectionCodeLookup} instead.
|
|
182
111
|
*/
|
|
183
112
|
export function setEPSGLookup(func) {
|
|
184
113
|
epsgLookup = func;
|
|
@@ -188,7 +117,6 @@ export function setEPSGLookup(func) {
|
|
|
188
117
|
* Get the current EPSG lookup function.
|
|
189
118
|
*
|
|
190
119
|
* @return {function(number):Promise<string>} The EPSG lookup function.
|
|
191
|
-
* @deprecated Use {@link module:ol/proj/proj4.getProjectionCodeLookup} instead.
|
|
192
120
|
*/
|
|
193
121
|
export function getEPSGLookup() {
|
|
194
122
|
return epsgLookup;
|
|
@@ -196,10 +124,9 @@ export function getEPSGLookup() {
|
|
|
196
124
|
|
|
197
125
|
/**
|
|
198
126
|
* Get a projection from an EPSG code. This function fetches the projection
|
|
199
|
-
* definition from the
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* function.
|
|
127
|
+
* definition from the epsg.io website, registers this definition for use with
|
|
128
|
+
* proj4, and returns a configured projection. You must call import proj4 and
|
|
129
|
+
* call {@link module:ol/proj/proj4.register} before using this function.
|
|
203
130
|
*
|
|
204
131
|
* If the projection definition is already registered with proj4, it will not
|
|
205
132
|
* be fetched again (so it is ok to call this function multiple times with the
|
|
@@ -208,13 +135,26 @@ export function getEPSGLookup() {
|
|
|
208
135
|
* @param {number|string} code The EPSG code (e.g. 4326 or 'EPSG:4326').
|
|
209
136
|
* @return {Promise<Projection>} The projection.
|
|
210
137
|
* @api
|
|
211
|
-
* @deprecated Use {@link module:ol/proj/proj4.fromProjectionCode} instead.
|
|
212
138
|
*/
|
|
213
139
|
export async function fromEPSGCode(code) {
|
|
214
|
-
if (typeof code === '
|
|
215
|
-
code = '
|
|
140
|
+
if (typeof code === 'string') {
|
|
141
|
+
code = parseInt(code.split(':').pop(), 10);
|
|
216
142
|
}
|
|
217
|
-
|
|
143
|
+
|
|
144
|
+
const proj4 = registered;
|
|
145
|
+
if (!proj4) {
|
|
146
|
+
throw new Error('Proj4 must be registered first with register(proj4)');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const epsgCode = 'EPSG:' + code;
|
|
150
|
+
if (proj4.defs(epsgCode)) {
|
|
151
|
+
return getCachedProjection(epsgCode);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
proj4.defs(epsgCode, await epsgLookup(code));
|
|
155
|
+
register(proj4);
|
|
156
|
+
|
|
157
|
+
return getCachedProjection(epsgCode);
|
|
218
158
|
}
|
|
219
159
|
|
|
220
160
|
/**
|
|
@@ -226,7 +166,6 @@ export async function fromEPSGCode(code) {
|
|
|
226
166
|
* @param {string} key MapTiler API key. Get your own API key at https://www.maptiler.com/cloud/.
|
|
227
167
|
* @return {function(number):Promise<string>} The EPSG lookup function.
|
|
228
168
|
* @api
|
|
229
|
-
* @deprecated Not needed any more, the default lookup provides this functionality now.
|
|
230
169
|
*/
|
|
231
170
|
export function epsgLookupMapTiler(key) {
|
|
232
171
|
return async function (code) {
|
package/proj.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* Proj4js, or create a custom build to support those projections you need; see
|
|
24
24
|
* the Proj4js website for how to do this. You also need the Proj4js definitions
|
|
25
25
|
* for the required projections. These definitions can be obtained from
|
|
26
|
-
* https://
|
|
27
|
-
*
|
|
26
|
+
* https://epsg.io/, and are a JS function, so can be loaded in a script
|
|
27
|
+
* tag (as in the examples) or pasted into your application.
|
|
28
28
|
*
|
|
29
29
|
* After all required projection definitions are added to proj4's registry (by
|
|
30
30
|
* using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Builder.d.ts","sourceRoot":"","sources":["Builder.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Builder.d.ts","sourceRoot":"","sources":["Builder.js"],"names":[],"mappings":";AA8BA;IACE;;;;;OAKG;IACH,uBALW,MAAM,aACN,OAAO,iBAAiB,EAAE,MAAM,cAChC,MAAM,cACN,MAAM,EAoFhB;IA/EC;;;OAGG;IACH,qBAFU,MAAM,CAEU;IAE1B;;;;OAIG;IACH,qBAFU,OAAO,iBAAiB,EAAE,MAAM,CAEhB;IAE1B;;;OAGG;IACH,sBAFU,MAAM,CAEY;IAE5B;;;OAGG;IACH,wBAFU,MAAM,CAEK;IAErB;;;;OAIG;IACH,sBAFU,MAAM,CAEY;IAE5B;;;OAGG;IACH,mCAAsC;IAEtC;;;OAGG;IACH,mCAAsC;IAEtC;;;OAGG;IACH,2BAA8B;IAE9B;;;OAGG;IACH,wBAFU,KAAK,CAAC,GAAC,CAAC,CAEI;IAEtB;;;OAGG;IACH,uBAFU,KAAK,CAAC,MAAM,CAAC,CAEF;IAErB;;;OAGG;IACH,uBAAwB;IAExB;;;OAGG;IACH,oCAFU,KAAK,CAAC,GAAC,CAAC,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BAHW,OAAO,cAAc,EAAE,eAAe,cACtC,CAAS,IAAkB,EAAb,aAAa,EAAE,IAAsC,EAAtC,OAAO,cAAc,EAAE,eAAe,KAAE,KAAK,CAAC,GAAC,CAAC,QAQvF;IAED;;;OAGG;IACH,yBAHW,OAAO,cAAc,EAAE,eAAe,eACtC,CAAS,IAAkB,EAAb,aAAa,EAAE,IAAsC,EAAtC,OAAO,cAAc,EAAE,eAAe,KAAG,IAAI,QA6BpF;IAED;;OAEG;IACH,qBAFW,OAAO,kBAAkB,EAAE,WAAW,QAUhD;IAED;;;;;;OAMG;IACH,kCAHY,OAAO,iBAAiB,EAAE,MAAM,CAY3C;CACF;0BArqByB,qBAAqB"}
|
package/render/canvas/Builder.js
CHANGED
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
defaultLineJoin,
|
|
25
25
|
defaultLineWidth,
|
|
26
26
|
defaultMiterLimit,
|
|
27
|
-
defaultStrokeOffset,
|
|
28
27
|
defaultStrokeStyle,
|
|
29
28
|
} from '../canvas.js';
|
|
30
29
|
import CanvasInstruction from './Instruction.js';
|
|
@@ -550,8 +549,6 @@ class CanvasBuilder extends VectorContext {
|
|
|
550
549
|
strokeStyleMiterLimit !== undefined
|
|
551
550
|
? strokeStyleMiterLimit
|
|
552
551
|
: defaultMiterLimit;
|
|
553
|
-
const strokeStyleOffset = strokeStyle.getOffset();
|
|
554
|
-
state.strokeOffset = strokeStyleOffset ?? defaultStrokeOffset;
|
|
555
552
|
|
|
556
553
|
if (state.lineWidth > this.maxLineWidth) {
|
|
557
554
|
this.maxLineWidth = state.lineWidth;
|
|
@@ -566,7 +563,6 @@ class CanvasBuilder extends VectorContext {
|
|
|
566
563
|
state.lineJoin = undefined;
|
|
567
564
|
state.lineWidth = undefined;
|
|
568
565
|
state.miterLimit = undefined;
|
|
569
|
-
state.strokeOffset = undefined;
|
|
570
566
|
}
|
|
571
567
|
return state;
|
|
572
568
|
}
|
|
@@ -645,7 +641,6 @@ class CanvasBuilder extends VectorContext {
|
|
|
645
641
|
const lineJoin = state.lineJoin;
|
|
646
642
|
const lineWidth = state.lineWidth;
|
|
647
643
|
const miterLimit = state.miterLimit;
|
|
648
|
-
const strokeOffset = state.strokeOffset;
|
|
649
644
|
if (
|
|
650
645
|
state.currentStrokeStyle != strokeStyle ||
|
|
651
646
|
state.currentLineCap != lineCap ||
|
|
@@ -654,8 +649,7 @@ class CanvasBuilder extends VectorContext {
|
|
|
654
649
|
state.currentLineDashOffset != lineDashOffset ||
|
|
655
650
|
state.currentLineJoin != lineJoin ||
|
|
656
651
|
state.currentLineWidth != lineWidth ||
|
|
657
|
-
state.currentMiterLimit != miterLimit
|
|
658
|
-
state.currentStrokeOffset != strokeOffset
|
|
652
|
+
state.currentMiterLimit != miterLimit
|
|
659
653
|
) {
|
|
660
654
|
applyStroke.call(this, state);
|
|
661
655
|
state.currentStrokeStyle = strokeStyle;
|
|
@@ -665,7 +659,6 @@ class CanvasBuilder extends VectorContext {
|
|
|
665
659
|
state.currentLineJoin = lineJoin;
|
|
666
660
|
state.currentLineWidth = lineWidth;
|
|
667
661
|
state.currentMiterLimit = miterLimit;
|
|
668
|
-
state.currentStrokeOffset = strokeOffset;
|
|
669
662
|
}
|
|
670
663
|
}
|
|
671
664
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Executor.d.ts","sourceRoot":"","sources":["Executor.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Executor.d.ts","sourceRoot":"","sources":["Executor.js"],"names":[],"mappings":";6BA2Ba,OAAO,wBAAwB,EAAE,KAAK,CAAC,OAAO,kBAAkB,EAAE,WAAW,CAAC;;;;;gBAK7E,MAAM;;;;gBACN,MAAM;;;;gBACN,MAAM;;;;gBACN,MAAM;;;;aACN,MAAM;;;;aACN,MAAM;;;;WACN,KAAK,CAAC,MAAM,CAAC;;;;kBACb,cAAc;;;;qBACd,OAAO,oBAAoB,EAAE,SAAS;;qCAIvC;IAAC,CAAC,EAAE,wBA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@
|
|
|
4
4
|
import {equals} from '../../array.js';
|
|
5
5
|
import {createEmpty, createOrUpdate, intersects} from '../../extent.js';
|
|
6
6
|
import {lineStringLength} from '../../geom/flat/length.js';
|
|
7
|
-
import {offsetLineVertex} from '../../geom/flat/lineoffset.js';
|
|
8
7
|
import {drawTextOnPath} from '../../geom/flat/textpath.js';
|
|
9
8
|
import {transform2D} from '../../geom/flat/transform.js';
|
|
10
9
|
import {
|
|
@@ -596,6 +595,7 @@ class Executor {
|
|
|
596
595
|
if (alignAndScale !== 1) {
|
|
597
596
|
context.scale(alignAndScale, alignAndScale);
|
|
598
597
|
}
|
|
598
|
+
context.rotate(this.viewRotation_);
|
|
599
599
|
}
|
|
600
600
|
context.fill();
|
|
601
601
|
if (alignAndScale) {
|
|
@@ -708,9 +708,6 @@ class Executor {
|
|
|
708
708
|
let dd; // end of per-instruction data
|
|
709
709
|
let anchorX,
|
|
710
710
|
anchorY,
|
|
711
|
-
lineOffsetPx,
|
|
712
|
-
/** @type {boolean} */ isClosedRing,
|
|
713
|
-
/** @type {number} */ dStart,
|
|
714
711
|
/** @type {import('../../style/Style.js').DeclutterMode} */
|
|
715
712
|
declutterMode,
|
|
716
713
|
prevX,
|
|
@@ -785,11 +782,10 @@ class Executor {
|
|
|
785
782
|
break;
|
|
786
783
|
case CanvasInstruction.CIRCLE:
|
|
787
784
|
d = /** @type {number} */ (instruction[1]);
|
|
788
|
-
lineOffsetPx = /** @type {number} */ instruction[2] ?? 0;
|
|
789
785
|
const x1 = pixelCoordinates[d];
|
|
790
786
|
const y1 = pixelCoordinates[d + 1];
|
|
791
|
-
const x2 = pixelCoordinates[d + 2]
|
|
792
|
-
const y2 = pixelCoordinates[d + 3]
|
|
787
|
+
const x2 = pixelCoordinates[d + 2];
|
|
788
|
+
const y2 = pixelCoordinates[d + 3];
|
|
793
789
|
const dx = x2 - x1;
|
|
794
790
|
const dy = y2 - y1;
|
|
795
791
|
const r = Math.sqrt(dx * dx + dy * dy);
|
|
@@ -1197,25 +1193,8 @@ class Executor {
|
|
|
1197
1193
|
case CanvasInstruction.MOVE_TO_LINE_TO:
|
|
1198
1194
|
d = /** @type {number} */ (instruction[1]);
|
|
1199
1195
|
dd = /** @type {number} */ (instruction[2]);
|
|
1200
|
-
lineOffsetPx = /** @type {number|undefined} */ (instruction[3]);
|
|
1201
|
-
isClosedRing =
|
|
1202
|
-
/** @type {boolean|undefined} */ (instruction[4]) ?? false;
|
|
1203
1196
|
x = pixelCoordinates[d];
|
|
1204
1197
|
y = pixelCoordinates[d + 1];
|
|
1205
|
-
|
|
1206
|
-
if (lineOffsetPx) {
|
|
1207
|
-
dStart = d;
|
|
1208
|
-
[x, y] = offsetLineVertex(
|
|
1209
|
-
x,
|
|
1210
|
-
y,
|
|
1211
|
-
isClosedRing ? pixelCoordinates[dd - 4] : undefined,
|
|
1212
|
-
isClosedRing ? pixelCoordinates[dd - 3] : undefined,
|
|
1213
|
-
pixelCoordinates[d + 2],
|
|
1214
|
-
pixelCoordinates[d + 3],
|
|
1215
|
-
lineOffsetPx,
|
|
1216
|
-
);
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
1198
|
context.moveTo(x, y);
|
|
1220
1199
|
prevX = (x + 0.5) | 0;
|
|
1221
1200
|
prevY = (y + 0.5) | 0;
|
|
@@ -1225,31 +1204,6 @@ class Executor {
|
|
|
1225
1204
|
roundX = (x + 0.5) | 0;
|
|
1226
1205
|
roundY = (y + 0.5) | 0;
|
|
1227
1206
|
if (d == dd - 2 || roundX !== prevX || roundY !== prevY) {
|
|
1228
|
-
if (lineOffsetPx) {
|
|
1229
|
-
if (d == dd - 2) {
|
|
1230
|
-
// last coordinate
|
|
1231
|
-
[x, y] = offsetLineVertex(
|
|
1232
|
-
x,
|
|
1233
|
-
y,
|
|
1234
|
-
pixelCoordinates[d - 2],
|
|
1235
|
-
pixelCoordinates[d - 1],
|
|
1236
|
-
isClosedRing ? pixelCoordinates[dStart + 2] : undefined,
|
|
1237
|
-
isClosedRing ? pixelCoordinates[dStart + 3] : undefined,
|
|
1238
|
-
lineOffsetPx,
|
|
1239
|
-
);
|
|
1240
|
-
} else {
|
|
1241
|
-
[x, y] = offsetLineVertex(
|
|
1242
|
-
x,
|
|
1243
|
-
y,
|
|
1244
|
-
pixelCoordinates[d - 2],
|
|
1245
|
-
pixelCoordinates[d - 1],
|
|
1246
|
-
pixelCoordinates[d + 2],
|
|
1247
|
-
pixelCoordinates[d + 3],
|
|
1248
|
-
lineOffsetPx,
|
|
1249
|
-
);
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
1207
|
context.lineTo(x, y);
|
|
1254
1208
|
prevX = roundX;
|
|
1255
1209
|
prevY = roundY;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecutorGroup.d.ts","sourceRoot":"","sources":["ExecutorGroup.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExecutorGroup.d.ts","sourceRoot":"","sources":["ExecutorGroup.js"],"names":[],"mappings":"AAidA;;;;;;GAMG;AACH,2CAHW,MAAM,GACL,KAAK,CAAC,MAAM,CAAC,CA2CxB;AAlfD;;;GAGG;AACH,kBAFU,KAAK,CAAC,OAAO,cAAc,EAAE,WAAW,CAAC,CASjD;AAEF;;;GAGG;AACH,wBAFU,KAAK,CAAC,OAAO,cAAc,EAAE,WAAW,CAAC,CAER;AAE3C;;;GAGG;AACH,4BAFU,KAAK,CAAC,OAAO,cAAc,EAAE,WAAW,CAAC,CAIjD;;AAEF;IACE;;;;;;;;;;;;OAYG;IACH,uBAZW,OAAO,iBAAiB,EAAE,MAAM,cAIhC,MAAM,cACN,MAAM,YACN,OAAO,mBACP;YAAQ,MAAM,GAAE,GAA4F;KAAC,iBAE7G,MAAM,sBACN,OAAO,EAwEjB;IA7DC;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,kBAAyB;IAEzB;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,oBAA6B;IAE7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Type) => !DECLUTTER.includes(builderType),
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
/** @type {boolean|undefined} */
|
|
44
|
-
let willReadFrequently = false;
|
|
45
|
-
|
|
46
|
-
/** @type {boolean|undefined} */
|
|
47
|
-
let canvasReadsBenchmarked = false;
|
|
48
|
-
|
|
49
|
-
/** Determine if canvas read operations are faster with willReadFrequently set to true or false */
|
|
50
|
-
function benchmarkCanvasReads() {
|
|
51
|
-
let bestResult = 0;
|
|
52
|
-
/**
|
|
53
|
-
* @param {boolean} willReadFrequently Will read frequently.
|
|
54
|
-
* @return {number} Operation count.
|
|
55
|
-
*/
|
|
56
|
-
const measure = (willReadFrequently) => {
|
|
57
|
-
const context = createCanvasContext2D(1, 1, null, {willReadFrequently});
|
|
58
|
-
let count = 0;
|
|
59
|
-
const start = performance.now();
|
|
60
|
-
for (; performance.now() - start < 50; ++count) {
|
|
61
|
-
context.fillStyle = `rgba(255,0,${count % 256},1)`;
|
|
62
|
-
context.fillRect(0, 0, 1, 1);
|
|
63
|
-
context.getImageData(0, 0, 1, 1);
|
|
64
|
-
}
|
|
65
|
-
bestResult = count > bestResult ? count : bestResult;
|
|
66
|
-
return count;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const measures = {
|
|
70
|
-
[measure(true)]: true,
|
|
71
|
-
[measure(false)]: false,
|
|
72
|
-
[measure(undefined)]: undefined,
|
|
73
|
-
};
|
|
74
|
-
willReadFrequently = measures[bestResult];
|
|
75
|
-
canvasReadsBenchmarked = true;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
43
|
class ExecutorGroup {
|
|
79
44
|
/**
|
|
80
45
|
* @param {import("../../extent.js").Extent} maxExtent Max extent for clipping. When a
|
|
@@ -236,10 +201,6 @@ class ExecutorGroup {
|
|
|
236
201
|
callback,
|
|
237
202
|
declutteredFeatures,
|
|
238
203
|
) {
|
|
239
|
-
if (canvasReadsBenchmarked === false) {
|
|
240
|
-
benchmarkCanvasReads();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
204
|
hitTolerance = Math.round(hitTolerance);
|
|
244
205
|
const contextSize = hitTolerance * 2 + 1;
|
|
245
206
|
const transform = composeTransform(
|
|
@@ -255,11 +216,14 @@ class ExecutorGroup {
|
|
|
255
216
|
|
|
256
217
|
const newContext = !this.hitDetectionContext_;
|
|
257
218
|
if (newContext) {
|
|
219
|
+
// Refrain from adding a 'willReadFrequently' hint in the options here.
|
|
220
|
+
// While it will remove the "Canvas2D: Multiple readback operations using
|
|
221
|
+
// getImageData are faster with the willReadFrequently attribute set
|
|
222
|
+
// to true" warnings in the console, it makes hitDetection extremely
|
|
223
|
+
// slow in Chrome when there are many features on the map
|
|
258
224
|
this.hitDetectionContext_ = createCanvasContext2D(
|
|
259
225
|
contextSize,
|
|
260
226
|
contextSize,
|
|
261
|
-
null,
|
|
262
|
-
{willReadFrequently},
|
|
263
227
|
);
|
|
264
228
|
}
|
|
265
229
|
const context = this.hitDetectionContext_;
|
|
@@ -216,7 +216,6 @@ declare class CanvasImmediateRenderer extends VectorContext {
|
|
|
216
216
|
* @param {number} end End.
|
|
217
217
|
* @param {number} stride Stride.
|
|
218
218
|
* @param {boolean} close Close.
|
|
219
|
-
* @param {number} [strokeOffset] Stroke Offset.
|
|
220
219
|
* @private
|
|
221
220
|
* @return {number} end End.
|
|
222
221
|
*/
|
|
@@ -226,7 +225,6 @@ declare class CanvasImmediateRenderer extends VectorContext {
|
|
|
226
225
|
* @param {number} offset Offset.
|
|
227
226
|
* @param {Array<number>} ends Ends.
|
|
228
227
|
* @param {number} stride Stride.
|
|
229
|
-
* @param {number} [strokeOffset] Stroke Offset.
|
|
230
228
|
* @private
|
|
231
229
|
* @return {number} End.
|
|
232
230
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Immediate.d.ts","sourceRoot":"","sources":["Immediate.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Immediate.d.ts","sourceRoot":"","sources":["Immediate.js"],"names":[],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A8F/C;CACF;0BAxpCyB,qBAAqB"}
|
|
@@ -9,7 +9,6 @@ import {equals} from '../../array.js';
|
|
|
9
9
|
import {asColorLike} from '../../colorlike.js';
|
|
10
10
|
import {intersects} from '../../extent.js';
|
|
11
11
|
import {transformGeom2D} from '../../geom/SimpleGeometry.js';
|
|
12
|
-
import {offsetLineString} from '../../geom/flat/lineoffset.js';
|
|
13
12
|
import {transform2D} from '../../geom/flat/transform.js';
|
|
14
13
|
import {toFixed} from '../../math.js';
|
|
15
14
|
import {
|
|
@@ -432,13 +431,12 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
432
431
|
* @param {number} end End.
|
|
433
432
|
* @param {number} stride Stride.
|
|
434
433
|
* @param {boolean} close Close.
|
|
435
|
-
* @param {number} [strokeOffset] Stroke Offset.
|
|
436
434
|
* @private
|
|
437
435
|
* @return {number} end End.
|
|
438
436
|
*/
|
|
439
|
-
moveToLineTo_(flatCoordinates, offset, end, stride, close
|
|
437
|
+
moveToLineTo_(flatCoordinates, offset, end, stride, close) {
|
|
440
438
|
const context = this.context_;
|
|
441
|
-
|
|
439
|
+
const pixelCoordinates = transform2D(
|
|
442
440
|
flatCoordinates,
|
|
443
441
|
offset,
|
|
444
442
|
end,
|
|
@@ -446,15 +444,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
446
444
|
this.transform_,
|
|
447
445
|
this.pixelCoordinates_,
|
|
448
446
|
);
|
|
449
|
-
if (Math.abs(strokeOffset) > 0) {
|
|
450
|
-
pixelCoordinates = offsetLineString(
|
|
451
|
-
pixelCoordinates,
|
|
452
|
-
stride,
|
|
453
|
-
strokeOffset,
|
|
454
|
-
close,
|
|
455
|
-
pixelCoordinates,
|
|
456
|
-
);
|
|
457
|
-
}
|
|
458
447
|
context.moveTo(pixelCoordinates[0], pixelCoordinates[1]);
|
|
459
448
|
let length = pixelCoordinates.length;
|
|
460
449
|
if (close) {
|
|
@@ -474,11 +463,10 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
474
463
|
* @param {number} offset Offset.
|
|
475
464
|
* @param {Array<number>} ends Ends.
|
|
476
465
|
* @param {number} stride Stride.
|
|
477
|
-
* @param {number} [strokeOffset] Stroke Offset.
|
|
478
466
|
* @private
|
|
479
467
|
* @return {number} End.
|
|
480
468
|
*/
|
|
481
|
-
drawRings_(flatCoordinates, offset, ends, stride
|
|
469
|
+
drawRings_(flatCoordinates, offset, ends, stride) {
|
|
482
470
|
for (let i = 0, ii = ends.length; i < ii; ++i) {
|
|
483
471
|
offset = this.moveToLineTo_(
|
|
484
472
|
flatCoordinates,
|
|
@@ -486,7 +474,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
486
474
|
ends[i],
|
|
487
475
|
stride,
|
|
488
476
|
true,
|
|
489
|
-
strokeOffset,
|
|
490
477
|
);
|
|
491
478
|
}
|
|
492
479
|
return offset;
|
|
@@ -746,7 +733,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
746
733
|
flatCoordinates.length,
|
|
747
734
|
geometry.getStride(),
|
|
748
735
|
false,
|
|
749
|
-
this.strokeState_.strokeOffset,
|
|
750
736
|
);
|
|
751
737
|
context.stroke();
|
|
752
738
|
}
|
|
@@ -792,7 +778,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
792
778
|
ends[i],
|
|
793
779
|
stride,
|
|
794
780
|
false,
|
|
795
|
-
this.strokeState_.strokeOffset,
|
|
796
781
|
);
|
|
797
782
|
}
|
|
798
783
|
context.stroke();
|
|
@@ -836,7 +821,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
836
821
|
0,
|
|
837
822
|
/** @type {Array<number>} */ (geometry.getEnds()),
|
|
838
823
|
geometry.getStride(),
|
|
839
|
-
this.strokeState_?.strokeOffset,
|
|
840
824
|
);
|
|
841
825
|
if (this.fillState_) {
|
|
842
826
|
context.fill();
|
|
@@ -884,13 +868,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
884
868
|
context.beginPath();
|
|
885
869
|
for (let i = 0, ii = endss.length; i < ii; ++i) {
|
|
886
870
|
const ends = endss[i];
|
|
887
|
-
offset = this.drawRings_(
|
|
888
|
-
flatCoordinates,
|
|
889
|
-
offset,
|
|
890
|
-
ends,
|
|
891
|
-
stride,
|
|
892
|
-
this.strokeState_?.strokeOffset,
|
|
893
|
-
);
|
|
871
|
+
offset = this.drawRings_(flatCoordinates, offset, ends, stride);
|
|
894
872
|
}
|
|
895
873
|
if (this.fillState_) {
|
|
896
874
|
context.fill();
|
|
@@ -1049,7 +1027,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
1049
1027
|
const lineDash = strokeStyleLineDash
|
|
1050
1028
|
? strokeStyleLineDash
|
|
1051
1029
|
: defaultLineDash;
|
|
1052
|
-
const strokeOffset = strokeStyle.getOffset();
|
|
1053
1030
|
this.strokeState_ = {
|
|
1054
1031
|
lineCap:
|
|
1055
1032
|
strokeStyleLineCap !== undefined
|
|
@@ -1078,7 +1055,6 @@ class CanvasImmediateRenderer extends VectorContext {
|
|
|
1078
1055
|
strokeStyle: asColorLike(
|
|
1079
1056
|
strokeStyleColor ? strokeStyleColor : defaultStrokeStyle,
|
|
1080
1057
|
),
|
|
1081
|
-
strokeOffset: (strokeOffset ?? 0) * this.pixelRatio_,
|
|
1082
1058
|
};
|
|
1083
1059
|
}
|
|
1084
1060
|
}
|