Ticket #1642: dilution2.diff

File dilution2.diff, 7.9 KB (added by anonymous, 17 years ago)

diff patch color-encoded h-dilution

  • E:/Programmierumgebungen/Projekte/JOSM_PATCHPREPARE/src/org/openstreetmap/josm/actions/AutoScaleAction.java

     
    2222 */
    2323public class AutoScaleAction extends JosmAction {
    2424
    25     public static final String[] modes = { marktr("data"), marktr("layer"), marktr("selection"), marktr("conflict") };
     25    public static final String[] modes = {marktr("data"), marktr("layer"), marktr("selection"), marktr("conflict") };
    2626    private final String mode;
    2727
    2828    private static int getModeShortcut(String mode) {
  • E:/Programmierumgebungen/Projekte/JOSM_PATCHPREPARE/src/org/openstreetmap/josm/gui/MapScaler.java

     
    2020        private final NavigatableComponent mv;
    2121        public MapScaler(NavigatableComponent mv, Projection proj) {
    2222                this.mv = mv;
    23                 setSize(100,30);
     23                setSize(100,220);
    2424                setOpaque(false);
    2525    }
    2626
     
    3838                g.drawLine(24, 3, 24, 7);
    3939                g.drawLine(74, 3, 74, 7);
    4040                g.drawString(text, (int)(50-bound.getWidth()/2), 23);
     41               
     42                g.drawString("Dilution:", 0, 49);
     43                Color c[] = org.openstreetmap.josm.data.gpx.WayPoint.dcolors;
     44                int[] d = org.openstreetmap.josm.data.gpx.WayPoint.dilution_steps;
     45                for(int i = 0; i < 10; i++) {
     46                        g.setColor(c[i]);
     47                       
     48                        int y = 57+i*17;
     49                       
     50                        g.fillRect(1, y, 9, 9);
     51                        g.setColor(Color.white);
     52                        g.drawRect(0, y-1, 10, 10);
     53                        g.drawString(Integer.toString(d[i]), 15, y+9);
     54                }
    4155    }
    4256
    4357        public String helpTopic() {
  • E:/Programmierumgebungen/Projekte/JOSM_PATCHPREPARE/src/org/openstreetmap/josm/gui/MainMenu.java

     
    125125        public final JosmAction about = new AboutAction();
    126126        public final HistoryInfoAction historyinfo = new HistoryInfoAction();
    127127
     128   
    128129        public final JMenu fileMenu = new JMenu(tr("File"));
    129130        public final JMenu editMenu = new JMenu(tr("Edit"));
    130131        public final JMenu viewMenu = new JMenu(tr("View"));
  • E:/Programmierumgebungen/Projekte/JOSM_PATCHPREPARE/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

     
    559559                 ********** STEP 3f - DRAW SMALL POINTS INSTEAD OF LINES ********
    560560                 ****************************************************************/
    561561                if (!large && !lines){
    562                         g.setColor(neutralColor);
     562                        //g.setColor(neutralColor);
    563563                        for (GpxTrack trk : data.tracks) {
    564564                                for (Collection<WayPoint> segment : trk.trackSegs) {
    565565                                        for (WayPoint trkPnt : segment) {
    566566                                                if (Double.isNaN(trkPnt.latlon.lat()) || Double.isNaN(trkPnt.latlon.lon()))
    567567                                                        continue;
    568568                                                Point screen = mv.getPoint(trkPnt.eastNorth);
     569                                                if(trkPnt.dop_color==null)  g.setColor(neutralColor);
     570                                                else g.setColor(trkPnt.dop_color);
    569571                                                g.drawRect(screen.x, screen.y, 0, 0);
    570572                                        } // end for trkpnt
    571573                                } // end for segment
  • E:/Programmierumgebungen/Projekte/JOSM_PATCHPREPARE/src/org/openstreetmap/josm/io/GpxReader.java

     
    224224                                break;
    225225                        case wpt:
    226226                                if (qName.equals("ele") || qName.equals("magvar")
     227                                                || qName.equals("hdop") || qName.equals("vdop")
     228                                                || qName.equals("pdop")
    227229                                                || qName.equals("geoidheight") || qName.equals("name")
    228230                                                || qName.equals("sym") || qName.equals("type")) {
    229231                                        currentWayPoint.attr.put(qName, accumulator.toString());
     
    238240                                        currentRoute.routePoints.add(currentWayPoint);
    239241                                } else if (qName.equals("trkpt")) {
    240242                                        currentState = states.pop();
     243                                        currentWayPoint.complete();
    241244                                        currentTrackSeg.add(currentWayPoint);
    242245                                } else if (qName.equals("wpt")) {
    243246                                        currentState = states.pop();
  • E:/Programmierumgebungen/Projekte/JOSM_PATCHPREPARE/src/org/openstreetmap/josm/data/coor/LatLon.java

     
    2727     * Possible ways to display coordinates
    2828     */
    2929    public enum CoordinateFormat {
    30         DECIMAL_DEGREES {public String toString() {return tr("Decimal Degrees");}}, 
     30        DECIMAL_DEGREES {public String toString() {return  tr("Decimal Degrees");}}, 
    3131        DEGREES_MINUTES_SECONDS {public String toString() {return tr("Degrees Minutes Seconds");}};
    3232    }
    3333   
  • E:/Programmierumgebungen/Projekte/JOSM_PATCHPREPARE/src/org/openstreetmap/josm/data/gpx/WayPoint.java

     
    2020        public Color speedLineColor;
    2121        public boolean drawLine;
    2222        public int dir;
     23        public Color dop_color; // to remove
    2324
    2425        public WayPoint(LatLon ll) {
    2526                latlon = ll;
    2627                eastNorth = Main.proj.latlon2eastNorth(ll);
    2728        }
     29       
     30        public void complete() {
     31                float hdop = 0;
     32                //if (attr.containsKey("hdop"))
     33                try {hdop = Float.parseFloat(attr.get("hdop").toString());} catch(Exception e){}
    2834
     35                if(hdop==0) dop_color = null;
     36                else {
     37                        dop_color = dcolors[dcolors.length-1];
     38                        for(int i = 0; i < dilution_steps.length; i++) {
     39                                if(hdop <= dilution_steps[i] ) {
     40                                        dop_color = dcolors[i];
     41                                        break;
     42                                }
     43                        }
     44                }
     45        }
     46       
     47        public static Color[] dcolors = {
     48                Color.WHITE,
     49                Color.CYAN,
     50                Color.BLUE,
     51                Color.GREEN,
     52                Color.YELLOW,
     53                new Color(191,127,0),   // dark orange,
     54                Color.MAGENTA,
     55                Color.RED,                              // dark red
     56                new Color(127,0,0),
     57                Color.DARK_GRAY
     58        };
     59        public static int[] dilution_steps = {
     60                1,2,3,4,5,6,7,8,9,10
     61        };
     62
    2963        @Override
    3064        public String toString() {
    3165                return "WayPoint (" + (attr.containsKey("name") ? attr.get("name") + ", " :"") + latlon.toString() + ", " + attr + ")";
     
    3468        /**
    3569         * Convert the time stamp of the waypoint into seconds from the epoch
    3670         */
     71        public final static SimpleDateFormat GPXTIMEFMT =
     72                new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); // ignore timezone
     73       
    3774        public void setTime() {
    3875                if (! attr.containsKey("time")) {
    3976                        return;
    4077                }
    41                 SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // ignore timezone
    42                 Date d = f.parse(attr.get("time").toString(), new ParsePosition(0));
     78                Date d = GPXTIMEFMT.parse(attr.get("time").toString(), new ParsePosition(0));
    4379                if (d != null /* parsing ok */) {
    4480                        time = d.getTime() / 1000.0; /* ms => seconds */
    4581                }