Skip to content

Commit 584623d

Browse files
committed
zones add
1 parent eff53a8 commit 584623d

File tree

5 files changed

+87
-3
lines changed

5 files changed

+87
-3
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue3-openlayers",
3-
"version": "0.1.48",
3+
"version": "0.1.49",
44
"description": "Openlayers Wrapper for Vue3",
55
"repository": {
66
"type": "git",

Diff for: src/App.vue

+18-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
<ol-layerswitcherimage-control />
99

10+
<ol-zone-control :zones="zones" :projection="projection" :layer="jawgLayer.tileLayer" v-if="jawgLayer != null">
11+
12+
</ol-zone-control>
13+
1014
<ol-tile-layer ref="osmLayer" title="OSM">
1115
<ol-source-osm />
1216
</ol-tile-layer>
@@ -326,6 +330,18 @@ export default {
326330
327331
});
328332
333+
const zones = [{
334+
title: "Turkey",
335+
extent: [17.952,46.241,52.449,31.222]
336+
},
337+
{
338+
title: "Cyprus",
339+
extent: [31.2836,36.1623,35.5957,34.1823]
340+
}, {
341+
title: "Brazil",
342+
extent: [-120.32,22.76,17.67,-47.52]
343+
}]
344+
329345
return {
330346
331347
center,
@@ -358,7 +374,8 @@ export default {
358374
starIcon,
359375
changeDrawType,
360376
path,
361-
animationPath
377+
animationPath,
378+
zones
362379
}
363380
},
364381
}

Diff for: src/assets/style.css

+17
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,21 @@
4040

4141
.ol-collapsed:hover {
4242
background-color: rgba(255,255,255,0);
43+
}
44+
45+
.ol-control.ol-mapzone {
46+
top: 12.5em !important;
47+
}
48+
49+
.ol-control.ol-mapzone button {
50+
51+
margin-top: 0em !important;
52+
}
53+
54+
.ol-layerswitcher-image button {
55+
background-color: transparent !important;
56+
}
57+
58+
.ol-mapzone > div p {
59+
background-color: black !important;
4360
}

Diff for: src/components/mapControls/ZoneControl.vue

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template lang="">
2+
<div v-if="false">
3+
4+
</div>
5+
</template>
6+
7+
<script>
8+
import Zone from 'ol-ext/control/MapZone';
9+
import useControl from '@/composables/useControl'
10+
11+
export default {
12+
name: 'ol-zone-control',
13+
setup(props,context) {
14+
const {
15+
control
16+
} = useControl(Zone, props,context);
17+
return {
18+
control
19+
}
20+
21+
},
22+
props: {
23+
className: {
24+
type: String,
25+
},
26+
zones: {
27+
type: Array,
28+
},
29+
layer: {
30+
type: [Object,Function],
31+
},
32+
projection: {
33+
type: String,
34+
default: 'EPSG:3857'
35+
},
36+
centerOnClick: {
37+
type: Boolean,
38+
default: true
39+
},
40+
41+
}
42+
}
43+
</script>
44+
45+
<style lang="">
46+
47+
</style>

Diff for: src/components/mapControls/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import PrintDialog from './PrintDialog.vue'
1515
import VideoRecorderControl from './VideoRecorderControl.vue'
1616
import LayerSwitcherControl from './LayerSwitcherControl.vue'
1717
import LayerSwitcherImageControl from './LayerSwitcherImageControl.vue'
18+
import ZoneControl from './ZoneControl.vue'
1819
function install (app) {
1920

2021
if (install.installed) {
@@ -40,6 +41,7 @@ function install (app) {
4041
app.component(VideoRecorderControl.name, VideoRecorderControl)
4142
app.component(LayerSwitcherControl.name, LayerSwitcherControl)
4243
app.component(LayerSwitcherImageControl.name, LayerSwitcherImageControl)
44+
app.component(ZoneControl.name, ZoneControl)
4345
}
4446

4547
export default install
@@ -61,5 +63,6 @@ function install (app) {
6163
PrintDialog,
6264
VideoRecorderControl,
6365
LayerSwitcherControl,
64-
LayerSwitcherImageControl
66+
LayerSwitcherImageControl,
67+
ZoneControl
6568
}

0 commit comments

Comments
 (0)