@@ -24,7 +24,9 @@ import { map, mapCommon, site, staticMap } from '@kit.MapKit';
24
24
import { LWError , LWLog } from './LWLog' ;
25
25
import {
26
26
Address ,
27
- Camera , ColorMap , DEFAULT_ZOOM , EdgePadding , ImageURISource , LatLng , Region ,
27
+ Camera , ColorMap , DEFAULT_ZOOM , EdgePadding , ImageURISource , LatLng ,
28
+ Point ,
29
+ Region ,
28
30
SnapshotOptions ,
29
31
TAG } from './sharedTypes' ;
30
32
import { image } from '@kit.ImageKit' ;
@@ -34,6 +36,7 @@ import fs from '@ohos.file.fs';
34
36
import { RNOHContext } from 'rnoh/ts' ;
35
37
36
38
export class MapsTurboManager {
39
+
37
40
private constructor ( ) {
38
41
}
39
42
@@ -174,6 +177,40 @@ export class MapsTurboManager{
174
177
this . mapController ?. setLatLngBounds ( { northeast : northEast , southwest : southWest } )
175
178
}
176
179
180
+ getMapBoundaries ( ) {
181
+ try {
182
+ let bounds = this . mapController ?. getProjection ( ) . getVisibleRegion ( ) ;
183
+ let north = bounds . bounds . northeast ;
184
+ let south = bounds . bounds . southwest ;
185
+ return {
186
+ northEast : north ,
187
+ southWest : south ,
188
+ } ;
189
+ } catch ( e ) {
190
+ LWError ( 'getMapBoundaries exception=' + JSON . stringify ( e ) ) ;
191
+ }
192
+ return { } ;
193
+ }
194
+
195
+ pointForCoordinate ( coordinate : LatLng ) {
196
+ try {
197
+ let mapPoint : mapCommon . MapPoint = this . mapController ?. getProjection ( ) . toScreenLocation ( { latitude : coordinate . latitude , longitude : coordinate . longitude } ) ;
198
+ return { x : mapPoint ?. positionX , y : mapPoint ?. positionY } ;
199
+ } catch ( e ) {
200
+ LWError ( 'pointForCoordinate exception=' + JSON . stringify ( e ) ) ;
201
+ }
202
+ return { } ;
203
+ }
204
+
205
+ coordinateForPoint ( point : Point ) {
206
+ try {
207
+ return this . mapController ?. getProjection ( ) . fromScreenLocation ( { positionX : point . x , positionY : point . y } ) ;
208
+ } catch ( e ) {
209
+ LWError ( 'coordinateForPoint exception=' + JSON . stringify ( e ) ) ;
210
+ }
211
+ return { } ;
212
+ }
213
+
177
214
public getAddressFromCoordinates ( coordinate : LatLng ) : Promise < Address > {
178
215
return new Promise ( ( resolve , reject ) => {
179
216
let params : site . ReverseGeocodeParams = {
@@ -285,4 +322,8 @@ export class MapsTurboManager{
285
322
public hideCallout ( ) {
286
323
287
324
}
325
+
326
+ public redraw ( ) {
327
+
328
+ }
288
329
}
0 commit comments