@@ -53,86 +53,67 @@ import TransformDemo from "@demos/TransformDemo.vue"
5353 </ol-map>
5454</template>
5555
56- <script>
56+ <script setup >
5757import { ref } from "vue";
5858import { GeoJSON } from "ol/format";
5959
60- export default {
61- setup() {
62- const map = ref("");
63- const center = ref([-102.13121, 40.2436]);
64- const projection = ref("EPSG:4326");
65- const zoom = ref(5);
66- const rotation = ref(0);
67-
68- const drawEnabled = ref(false);
69-
70- const geojsonObject = {
71- type: "FeatureCollection",
72- crs: {
73- type: "name",
74- properties: {
75- name: "EPSG:4326",
76- },
77- },
78- features: [
79- {
80- type: "Feature",
81- geometry: {
82- type: "Polygon",
83- coordinates: [
84- [
85- [-103.86923852630616, 43.45599322423934],
86- [-103.90891107984544, 39.34240191087722],
87- [-98.76630637117387, 39.558687199211114],
88- [-98.89435771175386, 43.945405844902986],
89- [-103.86923852630616, 43.45599322423934],
90- ],
91- ],
92- },
93- },
94- {
95- type: "Feature",
96- geometry: {
97- type: "Polygon",
98- coordinates: [
99- [
100- [-103.85636392303468, 38.10970692739486],
101- [-103.86770698495866, 33.218572724914544],
102- [-98.20654544301988, 33.6532810221672],
103- [-98.4408283538437, 38.31894739375114],
104- [-103.85636392303468, 38.10970692739486],
105- ],
106- ],
107- },
108- },
109- ],
110- };
111-
112- const zones = ref([]);
113-
114- const drawend = (event) => {
115- zones.value.push(event.feature);
116- drawEnabled.value = false;
117- };
118-
119- zones.value = new GeoJSON().readFeatures(geojsonObject);
120-
121- const geoJsonFormat = new GeoJSON();
122-
123- return {
124- map,
125- geoJsonFormat,
126- zones,
127- center,
128- projection,
129- zoom,
130- rotation,
131- drawEnabled,
132- drawend,
133- };
60+ const map = ref("");
61+ const center = ref([-102.13121, 40.2436]);
62+ const projection = ref("EPSG:4326");
63+ const zoom = ref(5);
64+ const rotation = ref(0);
65+ const drawEnabled = ref(false);
66+
67+ const geojsonObject = {
68+ type: "FeatureCollection",
69+ crs: {
70+ type: "name",
71+ properties: {
72+ name: "EPSG:4326",
73+ },
13474 },
75+ features: [
76+ {
77+ type: "Feature",
78+ geometry: {
79+ type: "Polygon",
80+ coordinates: [
81+ [
82+ [-103.86923852630616, 43.45599322423934],
83+ [-103.90891107984544, 39.34240191087722],
84+ [-98.76630637117387, 39.558687199211114],
85+ [-98.89435771175386, 43.945405844902986],
86+ [-103.86923852630616, 43.45599322423934],
87+ ],
88+ ],
89+ },
90+ },
91+ {
92+ type: "Feature",
93+ geometry: {
94+ type: "Polygon",
95+ coordinates: [
96+ [
97+ [-103.85636392303468, 38.10970692739486],
98+ [-103.86770698495866, 33.218572724914544],
99+ [-98.20654544301988, 33.6532810221672],
100+ [-98.4408283538437, 38.31894739375114],
101+ [-103.85636392303468, 38.10970692739486],
102+ ],
103+ ],
104+ },
105+ },
106+ ],
135107};
108+
109+ const zones = ref([]);
110+
111+ const drawend = (event) => {
112+ zones.value.push(event.feature);
113+ drawEnabled.value = false;
114+ };
115+
116+ zones.value = new GeoJSON().readFeatures(geojsonObject);
136117</script>
137118```
138119
0 commit comments