Changeset 857 in josm for trunk/src


Ignore:
Timestamp:
2008-08-24T14:32:24+02:00 (16 years ago)
Author:
stoecker
Message:

changed design of virtual nodes

Location:
trunk/src/org/openstreetmap/josm/data/osm/visitor
Files:
2 edited

Legend:

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

    r855 r857  
    157157                                        if(w.selected)
    158158                                        {
    159                                                 if(showDirection || virtualNodeSize != 0)
    160                                                         drawSeg(lastN, n, selectedColor, showDirection, width, false, false);
     159                                                if(showDirection)
     160                                                        drawSeg(lastN, n, selectedColor, showDirection, width, dashed, false);
    161161                                        }
    162162                                        else
    163                                                 drawSeg(lastN, n, untaggedColor, showDirection, width, dashed, true);
     163                                                drawSeg(lastN, n, colour, showDirection, width, dashed, true);
    164164                                }
    165165                                else
    166                                         drawSeg(lastN, n, w.selected ? selectedColor : colour, showDirection, width, true, true);
     166                                        drawSeg(lastN, n, w.selected ? selectedColor : colour, showDirection, width, dashed, true);
    167167                        } else {
    168168                                if (realWidth > 0 && useRealWidth && !showDirection) {
     
    244244                        return;
    245245                }
    246                 drawVirtualNode(p1, p2, col);
    247246                if(drawway)
    248247                {
     
    340339                        if (!osm.incomplete && !osm.deleted)
    341340                                osm.visit(this);
     341
     342                if(virtualNodeSize != 0)
     343                {
     344                        currentColor = nodeColor;
     345                        for (final OsmPrimitive osm : data.ways)
     346                                if (!osm.deleted)
     347                                        visitVirtual((Way)osm);
     348                        displaySegments(null);
     349                }
    342350        }
    343351
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r856 r857  
    134134                displaySegments(null);
    135135
     136                for (final OsmPrimitive osm : data.getSelected())
     137                        if (!osm.deleted)
     138                                osm.visit(this);
     139                displaySegments(null);
     140
    136141                for (final OsmPrimitive osm : data.nodes)
    137142                        if (!osm.deleted && !osm.selected)
    138143                                osm.visit(this);
    139 
    140                 for (final OsmPrimitive osm : data.getSelected())
    141                         if (!osm.deleted)
    142                                 osm.visit(this);
    143                 displaySegments(null);
     144                if(virtualNodeSize != 0)
     145                {
     146                        currentColor = nodeColor;
     147                        for (final OsmPrimitive osm : data.ways)
     148                                if (!osm.deleted)
     149                                        visitVirtual((Way)osm);
     150                        displaySegments(null);
     151                }
    144152        }
    145153
     
    161169                else
    162170                        drawNode(n, nodeColor, unselectedNodeSize, unselectedNodeRadius, fillUnselectedNode);
     171        }
     172
     173        public void visitVirtual(Way w) {
     174                Iterator<Node> it = w.nodes.iterator();
     175                if (it.hasNext()) {
     176                        Point lastP = nc.getPoint(it.next().eastNorth);
     177                        while(it.hasNext())
     178                        {
     179                                Point p = nc.getPoint(it.next().eastNorth);
     180                                if(isSegmentVisible(lastP, p))
     181                                {
     182                                        int xd = p.x-lastP.x; if(xd < 0) xd = -xd;
     183                                        int yd = p.y-lastP.y; if(yd < 0) yd = -yd;
     184                                        if(xd+yd > virtualNodeSpace)
     185                                        {
     186                                                int x = (p.x+lastP.x)/2;
     187                                                int y = (p.y+lastP.y)/2;
     188                                                currentPath.moveTo(x-5, y);
     189                                                currentPath.lineTo(x+5, y);
     190                                                currentPath.moveTo(x, y-5);
     191                                                currentPath.lineTo(x, y+5);
     192                                        }
     193                                }
     194                                lastP = p;
     195                        }
     196                }
    163197        }
    164198
     
    282316        }
    283317
    284         protected void drawVirtualNode(Point p1, Point p2, Color col)
    285         {
    286                 if(virtualNodeSize > 0)
    287                 {
    288                         int xd = p2.x-p1.x; if(xd < 0) xd = -xd;
    289                         int yd = p2.y-p1.y; if(yd < 0) yd = -yd;
    290                         if(xd+yd > virtualNodeSpace)
    291                         {
    292                                 int x = (p1.x+p2.x)/2;
    293                                 int y = (p1.y+p2.y)/2;
    294                                 currentPath.moveTo(x-5, y);
    295                                 currentPath.lineTo(x+5, y);
    296                                 currentPath.moveTo(x, y-5);
    297                                 currentPath.lineTo(x, y+5);
    298                         }
    299                 }
    300         }
    301 
    302318        /**
    303319         * Draw a line with the given color.
     
    308324
    309325                if (isSegmentVisible(p1, p2)) {
    310                         drawVirtualNode(p1, p2, col);
    311 
    312326                        currentPath.moveTo(p1.x, p1.y);
    313327                        currentPath.lineTo(p2.x, p2.y);
Note: See TracChangeset for help on using the changeset viewer.