@naivemap/image-layer-core 0.2.0-alpha.0 → 0.2.0
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.
|
@@ -1,16 +1,42 @@
|
|
|
1
1
|
import { Coordinates, LayerController, LayerMap } from '@naivemap/map-gl-layer-adaptor';
|
|
2
2
|
import { MaskProperty } from './mask';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* The options for ImageLayer
|
|
5
5
|
*/
|
|
6
6
|
export type ImageLayerOption = {
|
|
7
|
+
/**
|
|
8
|
+
* The URL of the image to display on the map. The image can be in any projection, and it will be reprojected to Web Mercator using Arrugator and Proj4js.
|
|
9
|
+
*/
|
|
7
10
|
url: string;
|
|
11
|
+
/**
|
|
12
|
+
* The projection of the image. It can be any projection supported by Proj4js, such as 'EPSG:4326' or 'EPSG:3857'.
|
|
13
|
+
*/
|
|
8
14
|
projection: string;
|
|
15
|
+
/**
|
|
16
|
+
* The coordinates of the image corners in the specified projection.
|
|
17
|
+
*/
|
|
9
18
|
coordinates: Coordinates;
|
|
19
|
+
/**
|
|
20
|
+
* The resampling method to use when reprojecting the image. Can be 'linear' or 'nearest'.
|
|
21
|
+
* @default 'linear'
|
|
22
|
+
*/
|
|
10
23
|
resampling?: 'linear' | 'nearest';
|
|
24
|
+
/**
|
|
25
|
+
* The opacity of the image layer.
|
|
26
|
+
* @default 1.0
|
|
27
|
+
*/
|
|
11
28
|
opacity?: number;
|
|
29
|
+
/**
|
|
30
|
+
* The crossOrigin attribute for loading the image. It can be set to 'anonymous' or 'use-credentials' if the image is loaded from a different origin and CORS is enabled on the server.
|
|
31
|
+
*/
|
|
12
32
|
crossOrigin?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The step size for the Arrugator algorithm. It controls the level of detail when reprojecting the image.
|
|
35
|
+
*/
|
|
13
36
|
arrugatorStep?: number;
|
|
37
|
+
/**
|
|
38
|
+
* The mask property for the image layer. It defines how the image should be masked.
|
|
39
|
+
*/
|
|
14
40
|
mask?: MaskProperty;
|
|
15
41
|
};
|
|
16
42
|
export default class ImageLayerCore implements LayerController {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as GeoJSON from 'geojson';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The mask property of the image layer
|
|
4
4
|
*/
|
|
5
5
|
export interface MaskProperty {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* The type of the mask, 'in' means the area inside the polygon will be masked, 'out' means the area outside the polygon will be masked, default is 'in'
|
|
8
8
|
*/
|
|
9
9
|
type?: 'in' | 'out';
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* The GeoJSON data or URL of the GeoJSON data for the mask
|
|
12
12
|
*/
|
|
13
13
|
data: GeoJSON.GeoJSON | string;
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naivemap/image-layer-core",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Map engine agnostic image custom layer core.",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"earcut": "^3.0.1",
|
|
36
36
|
"tinyqueue": "^3.0.0",
|
|
37
37
|
"twgl.js": "^5.5.4",
|
|
38
|
-
"@naivemap/map-gl-layer-adaptor": "0.2.0
|
|
38
|
+
"@naivemap/map-gl-layer-adaptor": "0.2.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"proj4": "^2.8.0"
|