Documentation for maplib/Catalog.kt

class Object

Catalog object class. This is base class for all catalog objects.

fun constructor(name: String, type: Int, path: String, handle: Long)

Main constructor

Параметры
  • name – e Object name

  • type – e Object type

  • path – h Object path

  • handle – e Object handle for C API

val name : String

e Object name

val type : Int

e Object type

val path : String

h Object path

fun constructor(handle: Long)

Third constructor

Параметры
  • handle – Object handle for C API

fun getProperties(forDomain: String = "") : Map<String, String>

Get catalog object properties.

Параметры
  • forDomain – Parameters domain

Результат

Dictionary of key-value.

fun getProperty(name: String, defaultValue: String, domain: String = "") : String

Get catalog object property.

Параметры
  • name – Key name.

  • defaultValue – Default value.

  • domain – Domain name.

Результат

Property value.

fun setProperty(name: String, value: String, domain: String) : Boolean

Set catalog object property.

Параметры
  • name – Key name.

  • value – Key value.

  • domain – Domain name.

Результат

True on success.

fun isSame(otherObject: Object) : Boolean

Compare current catalog object with other.

Параметры
  • otherObject – Catalog object to compare.

Результат

True if equal.

fun children(filter: Array<Type> = emptyArray()) : Array<Object>

Get catalog object children.

Параметры
  • filter – Catalog object types to filter.

Результат

Array of catalog object class instances.

fun child(name: String, fullMatch: Boolean = true) : Object?

Get child by name.

Параметры
  • name – Catalog object child name.

  • fullMatch – If true the name must be equal, else the function return last child the name begins with „name“.

Результат

Catalog object child instance or null.

fun refresh()

Refresh catalog object. Reread children.

fun create(name: String, options: Map<String, String> = mapOf()) : Object?

Create new catalog object.

Параметры
  • name – New object name.

  • options – Dictionary describing new catalog object. The keys are created object dependent. The mandatory key is:

  • TYPE - this is string value of type Type

Результат

Created catalog object instance or null.

fun canCreate(type: Type) : Boolean

Check if object type can be created at this parent object

Параметры
  • type – Object type to check.

Результат

true if object of type can be created at this parent object or false.

fun createTMS(name: String, url: String, epsg: Int, z_min: Int, z_max: Int, fullExtent: Envelope, limitExtent: Envelope, cacheExpires: Int, options: Map<String, String> = mapOf()) : Raster?

Create TMS datasource

Параметры
  • name – TMS connection name

  • url – TMS url. {x}, {y} and {z} must be present in url string

  • epsg – EPSG code of TMS

  • z_min – Minimum zoom. Default is 0

  • z_max – Maximum zoom. Default is 18

  • fullExtent – Full extent of TMS datasource. Depends on tile schema and projection

  • limitExtent – Data extent. Maybe equal or less of fullExtent

  • cacheExpires – Time in seconds to remove old tiles

  • options – Additional options as key: value array

Результат

Raster object or null

fun createDirectory(name: String) : Object?

Create new directory.

Параметры
  • name – Directory name.

Результат

Created directory or null.

fun delete() : Boolean

Delete catalog object.

Результат

True on success.

fun delete(name: String) : Boolean

Delete catalog object with name.

Параметры
  • name – Object name to delete.

Результат

True on success.

fun copy(asType: Type, inDestination: Object, move: Boolean, withOptions: Map<String, String> = mapOf(), callback: ((status: StatusCode, complete: Double, message: String) -> Boolean)? = null) : Boolean

Copy current catalog object to destination object.

Параметры
  • asType – Output catalog object type.

  • inDestination – Destination catalog object.

  • move – Move object. This object will be deleted.

  • withOptions – Key-value dictionary. This will affect how the copy will be performed.

  • callback – Callback function. May be null

Результат

True on success.

static fun isTable(type: Int) : Boolean

Check if type is non spatial table.

Параметры
  • type – Type to check.

Результат

True if this type belongs to table types.

static fun isRaster(type: Int) : Boolean

Check if type is raster.

Параметры
  • type – Type to check.

Результат

True if this type belongs to raster types.

static fun isFeatureClass(type: Int) : Boolean

Check if type is FeatureClass.

Параметры
  • type – Type to check.

Результат

True if this type belongs to FeatureClass types.

static fun isContainer(type: Int) : Boolean

Check if type is container (catalog object which can hold other objects).

Параметры
  • type – Type to check.

Результат

True if this type belongs to container types.

static fun forceChildToTable(table: Object) : Table?

Force catalog object instance to table.

Параметры
  • table – Catalog object instance.

Результат

Table class instance or null.

static fun forceChildToFeatureClass(featureClass: Object) : FeatureClass?

Force catalog object instance to FeatureClass.

Параметры
  • featureClass – Catalog object instance.

Результат

FeatureClass class instance or null.

static fun forceChildToRaster(raster: Object) : Raster?

Force catalog object instance to raster.

Параметры
  • raster – Catalog object instance.

Результат

Raster class instance or null.

static fun forceChildToMemoryStore(memoryStore: Object) : MemoryStore?

Force catalog object instance to memory store.

Параметры
  • memoryStore – Catalog object instance.

Результат

MemoryStore class instance or null.

static fun forceChildToNGWResourceGroup(ngwResource: Object) : NGWResourceGroup?

Force catalog object instance to NextGIS Web resource group.

Параметры
  • ngwResource – Catalog object instance.

Результат

NGWResourceGroup class instance or null.

enum class Type

Catalog object types

  • UNKNOWN = 0

  • ROOT = 51

  • FOLDER = 53

  • CONTAINER_NGW = 63

  • CONTAINER_NGS = 64

  • CONTAINER_MEM = 71

  • CONTAINER_NGWGROUP = 3001

  • CONTAINER_NGWTRACKERGROUP = 3002

  • FC_GEOJSON = 507

  • FC_MEM = 509

  • FC_GPKG = 515

  • FC_GPX = 517

  • RASTER_TMS = 1011

  • TABLE_GPKG = 1507

  • NGW_TRACKER = 3018

class Catalog

Catalog is root object of virtual file system tree.

constructor(handle Long)

Main constructor

static fun getCurrentDirectory() : String

Get current directory

Результат

Get current directory. This is file system path

fun childByPath(path: String) : Object?

Get catalog child by file system path.

Параметры
  • path – File system path.

Результат

Catalog object class instance or nil.

fun createConnection(name: String, connection: ConnectionDescription, options: Map<String, String> = mapOf()) : Object?

Create connection at default directory corespondent to connection type (i.e. for NextGIS Web connection, the connection file will be created at ngc://GIS Server connections path.

Параметры
  • name – Connection file name.

  • connection – Connection object. Before create connection, execute check function for test connection.

  • options – Create options as key = value array.

Результат

Created connection object or null.

enum class RootObjects

Catalog root objects names

  • UNKNOWN

  • LOCAL_CONNECTIONS

  • GIS_CONNECTIONS

  • DB_CONNECTIONS

class ConnectionDescription

ConnectionDescription is class to store connection properties.

fun constructor(type: Object.Type, options: Map<String,  String>  mapOf())

Main constructor

Параметры
  • type – e Connection object type.

  • options – s Connection options as key = value map.

val type : Object.Type

e Connection object type.

val options : Map<String

s Connection options as key = value map.

fun check() : Boolean

Check if connection is valid.

Результат

true if connection is valid.