001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.gpx;
003
004import java.util.Arrays;
005import java.util.Collection;
006import java.util.Collections;
007import java.util.List;
008
009import org.openstreetmap.josm.data.Bounds;
010import org.openstreetmap.josm.spi.preferences.Config;
011
012/**
013 * Constants for GPX handling.
014 */
015public interface GpxConstants {
016
017    /** GPS name of the element. This field will be transferred to and from the GPS.
018     *  GPX does not place restrictions on the length of this field or the characters contained in it.
019     *  It is up to the receiving application to validate the field before sending it to the GPS. */
020    String GPX_NAME = "name";
021
022    /** GPS element comment. Sent to GPS as comment. */
023    String GPX_CMT = "cmt";
024
025    /** Text description of the element. Holds additional information about the element intended for the user, not the GPS. */
026    String GPX_DESC = "desc";
027
028    /** Source of data. Included to give user some idea of reliability and accuracy of data. */
029    String GPX_SRC = "src";
030
031    /**
032     * Prefix used for all meta values.
033     */
034    String META_PREFIX = "meta.";
035    /**
036     * A constant for the metadata hash map: the author name of the file
037     * @see GpxData#get(String)
038     */
039    String META_AUTHOR_NAME = META_PREFIX + "author.name";
040    /**
041     * A constant for the metadata hash map: the author email of the file
042     * @see GpxData#get(String)
043     */
044    String META_AUTHOR_EMAIL = META_PREFIX + "author.email";
045    /**
046     * A constant for the metadata hash map: a link to a page about the author
047     * @see GpxData#get(String)
048     */
049    String META_AUTHOR_LINK = META_PREFIX + "author.link";
050    /**
051     * A constant for the metadata hash map: the author field for the copyright information in the gpx file
052     * @see GpxData#get(String)
053     */
054    String META_COPYRIGHT_AUTHOR = META_PREFIX + "copyright.author";
055    /**
056     * A constant for the metadata hash map: the license of the file
057     * @see GpxData#get(String)
058     */
059    String META_COPYRIGHT_LICENSE = META_PREFIX + "copyright.license";
060    /**
061     * A constant for the metadata hash map: the year of the license for the file
062     * @see GpxData#get(String)
063     */
064    String META_COPYRIGHT_YEAR = META_PREFIX + "copyright.year";
065    /**
066     * A constant for the metadata hash map: a description of the file
067     * @see GpxData#get(String)
068     */
069    String META_DESC = META_PREFIX + "desc";
070    /**
071     * A constant for the metadata hash map: the keywords of the file
072     * @see GpxData#get(String)
073     */
074    String META_KEYWORDS = META_PREFIX + "keywords";
075    /**
076     * A constant for the metadata hash map: the links. They are stored as list of {@link GpxLink} objects
077     * @see GpxData#get(String)
078     */
079    String META_LINKS = META_PREFIX + "links";
080    /**
081     * A constant for the metadata hash map: the name of the file (stored in the file, not the one on the disk)
082     * @see GpxData#get(String)
083     */
084    String META_NAME = META_PREFIX + "name";
085    /**
086     * A constant for the metadata hash map: the time as string
087     * @see GpxData#get(String)
088     */
089    String META_TIME = META_PREFIX + "time";
090    /**
091     * A constant for the metadata hash map: the bounding box. This is a {@link Bounds} object
092     * @see GpxData#getMetaBounds()
093     */
094    String META_BOUNDS = META_PREFIX + "bounds";
095    /**
096     * A constant for the metadata hash map: the extension data. This is a {@link Extensions} object
097     * @see GpxData#addExtension(String, String)
098     * @see GpxData#get(String)
099     */
100    String META_EXTENSIONS = META_PREFIX + "extensions";
101
102    /**
103     * A namespace for josm GPX extensions
104     */
105    String JOSM_EXTENSIONS_NAMESPACE_URI = Config.getUrls().getXMLBase() + "/gpx-extensions-1.0";
106
107    /** Elevation (in meters) of the point. */
108    String PT_ELE = "ele";
109
110    /** Creation/modification timestamp for the point.
111     *  Date and time in are in Univeral Coordinated Time (UTC), not local time!
112     *  Conforms to ISO 8601 specification for date/time representation.
113     *  Fractional seconds are allowed for millisecond timing in tracklogs. */
114    String PT_TIME = "time";
115
116    /** Magnetic variation (in degrees) at the point. 0.0 <= value < 360.0 */
117    String PT_MAGVAR = "magvar";
118
119    /** Height, in meters, of geoid (mean sea level) above WGS-84 earth ellipsoid. (NMEA GGA message) */
120    String PT_GEOIDHEIGHT = "geoidheight";
121
122    /** Text of GPS symbol name. For interchange with other programs, use the exact spelling of the symbol on the GPS, if known. */
123    String PT_SYM = "sym";
124
125    /** Type (textual classification) of element. */
126    String PT_TYPE = "type";
127
128    /** Type of GPS fix. none means GPS had no fix. Value comes from list: {'none'|'2d'|'3d'|'dgps'|'pps'} */
129    String PT_FIX = "fix";
130
131    /** Number of satellites used to calculate the GPS fix. (not number of satellites in view). */
132    String PT_SAT = "sat";
133
134    /** Horizontal dilution of precision. */
135    String PT_HDOP = "hdop";
136
137    /** Vertical dilution of precision. */
138    String PT_VDOP = "vdop";
139
140    /** Position dilution of precision. */
141    String PT_PDOP = "pdop";
142
143    /** Number of seconds since last DGPS update. */
144    String PT_AGEOFDGPSDATA = "ageofdgpsdata";
145
146    /** Represents a differential GPS station. 0 <= value <= 1023 */
147    String PT_DGPSID = "dgpsid";
148
149    /**
150     * Ordered list of all possible waypoint keys.
151     */
152    List<String> WPT_KEYS = Collections.unmodifiableList(Arrays.asList(PT_ELE, PT_TIME, PT_MAGVAR, PT_GEOIDHEIGHT,
153            GPX_NAME, GPX_CMT, GPX_DESC, GPX_SRC, META_LINKS, PT_SYM, PT_TYPE,
154            PT_FIX, PT_SAT, PT_HDOP, PT_VDOP, PT_PDOP, PT_AGEOFDGPSDATA, PT_DGPSID, META_EXTENSIONS));
155
156    /**
157     * Ordered list of all possible route and track keys.
158     */
159    List<String> RTE_TRK_KEYS = Collections.unmodifiableList(Arrays.asList(
160            GPX_NAME, GPX_CMT, GPX_DESC, GPX_SRC, META_LINKS, "number", PT_TYPE, META_EXTENSIONS));
161
162    /**
163     * Possible fix values. NMEA 0183 Version 4.00
164     */
165    Collection<String> FIX_VALUES = Collections.unmodifiableList(
166            Arrays.asList("none", "2d", "3d", "dgps", "pps", "rtk", "float rtk", "estimated", "manual", "simulated"));
167
168    /**
169     * The flag which indicates the solution quality.<ul>
170     * <li>1 : Fixed, solution by carrier‐based relative positioning and the integer ambiguity is properly resolved.</li>
171     * <li>2 : Float, solution by carrier‐based relative positioning but the integer ambiguity is not resolved.</li>
172     * <li>3 : Reserved</li>
173     * <li>4 : DGPS, solution by code‐based DGPS solutions or single point positioning with SBAS corrections</li>
174     * <li>5 : Single, solution by single point positioning</li></ul>
175     * @since 15247
176     */
177    String RTKLIB_Q = "Q";
178    /** N (north) component of the standard deviations in m. */
179    String RTKLIB_SDN = "sdn";
180    /** E (east) component of the standard deviations in m. */
181    String RTKLIB_SDE = "sde";
182    /** U (up) component of the standard deviations in m. */
183    String RTKLIB_SDU = "sdu";
184    /**
185     * The absolute value of sdne means square root of the absolute value of NE component of the estimated covariance matrix.
186     * The sign represents the sign of the covariance. */
187    String RTKLIB_SDNE = "sdne";
188    /**
189     * The absolute value of sdeu means square root of the absolute value of EU component of the estimated covariance matrix.
190     * The sign represents the sign of the covariance. */
191    String RTKLIB_SDEU = "sdeu";
192    /**
193     * The absolute value of sdun means square root of the absolute value of UN component of the estimated covariance matrix.
194     * The sign represents the sign of the covariance. */
195    String RTKLIB_SDUN = "sdun";
196    /** The time difference between the observation data epochs of the rover receiver and the base station in second. */
197    String RTKLIB_AGE = "age";
198    /**
199     * The ratio factor of ʺratio‐testʺ for standard integer ambiguity validation strategy.
200     * The value means the ratio of the squared sum of the residuals with the second best integer vector to with the best integer vector. */
201    String RTKLIB_RATIO = "ratio";
202}