111111
Showing
6 changed files
with
187 additions
and
236 deletions
... | @@ -6,9 +6,19 @@ | ... | @@ -6,9 +6,19 @@ |
6 | <meta name="viewport" content="width=device-width,initial-scale=1.0"> | 6 | <meta name="viewport" content="width=device-width,initial-scale=1.0"> |
7 | <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | 7 | <link rel="icon" href="<%= BASE_URL %>favicon.ico"> |
8 | <title><%= htmlWebpackPlugin.options.title %></title> | 8 | <title><%= htmlWebpackPlugin.options.title %></title> |
9 | <script src="https://cesium.com/downloads/cesiumjs/releases/1.71/Build/Cesium/Cesium.js"></script> | 9 | <!-- <script src="https://cesium.com/downloads/cesiumjs/releases/1.71/Build/Cesium/Cesium.js"></script> |
10 | <link href="https://cesium.com/downloads/cesiumjs/releases/1.71/Build/Cesium/Widgets/widgets.css" | 10 | <link href="https://cesium.com/downloads/cesiumjs/releases/1.71/Build/Cesium/Widgets/widgets.css" rel="stylesheet"> --> |
11 | rel="stylesheet"> | 11 | <link href="./Build/Cesium/Widgets/widgets.css" rel="stylesheet"> |
12 | <!-- <link href="./css/bootstrap.min.css" rel="stylesheet"> --> | ||
13 | <link href="./css/pretty.css" rel="stylesheet"> | ||
14 | <script type="text/javascript" src="./Build/Cesium/Cesium.js" data-main="js/main"></script> | ||
15 | <script type="text/javascript" src="./Build//Cesium/Widgets/CesiumNavigation/viewerCesiumNavigationMixin.js"></script> | ||
16 | <script type="text/javascript" src="./Build/Cesium/Workers/zlib.min.js" data-main="js/main"></script> | ||
17 | <script type="text/javascript" src="./js/jquery.min.js" data-main="js/main"></script> | ||
18 | <!-- <script src="./js/bootstrap.min.js"></script> --> | ||
19 | <script src="./js/spectrum.js"></script> | ||
20 | <script type="text/javascript" src="./js/supermap/SuperMap.Include.js"></script> | ||
21 | <script type="text/javascript" src="./js/require.min.js" data-main="js/main"></script> | ||
12 | </head> | 22 | </head> |
13 | <body> | 23 | <body> |
14 | <noscript> | 24 | <noscript> | ... | ... |
1 | export default | 1 | export default |
2 | class Roller { | 2 | class Roller { |
3 | constructor(obj) { | 3 | constructor(viewer) { |
4 | this.imageryLayers = obj.imageryLayers; | 4 | let body = $('body'); |
5 | this.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ | 5 | this.initRollerShutter(viewer, { |
6 | url: obj.url, | 6 | splitDirection: new Cesium.Cartesian2(Cesium.ImagerySplitDirection.LEFT, Cesium.ImagerySplitDirection.NONE), // 初始时屏蔽左侧 |
7 | layer: "tdtBasicLayer", | 7 | verticalSplitPosition: body.width() / 2, |
8 | style: "default", | 8 | horizontalSplitPosition: body.height() / 2, |
9 | format: "image/jpeg", | 9 | imageryLayers: [viewer.imageryLayers.addImageryProvider(new Cesium.BingMapsImageryProvider({ |
10 | tileMatrixSetID: "GoogleMapsCompatible", | 10 | key : 'AqYgyS1gIIDGsxmOlncqrgA83cHnhClLwZmIJXbYXX36pfxKYtUGk12Q3splaf4Y', |
11 | show: false | 11 | url : '//dev.virtualearth.net' |
12 | })).splitDirection = Cesium.ImagerySplitDirection.LEFT; | 12 | }))], // 参与卷帘的影像图层数组 |
13 | } | 13 | latestSplitDirection: null // 用于在禁用卷帘后恢复之前的卷帘方向 |
14 | screen(opt) { | 14 | }); |
15 | var slider = opt.slider, handler = new Cesium.ScreenSpaceEventHandler(slider), moveActive = false; | 15 | } |
16 | function move(movement) { | 16 | initRollerShutter(a, b) { |
17 | if (!moveActive) return; | 17 | this.setRollerShutterSplit(a, b); |
18 | var relativeOffset = movement.endPosition.x; | 18 | this.bindSliderEvt(a, b); |
19 | var splitPosition = | 19 | } |
20 | (slider.offsetLeft + relativeOffset) / | 20 | setRollerShutterSplit(viewer, rollerShutterConfig) { |
21 | slider.parentElement.offsetWidth; | 21 | let splitPosition = null, imageryLayer, body = $("body"); |
22 | slider.style.left = 100.0 * splitPosition + "%"; | 22 | if (rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.LEFT, Cesium.ImagerySplitDirection.NONE)) || rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.RIGHT, Cesium.ImagerySplitDirection.NONE))) { |
23 | opt.viewer.scene.imagerySplitPosition = splitPosition; | 23 | splitPosition = rollerShutterConfig.verticalSplitPosition; |
24 | } | 24 | } else if (rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.NONE, Cesium.ImagerySplitDirection.TOP)) || rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.NONE, Cesium.ImagerySplitDirection.BOTTOM))) { |
25 | 25 | splitPosition = rollerShutterConfig.horizontalSplitPosition; | |
26 | handler.setInputAction(function () { | 26 | } |
27 | moveActive = true; | 27 | for (imageryLayer of rollerShutterConfig.imageryLayers) { |
28 | }, Cesium.ScreenSpaceEventType.LEFT_DOWN); | 28 | imageryLayer.splitDirection = rollerShutterConfig.splitDirection; |
29 | handler.setInputAction(function () { | 29 | } |
30 | moveActive = true; | 30 | if (splitPosition) { // 如果禁用卷帘就没有必要设置分割位置 |
31 | }, Cesium.ScreenSpaceEventType.PINCH_START); | 31 | if (rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.LEFT, Cesium.ImagerySplitDirection.NONE)) || rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.RIGHT, Cesium.ImagerySplitDirection.NONE))) { |
32 | 32 | viewer.scene.imagerySplitPosition.x = splitPosition / body.width(); | |
33 | handler.setInputAction(move, Cesium.ScreenSpaceEventType.MOUSE_MOVE); | 33 | } else if (rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.NONE, Cesium.ImagerySplitDirection.TOP)) || |
34 | handler.setInputAction(move, Cesium.ScreenSpaceEventType.PINCH_MOVE); | 34 | rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.NONE, Cesium.ImagerySplitDirection.BOTTOM))) { |
35 | 35 | viewer.scene.imagerySplitPosition.y = splitPosition / body.height(); | |
36 | handler.setInputAction(function () { | 36 | } |
37 | moveActive = false; | 37 | } |
38 | }, Cesium.ScreenSpaceEventType.LEFT_UP); | 38 | } |
39 | handler.setInputAction(function () { | 39 | bindSliderEvt(viewer, rollerShutterConfig) { |
40 | moveActive = false; | 40 | let verticalSlider = document.getElementById('vertical-slider'); // 垂直分割条 |
41 | }, Cesium.ScreenSpaceEventType.PINCH_END); | 41 | let horizontalSlider = document.getElementById('horizontal-slider'); // 水平分割条 |
42 | verticalSlider.addEventListener('mousedown', mouseDown, false); | ||
43 | horizontalSlider.addEventListener('mousedown', mouseDown, false); | ||
44 | let windowHeight = $('body').height(); | ||
45 | let sliderMove = e => { // 鼠标拖拽时执行 | ||
46 | // 解决拖拽鼠标粘滞的问题 | ||
47 | if (e.preventDefault) { | ||
48 | e.preventDefault(); | ||
49 | } else { | ||
50 | e.returnValue = false; | ||
51 | } | ||
52 | if (rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.LEFT, Cesium.ImagerySplitDirection.NONE)) || rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.RIGHT, Cesium.ImagerySplitDirection.NONE))) { | ||
53 | verticalSlider.style.left = e.clientX + 'px'; | ||
54 | rollerShutterConfig.verticalSplitPosition = e.clientX; | ||
55 | } else if (rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.NONE, Cesium.ImagerySplitDirection.TOP)) || rollerShutterConfig.splitDirection.equals(new Cesium.Cartesian2(Cesium.ImagerySplitDirection.NONE, Cesium.ImagerySplitDirection.BOTTOM))) { | ||
56 | let clientY = e.clientY; | ||
57 | if (clientY < 0) { | ||
58 | clientY = 0; | ||
59 | } else if (clientY > windowHeight) { | ||
60 | clientY = windowHeight - $('#horizontal-slider').height(); | ||
61 | } | ||
62 | horizontalSlider.style.top = clientY + 'px'; | ||
63 | rollerShutterConfig.horizontalSplitPosition = windowHeight - clientY; | ||
64 | } | ||
65 | this.setRollerShutterSplit(viewer, rollerShutterConfig); | ||
66 | } | ||
67 | document.addEventListener('mouseup', mouseUp, false); | ||
68 | function mouseUp(e) { | ||
69 | document.removeEventListener('mousemove', sliderMove, false); | ||
70 | } | ||
71 | function mouseDown(e) { | ||
72 | document.addEventListener('mousemove', sliderMove, false); | ||
73 | } | ||
42 | } | 74 | } |
43 | } | 75 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -55,6 +55,7 @@ | ... | @@ -55,6 +55,7 @@ |
55 | }, | 55 | }, |
56 | startAnalysis() { | 56 | startAnalysis() { |
57 | // this.isAnalysis = true; | 57 | // this.isAnalysis = true; |
58 | this.$parent.viewpoint.chooseView(); | ||
58 | }, | 59 | }, |
59 | stopAnalysis() { | 60 | stopAnalysis() { |
60 | // this.isAnalysis = false; | 61 | // this.isAnalysis = false; | ... | ... |
... | @@ -74,8 +74,6 @@ | ... | @@ -74,8 +74,6 @@ |
74 | sdgc: '', // 水底高程 | 74 | sdgc: '', // 水底高程 |
75 | swsd: '', // 水位深度 | 75 | swsd: '', // 水位深度 |
76 | ymsd: '', // 淹没速度 | 76 | ymsd: '', // 淹没速度 |
77 | |||
78 | |||
79 | isXmbj: true, | 77 | isXmbj: true, |
80 | // isAnalysis: true | 78 | // isAnalysis: true |
81 | } | 79 | } |
... | @@ -90,12 +88,19 @@ | ... | @@ -90,12 +88,19 @@ |
90 | }, | 88 | }, |
91 | startAnalysis() { | 89 | startAnalysis() { |
92 | // this.isAnalysis = true; | 90 | // this.isAnalysis = true; |
91 | let viewer = this.$parent.viewer; | ||
92 | this.$parent.flood.floodParse(viewer.scene, this.$parent.flood.positions2d, 0, 50); | ||
93 | this.$parent.flood.handlerPolygon.clear(); | ||
93 | }, | 94 | }, |
94 | stopAnalysis() { | 95 | stopAnalysis() { |
95 | // this.isAnalysis = false; | 96 | // this.isAnalysis = false; |
97 | this.$parent.viewer.entities.removeAll(); | ||
98 | // this.$parent.flood.handlerPolygon.clear(); | ||
96 | }, | 99 | }, |
97 | handleIsXmbj(flag) { | 100 | handleIsXmbj(flag) { |
98 | this.isXmbj = flag; | 101 | this.isXmbj = flag; |
102 | this.$parent.flood.handlerPolygon.deactivate(); | ||
103 | !flag && this.$parent.flood.handlerPolygon.activate(); | ||
99 | } | 104 | } |
100 | } | 105 | } |
101 | } | 106 | } | ... | ... |
... | @@ -19,24 +19,6 @@ | ... | @@ -19,24 +19,6 @@ |
19 | </div> | 19 | </div> |
20 | 20 | ||
21 | <div class="func-input"> | 21 | <div class="func-input"> |
22 | <div class="btn-wrapper2" :class="[isCF?'add-bg2': '']" @click="handleIsXmbj('isCF')"> | ||
23 | <span class="center">春分</span> | ||
24 | </div> | ||
25 | <div class="btn-wrapper2" :class="[isXZ?'add-bg2': '']" @click="handleIsXmbj('isXZ')"> | ||
26 | <span class="center">夏至</span> | ||
27 | </div> | ||
28 | <div class="btn-wrapper2" :class="[isQF?'add-bg2': '']" @click="handleIsXmbj('isQF')"> | ||
29 | <span class="center">秋分</span> | ||
30 | </div> | ||
31 | <div class="btn-wrapper2" :class="[isLD?'add-bg2': '']" @click="handleIsXmbj('isLD')"> | ||
32 | <span class="center">立冬</span> | ||
33 | </div> | ||
34 | <div class="btn-wrapper2" :class="[isDZ?'add-bg2': '']" @click="handleIsXmbj('isDZ')"> | ||
35 | <span class="center">冬至</span> | ||
36 | </div> | ||
37 | </div> | ||
38 | |||
39 | <div class="func-input"> | ||
40 | <span>时间间隔 </span> | 22 | <span>时间间隔 </span> |
41 | <el-input-number v-model="timeS" controls-position="right" :min="0" :max="1000" | 23 | <el-input-number v-model="timeS" controls-position="right" :min="0" :max="1000" |
42 | style="margin:0 12px; width: 245px;"></el-input-number> | 24 | style="margin:0 12px; width: 245px;"></el-input-number> |
... | @@ -63,6 +45,7 @@ | ... | @@ -63,6 +45,7 @@ |
63 | </template> | 45 | </template> |
64 | 46 | ||
65 | <script> | 47 | <script> |
48 | import shadow from "../assets/js/map/shadow"; | ||
66 | let maxW = 24 * 60 * 60 * 1000 - 1 * 60 * 1000 | 49 | let maxW = 24 * 60 * 60 * 1000 - 1 * 60 * 1000 |
67 | export default { | 50 | export default { |
68 | name: 'yyAnslysis', | 51 | name: 'yyAnslysis', |
... | @@ -92,13 +75,15 @@ | ... | @@ -92,13 +75,15 @@ |
92 | } | 75 | } |
93 | } | 76 | } |
94 | }, | 77 | }, |
95 | mounted() {}, | 78 | mounted() { |
79 | this.shadow instanceof shadow || (this.shadow = new shadow()); | ||
80 | }, | ||
96 | methods: { | 81 | methods: { |
97 | closePop() { | 82 | closePop() { |
98 | this.$emit('closePop', 'yyAnslysis') | 83 | this.$emit('closePop', 'yyAnslysis') |
99 | }, | 84 | }, |
100 | startAnalysis() { | 85 | startAnalysis() { |
101 | 86 | console.log(this.shadow); | |
102 | }, | 87 | }, |
103 | stopAnalysis() { | 88 | stopAnalysis() { |
104 | 89 | ... | ... |
... | @@ -52,12 +52,12 @@ | ... | @@ -52,12 +52,12 @@ |
52 | <div class="bottomNav"> | 52 | <div class="bottomNav"> |
53 | <bottomNav></bottomNav> | 53 | <bottomNav></bottomNav> |
54 | </div> | 54 | </div> |
55 | <div class="leftAssert"> | 55 | <!-- <div class="leftAssert"> |
56 | <leftAssert @EFadb='EFadb' @EKgfz='EKgfz' @EGzfx='EGzfx'></leftAssert> | 56 | <leftAssert @EFadb='EFadb' @EKgfz='EKgfz' @EGzfx='EGzfx'></leftAssert> |
57 | </div> | 57 | </div> --> |
58 | <div class="mapPop"> | 58 | <!-- <div class="mapPop"> |
59 | <mapPop></mapPop> | 59 | <mapPop></mapPop> |
60 | </div> | 60 | </div> --> |
61 | <div class="allSee" v-if='allSee'> | 61 | <div class="allSee" v-if='allSee'> |
62 | <allSee @closePop='closePop'></allSee> | 62 | <allSee @closePop='closePop'></allSee> |
63 | </div> | 63 | </div> |
... | @@ -81,26 +81,53 @@ | ... | @@ -81,26 +81,53 @@ |
81 | <kgAnalusis @closePop='closePop'></kgAnalusis> | 81 | <kgAnalusis @closePop='closePop'></kgAnalusis> |
82 | </div> | 82 | </div> |
83 | 83 | ||
84 | |||
85 | <div id="cesiumContainer" style="width:100%;height:100%;"></div> | ||
86 | <div id="cesiumContainer"> | 84 | <div id="cesiumContainer"> |
87 | <div class="" ref="slider"></div> | 85 | <div id="vertical-slider" style="display: none;"></div> |
86 | <div id="horizontal-slider" style="display: none;"></div> | ||
87 | </div> | ||
88 | <!-- <div id="split_up" style="display: none;"></div> | ||
89 | <div id="split_bottom" style="display: none;"></div> | ||
90 | <div id="split_left" style="display: none;"></div> | ||
91 | <div id="split_right" style="display: none;"></div> --> | ||
92 | <!-- <div id="loadingbar" class="spinner"> | ||
93 | <div class="spinner-container container1"> | ||
94 | <div class="circle1"></div> | ||
95 | <div class="circle2"></div> | ||
96 | <div class="circle3"></div> | ||
97 | <div class="circle4"></div> | ||
98 | </div> | ||
99 | <div class="spinner-container container2"> | ||
100 | <div class="circle1"></div> | ||
101 | <div class="circle2"></div> | ||
102 | <div class="circle3"></div> | ||
103 | <div class="circle4"></div> | ||
88 | </div> | 104 | </div> |
105 | <div class="spinner-container container3"> | ||
106 | <div class="circle1"></div> | ||
107 | <div class="circle2"></div> | ||
108 | <div class="circle3"></div> | ||
109 | <div class="circle4"></div> | ||
110 | </div> | ||
111 | </div> --> | ||
112 | |||
89 | </div> | 113 | </div> |
90 | </template> | 114 | </template> |
91 | <script> | 115 | <script> |
92 | 116 | ||
93 | import measureTools from "../assets/js/map/MeasureTools"; | 117 | import objectManage from '../assets/js/map/maputils'; |
94 | import drawTool from "../assets/js/map/drawTool"; | 118 | import createDraw from '../assets/js/map/createDraw'; |
95 | import roller from "../assets/js/map/roller"; | 119 | import roller from "../assets/js/map/roller"; |
96 | import addCompany from '../assets/js/map/addCompany'; | 120 | import flood from "../assets/js/map/flood"; |
121 | import viewpoint from "../assets/js/map/viewpoint"; | ||
122 | import visual from "../assets/js/map/visual"; | ||
123 | |||
97 | 124 | ||
98 | import TopTitle from '../components/topTitle'; | 125 | import TopTitle from '../components/topTitle'; |
99 | import rightTopFunc from '../components/rightTopFunc'; | 126 | import rightTopFunc from '../components/rightTopFunc'; |
100 | import rightFunc from '../components/rightFunc'; | 127 | import rightFunc from '../components/rightFunc'; |
101 | import bottomNav from '../components/bottomNav'; | 128 | import bottomNav from '../components/bottomNav'; |
102 | import leftAssert from '../components/leftAssert'; | 129 | // import leftAssert from '../components/leftAssert'; |
103 | import mapPop from '../components/mapPop'; | 130 | // import mapPop from '../components/mapPop'; |
104 | 131 | ||
105 | import allSee from '../components/allSee'; //通视 | 132 | import allSee from '../components/allSee'; //通视 |
106 | import ymAnslysis from '../components/ymAnslysis'; //淹没分析 | 133 | import ymAnslysis from '../components/ymAnslysis'; //淹没分析 |
... | @@ -108,6 +135,8 @@ | ... | @@ -108,6 +135,8 @@ |
108 | import tjxAnslysis from '../components/tjxAnslysis'; // 天际线分析 | 135 | import tjxAnslysis from '../components/tjxAnslysis'; // 天际线分析 |
109 | import yyAnslysis from '../components/yyAnslysis'; // 阴影分析 | 136 | import yyAnslysis from '../components/yyAnslysis'; // 阴影分析 |
110 | import kgAnalusis from '../components/kgAnalusis'; // 控高分析 | 137 | import kgAnalusis from '../components/kgAnalusis'; // 控高分析 |
138 | import URL_CONFIG from "./../config/urlConfig.vue"; | ||
139 | const Cesium = window.Cesium; | ||
111 | 140 | ||
112 | export default { | 141 | export default { |
113 | components: { | 142 | components: { |
... | @@ -115,8 +144,8 @@ | ... | @@ -115,8 +144,8 @@ |
115 | rightTopFunc, | 144 | rightTopFunc, |
116 | rightFunc, | 145 | rightFunc, |
117 | bottomNav, | 146 | bottomNav, |
118 | leftAssert, | 147 | // leftAssert, |
119 | mapPop, | 148 | // mapPop, |
120 | 149 | ||
121 | allSee, | 150 | allSee, |
122 | ymAnslysis, | 151 | ymAnslysis, |
... | @@ -128,10 +157,7 @@ | ... | @@ -128,10 +157,7 @@ |
128 | data() { | 157 | data() { |
129 | return { | 158 | return { |
130 | viewer: undefined, | 159 | viewer: undefined, |
131 | entity: undefined, | 160 | isRoller: false, |
132 | devTypes: ['point', 'polyline', 'polygon'], | ||
133 | roll: {r: undefined, b: false}, | ||
134 | |||
135 | isReturn: false, // 复位 | 161 | isReturn: false, // 复位 |
136 | enlarge: false, // 放大 | 162 | enlarge: false, // 放大 |
137 | narrow: false, // 缩小 | 163 | narrow: false, // 缩小 |
... | @@ -157,54 +183,42 @@ | ... | @@ -157,54 +183,42 @@ |
157 | } | 183 | } |
158 | }, | 184 | }, |
159 | mounted() { | 185 | mounted() { |
160 | // ***********************************初始化地图******************************************** | 186 | this.viewer = new Cesium.Viewer('cesiumContainer'); |
161 | Cesium.Ion.defaultAccessToken = this.config.mapToken; | 187 | // this.viewer.imageryLayers.addImageryProvider(new Cesium.TiandituImageryProvider({ |
162 | this.viewer = new Cesium.Viewer('cesiumContainer', { | 188 | // credit : new Cesium.Credit('天地图全球影像服务'), |
163 | geocoder: false, | 189 | // token: URL_CONFIG.TOKEN_TIANDITU |
164 | homeButton: false, | 190 | // })); |
165 | sceneModePicker: false, | 191 | let scene = this.viewer.scene |
166 | fullscreenButton: false, | 192 | scene.shadowMap.darkness = 1.275; //设置第二重烘焙纹理的效果(明暗程度) |
167 | vrButton: false, | 193 | scene.skyAtmosphere.brightnessShift=0.4; |
168 | baseLayerPicker: true, | 194 | scene.debugShowFramesPerSecond = true; |
169 | infoBox: false, | 195 | scene.hdrEnabled = false; |
170 | selectionIndicator: false, | 196 | scene.sun.show = false; |
171 | animation: false, | 197 | this.draw = new createDraw(this.viewer); |
172 | timeline: false, | 198 | Cesium.when.all([ |
173 | shouldAnimate: true, | 199 | scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, { |
174 | navigationHelpButton: false, | 200 | name: 'ground' |
175 | navigationInstructionsInitiallyVisible: false, | 201 | }), |
176 | imageryProvider: new Cesium.UrlTemplateImageryProvider({ | 202 | scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, { |
177 | url: 'https://mt1.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali' | 203 | name: 'build' |
178 | }) | 204 | }) |
205 | ], layer => { | ||
206 | // this.layers = layer; | ||
207 | objectManage.viewer = this.viewer; | ||
208 | scene.camera.setView({ | ||
209 | destination : Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196), | ||
210 | orientation : { | ||
211 | heading : 0.41348036210986194, | ||
212 | pitch : -0.13636490404291735, | ||
213 | roll : 6.283185307179563 | ||
214 | } | ||
179 | }); | 215 | }); |
180 | 216 | }, function(e){ | |
181 | // ***********************************倾斜摄影加载******************************************** | 217 | if (widget._showRenderLoopErrors) { |
182 | let tileset = new Cesium.Cesium3DTileset({ | 218 | var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?'; |
183 | url : 'http://localhost:9000/model/e44fe150d09b11eaabec1d24e8548b3a/tileset.json', | 219 | widget.showErrorPanel(title, undefined, e); |
184 | skipLevelOfDetail : true, | 220 | } |
185 | baseScreenSpaceError : 1024, | ||
186 | skipScreenSpaceErrorFactor : 16, | ||
187 | skipLevels : 1, | ||
188 | immediatelyLoadDesiredLevelOfDetail : false, | ||
189 | loadSiblings : false, | ||
190 | cullWithChildrenBounds : true | ||
191 | }), height = -2440; | ||
192 | |||
193 | this.viewer.scene.primitives.add(tileset); | ||
194 | tileset.readyPromise.then(argument => { | ||
195 | var cartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center); | ||
196 | var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height); | ||
197 | var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height + height); | ||
198 | var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3()); | ||
199 | tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation); | ||
200 | setTimeout(() => { this.viewer.flyTo(tileset) }, 2000); | ||
201 | }); | 221 | }); |
202 | |||
203 | // ********************************Draw******************************************** | ||
204 | this.draw = new drawTool.drawTool({ | ||
205 | viewer: this.viewer, | ||
206 | hasEdit: true, | ||
207 | }) | ||
208 | }, | 222 | }, |
209 | methods: { | 223 | methods: { |
210 | searchRoat(val) { | 224 | searchRoat(val) { |
... | @@ -255,131 +269,33 @@ | ... | @@ -255,131 +269,33 @@ |
255 | } | 269 | } |
256 | // 距离 | 270 | // 距离 |
257 | ,Edistance(val) { | 271 | ,Edistance(val) { |
258 | new measureTools.measureTools(this.viewer).measurePolyLine(); | 272 | this.draw.handlerDis.activate(); |
259 | } | 273 | } |
260 | // 面积 | 274 | // 面积 |
261 | ,Earea(val) { | 275 | ,Earea(val) { |
262 | new measureTools.measureTools(this.viewer).measurePolygon(); | 276 | this.draw.handlerArea.activate(); |
263 | } | 277 | } |
264 | // 标记 | 278 | // 标记 |
265 | ,Emarker(val) { | 279 | ,Emarker(val) { |
266 | // this.draw.type.point || (this.draw.type.point = new tool.attributes.point({viewer: this.viewer})); | 280 | this.draw.handlerHeight.activate(); |
267 | // this.draw.create('point'); | ||
268 | this.draw.startDraw({ | ||
269 | type: "polyline", | ||
270 | style: { | ||
271 | material: Cesium.Color.YELLOW, | ||
272 | clampToGround: true | ||
273 | } | ||
274 | }); | ||
275 | } | 281 | } |
276 | // 卷帘 | 282 | // 卷帘 |
277 | ,ErollerShutter() { | 283 | ,ErollerShutter() { |
278 | this.roll.r || (this.roll.r = new roller({ | 284 | let slider = document.getElementById('vertical-slider'); |
279 | imageryLayers: this.viewer.imageryLayers, | 285 | slider.style.display = (this.isRoller = !this.isRoller) ? 'block' : 'none'; |
280 | url: 'http://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=ebf64362215c081f8317203220f133eb' | 286 | this.roller instanceof roller || (this.roller = new roller(this.viewer)); |
281 | })).screen({ | 287 | } |
282 | slider: this.$refs.slider, | 288 | ,EsplitScreen() { |
283 | viewer: this.viewer | 289 | // VERTICAL HORIZONTAL |
284 | }) | 290 | this.viewer.scene.multiViewportMode = Cesium.MultiViewportMode.HORIZONTAL; |
285 | this.$refs.slider.className = (this.roll.b = !this.roll.b) ? 'slider' : ''; | ||
286 | this.viewer.scene.imagerySplitPosition = this.roll.b && this.$refs.slider.offsetLeft / this.$refs.slider.parentElement.offsetWidth | ||
287 | } | 291 | } |
288 | // 分屏 | ||
289 | ,EsplitScreen() {} | ||
290 | // 指北 | 292 | // 指北 |
291 | ,EtoNorth() {} | 293 | ,EtoNorth() {} |
292 | // 顶视 | 294 | // 顶视 |
293 | ,EtopSee() {} | 295 | ,EtopSee() {} |
294 | // 环视 | 296 | // 环视 |
295 | ,EroundSee() { | 297 | ,EroundSee() { |
296 | // var parentEntity = this.viewer.entities.add(new Cesium.Entity()), positions = [], cartesian, polyline; | 298 | // this.visual instanceof visual || (this.visual = new visual(this.viewer)); |
297 | // this.handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas) | ||
298 | // this.handler.setInputAction(evt => { | ||
299 | |||
300 | // cartesian = this.viewer.scene.pickPosition(evt.position); | ||
301 | // // cartesian = this.draw.getCatesian3FromPX(evt.position, this.viewer, []); | ||
302 | // positions.push(cartesian.clone()); | ||
303 | // // addCompany.createPoint.call(this, {position: cartesian}) | ||
304 | |||
305 | // if(positions.length === 1) { | ||
306 | // this.handler.setInputAction(moveEvent => { | ||
307 | // positions[1] = this.viewer.scene.pickPosition(moveEvent.endPosition); | ||
308 | // // positions[1] = this.draw.getCatesian3FromPX(moveEvent.endPosition, this.viewer, []); | ||
309 | // !polyline && (polyline = addCompany.createPolyline.call(this, positions)); | ||
310 | // }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); | ||
311 | // return; | ||
312 | // } | ||
313 | |||
314 | |||
315 | // this.handler.destroy(); | ||
316 | // // console.log(Cesium.Cartesian3.distance(positions[0], positions[1])); | ||
317 | // // var cartesian = this.draw.getCatesian3FromPX(evt.position, this.viewer, []); | ||
318 | // var viewPointEntity = this.viewer.entities.add({ | ||
319 | // parent: parentEntity, | ||
320 | // position: positions[0], | ||
321 | // ellipsoid: { | ||
322 | // radii: new Cesium.Cartesian3(5, 5, 5), | ||
323 | // material: Cesium.Color.GREEN | ||
324 | // } | ||
325 | // }); | ||
326 | // // // 世界坐标转换为投影坐标 | ||
327 | // var webMercatorProjection = new Cesium.WebMercatorProjection(this.viewer.scene.globe.ellipsoid); | ||
328 | // var viewPointWebMercator = webMercatorProjection.project(Cesium.Cartographic.fromCartesian(positions[0])); | ||
329 | // // // 排除碰撞监测的对象 | ||
330 | // var objectsToExclude = [viewPointEntity]; | ||
331 | |||
332 | // // 目标点集合 | ||
333 | // var destPoints = []; | ||
334 | // // 视域点和目标点的距离 | ||
335 | // var radius = Cesium.Cartesian3.distance(positions[0], positions[1]); // 视距1000米 | ||
336 | // // 计算一圈 | ||
337 | // for (var i = 0; i <= 30; i++) { | ||
338 | // // 度数转弧度 | ||
339 | // var radians = Cesium.Math.toRadians(i); | ||
340 | // // 计算目标点 | ||
341 | // var toPoint = new Cesium.Cartesian3(viewPointWebMercator.x + radius * Math.cos(radians), viewPointWebMercator.y + radius * Math.sin(radians), 10); | ||
342 | // // 投影坐标转世界坐标 | ||
343 | // toPoint = webMercatorProjection.unproject(toPoint); | ||
344 | // destPoints.push(Cesium.Cartographic.toCartesian(toPoint.clone())); | ||
345 | // } | ||
346 | // let viewer = this.viewer; | ||
347 | // // 绘制线 | ||
348 | // function drawLine(leftPoint, secPoint, color) { | ||
349 | // viewer.entities.add({ | ||
350 | // polyline: { | ||
351 | // positions: [leftPoint, secPoint], | ||
352 | // arcType: Cesium.ArcType.NONE, | ||
353 | // width: 5, | ||
354 | // material: color, | ||
355 | // depthFailMaterial: color | ||
356 | // } | ||
357 | // }) | ||
358 | // } | ||
359 | // pickFromRay.call(this); | ||
360 | // function pickFromRay() { | ||
361 | // for (var i = 0; i < destPoints.length; i++) { | ||
362 | // // 计算射线的方向,目标点left 视域点right | ||
363 | // var direction = Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(destPoints[i], positions[0], new Cesium.Cartesian3()), new Cesium.Cartesian3()); | ||
364 | // console.log(direction); | ||
365 | // // 建立射线 | ||
366 | // var ray = new Cesium.Ray(positions[0], direction); | ||
367 | // var result = viewer.scene.pickFromRay(ray, objectsToExclude); // 计算交互点,返回第一个 | ||
368 | // showIntersection(result, destPoints[i], positions[0]); | ||
369 | // } | ||
370 | // } | ||
371 | // // 处理交互点 | ||
372 | // function showIntersection(result, destPoint, cartesian) { | ||
373 | // // 如果是场景模型的交互点,排除交互点是地球表面 | ||
374 | // if (Cesium.defined(result) && Cesium.defined(result.object)) { | ||
375 | // drawLine(result.position, cartesian, Cesium.Color.GREEN); // 可视区域 | ||
376 | // drawLine(result.position, destPoint, Cesium.Color.RED); // 不可视区域 | ||
377 | // } else { | ||
378 | // drawLine(cartesian, destPoint, Cesium.Color.GREEN); | ||
379 | // } | ||
380 | // } | ||
381 | // this.handler.destroy(); | ||
382 | // }, Cesium.ScreenSpaceEventType.LEFT_CLICK); | ||
383 | } | 299 | } |
384 | // 视域 | 300 | // 视域 |
385 | ,Ehorizon(val) { | 301 | ,Ehorizon(val) { |
... | @@ -390,11 +306,13 @@ | ... | @@ -390,11 +306,13 @@ |
390 | ,EallSee(val) { | 306 | ,EallSee(val) { |
391 | this[val] = !this[val]; | 307 | this[val] = !this[val]; |
392 | this.onlySelect(val); | 308 | this.onlySelect(val); |
309 | this.viewpoint instanceof viewpoint || (this.viewpoint = new viewpoint(this.viewer)); | ||
393 | }, | 310 | }, |
394 | // 淹没分析 | 311 | // 淹没分析 |
395 | EymAnslysis(val) { | 312 | EymAnslysis(val) { |
396 | this[val] = !this[val]; | 313 | this[val] = !this[val]; |
397 | this.onlySelect(val); | 314 | this.onlySelect(val); |
315 | this.flood instanceof flood || (this.flood = new flood(this.viewer)); | ||
398 | }, | 316 | }, |
399 | // 天际线分析 | 317 | // 天际线分析 |
400 | EtjxAnslysis(val) { | 318 | EtjxAnslysis(val) { | ... | ... |
-
Please register or sign in to post a comment