Package globus.glmap
Class GLMapTrackData
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapTrackData
@ParametersAreNonnullByDefault public class GLMapTrackData extends GLNativeObject
GLMapTrackData holds data for track-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGLMapTrackData.PointsCallbackCallback for filling track data -
Constructor Summary
Constructors Constructor Description GLMapTrackData(GLMapTrackData.PointsCallback pointsCallback, int size)Constructor with callbackGLMapTrackData(java.util.List data)Constructor from raw data -
Method Summary
Modifier and Type Method Description GLMapTrackDatacopyTrackAndAddGeoPoint(double lat, double lon, int color, boolean startNewSegment)Copies points to new track and add new point to track.GLMapTrackDatacopyTrackAndAddPoint(double x, double y, int color, boolean startNewSegment)Copies points to new track and add new point to track.MapPointfindNearestPoint(GLMapView mapView, MapPoint point, double distanceInPoints)Calculates nearest point on track from given pointGLMapBBoxgetBBox()Retrurns bbox of trackintgetByteCount()Size of internal data of GLMapTrackData.static voidsetPointData(long nativePoint, int x, int y, int color)Sets data for native point.static voidsetPointDataGeo(long nativePoint, double lat, double lon, int color)Sets data for native point.
-
Constructor Details
-
GLMapTrackData
Constructor with callback- Parameters:
pointsCallback- callback that will provide information about pointssize- number of points in track
-
GLMapTrackData
public GLMapTrackData(java.util.List data)Constructor from raw data- Parameters:
data- List of byte arrays with raw data. Each element of this array defines track segment
-
-
Method Details
-
setPointData
public static void setPointData(long nativePoint, int x, int y, int color)Sets data for native point. Coordinates are in internal format- Parameters:
nativePoint- nativePoint passed to callbackx- x coordinate of pointy- y coordinate of pointcolor- color of track at this point
-
setPointDataGeo
public static void setPointDataGeo(long nativePoint, double lat, double lon, int color)Sets data for native point. Coordinates are in geo format.- Parameters:
nativePoint- nativePoint passed to callbacklat- latitude of pointlon- longitude of pointcolor- color of track at this point
-
getByteCount
public int getByteCount()Size of internal data of GLMapTrackData.- Returns:
- Size of internal data of GLMapTrackData.
-
getBBox
Retrurns bbox of track- Returns:
- bbox of track
-
copyTrackAndAddPoint
@NonNull public GLMapTrackData copyTrackAndAddPoint(double x, double y, int color, boolean startNewSegment)Copies points to new track 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.- Parameters:
x- x coordinatey- y coordinatecolor- color at pointstartNewSegment- If YES new segment will be created- Returns:
- A new track data object
-
copyTrackAndAddGeoPoint
@NonNull public GLMapTrackData copyTrackAndAddGeoPoint(double lat, double lon, int color, boolean startNewSegment)Copies points to new track 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.- Parameters:
lat- latitude coordinatelon- longitude coordinatecolor- color at pointstartNewSegment- If YES new segment will be created- Returns:
- A new track data object
-
findNearestPoint
@Nullable public MapPoint findNearestPoint(GLMapView mapView, MapPoint point, double distanceInPoints)Calculates nearest point on track from given point- Parameters:
mapView- MapView where track is displayedpoint- Point from where calculate nearest pointdistanceInPoints- maximum distance from track in points- Returns:
- nearest point on track from given point or null if track is too far from given point
-