Package globus.glmap
Class GLMapVectorObject
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapVectorObject
@ParametersAreNonnullByDefault public class GLMapVectorObject extends GLNativeObject
GLMapVectorObject is a bridge class, to work with GLMap internal representation of vector object.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGLMapVectorObject.Type -
Field Summary
Fields Modifier and Type Field Description GLMapDrawAttributesdrawAttributes -
Method Summary
Modifier and Type Method Description java.lang.StringasGeoJSON()Serialize object as GeoJSONintcompare(GLMapVectorObject other)static java.lang.ObjectcreateFromGeoJSONOrError(java.lang.String geoJSON)Creates an array of GLMapVectorObject from stringstatic GLMapVectorObjectListcreateFromGeoJSONOrThrow(java.lang.String geoJSON)static java.lang.ObjectcreateFromGeoJSONStreamOrError(java.io.InputStream geoJSON)Creates an array of GLMapVectorObject from streamstatic GLMapVectorObjectListcreateFromGeoJSONStreamOrThrow(java.io.InputStream geoJSON)static GLMapVectorObjectcreateGeoLine(MapPoint start, MapPoint end, double quality)Adds big circle line from `start` to `end`.static GLMapVectorObjectcreateGeoPoint(MapGeoPoint point)static GLMapVectorObjectcreateMultiline(MapPoint[][] multilinePoints)Loads multiline geometry to vector objectstatic GLMapVectorObjectcreateMultilineGeo(MapGeoPoint[][] multilinePoints)static GLMapVectorObjectcreatePoint(MapPoint point)Loads point to vector objectstatic GLMapVectorObjectcreatePolygon(MapPoint[][] outerRings, MapPoint[][] innerRings)Loads polygon geometry to vector object.static GLMapVectorObjectcreatePolygonGeo(MapGeoPoint[][] outerRings, MapGeoPoint[][] innerRings)booleanequals(java.lang.Object other)MapPointfindNearestPoint(GLMapView mapView, MapPoint point, double distanceInPoints)Calculates nearest point of vector object from given pointGLMapBBoxgetBBox()Returns bbox of objectMapGeoPoint[][]getMultilineGeoPoints()MapPoint[][]getMultilinePoints()Returns points of multiline for object with type of TYPE_LINEintgetType()Returns type of objectinthashCode()java.lang.StringlocalizedName(GLMapLocaleSettings localeSettings)Returns localized name.MapPointpoint()voidsetValueForKey(java.lang.String key, java.lang.String value)Sets value for keyandroid.text.SpannableStringspannedName(java.lang.Object normal, java.lang.Object highlighted, int flags, GLMapLocaleSettings localeSettings)Returns spanned name where parts that matched search are highlighted.booleanupdateDrawAttributes(GLMapView mapView)Updates draw attributesbooleanupdateDrawAttributes(GLMapView mapView, GLMapVectorCascadeStyle style)Updates draw attributesjava.lang.StringvalueForKey(java.lang.String key)Returns value for the keyjava.lang.String[]valuesForKey(java.lang.String key)Returns values for the keyMethods inherited from class globus.glmap.GLNativeObject
disposeMethods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
drawAttributes
-
-
Method Details
-
compare
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)- Overrides:
equalsin classjava.lang.Object
-
createFromGeoJSONOrError
public static java.lang.Object createFromGeoJSONOrError(java.lang.String geoJSON)Creates an array of GLMapVectorObject from string- Parameters:
geoJSON- source string with geo JSON data- Returns:
- objects constructed from geo JSON data
-
createFromGeoJSONOrThrow
public static GLMapVectorObjectList createFromGeoJSONOrThrow(java.lang.String geoJSON) throws java.lang.Exception- Throws:
java.lang.Exception
-
createFromGeoJSONStreamOrError
@Nullable public static java.lang.Object createFromGeoJSONStreamOrError(java.io.InputStream geoJSON)Creates an array of GLMapVectorObject from stream- Parameters:
geoJSON- stream with geo JSON data- Returns:
- objects constructed from geo JSON data
-
createFromGeoJSONStreamOrThrow
@Nonnull public static GLMapVectorObjectList createFromGeoJSONStreamOrThrow(java.io.InputStream geoJSON) throws java.lang.Exception- Throws:
java.lang.Exception
-
createMultiline
Loads multiline geometry to vector objectMapPoint[] line1 = new MapPoint[5]; line1[0] = new MapPoint(27.7151, 53.8869); // Minsk line1[1] = new MapPoint(30.5186, 50.4339); // Kiev line1[2] = new MapPoint(21.0103, 52.2251); // Warsaw line1[3] = new MapPoint(13.4102, 52.5037); // Berlin line1[4] = new MapPoint(2.3343, 48.8505); // Paris MapPoint[] line2 = new MapPoint[3]; line2[0] = new MapPoint(4.9021, 52.3690); // Amsterdam line2[1] = new MapPoint(4.3458, 50.8263); // Brussel line2[2] = new MapPoint(6.1296, 49.6072); // Luxembourg MapPoint[][] multiline = {line1, line2}; obj.loadMultiline(multiline);- Parameters:
multilinePoints- Data to load to vector object- Returns:
- Created vector object with multiline
-
createMultilineGeo
-
createPoint
Loads point to vector object- Parameters:
point- Data to load to vector object- Returns:
- Created vector object with multiline
-
createGeoPoint
-
createPolygon
@NonNull public static GLMapVectorObject createPolygon(MapPoint[][] outerRings, @Nullable MapPoint[][] innerRings)Loads polygon geometry to vector object.MapPoint[][] outerRings = {outerRing1, outerRing2}; MapPoint[][] innerRings = {innerRing}, innerRing2}; obj.loadPolygon(outerRings, innerRings);- Parameters:
outerRings- outer rings of polygon.innerRings- inner rings of polygons (holes).- Returns:
- Created vector object with polygon.
-
createPolygonGeo
@NonNull public static GLMapVectorObject createPolygonGeo(MapGeoPoint[][] outerRings, @Nullable MapGeoPoint[][] innerRings) -
createGeoLine
@NonNull public static GLMapVectorObject createGeoLine(MapPoint start, MapPoint end, double quality)Adds big circle line from `start` to `end`. Useful to display plane routes. Should be used only on empty `GLMapVectorObject`- Parameters:
start- Start pointend- End pointquality- Maximum distance from point to line, used for simplification in Douglas Peucker algorithm. Units is map internal coordinates.- Returns:
- Created vector object with geo-line.
-
getType
public int getType()Returns type of object- Returns:
- type of object
-
point
- Returns:
- some point that belongs to vector object.
-
getBBox
Returns bbox of object- Returns:
- bbox of object
-
getMultilinePoints
Returns points of multiline for object with type of TYPE_LINE- Returns:
- points of multiline
-
getMultilineGeoPoints
-
asGeoJSON
@Nullable public java.lang.String asGeoJSON()Serialize object as GeoJSON- Returns:
- GeoJSON string
-
findNearestPoint
@Nullable public MapPoint findNearestPoint(GLMapView mapView, MapPoint point, double distanceInPoints)Calculates nearest point of vector object 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
-
valueForKey
@Nullable public java.lang.String valueForKey(java.lang.String key)Returns value for the key- Parameters:
key- Key of requested value- Returns:
- value associated with given key. (if loaded from geo JSON get values from "properties" section)
-
valuesForKey
@Nullable public java.lang.String[] valuesForKey(java.lang.String key)Returns values for the key- Parameters:
key- Key of requested values- Returns:
- array of values associated with given key
-
setValueForKey
public void setValueForKey(java.lang.String key, @Nullable java.lang.String value)Sets value for key- Parameters:
key- Key of valuevalue- value to set
-
spannedName
@Nullable public android.text.SpannableString spannedName(java.lang.Object normal, java.lang.Object highlighted, int flags, GLMapLocaleSettings localeSettings)Returns spanned name where parts that matched search are highlighted.- Parameters:
normal- normal span (must support clone method)highlighted- highlighted span (must support clone method)flags- flag that is passed to setSpanlocaleSettings- locale settings to use- Returns:
- spanned name of object
-
localizedName
Returns localized name.- Parameters:
localeSettings- locale settings to use- Returns:
- spanned name of object
-
updateDrawAttributes
Updates draw attributes- Parameters:
mapView- view where object is displayedstyle- style of object or null to use map view style- Returns:
- true if visible
-
updateDrawAttributes
Updates draw attributes- Parameters:
mapView- view where object is displayed- Returns:
- true if visible
-