GLMapVectorObjectArray

Objective-C


@interface GLMapVectorObjectArray : NSObject

Swift

class GLMapVectorObjectArray : NSObject

GLMapVectorObjectArray is a fast and compact container for vector objects. It uses a C++ std::vector internally.

  • Initializes empty array

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()
  • Initializes empty array with given initial capacity

    Declaration

    Objective-C

    - (nonnull instancetype)initWithCapacity:(NSUInteger)capacity;

    Swift

    init(capacity: UInt)
  • Returns the object located at the specified index. If index is beyond the end of the array (that is, if index is greater than or equal to the value returned by count), an NSRangeException is raised.

    Declaration

    Objective-C

    - (nonnull GLMapVectorObject *)objectAtIndex:(NSUInteger)index;

    Swift

    func object(at index: UInt) -> GLMapVectorObject

    Parameters

    index

    An index within the bounds of the array.

    Return Value

    The object located at index.

  • Returns the object at the specified index. This method has the same behavior as the objectAtIndex: method. If index is beyond the end of the array (that is, if index is greater than or equal to the value returned by count), an NSRangeException is raised. You shouldn’t need to call this method directly. Instead, this method is called when accessing an object by index using subscripting.

    Declaration

    Objective-C

    - (nonnull GLMapVectorObject *)objectAtIndexedSubscript:(NSUInteger)index;

    Swift

    subscript(index: UInt) -> GLMapVectorObject { get }

    Parameters

    index

    An index within the bounds of the array.

    Return Value

    The object located at index.

  • The number of objects in the array.

    Declaration

    Objective-C

    @property (readonly) NSUInteger count;

    Swift

    var count: UInt { get }
  • Bounding box that contains all objects in the array.

    Declaration

    Objective-C

    @property (readonly) GLMapBBox bbox;

    Swift

    var bbox: GLMapBBox { get }
  • Adds object to array

    Declaration

    Objective-C

    - (void)addObject:(nonnull GLMapVectorObject *)object;

    Swift

    func add(_ object: GLMapVectorObject)
  • Inserts object to array at given index

    Declaration

    Objective-C

    - (void)insertObject:(nonnull GLMapVectorObject *)object
                 atIndex:(NSUInteger)index;

    Swift

    func insert(_ object: GLMapVectorObject, at index: UInt)
  • Inserts objects to array at given indexes

    Declaration

    Objective-C

    - (void)insertObjects:(nonnull NSArray<GLMapVectorObject *> *)objects
                atIndexes:(nonnull NSIndexSet *)indexSet;

    Swift

    func insert(_ objects: [GLMapVectorObject], at indexSet: IndexSet)
  • Removes object at given index

    Declaration

    Objective-C

    - (void)removeObjectAtIndex:(NSUInteger)index;

    Swift

    func removeObject(at index: UInt)
  • Removes object at given indexes

    Declaration

    Objective-C

    - (void)removeObjectsAtIndexes:(nonnull NSIndexSet *)indexSet;

    Swift

    func removeObjects(at indexSet: IndexSet)
  • Removes all objects from array

    Declaration

    Objective-C

    - (void)removeAllObjects;

    Swift

    func removeAllObjects()
  • Converts GLMapVectorObjectArray to NSArray

    Declaration

    Objective-C

    - (nonnull NSArray<GLMapVectorObject *> *)array;

    Swift

    func array() -> [GLMapVectorObject]
  • Clusters objects by distance.

    Declaration

    Objective-C

    - (nonnull NSArray<GLMapVectorObjectArray *> *)clusterWithRadius:(double)radius;

    Swift

    func cluster(withRadius radius: Double) -> [GLMapVectorObjectArray]

    Parameters

    radius

    Maximum distance between objects in the same cluster, in meters.

    Return Value

    An array of clusters, each represented as a GLMapVectorObjectArray.