cd-mapgis 1.0.74 → 1.0.76

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cd-mapgis",
3
- "version": "1.0.74",
3
+ "version": "1.0.76",
4
4
  "main": "./src/index.js",
5
5
  "types": "./src/index.d.ts",
6
6
  "type": "module",
package/src/LayerUtil.js CHANGED
@@ -202,7 +202,7 @@ export default class LayerUtil {
202
202
  let geometry = geoJSON.readGeometry(p.data);
203
203
  let feature = new Feature({ geometry: geometry });
204
204
  let vectorSource = new VectorSource({ features: [feature] });
205
- p.style = p.style ? StyleUtil.getPointStyle(p.style) : StyleUtil.getViewOnTemplayerStyle();
205
+ p.style = p.style ? StyleUtil.getCommStyle(p.style) : StyleUtil.getViewOnTemplayerStyle();
206
206
  let layer = new VectorLayer({
207
207
  source: vectorSource,
208
208
  style: p.style
package/src/StyleUtil.js CHANGED
@@ -21,6 +21,15 @@ export default class StyleUtil {
21
21
  }),
22
22
  fill: new Fill({
23
23
  color: 'rgba(0, 0, 0, 0)' // 透明填充
24
+ }),
25
+ image: new Circle({
26
+ radius: 5,
27
+ stroke: new Stroke({
28
+ color: 'rgba(0, 0, 0, 0.7)'
29
+ }),
30
+ fill: new Fill({
31
+ color: 'rgba(255, 255, 255, 0.2)'
32
+ })
24
33
  })
25
34
  });
26
35
  }
@@ -86,8 +95,8 @@ export default class StyleUtil {
86
95
  anchorXUnits: 'fraction',
87
96
  anchorYUnits: 'pixels',
88
97
  offsetOrigin: 'top-right',
89
- scale:p.scale ?? 0.5,
90
- offset:p.offset ?? [0,10],
98
+ scale: p.scale ?? 0.5,
99
+ offset: p.offset ?? [0, 10],
91
100
  // offset:[0,10],
92
101
  //图标缩放比例
93
102
  //scale:0.5,
@@ -156,7 +165,46 @@ export default class StyleUtil {
156
165
  });
157
166
  if (p.text) {
158
167
  styleParam.text = StyleUtil.getText(p.text);
159
- }
168
+ }
169
+ return new Style(styleParam);
170
+ }
171
+ /**
172
+ * 通用样式配置
173
+ * @param {*} p
174
+ * @returns
175
+ */
176
+ static getCommStyle(p) {
177
+ let styleParam = {};
178
+ let fill = 'rgba(255, 255, 255, 0.2)';
179
+ let lineColor = 'rgba(0, 0, 255, 1)';
180
+ let lineWidth = 2;
181
+ if (p.style) {
182
+ if (p.style.fillColor) fill = p.style.fillColor;
183
+ if (p.style.lineColor) lineColor = p.style.lineColor;
184
+ if (p.style.lineWidth) lineWidth = p.style.lineWidth;
185
+ }
186
+ styleParam.fill = new Fill({
187
+ color: fill
188
+ });
189
+ styleParam.stroke = new Stroke({
190
+ color: lineColor,
191
+ width: lineWidth
192
+ });
193
+ styleParam.image = new Circle({
194
+ radius: 5,
195
+ stroke: new Stroke({
196
+ color: 'rgba(0, 0, 0, 0.7)'
197
+ }),
198
+ fill: new Fill({
199
+ color: 'rgba(255, 255, 255, 0.2)'
200
+ })
201
+ });
202
+ if (p.img) {
203
+ styleParam.image = StyleUtil.getIcon(p.img);
204
+ }
205
+ if (p.text) {
206
+ styleParam.text = StyleUtil.getText(p.text);
207
+ }
160
208
  return new Style(styleParam);
161
209
  }
162
210
  }