my-openlayer 0.1.10 → 0.1.12
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/dist/core/Line.js +4 -4
- package/dist/core/MapBaseLayers.d.ts +1 -2
- package/dist/core/MapBaseLayers.js +5 -10
- package/dist/core/Point.js +3 -3
- package/dist/core/Polygon.js +5 -5
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/core/Line.js
CHANGED
|
@@ -11,8 +11,8 @@ export default class Line {
|
|
|
11
11
|
}
|
|
12
12
|
addLine(data, options) {
|
|
13
13
|
const layer = new VectorLayer({
|
|
14
|
-
name: options.
|
|
15
|
-
layerName: options.
|
|
14
|
+
name: options.layerName,
|
|
15
|
+
layerName: options.layerName,
|
|
16
16
|
source: new VectorSource({
|
|
17
17
|
features: (new GeoJSON()).readFeatures(data)
|
|
18
18
|
}),
|
|
@@ -57,8 +57,8 @@ export default class Line {
|
|
|
57
57
|
layerName: 'river',
|
|
58
58
|
source: vectorSource,
|
|
59
59
|
style: function (feature) {
|
|
60
|
-
feature.set('type', options.
|
|
61
|
-
feature.set('layerName', options.
|
|
60
|
+
feature.set('type', options.layerName);
|
|
61
|
+
feature.set('layerName', options.layerName);
|
|
62
62
|
return new Style({
|
|
63
63
|
stroke: new Stroke({
|
|
64
64
|
color: options.strokeColor || 'rgb(0,113,255)',
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import Map from "ol/Map";
|
|
5
5
|
import { Tile as TileLayer } from "ol/layer";
|
|
6
|
-
import { WMTS } from "ol/source";
|
|
7
6
|
import WMTSTileGrid from "ol/tilegrid/WMTS";
|
|
8
7
|
import XYZ from "ol/source/XYZ";
|
|
9
8
|
import { MapLayersOptions, TiandituType, AnnotationLayerOptions } from "../types";
|
|
@@ -23,7 +22,7 @@ export default class MapBaseLayers {
|
|
|
23
22
|
token: string;
|
|
24
23
|
zIndex: number;
|
|
25
24
|
visible: boolean;
|
|
26
|
-
}): TileLayer<
|
|
25
|
+
}): TileLayer<XYZ>;
|
|
27
26
|
/**
|
|
28
27
|
* 地图注记
|
|
29
28
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Tile as TileLayer } from "ol/layer";
|
|
5
5
|
import { get as getProjection } from "ol/proj";
|
|
6
6
|
import { getTopLeft, getWidth } from "ol/extent";
|
|
7
|
-
import { WMTS } from "ol/source";
|
|
7
|
+
// import { WMTS } from "ol/source";
|
|
8
8
|
import WMTSTileGrid from "ol/tilegrid/WMTS";
|
|
9
9
|
import XYZ from "ol/source/XYZ";
|
|
10
10
|
import MapTools from "./MapTools";
|
|
@@ -111,14 +111,9 @@ export default class MapBaseLayers {
|
|
|
111
111
|
//img_c 影像底图 ter_c 地形底图
|
|
112
112
|
static getTiandiTuLayer(options) {
|
|
113
113
|
return new TileLayer({
|
|
114
|
-
source: new
|
|
115
|
-
url:
|
|
116
|
-
|
|
117
|
-
style: 'default',
|
|
118
|
-
matrixSet: 'c',
|
|
119
|
-
format: 'tiles',
|
|
120
|
-
wrapX: true,
|
|
121
|
-
tileGrid: this.getTileGrid(19)
|
|
114
|
+
source: new XYZ({
|
|
115
|
+
url: `//t{0-7}.tianditu.gov.cn/DataServer?T=${options.type}&tk=${options.token}&x={x}&y={y}&l={z}`,
|
|
116
|
+
projection: 'EPSG:4326'
|
|
122
117
|
}),
|
|
123
118
|
zIndex: options.zIndex,
|
|
124
119
|
visible: options.visible
|
|
@@ -130,7 +125,7 @@ export default class MapBaseLayers {
|
|
|
130
125
|
static getAnnotationLayer(options) {
|
|
131
126
|
return new TileLayer({
|
|
132
127
|
source: new XYZ({
|
|
133
|
-
url:
|
|
128
|
+
url: `//t{0-7}.tianditu.gov.cn/DataServer?T=${options.type}&tk=${options.token}&x={x}&y={y}&l={z}`,
|
|
134
129
|
projection: 'EPSG:4326'
|
|
135
130
|
}),
|
|
136
131
|
zIndex: options.zIndex,
|
package/dist/core/Point.js
CHANGED
|
@@ -32,7 +32,7 @@ export default class Point {
|
|
|
32
32
|
// clickLocation: options.clickLocation,
|
|
33
33
|
// all: JSON.stringify(item),
|
|
34
34
|
rawData: item, //保存原始数据
|
|
35
|
-
type: options.
|
|
35
|
+
type: options.layerName,
|
|
36
36
|
geometry: new olPoint([item.lgtd, item.lttd])
|
|
37
37
|
});
|
|
38
38
|
const style = {};
|
|
@@ -64,7 +64,7 @@ export default class Point {
|
|
|
64
64
|
pointFeatureList.push(pointFeature);
|
|
65
65
|
});
|
|
66
66
|
const PointVectorLayer = new VectorLayer({
|
|
67
|
-
layerName: options.
|
|
67
|
+
layerName: options.layerName,
|
|
68
68
|
source: new VectorSource({
|
|
69
69
|
features: pointFeatureList
|
|
70
70
|
}),
|
|
@@ -91,7 +91,7 @@ export default class Point {
|
|
|
91
91
|
source: source,
|
|
92
92
|
});
|
|
93
93
|
const clusterLayer = new VectorLayer({
|
|
94
|
-
layerName: options.
|
|
94
|
+
layerName: options.layerName,
|
|
95
95
|
source: clusterSource,
|
|
96
96
|
style: function (feature) {
|
|
97
97
|
const name = feature.get('features')[0].get(options.nameKey);
|
package/dist/core/Polygon.js
CHANGED
|
@@ -33,7 +33,7 @@ export default class Polygon {
|
|
|
33
33
|
*/
|
|
34
34
|
addBorderPolygon(data, options) {
|
|
35
35
|
options = options ?? {};
|
|
36
|
-
options.
|
|
36
|
+
options.layerName = options.layerName ?? 'border';
|
|
37
37
|
options.fillColor = options.fillColor ?? 'rgba(255, 255, 255, 0)';
|
|
38
38
|
this.addPolygon(data, options);
|
|
39
39
|
if (options.mask)
|
|
@@ -43,12 +43,12 @@ export default class Polygon {
|
|
|
43
43
|
//fyBasinJson中的id的key需要跟options中的nameKey一致
|
|
44
44
|
addPolygon(dataJSON, options) {
|
|
45
45
|
options = options ?? {};
|
|
46
|
-
if (options.
|
|
47
|
-
MapTools.removeLayer(this.map, options.
|
|
46
|
+
if (options.layerName != null) {
|
|
47
|
+
MapTools.removeLayer(this.map, options.layerName);
|
|
48
48
|
}
|
|
49
49
|
const layer = new VectorLayer({
|
|
50
|
-
name: options.
|
|
51
|
-
layerName: options.
|
|
50
|
+
name: options.layerName,
|
|
51
|
+
layerName: options.layerName,
|
|
52
52
|
source: new VectorSource({
|
|
53
53
|
features: (new GeoJSON()).readFeatures(dataJSON, options.projectionOptOptions ?? {})
|
|
54
54
|
}),
|
package/dist/types.d.ts
CHANGED