Ignore:
Timestamp:
2012-08-16T11:45:11+02:00 (12 years ago)
Author:
larry0ua
Message:

'PicLayer - #7127 - added world file loading option'

Location:
applications/editors/josm/plugins/piclayer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/piclayer/build.xml

    r27883 r28559  
    2222-->
    2323<project name="PicLayer" default="dist" basedir=".">
    24     <property name="commit.message" value="PicLayer - added possibility to edit transformation with 1 or 2 points (move or rect transformation)"/>
     24    <property name="commit.message" value="PicLayer - #7127 - added world file loading option"/>
    2525    <property name="plugin.main.version" value="4980"/>
    2626    <!--
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java

    r27662 r28559  
    4848import org.openstreetmap.josm.data.coor.LatLon;
    4949import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     50import org.openstreetmap.josm.data.projection.Projection;
    5051import org.openstreetmap.josm.gui.MapView;
    5152import org.openstreetmap.josm.gui.layer.Layer;
    5253import org.openstreetmap.josm.plugins.piclayer.actions.LoadPictureCalibrationAction;
     54import org.openstreetmap.josm.plugins.piclayer.actions.LoadPictureCalibrationFromWorldAction;
    5355import org.openstreetmap.josm.plugins.piclayer.actions.ResetCalibrationAction;
    5456import org.openstreetmap.josm.plugins.piclayer.actions.SavePictureCalibrationAction;
     
    121123    private static final int pinHeight = 64;
    122124
     125    protected final Projection projection;
     126
    123127    /**
    124128     * Constructor
     
    137141            pinTiledImage = new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource("/images/v6_64.png"))).getImage();
    138142        }
     143
     144        projection = Main.getProjection();
    139145    }
    140146
     
    201207                new SavePictureCalibrationAction(this),
    202208                new LoadPictureCalibrationAction(this),
     209                new LoadPictureCalibrationFromWorldAction(this),
    203210                SeparatorLayerAction.INSTANCE,
    204211                new RenameLayerAction(null,this),
     
    302309         * so we get the result at the point 'en' and not some average.
    303310         */
    304         double naturalScale = Main.getProjection().getDefaultZoomInPPD();
     311        double naturalScale = projection.getDefaultZoomInPPD();
    305312        naturalScale *= 0.01; // make a little smaller
    306313
    307         LatLon ll1 = Main.getProjection().eastNorth2latlon(
     314        LatLon ll1 = projection.eastNorth2latlon(
    308315                new EastNorth(en.east() - naturalScale, en.north()));
    309         LatLon ll2 = Main.getProjection().eastNorth2latlon(
     316        LatLon ll2 = projection.eastNorth2latlon(
    310317                new EastNorth(en.east() + naturalScale, en.north()));
    311318
     
    316323    /* see getMetersPerEasting */
    317324    private double getMetersPerNorthing(EastNorth en) {
    318         double naturalScale = Main.getProjection().getDefaultZoomInPPD();
     325        double naturalScale = projection.getDefaultZoomInPPD();
    319326        naturalScale *= 0.01;
    320327
    321         LatLon ll1 = Main.getProjection().eastNorth2latlon(
     328        LatLon ll1 = projection.eastNorth2latlon(
    322329                new EastNorth(en.east(), en.north()- naturalScale));
    323         LatLon ll2 = Main.getProjection().eastNorth2latlon(
     330        LatLon ll2 = projection.eastNorth2latlon(
    324331                new EastNorth(en.east(), en.north() + naturalScale));
    325332
     
    337344        if ( image == null )
    338345            return;
    339         String projcode = Main.getProjection().toCode();
     346        String projcode = projection.toCode();
    340347
    341348        // TODO: bounding box only supported when coordinates are in meters
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerFromKML.java

    r27662 r28559  
    88import javax.imageio.ImageIO;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.data.coor.EastNorth;
    1211import org.openstreetmap.josm.data.coor.LatLon;
     
    5352        LatLon coord2 = new LatLon(cal.getSouth(), cal.getWest());
    5453
    55         EastNorth en1 = Main.getProjection().latlon2eastNorth(coord1);
    56         EastNorth en2 = Main.getProjection().latlon2eastNorth(coord2);
     54        EastNorth en1 = projection.latlon2eastNorth(coord1);
     55        EastNorth en2 = projection.latlon2eastNorth(coord2);
    5756
    5857
Note: See TracChangeset for help on using the changeset viewer.