Ignore:
Timestamp:
2017-11-14T20:02:52+01:00 (7 years ago)
Author:
donvip
Message:

fix #josm15551 - update to JOSM 13050

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

Legend:

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

    r33385 r33809  
    33    <property name="commit.message" value="[josm/PicLayer] - #12045 add ability to localize dialog titles"/>
    44    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    5     <property name="plugin.main.version" value="11713"/>
     5    <property name="plugin.main.version" value="13050"/>
    66       
    77    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java

    r32675 r33809  
    3232import org.openstreetmap.josm.actions.mapmode.MapMode;
    3333import org.openstreetmap.josm.gui.IconToggleButton;
     34import org.openstreetmap.josm.gui.MainApplication;
    3435import org.openstreetmap.josm.gui.MainMenu;
    3536import org.openstreetmap.josm.gui.MapFrame;
     
    7677
    7778        // Add menu items
    78         MainMenu.add(Main.main.menu.imagerySubMenu, newLayerFromFileAction);
    79         MainMenu.add(Main.main.menu.imagerySubMenu, newLayerFromClipboardAction);
     79        MainMenu.add(MainApplication.getMenu().imagerySubMenu, newLayerFromFileAction);
     80        MainMenu.add(MainApplication.getMenu().imagerySubMenu, newLayerFromClipboardAction);
    8081        updateEnabledState();
    8182        // Listen to layers
    82         Main.getLayerManager().addLayerChangeListener(this);
    83         Main.getLayerManager().addActiveLayerChangeListener(this);
     83        MainApplication.getLayerManager().addLayerChangeListener(this);
     84        MainApplication.getLayerManager().addActiveLayerChangeListener(this);
    8485    }
    8586
     
    132133    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
    133134        Layer oldLayer = e.getPreviousActiveLayer();
    134         Layer newLayer = Main.getLayerManager().getActiveLayer();
     135        Layer newLayer = MainApplication.getLayerManager().getActiveLayer();
    135136        boolean oldPic = oldLayer instanceof PicLayerAbstract;
    136137        boolean newPic = newLayer instanceof PicLayerAbstract;
     
    177178
    178179    private void updateEnabledState() {
    179         boolean enable = !Main.getLayerManager().getLayers().isEmpty();
     180        boolean enable = !MainApplication.getLayerManager().getLayers().isEmpty();
    180181        newLayerFromFileAction.setEnabled(enable);
    181182        newLayerFromClipboardAction.setEnabled(enable);
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java

    r33385 r33809  
    88import java.awt.geom.Point2D;
    99
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.actions.mapmode.MapMode;
    1211import org.openstreetmap.josm.data.coor.EastNorth;
     12import org.openstreetmap.josm.gui.MainApplication;
    1313import org.openstreetmap.josm.gui.MapFrame;
    1414import org.openstreetmap.josm.gui.layer.Layer;
     
    4343    public void enterMode() {
    4444        super.enterMode();
    45         Main.map.mapView.addMouseListener(this);
    46         Main.map.mapView.addMouseMotionListener(this);
     45        MainApplication.getMap().mapView.addMouseListener(this);
     46        MainApplication.getMap().mapView.addMouseMotionListener(this);
    4747    }
    4848
     
    5050    public void exitMode() {
    5151        super.exitMode();
    52         Main.map.mapView.removeMouseListener(this);
    53         Main.map.mapView.removeMouseMotionListener(this);
     52        MainApplication.getMap().mapView.removeMouseListener(this);
     53        MainApplication.getMap().mapView.removeMouseMotionListener(this);
    5454    }
    5555
     
    5757    public void mousePressed(MouseEvent e) {
    5858        // Start action
    59         if (Main.getLayerManager().getActiveLayer() instanceof PicLayerAbstract) {
    60             currentLayer = (PicLayerAbstract) Main.getLayerManager().getActiveLayer();
     59        if (MainApplication.getLayerManager().getActiveLayer() instanceof PicLayerAbstract) {
     60            currentLayer = (PicLayerAbstract) MainApplication.getLayerManager().getActiveLayer();
    6161
    6262            if (currentLayer != null && e.getButton() == MouseEvent.BUTTON1) {
     
    6464                isDragging = true;
    6565                prevMousePoint = new Point(e.getPoint());
    66                 prevEastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY());
     66                prevEastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
    6767                // try to find and fill selected point if possible
    6868                selectedPoint = currentLayer.findSelectedPoint(e.getPoint());
     
    7878            doAction(e);
    7979            prevMousePoint = new Point(e.getPoint());
    80             prevEastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY());
     80            prevEastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
    8181            currentLayer.invalidate();
    8282        }
     
    9999
    100100    protected void updateDrawPoints(boolean value) {
    101         Layer active = Main.getLayerManager().getActiveLayer();
     101        Layer active = MainApplication.getLayerManager().getActiveLayer();
    102102        if (active instanceof PicLayerAbstract) {
    103103            ((PicLayerAbstract) active).setDrawPoints(value);
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromClipboardAction.java

    r32675 r33809  
    2828import javax.swing.JOptionPane;
    2929
    30 import org.openstreetmap.josm.Main;
    3130import org.openstreetmap.josm.actions.JosmAction;
     31import org.openstreetmap.josm.gui.MainApplication;
    3232import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerFromClipboard;
    3333
     
    6363        }
    6464        // Add layer
    65         Main.getLayerManager().addLayer(layer);
     65        MainApplication.getLayerManager().addLayer(layer);
    6666    }
    6767}
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java

    r33385 r33809  
    3737import org.openstreetmap.josm.actions.JosmAction;
    3838import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     39import org.openstreetmap.josm.gui.MainApplication;
    3940import org.openstreetmap.josm.gui.layer.Layer;
    4041import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract;
     
    119120            // or at the bottom of the stack if there is no such layer yet
    120121            // The next layers we load will be placed one after the other after this first layer
    121             int newLayerPos = Main.getLayerManager().getLayers().size();
    122             for (Layer l : Main.getLayerManager().getLayersOfType(PicLayerAbstract.class)) {
    123                 int pos = Main.getLayerManager().getLayers().indexOf(l);
     122            int newLayerPos = MainApplication.getLayerManager().getLayers().size();
     123            for (Layer l : MainApplication.getLayerManager().getLayersOfType(PicLayerAbstract.class)) {
     124                int pos = MainApplication.getLayerManager().getLayers().indexOf(l);
    124125                if (pos < newLayerPos) newLayerPos = pos;
    125126            }
     
    164165        // Add layer only if successfully initialized
    165166
    166         Main.getLayerManager().addLayer(layer);
    167         Main.map.mapView.moveLayer(layer, newLayerPos++);
     167        MainApplication.getLayerManager().addLayer(layer);
     168        MainApplication.getMap().mapView.moveLayer(layer, newLayerPos++);
    168169
    169         if (isZoomToLayer && Main.pref.getInteger("piclayer.zoom-on-load", 1) != 0) {
     170        if (isZoomToLayer && Main.pref.getInt("piclayer.zoom-on-load", 1) != 0) {
    170171            // if we are loading a single picture file, zoom on it, so that the user can see something
    171172            BoundingXYVisitor v = new BoundingXYVisitor();
    172173            layer.visitBoundingBox(v);
    173             Main.map.mapView.zoomTo(v);
     174            MainApplication.getMap().mapView.zoomTo(v);
    174175        }
    175176    }
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/MovePictureAction.java

    r32675 r33809  
    2525import java.awt.event.MouseEvent;
    2626
    27 import org.openstreetmap.josm.Main;
    2827import org.openstreetmap.josm.data.coor.EastNorth;
     28import org.openstreetmap.josm.gui.MainApplication;
    2929import org.openstreetmap.josm.gui.MapFrame;
    3030import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
     
    4141     */
    4242    public MovePictureAction(MapFrame frame) {
    43         super(tr("PicLayer move"), tr("Moved"), "move", tr("Drag to move the picture"), frame, ImageProvider.getCursor("crosshair", null));
     43        super(tr("PicLayer move"), tr("Moved"), "move", tr("Drag to move the picture"),
     44                frame, ImageProvider.getCursor("crosshair", null));
    4445    }
    4546
    4647    @Override
    4748    protected void doAction(MouseEvent e) {
    48         EastNorth eastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY());
     49        EastNorth eastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
    4950        currentLayer.movePictureBy(
    5051            eastNorth.east() - prevEastNorth.east(),
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/RotatePictureAction.java

    r33146 r33809  
    2727import java.awt.geom.Point2D;
    2828
    29 import org.openstreetmap.josm.Main;
     29import org.openstreetmap.josm.gui.MainApplication;
    3030import org.openstreetmap.josm.gui.MapFrame;
    3131import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
     
    4848    @Override
    4949    protected void doAction(MouseEvent e) {
    50         Point2D center = new Point(Main.map.mapView.getWidth()/2, Main.map.mapView.getHeight()/2);
     50        Point2D center = new Point(MainApplication.getMap().mapView.getWidth()/2, MainApplication.getMap().mapView.getHeight()/2);
    5151        double alpha1 = Math.atan2(e.getY() - center.getY(), e.getX() - center.getX());
    5252        double alpha0 = Math.atan2(prevMousePoint.getY() - center.getY(), prevMousePoint.getX() - center.getX());
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXPictureAction.java

    r33148 r33809  
    2525import java.awt.event.MouseEvent;
    2626
    27 import org.openstreetmap.josm.Main;
     27import org.openstreetmap.josm.gui.MainApplication;
    2828import org.openstreetmap.josm.gui.MapFrame;
    2929import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
     
    4040     */
    4141    public ScaleXPictureAction(MapFrame frame) {
    42         super(tr("PicLayer scale X"), tr("Scaled by X"), "scale_x", tr("Drag to scale the picture in the X Axis"), frame, ImageProvider.getCursor("crosshair", null));
     42        super(tr("PicLayer scale X"), tr("Scaled by X"), "scale_x", tr("Drag to scale the picture in the X Axis"),
     43                frame, ImageProvider.getCursor("crosshair", null));
    4344    }
    4445
    4546    @Override
    4647    protected void doAction(MouseEvent e) {
    47         double centerX = Main.map.mapView.getWidth()/2;
     48        double centerX = MainApplication.getMap().mapView.getWidth()/2;
    4849        double dx0 = Math.max(Math.abs(prevMousePoint.getX() - centerX), 10);
    4950        double dx = Math.abs(e.getX() - centerX);
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXYPictureAction.java

    r33148 r33809  
    2727import java.awt.geom.Point2D;
    2828
    29 import org.openstreetmap.josm.Main;
     29import org.openstreetmap.josm.gui.MainApplication;
    3030import org.openstreetmap.josm.gui.MapFrame;
    3131import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
     
    4242     */
    4343    public ScaleXYPictureAction(MapFrame frame) {
    44         super(tr("PicLayer scale"), tr("Scaled"), "scale", tr("Drag to scale the picture in the X and Y Axis"), frame, ImageProvider.getCursor("crosshair", null));
     44        super(tr("PicLayer scale"), tr("Scaled"), "scale", tr("Drag to scale the picture in the X and Y Axis"),
     45                frame, ImageProvider.getCursor("crosshair", null));
    4546    }
    4647
    4748    @Override
    4849    protected void doAction(MouseEvent e) {
    49         double centerX = Main.map.mapView.getWidth()/2;
    50         double centerY = Main.map.mapView.getHeight()/2;
     50        double centerX = MainApplication.getMap().mapView.getWidth()/2;
     51        double centerY = MainApplication.getMap().mapView.getHeight()/2;
    5152        double d0 = Math.max(prevMousePoint.distance(centerX, centerY), 10);
    5253        Point2D mousePoint = new Point(e.getX(), e.getY());
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleYPictureAction.java

    r33148 r33809  
    2525import java.awt.event.MouseEvent;
    2626
    27 import org.openstreetmap.josm.Main;
     27import org.openstreetmap.josm.gui.MainApplication;
    2828import org.openstreetmap.josm.gui.MapFrame;
    2929import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
     
    4040     */
    4141    public ScaleYPictureAction(MapFrame frame) {
    42         super(tr("PicLayer scale Y"), tr("Scaled by Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"), frame, ImageProvider.getCursor("crosshair", null));
     42        super(tr("PicLayer scale Y"), tr("Scaled by Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"),
     43                frame, ImageProvider.getCursor("crosshair", null));
    4344    }
    4445
    4546    @Override
    4647    protected void doAction(MouseEvent e) {
    47         double centerY = Main.map.mapView.getHeight()/2;
     48        double centerY = MainApplication.getMap().mapView.getHeight()/2;
    4849        double dy0 = Math.max(Math.abs(prevMousePoint.getY() - centerY), 10);
    4950        double dy = Math.abs(e.getY() - centerY);
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ShearPictureAction.java

    r32675 r33809  
    2727import java.awt.event.MouseEvent;
    2828
    29 import org.openstreetmap.josm.Main;
    3029import org.openstreetmap.josm.data.coor.EastNorth;
     30import org.openstreetmap.josm.gui.MainApplication;
    3131import org.openstreetmap.josm.gui.MapFrame;
    3232import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
     
    4848    @Override
    4949    protected void doAction(MouseEvent e) {
    50         EastNorth eastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY());
     50        EastNorth eastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
    5151        currentLayer.shearPictureBy(
    5252            1000* (eastNorth.east() - prevEastNorth.east()),
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/MovePointAction.java

    r30356 r33809  
    1616
    1717    public MovePointAction(MapFrame frame) {
    18         super(tr("PicLayer Move point"), tr("Point added/moved"), "movepoint", tr("Drag or create point on the picture"), frame, ImageProvider.getCursor("crosshair", null));
     18        super(tr("PicLayer Move point"), tr("Point added/moved"), "movepoint", tr("Drag or create point on the picture"),
     19                frame, ImageProvider.getCursor("crosshair", null));
    1920    }
    2021
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/RemovePointAction.java

    r32675 r33809  
    1313
    1414    public RemovePointAction(MapFrame frame) {
    15         super(tr("PicLayer Remove point"), tr("Point removed"), "removepoint", tr("Remove point on the picture"), frame, ImageProvider.getCursor("crosshair", null));
     15        super(tr("PicLayer Remove point"), tr("Point removed"), "removepoint", tr("Remove point on the picture"),
     16                frame, ImageProvider.getCursor("crosshair", null));
    1617    }
    1718
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/TransformPointAction.java

    r32675 r33809  
    1515
    1616    public TransformPointAction(MapFrame frame) {
    17         super(tr("PicLayer Transform point"), tr("Point transformed"), "transformpoint", tr("Transform point on the picture"), frame, ImageProvider.getCursor("crosshair", null));
     17        super(tr("PicLayer Transform point"), tr("Point transformed"), "transformpoint", tr("Transform point on the picture"),
     18                frame, ImageProvider.getCursor("crosshair", null));
    1819    }
    1920
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/command/TransformCommand.java

    r33384 r33809  
    1010import org.openstreetmap.josm.command.Command;
    1111import org.openstreetmap.josm.data.osm.OsmPrimitive;
    12 import org.openstreetmap.josm.gui.layer.Layer;
     12import org.openstreetmap.josm.gui.MainApplication;
    1313import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract;
    1414import org.openstreetmap.josm.plugins.piclayer.transform.PictureTransform;
     
    2323
    2424    public TransformCommand(PicLayerAbstract layer, String actionName) {
     25        super(MainApplication.getLayerManager().getEditDataSet());
    2526        this.layer = layer;
    2627        this.actionName = actionName;
     
    6162
    6263    @Override
    63     public boolean invalidBecauselayerRemoved(Layer oldLayer) {
    64         return oldLayer == layer;
    65     }
    66 
    67     @Override
    6864    public Icon getDescriptionIcon() {
    6965        return ImageProvider.get("layericon");
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java

    r33384 r33809  
    5050import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    5151import org.openstreetmap.josm.data.projection.Projection;
     52import org.openstreetmap.josm.gui.MainApplication;
    5253import org.openstreetmap.josm.gui.MapView;
    5354import org.openstreetmap.josm.gui.layer.Layer;
     
    5859import org.openstreetmap.josm.plugins.piclayer.actions.SavePictureCalibrationToWorldAction;
    5960import org.openstreetmap.josm.plugins.piclayer.transform.PictureTransform;
     61import org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider;
     62import org.openstreetmap.josm.tools.Logging;
    6063
    6164/**
     
    156159
    157160        // If the map does not exist - we're screwed. We should not get into this situation in the first place!
    158         if (Main.map != null && Main.map.mapView != null) {
    159 
    160             EastNorth center = Main.map.mapView.getCenter();
     161        if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) {
     162
     163            EastNorth center = MainApplication.getMap().mapView.getCenter();
    161164
    162165//            imagePosition = new EastNorth(center.east(), center.north());
     
    164167//            initialImagePosition = new EastNorth(imagePosition.east(), imagePosition.north());
    165168            // Initial scale at which the image was loaded
    166             initialImageScale = Main.map.mapView.getDist100Pixel();
     169            initialImageScale = MainApplication.getMap().mapView.getDist100Pixel();
    167170        } else {
    168171            throw new IOException(tr("Could not find the map object."));
     
    449452            // initialize matrix
    450453            double[] matrix = new double[6];
    451             matrix[0] = Double.parseDouble(props.getProperty(MATRIXm00, "1"));
    452             matrix[1] = Double.parseDouble(props.getProperty(MATRIXm01, "0"));
    453             matrix[2] = Double.parseDouble(props.getProperty(MATRIXm10, "0"));
    454             matrix[3] = Double.parseDouble(props.getProperty(MATRIXm11, "1"));
    455             matrix[4] = Double.parseDouble(props.getProperty(MATRIXm02, "0"));
    456             matrix[5] = Double.parseDouble(props.getProperty(MATRIXm12, "0"));
     454            matrix[0] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm00, "1"));
     455            matrix[1] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm01, "0"));
     456            matrix[2] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm10, "0"));
     457            matrix[3] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm11, "1"));
     458            matrix[4] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm02, "0"));
     459            matrix[5] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm12, "0"));
    457460
    458461            transform = new AffineTransform(matrix);
     
    474477            for (int i = 0; i < 6; ++i) {
    475478                String line = br.readLine();
    476                 e[i] = Double.parseDouble(line);
     479                e[i] = JosmDecimalFormatSymbolsProvider.parseDouble(line);
    477480            }
    478481            double sx = e[0], ry = e[1], rx = e[2], sy = e[3], dx = e[4], dy = e[5];
     
    532535        // Position image at the right graphical place
    533536
    534         EastNorth center = Main.map.mapView.getCenter();
    535         EastNorth leftop = Main.map.mapView.getEastNorth(0, 0);
     537        EastNorth center = MainApplication.getMap().mapView.getCenter();
     538        EastNorth leftop = MainApplication.getMap().mapView.getEastNorth(0, 0);
    536539        // Number of pixels for one unit in east north space.
    537540        // This is the same in x- and y- direction.
    538         double pixel_per_en = (Main.map.mapView.getWidth() / 2.0) / (center.east() - leftop.east());
     541        double pixel_per_en = (MainApplication.getMap().mapView.getWidth() / 2.0) / (center.east() - leftop.east());
    539542
    540543        EastNorth imageCenter = transformer.getImagePosition();
     
    565568    public void rotatePictureBy(double angle) {
    566569        try {
    567             Point2D trans = transformPoint(new Point(Main.map.mapView.getWidth()/2, Main.map.mapView.getHeight()/2));
    568 
     570            MapView mapView = MainApplication.getMap().mapView;
     571            Point2D trans = transformPoint(new Point(mapView.getWidth()/2, mapView.getHeight()/2));
    569572            transformer.concatenateTransformPoint(AffineTransform.getRotateInstance(angle), trans);
    570573        } catch (NoninvertibleTransformException e) {
    571             e.printStackTrace();
     574            Logging.error(e);
    572575        }
    573576    }
     
    575578    public void scalePictureBy(double scalex, double scaley) {
    576579        try {
    577             Point2D trans = transformPoint(new Point(Main.map.mapView.getWidth()/2, Main.map.mapView.getHeight()/2));
    578 
     580            MapView mapView = MainApplication.getMap().mapView;
     581            Point2D trans = transformPoint(new Point(mapView.getWidth()/2, mapView.getHeight()/2));
    579582            transformer.concatenateTransformPoint(AffineTransform.getScaleInstance(scalex, scaley), trans);
    580583        } catch (NoninvertibleTransformException e) {
    581             e.printStackTrace();
     584            Logging.error(e);
    582585        }
    583586    }
     
    585588    public void shearPictureBy(double shx, double shy) {
    586589        try {
    587             Point2D trans = transformPoint(new Point(Main.map.mapView.getWidth()/2, Main.map.mapView.getHeight()/2));
    588 
     590            MapView mapView = MainApplication.getMap().mapView;
     591            Point2D trans = transformPoint(new Point(mapView.getWidth()/2, mapView.getHeight()/2));
    589592            transformer.concatenateTransformPoint(AffineTransform.getShearInstance(shx, shy), trans);
    590593        } catch (NoninvertibleTransformException e) {
    591             e.printStackTrace();
     594            Logging.error(e);
    592595        }
    593596    }
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerFromFile.java

    r32675 r33809  
    3737
    3838import org.openstreetmap.josm.Main;
     39import org.openstreetmap.josm.tools.Logging;
    3940/**
    4041 * Layer displaying a picture loaded from a file.
     
    7172    protected Image createImage() throws IOException {
    7273        // Try to load file
    73         Image image = null;
    74 
    7574        if (isZip) {
    7675            try (ZipFile zipFile = new ZipFile(m_file)) {
     
    9594                    }
    9695                }
    97                 System.err.println("Warning: no image in zip file found");
     96                Logging.warn("Warning: no image in zip file found");
    9897                return null;
    9998            } catch (Exception e) {
    100                 System.err.println(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", m_file.getName(), e.toString()));
     99                Logging.warn(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", m_file.getName(), e.toString()));
    101100                return null;
    102101            }
    103102        } else {
    104             image = ImageIO.read(m_file);
    105             return image;
     103            return ImageIO.read(m_file);
    106104        }
    107105    }
     
    170168                }
    171169            } catch (Exception e) {
    172                 Main.warn(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", m_file.getName(), e.toString()));
     170                Logging.warn(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", m_file.getName(), e.toString()));
    173171                return;
    174172            }
Note: See TracChangeset for help on using the changeset viewer.