20191217
Showing
6 changed files
with
168 additions
and
5 deletions
... | @@ -211,6 +211,11 @@ | ... | @@ -211,6 +211,11 @@ |
211 | "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", | 211 | "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", |
212 | "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==" | 212 | "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==" |
213 | }, | 213 | }, |
214 | "@openlayers/pepjs": { | ||
215 | "version": "0.5.3", | ||
216 | "resolved": "https://registry.npmjs.org/@openlayers/pepjs/-/pepjs-0.5.3.tgz", | ||
217 | "integrity": "sha512-Bgvi5c14BS0FJWyYWWFstNEnXsB30nK8Jt8hkAAdqr7E0gDdBBWVDglF3Ub19wTxvgJ/CVHyTY6VuCtnyRzglg==" | ||
218 | }, | ||
214 | "@supermap/iclient-common": { | 219 | "@supermap/iclient-common": { |
215 | "version": "10.0.0", | 220 | "version": "10.0.0", |
216 | "resolved": "https://registry.npmjs.org/@supermap/iclient-common/-/iclient-common-10.0.0.tgz", | 221 | "resolved": "https://registry.npmjs.org/@supermap/iclient-common/-/iclient-common-10.0.0.tgz", |
... | @@ -6304,8 +6309,7 @@ | ... | @@ -6304,8 +6309,7 @@ |
6304 | }, | 6309 | }, |
6305 | "js-yaml": { | 6310 | "js-yaml": { |
6306 | "version": "3.7.0", | 6311 | "version": "3.7.0", |
6307 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz", | 6312 | "resolved": "", |
6308 | "integrity": "sha1-XJZ93YN6m/3KXy3oQlOr6KHAO4A=", | ||
6309 | "dev": true, | 6313 | "dev": true, |
6310 | "requires": { | 6314 | "requires": { |
6311 | "argparse": "^1.0.7", | 6315 | "argparse": "^1.0.7", |
... | @@ -7422,6 +7426,17 @@ | ... | @@ -7422,6 +7426,17 @@ |
7422 | "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", | 7426 | "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", |
7423 | "dev": true | 7427 | "dev": true |
7424 | }, | 7428 | }, |
7429 | "ol": { | ||
7430 | "version": "6.1.1", | ||
7431 | "resolved": "https://registry.npmjs.org/ol/-/ol-6.1.1.tgz", | ||
7432 | "integrity": "sha512-0dL3i3eJqgOpqIjDKEY3grkeQnjAYfV5L/JCxhOu4SxiaizRwFrFgeas6LILRoxKa03jhQFbut2r2bbgcLGQeA==", | ||
7433 | "requires": { | ||
7434 | "@openlayers/pepjs": "^0.5.3", | ||
7435 | "pbf": "3.2.1", | ||
7436 | "pixelworks": "1.1.0", | ||
7437 | "rbush": "^3.0.1" | ||
7438 | } | ||
7439 | }, | ||
7425 | "omit.js": { | 7440 | "omit.js": { |
7426 | "version": "1.0.2", | 7441 | "version": "1.0.2", |
7427 | "resolved": "https://registry.npmjs.org/omit.js/-/omit.js-1.0.2.tgz", | 7442 | "resolved": "https://registry.npmjs.org/omit.js/-/omit.js-1.0.2.tgz", |
... | @@ -7793,6 +7808,11 @@ | ... | @@ -7793,6 +7808,11 @@ |
7793 | "pinkie": "^2.0.0" | 7808 | "pinkie": "^2.0.0" |
7794 | } | 7809 | } |
7795 | }, | 7810 | }, |
7811 | "pixelworks": { | ||
7812 | "version": "1.1.0", | ||
7813 | "resolved": "https://registry.npmjs.org/pixelworks/-/pixelworks-1.1.0.tgz", | ||
7814 | "integrity": "sha1-Hwla1I3Ki/ihyCWOAJIDGkTyLKU=" | ||
7815 | }, | ||
7796 | "pkg-dir": { | 7816 | "pkg-dir": { |
7797 | "version": "2.0.0", | 7817 | "version": "2.0.0", |
7798 | "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", | 7818 | "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", |
... | @@ -10366,6 +10386,14 @@ | ... | @@ -10366,6 +10386,14 @@ |
10366 | "unpipe": "1.0.0" | 10386 | "unpipe": "1.0.0" |
10367 | } | 10387 | } |
10368 | }, | 10388 | }, |
10389 | "rbush": { | ||
10390 | "version": "3.0.1", | ||
10391 | "resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz", | ||
10392 | "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==", | ||
10393 | "requires": { | ||
10394 | "quickselect": "^2.0.0" | ||
10395 | } | ||
10396 | }, | ||
10369 | "read-cache": { | 10397 | "read-cache": { |
10370 | "version": "1.0.0", | 10398 | "version": "1.0.0", |
10371 | "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", | 10399 | "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", | ... | ... |
... | @@ -18,6 +18,7 @@ | ... | @@ -18,6 +18,7 @@ |
18 | "jquery": "^3.4.1", | 18 | "jquery": "^3.4.1", |
19 | "mapbox-gl": "^1.6.0", | 19 | "mapbox-gl": "^1.6.0", |
20 | "mapbox-gl-compare": "^0.3.0", | 20 | "mapbox-gl-compare": "^0.3.0", |
21 | "ol": "^6.1.1", | ||
21 | "vue": "^2.5.2", | 22 | "vue": "^2.5.2", |
22 | "vue-router": "^3.0.1" | 23 | "vue-router": "^3.0.1" |
23 | }, | 24 | }, | ... | ... |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | * @Author: jiangbotao | 2 | * @Author: jiangbotao |
3 | * @Date: 2019-12-13 23:53:57 | 3 | * @Date: 2019-12-13 23:53:57 |
4 | * @LastEditors: jiangbotao | 4 | * @LastEditors: jiangbotao |
5 | * @LastEditTime: 2019-12-16 12:57:27 | 5 | * @LastEditTime: 2019-12-17 19:54:02 |
6 | * @FilePath: \supermapvue\src\components\menu\MyMenu.vue | 6 | * @FilePath: \supermapvue\src\components\menu\MyMenu.vue |
7 | --> | 7 | --> |
8 | <template> | 8 | <template> |
... | @@ -47,6 +47,10 @@ | ... | @@ -47,6 +47,10 @@ |
47 | <a-menu-item key="5_3"><router-link :to="'/theme_range'">分段渲染</router-link></a-menu-item> | 47 | <a-menu-item key="5_3"><router-link :to="'/theme_range'">分段渲染</router-link></a-menu-item> |
48 | <a-menu-item key="5_4"><router-link :to="'/theme_label'">注记图</router-link></a-menu-item> | 48 | <a-menu-item key="5_4"><router-link :to="'/theme_label'">注记图</router-link></a-menu-item> |
49 | </a-sub-menu> | 49 | </a-sub-menu> |
50 | <a-sub-menu key="sub6"> | ||
51 | <span slot="title"><a-icon type="up-square" /><span>OpenLayers</span></span> | ||
52 | <a-menu-item key="6_1"><router-link :to="'/map_ol'">OL</router-link></a-menu-item> | ||
53 | </a-sub-menu> | ||
50 | </a-menu> | 54 | </a-menu> |
51 | </template> | 55 | </template> |
52 | <style scoped> | 56 | <style scoped> | ... | ... |
src/components/ol/OL.vue
0 → 100644
1 | <!-- | ||
2 | * @Author: jiangbotao | ||
3 | * @Date: 2019-12-17 19:48:20 | ||
4 | * @LastEditors: jiangbotao | ||
5 | * @LastEditTime: 2019-12-17 20:36:29 | ||
6 | * @FilePath: \supermapvue\src\components\ol\OL.vue | ||
7 | --> | ||
8 | <template> | ||
9 | <div > | ||
10 | <div id="map"></div> | ||
11 | </div> | ||
12 | </template> | ||
13 | |||
14 | <script> | ||
15 | import "ol/ol.css"; | ||
16 | import { Map, View } from "ol"; | ||
17 | import { XYZ } from 'ol/source'; | ||
18 | import VectorSource from "ol/source/Vector"; | ||
19 | import Point from "ol/geom/Point"; | ||
20 | import {Draw, Modify, Snap} from 'ol/interaction'; | ||
21 | import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer"; | ||
22 | import {Circle as CircleStyle, Fill, Stroke, Style} from 'ol/style'; | ||
23 | |||
24 | export default { | ||
25 | data() { | ||
26 | return { | ||
27 | map: null | ||
28 | }; | ||
29 | }, | ||
30 | mounted() { | ||
31 | var tdt_vec = new TileLayer({ | ||
32 | source: new XYZ({ | ||
33 | url: "http://t3.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=394404c8b901574fdc4cdf8c18a98448" | ||
34 | }) | ||
35 | }); | ||
36 | var tdt_cva = new TileLayer({ | ||
37 | source: new XYZ({ | ||
38 | url: "http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=394404c8b901574fdc4cdf8c18a98448" | ||
39 | }) | ||
40 | }); | ||
41 | // 矢量绘制图层 | ||
42 | var source = new VectorSource(); | ||
43 | var vectorLayer = new VectorLayer({ | ||
44 | source: source, | ||
45 | style: new Style({ | ||
46 | fill: new Fill({ | ||
47 | color: 'rgba(255, 0, 0, 0.2)' | ||
48 | }), | ||
49 | stroke: new Stroke({ | ||
50 | color: '#ffcc33', | ||
51 | width: 2 | ||
52 | }), | ||
53 | image: new CircleStyle({ | ||
54 | radius: 7, | ||
55 | fill: new Fill({ | ||
56 | color: '#ffcc33' | ||
57 | }) | ||
58 | }) | ||
59 | }) | ||
60 | }); | ||
61 | this.map = new Map({ | ||
62 | target: "map", | ||
63 | layers: [ | ||
64 | tdt_vec, tdt_cva, vectorLayer | ||
65 | ], | ||
66 | view: new View({ | ||
67 | projection: "EPSG:4326", | ||
68 | center: [120.79, 27.99], | ||
69 | zoom: 12, | ||
70 | minZoom: 10, | ||
71 | maxZoom: 18 | ||
72 | }) | ||
73 | }); | ||
74 | |||
75 | var modify = new Modify({source: source}); | ||
76 | this.map.addInteraction(modify); | ||
77 | modify.on('modifyend',function(e){ | ||
78 | var features = e.features.getArray(); | ||
79 | console.log(features); | ||
80 | }); | ||
81 | |||
82 | var draw, snap; // global so we can remove them later | ||
83 | function addInteractions(map) { | ||
84 | draw = new Draw({ | ||
85 | source: source, | ||
86 | type: 'Point' | ||
87 | }); | ||
88 | draw.on('drawstart', function (e) { | ||
89 | source.clear(); // implicit remove of last feature. | ||
90 | }); | ||
91 | draw.on('drawend', function(evt){ | ||
92 | var feature = evt.feature; | ||
93 | var p = feature.getGeometry(); | ||
94 | console.log(p.getCoordinates()); | ||
95 | var coord = p.getCoordinates(); | ||
96 | map.getView().animate({center: [coord[0], coord[1]]}); | ||
97 | }); | ||
98 | map.addInteraction(draw); | ||
99 | snap = new Snap({source: source}); | ||
100 | map.addInteraction(snap); | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | * Handle change event. | ||
105 | */ | ||
106 | // typeSelect.onchange = function(map) { | ||
107 | // map.removeInteraction(draw); | ||
108 | // map.removeInteraction(snap); | ||
109 | // addInteractions(); | ||
110 | // }; | ||
111 | |||
112 | addInteractions(this.map); | ||
113 | } | ||
114 | }; | ||
115 | </script> | ||
116 | |||
117 | <!-- Add "scoped" attribute to limit CSS to this component only --> | ||
118 | <style scoped> | ||
119 | #map { | ||
120 | position: absolute; | ||
121 | height: 100%; | ||
122 | width: 100%; | ||
123 | background-color: white | ||
124 | } | ||
125 | </style> |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | * @Author: jiangbotao | 2 | * @Author: jiangbotao |
3 | * @Date: 2019-12-12 17:40:15 | 3 | * @Date: 2019-12-12 17:40:15 |
4 | * @LastEditors: jiangbotao | 4 | * @LastEditors: jiangbotao |
5 | * @LastEditTime: 2019-12-17 00:26:31 | 5 | * @LastEditTime: 2019-12-17 20:35:13 |
6 | * @FilePath: \supermapvue\src\main.js | 6 | * @FilePath: \supermapvue\src\main.js |
7 | */ | 7 | */ |
8 | import Vue from 'vue' | 8 | import Vue from 'vue' | ... | ... |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | * @Author: jiangbotao | 2 | * @Author: jiangbotao |
3 | * @Date: 2019-12-12 17:40:15 | 3 | * @Date: 2019-12-12 17:40:15 |
4 | * @LastEditors: jiangbotao | 4 | * @LastEditors: jiangbotao |
5 | * @LastEditTime: 2019-12-15 18:08:19 | 5 | * @LastEditTime: 2019-12-17 20:37:03 |
6 | * @FilePath: \supermapvue\src\router\index.js | 6 | * @FilePath: \supermapvue\src\router\index.js |
7 | */ | 7 | */ |
8 | import Vue from 'vue' | 8 | import Vue from 'vue' |
... | @@ -116,6 +116,11 @@ export default new Router({ | ... | @@ -116,6 +116,11 @@ export default new Router({ |
116 | path: '/mvt_wzdemo', | 116 | path: '/mvt_wzdemo', |
117 | name: 'Theme_wzdemo', | 117 | name: 'Theme_wzdemo', |
118 | component: () => import('@/components/vt/Map_wzdemo') | 118 | component: () => import('@/components/vt/Map_wzdemo') |
119 | }, | ||
120 | { | ||
121 | path: '/map_ol', | ||
122 | name: 'Map_OL', | ||
123 | component: () => import('@/components/ol/OL') | ||
119 | } | 124 | } |
120 | ] | 125 | ] |
121 | }) | 126 | }) | ... | ... |
-
Please register or sign in to post a comment