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.
-
Unavailable
Please use inits with data.
Not used.
Declaration
Objective-C
- (instancetype _Nonnull)init; -
Initalizes
GLMapTrackDatawith array of pointsDeclaration
Objective-C
- (instancetype _Nullable)initWithPoints:(const GLTrackPoint *_Nonnull)points count:(NSUInteger)count;Parameters
pointsTrack point array
countSize of point array
Return Value
A new track data object
-
Initializes
GLMapTrackDatawith points that retured bypointsCallbackDeclaration
Objective-C
- (instancetype _Nullable)initWithPointsCallback: (GLMapTrackPointsCallback _Nonnull)pointsCallback count:(NSUInteger)count;Parameters
pointsCallbackCallback block used to fill track points data
countNumber 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
GLMapTrackDataand merges segments if needed.Declaration
Objective-C
- (instancetype _Nullable)initWithData:(GLMapTrackData *_Nonnull)data mergeSegments:(BOOL)mergeSegments;Parameters
dataSource object with points
mergeSegmentsIf YES, it tries to merge line segments into single line during construction. Otherwise it just retains
datacontents.Return Value
A new track data object
-
Copies points from given
GLMapTrackDataand 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
dataSource object with points
ptNew point to be added
startNewSegmentIf 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
YESif track have no points -
Declaration
Objective-C
- (size_t)segmentCount;Return Value
Count of lines inside this GLMapTrackData
-
Finds nearest point of track, to given point. Useful to find nearest point of track whe user tap.
Declaration
Objective-C
- (BOOL)findNearestPoint:(GLMapPoint *_Nonnull)point atMapView:(GLMapView *_Nonnull)mapView maxDistance:(CGFloat)distance;Parameters
pointPoint on map. If point was found this value will be set to nearest point
distanceMax distance from track allowed
Return Value
YES if point found, otherwise NO.
Install in Dash
GLMapTrackData Class Reference