|
@@ -225,7 +225,9 @@ export default {
|
|
|
clear() {
|
|
|
this.$refs.range.reset();
|
|
|
// this.pullClear();
|
|
|
- this.removeEntities();
|
|
|
+ // this.removeEntities();
|
|
|
+ viewer.entities.removeAll();
|
|
|
+ viewer.dataSources.removeAll();
|
|
|
},
|
|
|
submit() {
|
|
|
var _temp = this.$refs.range.getRange();
|
|
@@ -239,7 +241,7 @@ export default {
|
|
|
}
|
|
|
this.form.geojson = parse(_temp.geom);
|
|
|
// this.pullUp(_temp, this.form.BuildingHeight);
|
|
|
- this.onSubmit(this.form.geojson);
|
|
|
+ this.onSubmit();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -267,9 +269,8 @@ export default {
|
|
|
|
|
|
return gcHight;
|
|
|
},
|
|
|
- onSubmit(geojson) {
|
|
|
- let that = this;
|
|
|
- that.removeEntities();
|
|
|
+ onSubmit() {
|
|
|
+ // that.removeEntities();
|
|
|
// //基础高度(地形高度)加入地形后可删除
|
|
|
let jcgd = 0;
|
|
|
jcgd = this.getjcHigeht(geojson);
|
|
@@ -278,58 +279,47 @@ export default {
|
|
|
minH = jcgd;
|
|
|
for (
|
|
|
let FLOORindex = 1;
|
|
|
- FLOORindex <= Math.ceil(that.form.BuildingHeight / that.form.FLOORH);
|
|
|
+ FLOORindex <= Math.ceil(this.form.BuildingHeight / this.form.FLOORH);
|
|
|
FLOORindex++
|
|
|
) {
|
|
|
- // debugger;
|
|
|
- maxH += that.form.FLOORH;
|
|
|
- minH = maxH - that.form.FLOORH;
|
|
|
- if (maxH > that.form.BuildingHeight) maxH = that.form.BuildingHeight;
|
|
|
+ maxH += this.form.FLOORH;
|
|
|
+ minH = maxH - this.form.FLOORH;
|
|
|
+ if (maxH > this.form.BuildingHeight) maxH = this.form.BuildingHeight;
|
|
|
console.log("maxH:" + maxH + "----minH:" + minH);
|
|
|
this.loadGeoJSON(this.form.geojson, "#ffffff", "", minH, maxH, "");
|
|
|
- let ps = [];
|
|
|
- // for (let index = 0; index < element.geometry.points.length; index++) {
|
|
|
- // const point = element.geometry.points[index];
|
|
|
- // ps.push(point.x);
|
|
|
- // ps.push(point.y);
|
|
|
- // // ps.push(minH);
|
|
|
- // }
|
|
|
- // geojson.coordinates[0].forEach((gom) => {
|
|
|
- // ps.push(gom[0]);
|
|
|
- // ps.push(gom[1]);
|
|
|
- // });
|
|
|
- // // let id = uuidv4();
|
|
|
- // this.addPolygon(ps, jcgd, that.form.BuildingHeight);
|
|
|
-
|
|
|
- // let pss = [];
|
|
|
- // // for (let index = 0; index < element.geometry.points.length; index++) {
|
|
|
- // // const point = element.geometry.points[index];
|
|
|
- // // pss.push(point.x);
|
|
|
- // // pss.push(point.y);
|
|
|
- // // pss.push(maxH);
|
|
|
- // // }
|
|
|
- // geojson.coordinates[0].forEach((gom) => {
|
|
|
- // pss.push(gom[0]);
|
|
|
- // pss.push(gom[1]);
|
|
|
- // pss.push(maxH);
|
|
|
- // });
|
|
|
- // this.addPolyline(pss);
|
|
|
-
|
|
|
- // viewer.entities.add({
|
|
|
- // id: id,
|
|
|
- // polygon: {
|
|
|
- // hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(ps),
|
|
|
- // extrudedHeight: Number(maxH),
|
|
|
- // perPositionHeight: true,
|
|
|
- // material: Cesium.Color.CHARTREUSE.withAlpha(0.1),
|
|
|
- // outline: true,
|
|
|
- // outlineColor: Cesium.Color.MEDIUMSPRINGGREEN,
|
|
|
- // outlineWidth: 1.0,
|
|
|
- // shadows: Cesium.ShadowMode.ENABLED,
|
|
|
- // },
|
|
|
- // });
|
|
|
+ // this.addPrimitive(this.form.geojson);
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ addPrimitive() {
|
|
|
+ // let ps = [];
|
|
|
+ // geojson.coordinates[0].forEach((gom) => {
|
|
|
+ // ps.push(gom[0]);
|
|
|
+ // ps.push(gom[1]);
|
|
|
+ // });
|
|
|
+ // // let id = uuidv4();
|
|
|
+ // this.addPolygon(ps, jcgd, that.form.BuildingHeight);
|
|
|
+ // let pss = [];
|
|
|
+ // geojson.coordinates[0].forEach((gom) => {
|
|
|
+ // pss.push(gom[0]);
|
|
|
+ // pss.push(gom[1]);
|
|
|
+ // pss.push(maxH);
|
|
|
+ // });
|
|
|
+ // this.addPolyline(pss);
|
|
|
+ // viewer.entities.add({
|
|
|
+ // id: id,
|
|
|
+ // polygon: {
|
|
|
+ // hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(ps),
|
|
|
+ // extrudedHeight: Number(maxH),
|
|
|
+ // perPositionHeight: true,
|
|
|
+ // material: Cesium.Color.CHARTREUSE.withAlpha(0.1),
|
|
|
+ // outline: true,
|
|
|
+ // outlineColor: Cesium.Color.MEDIUMSPRINGGREEN,
|
|
|
+ // outlineWidth: 1.0,
|
|
|
+ // shadows: Cesium.ShadowMode.ENABLED,
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ },
|
|
|
addPolygon(ps, minH, maxH) {
|
|
|
// 定义多边形的顶点(经纬度)
|
|
|
var polygonHierarchy = new Cesium.PolygonHierarchy(
|