Package org.openstreetmap.josm.data.gpx
Class GpxExtension
java.lang.Object
org.openstreetmap.josm.data.gpx.WithAttributes
org.openstreetmap.josm.data.gpx.GpxExtension
- All Implemented Interfaces:
GpxConstants,IWithAttributes
A GpxExtension that has attributes and child extensions (implements
IWithAttributes and GpxConstants).- Since:
- 15496
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openstreetmap.josm.data.gpx.GpxConstants
GpxConstants.ColorFormat -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate IWithAttributesprivate final Stringprivate final Stringprivate Stringprivate booleanFields inherited from class org.openstreetmap.josm.data.gpx.WithAttributes
attrFields inherited from interface org.openstreetmap.josm.data.gpx.GpxConstants
EXTENSION_ABBREVIATIONS, FIX_VALUES, GARMIN_COLORS, GPX_CMT, GPX_DESC, GPX_NAME, GPX_PREFIX, GPX_SRC, JOSM_CREATOR_NAME, META_AUTHOR_EMAIL, META_AUTHOR_LINK, META_AUTHOR_NAME, META_BOUNDS, META_COPYRIGHT_AUTHOR, META_COPYRIGHT_LICENSE, META_COPYRIGHT_YEAR, META_DESC, META_KEYWORDS, META_LINKS, META_NAME, META_PREFIX, META_TIME, PT_AGEOFDGPSDATA, PT_COURSE, PT_DGPSID, PT_ELE, PT_FIX, PT_GEOIDHEIGHT, PT_HDOP, PT_MAGVAR, PT_PDOP, PT_SAT, PT_STD_HDEV, PT_STD_VDEV, PT_SYM, PT_TIME, PT_TYPE, PT_VDOP, RTE_TRK_KEYS, RTKLIB_AGE, RTKLIB_Q, RTKLIB_RATIO, RTKLIB_SDE, RTKLIB_SDEU, RTKLIB_SDN, RTKLIB_SDNE, RTKLIB_SDU, RTKLIB_SDUN, WPT_KEYS, XML_URI_EXTENSIONS_DRAWING, XML_URI_EXTENSIONS_GARMIN, XML_URI_EXTENSIONS_JOSM, XML_URI_XSD, XML_XSD_EXTENSIONS_DRAWING, XML_XSD_EXTENSIONS_GARMIN, XML_XSD_EXTENSIONS_JOSM -
Constructor Summary
ConstructorsConstructorDescriptionGpxExtension(String prefix, String key, String value) Constructs a newGpxExtension.GpxExtension(String namespaceURI, String qName, Attributes atts) Creates a newGpxExtension -
Method Summary
Modifier and TypeMethodDescriptionbooleanfindExtension(String sPrefix, String sKey) Searches recursively for the extension with the given key in all childrenstatic GpxData.XMLNamespacefindNamespace(String prefix) Finds the namespace for the given default prefix, if supported with schema locationstatic StringfindPrefix(String namespaceURI) Finds the default prefix used by JOSM for the given namespaceURI as the document is free specify another one.Returns the flattened extension key of this extension.getKey()Returns the key (local element name) of the extension.Returns the parent element of this extension.Returns the prefix of the XML namespace.Returns the qualified name of the XML element.getValue()Returns the value of the extension.inthashCode()voidhide()Hides this extension and all then-empty parents so it isn't writtenbooleanDetermines if this extension should be written.voidremove()Removes this extension from its parent and all then-empty parentsvoidsetParent(IWithAttributes parent) Sets the parent for this extensionvoidSets the value.voidshow()Shows this extension and all parents so it can be writtenMethods inherited from class org.openstreetmap.josm.data.gpx.WithAttributes
get, getAttributes, getCollection, getExtensions, getString, hasExtensions, put
-
Field Details
-
qualifiedName
-
prefix
-
key
-
parent
-
value
-
visible
-
-
Constructor Details
-
GpxExtension
Constructs a newGpxExtension.- Parameters:
prefix- the prefixkey- the keyvalue- the value
-
GpxExtension
Creates a newGpxExtension- Parameters:
namespaceURI- the URI of the XML namespace, used to determine supported extensions (josm, gpxx, gpxd) regardless of the prefix that could legally vary from file to file.qName- the qualified name of the XML element including prefixatts- the attributes
-
-
Method Details
-
findPrefix
Finds the default prefix used by JOSM for the given namespaceURI as the document is free specify another one.- Parameters:
namespaceURI- namespace URI- Returns:
- the prefix
-
findNamespace
Finds the namespace for the given default prefix, if supported with schema location- Parameters:
prefix- the prefix used by JOSM- Returns:
- the
GpxData.XMLNamespaceelement, location and URI can benullif not found.
-
getQualifiedName
Returns the qualified name of the XML element.- Returns:
- the qualified name of the XML element
-
getPrefix
Returns the prefix of the XML namespace.- Returns:
- the prefix of the XML namespace
-
getKey
Returns the key (local element name) of the extension.- Returns:
- the key (local element name) of the extension
-
getFlatKey
Returns the flattened extension key of this extension.- Returns:
- the flattened extension key of this extension, used for conversion to OSM layers
-
findExtension
Searches recursively for the extension with the given key in all children- Parameters:
sPrefix- the prefix to look forsKey- the key to look for- Returns:
- the extension if found, otherwise
null
-
getValue
Returns the value of the extension.- Returns:
- the value of the extension
-
setValue
Sets the value.- Parameters:
value- the value to set
-
remove
Removes this extension from its parent and all then-empty parents- Throws:
IllegalStateException- if parent not set
-
hide
Hides this extension and all then-empty parents so it isn't written- See Also:
-
show
Shows this extension and all parents so it can be written- See Also:
-
isVisible
Determines if this extension should be written.- Returns:
- if this extension should be written, used for hiding colors during export without removing them
-
getParent
Returns the parent element of this extension.- Returns:
- the parent element of this extension, can be another extension or gpx elements (data, track, segment, ...)
-
setParent
Sets the parent for this extension- Parameters:
parent- the parent- Throws:
IllegalStateException- if parent already set
-
hashCode
- Overrides:
hashCodein classWithAttributes
-
equals
- Overrides:
equalsin classWithAttributes
-