Merge remote-tracking branch 'origin/master'
Showing
10 changed files
with
99 additions
and
80 deletions
... | @@ -4,20 +4,14 @@ export default class flood { | ... | @@ -4,20 +4,14 @@ export default class flood { |
4 | this.positions2d = []; | 4 | this.positions2d = []; |
5 | this.handlerPolygon = new Cesium.DrawHandler(objectManage.viewer, Cesium.DrawMode.Polygon); | 5 | this.handlerPolygon = new Cesium.DrawHandler(objectManage.viewer, Cesium.DrawMode.Polygon); |
6 | this.handlerPolygon.drawEvt.addEventListener(polygon => { | 6 | this.handlerPolygon.drawEvt.addEventListener(polygon => { |
7 | var array = [].concat(polygon.object.positions), positions = []; | 7 | var array = [].concat(polygon.object.positions); |
8 | for(var i = 0, len = array.length; i < len; i++){ | 8 | for(var i = 0, len = array.length; i < len; i++){ |
9 | var cartographic = Cesium.Cartographic.fromCartesian(array[i]); | 9 | var cartographic = Cesium.Cartographic.fromCartesian(array[i]); |
10 | var longitude = Cesium.Math.toDegrees(cartographic.longitude); | 10 | var longitude = Cesium.Math.toDegrees(cartographic.longitude); |
11 | var latitude = Cesium.Math.toDegrees(cartographic.latitude); | 11 | var latitude = Cesium.Math.toDegrees(cartographic.latitude); |
12 | var h=cartographic.height; | ||
13 | if(positions.indexOf(longitude)===-1&&positions.indexOf(latitude)===-1){ | ||
14 | positions.push(longitude); | ||
15 | positions.push(latitude); | ||
16 | positions.push(h); | ||
17 | this.positions2d.push(longitude); | 12 | this.positions2d.push(longitude); |
18 | this.positions2d.push(latitude); | 13 | this.positions2d.push(latitude); |
19 | this.positions2d.push(1000.0); | 14 | this.positions2d.push(cartographic.height); |
20 | } | ||
21 | } | 15 | } |
22 | }); | 16 | }); |
23 | } | 17 | } |
... | @@ -70,11 +64,19 @@ export default class flood { | ... | @@ -70,11 +64,19 @@ export default class flood { |
70 | } | 64 | } |
71 | }); | 65 | }); |
72 | } | 66 | } |
73 | floodParse(scene, positions2d, waterHeight, targetHeight) { | 67 | floodParse(waterHeight, targetHeight) { |
74 | var River1 = new Cesium.Primitive({ | 68 | !this.positions2d.length && (this.positions2d = [ |
69 | 116.44391163897568, 39.922128887755996, 10, | ||
70 | 116.47222524452756, 39.921663337343915, 10, | ||
71 | 116.47147655687662, 39.903608069115315, 10, | ||
72 | 116.44520545789665, 39.902556426686864, 10, | ||
73 | 116.44515353439972, 39.90683243165845, 10, | ||
74 | 116.4437677267605, 39.9069642145195, 10 | ||
75 | ]); | ||
76 | this.river = new Cesium.Primitive({ | ||
75 | geometryInstances : new Cesium.GeometryInstance({ | 77 | geometryInstances : new Cesium.GeometryInstance({ |
76 | geometry :new Cesium.PolygonGeometry({ | 78 | geometry :new Cesium.PolygonGeometry({ |
77 | polygonHierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(positions2d)), | 79 | polygonHierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(this.positions2d)), |
78 | extrudedHeight: targetHeight, | 80 | extrudedHeight: targetHeight, |
79 | height: waterHeight, | 81 | height: waterHeight, |
80 | vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT | 82 | vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT |
... | @@ -96,6 +98,10 @@ export default class flood { | ... | @@ -96,6 +98,10 @@ export default class flood { |
96 | }), | 98 | }), |
97 | show : true | 99 | show : true |
98 | }); | 100 | }); |
99 | scene.primitives.add(River1); | 101 | objectManage.viewer.scene.primitives.add(this.river); |
102 | } | ||
103 | remove() { | ||
104 | this.positions2d = []; | ||
105 | objectManage.viewer.scene.primitives.remove(this.river); | ||
100 | } | 106 | } |
101 | } | 107 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | import objectManage from './maputils'; | 1 | import objectManage from './maputils'; |
2 | export default class heightControl { | 2 | export default class heightControl { |
3 | constructor() { | 3 | constructor(opt) { |
4 | this.handlerPolygon = new Cesium.DrawHandler(objectManage.viewer, Cesium.DrawMode.Polygon); | 4 | this.handlerPolygon = new Cesium.DrawHandler(objectManage.viewer, Cesium.DrawMode.Polygon); |
5 | this.building = objectManage.viewer.scene.layers.find("build1"); | ||
6 | this.building1 = objectManage.viewer.scene.layers.find("build2"); | ||
7 | this.arr = []; | ||
8 | var i = 0; | ||
9 | while(i < 2000) this.arr.push(i++); | ||
5 | this.handlerPolygon.drawEvt.addEventListener(result => { | 10 | this.handlerPolygon.drawEvt.addEventListener(result => { |
6 | var array = [].concat(result.object.positions), positions = []; | 11 | var array = [].concat(result.object.positions), positions = []; |
7 | var polygon = result.object; | 12 | var polygon = result.object; |
... | @@ -17,16 +22,37 @@ export default class heightControl { | ... | @@ -17,16 +22,37 @@ export default class heightControl { |
17 | positions.push(latitude); | 22 | positions.push(latitude); |
18 | } | 23 | } |
19 | } | 24 | } |
25 | this.addPolygon(Object.assign(opt, {p: positions})); | ||
26 | this.splice(opt.h); | ||
27 | }); | ||
28 | } | ||
29 | addPolygon(opt) { | ||
20 | this.polygon = objectManage.viewer.entities.add({ | 30 | this.polygon = objectManage.viewer.entities.add({ |
21 | id: 'polygonA', | 31 | id: 'polygonA', |
22 | polygon: { | 32 | polygon: { |
23 | hierarchy: Cesium.Cartesian3.fromDegreesArray(positions), | 33 | hierarchy: Cesium.Cartesian3.fromDegreesArray(opt.p), |
24 | height: 105, | 34 | height: opt.h, |
25 | material: new Cesium.Color(1, 1, 0.20, 0.5), | 35 | material: new Cesium.Color(1, 1, 0.20, 0.5), |
26 | outline: true, | 36 | outline: true, |
27 | outlineColor: Cesium.Color.RED | 37 | outlineColor: Cesium.Color.RED |
28 | } | 38 | } |
29 | }).polygon; | 39 | }).polygon; |
40 | } | ||
41 | splice(h) { | ||
42 | this.building.clipLineColor = Cesium.Color.WHITE.withAlpha(0.0); | ||
43 | this.building1.setObjsColor(this.arr, Cesium.Color.DARKORANGE.withAlpha(0.5)); | ||
44 | this.building.setCustomClipBox({ | ||
45 | dimensions: new Cesium.Cartesian3(5000, 5000, h * 2), | ||
46 | position: Cesium.Cartesian3.fromDegrees(116.44391163897568, 39.922128887755996, h / h - 1), | ||
47 | clipMode: "clip_behind_any_plane" | ||
30 | }); | 48 | }); |
49 | this.building1.setCustomClipBox({ | ||
50 | dimensions: new Cesium.Cartesian3(5000, 5000, h * 2), | ||
51 | position: Cesium.Cartesian3.fromDegrees(116.44391163897568, 39.922128887755996, h / h - 1), | ||
52 | clipMode: "clip_behind_all_plane" | ||
53 | }); | ||
54 | } | ||
55 | remove() { | ||
56 | objectManage.viewer.entities.removeAll(); | ||
31 | } | 57 | } |
32 | } | 58 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | |||
2 | import objectManage from './maputils'; | 1 | import objectManage from './maputils'; |
3 | export default class viewpoint { | 2 | export default class viewpoint { |
4 | constructor() { | 3 | constructor() { |
... | @@ -39,4 +38,10 @@ export default class viewpoint { | ... | @@ -39,4 +38,10 @@ export default class viewpoint { |
39 | objectManage.viewer.scene.viewFlag = false; | 38 | objectManage.viewer.scene.viewFlag = false; |
40 | this.handlerPoint.activate(); | 39 | this.handlerPoint.activate(); |
41 | } | 40 | } |
41 | remove() { | ||
42 | this.sightline.destroy(); | ||
43 | this.sightline = new Cesium.Sightline(objectManage.viewer.scene); | ||
44 | this.sightline.couldRemove = false; | ||
45 | this.sightline.build(); | ||
46 | } | ||
42 | } | 47 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -64,7 +64,6 @@ export default class visual { | ... | @@ -64,7 +64,6 @@ export default class visual { |
64 | objectManage.viewer.scene.viewFlag = false; | 64 | objectManage.viewer.scene.viewFlag = false; |
65 | } | 65 | } |
66 | }); | 66 | }); |
67 | this.chooseView(); | ||
68 | } | 67 | } |
69 | chooseView() { | 68 | chooseView() { |
70 | if (this.pointHandler.active) return; | 69 | if (this.pointHandler.active) return; |
... | @@ -75,4 +74,8 @@ export default class visual { | ... | @@ -75,4 +74,8 @@ export default class visual { |
75 | //激活绘制点类 | 74 | //激活绘制点类 |
76 | this.pointHandler.activate(); | 75 | this.pointHandler.activate(); |
77 | } | 76 | } |
77 | remove() { | ||
78 | this.viewshed3D.destroy(); | ||
79 | this.viewshed3D = new Cesium.ViewShed3D(objectManage.viewer.scene); | ||
80 | } | ||
78 | } | 81 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -47,7 +47,7 @@ | ... | @@ -47,7 +47,7 @@ |
47 | } | 47 | } |
48 | }, | 48 | }, |
49 | mounted() { | 49 | mounted() { |
50 | this.viewpoint instanceof viewpoint || (this.viewpoint = new viewpoint(this.viewer)); | 50 | this.viewpoint instanceof viewpoint || (this.viewpoint = new viewpoint()); |
51 | }, | 51 | }, |
52 | methods: { | 52 | methods: { |
53 | closePop() { | 53 | closePop() { |
... | @@ -57,11 +57,10 @@ | ... | @@ -57,11 +57,10 @@ |
57 | 57 | ||
58 | }, | 58 | }, |
59 | startAnalysis() { | 59 | startAnalysis() { |
60 | // this.isAnalysis = true; | ||
61 | this.viewpoint.chooseView(); | 60 | this.viewpoint.chooseView(); |
62 | }, | 61 | }, |
63 | stopAnalysis() { | 62 | stopAnalysis() { |
64 | // this.isAnalysis = false; | 63 | this.viewpoint.remove(); |
65 | } | 64 | } |
66 | 65 | ||
67 | } | 66 | } | ... | ... |
... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
11 | <span @click="closePop" class="close">×</span> | 11 | <span @click="closePop" class="close">×</span> |
12 | </div> | 12 | </div> |
13 | <div class="" style="padding: 18px 24px 0px 24px;"> | 13 | <div class="" style="padding: 18px 24px 0px 24px;"> |
14 | <el-slider v-model="height" :min='0' :max='1000' :format-tooltip="formatTooltip" | 14 | <el-slider v-model="height" :min='1' :max='1000' :format-tooltip="formatTooltip" |
15 | @change='EheightChange'></el-slider> | 15 | @change='EheightChange'></el-slider> |
16 | </div> | 16 | </div> |
17 | <div class="func-btn"> | 17 | <div class="func-btn"> |
... | @@ -24,62 +24,40 @@ | ... | @@ -24,62 +24,40 @@ |
24 | <span>清除分析结果</span> | 24 | <span>清除分析结果</span> |
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | <div class="table-box" style="padding: 18px 24px 30px 24px;"> | ||
28 | <el-table :data="tableData" :highlight-current-row='false' height="242" border style="width: 100%"> | ||
29 | <el-table-column prop="name" label="名称" align='center'> | ||
30 | </el-table-column> | ||
31 | <el-table-column prop="height" label="高度(m)" align='center'> | ||
32 | </el-table-column> | ||
33 | <el-table-column prop="superelevation" label="超高度(m)" align='center'> | ||
34 | </el-table-column> | ||
35 | </el-table> | ||
36 | </div> | ||
37 | </div> | 27 | </div> |
38 | </div> | 28 | </div> |
39 | </template> | 29 | </template> |
40 | 30 | ||
41 | <script> | 31 | <script> |
32 | import heightControl from "../assets/js/map/heightControl"; | ||
42 | export default { | 33 | export default { |
43 | name: 'kgAnalusis', | 34 | name: 'kgAnalusis', |
44 | components: {}, | 35 | components: {}, |
45 | data() { | 36 | data() { |
46 | return { | 37 | return { |
47 | height: 320, | 38 | height: 100 |
48 | tableData: [{ | ||
49 | name: '1号楼', | ||
50 | height: '34', | ||
51 | superelevation: '4' | ||
52 | }, { | ||
53 | name: '1号楼', | ||
54 | height: '34', | ||
55 | superelevation: '4' | ||
56 | }, { | ||
57 | name: '1号楼', | ||
58 | height: '34', | ||
59 | superelevation: '4' | ||
60 | }, { | ||
61 | name: '1号楼', | ||
62 | height: '34', | ||
63 | superelevation: '4' | ||
64 | },] | ||
65 | } | 39 | } |
66 | }, | 40 | }, |
67 | mounted() {}, | 41 | mounted() { |
42 | this.heightControl instanceof heightControl || (this.heightControl = new heightControl({h: this.height})); | ||
43 | }, | ||
68 | methods: { | 44 | methods: { |
69 | closePop() { | 45 | closePop() { |
70 | this.$emit('closePop', 'kgAnalusis') | 46 | this.$emit('closePop', 'kgAnalusis') |
71 | }, | 47 | }, |
72 | startAnalysis() { | 48 | startAnalysis() { |
73 | 49 | this.heightControl.handlerPolygon.deactivate(); | |
50 | this.heightControl.handlerPolygon.activate(); | ||
74 | }, | 51 | }, |
75 | stopAnalysis() { | 52 | stopAnalysis() { |
76 | 53 | this.heightControl.remove(); | |
77 | }, | 54 | }, |
78 | formatTooltip(val) { | 55 | formatTooltip(val) { |
79 | return val + '米'; | 56 | return val + '米'; |
80 | }, | 57 | }, |
81 | EheightChange() { | 58 | EheightChange() { |
82 | 59 | this.heightControl.polygon.height = this.height; | |
60 | this.heightControl.splice(this.height); | ||
83 | } | 61 | } |
84 | } | 62 | } |
85 | } | 63 | } | ... | ... |
... | @@ -41,7 +41,6 @@ | ... | @@ -41,7 +41,6 @@ |
41 | </template> | 41 | </template> |
42 | 42 | ||
43 | <script> | 43 | <script> |
44 | import height from "../assets/js/map/heightControl"; | ||
45 | export default { | 44 | export default { |
46 | name: 'tjxAnslysis', | 45 | name: 'tjxAnslysis', |
47 | components: {}, | 46 | components: {}, |
... | @@ -51,18 +50,16 @@ | ... | @@ -51,18 +50,16 @@ |
51 | } | 50 | } |
52 | }, | 51 | }, |
53 | mounted() { | 52 | mounted() { |
54 | this.height instanceof height || (this.height = new height()); | ||
55 | }, | 53 | }, |
56 | methods: { | 54 | methods: { |
57 | closePop() { | 55 | closePop() { |
58 | this.$emit('closePop', 'tjxAnslysis') | 56 | this.$emit('closePop', 'tjxAnslysis') |
59 | }, | 57 | }, |
60 | startAnalysis() { | 58 | startAnalysis() { |
61 | this.height.handlerPolygon.deactivate(); | 59 | |
62 | this.height.handlerPolygon.activate(); | ||
63 | }, | 60 | }, |
64 | stopAnalysis() { | 61 | stopAnalysis() { |
65 | this.height.polygon.height = 50; | 62 | |
66 | }, | 63 | }, |
67 | } | 64 | } |
68 | } | 65 | } | ... | ... |
... | @@ -123,11 +123,12 @@ | ... | @@ -123,11 +123,12 @@ |
123 | closePop() { | 123 | closePop() { |
124 | this.$emit('closePop', 'visualField') | 124 | this.$emit('closePop', 'visualField') |
125 | }, | 125 | }, |
126 | handleChange() { | 126 | startAnalysis() { |
127 | 127 | this.visual.chooseView(); | |
128 | }, | ||
129 | stopAnalysis() { | ||
130 | this.visual.remove(); | ||
128 | }, | 131 | }, |
129 | startAnalysis() {}, | ||
130 | stopAnalysis() {}, | ||
131 | handleIsXmbj(flag) { | 132 | handleIsXmbj(flag) { |
132 | this.isXmbj = flag; | 133 | this.isXmbj = flag; |
133 | } | 134 | } | ... | ... |
... | @@ -69,7 +69,7 @@ | ... | @@ -69,7 +69,7 @@ |
69 | step: 0.01, | 69 | step: 0.01, |
70 | num: 1, | 70 | num: 1, |
71 | sdgc: '', // 水底高程 | 71 | sdgc: '', // 水底高程 |
72 | swsd: '', // 水位深度 | 72 | swsd: 50, // 水位深度 |
73 | ymsd: '', // 淹没速度 | 73 | ymsd: '', // 淹没速度 |
74 | isXmbj: true, | 74 | isXmbj: true, |
75 | // isAnalysis: true | 75 | // isAnalysis: true |
... | @@ -86,15 +86,11 @@ | ... | @@ -86,15 +86,11 @@ |
86 | 86 | ||
87 | }, | 87 | }, |
88 | startAnalysis() { | 88 | startAnalysis() { |
89 | // this.isAnalysis = true; | 89 | this.flood.floodParse(0, this.swsd); |
90 | let viewer = this.$parent.viewer; | ||
91 | this.flood.floodParse(viewer.scene, this.flood.positions2d, 0, 50); | ||
92 | this.flood.handlerPolygon.clear(); | 90 | this.flood.handlerPolygon.clear(); |
93 | }, | 91 | }, |
94 | stopAnalysis() { | 92 | stopAnalysis() { |
95 | // this.isAnalysis = false; | 93 | this.flood.remove(); |
96 | objectManage.viewer.entities.removeAll(); | ||
97 | // this.$parent.flood.handlerPolygon.clear(); | ||
98 | }, | 94 | }, |
99 | handleIsXmbj(flag) { | 95 | handleIsXmbj(flag) { |
100 | this.isXmbj = flag; | 96 | this.isXmbj = flag; | ... | ... |
... | @@ -218,20 +218,28 @@ | ... | @@ -218,20 +218,28 @@ |
218 | scene.hdrEnabled = false; | 218 | scene.hdrEnabled = false; |
219 | scene.sun.show = true; | 219 | scene.sun.show = true; |
220 | this.draw = new createDraw(this.viewer); | 220 | this.draw = new createDraw(this.viewer); |
221 | Cesium.when.all([ | 221 | |
222 | scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, { | 222 | var promise = []; |
223 | // promise[0] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, { | ||
224 | // name: 'ground' | ||
225 | // }); | ||
226 | promise[0] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, { | ||
227 | name: 'build1' | ||
228 | }); | ||
229 | promise[1] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, { | ||
230 | name: 'build2' | ||
231 | }); | ||
232 | promise[2] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, { | ||
223 | name: 'ground' | 233 | name: 'ground' |
224 | }), | 234 | }); |
225 | scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, { | 235 | |
226 | name: 'build' | 236 | Cesium.when.all(promise, layers => { |
227 | }) | ||
228 | ], layers => { | ||
229 | // this.layers = layer; | 237 | // this.layers = layer; |
230 | objectManage.viewer = this.viewer; | 238 | objectManage.viewer = this.viewer; |
231 | layers[0].selectEnabled = false; | 239 | // layers[0].selectEnabled = false; |
232 | layers[1].selectEnabled = false; | 240 | // layers[1].selectEnabled = false; |
233 | layers[0].shadowType = 2; | 241 | // layers[0].shadowType = 2; |
234 | layers[1].shadowType = 2; | 242 | // layers[1].shadowType = 2; |
235 | scene.camera.setView({ | 243 | scene.camera.setView({ |
236 | destination : Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196), | 244 | destination : Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196), |
237 | orientation : { | 245 | orientation : { | ... | ... |
-
Please register or sign in to post a comment