Package globus.glmap
Class GLMapVectorObject
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapVectorObject
- All Implemented Interfaces:
GLMapTagsContainer,AutoCloseable
A bridge class for working with GLMap's internal representation of a vector object.
A vector object may represent a point, line, or polygon and can be created from GeoJSON or
built programmatically (see the create* methods).
-
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) Compares objects for sorting.voidcopyProperties(GLMapTagsContainer other) Copies all properties from another tags container object.static ObjectcreateFromGeoJSONOrError(String geoJSON) Creates vector objects from a GeoJSON string.static GLMapVectorObjectListcreateFromGeoJSONOrThrow(String geoJSON) Create objects from geo-json string throws if error happensstatic ObjectCreates vector objects from a GeoJSON stream.static GLMapVectorObjectListCreate objects from geo-json streamstatic GLMapVectorObjectcreateGeoLine(MapGeoPoint start, MapGeoPoint end, double quality) Creates a great-circle line fromstarttoend.static GLMapVectorObjectcreateGeoPoint(MapGeoPoint point) Creates a vector object with point geometry in geographic coordinates (WGS84 degrees).static GLMapVectorObjectcreateMultiline(MapPoint[][] multilinePoints) Creates a vector object with multiline geometry from internal map coordinates.static GLMapVectorObjectcreateMultilineGeo(MapGeoPoint[][] multilinePoints) Creates a vector object with multiline geometry in geographic coordinates (WGS84 degrees).static GLMapVectorObjectcreatePoint(MapPoint point) Creates a vector object with point geometry in internal map coordinates.static GLMapVectorObjectcreatePolygon(MapPoint[][] polygon) Creates a vector object with polygon geometry from internal map coordinates.static GLMapVectorObjectcreatePolygonGeo(MapGeoPoint[][] polygon) Creates a vector object with polygon geometry in geographic coordinates (WGS84 degrees).booleangetBBox()Retrieves the bounding box of this vector object.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 attributesvalueForKey(String key) Returns value for the keyvaluesForKey(String key) Returns values for the keyMethods inherited from class globus.glmap.GLNativeObject
close, dispose
-
Field Details
-
drawAttributes
Draw attributes of object. Filled by updateDrawAttributes functions.
-
-
Method Details
-
compare
Compares objects for sorting.- Parameters:
other- other object- Returns:
- a negative value if this object is less than
other,0if they are equal, or a positive value if this object is greater thanother
-
hashCode
public int hashCode() -
equals
-
createFromGeoJSONOrError
Creates vector objects from a GeoJSON string.- Parameters:
geoJSON- source string with geo JSON data- Returns:
GLMapVectorObjectListon success, orGLMapErroron failure
-
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 vector objects from a GeoJSON stream.- Parameters:
geoJSON- stream with geo JSON data- Returns:
GLMapVectorObjectListon success, orGLMapErroron failure
-
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
Creates a vector object with multiline geometry from internal map coordinates.MapPoint[] line1 = { MapPoint.CreateFromGeoCoordinates(53.8869, 27.7151), // Minsk MapPoint.CreateFromGeoCoordinates(50.4339, 30.5186), // Kyiv }; MapPoint[] line2 = { MapPoint.CreateFromGeoCoordinates(52.3690, 4.9021), // Amsterdam MapPoint.CreateFromGeoCoordinates(50.8263, 4.3458), // Brussels }; GLMapVectorObject obj = GLMapVectorObject.createMultiline(new MapPoint[][] {line1, line2});- Parameters:
multilinePoints- Multiline points in internal map coordinates.- Returns:
- Created vector object with multiline geometry.
- See Also:
-
createMultilineGeo
@NonNull public static GLMapVectorObject createMultilineGeo(@NonNull MapGeoPoint[][] multilinePoints) Creates a vector object with multiline geometry in geographic coordinates (WGS84 degrees).- Parameters:
multilinePoints- Multiline points in geographic coordinates.- Returns:
- Created vector object with multiline geometry.
-
createPoint
Creates a vector object with point geometry in internal map coordinates.- Parameters:
point- Point in internal map coordinates.- Returns:
- Created vector object with point geometry.
- See Also:
-
createGeoPoint
Creates a vector object with point geometry in geographic coordinates (WGS84 degrees).- Parameters:
point- Point in geographic coordinates.- Returns:
- Created vector object with point geometry.
-
createPolygon
Creates a vector object with polygon geometry from internal map coordinates.MapPoint[][] polygon = {outerRing1, innerRing1, innerRing2}; GLMapVectorObject polygon = GLMapVectorObject.createPolygon(polygon);- Parameters:
polygon- first array is outer ring next is inner rings- Returns:
- Created vector object with polygon geometry.
- See Also:
-
createPolygonGeo
Creates a vector object with polygon geometry in geographic coordinates (WGS84 degrees).- Parameters:
polygon- first array is outer ring next is inner rings- Returns:
- Created vector object with polygon geometry
-
createGeoLine
@NonNull public static GLMapVectorObject createGeoLine(@NonNull MapGeoPoint start, @NonNull MapGeoPoint end, double quality) Creates a great-circle line fromstarttoend. Useful to display plane routes.- Parameters:
start- Start pointend- End pointquality- Maximum distance from point to line, used for simplification in Douglas Peucker algorithm. Units are internal map 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.
-
asGeoJSON
Serialize object as GeoJSON- Returns:
- GeoJSON string
-
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 GLMapVectorCascadeStyle style, @NonNull GLMapLocaleSettings localeSettings, int zoomLevel) Updates draw attributes- Parameters:
style- style of objectlocaleSettings- locale settingszoomLevel- zoom to test- Returns:
- true if visible
-