Ignore:
Timestamp:
2011-02-06T15:48:58+01:00 (13 years ago)
Author:
bastiK
Message:

mapcss: fill-image

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

Legend:

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

    r3858 r3862  
    8181
    8282        outlineOnly = Main.pref.getBoolean("draw.data.area_outline_only", false);
    83 
     83       
    8484    }
    8585
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintVisitor.java

    r3836 r3862  
    101101        styles = MapPaintStyles.getStyles();
    102102
     103        this.paintSettings = MapPaintSettings.INSTANCE;
     104
    103105        circum = nc.getDist100Pixel();
    104         boolean drawArea = circum <= Main.pref.getInteger("mappaint.fillareas", 10000000);
     106        boolean drawArea = circum <= Main.pref.getInteger("mappaint.fillareas", 10000000) && !paintSettings.isOutlineOnly();
    105107        boolean drawMultipolygon = drawArea && Main.pref.getBoolean("mappaint.multipolygon", true);
    106108        styles.setDrawMultipolygon(drawMultipolygon);
     
    112114                        RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
    113115
    114         this.paintSettings = MapPaintSettings.INSTANCE;
    115116        this.painter = new MapPainter(paintSettings, g, inactive, nc, virtual, circum, leftHandTraffic);
    116117
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java

    r3860 r3862  
    1111import java.awt.Polygon;
    1212import java.awt.Rectangle;
     13import java.awt.TexturePaint;
    1314import java.awt.geom.GeneralPath;
    1415import java.awt.geom.Rectangle2D;
     16import java.awt.image.BufferedImage;
    1517import java.util.Arrays;
    1618import java.util.Collection;
     
    4244    private final boolean showNames;
    4345    private final boolean showIcons;
    44     private final boolean outlineOnly;
    4546
    4647    private final Color inactiveColor;
     
    7879        this.showNames = settings.getShowNamesDistance() > circum;
    7980        this.showIcons = settings.getShowIconsDistance() > circum;
    80         this.outlineOnly = settings.isOutlineOnly();
    8181
    8282        this.inactiveColor = PaintColors.INACTIVE.get();
     
    258258    }
    259259
    260     public void drawArea(Way w, Color color, String name) {
     260    public void drawArea(Way w, Color color, BufferedImage fillImage, String name) {
    261261        Polygon polygon = getPolygon(w);
    262         drawArea(polygon, color, name);
    263     }
    264 
    265     protected void drawArea(Polygon polygon, Color color, String name) {
    266 
    267         g.setColor(color);
    268 
    269         if (outlineOnly) {
    270             g.drawPolygon(polygon);
     262        drawArea(polygon, color, fillImage, name);
     263    }
     264
     265    protected void drawArea(Polygon polygon, Color color, BufferedImage fillImage, String name) {
     266
     267        if (fillImage == null) {
     268            g.setColor(color);
     269            g.fillPolygon(polygon);
    271270        } else {
    272             g.fillPolygon(polygon);
    273         }
    274 
     271            TexturePaint texture = new TexturePaint(fillImage,
     272                    new Rectangle(polygon.xpoints[0], polygon.ypoints[0], fillImage.getWidth(), fillImage.getHeight()));
     273
     274            g.setPaint(texture);
     275            g.fill(polygon);
     276        }
    275277
    276278        if (name != null) {
     
    311313    }
    312314
    313     public void drawArea(Relation r, Color color, String name) {
     315    public void drawArea(Relation r, Color color, BufferedImage fillImage, String name) {
    314316        Multipolygon multipolygon = new Multipolygon(nc);
    315317        multipolygon.load(r);
     
    320322                    continue;
    321323                }
    322                 drawArea(p, color, getAreaName(r));
     324                drawArea(p, color, fillImage, getAreaName(r));
    323325            }
    324326        }
Note: See TracChangeset for help on using the changeset viewer.