111111
Showing
1 changed file
with
0 additions
and
111 deletions
src/components/map/Map.vue
deleted
100644 → 0
1 | <template> | ||
2 | |||
3 | <div id="map"> | ||
4 | <div id="map-box" ref="mapBody"></div> | ||
5 | </div> | ||
6 | |||
7 | </template> | ||
8 | |||
9 | <script> | ||
10 | import maps from "../../assets/js/map/mapUtils"; | ||
11 | import panel from "../../assets/js/map/panel"; | ||
12 | import maintain from "../../assets/js/map/maintain"; | ||
13 | export default { | ||
14 | data() { | ||
15 | return { | ||
16 | SGWorld: undefined, | ||
17 | regEvent: ['OnLoadFinished'], // 三维地图初始化函数 | ||
18 | initial: ['tree', 'map', 'sgword'], | ||
19 | } | ||
20 | }, | ||
21 | methods: { | ||
22 | Initialization() { | ||
23 | !this.$refs.mapBody.children.length && this.createEl(); | ||
24 | this.SGWorld.Project.Open("http://DESKTOP-583NBSF/SG/projects/SG.397338", true, "", ""); | ||
25 | |||
26 | this.regEvent.forEach(e => { | ||
27 | typeof this[e] === "function" && this.SGWorld.AttachEvent(e, this[e]); | ||
28 | }); | ||
29 | |||
30 | }, | ||
31 | OnLoadFinished() { | ||
32 | this.SGWorld.Navigate.JumpTo(SGWorld.Creator.CreatePosition(101.67468055555556, 36.54803611111111, 863, 0, | ||
33 | 220.63478, -40, 0)); | ||
34 | maps.sgWorld || (maps.sgWorld = this.SGWorld); | ||
35 | |||
36 | this.$parent.Initialization(); | ||
37 | |||
38 | Object.keys(panel.attribute || {}).forEach(e => { | ||
39 | let opt = panel.attribute[e], popup; | ||
40 | Array.isArray(opt) && | ||
41 | (maps.popups[e] = maps.sgWorld.Creator.CreatePopupMessage(opt[0], '', opt[2], opt[3], opt[4], opt[5], -1)); | ||
42 | maps.popups[e].Src = opt[1] + "?popupID=" + maps.popups[e].ID; | ||
43 | }); | ||
44 | |||
45 | |||
46 | |||
47 | }, | ||
48 | CreatWMSlayer(r) { | ||
49 | |||
50 | var box = r.split("BBOX=")[1].split(','); | ||
51 | var LayerName = "WMS服务" | ||
52 | var box3 = box[3].split('&')[0] | ||
53 | var buffer='<EXT><ExtInfo><![CDATA['; | ||
54 | buffer+='[INFO]\n'; | ||
55 | buffer+='MPP=2.68220901489258E-06\n'; | ||
56 | buffer+='Url=' + r + '\n'; | ||
57 | buffer+='xul=' + box[0] + '\n'; | ||
58 | buffer+='ylr=' + box[1] + '\n'; | ||
59 | buffer+='xlr=' + box[2] + '\n'; | ||
60 | buffer+='yul=' + box3 + '\n'; | ||
61 | buffer+=']]></ExtInfo><ExtType>wms</ExtType></EXT>'; | ||
62 | this.SGWorld.Creator.CreateImageryLayer(LayerName, box[0], box3, box[2], box[1], buffer, "gisplg.rct", "", LayerName); | ||
63 | |||
64 | // var box = r.split("BBOX=")[1].split(','); | ||
65 | // var LayerName = r.split("Layers=")[1].split('&')[0]; | ||
66 | // var box3 = box[3].split('&')[0] | ||
67 | // var buffer='<EXT><ExtInfo><![CDATA['; | ||
68 | // buffer+='[INFO]\n'; | ||
69 | // buffer+='MPP=2.68220901489258E-06\n'; | ||
70 | // buffer+='Url=' + r + '\n'; | ||
71 | // buffer+='xul=' + box[0] + '\n'; | ||
72 | // buffer+='ylr=' + box[1] + '\n'; | ||
73 | // buffer+='xlr=' + box[2] + '\n'; | ||
74 | // buffer+='yul=' + box3 + '\n'; | ||
75 | // buffer+=']]></ExtInfo><ExtType>wms</ExtType></EXT>'; | ||
76 | // console.log(LayerName); | ||
77 | // this.SGWorld.Creator.CreateImageryLayer(LayerName, box[0], box3, box[2], box[1], null, "gisplg.rct", 0, LayerName) | ||
78 | }, | ||
79 | createEl() { | ||
80 | let init = maintain.methods.getMap, keys, i, o; | ||
81 | (this.initial || []).forEach(e => { | ||
82 | this.constructorEl(init[e]); | ||
83 | }) | ||
84 | }, | ||
85 | constructorEl(opt) { | ||
86 | if (!opt.el) return; | ||
87 | let el = document.createElement(opt.el); | ||
88 | Object.assign(el, { name: opt.name, id: opt.id, classid: opt.classid }); | ||
89 | Object.keys(opt.style).forEach(e => { | ||
90 | el.style[e] = opt.style[e]; | ||
91 | }); | ||
92 | this.$refs.mapBody.appendChild((this.SGWorld = el)); | ||
93 | } | ||
94 | }, | ||
95 | mounted() { | ||
96 | this.Initialization(); | ||
97 | } | ||
98 | } | ||
99 | </script> | ||
100 | |||
101 | <style scoped lang="scss"> | ||
102 | #map { | ||
103 | display: flex; | ||
104 | } | ||
105 | #map-box { | ||
106 | background: #95ab2a; | ||
107 | width: 100%; | ||
108 | height: 100%; | ||
109 | flex: 1; | ||
110 | } | ||
111 | </style> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment