Changeset 18595 in osm


Ignore:
Timestamp:
2009-11-14T19:38:46+01:00 (16 years ago)
Author:
jttt
Message:

Updated to new MapViewPaintable.paint arguments

Location:
applications/editors/josm/plugins
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/build.xml

    r18413 r18595  
    2626                <attribute name="Plugin-Description" value="A special handler for the French land registry WMS server."/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/FR:JOSM/Fr:Plugin/Cadastre"/>
    28                 <attribute name="Plugin-Mainversion" value="2381"/>
     28                <attribute name="Plugin-Mainversion" value="2450"/>
    2929                <attribute name="Plugin-Stage" value="60"/>
    3030                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r18544 r18595  
    2626
    2727import org.openstreetmap.josm.Main;
     28import org.openstreetmap.josm.data.Bounds;
     29import org.openstreetmap.josm.data.coor.EastNorth;
    2830import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    2931import org.openstreetmap.josm.data.projection.LambertCC9Zones;
    30 import org.openstreetmap.josm.data.Bounds;
    3132import org.openstreetmap.josm.gui.MapView;
    3233import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     
    3435import org.openstreetmap.josm.gui.layer.Layer;
    3536import org.openstreetmap.josm.io.OsmTransferException;
    36 import org.openstreetmap.josm.data.coor.EastNorth;
    3737
    3838/**
     
    6565
    6666    private boolean isRaster = false;
    67    
     67
    6868    private boolean isAlreadyGeoreferenced = false;
    69    
     69
    7070    public double X0, Y0, angle, fX, fY;
    7171
     
    7373    private EastNorth rasterMax;
    7474    private double rasterRatio;
    75    
     75
    7676    private JMenuItem saveAsPng;
    7777
     
    103103        if (isRaster) {
    104104            b = new Bounds(Main.proj.eastNorth2latlon(rasterMin), Main.proj.eastNorth2latlon(rasterMax));
    105             divideBbox(b, Integer.parseInt(Main.pref.get("cadastrewms.rasterDivider", 
     105            divideBbox(b, Integer.parseInt(Main.pref.get("cadastrewms.rasterDivider",
    106106                    CadastrePreferenceSetting.DEFAULT_RASTER_DIVIDER)));
    107107        } else
     
    203203
    204204    @Override
    205     public void paint(Graphics g, final MapView mv) {
     205    public void paint(Graphics2D g, final MapView mv, Bounds bounds) {
    206206        synchronized(this){
    207207            for (GeorefImage img : images)
    208                 img.paint((Graphics2D) g, mv, CadastrePlugin.backgroundTransparent,
     208                img.paint(g, mv, CadastrePlugin.backgroundTransparent,
    209209                        CadastrePlugin.transparency, CadastrePlugin.drawBoundaries);
    210210        }
     
    236236                saveAsPng,
    237237                new JMenuItem(new LayerListPopup.InfoAction(this)),
    238                
     238
    239239        };
    240240        return component;
     
    336336
    337337    /**
    338      * Set raster positions used for grabbing and georeferencing. 
     338     * Set raster positions used for grabbing and georeferencing.
    339339     * rasterMin is the Eaast North of bottom left corner raster image on the screen when image is grabbed.
    340340     * The bounds width and height are the raster width and height. The image width matches the current view
    341341     * and the image height is adapted.
    342      * Required: the communeBBox must be set (normally it is catched by CadastreInterface and saved by DownloadWMSPlanImage)   
     342     * Required: the communeBBox must be set (normally it is catched by CadastreInterface and saved by DownloadWMSPlanImage)
    343343     * @param bounds the current main map view boundaries
    344344     */
     
    347347        EastNorth eaMin = Main.proj.latlon2eastNorth(bounds.getMin());
    348348        EastNorth eaMax = Main.proj.latlon2eastNorth(bounds.getMax());
    349         double rasterSizeX = communeBBox.max.getX() - communeBBox.min.getX(); 
     349        double rasterSizeX = communeBBox.max.getX() - communeBBox.min.getX();
    350350        double rasterSizeY = communeBBox.max.getY() - communeBBox.min.getY();
    351351        double ratio = rasterSizeY/rasterSizeX;
     
    443443        return true;
    444444    }
    445    
     445
    446446    /**
    447447     * Join the grabbed images into one single.
     
    454454            EastNorth max = images.get(images.size()-1).max;
    455455            int oldImgWidth = images.get(0).image.getWidth();
    456             int oldImgHeight = images.get(0).image.getHeight(); 
     456            int oldImgHeight = images.get(0).image.getHeight();
    457457            int newWidth = oldImgWidth*(int)Math.sqrt(images.size());
    458458            int newHeight = oldImgHeight*(int)Math.sqrt(images.size());
     
    475475        }
    476476    }
    477    
     477
    478478    /**
    479479     * Image cropping based on two EN coordinates pointing to two corners in diagonal
    480480     * Because it's coming from user mouse clics, we have to sort de positions first.
    481481     * Works only for raster image layer (only one image in collection).
    482      * Updates layer georeferences. 
     482     * Updates layer georeferences.
    483483     * @param en1
    484484     * @param en2
    485485     */
    486486    public void cropImage(EastNorth en1, EastNorth en2){
    487         // adj1 is corner bottom, left 
     487        // adj1 is corner bottom, left
    488488        EastNorth adj1 = new EastNorth(en1.east() <= en2.east() ? en1.east() : en2.east(),
    489489                en1.north() <= en2.north() ? en1.north() : en2.north());
     
    501501        Graphics g = new_img.getGraphics();
    502502        g.drawImage(images.get(0).image, 0, 0, newWidth-1, newHeight-1,
    503                 (int)sx1, (int)sy1, (int)sx2, (int)sy2,
     503                sx1, sy1, sx2, sy2,
    504504                this);
    505505        images.set(0, new GeorefImage(new_img, adj1, adj2));
     
    522522
    523523    /**
    524      * Method required by ImageObserver when drawing an image 
     524     * Method required by ImageObserver when drawing an image
    525525     */
    526526    public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
     
    540540            if (Main.map.mapView.getAllLayers().size() == 1) {
    541541                /* Enable this code below when JOSM will have a proper support of dynamic projection change
    542                  * 
     542                 *
    543543                System.out.println("close all layers and change current Lambert zone from "+LambertCC9Zones.layoutZone+" to "+lambertZone);
    544544                Bounds b = null;
     
    562562                (images.get(0).max.north()+images.get(0).min.north())/2);
    563563    }
    564    
     564
    565565    public void displace(double dx, double dy) {
    566566        this.rasterMin = new EastNorth(rasterMin.east() + dx, rasterMin.north() + dy);
     
    582582        if (!crosspieces.equals("0")) {
    583583            int modulo = 50;
    584             if (crosspieces.equals("2")) modulo = 100; 
     584            if (crosspieces.equals("2")) modulo = 100;
    585585            EastNorthBound currentView = new EastNorthBound(mv.getEastNorth(0, mv.getHeight()),
    586586                    mv.getEastNorth(mv.getWidth(), 0));
     
    603603        }
    604604    }
    605    
     605
    606606}
  • applications/editors/josm/plugins/editgpx/build.xml

    r18426 r18595  
    2626                <attribute name="Plugin-Description" value="Allows the user to anonymize timestamps and delete parts of huge GPX tracks very fast." />
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/EditGpx" />
    28                 <attribute name="Plugin-Mainversion" value="2388" />
     28                <attribute name="Plugin-Mainversion" value="2450" />
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java

    r18426 r18595  
    88import java.awt.Color;
    99import java.awt.Component;
    10 import java.awt.Graphics;
     10import java.awt.Graphics2D;
    1111import java.awt.Point;
    1212import java.awt.Toolkit;
     
    2323
    2424import org.openstreetmap.josm.Main;
     25import org.openstreetmap.josm.data.Bounds;
    2526import org.openstreetmap.josm.data.gpx.GpxData;
    2627import org.openstreetmap.josm.data.gpx.GpxTrack;
     
    106107
    107108    @Override
    108     public void paint(Graphics g, MapView mv) {
     109    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
    109110        g.setColor(Color.yellow);
    110111
  • applications/editors/josm/plugins/imagewaypoint/build.xml

    r17373 r18595  
    2626                <attribute name="Plugin-Description" value="Another plugin to match images to the waypoints in a GPX file. A match is made when the 'name', 'cmt' or 'desc' attribute of a waypoint tag matches the filename of an image."/>
    2727                <attribute name="Plugin-Early" value="false"/>
    28                 <attribute name="Plugin-Mainversion" value="2012"/>
     28                <attribute name="Plugin-Mainversion" value="2450"/>
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java

    r17373 r18595  
    44
    55import java.awt.Component;
    6 import java.awt.Graphics;
     6import java.awt.Graphics2D;
    77import java.awt.Rectangle;
    88import java.awt.event.MouseAdapter;
     
    1313
    1414import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.data.Bounds;
    1516import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    1617import org.openstreetmap.josm.gui.MapView;
     
    116117
    117118    @Override
    118     public final void paint(final Graphics graphics, final MapView mapView) {
     119    public final void paint(final Graphics2D graphics, final MapView mapView, Bounds box) {
    119120        final ImageEntry[] images = ImageEntries.getInstance().getImages();
    120121
  • applications/editors/josm/plugins/measurement/.classpath

    r15953 r18595  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
    4         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/sun-jdk-1.5.0"/>
     4        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 5"/>
    55        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
    66        <classpathentry kind="output" path="build"/>
  • applications/editors/josm/plugins/measurement/build.xml

    r17377 r18595  
    2525                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    2626                <attribute name="Plugin-Description" value="Provide a measurement dialog and a layer to measure length and angle of segments, area surrounded by a (simple) closed way and create measurement paths (which also can be imported from a gps layer)."/>
    27                 <attribute name="Plugin-Mainversion" value="2012"/>
     27                <attribute name="Plugin-Mainversion" value="2450"/>
    2828                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    2929            </manifest>
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java

    r16801 r18595  
    55import java.awt.Color;
    66import java.awt.Component;
    7 import java.awt.Graphics;
     7import java.awt.Graphics2D;
    88import java.awt.Point;
    99import java.awt.Toolkit;
     
    2929
    3030import org.openstreetmap.josm.Main;
     31import org.openstreetmap.josm.data.Bounds;
    3132import org.openstreetmap.josm.data.coor.LatLon;
    3233import org.openstreetmap.josm.data.gpx.GpxTrack;
     
    7172    }
    7273
    73     @Override public void paint(Graphics g, final MapView mv) {
     74    @Override public void paint(Graphics2D g, final MapView mv, Bounds bounds) {
    7475        g.setColor(Color.green);
    7576        Point l = null;
  • applications/editors/josm/plugins/openstreetbugs/build.xml

    r18503 r18595  
    2626                <attribute name="Plugin-Description" value="Imports issues from OpenStreetBugs"/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/OpenStreetBugs"/>
    28                 <attribute name="Plugin-Mainversion" value="2401"/>
     28                <attribute name="Plugin-Mainversion" value="2450"/>
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbLayer.java

    r18482 r18595  
    3232import java.awt.Component;
    3333import java.awt.Dimension;
    34 import java.awt.Graphics;
     34import java.awt.Graphics2D;
    3535import java.awt.Image;
    3636import java.awt.Point;
     
    4848import org.openstreetmap.josm.Main;
    4949import org.openstreetmap.josm.actions.RenameLayerAction;
     50import org.openstreetmap.josm.data.Bounds;
    5051import org.openstreetmap.josm.data.SelectionChangedListener;
    5152import org.openstreetmap.josm.data.osm.DataSet;
     
    118119
    119120    @Override
    120     public void paint(Graphics g, MapView mv) {
     121    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
    121122        Object[] nodes = data.getNodes().toArray();
    122123        // This loop renders all the bug icons
     
    178179
    179180            int tx = p.x + (width / 2) + 5;
    180             int ty = (int)(p.y - height / 2) -1;
     181            int ty = (p.y - height / 2) -1;
    181182            g.translate(tx, ty);
    182183
     
    189190            for(int x = 0; x < 2; x++) {
    190191                Dimension d = tooltip.getUI().getPreferredSize(tooltip);
    191                 d.width = Math.min(d.width, (int)(mv.getWidth()*2/3));
     192                d.width = Math.min(d.width, (mv.getWidth()*2/3));
    192193                tooltip.setSize(d);
    193194                tooltip.paint(g);
     
    231232        if(e.getButton() == MouseEvent.BUTTON1) {
    232233            if(Main.map.mapView.getActiveLayer() == this) {
    233                 Node n = (Node) getNearestNode(e.getPoint());
     234                Node n = getNearestNode(e.getPoint());
    234235                if(data.getNodes().contains(n)) {
    235236                    data.setSelected(n);
     
    250251        if(e.isPopupTrigger()) {
    251252            if(Main.map.mapView.getActiveLayer() == this) {
    252                 Node n = (Node) getNearestNode(e.getPoint());
     253                Node n = getNearestNode(e.getPoint());
    253254                OsbAction.setSelectedNode(n);
    254255                if(data.getNodes().contains(n)) {
Note: See TracChangeset for help on using the changeset viewer.