cd-mapgis 1.0.42 → 1.0.43
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 +1 -1
- package/src/LayerUtil.js +6 -12
- package/src/MapView.js +1 -2
- package/src/StyleUtil.js +2 -2
package/package.json
CHANGED
package/src/LayerUtil.js
CHANGED
|
@@ -209,13 +209,11 @@ export default class LayerUtil {
|
|
|
209
209
|
* 将geoJson的点集合数据包装为一个图层
|
|
210
210
|
* @param {*} p {geoList:[],img:{url,anchor},text:{str,font,color,offsetY}}
|
|
211
211
|
*/
|
|
212
|
-
static getJsonPointsLayer(p) {
|
|
213
|
-
console.log("1", p);
|
|
212
|
+
static getJsonPointsLayer(p) {
|
|
214
213
|
let geoJSON = new GeoJSON();
|
|
215
214
|
let features = [];
|
|
216
215
|
for (let i = 0; i < p.geoList.length; i++) {
|
|
217
|
-
let geo = p.geoList[i];
|
|
218
|
-
console.log("2", geo);
|
|
216
|
+
let geo = p.geoList[i];
|
|
219
217
|
var f = new Feature({
|
|
220
218
|
geometry: geoJSON.readGeometry(geo.json)
|
|
221
219
|
});
|
|
@@ -225,8 +223,7 @@ export default class LayerUtil {
|
|
|
225
223
|
}
|
|
226
224
|
f.setStyle(StyleUtil.getPointStyle(p));
|
|
227
225
|
features.push(f);
|
|
228
|
-
}
|
|
229
|
-
console.log("3", features);
|
|
226
|
+
}
|
|
230
227
|
let vectorSource = new VectorSource({ features: features });
|
|
231
228
|
return new VectorLayer({
|
|
232
229
|
source: vectorSource
|
|
@@ -236,13 +233,11 @@ export default class LayerUtil {
|
|
|
236
233
|
* 将geoJson的多边形集合数据包装为一个图层
|
|
237
234
|
* @param {*} p {geoList:[],style:{fillColor,lineColor,lineWidth},text:{str,font,color}}
|
|
238
235
|
*/
|
|
239
|
-
static getJsonPolygonsLayer(p) {
|
|
240
|
-
console.log("1", p);
|
|
236
|
+
static getJsonPolygonsLayer(p) {
|
|
241
237
|
let geoJSON = new GeoJSON();
|
|
242
238
|
let features = [];
|
|
243
239
|
for (let i = 0; i < p.geoList.length; i++) {
|
|
244
|
-
let geo = p.geoList[i];
|
|
245
|
-
console.log("2", geo);
|
|
240
|
+
let geo = p.geoList[i];
|
|
246
241
|
var f = new Feature({
|
|
247
242
|
geometry: geoJSON.readGeometry(geo.json)
|
|
248
243
|
});
|
|
@@ -252,8 +247,7 @@ export default class LayerUtil {
|
|
|
252
247
|
}
|
|
253
248
|
f.setStyle(StyleUtil.getPolygonStyle(p));
|
|
254
249
|
features.push(f);
|
|
255
|
-
}
|
|
256
|
-
console.log("3", features);
|
|
250
|
+
}
|
|
257
251
|
let vectorSource = new VectorSource({ features: features });
|
|
258
252
|
return new VectorLayer({
|
|
259
253
|
source: vectorSource
|
package/src/MapView.js
CHANGED
|
@@ -198,8 +198,7 @@ export default class MapView {
|
|
|
198
198
|
}
|
|
199
199
|
//将视图调整到一个指定的图层显示范围,并返回是否调整成功.只对矢量图层有效,瓦片图层无效
|
|
200
200
|
viewToLayer(layer) {
|
|
201
|
-
let source = layer.getSource();
|
|
202
|
-
console.log("length",source.getFeatures().length);
|
|
201
|
+
let source = layer.getSource();
|
|
203
202
|
if (source.getFeatures().length === 0) return false;
|
|
204
203
|
var extent = source.getExtent();
|
|
205
204
|
let view = this.map.getView();
|
package/src/StyleUtil.js
CHANGED
|
@@ -107,6 +107,7 @@ export default class StyleUtil {
|
|
|
107
107
|
return new Text({
|
|
108
108
|
text: p.str, // 从要素属性获取文字
|
|
109
109
|
font: font,
|
|
110
|
+
overflow: true, // 关键设置:允许文字溢出
|
|
110
111
|
fill: new Fill({
|
|
111
112
|
color: corlor
|
|
112
113
|
}),
|
|
@@ -153,8 +154,7 @@ export default class StyleUtil {
|
|
|
153
154
|
});
|
|
154
155
|
if (p.text) {
|
|
155
156
|
styleParam.text = StyleUtil.getText(p.text);
|
|
156
|
-
}
|
|
157
|
-
console.log("1111", styleParam)
|
|
157
|
+
}
|
|
158
158
|
return new Style(styleParam);
|
|
159
159
|
}
|
|
160
160
|
}
|