|
@@ -54,7 +54,7 @@
|
|
|
markerboxEntity: [], //地图落点实体
|
|
|
markerboxEntityRadius: [], //地图落点实体
|
|
|
connectBoxEntity: null, //地图线实体
|
|
|
- graphicsBoxEntity: null, //地图面实体
|
|
|
+ graphicsBoxEntity: [], //地图面实体
|
|
|
connectBoxEntityTwo: null, //地图线实体
|
|
|
timer: null,
|
|
|
/*************************原地图属性*********************/
|
|
@@ -346,9 +346,11 @@
|
|
|
},
|
|
|
//移除之前添加的面
|
|
|
clearG() {
|
|
|
- if (this.graphicsBoxEntity != null) {
|
|
|
- this.viewer.entities.remove(this.graphicsBoxEntity)
|
|
|
- this.graphicsBoxEntity = null
|
|
|
+ if (this.graphicsBoxEntity != null && this.graphicsBoxEntity.length > 0) {
|
|
|
+ for (let i = 0; i < this.graphicsBoxEntity.length; i++) {
|
|
|
+ this.viewer.entities.remove(this.graphicsBoxEntity[i])
|
|
|
+ }
|
|
|
+ this.graphicsBoxEntity = []
|
|
|
}
|
|
|
},
|
|
|
superMapInfo(index) {
|
|
@@ -943,35 +945,46 @@
|
|
|
/**
|
|
|
* 地图画线(贴地)
|
|
|
*/
|
|
|
- setConnectTwoList(connectList, color, withAlpha) {
|
|
|
+ setGraphicsList(graphicsList, color, withAlpha) {
|
|
|
let that = this
|
|
|
//Cesium.Color.fromCssColorString('#67ADDF') 16进制颜色设置
|
|
|
let material = Cesium.Color.fromCssColorString(color).withAlpha(withAlpha);
|
|
|
- that.connectBoxEntityTwo = that.viewer.entities.add({
|
|
|
- Type: 'Polyline',
|
|
|
- polyline: {
|
|
|
- positions: Cesium.Cartesian3.fromDegreesArray(connectList),
|
|
|
+ let graphicsBoxEntity = that.viewer.entities.add({
|
|
|
+ polygon: {
|
|
|
+ hierarchy: Cesium.Cartesian3.fromDegreesArray(graphicsList),
|
|
|
clampToGround: true, //贴地 true,不贴地 false
|
|
|
width: 5,
|
|
|
material: material
|
|
|
}
|
|
|
})
|
|
|
+ that.graphicsBoxEntity.push(graphicsBoxEntity);
|
|
|
},
|
|
|
/**
|
|
|
* 地图图形(贴地)
|
|
|
*/
|
|
|
- setGraphicsList(graphicsList, color, withAlpha) {
|
|
|
+ setGraphicsListMultiple(graphicsList, color, withAlpha) {
|
|
|
let that = this
|
|
|
//Cesium.Color.fromCssColorString('#67ADDF') 16进制颜色设置
|
|
|
let material = Cesium.Color.fromCssColorString(color).withAlpha(withAlpha);
|
|
|
- that.graphicsBoxEntity = that.viewer.entities.add({
|
|
|
- polygon: {
|
|
|
- hierarchy: Cesium.Cartesian3.fromDegreesArray(graphicsList),
|
|
|
- clampToGround: true, //贴地 true,不贴地 false
|
|
|
- width: 5,
|
|
|
- material: material
|
|
|
+ for (let i = 0; i < graphicsList.length; i++) {
|
|
|
+ if (graphicsList[i].latLngs != null && graphicsList[i].latLngs != "") {
|
|
|
+ let jsonToArr = JSON.parse(graphicsList[i].latLngs);
|
|
|
+ const arr = []
|
|
|
+ for (let j = 0; j < jsonToArr.length; j++) {
|
|
|
+ arr.push(jsonToArr[j].lng)
|
|
|
+ arr.push(jsonToArr[j].lat)
|
|
|
+ }
|
|
|
+ let graphicsBoxEntity = that.viewer.entities.add({
|
|
|
+ polygon: {
|
|
|
+ hierarchy: Cesium.Cartesian3.fromDegreesArray(arr),
|
|
|
+ clampToGround: true, //贴地 true,不贴地 false
|
|
|
+ width: 5,
|
|
|
+ material: material
|
|
|
+ }
|
|
|
+ })
|
|
|
+ that.graphicsBoxEntity.push(graphicsBoxEntity);
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
}
|