7fac27ca by jikai

111111

1 parent 3f79c517
......@@ -70,7 +70,7 @@ export default class flood {
}
});
}
floodParse(scene, positions2d, waterHeight, targetHeight) {
floodParse(positions2d, waterHeight, targetHeight) {
var River1 = new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry :new Cesium.PolygonGeometry({
......@@ -96,6 +96,6 @@ export default class flood {
}),
show : true
});
scene.primitives.add(River1);
objectManage.viewer.scene.primitives.add(River1);
}
}
\ No newline at end of file
......
import objectManage from './maputils';
export default class heightControl {
constructor() {
constructor(opt) {
this.handlerPolygon = new Cesium.DrawHandler(objectManage.viewer, Cesium.DrawMode.Polygon);
this.building = objectManage.viewer.scene.layers.find("build1");
this.building1 = objectManage.viewer.scene.layers.find("build2");
this.arr = [];
var i = 0;
while(i < 2000) this.arr.push(i++);
this.handlerPolygon.drawEvt.addEventListener(result => {
var array = [].concat(result.object.positions), positions = [];
var polygon = result.object;
......@@ -17,16 +22,37 @@ export default class heightControl {
positions.push(latitude);
}
}
this.polygon = objectManage.viewer.entities.add({
id: 'polygonA',
polygon: {
hierarchy: Cesium.Cartesian3.fromDegreesArray(positions),
height: 105,
material: new Cesium.Color(1, 1, 0.20, 0.5),
outline: true,
outlineColor: Cesium.Color.RED
}
}).polygon;
this.addPolygon(Object.assign(opt, {p: positions}));
this.splice(opt.h);
});
}
addPolygon(opt) {
this.polygon = objectManage.viewer.entities.add({
id: 'polygonA',
polygon: {
hierarchy: Cesium.Cartesian3.fromDegreesArray(opt.p),
height: opt.h,
material: new Cesium.Color(1, 1, 0.20, 0.5),
outline: true,
outlineColor: Cesium.Color.RED
}
}).polygon;
}
splice(h) {
this.building.clipLineColor = Cesium.Color.WHITE.withAlpha(0.0);
this.building1.setObjsColor(this.arr, Cesium.Color.DARKORANGE.withAlpha(0.5));
this.building.setCustomClipBox({
dimensions: new Cesium.Cartesian3(5000, 5000, h * 2),
position: Cesium.Cartesian3.fromDegrees(116.44391163897568, 39.922128887755996, h / h - 1),
clipMode: "clip_behind_any_plane"
});
this.building1.setCustomClipBox({
dimensions: new Cesium.Cartesian3(5000, 5000, h * 2),
position: Cesium.Cartesian3.fromDegrees(116.44391163897568, 39.922128887755996, h / h - 1),
clipMode: "clip_behind_all_plane"
});
}
remove() {
objectManage.viewer.entities.removeAll();
}
}
\ No newline at end of file
......
......@@ -2,6 +2,7 @@
import objectManage from './maputils';
export default class viewpoint {
constructor() {
console.log(Cesium.Sightline);
this.sightline = new Cesium.Sightline(objectManage.viewer.scene);
this.sightline.couldRemove = false;
this.sightline.build();
......
......@@ -64,7 +64,6 @@ export default class visual {
objectManage.viewer.scene.viewFlag = false;
}
});
this.chooseView();
}
chooseView() {
if (this.pointHandler.active) return;
......@@ -75,4 +74,8 @@ export default class visual {
//激活绘制点类
this.pointHandler.activate();
}
remove() {
this.viewshed3D.destroy();
this.viewshed3D = new Cesium.ViewShed3D(objectManage.viewer.scene);
}
}
\ No newline at end of file
......
......@@ -47,7 +47,7 @@
}
},
mounted() {
this.viewpoint instanceof viewpoint || (this.viewpoint = new viewpoint(this.viewer));
this.viewpoint instanceof viewpoint || (this.viewpoint = new viewpoint());
},
methods: {
closePop() {
......
......@@ -11,7 +11,7 @@
<span @click="closePop" class="close">×</span>
</div>
<div class="" style="padding: 18px 24px 0px 24px;">
<el-slider v-model="height" :min='0' :max='1000' :format-tooltip="formatTooltip"
<el-slider v-model="height" :min='1' :max='1000' :format-tooltip="formatTooltip"
@change='EheightChange'></el-slider>
</div>
<div class="func-btn">
......@@ -24,62 +24,40 @@
<span>清除分析结果</span>
</div>
</div>
<div class="table-box" style="padding: 18px 24px 30px 24px;">
<el-table :data="tableData" :highlight-current-row='false' height="242" border style="width: 100%">
<el-table-column prop="name" label="名称" align='center'>
</el-table-column>
<el-table-column prop="height" label="高度(m)" align='center'>
</el-table-column>
<el-table-column prop="superelevation" label="超高度(m)" align='center'>
</el-table-column>
</el-table>
</div>
</div>
</div>
</template>
<script>
import heightControl from "../assets/js/map/heightControl";
export default {
name: 'kgAnalusis',
components: {},
data() {
return {
height: 320,
tableData: [{
name: '1号楼',
height: '34',
superelevation: '4'
}, {
name: '1号楼',
height: '34',
superelevation: '4'
}, {
name: '1号楼',
height: '34',
superelevation: '4'
}, {
name: '1号楼',
height: '34',
superelevation: '4'
},]
height: 100
}
},
mounted() {},
mounted() {
this.heightControl instanceof heightControl || (this.heightControl = new heightControl({h: this.height}));
},
methods: {
closePop() {
this.$emit('closePop', 'kgAnalusis')
},
startAnalysis() {
this.heightControl.handlerPolygon.deactivate();
this.heightControl.handlerPolygon.activate();
},
stopAnalysis() {
this.heightControl.remove();
},
formatTooltip(val) {
return val + '米';
},
EheightChange() {
this.heightControl.polygon.height = this.height;
this.heightControl.splice(this.height);
}
}
}
......
......@@ -41,7 +41,6 @@
</template>
<script>
import height from "../assets/js/map/heightControl";
export default {
name: 'tjxAnslysis',
components: {},
......@@ -51,18 +50,16 @@
}
},
mounted() {
this.height instanceof height || (this.height = new height());
},
methods: {
closePop() {
this.$emit('closePop', 'tjxAnslysis')
},
startAnalysis() {
this.height.handlerPolygon.deactivate();
this.height.handlerPolygon.activate();
},
stopAnalysis() {
this.height.polygon.height = 50;
},
}
}
......
......@@ -123,11 +123,12 @@
closePop() {
this.$emit('closePop', 'visualField')
},
handleChange() {
startAnalysis() {
this.visual.chooseView();
},
stopAnalysis() {
this.visual.remove();
},
startAnalysis() {},
stopAnalysis() {},
handleIsXmbj(flag) {
this.isXmbj = flag;
}
......
......@@ -86,15 +86,11 @@
},
startAnalysis() {
// this.isAnalysis = true;
let viewer = this.$parent.viewer;
this.flood.floodParse(viewer.scene, this.flood.positions2d, 0, 50);
this.flood.floodParse(this.flood.positions2d, 0, 50);
this.flood.handlerPolygon.clear();
},
stopAnalysis() {
// this.isAnalysis = false;
objectManage.viewer.entities.removeAll();
// this.$parent.flood.handlerPolygon.clear();
},
handleIsXmbj(flag) {
this.isXmbj = flag;
......
......@@ -206,20 +206,28 @@
scene.hdrEnabled = false;
scene.sun.show = true;
this.draw = new createDraw(this.viewer);
Cesium.when.all([
scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, {
name: 'ground'
}),
scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, {
name: 'build'
})
], layers => {
var promise = [];
// promise[0] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, {
// name: 'ground'
// });
promise[0] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, {
name: 'build1'
});
promise[1] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, {
name: 'build2'
});
promise[2] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, {
name: 'ground'
});
Cesium.when.all(promise, layers => {
// this.layers = layer;
objectManage.viewer = this.viewer;
layers[0].selectEnabled = false;
layers[1].selectEnabled = false;
layers[0].shadowType = 2;
layers[1].shadowType = 2;
// layers[0].selectEnabled = false;
// layers[1].selectEnabled = false;
// layers[0].shadowType = 2;
// layers[1].shadowType = 2;
scene.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196),
orientation : {
......