Documentation for MapLib/Api.swift

class API

A class with common api methods

func version(component: String) Int

Returns library version as number

Параметры
  • component – May be self, gdal, sqlite, tiff, jpeg, png, jsonc, proj, geotiff, expat, iconv, zlib, openssl

Результат

version number

func versionString(component: String) String

Returns library version as string

Параметры
  • component – May be self, gdal, sqlite, tiff, jpeg, png, jsonc, proj, geotiff, expat, iconv, zlib, openssl

Результат

version string

func freeResources(full: Bool)

Free library resources. On this call catalog removes all preloaded tree items. The map storage closes and removes all maps

Параметры
  • full – If true catalog and map storage will be freed, otherwise only map storage

func lastError() String

Returns last error message

Результат

message string

func getCatalog() Catalog

Get catalog class instance. The catalog object is singleton.

Результат

Catalog class instance

func getMap(_ name:String) Map?

Get map by name

Параметры
  • name – map file name. If map file name extension is not set it will append.

Результат

Map class instance or nil

func getStore(_ name:String) Store?

Get NextGIS store catalog object. The NextGIS store is geopackage file with some addtions needed for library.

Параметры
  • name – File name. If file name extension is not set it will append.

Результат

Catalog object instance or nil

func getDataDirectory() Object?

Get library data directory. Directory to store various data include maps, files, etc.

Результат

Catalog object instance or nil

func getTmpDirectory() Object?

Get library temp directory.

Результат

Catalog object instance or nil

func getDocDirectory() Object?

Get library documents directory

Результат

Catalog object instance or nil

func md5(string: String) String

Create MD5 hash from text

Параметры
  • string – text to create MD5 hash

Результат

MD5 hash string created from text

func getProperty(for key:String, withDefault value:String) String

Get library property

Параметры
  • key – key value

  • value – default value if not exists

Результат

property value correspondent to key

func setProperty(for key:String, with value:String)

Set library property

Параметры
  • key – key value

  • value – value to set