更改设备不能编辑
This commit is contained in:
parent
837255691e
commit
f2a0977133
|
|
@ -601,12 +601,25 @@ export default {
|
|||
return item.geometry.coordinates;
|
||||
});
|
||||
|
||||
geojson.coordinates = geojson.coordinates.filter(
|
||||
(item) =>
|
||||
Array.isArray(item) &&
|
||||
Array.isArray(item[0]) &&
|
||||
Array.isArray(item[0][0])
|
||||
);
|
||||
// 清理 geojson.coordinates,只保留第一个有效元素
|
||||
if (
|
||||
Array.isArray(geojson.coordinates) &&
|
||||
geojson.coordinates.length > 1
|
||||
) {
|
||||
// 寻找第一个有效元素(点、多边形或圆)
|
||||
const firstValidItem = geojson.coordinates.find(
|
||||
(item) =>
|
||||
Array.isArray(item) &&
|
||||
// 点坐标:[lng, lat]
|
||||
((item.length === 2 &&
|
||||
typeof item[0] === "number" &&
|
||||
typeof item[1] === "number") ||
|
||||
// 多边形或圆坐标:三维数组
|
||||
(Array.isArray(item[0]) && Array.isArray(item[0][0])))
|
||||
);
|
||||
// 如果找到有效元素,只保留它;否则置为空数组
|
||||
geojson.coordinates = firstValidItem ? [firstValidItem] : [];
|
||||
}
|
||||
}
|
||||
this.ruleForm.geoJson = geojson;
|
||||
this.ruleForm.center = [
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ export default {
|
|||
},
|
||||
toGeoJSON() {
|
||||
if (this.typeOf === "pointP") {
|
||||
// return this.graphicLayer.toGeoJSON({ noAlt: true });
|
||||
return this.graphicLayer.toGeoJSON({ noAlt: true });
|
||||
} else {
|
||||
this.graphicLayer._graphicList._array.forEach((item) => {
|
||||
if (item.type === "billboard") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue