Documentation for maplib/MapView.kt

interface GestureDelegate

Gesture delegate protocol. Correspondent functions will be executed on gesture events.

interface LocationDelegate

Location delegate protocol. Correspondent functions will be executed on location events.

interface MapViewDelegate

Map drawing delegate protocol. Correspondent functions will be executed on map draw events.

class MapView : GLSurfaceView

Map view with GL rendering.

MapView holds MapDocument and renders it.

var currentLocation : Location? = null

Last known location or null.

var showLocation : Boolean = false

Show/hide current position on map. The location overlay must be set.

var freeze : Boolean = true

Freeze map drawing read/write property.

var mapScale : Double

Map scale read/write property.

var mapCenter : Point

Map center in spatial reference coordinates read/write property.

var mapExtent : Envelope

Map current extent read/write property.

fun setMap(map: MapDocument)

Set map class to view.

Параметры
  • map – Map class instance.

fun cancelDraw() : Boolean

Cancel drawing process. Default return value is false. Using override function can cancel drawing on some cases.

Результат

True to cancel drawing.

fun refresh(normal: Boolean = true)

Refresh map.

Параметры
  • normal – If true just refresh view, otherwise refill all map tiles.

fun zoomIn(multiply: Double = 2.0)

Zoom in.

Параметры
  • multiply – Multiply factor. Default is 2.

fun zoomOut(multiply: Double = 2.0)

Zoom out.

Параметры
  • multiply – Multiply factor. Default is 2.

fun centerMap(coordinate: Point)

Center map at spatial reference coordinates and redraw it.

Параметры
  • coordinate – New center coordinates.

fun centerInCurrentLocation()

Center map in current location. If current location is null, nothing happened.

fun invalidate(envelope: Envelope)

Invalidate part of the map. The refresh function invalidates all visible screen.

Параметры
  • envelope – Envelope to invalidate.

fun pan(w: Double, h: Double)

Pan map to specific screen shift.

Параметры
  • w – horizontal pixel shift

  • h – vertical pixel shift.

fun scheduleDraw(drawState: MapDocument.DrawState, timeInterval: Long = Constants.refreshTime)

Schedule map redraw.

Параметры
  • drawState – Draw state value. See Map.DrawState values.

  • timeInterval – Time interval in seconds.

fun registerGestureRecognizers(delegate: GestureDelegate)

Register gesture delegate function.

Параметры
  • delegate – delegate function.

fun registerLocation(delegate: LocationDelegate)

Register location delegate function.

Параметры
  • delegate – location delegate function.

fun registerView(delegate: MapViewDelegate)

Register map drawing delegate function.

Параметры
  • delegate – map drawing delegate function.

fun getExtent(srs: Int) : Envelope

Get current extent in specified spatial reference system by EPSG code.

Параметры
  • srs – EPSG code.

Результат

Envelope in specified spatial reference system.