Documentation for MapLib/Map.swift¶
- struct Point¶
Point class. Store x and y coordinates.
- class Map¶
Map class. The oredered array of layers.
- var center : Point¶
Map center read/write property. The point coordinates should be geographic, not screen.
- func close()¶
Close map. The map resources (layers, styles, etc.) will be freed.
- func setBackgroundColor(R: UInt8, G: UInt8, B: UInt8, A: UInt8)¶
Set map background.
- Параметры
R – red color.
G – green color.
B – blue color.
A – alpha color.
- func setSize(width: CGFloat, height: CGFloat)¶
Set map viewport size. MapView executes this function on resize.
- Параметры
width – map width in pixels.
height – map height in pixels.
- func addLayer(name: String, source: Object!) Layer? ¶
Add layer to map.
- Параметры
name – layer mame.
source – layer datasource.
- Результат
Layer class instance or nil on error.
- func deleteLayer(layer: Layer) Bool ¶
Remove layer from map.
- Параметры
layer – Layer class instance.
- Результат
True if delete succeeded.
- func deleteLayer(position: Int32) Bool ¶
Remove layer from map.
- Параметры
position – Layer index.
- Результат
True if delete succeeded.
- func getLayer(by position:Int32) Layer? ¶
Get map layer.
- Параметры
position – Layer index.
- Результат
Layer class instance.
- func setOptions(options: [String:String])¶
Set map options.
- Параметры
options – key-value dictionary. The supported keys are: - ZOOM_INCREMENT - Add integer value to zomm level correspondent to scale. May be negative. - VIEWPORT_REDUCE_FACTOR - Reduce view size on provided value. Make sense to decrease memory usage.
- func setExtentLimits(minX: Double, minY: Double, maxX: Double, maxY: Double)¶
Set map extent limits. This limits prevent scroll out of this bounding box.
- Параметры
minX – minimum x coordinate.
minY – minimum y coordinate.
maxX – maximum x coordinate.
maxY – maximum y coordinate.
- func reorder(before: Layer?, moved: Layer!)¶
Reorder map layers.
- Параметры
before – Before layer class instance will moved layer insert.
moved – Layer class instance to move.
- func identify(x: Float, y: Float, limit: Int = 0) [Feature] ¶
Search features in buffer around click/tap postition.
- Параметры
x – x position.
y – y position.
limit – max count return features.
- Результат
array of Feature.
- func select(features: [Feature])¶
Hightlight feature in map layers. Change the feature style to selection style. The selection style mast be set in map.
- Параметры
features – Features array. If array is empty the current hightlighted features will get layer style and drawn not hightlited.
- func invalidate(extent: Envelope)¶
Invalidate part of the map.
- Параметры
extent – Extente to invalidate
- func selectionStyle(for type:SelectionStyleType) JsonObject ¶
Get selection style
- Параметры
type – Style type
- Результат
Json object with style
- func selectionStyleName(for type:SelectionStyleType) String ¶
Get selection style name
- Параметры
type – Style type
- Результат
Style name string
- func setSelectionStyle()¶
Set selection style
- Параметры
style – Json object with style. See Layer.style
type – Selection style type
- Результат
True on success.
- func setSelectionStyle()
Set selection style name
- Параметры
name – Style name. See Layer.styleName
type – Selection style type
- Результат
True on success.
- func getOverlay(type: OverlayType) Overlay? ¶
Get map overlay
- Параметры
type – Overlay type.
- Результат
Overlay class instance or nil.
- func addIconSet(name: String, path: String, move: Bool) Bool ¶
Add iconset to map. The iconset is square image 256 x 256 or 512 x 512 pixel with icons in it.
- Параметры
name – Iconset name.
path – Path to image if file system.
move – If true the image will be deleted after successufly added to map document.
- Результат
True on success.
- func removeIconSet(name: String) Bool ¶
Remove iconset from map.
- Параметры
name – Iconset name.
- Результат
True on success.
- func isIconSetExists(name: String) Bool ¶
Validate iconset exists in map.
- Параметры
name – Iconset name.
- Результат
True if exists.
- enum OverlayType : UInt32¶
Map overlay types.
UNKNOWN: unknown overlay type.
LOCATION: overlay with current location mark.
TRACK: overlay for current tracks.
EDIT: overlay for vector geometry editig.
FIGURES: overlay to show geometry primitives.
ALL: All overlays.
- enum SelectionStyleType : UInt32¶
Map selection style types. In map can be configured styles for point, line and polygon (and multi…) layers. The styles are common for all layers.
POINT: point.
LINE: linestring.
FILL: polygon.
- enum DrawState : UInt32¶
Map drawing state enum
NORMAL: normal draw. Only new tiles will be filled with data to draw.
REDRAW: all cached data will be drop. Tiles deleted from meory. All tiles in screen will be filled with data to draw.
REFILL: all tiles will be mark need to fill with data to draw.
PRESERVED: just update scree with cached data.
NOTHING: no draw operation.