API Docs for: 7.2
Show:

MQA.TKObjectCollection Class

Module: MQA

Basic collection with utility methods. This is also aliases as MQA.LatLngCollection. TODO: rationalize the name of this collection to remove aliasing -jsypher

Constructor

MQA.TKObjectCollection

()

Properties

bestFit

Boolean

Should this collection participate in best fitting on the map, defaults to true Example: routes & pois should, traffic markets should not

collectionName

String

Name of this collection, blank by default.

guid

String

Unique id for object

items

Array

Items contained in this collection

Methods

add

(
  • obj
)
Number

Adds an object to the collection. Calls collection's _onAdd method if defined.

Parameters:

  • obj Object

    Object to be added

Returns <Number>

the new length of the collection

append

(
  • collToAppend
)

Appends the specified TKObjectCollection to this TKObjectCollection.

Parameters:

contains

(
  • item
)
Boolean

Function to test if object is in collection.

Parameters:

  • item Object

    The object to test.

Returns <Boolean>

true if object is contained in the collection

getAt

(
  • index
)
Object

Returns an object at the specified index.

Parameters:

  • index Number

    The index of the item to retrieve

Returns <Object>

object stored at the index

getById

(
  • strId
)
Object | Null

Returns an object with the specified ID.

Parameters:

  • strId String

    The ID of the item to retrieve

Returns <Object | Null>

The object if found, otherwise null.

getItemIndex

(
  • item
)
Number | Boolean

Returns the index of the specified item in the collection.

Parameters:

  • item Object

    The item to find the index for.

Returns <Number | Boolean>

If the item is found its index is returned, otherwise returns false. TODO: Should probably return -1 instead of false to have consistent return typing

getName

() String

Returns the name of the collection

Returns <String>

name of collection

getSize

() Number

Returns the size of the Collection

Returns <Number>

the size of the collection.

remove

(
  • index
)
Object

Removes an object at specified index. Calls collection's _onRemove method if defined.

Parameters:

  • index Number

    Index of the item to be removed.

Returns <Object>

the object at the specified index

removeAll

()

Remove all elements from collection.

removeItem

(
  • item
)

Remove an item by its pointer.

Parameters:

  • item Object

    The item to remove

setName

(
  • n
)

Sets the name of the collection.

Parameters: