Documentation for MapLib/MapView.swift

protocol GestureDelegate : class

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

protocol LocationDelegate : class

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

protocol MapViewDelegate : class

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

class MapView : GLKView

Map view class.

var currentLocation : CLLocation = nil

Last known location or nil.

var showLocation : Bool

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

var freeze : Bool

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 curremt extent read/write propertry.

func setMap(map: Map)

Set map class to view.

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

func cancelDraw() Bool

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

Результат

True to cancel drawing.

func refresh(normal: Bool = true)

Refresh map.

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

func zoomIn(multiply: Double = 2.0)

Zoom in.

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

func zoomOut(multiply: Double = 2.0)

Zoom out.

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

func centerMap(coordinate: Point)

Center map at spatial reference coordinates.

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

func centerInCurrentLocation()

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

func invalidate(envelope: Envelope)

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

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

func pan(w: Double, h: Double)

Pan map to specific screen shift.

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

  • h – vertical pixel shift.

func scheduleDraw(drawState: Map.DrawState, timeInterval: TimeInterval = Constants.refreshTime)

Shedule map redraw.

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

  • timeInterval – Time interval in seconds.

func registerGestureRecognizers(_ delegate:GestureDelegate)

Register gesture delegate function.

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

func registerLocation(_ delegate:LocationDelegate)

Register location delegate function.

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

func registerView(_ delegate:MapViewDelegate)

Register map drawing delegate function.

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

func getExtent(srs: Int32) Envelope

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

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

Результат

Envelope in specified spatial reference system.

class MapViewEdit : MapView

Map view with vector feature editing functions.

var isEditMode : Bool

Is in edit mode or not.

func undoEdit()

Undo edit operation.

func redoEdit()

Redo edit operation.

func addGeometryPart()

Add geometry part.

func addGeometryPoint()

Add geometry point.

func addGeometryPoint(with coordinates:Point)

Add geometry point in specified coordinates.

Параметры
  • coordinates – Point coordinates.

func deleteGeometryPart() EditOverlay.DeleteResultType

Deletes selected geometry part

Результат

delete result type value. EditOverlay.DeleteResultType.

func deleteGeometryPoint() EditOverlay.DeleteResultType

Delete point from geometry.

Результат

delete result type value. EditOverlay.DeleteResultType.

func deleteGeometry()

Delete the whole geometry.

func addGeometryHole()

Add hole to geometry.

func deleteGeometryHole() EditOverlay.DeleteResultType

Delete geometry hole.

Результат

delete result type value. EditOverlay.DeleteResultType.