Class Feature
- java.lang.Object
-
- org.openstreetmap.josm.data.imagery.vectortile.mapbox.Feature
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String[]
EMPTY_STRING_ARRAY
private java.util.List<CommandInteger>
geometry
The geometry of the feature.private static byte
GEOMETRY_FIELD
private static byte
GEOMETRY_TYPE_FIELD
private Geometry
geometryObject
private GeometryTypes
geometryType
The geometry type of the feature.private long
id
The id of the feature.private static byte
ID_FIELD
private static java.text.NumberFormat
NUMBER_FORMAT
The number format instance to use (using a static instance gets rid of quite o few allocations) Doing this reduced the allocations ofparseTagValue(String, Layer, int, List)
from 22.79% of parent to 12.2% of parent.private static byte
TAG_FIELD
private TagMap
tags
The tags of the feature.
-
Constructor Summary
Constructors Constructor Description Feature(Layer layer, ProtobufRecord protobufRecord)
Create a new Feature
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<CommandInteger>
getGeometry()
Get the geometry instructionsGeometry
getGeometryObject()
Get the an object with shapes for the geometryGeometryTypes
getGeometryType()
Get the geometry typelong
getId()
Get the id of the objectTagMap
getTags()
Get the tagsprivate static java.lang.String
parseTagValue(java.lang.String key, Layer layer, int number, java.util.List<java.lang.String> tagList)
Parse a tag valuejava.lang.String
toString()
-
-
-
Field Detail
-
ID_FIELD
private static final byte ID_FIELD
- See Also:
- Constant Field Values
-
TAG_FIELD
private static final byte TAG_FIELD
- See Also:
- Constant Field Values
-
GEOMETRY_TYPE_FIELD
private static final byte GEOMETRY_TYPE_FIELD
- See Also:
- Constant Field Values
-
GEOMETRY_FIELD
private static final byte GEOMETRY_FIELD
- See Also:
- Constant Field Values
-
NUMBER_FORMAT
private static final java.text.NumberFormat NUMBER_FORMAT
The number format instance to use (using a static instance gets rid of quite o few allocations) Doing this reduced the allocations ofparseTagValue(String, Layer, int, List)
from 22.79% of parent to 12.2% of parent.
-
EMPTY_STRING_ARRAY
private static final java.lang.String[] EMPTY_STRING_ARRAY
-
geometry
private final java.util.List<CommandInteger> geometry
The geometry of the feature. Required.
-
geometryType
private final GeometryTypes geometryType
The geometry type of the feature. Required.
-
id
private final long id
The id of the feature. Optional.
-
geometryObject
private Geometry geometryObject
-
-
Constructor Detail
-
Feature
public Feature(Layer layer, ProtobufRecord protobufRecord) throws java.io.IOException
Create a new Feature- Parameters:
layer
- The layer the feature is part of (required for tags)protobufRecord
- The record to create the feature from- Throws:
java.io.IOException
- - if an IO error occurs
-
-
Method Detail
-
parseTagValue
private static java.lang.String parseTagValue(java.lang.String key, Layer layer, int number, java.util.List<java.lang.String> tagList)
Parse a tag value- Parameters:
key
- The current key (ornull
, ifnull
, the returned value will be the new key)layer
- The layer with key/value informationnumber
- The number to get the value fromtagList
- The list to add the new value to- Returns:
- The new key (if
null
, then a value was parsed and added to tags)
-
getGeometry
public java.util.List<CommandInteger> getGeometry()
Get the geometry instructions- Returns:
- The geometry
-
getGeometryType
public GeometryTypes getGeometryType()
Get the geometry type- Returns:
- The
GeometryTypes
-
getId
public long getId()
Get the id of the object- Returns:
- The unique id in the layer, or 0.
-
getGeometryObject
public Geometry getGeometryObject()
Get the an object with shapes for the geometry- Returns:
- An object with usable geometry information
- Throws:
java.lang.IllegalArgumentException
- if the geometry object cannot be created because arguments are not understood or the shoelace formula returns 0 for a polygon ring.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-