cd-mapgis 1.0.42 → 1.0.44
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 -1
- package/src/StyleUtil.js +2 -2
- package/test-om.js +11 -11
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
|
@@ -179,6 +179,7 @@ export default class MapView {
|
|
|
179
179
|
//地图工具 len、area
|
|
180
180
|
tool(type) {
|
|
181
181
|
this.clearDraw();
|
|
182
|
+
if (type == 'clear') return;
|
|
182
183
|
let dic = { len: 'LineString', area: 'Polygon' };
|
|
183
184
|
this.mapDrawUtil = new MapDrawUtil({ map: this.map });
|
|
184
185
|
let t = dic[type];
|
|
@@ -199,7 +200,6 @@ export default class MapView {
|
|
|
199
200
|
//将视图调整到一个指定的图层显示范围,并返回是否调整成功.只对矢量图层有效,瓦片图层无效
|
|
200
201
|
viewToLayer(layer) {
|
|
201
202
|
let source = layer.getSource();
|
|
202
|
-
console.log("length",source.getFeatures().length);
|
|
203
203
|
if (source.getFeatures().length === 0) return false;
|
|
204
204
|
var extent = source.getExtent();
|
|
205
205
|
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
|
}
|
package/test-om.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// 导入 OM 类
|
|
2
|
-
import { OM } from './src/index.js';
|
|
3
|
-
|
|
4
|
-
// 打印 OM 类,检查是否为类而不是字符串
|
|
5
|
-
console.log('OM 类型:', typeof OM);
|
|
6
|
-
console.log('OM 类定义:', OM);
|
|
7
|
-
|
|
8
|
-
// 测试调用静态方法(不执行实际初始化,只检查方法是否存在)
|
|
9
|
-
console.log('OM.initMap 存在:', typeof OM.initMap === 'function');
|
|
10
|
-
|
|
11
|
-
console.log('测试完成,请检查输出结果。');
|
|
1
|
+
// 导入 OM 类
|
|
2
|
+
import { OM } from './src/index.js';
|
|
3
|
+
|
|
4
|
+
// 打印 OM 类,检查是否为类而不是字符串
|
|
5
|
+
console.log('OM 类型:', typeof OM);
|
|
6
|
+
console.log('OM 类定义:', OM);
|
|
7
|
+
|
|
8
|
+
// 测试调用静态方法(不执行实际初始化,只检查方法是否存在)
|
|
9
|
+
console.log('OM.initMap 存在:', typeof OM.initMap === 'function');
|
|
10
|
+
|
|
11
|
+
console.log('测试完成,请检查输出结果。');
|