Changeset 15247 in josm


Ignore:
Timestamp:
2019-07-14T02:26:22+02:00 (6 weeks ago)
Author:
Don-vip
Message:

see #17829 - support RTKLib Positioning Solution files. Add new "Quality" GPX color mode

Location:
trunk
Files:
7 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java

    r14668 r15247  
    2727import org.openstreetmap.josm.gui.io.importexport.OsmChangeImporter;
    2828import org.openstreetmap.josm.gui.io.importexport.OsmImporter;
     29import org.openstreetmap.josm.gui.io.importexport.RtkLibImporter;
    2930import org.openstreetmap.josm.gui.io.importexport.WMSLayerImporter;
    3031import org.openstreetmap.josm.gui.widgets.AbstractFileChooser;
     
    6566                GpxImporter.class,
    6667                NMEAImporter.class,
     68                RtkLibImporter.class,
    6769                NoteImporter.class,
    6870                JpgImporter.class,
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxConstants.java

    r15020 r15247  
    165165    Collection<String> FIX_VALUES = Collections.unmodifiableList(
    166166            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 = "ration";
    167202}
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r15045 r15247  
    7979import org.openstreetmap.josm.gui.io.importexport.JpgImporter;
    8080import org.openstreetmap.josm.gui.io.importexport.NMEAImporter;
     81import org.openstreetmap.josm.gui.io.importexport.RtkLibImporter;
    8182import org.openstreetmap.josm.gui.layer.GpxLayer;
    8283import org.openstreetmap.josm.gui.layer.Layer;
     
    267268            ExtensionFileFilter gpxFilter = GpxImporter.getFileFilter();
    268269            AbstractFileChooser fc = new FileChooserManager(true, null).createFileChooser(false, null,
    269                     Arrays.asList(gpxFilter, NMEAImporter.FILE_FILTER), gpxFilter, JFileChooser.FILES_ONLY).openFileChooser();
     270                    Arrays.asList(gpxFilter, NMEAImporter.FILE_FILTER, RtkLibImporter.FILE_FILTER), gpxFilter, JFileChooser.FILES_ONLY)
     271                    .openFileChooser();
    270272            if (fc == null)
    271273                return;
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r15001 r15247  
    126126    /** Colors (without custom alpha channel, if given) for HDOP painting. **/
    127127    private ColorScale hdopScale;
     128    private ColorScale qualityScale;
    128129    private ColorScale dateScale;
    129130    private ColorScale directionScale;
     
    177178    private static Color[] heatMapLutColorJosmRed2Blue = createColorFromResource("red2blue");
    178179
     180    private static Color[] rtkLibQualityColors = new Color[] {
     181        Color.GREEN, // Fixed, solution by carrier‐based relative positioning and the integer ambiguity is properly resolved.
     182        Color.ORANGE, // Float, solution by carrier‐based relative positioning but the integer ambiguity is not resolved.
     183        Color.PINK, // Reserved
     184        Color.BLUE, // DGPS, solution by code‐based DGPS solutions or single point positioning with SBAS corrections
     185        Color.RED, // Single, solution by single point positioning
     186        Color.CYAN // PPP
     187    };
     188
    179189    // user defined heatmap color
    180190    private Color[] heatMapLutColor = createColorLut(0, Color.BLACK, Color.WHITE);
     
    188198        /** Colors (without custom alpha channel, if given) for HDOP painting. **/
    189199        hdopScale = ColorScale.createHSBScale(256).makeReversed().addTitle(tr("HDOP"));
     200        qualityScale = ColorScale.createFixedScale(rtkLibQualityColors).addTitle(tr("Quality"));
    190201        dateScale = ColorScale.createHSBScale(256).addTitle(tr("Time"));
    191202        directionScale = ColorScale.createCyclicScale(256).setIntervalCount(4).addTitle(tr("Direction"));
     
    228239         * Color using a heatmap instead of normal lines
    229240         */
    230         HEATMAP;
     241        HEATMAP,
     242        /**
     243         * Color by quality (RTKLib)
     244         */
     245        QUALITY;
    231246
    232247        static ColorMode fromIndex(final int index) {
     
    343358        dateScale.setNoDataColor(neutralColor);
    344359        hdopScale.setNoDataColor(neutralColor);
     360        qualityScale.setNoDataColor(neutralColor);
    345361        directionScale.setNoDataColor(neutralColor);
    346362
     
    557573            velocityScale.setRange(0, colorTracksTune);
    558574            hdopScale.setRange(0, hdoprange);
     575            qualityScale.setRange(1, rtkLibQualityColors.length);
    559576        }
    560577        double now = System.currentTimeMillis()/1000.0;
     
    586603
    587604                if (colored == ColorMode.HDOP) {
    588                     Float hdop = (Float) trkPnt.get(GpxConstants.PT_HDOP);
    589                     color = hdopScale.getColor(hdop);
     605                    color = hdopScale.getColor((Float) trkPnt.get(GpxConstants.PT_HDOP));
     606                } else if (colored == ColorMode.QUALITY) {
     607                    color = qualityScale.getColor((Integer) trkPnt.get(GpxConstants.RTKLIB_Q));
    590608                }
    591609                if (oldWp != null) { // other coloring modes need segment for calcuation
     
    15061524        if (colored == ColorMode.HDOP) {
    15071525            hdopScale.drawColorBar(g, w-30, 50, 20, 100, 1.0);
     1526        } else if (colored == ColorMode.QUALITY) {
     1527            qualityScale.drawColorBar(g, w-30, 50, 20, 100, 1.0);
    15081528        } else if (colored == ColorMode.VELOCITY) {
    15091529            SystemOfMeasurement som = SystemOfMeasurement.getSystemOfMeasurement();
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java

    r14153 r15247  
    6565    private final JRadioButton colorTypeDirection = new JRadioButton(tr("Direction (red = west, yellow = north, green = east, blue = south)"));
    6666    private final JRadioButton colorTypeDilution = new JRadioButton(tr("Dilution of Position (red = high, green = low, if available)"));
     67    private final JRadioButton colorTypeQuality = new JRadioButton(tr("Quality (RTKLib only, if available)"));
    6768    private final JRadioButton colorTypeTime = new JRadioButton(tr("Track date"));
    6869    private final JRadioButton colorTypeHeatMap = new JRadioButton(tr("Heat Map (dark = few, bright = many)"));
     
    249250        colorGroup.add(colorTypeDirection);
    250251        colorGroup.add(colorTypeDilution);
     252        colorGroup.add(colorTypeQuality);
    251253        colorGroup.add(colorTypeTime);
    252254        colorGroup.add(colorTypeHeatMap);
     
    257259        colorTypeDilution.setToolTipText(
    258260                tr("Colors points and track segments by dilution of position (HDOP). Your capture device needs to log that information."));
     261        colorTypeQuality.setToolTipText(
     262                tr("Colors points and track segments by RTKLib quality flag (Q). Your capture device needs to log that information."));
    259263        colorTypeTime.setToolTipText(tr("Colors points and track segments by its timestamp."));
    260264        colorTypeHeatMap.setToolTipText(tr("Collected points and track segments for a position and displayed as heat map."));
     
    277281        add(colorTypeDirection, GBC.eol().insets(40, 0, 0, 0));
    278282        add(colorTypeDilution, GBC.eol().insets(40, 0, 0, 0));
     283        add(colorTypeQuality, GBC.eol().insets(40, 0, 0, 0));
    279284        add(colorTypeTime, GBC.eol().insets(40, 0, 0, 0));
    280285        add(colorTypeHeatMap, GBC.std().insets(40, 0, 0, 0));
     
    341346        ExpertToggleAction.addVisibilitySwitcher(colorTypeDirection);
    342347        ExpertToggleAction.addVisibilitySwitcher(colorTypeDilution);
     348        ExpertToggleAction.addVisibilitySwitcher(colorTypeQuality);
    343349        ExpertToggleAction.addVisibilitySwitcher(colorTypeHeatMapLowerLimit);
    344350        ExpertToggleAction.addVisibilitySwitcher(colorTypeHeatMapLowerLimitLabel);
     
    445451            case 4: colorTypeTime.setSelected(true); break;
    446452            case 5: colorTypeHeatMap.setSelected(true); break;
     453            case 6: colorTypeQuality.setSelected(true); break;
    447454            default: Logging.warn("Unknown color type: " + colorType);
    448455            }
     
    525532        } else if (colorTypeHeatMap.isSelected()) {
    526533            Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 5);
     534        } else if (colorTypeQuality.isSelected()) {
     535            Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 6);
    527536        } else {
    528537            Config.getPref().putInt("draw.rawgps.colors"+layerNameDot, 0);
  • trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java

    r14687 r15247  
    6262        TASKING_MANAGER("https?://.*/api/v\\p{Digit}+/project/\\p{Digit}+/tasks_as_gpx?.*"),
    6363
     64        /** External GPX script */
    6465        EXTERNAL_GPX_SCRIPT("https?://.*exportgpx.*"),
     66        /** External GPX file */
    6567        EXTERNAL_GPX_FILE  ("https?://.*/(.*\\.gpx)");
    6668
     
    116118    public OsmServerLocationReader(String url) {
    117119        this.url = url;
     120    }
     121
     122    /**
     123     * Returns the URL to fetch
     124     * @return the URL to fetch
     125     * @since 15247
     126     */
     127    public final String getUrl() {
     128        return url;
    118129    }
    119130
  • trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java

    r15018 r15247  
    213213    }
    214214
     215    /**
     216     * Returns the number of coordinates that have been successfuly read.
     217     * @return the number of coordinates that have been successfuly read
     218     */
    215219    public int getNumberOfCoordinates() {
    216220        return ps.success;
  • trunk/src/org/openstreetmap/josm/io/session/GpxTracksSessionImporter.java

    r12671 r15247  
    1515import org.openstreetmap.josm.gui.io.importexport.GpxImporter;
    1616import org.openstreetmap.josm.gui.io.importexport.NMEAImporter;
     17import org.openstreetmap.josm.gui.io.importexport.RtkLibImporter;
    1718import org.openstreetmap.josm.gui.layer.GpxLayer;
    1819import org.openstreetmap.josm.gui.layer.Layer;
     
    4849                if (NMEAImporter.FILE_FILTER.acceptName(fileStr)) {
    4950                    importData = NMEAImporter.loadLayers(in, support.getFile(fileStr), support.getLayerName(), null);
     51                } else if (RtkLibImporter.FILE_FILTER.acceptName(fileStr)) {
     52                    importData = RtkLibImporter.loadLayers(in, support.getFile(fileStr), support.getLayerName(), null);
    5053                } else {
    5154                    importData = GpxImporter.loadLayers(in, support.getFile(fileStr), support.getLayerName(), null, progressMonitor);
  • trunk/src/org/openstreetmap/josm/tools/ColorScale.java

    r12538 r15247  
    2222    private ColorScale() {
    2323
     24    }
     25
     26    /**
     27     * Gets a fixed color range.
     28     * @param colors the fixed colors list
     29     * @return The scale
     30     * @since 15247
     31     */
     32    public static ColorScale createFixedScale(Color[] colors) {
     33        ColorScale sc = new ColorScale();
     34        sc.colors = Utils.copyArray(colors);
     35        sc.setRange(0, colors.length - 1);
     36        sc.addBounds();
     37        return sc;
    2438    }
    2539
Note: See TracChangeset for help on using the changeset viewer.