Package org.openstreetmap.josm.io
Class GpxWriter
java.lang.Object
org.openstreetmap.josm.io.XmlWriter
org.openstreetmap.josm.io.GpxWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,GpxConstants
- Direct Known Subclasses:
MarkerSessionExporter.MarkerWriter
Writes GPX files from GPX data or OSM data.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openstreetmap.josm.data.gpx.GpxConstants
GpxConstants.ColorFormat -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate GpxDataprivate Stringprivate Instantprivate static final intprivate static final intprivate static final intFields 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
ConstructorsConstructorDescriptionGpxWriter(OutputStream out) Constructs a newGpxWriter.GpxWriter(PrintWriter out) Constructs a newGpxWriter. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidReturns the forced metadata time information, if any.private voidgpxExtensions(GpxExtensionCollection allExtensions) private voidoutput linkprivate voidprivate voidprivate voidprivate voidprivate voidvoidsetMetaTime(Instant metaTime) Sets the forced metadata time information.private voidif content not null, open tag, write encoded content, and close tag else do nothing.private voidprivate voidoutput a pointvoidWrites the given GPX data.voidwrite(GpxData data, GpxConstants.ColorFormat colorFormat, boolean savePrefs) Writes the given GPX data.private voidwriteAttr(IWithAttributes obj, List<String> keys) private voidwriteExtension(List<GpxExtension> extensions) private voidprivate voidprivate voidprivate void
-
Field Details
-
data
-
indent
-
metaTime
-
validprefixes
-
WAY_POINT
- See Also:
-
ROUTE_POINT
- See Also:
-
TRACK_POINT
- See Also:
-
-
Constructor Details
-
GpxWriter
Constructs a newGpxWriter.- Parameters:
out- The output writer
-
GpxWriter
Constructs a newGpxWriter.- Parameters:
out- The output stream
-
-
Method Details
-
getMetaTime
Returns the forced metadata time information, if any.- Returns:
- the forced metadata time information, or
null - Since:
- 18219
-
setMetaTime
Sets the forced metadata time information.- Parameters:
metaTime- the forced metadata time information, ornullto use the current time- Since:
- 18219
-
write
Writes the given GPX data.- Parameters:
data- The data to write
-
write
Writes the given GPX data.- Parameters:
data- The data to writecolorFormat- determines if colors are saved and which extension is to be usedsavePrefs- whether layer specific preferences are saved
-
writeAttr
-
writeMetaData
-
writeWayPoints
-
writeRoutes
-
writeTracks
-
openln
-
openln
-
open
-
open
-
inline
-
close
-
closeln
-
simpleTag
if content not null, open tag, write encoded content, and close tag else do nothing.- Parameters:
tag- GPX tagcontent- content
-
simpleTag
-
gpxLink
output link- Parameters:
link- link
-
wayPoint
output a point- Parameters:
pnt- waypointmode-WAY_POINTforwpt,ROUTE_POINTforrtept,TRACK_POINTfortrkpt
-
gpxExtensions
-
writeExtension
-