Ignore:
Timestamp:
2009-08-23T22:37:39+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3261: Use the "name:$CURRENT_LOCALE" name in the JOSM UI instead of "name" when it exists
new: new checkbox in LAF preferences for enabling/disabling localized names for primitives

File:
1 edited

Legend:

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

    r1937 r1990  
    3434import org.openstreetmap.josm.data.osm.RelationMember;
    3535import org.openstreetmap.josm.data.osm.Way;
     36import org.openstreetmap.josm.gui.DefaultNameFormatter;
    3637import org.openstreetmap.josm.gui.mappaint.AreaElemStyle;
    3738import org.openstreetmap.josm.gui.mappaint.ElemStyle;
     
    9495            return (styles != null) ? styles.get(osm) : null;
    9596
    96         if(osm.mappaintStyle == null && styles != null) {
    97             osm.mappaintStyle = styles.get(osm);
    98             if(osm instanceof Way)
    99                 ((Way)osm).isMappaintArea = styles.isArea(osm);
    100         }
    101         return osm.mappaintStyle;
     97            if(osm.mappaintStyle == null && styles != null) {
     98                osm.mappaintStyle = styles.get(osm);
     99                if(osm instanceof Way) {
     100                    ((Way)osm).isMappaintArea = styles.isArea(osm);
     101                }
     102            }
     103            return osm.mappaintStyle;
    102104    }
    103105
     
    106108            return (styles != null) ? styles.getIcon(osm) : null;
    107109
    108         if(osm.mappaintStyle == null && styles != null)
    109             osm.mappaintStyle = styles.getIcon(osm);
    110 
    111         return (IconElemStyle)osm.mappaintStyle;
     110            if(osm.mappaintStyle == null && styles != null) {
     111                osm.mappaintStyle = styles.getIcon(osm);
     112            }
     113
     114            return (IconElemStyle)osm.mappaintStyle;
    112115    }
    113116
     
    129132     * @param n The node to draw.
    130133     */
     134    @Override
    131135    public void visit(Node n) {
    132136        /* check, if the node is visible at all */
    133137        if((n.getEastNorth().east()  > maxEN.east() ) ||
    134            (n.getEastNorth().north() > maxEN.north()) ||
    135            (n.getEastNorth().east()  < minEN.east() ) ||
    136            (n.getEastNorth().north() < minEN.north()))
     138                (n.getEastNorth().north() > maxEN.north()) ||
     139                (n.getEastNorth().east()  < minEN.east() ) ||
     140                (n.getEastNorth().north() < minEN.north()))
    137141        {
    138142            n.mappaintVisibleCode = viewid;
     
    146150        //    return;
    147151
    148         if (nodeStyle != null && isZoomOk(nodeStyle) && showIcons > dist)
     152        if (nodeStyle != null && isZoomOk(nodeStyle) && showIcons > dist) {
    149153            drawNode(n, nodeStyle.icon, nodeStyle.annotate, n.isSelected());
    150         else if (n.highlighted)
     154        } else if (n.highlighted) {
    151155            drawNode(n, highlightColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
    152         else if (n.isSelected())
     156        } else if (n.isSelected()) {
    153157            drawNode(n, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
    154         else if (n.isTagged())
     158        } else if (n.isTagged()) {
    155159            drawNode(n, nodeColor, taggedNodeSize, taggedNodeRadius, fillUnselectedNode);
    156         else
     160        } else {
    157161            drawNode(n, nodeColor, unselectedNodeSize, unselectedNodeRadius, fillUnselectedNode);
     162        }
    158163    }
    159164
     
    162167     * @param w The way to draw.
    163168     */
     169    @Override
    164170    public void visit(Way w) {
    165171        if(w.getNodesCount() < 2)
     
    177183        for (Node n : w.getNodes())
    178184        {
    179             if(n.getEastNorth().east() > maxx) maxx = n.getEastNorth().east();
    180             if(n.getEastNorth().north() > maxy) maxy = n.getEastNorth().north();
    181             if(n.getEastNorth().east() < minx) minx = n.getEastNorth().east();
    182             if(n.getEastNorth().north() < miny) miny = n.getEastNorth().north();
     185            if(n.getEastNorth().east() > maxx) {
     186                maxx = n.getEastNorth().east();
     187            }
     188            if(n.getEastNorth().north() > maxy) {
     189                maxy = n.getEastNorth().north();
     190            }
     191            if(n.getEastNorth().east() < minx) {
     192                minx = n.getEastNorth().east();
     193            }
     194            if(n.getEastNorth().north() < miny) {
     195                miny = n.getEastNorth().north();
     196            }
    183197        }
    184198
    185199        if ((minx > maxEN.east()) ||
    186             (miny > maxEN.north()) ||
    187             (maxx < minEN.east()) ||
    188             (maxy < minEN.north()))
     200                (miny > maxEN.north()) ||
     201                (maxx < minEN.east()) ||
     202                (maxy < minEN.north()))
    189203        {
    190204            w.mappaintVisibleCode = viewid;
     
    201215
    202216        w.mappaintVisibleCode = 0;
    203         if(fillAreas > dist)
     217        if(fillAreas > dist) {
    204218            w.clearErrors();
     219        }
    205220
    206221        if(wayStyle==null)
     
    226241            if (fillAreas > dist)
    227242            {
    228             //    profilerVisibleAreas++;
     243                //    profilerVisibleAreas++;
    229244                drawArea(w, w.isSelected() ? selectedColor : areaStyle.color);
    230                 if(!w.isClosed())
     245                if(!w.isClosed()) {
    231246                    w.putError(tr("Area style way is not closed."), true);
     247                }
    232248            }
    233249            drawWay(w, areaStyle.line, areaStyle.color, w.isSelected());
     
    241257           (even if the tag is negated as in oneway=false) or the way is selected */
    242258        boolean showDirection = w.isSelected() || ((!useRealWidth) && (showDirectionArrow
    243         && (!showRelevantDirectionsOnly || w.hasDirectionKeys())));
     259                && (!showRelevantDirectionsOnly || w.hasDirectionKeys())));
    244260        /* head only takes over control if the option is true,
    245261           the direction should be shown at all and not only because it's selected */
     
    253269        if(l != null)
    254270        {
    255             if (l.color != null) color = l.color;
     271            if (l.color != null) {
     272                color = l.color;
     273            }
    256274            width = l.width;
    257275            realWidth = l.realWidth;
     
    259277            dashedColor = l.dashedColor;
    260278        }
    261         if(selected)
     279        if(selected) {
    262280            color = selectedColor;
     281        }
    263282        if (realWidth > 0 && useRealWidth && !showDirection)
    264283        {
    265284            int tmpWidth = (int) (100 /  (float) (circum / realWidth));
    266             if (tmpWidth > width) width = tmpWidth;
     285            if (tmpWidth > width) {
     286                width = tmpWidth;
     287            }
    267288
    268289            /* if we have a "width" tag, try use it */
     
    281302        }
    282303
    283         if(w.highlighted)
     304        if(w.highlighted) {
    284305            color = highlightColor;
    285         else if(w.isSelected())
     306        } else if(w.isSelected()) {
    286307            color = selectedColor;
     308        }
    287309
    288310        /* draw overlays under the way */
     
    299321                        {
    300322                            drawSeg(lastN, n, s.color != null  && !w.isSelected() ? s.color : color,
    301                             false, s.getWidth(width), s.dashed, s.dashedColor);
     323                                    false, s.getWidth(width), s.dashed, s.dashedColor);
    302324                        }
    303325                        lastN = n;
     
    313335        {
    314336            Node n = it.next();
    315             if(lastN != null)
     337            if(lastN != null) {
    316338                drawSeg(lastN, n, color,
    317                     showOnlyHeadArrowOnly ? !it.hasNext() : showDirection, width, dashed, dashedColor);
     339                        showOnlyHeadArrowOnly ? !it.hasNext() : showDirection, width, dashed, dashedColor);
     340            }
    318341            lastN = n;
    319342        }
     
    332355                        {
    333356                            drawSeg(lastN, n, s.color != null && !w.isSelected() ? s.color : color,
    334                             false, s.getWidth(width), s.dashed, s.dashedColor);
     357                                    false, s.getWidth(width), s.dashed, s.dashedColor);
    335358                        }
    336359                        lastN = n;
     
    386409                            {
    387410                                nl = w.getNodesCount()-1;
    388                                 if(w.getNode(nl) == c.getNode(0)) mode = 21;
    389                                 else if(w.getNode(nl) == c.getNode(cl)) mode = 22;
    390                                 else if(w.getNode(0) == c.getNode(0)) mode = 11;
    391                                 else if(w.getNode(0) == c.getNode(cl)) mode = 12;
     411                                if(w.getNode(nl) == c.getNode(0)) {
     412                                    mode = 21;
     413                                } else if(w.getNode(nl) == c.getNode(cl)) {
     414                                    mode = 22;
     415                                } else if(w.getNode(0) == c.getNode(0)) {
     416                                    mode = 11;
     417                                } else if(w.getNode(0) == c.getNode(cl)) {
     418                                    mode = 12;
     419                                }
    392420                            }
    393421                            else
    394422                            {
    395423                                nl = n.size()-1;
    396                                 if(n.get(nl) == c.getNode(0)) mode = 21;
    397                                 else if(n.get(0) == c.getNode(cl)) mode = 12;
    398                                 else if(n.get(0) == c.getNode(0)) mode = 11;
    399                                 else if(n.get(nl) == c.getNode(cl)) mode = 22;
     424                                if(n.get(nl) == c.getNode(0)) {
     425                                    mode = 21;
     426                                } else if(n.get(0) == c.getNode(cl)) {
     427                                    mode = 12;
     428                                } else if(n.get(0) == c.getNode(0)) {
     429                                    mode = 11;
     430                                } else if(n.get(nl) == c.getNode(cl)) {
     431                                    mode = 22;
     432                                }
    400433                            }
    401434                            if(mode != 0)
     
    403436                                joinArray[i] = null;
    404437                                joined = true;
    405                                 if(c.isSelected()) selected = true;
     438                                if(c.isSelected()) {
     439                                    selected = true;
     440                                }
    406441                                --left;
    407                                 if(n == null) n = w.getNodes();
     442                                if(n == null) {
     443                                    n = w.getNodes();
     444                                }
    408445                                n.remove((mode == 21 || mode == 22) ? nl : 0);
    409                                 if(mode == 21)
     446                                if(mode == 21) {
    410447                                    n.addAll(c.getNodes());
    411                                 else if(mode == 12)
     448                                } else if(mode == 12) {
    412449                                    n.addAll(0, c.getNodes());
    413                                 else if(mode == 22)
     450                                } else if(mode == 22)
    414451                                {
    415                                     for(Node node : c.getNodes())
     452                                    for(Node node : c.getNodes()) {
    416453                                        n.add(nl, node);
     454                                    }
    417455                                }
    418456                                else /* mode == 11 */
    419457                                {
    420                                     for(Node node : c.getNodes())
     458                                    for(Node node : c.getNodes()) {
    421459                                        n.add(0, node);
     460                                    }
    422461                                }
    423462                            }
     
    437476                {
    438477                    errs.putError(tr("multipolygon way ''{0}'' is not closed.",
    439                     w.getName()), true);
     478                            w.getDisplayName(DefaultNameFormatter.getInstance())), true);
    440479                }
    441480            }
     
    447486
    448487    public void drawSelectedMember(OsmPrimitive osm, ElemStyle style, Boolean area,
    449     Boolean areaselected)
     488            Boolean areaselected)
    450489    {
    451490        if(osm instanceof Way)
     
    456495                AreaElemStyle areaStyle = (AreaElemStyle)style;
    457496                drawWay(way, areaStyle.line, selectedColor, true);
    458                 if(area)
     497                if(area) {
    459498                    drawArea(way, areaselected ? selectedColor : areaStyle.color);
     499                }
    460500            }
    461501            else
     
    466506        else if(osm instanceof Node)
    467507        {
    468             if(style != null && isZoomOk(style))
     508            if(style != null && isZoomOk(style)) {
    469509                drawNode((Node)osm, ((IconElemStyle)style).icon,
    470                 ((IconElemStyle)style).annotate, true);
    471             else
     510                        ((IconElemStyle)style).annotate, true);
     511            } else {
    472512                drawNode((Node)osm, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
     513            }
    473514        }
    474515        osm.mappaintDrawnCode = paintid;
    475516    }
    476517
     518    @Override
    477519    public void visit(Relation r) {
    478520
     
    497539        {
    498540            if(drawMultipolygon(r))
    499               return;
     541                return;
    500542        }
    501543        else if (drawRestriction && "restriction".equals(r.get("type")))
     
    511553                {
    512554                    drawSelectedMember(m.getMember(), styles != null ? getPrimitiveStyle(m.getMember())
    513                     : null, true, true);
     555                            : null, true, true);
    514556                }
    515557            }
     
    535577            //    System.out.println("member " + m.member + " selected " + r.selected);
    536578
    537             if(m.getMember() == null)
     579            if(m.getMember() == null) {
    538580                // TODO Nullable member will not be allowed after RelationMember.member is encalupsed
    539581                r.putError(tr("Empty member in relation."), true);
    540             else if(m.getMember().deleted)
     582            } else if(m.getMember().deleted) {
    541583                r.putError(tr("Deleted member ''{0}'' in relation.",
    542                 m.getMember().getName()), true);
    543             else if(m.getMember().incomplete)
    544             {
     584                        m.getMember().getDisplayName(DefaultNameFormatter.getInstance())), true);
     585            } else if(m.getMember().incomplete)
    545586                return;
    546             }
    547587            else
    548588            {
     
    553593                    {
    554594                        r.putError(tr("Way ''{0}'' with less than two points.",
    555                         w.getName()), true);
     595                                w.getDisplayName(DefaultNameFormatter.getInstance())), true);
    556596                    }
    557597                    else if("from".equals(m.getRole())) {
    558                         if(fromWay != null)
     598                        if(fromWay != null) {
    559599                            r.putError(tr("More than one \"from\" way found."), true);
    560                         else {
     600                        } else {
    561601                            fromWay = w;
    562602                        }
    563603                    } else if("to".equals(m.getRole())) {
    564                         if(toWay != null)
     604                        if(toWay != null) {
    565605                            r.putError(tr("More than one \"to\" way found."), true);
    566                         else {
     606                        } else {
    567607                            toWay = w;
    568608                        }
    569609                    } else if("via".equals(m.getRole())) {
    570                         if(via != null)
     610                        if(via != null) {
    571611                            r.putError(tr("More than one \"via\" found."), true);
    572                         else
     612                        } else {
    573613                            via = w;
    574                     }
    575                     else
     614                        }
     615                    } else {
    576616                        r.putError(tr("Unknown role ''{0}''.", m.getRole()), true);
     617                    }
    577618                }
    578619                else if(m.isNode())
     
    581622                    if("via".equals(m.getRole()))
    582623                    {
    583                         if(via != null)
     624                        if(via != null) {
    584625                            r.putError(tr("More than one \"via\" found."), true);
    585                         else
     626                        } else {
    586627                            via = n;
    587                     }
    588                     else
     628                        }
     629                    } else {
    589630                        r.putError(tr("Unknown role ''{0}''.", m.getRole()), true);
    590                 }
    591                 else
    592                     r.putError(tr("Unknown member type for ''{0}''.", m.getMember().getName()), true);
     631                    }
     632                } else {
     633                    r.putError(tr("Unknown member type for ''{0}''.", m.getMember().getDisplayName(DefaultNameFormatter.getInstance())), true);
     634                }
    593635            }
    594636        }
     
    615657                return;
    616658            }
    617             if(!toWay.isFirstLastNode(viaNode))
     659            if(!toWay.isFirstLastNode(viaNode)) {
    618660                r.putError(tr("The \"to\" way doesn't start or end at a \"via\" node."), true);
     661            }
    619662        }
    620663        else
     
    623666            Node firstNode = viaWay.firstNode();
    624667            Node lastNode = viaWay.lastNode();
    625             if(fromWay.isFirstLastNode(firstNode))
     668            if(fromWay.isFirstLastNode(firstNode)) {
    626669                viaNode = firstNode;
    627             else if(fromWay.isFirstLastNode(lastNode))
     670            } else if(fromWay.isFirstLastNode(lastNode)) {
    628671                viaNode = firstNode;
    629             else {
     672            } else {
    630673                r.putError(tr("The \"from\" way doesn't start or end at the \"via\" way."), true);
    631674                return;
    632675            }
    633             if(!toWay.isFirstLastNode(viaNode == firstNode ? lastNode : firstNode))
     676            if(!toWay.isFirstLastNode(viaNode == firstNode ? lastNode : firstNode)) {
    634677                r.putError(tr("The \"to\" way doesn't start or end at the \"via\" way."), true);
     678            }
    635679        }
    636680
     
    675719           (calculate the vector vx/vy with the specified length and the direction
    676720           away from the "via" node along the first segment of the "from" way)
    677         */
     721         */
    678722        double distanceFromVia=14;
    679723        double dx = (pFrom.x >= pVia.x) ? (pFrom.x - pVia.x) : (pVia.x - pFrom.x);
     
    691735        double vy = distanceFromVia * Math.sin(fromAngle);
    692736
    693         if(pFrom.x < pVia.x) vx = -vx;
    694         if(pFrom.y < pVia.y) vy = -vy;
     737        if(pFrom.x < pVia.x) {
     738            vx = -vx;
     739        }
     740        if(pFrom.y < pVia.y) {
     741            vy = -vy;
     742        }
    695743
    696744        //if(restrictionDebug)
     
    700748           (calculate the vx2/vy2 vector with the specified length and the direction
    701749           90degrees away from the first segment of the "from" way)
    702         */
     750         */
    703751        double distanceFromWay=10;
    704752        double vx2 = 0;
     
    740788                vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg + 180));
    741789                vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg + 180));
    742              } else {
     790            } else {
    743791                vx2 = distanceFromWay * Math.sin(Math.toRadians(fromAngleDeg));
    744792                vy2 = distanceFromWay * Math.cos(Math.toRadians(fromAngleDeg));
     
    783831        for (RelationMember m : r.getMembers())
    784832        {
    785             if(m.getMember() == null)
     833            if(m.getMember() == null) {
    786834                //TODO Remove useless nullcheck when RelationMember.member is encalupsed
    787835                r.putError(tr("Empty member in relation."), true);
    788             else if(m.getMember().deleted)
     836            } else if(m.getMember().deleted) {
    789837                r.putError(tr("Deleted member ''{0}'' in relation.",
    790                 m.getMember().getName()), true);
    791             else if(m.getMember().incomplete)
     838                        m.getMember().getDisplayName(DefaultNameFormatter.getInstance())), true);
     839            } else if(m.getMember().incomplete) {
    792840                incomplete = true;
    793             else
     841            } else
    794842            {
    795843                if(m.isWay())
     
    799847                    {
    800848                        r.putError(tr("Way ''{0}'' with less than two points.",
    801                         w.getName()), true);
    802                     }
    803                     else if("inner".equals(m.getRole()))
     849                                w.getDisplayName(DefaultNameFormatter.getInstance())), true);
     850                    }
     851                    else if("inner".equals(m.getRole())) {
    804852                        inner.add(w);
    805                     else if("outer".equals(m.getRole()))
     853                    } else if("outer".equals(m.getRole())) {
    806854                        outer.add(w);
    807                     else
     855                    } else
    808856                    {
    809857                        r.putError(tr("No useful role ''{0}'' for Way ''{1}''.",
    810                           m.getRole(), w.getName()), true);
    811                         if(!m.hasRole())
     858                                m.getRole(), w.getDisplayName(DefaultNameFormatter.getInstance())), true);
     859                        if(!m.hasRole()) {
    812860                            outer.add(w);
    813                         else if(r.isSelected())
     861                        } else if(r.isSelected()) {
    814862                            drawSelectedMember(m.getMember(), styles != null
    815                             ? getPrimitiveStyle(m.getMember()) : null, true, true);
     863                                    ? getPrimitiveStyle(m.getMember()) : null, true, true);
     864                        }
    816865                    }
    817866                }
     
    819868                {
    820869                    r.putError(tr("Non-Way ''{0}'' in multipolygon.",
    821                     m.getMember().getName()), true);
     870                            m.getMember().getDisplayName(DefaultNameFormatter.getInstance())), true);
    822871                }
    823872            }
     
    829878            for (Way w : outer)
    830879            {
    831                if(wayStyle == null)
    832                    wayStyle = styles.getArea(w);
     880                if(wayStyle == null) {
     881                    wayStyle = styles.getArea(w);
     882                }
    833883            }
    834884            r.mappaintStyle = wayStyle;
     
    844894            for (Way w : outer)
    845895            {
    846                 if(w.isClosed()) outerclosed.add(w);
    847                 else join.add(w);
     896                if(w.isClosed()) {
     897                    outerclosed.add(w);
     898                } else {
     899                    join.add(w);
     900                }
    848901            }
    849902            if(join.size() != 0)
    850903            {
    851                 for(Way w : joinWays(join, incomplete ? null : r))
     904                for(Way w : joinWays(join, incomplete ? null : r)) {
    852905                    outerclosed.add(w);
     906                }
    853907            }
    854908
     
    856910            for (Way w : inner)
    857911            {
    858                 if(w.isClosed()) innerclosed.add(w);
    859                 else join.add(w);
     912                if(w.isClosed()) {
     913                    innerclosed.add(w);
     914                } else {
     915                    join.add(w);
     916                }
    860917            }
    861918            if(join.size() != 0)
    862919            {
    863                 for(Way w : joinWays(join, incomplete ? null : r))
     920                for(Way w : joinWays(join, incomplete ? null : r)) {
    864921                    innerclosed.add(w);
     922                }
    865923            }
    866924
     
    868926            {
    869927                r.putError(tr("No outer way for multipolygon ''{0}''.",
    870                 r.getName()), true);
     928                        r.getDisplayName(DefaultNameFormatter.getInstance())), true);
    871929                visible = true; /* prevent killing remaining ways */
    872930            }
     
    892950                        for(int i = 0; i < p.npoints; ++i)
    893951                        {
    894                             if(poly.contains(p.xpoints[i],p.ypoints[i]))
     952                            if(poly.contains(p.xpoints[i],p.ypoints[i])) {
    895953                                --contains;
     954                            }
    896955                        }
    897956                        if(contains == 0) return 1;
     
    901960                    public void addInner(Polygon p)
    902961                    {
    903                         if(inner == null)
     962                        if(inner == null) {
    904963                            inner = new ArrayList<Polygon>();
     964                        }
    905965                        inner.add(p);
    906966                    }
     
    908968                    {
    909969                        return (poly.npoints >= 3
    910                         && poly.xpoints[0] == poly.xpoints[poly.npoints-1]
    911                         && poly.ypoints[0] == poly.ypoints[poly.npoints-1]);
     970                                && poly.xpoints[0] == poly.xpoints[poly.npoints-1]
     971                                                                   && poly.ypoints[0] == poly.ypoints[poly.npoints-1]);
    912972                    }
    913973                    public Polygon get()
     
    917977                            for (Polygon pp : inner)
    918978                            {
    919                                 for(int i = 0; i < pp.npoints; ++i)
     979                                for(int i = 0; i < pp.npoints; ++i) {
    920980                                    poly.addPoint(pp.xpoints[i],pp.ypoints[i]);
     981                                }
    921982                                poly.addPoint(p.x,p.y);
    922983                            }
     
    9541015                            {
    9551016                                r.putError(tr("Intersection between ways ''{0}'' and ''{1}''.",
    956                                 pd.way.getName(), wInner.getName()), true);
     1017                                        pd.way.getDisplayName(DefaultNameFormatter.getInstance()), wInner.getDisplayName(DefaultNameFormatter.getInstance())), true);
    9571018                            }
    958                             if(o == null || o.contains(pd.poly) > 0)
     1019                            if(o == null || o.contains(pd.poly) > 0) {
    9591020                                o = pd;
     1021                            }
    9601022                        }
    9611023                    }
     
    9651027                        {
    9661028                            r.putError(tr("Inner way ''{0}'' is outside.",
    967                             wInner.getName()), true);
     1029                                    wInner.getDisplayName(DefaultNameFormatter.getInstance())), true);
    9681030                        }
    9691031                        o = poly.get(0);
     
    9781040                    {
    9791041                        drawAreaPolygon(p, (pd.way.isSelected() || r.isSelected()) ? selectedColor
    980                         : areaStyle.color);
     1042                                : areaStyle.color);
    9811043                        visible = true;
    9821044                    }
     
    9861048            {
    9871049                r.mappaintVisibleCode = viewid;
    988                 for (Way wInner : inner)
     1050                for (Way wInner : inner) {
    9891051                    wInner.mappaintVisibleCode = viewid;
    990                 for (Way wOuter : outer)
     1052                }
     1053                for (Way wOuter : outer) {
    9911054                    wOuter.mappaintVisibleCode = viewid;
     1055                }
    9921056                return drawn;
    9931057            }
     
    9981062                {
    9991063                    if(zoomok && (wInner.mappaintDrawnCode != paintid
    1000                     || outer.size() == 0))
     1064                            || outer.size() == 0))
    10011065                    {
    10021066                        drawWay(wInner, ((AreaElemStyle)wayStyle).line,
    1003                         ((AreaElemStyle)wayStyle).color, wInner.isSelected()
    1004                         || r.isSelected());
     1067                                ((AreaElemStyle)wayStyle).color, wInner.isSelected()
     1068                                || r.isSelected());
    10051069                    }
    10061070                    wInner.mappaintDrawnCode = paintid;
     
    10111075                    {
    10121076                        drawSelectedMember(wInner, innerStyle,
    1013                         !wayStyle.equals(innerStyle), wInner.isSelected());
     1077                                !wayStyle.equals(innerStyle), wInner.isSelected());
    10141078                    }
    10151079                    if(wayStyle.equals(innerStyle))
    10161080                    {
    10171081                        r.putError(tr("Style for inner way ''{0}'' equals multipolygon.",
    1018                         wInner.getName()), false);
    1019                         if(!r.isSelected())
     1082                                wInner.getDisplayName(DefaultNameFormatter.getInstance())), false);
     1083                        if(!r.isSelected()) {
    10201084                            wInner.mappaintDrawnAreaCode = paintid;
     1085                        }
    10211086                    }
    10221087                }
     
    10301095                    {
    10311096                        drawWay(wOuter, ((AreaElemStyle)wayStyle).line,
    1032                         ((AreaElemStyle)wayStyle).color, wOuter.isSelected()
    1033                         || r.isSelected());
     1097                                ((AreaElemStyle)wayStyle).color, wOuter.isSelected()
     1098                                || r.isSelected());
    10341099                    }
    10351100                    wOuter.mappaintDrawnCode = paintid;
     
    10381103                {
    10391104                    if(outerStyle instanceof AreaElemStyle
    1040                     && !wayStyle.equals(outerStyle))
     1105                            && !wayStyle.equals(outerStyle))
    10411106                    {
    10421107                        r.putError(tr("Style for outer way ''{0}'' mismatches.",
    1043                         wOuter.getName()), true);
     1108                                wOuter.getDisplayName(DefaultNameFormatter.getInstance())), true);
    10441109                    }
    10451110                    if(r.isSelected())
     
    10471112                        drawSelectedMember(wOuter, outerStyle, false, false);
    10481113                    }
    1049                     else if(outerStyle instanceof AreaElemStyle)
     1114                    else if(outerStyle instanceof AreaElemStyle) {
    10501115                        wOuter.mappaintDrawnAreaCode = paintid;
     1116                    }
    10511117                }
    10521118            }
     
    11151181            for (String rn : regionalNameOrder) {
    11161182                name = n.get(rn);
    1117                 if (name != null) break;
     1183                if (name != null) {
     1184                    break;
     1185                }
    11181186            }
    11191187        }
     
    11291197        Point p2 = nc.getPoint(n2);
    11301198
    1131         if (!isSegmentVisible(p1, p2)) {
     1199        if (!isSegmentVisible(p1, p2))
    11321200            return;
    1133         }
    11341201        //profilerVisibleSegments++;
    11351202        currentPath.moveTo(p1.x, p1.y);
     
    11441211    }
    11451212
     1213    @Override
    11461214    protected void displaySegments() {
    11471215        displaySegments(null, 0, new float[0], null);
     
    11591227                        g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
    11601228                    }
    1161                 }
    1162                 else
     1229                } else {
    11631230                    g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
     1231                }
    11641232            }
    11651233            g2d.draw(currentPath);
     
    11781246                            g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
    11791247                        }
    1180                     }
    1181                     else
     1248                    } else {
    11821249                        g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
     1250                    }
    11831251                }
    11841252                g2d.draw(currentPath);
    11851253            }
    11861254
    1187             if(useStrokes > dist)
     1255            if(useStrokes > dist) {
    11881256                g2d.setStroke(new BasicStroke(1));
     1257            }
    11891258
    11901259            currentPath = new GeneralPath();
     
    12031272     * @param color The color of the node.
    12041273     */
     1274    @Override
    12051275    public void drawNode(Node n, Color color, int size, int radius, boolean fill) {
    12061276        if (isZoomOk(null) && size > 1) {
     
    12161286                g.fillRect(p.x - radius, p.y - radius, size, size);
    12171287                g.drawRect(p.x - radius, p.y - radius, size, size);
    1218             } else
     1288            } else {
    12191289                g.drawRect(p.x - radius, p.y - radius, size, size);
     1290            }
    12201291
    12211292            if(showNames > dist)
     
    12341305    }
    12351306
     1307    @Override
    12361308    public void getColors()
    12371309    {
     
    12421314
    12431315    /* Shows areas before non-areas */
     1316    @Override
    12441317    public void visitAll(DataSet data, Boolean virtual) {
    12451318
     
    13031376
    13041377            /*** RELATIONS ***/
    1305         //    profilerN = 0;
     1378            //    profilerN = 0;
    13061379            for (final Relation osm : data.relations)
    13071380            {
     
    13091382                {
    13101383                    osm.visit(this);
    1311         //            profilerN++;
    1312                 }
    1313             }
    1314 
    1315         //    if(profiler)
    1316         //    {
    1317         //        System.out.format("Relations: %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    1318         //        profilerLast = java.lang.System.currentTimeMillis();
    1319         //    }
     1384                    //            profilerN++;
     1385                }
     1386            }
     1387
     1388            //    if(profiler)
     1389            //    {
     1390            //        System.out.format("Relations: %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     1391            //        profilerLast = java.lang.System.currentTimeMillis();
     1392            //    }
    13201393
    13211394            /*** AREAS ***/
    1322         //    profilerN = 0;
     1395            //    profilerN = 0;
    13231396            for (final Way osm : data.ways)
    13241397            {
    13251398                if (!osm.incomplete && !osm.deleted
    1326                 && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid)
     1399                        && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid)
    13271400                {
    13281401                    if(isPrimitiveArea(osm) && osm.mappaintDrawnAreaCode != paintid)
    13291402                    {
    13301403                        osm.visit(this);
    1331         //                profilerN++;
    1332                     } else
     1404                        //                profilerN++;
     1405                    } else {
    13331406                        noAreaWays.add(osm);
    1334                 }
    1335             }
    1336 
    1337         //    if(profiler)
    1338         //    {
    1339         //        System.out.format("Areas    : %5dms, calls=%7d, visible=%d\n",
    1340         //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleAreas);
    1341         //        profilerLast = java.lang.System.currentTimeMillis();
    1342         //    }
     1407                    }
     1408                }
     1409            }
     1410
     1411            //    if(profiler)
     1412            //    {
     1413            //        System.out.format("Areas    : %5dms, calls=%7d, visible=%d\n",
     1414            //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleAreas);
     1415            //        profilerLast = java.lang.System.currentTimeMillis();
     1416            //    }
    13431417
    13441418            /*** WAYS ***/
    1345         //    profilerN = 0;
     1419            //    profilerN = 0;
    13461420            fillAreas = 0;
    13471421            for (final OsmPrimitive osm : noAreaWays)
    13481422            {
    13491423                osm.visit(this);
    1350         //        profilerN++;
    1351             }
    1352 
    1353         //    if(profiler)
    1354         //    {
    1355         //        System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
    1356         //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
    1357         //        profilerLast = java.lang.System.currentTimeMillis();
    1358         //    }
     1424                //        profilerN++;
     1425            }
     1426
     1427            //    if(profiler)
     1428            //    {
     1429            //        System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
     1430            //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
     1431            //        profilerLast = java.lang.System.currentTimeMillis();
     1432            //    }
    13591433        }
    13601434        else
    13611435        {
    13621436            /*** WAYS (filling disabled)  ***/
    1363         //    profilerN = 0;
     1437            //    profilerN = 0;
    13641438            for (final OsmPrimitive osm : data.ways)
    13651439                if (!osm.incomplete && !osm.deleted && !osm.isSelected()
    1366                 && osm.mappaintVisibleCode != viewid )
     1440                        && osm.mappaintVisibleCode != viewid )
    13671441                {
    13681442                    osm.visit(this);
    1369         //            profilerN++;
    1370                 }
    1371 
    1372         //    if(profiler)
    1373         //    {
    1374         //        System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
    1375         //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
    1376         //        profilerLast = java.lang.System.currentTimeMillis();
    1377         //    }
     1443                    //            profilerN++;
     1444                }
     1445
     1446            //    if(profiler)
     1447            //    {
     1448            //        System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
     1449            //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
     1450            //        profilerLast = java.lang.System.currentTimeMillis();
     1451            //    }
    13781452        }
    13791453
     
    13831457        for (final OsmPrimitive osm : data.getSelected()) {
    13841458            if (!osm.incomplete && !osm.deleted && !(osm instanceof Node)
    1385             && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid)
     1459                    && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid)
    13861460            {
    13871461                osm.visit(this);
    1388         //        profilerN++;
     1462                //        profilerN++;
    13891463            }
    13901464        }
     
    14031477        for (final OsmPrimitive osm : data.nodes)
    14041478            if (!osm.incomplete && !osm.deleted
    1405             && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid)
     1479                    && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid)
    14061480            {
    14071481                osm.visit(this);
    1408         //        profilerN++;
     1482                //        profilerN++;
    14091483            }
    14101484
     
    14191493        if (virtualNodeSize != 0)
    14201494        {
    1421         //    profilerN = 0;
     1495            //    profilerN = 0;
    14221496            currentColor = nodeColor;
    14231497            for (final OsmPrimitive osm : data.ways)
    14241498                if (!osm.incomplete && !osm.deleted
    1425                 && osm.mappaintVisibleCode != viewid )
     1499                        && osm.mappaintVisibleCode != viewid )
    14261500                {
    14271501                    /* TODO: move this into the SimplePaint code? */
    1428         //            if(!profilerOmitDraw)
    1429                         visitVirtual((Way)osm);
    1430         //            profilerN++;
    1431                 }
    1432 
    1433         //    if(profiler)
    1434         //    {
    1435         //        System.out.format("Virtual  : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    1436         //        profilerLast = java.lang.System.currentTimeMillis();
    1437         //    }
     1502                    //            if(!profilerOmitDraw)
     1503                    visitVirtual((Way)osm);
     1504                    //            profilerN++;
     1505                }
     1506
     1507            //    if(profiler)
     1508            //    {
     1509            //        System.out.format("Virtual  : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     1510            //        profilerLast = java.lang.System.currentTimeMillis();
     1511            //    }
    14381512
    14391513            displaySegments(null);
Note: See TracChangeset for help on using the changeset viewer.