GLMapTrackData


@interface GLMapTrackData : NSObject

GLMapTrackData class holds data for track and information to optimize draw at different zoom levels. Data stored without connection to mapView and could be added on different GLMapView at the same time.

  • Not used.

    Declaration

    Objective-C

    - (instancetype _Nonnull)init;
  • Initalizes GLMapTrackData with array of points

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithPoints:(const GLTrackPoint *_Nonnull)points
                                       count:(NSUInteger)count;

    Parameters

    points

    Track point array

    count

    Size of point array

    Return Value

    A new track data object

  • Initializes GLMapTrackData with points that retured by pointsCallback

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithPointsCallback:
                                  (GLMapTrackPointsCallback _Nonnull)pointsCallback
                                               count:(NSUInteger)count;

    Parameters

    pointsCallback

    Callback block used to fill track points data

    count

    Number of times callback is called. If zero callback will be called until it will return NO

    Return Value

    A new track data object

  • Copies points from given GLMapTrackData and merges segments if needed.

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithData:(GLMapTrackData *_Nonnull)data
                             mergeSegments:(BOOL)mergeSegments;

    Parameters

    data

    Source object with points

    mergeSegments

    If YES, it tries to merge line segments into single line during construction. Otherwise it just retains data contents.

    Return Value

    A new track data object

  • Copies points from given GLMapTrackData and add new point to track.

    When frequently updated track is displayed is a good idea to add new points into small segments. Up to 100 points per segment. And then merge segments together. Track uses optimized Ramer-Douglas-Peucker, but it’s still can have O(n^2) complexity in worst case. With described solution GLMap could record tracks up to million points.

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithData:(GLMapTrackData *_Nonnull)data
                               andNewPoint:(GLTrackPoint)pt
                           startNewSegment:(BOOL)startNewSegment;

    Parameters

    data

    Source object with points

    pt

    New point to be added

    startNewSegment

    If YES new segment will be created

    Return Value

    A new track data object

  • Creates new copy of track data with merged segments that have same start/end points.

    Declaration

    Objective-C

    - (instancetype _Nullable)trackDataWithMergedSegments;

    Return Value

    A new track data object

  • Declaration

    Objective-C

    - (GLMapBBox)bbox;

    Return Value

    Bounding box of track

  • Declaration

    Objective-C

    - (BOOL)isEmpty;

    Return Value

    YES if track have no points

  • Declaration

    Objective-C

    - (size_t)segmentCount;

    Return Value

    Count of lines inside this GLMapTrackData