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.

Parameters
  • map – Map class instance.

func cancelDraw() Bool

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

Returns

True to cancel drawing.

func refresh(normal: Bool = true)

Refresh map.

Parameters
  • normal – If true just refresh view, othervise refill all map tiles.

func zoomIn(multiply: Double = 2.0)

Zoom in.

Parameters
  • multiply – Multiply factor. Default is 2.

func zoomOut(multiply: Double = 2.0)

Zoom out.

Parameters
  • multiply – Multiply factor. Default is 2.

func centerMap(coordinate: Point)

Center map at spatial reference coordinates.

Parameters
  • 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.

Parameters
  • envelope – Envelope to invalidate.

func pan(w: Double, h: Double)

Pan map to specific screen shift.

Parameters
  • w – horisontal pixel shift

  • h – vertical pixel shift.

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

Shedule map redraw.

Parameters
  • drawState – Draw state value. See Map.DrawState values.

  • timeInterval – Time interval in seconds.

func registerGestureRecognizers(_ delegate:GestureDelegate)

Register gesture delegate function.

Parameters
  • delegate – delegate function.

func registerLocation(_ delegate:LocationDelegate)

Register location delegate function.

Parameters
  • delegate – location delegate function.

func registerView(_ delegate:MapViewDelegate)

Register map drawing delegate function.

Parameters
  • delegate – map drawing delegate function.

func getExtent(srs: Int32) Envelope

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

Parameters
  • srs – EPSG code.

Returns

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.

Parameters
  • coordinates – Point coordinates.

func deleteGeometryPart() EditOverlay.DeleteResultType

Deletes selected geometry part

Returns

delete result type value. EditOverlay.DeleteResultType.

func deleteGeometryPoint() EditOverlay.DeleteResultType

Delete point from geometry.

Returns

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.

Returns

delete result type value. EditOverlay.DeleteResultType.