GLMapVectorObject

Objective-C


@interface GLMapVectorObject : GLMapTagsContainer <NSCopying>

Swift

class GLMapVectorObject : GLMapTagsContainer, NSCopying

GLMapVectorObject is a bridge class to work with GLMap’s internal representation of a vector object.

Properties

  • Reference point of the object in internal map coordinates. For point objects, this is the point itself. For lines/polygons, this is a representative point used for labeling/search.

    Declaration

    Objective-C

    @property (readonly) GLMapPoint point;

    Swift

    var point: GLMapPoint { get }
  • Bounding box of the object (internal map coordinates).

    Declaration

    Objective-C

    @property (readonly) GLMapBBox bbox;

    Swift

    var bbox: GLMapBBox { get }
  • Resolved draw attributes after last update.

    Declaration

    Objective-C

    @property (copy) GLMapVectorStyle *_Nullable drawAttributes;

    Swift

    @NSCopying var drawAttributes: GLMapVectorStyle? { get set }

Static Methods

  • Creates an array of vector objects from GeoJSON data.

    Declaration

    Objective-C

    + (GLMapVectorObjectArray *_Nullable)
        createVectorObjectsFromGeoJSONData:(nonnull NSData *)geoJSONData
                                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func createVectorObjects(fromGeoJSONData geoJSONData: Data) throws -> GLMapVectorObjectArray

    Parameters

    geoJSONData

    GeoJSON data.

    error

    Output: error if parsing fails.

    Return Value

    Array of vector objects, or nil on error.

  • Creates an array of vector objects from a GeoJSON string.

    Declaration

    Objective-C

    + (GLMapVectorObjectArray *_Nullable)
        createVectorObjectsFromGeoJSON:(nonnull NSString *)geoJSON
                                 error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func createVectorObjects(fromGeoJSON geoJSON: String) throws -> GLMapVectorObjectArray

    Parameters

    geoJSON

    GeoJSON string.

    error

    Output: error if parsing fails.

    Return Value

    Array of vector objects, or nil on error.

  • Creates an array of vector objects from a GeoJSON file.

    Declaration

    Objective-C

    + (GLMapVectorObjectArray *_Nullable)
        createVectorObjectsFromFile:(nonnull NSString *)filePath
                              error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func createVectorObjects(fromFile filePath: String) throws -> GLMapVectorObjectArray

    Parameters

    filePath

    Path to a GeoJSON file.

    error

    Output: error if parsing fails.

    Return Value

    Array of vector objects, or nil on error.

  • Streamed parsing of a GeoJSON file.

    Declaration

    Objective-C

    + (BOOL)enumVectorObjectsFromFile:(nonnull NSString *)filePath
                          objectBlock:(nonnull GLMapVectorObjectBlock)objectBlock
                                error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func enumVectorObjects(fromFile filePath: String, objectBlock: @escaping GLMapVectorObjectBlock) throws

    Parameters

    filePath

    Path to a GeoJSON file.

    objectBlock

    Block called for each parsed object.

    error

    Output: error if parsing fails.

    Return Value

    YES if parsing succeeds, otherwise NO.

Methods

  • Finds the nearest point on the object to the given point.

    Declaration

    Objective-C

    - (BOOL)findNearestPoint:(nonnull GLMapPoint *)nearestPoint
                     toPoint:(GLMapPoint)point
                 maxDistance:(CGFloat)distance;

    Swift

    func findNearestPoint(_ nearestPoint: UnsafeMutablePointer<GLMapPoint>, to point: GLMapPoint, maxDistance distance: CGFloat) -> Bool

    Parameters

    nearestPoint

    Output: nearest point on the object (internal map coordinates).

    point

    Reference point (internal map coordinates).

    distance

    Maximum search distance in internal map units.

    Return Value

    YES if a point within distance is found, otherwise NO.

  • Compare with other object.

    Declaration

    Objective-C

    - (NSComparisonResult)compare:(nonnull id)object;

    Swift

    func compare(_ object: Any) -> ComparisonResult
  • Useful for debugging.

    Declaration

    Objective-C

    - (nonnull NSString *)debugDescription;

    Swift

    func debugDescription() -> String
  • GeoJSON representation of the vector object.

    Declaration

    Objective-C

    - (nonnull NSString *)asGeoJSON;

    Swift

    func asGeoJSON() -> String

GLSearch