99 <input type =" radio" :value =" t" v-model =" value" >
1010 </div >
1111 <div >
12- <button class =" button" @click =" measure .clear()" >清除</button >
12+ <button class =" button" @click =" drawer .clear()" >清除</button >
1313 </div >
1414 <div >
15- <button class =" button" @click =" measure .stop()" >停止</button >
15+ <button class =" button" @click =" drawer .stop()" >停止</button >
1616 </div >
1717 </div >
1818
8484
8585<script setup lang="ts">
8686import Map from ' ./Map.vue' ;
87- import { GeoJSONLayerManager , MeasureManager , TDrawGeometryType , TIdentityGeoJSONFeature , Units } from ' ../index' ;
87+ import { DrawManager , GeoJSONLayerManager , MeasureManager , TDrawGeometryType , TIdentityGeoJSONFeature , Units } from ' ../index' ;
8888import { ref , watch } from ' vue' ;
8989
9090const value = ref (" " );
@@ -95,6 +95,7 @@ const radios = {
9595}
9696
9797let measure: MeasureManager ;
98+ let drawer: DrawManager ;
9899const direction = ref (false );
99100const distance = ref (false );
100101const center = ref (false );
@@ -123,16 +124,16 @@ watch(precisions, a => {
123124}, { deep: true });
124125
125126function 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 , {});
128129 measure .setDirectionSymbol (" >>" , " <<" );
129130 measure .showPolygonDirection (false );
130131 measure .showPolygonDistance (false );
131132 measure .showSegment (false );
132133}
133134
134135function handleRadioClick(measureType : TDrawGeometryType ) {
135- measure .start (measureType );
136+ drawer .start (measureType );
136137 value .value = measureType ;
137138}
138139
0 commit comments