Changeset 1309 in josm for trunk


Ignore:
Timestamp:
2009-01-20T13:55:33+01:00 (15 years ago)
Author:
stoecker
Message:

fixed texts, added EPSG codes to projection (to fix WMS access)

Location:
trunk/src/org/openstreetmap/josm
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r1297 r1309  
    172172            if(n.eastNorth.north() < miny) miny = n.eastNorth.north();
    173173        }
    174        
     174
    175175        if ((minx > maxEN.east()) ||
    176176            (miny > maxEN.north()) ||
     
    471471        // draw multipolygon relations including their ways
    472472        // other relations are only drawn when selected
    473        
     473
    474474        // we are in the "draw selected" phase
    475475        // TODO: is it necessary to check for r.selected?
     
    486486            return;
    487487        }
    488        
     488
    489489        if (drawMultipolygon && r.keys != null && "multipolygon".equals(r.keys.get("type")))
    490490        {
     
    492492            return;
    493493        }
    494        
     494
    495495        if (drawRestriction && r.keys != null && "restriction".equals(r.keys.get("type")))
    496496        {
     
    498498            return;
    499499        }
    500        
     500
    501501        if(r.selected)
    502502            drawSelectedRelation(r);
    503503    }
    504504
    505    
     505
    506506    // this current experimental implementation will only work for standard restrictions:
    507507    // from(Way) / via(Node) / to(Way)
     
    509509        if(restrictionDebug)
    510510            System.out.println("Restriction: " + r.keys.get("name") + " restriction " + r.keys.get("restriction"));
    511      
     511
    512512        r.clearErrors();
    513513
     
    521521            if(restrictionDebug)
    522522                System.out.println("member " + m.member + " selected " + r.selected);
    523            
    524             if(m.member == null) 
     523
     524            if(m.member == null)
    525525                r.putError(tr("Empty member in relation."), true);
    526526            else if(m.member.deleted)
     
    529529            else if(m.member.incomplete)
    530530            {
    531                 // TODO: What to do with incomplete members?
    532                 //incomplete = true;
    533                 r.putError(tr("incomplete member {0}" + " with role {1}", m.member, m.role), true);
     531                return;
    534532            }
    535533            else
     
    550548                    else if("from".equals(m.role)) {
    551549                        if(fromWay != null)
    552                             r.putError(tr("more than one from way found - ignored."), true);
     550                            r.putError(tr("More than one \"from\" way found."), true);
    553551                        else {
    554552                            fromWay = w;
     
    556554                    } else if("to".equals(m.role)) {
    557555                        if(toWay != null)
    558                             r.putError(tr("more than one to way found - ignored."), true);
     556                            r.putError(tr("More than one \"to\" way found."), true);
    559557                        else {
    560558                            toWay = w;
     
    562560                    }
    563561                    else
    564                         r.putError(tr("unknown role {0} - ignored", m.role), true);
     562                        r.putError(tr("Unknown role {0}.", m.role), true);
    565563                }
    566564                else if(m.member instanceof Node)
     
    569567                    if("via".equals(m.role))
    570568                        if(via != null)
    571                             System.out.println("more than one via found - ignored");
     569                            System.out.println("More than one \"via\" found.");
    572570                        else {
    573571                            via = n;
    574572                        }
    575573                    else
    576                         r.putError(tr("unknown role {0} - ignored", m.role), true);
     574                        r.putError(tr("Unknown role ''{0}''.", m.role), true);
    577575                }
    578576                else
    579                     r.putError(tr("unknown instanceof member - ignored"), true);
    580             }
    581         }
    582        
     577                    r.putError(tr("Unknown member type for ''{0}''.", m.member.getName()), true);
     578            }
     579        }
     580
    583581        if (fromWay == null) {
    584             r.putError(tr("no from way found"), true);
     582            r.putError(tr("No \"from\" way found."), true);
    585583            return;
    586584        }
    587585        if (toWay == null) {
    588             r.putError(tr("no to way found"), true);
     586            r.putError(tr("No \"to\" way found."), true);
    589587            return;
    590588        }
    591589        if (via == null) {
    592             r.putError(tr("no via node found"), true);
     590            r.putError(tr("No \"via\" node found."), true);
    593591            return;
    594592        }
     
    596594        // check if "from" way starts or ends at via
    597595        if(fromWay.nodes.get(0) != via && fromWay.nodes.get(fromWay.nodes.size()-1) != via) {
    598             r.putError(tr("from way doesn't start or end at a via node"), true);
     596            r.putError(tr("The \"from\" way doesn't start or end at a \"via\" node."), true);
    599597            return;
    600598        }
     
    606604
    607605        // find the "direct" nodes before the via node
    608         Node fromNode = null;       
     606        Node fromNode = null;
    609607        try
    610608        {
     
    617615            }
    618616        } catch (IndexOutOfBoundsException ioobe) {
    619             System.out.println("from must contain at least 2 nodes");
     617            r.putError(tr("The \"{0}\" way must contain at least 2 nodes.", "from"), true);
    620618        }
    621619
     
    634632            }
    635633        } catch (IndexOutOfBoundsException ioobe) {
    636             System.out.println("to must contain at least 2 nodes");
    637         }
    638        
     634            r.putError(tr("The \"{0}\" way must contain at least 2 nodes.", "to"), true);
     635        }
     636
    639637        Point pFrom = nc.getPoint(fromNode.eastNorth);
    640638        Point pVia = nc.getPoint(via.eastNorth);
    641        
     639
    642640        if(restrictionDebug) {
    643641            Point pTo = nc.getPoint(toNode.eastNorth);
     
    660658        double dx = (pFrom.x >= pVia.x) ? (pFrom.x - pVia.x) : (pVia.x - pFrom.x);
    661659        double dy = (pFrom.y >= pVia.y) ? (pFrom.y - pVia.y) : (pVia.y - pFrom.y);
    662        
     660
    663661        double fromAngle;
    664662        if(dx == 0.0) {
     
    671669        double vx = distanceFromVia * Math.cos(fromAngle);
    672670        double vy = distanceFromVia * Math.sin(fromAngle);
    673        
     671
    674672        if(pFrom.x < pVia.x) vx = -vx;
    675673        if(pFrom.y < pVia.y) vy = -vy;
     
    677675        if(restrictionDebug)
    678676            System.out.println("vx " + vx + " vy " + vy);
    679        
     677
    680678        // go a few pixels away from the way (in a right angle)
    681679        // (calculate the vx2/vy2 vector with the specified length and the direction 90degrees away from the first segment of the "from" way)
     
    725723            iconAngle = 270-fromAngleDeg;
    726724        }
    727        
     725
    728726        IconElemStyle nodeStyle = (IconElemStyle)getPrimitiveStyle(r);
    729        
     727
    730728        if (nodeStyle == null) {
    731             r.putError(tr("Style for restriction {0} not found", r.keys.get("restriction")), true);
    732             return;
    733         }
    734 
    735         // rotate icon with direction last node in from to 
     729            r.putError(tr("Style for restriction {0} not found.", r.keys.get("restriction")), true);
     730            return;
     731        }
     732
     733        // rotate icon with direction last node in from to
    736734        if(restrictionDebug)
    737735            System.out.println("Deg1 " + fromAngleDeg + " Deg2 " + (fromAngleDeg + 180) + " Icon " + iconAngle);
     
    761759        for (RelationMember m : r.members)
    762760        {
    763             if(m.member == null) 
     761            if(m.member == null)
    764762                r.putError(tr("Empty member in relation."), true);
    765763            else if(m.member.deleted)
     
    869867                                --contains;
    870868                        }
    871                         if(contains == 0) return 1; 
    872                         if(contains == p.npoints) return 0; 
    873                         return 2; 
     869                        if(contains == 0) return 1;
     870                        if(contains == p.npoints) return 0;
     871                        return 2;
    874872                    }
    875873                    public void addInner(Polygon p)
     
    10371035    {
    10381036        Polygon polygon = getPolygon(w);
    1039        
     1037
    10401038        // set the opacity (alpha) level of the filled polygon
    10411039        g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
     
    11861184        boolean profiler = Main.pref.getBoolean("mappaint.profiler",false);
    11871185        profilerOmitDraw = Main.pref.getBoolean("mappaint.profiler.omitdraw",false);
    1188        
     1186
    11891187        useStyleCache = Main.pref.getBoolean("mappaint.cache",true);
    11901188        fillAreas = Main.pref.getInteger("mappaint.fillareas", 100000);
     
    11961194        LatLon ll2 = nc.getLatLon(100,0);
    11971195        dist = ll1.greatCircleDistance(ll2);
    1198        
     1196
    11991197        long profilerStart = java.lang.System.currentTimeMillis();
    12001198        long profilerLast = profilerStart;
     
    12211219        minEN = nc.getEastNorth(0,nc.getHeight()-1);
    12221220        maxEN = nc.getEastNorth(nc.getWidth()-1,0);
    1223        
     1221
    12241222
    12251223        selectedCall = false;
  • trunk/src/org/openstreetmap/josm/data/projection/Epsg4326.java

    r1169 r1309  
    2424    }
    2525
     26    public String toCode() {
     27        return "EPSG:4326";
     28    }
     29
    2630    public String getCacheDirectoryName() {
    2731        return "epsg4326";
  • trunk/src/org/openstreetmap/josm/data/projection/Lambert.java

    r1212 r1309  
    122122            } else if (layoutZone != currentZone) {
    123123                if ((currentZone < layoutZone && Math.abs(zoneLimits[currentZone] - lt) > cMaxOverlappingZones)
    124                         || (currentZone > layoutZone && Math.abs(zoneLimits[layoutZone] - lt) > cMaxOverlappingZones)) {
     124                || (currentZone > layoutZone && Math.abs(zoneLimits[layoutZone] - lt) > cMaxOverlappingZones)) {
    125125                    JOptionPane.showMessageDialog(Main.parent,
    126                                     tr("IMPORTANT : data positioned far away from\n"
    127                                             + "the current Lambert zone limits.\n"
    128                                             + "Do not upload any data after this message.\n"
    129                                             + "Undo your last action, Save your work \n"
    130                                             + "and Start a new layer on the new zone."));
     126                    tr("IMPORTANT : data positioned far away from\n"
     127                    + "the current Lambert zone limits.\n"
     128                    + "Do not upload any data after this message.\n"
     129                    + "Undo your last action, save your work\n"
     130                    + "and start a new layer on the new zone."));
    131131                    layoutZone = -1;
    132132                    dontDisplayErrors = true;
     
    157157    @Override public String toString() {
    158158        return tr("Lambert Zone (France)");
     159    }
     160
     161    public String toCode() {
     162        return "EPSG::"+(27571+currentZone);
    159163    }
    160164
  • trunk/src/org/openstreetmap/josm/data/projection/LambertEST.java

    r1230 r1309  
    9797    }
    9898
     99    public String toCode() {
     100        return "EPSG:3301";
     101    }
     102
    99103    public String getCacheDirectoryName() {
    100104        return "lambertest";
  • trunk/src/org/openstreetmap/josm/data/projection/Mercator.java

    r1261 r1309  
    3737    }
    3838
     39    public String toCode() {
     40        return "EPSG:3785"; /* TODO: Check if that is correct */
     41    }
     42
    3943    public String getCacheDirectoryName() {
    4044        return "mercator";
  • trunk/src/org/openstreetmap/josm/data/projection/Projection.java

    r1230 r1309  
    5858
    5959    /**
     60     * Return projection code.
     61     */
     62    String toCode();
     63
     64    /**
    6065     * Get a filename compatible string (for the cache directory)
    6166     */
  • trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java

    r1300 r1309  
    501501
    502502        while (true) {
    503             int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Syncronize Time with GPS Unit"), JOptionPane.OK_CANCEL_OPTION);
     503            int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Synchronize Time with GPS Unit"), JOptionPane.OK_CANCEL_OPTION);
    504504            if (answer != JOptionPane.OK_OPTION || gpsText.getText().equals(""))
    505505                return;
Note: See TracChangeset for help on using the changeset viewer.