Package globus.glmap
Class GLMapVectorObject
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapVectorObject
- All Implemented Interfaces:
GLMapTagsContainer
GLMapVectorObject is a bridge class, to work with GLMap internal representation of
vector object.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines the types of vector objects. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionSerialize object as GeoJSONintcompare(GLMapVectorObject other) Compare objects for sortingvoidcopyProperties(GLMapTagsContainer other) Copies all properties from another tags container object.static ObjectcreateFromGeoJSONOrError(String geoJSON) Creates an array of GLMapVectorObject from stringstatic GLMapVectorObjectListcreateFromGeoJSONOrThrow(String geoJSON) Create objects from geo-json string throws if error happensstatic ObjectCreates an array of GLMapVectorObject from streamstatic GLMapVectorObjectListCreate objects from geo-json streamstatic GLMapVectorObjectcreateGeoLine(MapGeoPoint start, MapGeoPoint end, double quality) Adds big circle line from `start` to `end`.static GLMapVectorObjectcreateGeoPoint(MapGeoPoint point) Create vector object with point geometrystatic GLMapVectorObjectcreateMultiline(MapPoint[][] multilinePoints) Loads multiline geometry to vector objectstatic GLMapVectorObjectcreateMultilineGeo(MapGeoPoint[][] multilinePoints) Creates vector object with multiline geometrystatic 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) Creates vector object with polygon geometrybooleanfindNearestPoint(GLMapViewRenderer renderer, MapPoint point, double distanceInPoints) Calculates nearest point of vector object from given pointgetBBox()Retrieves the bounding box of this vector object.MapGeoPoint[][]Retrieves the geo-referenced points of a multiline for an object whose type isGLMapVectorObject.Type.Line.MapPoint[][]Retrieves the points of a multiline for an object whose type isGLMapVectorObject.Type.Line.intgetType()Retrieves the type of this vector object.inthashCode()localizedName(GLMapLocaleSettings localeSettings) Returns localized name.point()Retrieves a point associated with this vector object.voidsetValueForKey(String key, String value) Sets value for keybooleanupdateDrawAttributes(GLMapVectorCascadeStyle style, GLMapLocaleSettings localeSettings, int zoomLevel) Updates draw attributesbooleanupdateDrawAttributes(GLMapViewRenderer mapView) Updates draw attributesbooleanupdateDrawAttributes(GLMapViewRenderer mapView, GLMapVectorCascadeStyle style) Updates draw attributesvalueForKey(String key) Returns value for the keyvaluesForKey(String key) Returns values for the keyMethods inherited from class globus.glmap.GLNativeObject
dispose
-
Field Details
-
drawAttributes
Draw attributes of object. Filled by updateDrawAttributes functions.
-
-
Method Details
-
compare
Compare objects for sorting- Parameters:
other- other object- Returns:
- 0 if objects are equal. -1 if other is greater. 1 if other is less.
-
hashCode
public int hashCode() -
equals
-
createFromGeoJSONOrError
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(@NonNull String geoJSON) throws Exception Create objects from geo-json string throws if error happens- Parameters:
geoJSON- geo-json string- Returns:
- vector objects
- Throws:
Exception- if error happens
-
createFromGeoJSONStreamOrError
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(@NonNull InputStream geoJSON) throws Exception Create objects from geo-json stream- Parameters:
geoJSON- geo-json stream- Returns:
- vector objects
- Throws:
Exception- if an error happens
-
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
@NonNull public static GLMapVectorObject createMultilineGeo(@NonNull MapGeoPoint[][] multilinePoints) Creates vector object with multiline geometry- Parameters:
multilinePoints- geo points of multiline- Returns:
- vector object with multiline
-
createPoint
Loads point to vector object- Parameters:
point- Data to load to vector object- Returns:
- Created vector object with multiline
-
createGeoPoint
Create vector object with point geometry- Parameters:
point- point of object- Returns:
- vector object with point geometry
-
createPolygon
@NonNull public static GLMapVectorObject createPolygon(@NonNull 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(@NonNull MapGeoPoint[][] outerRings, @Nullable MapGeoPoint[][] innerRings) Creates vector object with polygon geometry- Parameters:
outerRings- outer rings of polygoninnerRings- inner tings of polygon- Returns:
- Created vector object with polygon geometry
-
createGeoLine
@NonNull public static GLMapVectorObject createGeoLine(@NonNull MapGeoPoint start, @NonNull MapGeoPoint 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()Retrieves the type of this vector object.- Returns:
- The type of the object, which can be one of the constants defined in
GLMapVectorObject.Type.
-
point
Retrieves a point associated with this vector object.- Returns:
- A
MapPointrepresenting a point belonging to the object.
-
getBBox
Retrieves the bounding box of this vector object.- Returns:
- A
GLMapBBoxrepresenting the object's bounding box.
-
getMultilinePoints
Retrieves the points of a multiline for an object whose type isGLMapVectorObject.Type.Line.- Returns:
- A two-dimensional array of
MapPointobjects, ornullif the object is not of typeGLMapVectorObject.Type.Line.
-
getMultilineGeoPoints
Retrieves the geo-referenced points of a multiline for an object whose type isGLMapVectorObject.Type.Line.- Returns:
- A two-dimensional array of
MapGeoPointobjects, ornullif the object is not of typeGLMapVectorObject.Type.Line.
-
asGeoJSON
Serialize object as GeoJSON- Returns:
- GeoJSON string
-
findNearestPoint
@Nullable public MapPoint findNearestPoint(@NonNull GLMapViewRenderer renderer, @NonNull MapPoint point, double distanceInPoints) Calculates nearest point of vector object from given point- Parameters:
renderer- 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
Description copied from interface:GLMapTagsContainerReturns value for the key- Specified by:
valueForKeyin interfaceGLMapTagsContainer- Parameters:
key- Key of requested value- Returns:
- value associated with given key. (if loaded from geo JSON get values from "properties" section)
-
valuesForKey
Description copied from interface:GLMapTagsContainerReturns values for the key- Specified by:
valuesForKeyin interfaceGLMapTagsContainer- Parameters:
key- Key of requested values- Returns:
- array of values associated with given key
-
setValueForKey
Description copied from interface:GLMapTagsContainerSets value for key- Specified by:
setValueForKeyin interfaceGLMapTagsContainer- Parameters:
key- Key of valuevalue- value to set
-
localizedName
Description copied from interface:GLMapTagsContainerReturns localized name.- Specified by:
localizedNamein interfaceGLMapTagsContainer- Parameters:
localeSettings- locale settings to use- Returns:
- name of object
-
copyProperties
Description copied from interface:GLMapTagsContainerCopies all properties from another tags container object.- Specified by:
copyPropertiesin interfaceGLMapTagsContainer- Parameters:
other- Other tags container.
-
updateDrawAttributes
public boolean updateDrawAttributes(@NonNull GLMapViewRenderer mapView, @Nullable GLMapVectorCascadeStyle style) 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
public boolean updateDrawAttributes(@NonNull GLMapVectorCascadeStyle style, @NonNull GLMapLocaleSettings localeSettings, int zoomLevel) Updates draw attributes- Parameters:
style- style of objectlocaleSettings- locale settingszoomLevel- zoom to test- Returns:
- true if visible
-
updateDrawAttributes
Updates draw attributes- Parameters:
mapView- view where object is displayed- Returns:
- true if visible
-