目录

Projection

Class Info

public final class Projection

Final class that extends Object. This class is used for conversion between screen coordinates and longitude and latitude. An instance of this type will be returned when the getProjection method in the HuaweiMap class is called.

Public Method Summary

Qualifier and Type

Method Name and Description

LatLng

fromScreenLocation(Point point)

Obtains the longitude and latitude of a location on the screen.

VisibleRegion

getVisibleRegion()

Obtains the visible region after conversion between the screen coordinates and longitude/latitude coordinates.

Point

toScreenLocation(LatLng latLng)

Obtains a location on the screen corresponding to the specified longitude/latitude coordinates.

Public Methods

[h2]fromScreenLocation

Method

public LatLng fromScreenLocation(Point point)

Obtains the longitude and latitude of a location on the screen. The location on the screen is specified in screen pixels (instead of display pixels) relative to the top left corner of the map (instead of the top left corner of the screen).

Parameters

Name

Description

point

Coordinate point on the screen, in pixels. The value ranges from INT_MIN to INT_MAX.

NOTE:

This parameter has a fixed value of (90, 0) if the line connecting the selected point (coordinate point on the screen) and camera is almost in parallel with the ground.

Returns

Type

Description

LatLng

LatLng object that contains the corresponding longitude and latitude.

[h2]getVisibleRegion

Method

public VisibleRegion getVisibleRegion()

Obtains the visible region after conversion between the screen coordinates and longitude/latitude coordinates.

Returns

Type

Description

VisibleRegion

Visible region.

[h2]toScreenLocation

Method

public Point toScreenLocation(LatLng latLng)

Obtains a location on the screen corresponding to the specified longitude/latitude coordinates. The location on the screen is specified in screen pixels (instead of display pixels) relative to the top left corner of the map (instead of the top left corner of the screen).

Parameters

Name

Description

latLng

LatLng object that contains the corresponding longitude and latitude. The value ranges from -180 to 180 for the longitude and from -85.05 to 85.05 for the latitude.

NOTE:

This parameter has a fixed value of (INT_MAX,INT_MAX) if the longitude and latitude are out of the view frustum of the map camera.

Returns

Type

Description

Point

Coordinate point on the screen, in pixels.