Ignore:
Timestamp:
2008-08-24T19:27:36+02:00 (16 years ago)
Author:
stoecker
Message:

changed drawing areas a lot

File:
1 edited

Legend:

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

    r862 r863  
    152152                        orderNumber++;
    153153
    154                         if (area) {
    155                                 if(fillAreas)
    156                                 {
    157                                         if(w.selected)
    158                                         {
    159                                                 if(showDirection)
    160                                                         drawSeg(lastN, n, selectedColor, showDirection, width, dashed, false);
    161                                         }
    162                                         else
    163                                                 drawSeg(lastN, n, colour, showDirection, width, dashed, true);
    164                                 }
    165                                 else
    166                                         drawSeg(lastN, n, w.selected ? selectedColor : colour, showDirection, width, dashed, true);
    167                         } else {
    168                                 if (realWidth > 0 && useRealWidth && !showDirection) {
    169                                         int tmpWidth = (int) (100 /  (float) (circum / realWidth));
    170                                         if (tmpWidth > width) width = tmpWidth;
    171                                 }
    172                                 drawSeg(lastN, n, w.selected ? selectedColor : colour, showDirection, width, dashed, true);
    173                         }
     154                        if (!area && realWidth > 0 && useRealWidth && !showDirection) {
     155                                int tmpWidth = (int) (100 /  (float) (circum / realWidth));
     156                                if (tmpWidth > width) width = tmpWidth;
     157                        }
     158                        drawSeg(lastN, n, w.selected ? selectedColor : colour, showDirection, width, dashed);
    174159
    175160                        if (showOrderNumber)
     
    188173        {
    189174                Polygon polygon = new Polygon();
    190                 Point p;
     175
     176                for (Node n : w.nodes)
     177                {
     178                        Point p = nc.getPoint(n.eastNorth);
     179                        polygon.addPoint(p.x,p.y);
     180                }
     181
     182                Color mycolor = w.selected ? selectedColor : colour;
    191183                // set the opacity (alpha) level of the filled polygon
    192                 Color coloura = new Color( colour.getRed(), colour.getGreen(), colour.getBlue(), fillAlpha);
    193 
    194                 for (Node n : w.nodes)
    195                 {
    196                         p = nc.getPoint(n.eastNorth);
    197                         polygon.addPoint(p.x,p.y);
    198                 }
    199 
    200                 g.setColor( w.selected ?
    201                                 selectedColor : coloura);
     184                g.setColor(new Color( mycolor.getRed(), mycolor.getGreen(), mycolor.getBlue(), fillAlpha));
    202185
    203186                g.fillPolygon(polygon);
     
    226209        }
    227210
    228         /**
    229          * Draw a line with the given color.
    230          */
    231         protected void drawSegment(Node n1, Node n2, Color col, boolean showDirection) {
    232                 if (useRealWidth && showDirection) showDirection = false;
    233                 drawSeg(n1, n2, col, showDirection, 1, false, true);
    234         }
    235 
    236         private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, boolean dashed, boolean drawway) {
     211        private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, boolean dashed) {
    237212                if (col != currentColor || width != currentWidth || dashed != currentDashed) {
    238213                        displaySegments(col, width, dashed);
     
    244219                        return;
    245220                }
    246                 if(drawway)
    247                 {
    248                         currentPath.moveTo(p1.x, p1.y);
    249                         currentPath.lineTo(p2.x, p2.y);
    250                 }
     221                currentPath.moveTo(p1.x, p1.y);
     222                currentPath.lineTo(p2.x, p2.y);
    251223
    252224                if (showDirection) {
    253225                        double t = Math.atan2(p2.y-p1.y, p2.x-p1.x) + Math.PI;
    254                         if(!drawway)
    255                                 currentPath.moveTo(p2.x, p2.y);
    256226                        currentPath.lineTo((int)(p2.x + 10*Math.cos(t-PHI)), (int)(p2.y + 10*Math.sin(t-PHI)));
    257227                        currentPath.moveTo((int)(p2.x + 10*Math.cos(t+PHI)), (int)(p2.y + 10*Math.sin(t+PHI)));
Note: See TracChangeset for help on using the changeset viewer.