Package globus.glmap
Class GLMapVectorObject
java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapVectorObject
- All Implemented Interfaces:
GLMapTagsContainer,AutoCloseable
- Direct Known Subclasses:
GLMapVectorLine,GLMapVectorPoint,GLMapVectorPolygon,GLMapVectorRelation
A bridge class for working with GLMap's internal representation of a vector object.
Instances are GLMapVectorPoint, GLMapVectorLine or GLMapVectorPolygon.
They are created from GeoJSON, by GeometryBuilder, or by the subclass constructors.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceType of a vector object; each type has its class (GLMapVectorPoint,GLMapVectorLine, …). -
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) Deprecated.static GLMapVectorObjectcreateGeoPoint(MapGeoPoint point) Deprecated.static GLMapVectorObjectcreateMultiline(MapPoint[][] multilinePoints) Deprecated.UseGeometryBuilder.addLine(MapPoint[])for each line.static GLMapVectorObjectcreateMultilineGeo(MapGeoPoint[][] multilinePoints) Deprecated.UseGeometryBuilder.addGeoLine(MapGeoPoint[])for each line.static GLMapVectorObjectcreatePoint(MapPoint point) Deprecated.static GLMapVectorObjectcreatePolygon(MapPoint[][] polygon) Deprecated.UseGeometryBuilder.beginPolygon()andGeometryBuilder.addLine(MapPoint[])for each ring.static GLMapVectorObjectcreatePolygonGeo(MapGeoPoint[][] polygon) Deprecated.UseGeometryBuilder.beginPolygon()andGeometryBuilder.addGeoLine(MapGeoPoint[])for each ring.booleangetBBox()Retrieves the bounding box of this vector object.intintgetLinePointCount(int lineIndex) Returns the number of points in the given line.intgetLinePointStart(int lineIndex) Returns the start index of the point range for the given line.voidgetPointAtIndex(int index, MapPoint outPoint) Fills the provided point object with the coordinates at the given absolute index.intintintgetPolygonLineCount(int polygonIndex) Returns the number of lines in the given polygon.intgetPolygonLineStart(int polygonIndex) Returns the start index of the line range for the given polygon.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
@Deprecated @NonNull public static GLMapVectorObject createMultiline(@NonNull MapPoint[][] multilinePoints) Deprecated.UseGeometryBuilder.addLine(MapPoint[])for each line. Will be removed in 2.4.0.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
@Deprecated @NonNull public static GLMapVectorObject createMultilineGeo(@NonNull MapGeoPoint[][] multilinePoints) Deprecated.UseGeometryBuilder.addGeoLine(MapGeoPoint[])for each line. Will be removed in 2.4.0.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
Deprecated.UseGLMapVectorPoint(MapPoint). Will be removed in 2.4.0.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
Deprecated.UseGLMapVectorPoint(MapPoint)withMapPoint(MapGeoPoint). Will be removed in 2.4.0.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
Deprecated.UseGeometryBuilder.beginPolygon()andGeometryBuilder.addLine(MapPoint[])for each ring. Will be removed in 2.4.0.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
@Deprecated @NonNull public static GLMapVectorObject createPolygonGeo(@NonNull MapGeoPoint[][] polygon) Deprecated.UseGeometryBuilder.beginPolygon()andGeometryBuilder.addGeoLine(MapGeoPoint[])for each ring. Will be removed in 2.4.0.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
@Deprecated @NonNull public static GLMapVectorObject createGeoLine(@NonNull MapGeoPoint start, @NonNull MapGeoPoint end, double quality) Deprecated.UseGLMapVectorLine(MapGeoPoint, MapGeoPoint, double). Will be removed in 2.4.0.Creates a great-circle line fromstarttoend. Useful to display plane routes.- Parameters:
start- Start pointend- End pointquality- subdivision step in meters: the line is split until its half-segments are shorter than this, into at most 65536 segments- 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.
-
getPointCount
public int getPointCount()- Returns:
- The total number of points in the geometry.
-
getLineCount
public int getLineCount()- Returns:
- The number of line segments (including polygon outlines) in the geometry.
-
getPolygonCount
public int getPolygonCount()- Returns:
- The number of polygons in the geometry.
-
getLinePointStart
public int getLinePointStart(int lineIndex) Returns the start index of the point range for the given line.- Parameters:
lineIndex- The index of the line (0 <= lineIndex < getLineCount()).- Returns:
- The absolute index of the first point of that line.
-
getLinePointCount
public int getLinePointCount(int lineIndex) Returns the number of points in the given line.- Parameters:
lineIndex- The index of the line (0 <= lineIndex < getLineCount()).- Returns:
- The count of points belonging to that line.
-
getPolygonLineStart
public int getPolygonLineStart(int polygonIndex) Returns the start index of the line range for the given polygon.- Parameters:
polygonIndex- The index of the polygon (0 <= polygonIndex < getPolygonCount()).- Returns:
- The index of the first line that makes up that polygon.
-
getPolygonLineCount
public int getPolygonLineCount(int polygonIndex) Returns the number of lines in the given polygon.- Parameters:
polygonIndex- The index of the polygon (0 <= polygonIndex < getPolygonCount()).- Returns:
- The count of lines belonging to that polygon.
-
getPointAtIndex
Fills the provided point object with the coordinates at the given absolute index.- Parameters:
index-0 <= index < getPointCount()outPoint- Pre-allocated GLMapPoint instance that will be filled.
-
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
-
GLMapVectorLine(MapGeoPoint, MapGeoPoint, double).