111111
Showing
10 changed files
with
75 additions
and
65 deletions
... | @@ -70,7 +70,7 @@ export default class flood { | ... | @@ -70,7 +70,7 @@ export default class flood { |
70 | } | 70 | } |
71 | }); | 71 | }); |
72 | } | 72 | } |
73 | floodParse(scene, positions2d, waterHeight, targetHeight) { | 73 | floodParse(positions2d, waterHeight, targetHeight) { |
74 | var River1 = new Cesium.Primitive({ | 74 | var River1 = new Cesium.Primitive({ |
75 | geometryInstances : new Cesium.GeometryInstance({ | 75 | geometryInstances : new Cesium.GeometryInstance({ |
76 | geometry :new Cesium.PolygonGeometry({ | 76 | geometry :new Cesium.PolygonGeometry({ |
... | @@ -96,6 +96,6 @@ export default class flood { | ... | @@ -96,6 +96,6 @@ export default class flood { |
96 | }), | 96 | }), |
97 | show : true | 97 | show : true |
98 | }); | 98 | }); |
99 | scene.primitives.add(River1); | 99 | objectManage.viewer.scene.primitives.add(River1); |
100 | } | 100 | } |
101 | } | 101 | } |
... | \ 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 | ... | ... |
... | @@ -2,6 +2,7 @@ | ... | @@ -2,6 +2,7 @@ |
2 | import objectManage from './maputils'; | 2 | import objectManage from './maputils'; |
3 | export default class viewpoint { | 3 | export default class viewpoint { |
4 | constructor() { | 4 | constructor() { |
5 | console.log(Cesium.Sightline); | ||
5 | this.sightline = new Cesium.Sightline(objectManage.viewer.scene); | 6 | this.sightline = new Cesium.Sightline(objectManage.viewer.scene); |
6 | this.sightline.couldRemove = false; | 7 | this.sightline.couldRemove = false; |
7 | this.sightline.build(); | 8 | this.sightline.build(); | ... | ... |
... | @@ -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() { | ... | ... |
... | @@ -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 | } | ... | ... |
... | @@ -86,15 +86,11 @@ | ... | @@ -86,15 +86,11 @@ |
86 | 86 | ||
87 | }, | 87 | }, |
88 | startAnalysis() { | 88 | startAnalysis() { |
89 | // this.isAnalysis = true; | 89 | this.flood.floodParse(this.flood.positions2d, 0, 50); |
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; | ||
96 | objectManage.viewer.entities.removeAll(); | 93 | 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; | ... | ... |
... | @@ -206,20 +206,28 @@ | ... | @@ -206,20 +206,28 @@ |
206 | scene.hdrEnabled = false; | 206 | scene.hdrEnabled = false; |
207 | scene.sun.show = true; | 207 | scene.sun.show = true; |
208 | this.draw = new createDraw(this.viewer); | 208 | this.draw = new createDraw(this.viewer); |
209 | Cesium.when.all([ | 209 | |
210 | scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, { | 210 | var promise = []; |
211 | // promise[0] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, { | ||
212 | // name: 'ground' | ||
213 | // }); | ||
214 | promise[0] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, { | ||
215 | name: 'build1' | ||
216 | }); | ||
217 | promise[1] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, { | ||
218 | name: 'build2' | ||
219 | }); | ||
220 | promise[2] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, { | ||
211 | name: 'ground' | 221 | name: 'ground' |
212 | }), | 222 | }); |
213 | scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, { | 223 | |
214 | name: 'build' | 224 | Cesium.when.all(promise, layers => { |
215 | }) | ||
216 | ], layers => { | ||
217 | // this.layers = layer; | 225 | // this.layers = layer; |
218 | objectManage.viewer = this.viewer; | 226 | objectManage.viewer = this.viewer; |
219 | layers[0].selectEnabled = false; | 227 | // layers[0].selectEnabled = false; |
220 | layers[1].selectEnabled = false; | 228 | // layers[1].selectEnabled = false; |
221 | layers[0].shadowType = 2; | 229 | // layers[0].shadowType = 2; |
222 | layers[1].shadowType = 2; | 230 | // layers[1].shadowType = 2; |
223 | scene.camera.setView({ | 231 | scene.camera.setView({ |
224 | destination : Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196), | 232 | destination : Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196), |
225 | orientation : { | 233 | orientation : { | ... | ... |
-
Please register or sign in to post a comment