cd-mapgis 1.0.40 → 1.0.41

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.40",
3
+ "version": "1.0.41",
4
4
  "main": "./src/index.js",
5
5
  "types": "./src/index.d.ts",
6
6
  "type": "module",
package/src/LayerUtil.js CHANGED
@@ -234,13 +234,12 @@ export default class LayerUtil {
234
234
  * @param {*} p {geoList:[],style:{fillColor,lineColor,lineWidth},text:{str,font,color}}
235
235
  */
236
236
  static getJsonPolygonsLayer(p) {
237
+ console.log("1", p);
237
238
  let geoJSON = new GeoJSON();
238
- let vectorSource = new VectorSource({ features: [] });
239
- let layer = new VectorLayer({
240
- source: vectorSource
241
- });
239
+ let features = [];
242
240
  for (let i = 0; i < p.geoList; i++) {
243
241
  let geo = p.geoList[i];
242
+ console.log("2", geo);
244
243
  var f = new Feature({
245
244
  geometry: geoJSON.readGeometry(geo.json)
246
245
  });
@@ -249,8 +248,12 @@ export default class LayerUtil {
249
248
  p.text.str = geo.text;
250
249
  }
251
250
  f.setStyle(StyleUtil.getPolygonStyle(p));
252
- vectorSource.addFeature(f);
251
+ features.push(f);
253
252
  }
254
- return layer;
253
+ console.log("3", features);
254
+ let vectorSource = new VectorSource({ features: features });
255
+ return new VectorLayer({
256
+ source: vectorSource
257
+ });
255
258
  }
256
259
  }
package/src/MapView.js CHANGED
@@ -199,6 +199,7 @@ export default class MapView {
199
199
  //将视图调整到一个指定的图层显示范围,并返回是否调整成功.只对矢量图层有效,瓦片图层无效
200
200
  viewToLayer(layer) {
201
201
  let source = layer.getSource();
202
+ console.log("length",source.getFeatures().length);
202
203
  if (source.getFeatures().length === 0) return false;
203
204
  var extent = source.getExtent();
204
205
  let view = this.map.getView();
package/src/StyleUtil.js CHANGED
@@ -154,6 +154,7 @@ export default class StyleUtil {
154
154
  if (p.text) {
155
155
  styleParam.text = StyleUtil.getText(p.text);
156
156
  }
157
+ console.log("1111", styleParam)
157
158
  return new Style(styleParam);
158
159
  }
159
160
  }