9
9
<input type =" radio" :value =" t" v-model =" value" >
10
10
</div >
11
11
<div >
12
- <button class =" button" @click =" measure .clear()" >清除</button >
12
+ <button class =" button" @click =" drawer .clear()" >清除</button >
13
13
</div >
14
14
<div >
15
- <button class =" button" @click =" measure .stop()" >停止</button >
15
+ <button class =" button" @click =" drawer .stop()" >停止</button >
16
16
</div >
17
17
</div >
18
18
84
84
85
85
<script setup lang="ts">
86
86
import Map from ' ./Map.vue' ;
87
- import { GeoJSONLayerManager , MeasureManager , TDrawGeometryType , TIdentityGeoJSONFeature , Units } from ' ../index' ;
87
+ import { DrawManager , GeoJSONLayerManager , MeasureManager , TDrawGeometryType , TIdentityGeoJSONFeature , Units } from ' ../index' ;
88
88
import { ref , watch } from ' vue' ;
89
89
90
90
const value = ref (" " );
@@ -95,6 +95,7 @@ const radios = {
95
95
}
96
96
97
97
let measure: MeasureManager ;
98
+ let drawer: DrawManager ;
98
99
const direction = ref (false );
99
100
const distance = ref (false );
100
101
const center = ref (false );
@@ -123,16 +124,16 @@ watch(precisions, a => {
123
124
}, { deep: true });
124
125
125
126
function onMapLoad(map : maplibregl .Map ) {
126
- const glManager = new GeoJSONLayerManager <TIdentityGeoJSONFeature >(map , []);
127
- measure = new MeasureManager (glManager , {});
127
+ drawer = new DrawManager ( new GeoJSONLayerManager <TIdentityGeoJSONFeature >(map , []) );
128
+ measure = new MeasureManager (drawer , {});
128
129
measure .setDirectionSymbol (" >>" , " <<" );
129
130
measure .showPolygonDirection (false );
130
131
measure .showPolygonDistance (false );
131
132
measure .showSegment (false );
132
133
}
133
134
134
135
function handleRadioClick(measureType : TDrawGeometryType ) {
135
- measure .start (measureType );
136
+ drawer .start (measureType );
136
137
value .value = measureType ;
137
138
}
138
139
0 commit comments