Documentation for maplib/Feature.kt

data class DateComponents

Date components class to transform from separate values of year, month, day, hour, minute and second to date.

fun constructor(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int, gmtOffset: Int)

Main constructor

Parameters
  • year – r Year value

  • month – h Month value

  • day – y Day value

  • hour – r Hour value

  • minute – e Minute value

  • second – d Second value

  • gmtOffset – t Time zone offset value

val year : Int

r Year value

val month : Int

h Month value

val day : Int

y Day value

val hour : Int

r Hour value

val minute : Int

e Minute value

val second : Int

d Second value

val gmtOffset : Int

t Time zone offset value

fun toDate() : Date

Transform to date class.

Returns

Date class instance.

class Feature

Feature or row.

fun constructor(handle: Long, table: Table)

Main constructor

Parameters
  • handle – e Feature handle for C API.

  • table – e Table the feature belongs to.

val handle : Long

e Feature handle for C API.

val table : Table

e Table the feature belongs to.

val id : Long

Feature/row identifier.

var geometry : Geometry?

Feature/row geometry.

fun isFieldSet(index: Int) : Boolean

Check if field set.

Parameters
  • index – Field index.

Returns

True if field set.

fun getFieldAsInteger(index: Int) : Int

Get field integer value.

Parameters
  • index – Field index.

Returns

Field value.

fun getFieldAsDouble(index: Int) : Double

Get field double value.

Parameters
  • index – Field index.

Returns

Field value.

fun getFieldAsString(index: Int) : String

Get field string value.

Parameters
  • index – Field index.

Returns

Field value.

fun getFieldAsDateTime(index: Int) : Date

Get field value.

Parameters
  • index – Field index.

Returns

Field value.

fun setField(index: Int, value: String)

Set field value.

Parameters
  • index – Field index.

  • value – Value to set.

fun setField(index: Int, value: Double)

Set field value.

Parameters
  • index – Field index.

  • value – Value to set.

fun setField(index: Int, value: Int)

Set field value.

Parameters
  • index – Field index.

  • value – Value to set.

fun setField(index: Int, value: Date)

Set field value.

Parameters
  • index – Field index.

  • value – Value to set.

fun createGeometry() : Geometry?

Create new geometry. The type of geometry will be corespondent to feature class geometry type.

Returns

Geometry class instance or null.

fun getAttachment(aid: Long) : Attachment?

Get attachment.

Parameters
  • aid – Attachment identifier.

Returns

Attachment class instance or null.

fun getAttachments() : Array<Attachment>

Get all attachments.

Returns

Attachment array.

fun addAttachment(name: String, description: String, path: String, move: Boolean, remoteId: Long = -1, logEdits: Boolean = true) : Long

Add new attachment.

Parameters
  • name – Name.

  • description – Description text.

  • path – File system path.

  • move – If true the attachment file will be

  • remoteId – Remote identifier.

  • logEdits – Log edits in history table. This log can be received using editOperations function.

Returns

New attachment identifier.

fun deleteAttachment(aid: Long, logEdits: Boolean = true) : Boolean

Delete attachment.

Parameters
  • aid – Attachment identifier.

  • logEdits – Log edits in history table. This log can be received using editOperations function.

Returns

True on success.

fun deleteAttachment(attachment: Attachment, logEdits: Boolean = true) : Boolean

Delete attachment.

Parameters
  • attachment – Attachment class instance.

  • logEdits – Log edits in history table. This log can be received using editOperations function.

Returns

True on success.

fun delete() : Boolean

Delete feature.

Returns

True on success.

class Attachment

Attachment class. A file added to the feature/row

fun constructor(handle: Long = 0, id: Long, name: String, description: String, path: String, size: Long, remoteIdVal: Long)

Main constructor

Parameters
  • handle – e Handle of attachment or 0 for new one.

  • id – d Attachment id.

  • name – e Attachment name.

  • description – n Attachment description.

  • path – h Attachment file path in file system.

  • size – e Attachment file size.

val handle : Long = 0

e Handle of attachment or 0 for new one.

val id : Long

d Attachment id.

val name : String

e Attachment name.

val description : String

n Attachment description.

val path : String

h Attachment file path in file system.

val size : Long

e Attachment file size.

fun isFileAvailable() : Boolean

Is attachment file available on disk.

Returns

True of file exists.

fun update(name: String, description: String, logEdits: Boolean = true) : Boolean

Update attachment. Only name and description can be updated. To change attachment file, just delete attachment and create new one.

Parameters
  • name – New attachment name.

  • description – New attachment description.

  • logEdits – Log edits in history table. This log can be received using editOperations function.

Returns

True on success.