Documentation for maplib/Overlay.kt
- data class TouchResult
Touch result class
- class Overlay
Overlay. Map overlay to draw different features (for example, current position, edit features, etc.)
- constructor(mapPtr MapDocument, type: Overlay.Type, map: WeakReference<MapDocument> = WeakReference(mapPtr))
Main constructor
- Parameters
type – e Overlay type.
- val type : Overlay.Type
e Overlay type.
- var options : Map<String, String>
Overlay options key-value dictionary. The keys depend on overlay type.
- enum class Type
Map overlay types.
UNKNOWN = 0 : Unknown overlay type.
LOCATION = 1 : Overlay with current location mark.
TRACK = 2 : Overlay for current tracks.
EDIT = 3 : Overlay for vector geometry editing.
FIGURES = 4 : Overlay to show geometry primitives.
ALL = 5 : All overlays.
- class LocationOverlay
LocationOverlay. Overlay showing current position
- constructor(mapPtr MapDocument)
Main constructor
- var style : JsonObject
Overlay style json object
- class EditOverlay
Overlay showing edit features
- constructor(mapPtr MapDocument)
Main constructor
- var pointStyle : JsonObject
Point json object style.
- var lineStyle : JsonObject
Line json object style.
- var fillStyle : JsonObject
Polygon json object style.
- var crossStyle : JsonObject
The cross in screen center style read/write property.
- val geometryType : Geometry.Type
Edit geometry type property.
- fun setPointStyle(name: String) : Boolean
Set edit overlay point feature style.
- Parameters
name – Style name.
- Returns
True on success.
- fun setLineStyle(name: String) : Boolean
Set edit overlay line feature style.
- Parameters
name – Style name.
- Returns
True on success.
- fun setFillStyle(name: String) : Boolean
Set edit overlay polygon feature style.
- Parameters
name – Style name.
- Returns
True on success.
- fun setCrossStyle(name: String) : Boolean
Set edit overlay cross style.
- Parameters
name – Style name.
- Returns
True on success.
- fun save() : Feature?
Save edits and return result feature instance.
- Returns
Feature class instance or null.
- fun createNewGeometry(layer: Layer) : Boolean
Create new geometry and start editing. If the layer datasource is point - the point at the center of screen will be created, if line - line with two points, if polygon - polygon with three points.
- Parameters
layer – Layer in which to create new geometry. The feature will be created in layer datasource.
- Returns
True on success.
- fun createNewEmptyGeometry(layer: Layer) : Boolean
Create new geometry and start editing. The geometry will be empty. This is for edit by walk editing.
- Parameters
layer – Layer in which to create new geometry. The feature will be created in layer datasource.
- Returns
True on success.
- fun createNewGeometryOfType(type: Geometry.Type) : Boolean
Create new geometry and start editing.
- Parameters
type – Geometry type.
- Returns
True on success.
- fun editGeometry(feature: Feature) : Boolean
Start editing geometry from feature.
- Parameters
feature – Feature to edit geometry.
- Returns
True on success.
- fun addGeometryPoint() : Boolean
Add point to geometry. Make sense only for line or polygon ring.
- Returns
True on success.
- fun addGeometryPoint(coordinates: Point) : Boolean
Add point to geometry. Make sense only for line or polygon ring.
- Parameters
coordinates – Point coordinates.
- Returns
True on success.
- fun deleteGeometryPoint() : DeleteResultType
Delete point from geometry.
- Returns
True on success.
- fun deleteGeometryPart() : DeleteResultType
Delete geometry part
- Returns
The value of type enum DeleteResultType
- fun deleteGeometryHole() : DeleteResultType
Delete geometry hole.
- Returns
Delete result type indicating is this last hole or any already exists.
- fun touchDown(x: Float, y: Float) : TouchResult
Touch down event in edit overlay.
- Parameters
x – X screen coordinate.
y – Y screen coordinate.
- Returns
TouchResult with selected point identifier and is this point belongs to hole.
- fun touchUp(x: Float, y: Float) : TouchResult
Touch up event in edit overlay.
- Parameters
x – X screen coordinate.
y – Y screen coordinate.
- Returns
TouchResult with selected point identifier and is this point belongs to hole.
- fun touchMove(x: Float, y: Double) : TouchResult
Touch move event in edit overlay.
- Parameters
x – X screen coordinate.
y – Y screen coordinate.
- Returns
TouchResult with selected point identifier and is this point belongs to hole.
- fun singleTouch(x: Float, y: Float) : TouchResult
Touch single event in edit overlay. For example down and up.
- Parameters
x – X screen coordinate.
y – Y screen coordinate.
- Returns
TouchResult with selected point identifier and is this point belongs to hole.
- enum class DeleteResultType
Edit operation result type.
FAILED = 1 : Delete operation failed
SELTYPE_NO_CHANGE = 2 : Same piece type is selected after delete operation
HOLE = 3 : Hole is deleted. Outer ring selected
PART = 4 : Part is deleted. Other part selected
GEOMETRY = 5 : Whole geometry is deleted
- enum class EditStyleType
Edit style type.
POINT = 0 : Point style
LINE = 1 : Line style
FILL = 2 : Fill style
CROSS = 3 : Cross style
- enum class MapTouchType
Map touch type
ON_DOWN : Down click/touch
ON_MOVE : Move
ON_UP : Up click/touch
SINGLE : Single touch (down an up)