Changeset 33809 in osm for applications/editors/josm/plugins/piclayer/src
- Timestamp:
- 2017-11-14T20:02:52+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java
r32675 r33809 32 32 import org.openstreetmap.josm.actions.mapmode.MapMode; 33 33 import org.openstreetmap.josm.gui.IconToggleButton; 34 import org.openstreetmap.josm.gui.MainApplication; 34 35 import org.openstreetmap.josm.gui.MainMenu; 35 36 import org.openstreetmap.josm.gui.MapFrame; … … 76 77 77 78 // 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); 80 81 updateEnabledState(); 81 82 // Listen to layers 82 Main .getLayerManager().addLayerChangeListener(this);83 Main .getLayerManager().addActiveLayerChangeListener(this);83 MainApplication.getLayerManager().addLayerChangeListener(this); 84 MainApplication.getLayerManager().addActiveLayerChangeListener(this); 84 85 } 85 86 … … 132 133 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 133 134 Layer oldLayer = e.getPreviousActiveLayer(); 134 Layer newLayer = Main .getLayerManager().getActiveLayer();135 Layer newLayer = MainApplication.getLayerManager().getActiveLayer(); 135 136 boolean oldPic = oldLayer instanceof PicLayerAbstract; 136 137 boolean newPic = newLayer instanceof PicLayerAbstract; … … 177 178 178 179 private void updateEnabledState() { 179 boolean enable = !Main .getLayerManager().getLayers().isEmpty();180 boolean enable = !MainApplication.getLayerManager().getLayers().isEmpty(); 180 181 newLayerFromFileAction.setEnabled(enable); 181 182 newLayerFromClipboardAction.setEnabled(enable); -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java
r33385 r33809 8 8 import java.awt.geom.Point2D; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.actions.mapmode.MapMode; 12 11 import org.openstreetmap.josm.data.coor.EastNorth; 12 import org.openstreetmap.josm.gui.MainApplication; 13 13 import org.openstreetmap.josm.gui.MapFrame; 14 14 import org.openstreetmap.josm.gui.layer.Layer; … … 43 43 public void enterMode() { 44 44 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); 47 47 } 48 48 … … 50 50 public void exitMode() { 51 51 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); 54 54 } 55 55 … … 57 57 public void mousePressed(MouseEvent e) { 58 58 // 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(); 61 61 62 62 if (currentLayer != null && e.getButton() == MouseEvent.BUTTON1) { … … 64 64 isDragging = true; 65 65 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()); 67 67 // try to find and fill selected point if possible 68 68 selectedPoint = currentLayer.findSelectedPoint(e.getPoint()); … … 78 78 doAction(e); 79 79 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()); 81 81 currentLayer.invalidate(); 82 82 } … … 99 99 100 100 protected void updateDrawPoints(boolean value) { 101 Layer active = Main .getLayerManager().getActiveLayer();101 Layer active = MainApplication.getLayerManager().getActiveLayer(); 102 102 if (active instanceof PicLayerAbstract) { 103 103 ((PicLayerAbstract) active).setDrawPoints(value); -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromClipboardAction.java
r32675 r33809 28 28 import javax.swing.JOptionPane; 29 29 30 import org.openstreetmap.josm.Main;31 30 import org.openstreetmap.josm.actions.JosmAction; 31 import org.openstreetmap.josm.gui.MainApplication; 32 32 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerFromClipboard; 33 33 … … 63 63 } 64 64 // Add layer 65 Main .getLayerManager().addLayer(layer);65 MainApplication.getLayerManager().addLayer(layer); 66 66 } 67 67 } -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java
r33385 r33809 37 37 import org.openstreetmap.josm.actions.JosmAction; 38 38 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 39 import org.openstreetmap.josm.gui.MainApplication; 39 40 import org.openstreetmap.josm.gui.layer.Layer; 40 41 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract; … … 119 120 // or at the bottom of the stack if there is no such layer yet 120 121 // 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); 124 125 if (pos < newLayerPos) newLayerPos = pos; 125 126 } … … 164 165 // Add layer only if successfully initialized 165 166 166 Main .getLayerManager().addLayer(layer);167 Main .map.mapView.moveLayer(layer, newLayerPos++);167 MainApplication.getLayerManager().addLayer(layer); 168 MainApplication.getMap().mapView.moveLayer(layer, newLayerPos++); 168 169 169 if (isZoomToLayer && Main.pref.getInt eger("piclayer.zoom-on-load", 1) != 0) {170 if (isZoomToLayer && Main.pref.getInt("piclayer.zoom-on-load", 1) != 0) { 170 171 // if we are loading a single picture file, zoom on it, so that the user can see something 171 172 BoundingXYVisitor v = new BoundingXYVisitor(); 172 173 layer.visitBoundingBox(v); 173 Main .map.mapView.zoomTo(v);174 MainApplication.getMap().mapView.zoomTo(v); 174 175 } 175 176 } -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/MovePictureAction.java
r32675 r33809 25 25 import java.awt.event.MouseEvent; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.data.coor.EastNorth; 28 import org.openstreetmap.josm.gui.MainApplication; 29 29 import org.openstreetmap.josm.gui.MapFrame; 30 30 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; … … 41 41 */ 42 42 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)); 44 45 } 45 46 46 47 @Override 47 48 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()); 49 50 currentLayer.movePictureBy( 50 51 eastNorth.east() - prevEastNorth.east(), -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/RotatePictureAction.java
r33146 r33809 27 27 import java.awt.geom.Point2D; 28 28 29 import org.openstreetmap.josm. Main;29 import org.openstreetmap.josm.gui.MainApplication; 30 30 import org.openstreetmap.josm.gui.MapFrame; 31 31 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; … … 48 48 @Override 49 49 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); 51 51 double alpha1 = Math.atan2(e.getY() - center.getY(), e.getX() - center.getX()); 52 52 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 25 25 import java.awt.event.MouseEvent; 26 26 27 import org.openstreetmap.josm. Main;27 import org.openstreetmap.josm.gui.MainApplication; 28 28 import org.openstreetmap.josm.gui.MapFrame; 29 29 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; … … 40 40 */ 41 41 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)); 43 44 } 44 45 45 46 @Override 46 47 protected void doAction(MouseEvent e) { 47 double centerX = Main .map.mapView.getWidth()/2;48 double centerX = MainApplication.getMap().mapView.getWidth()/2; 48 49 double dx0 = Math.max(Math.abs(prevMousePoint.getX() - centerX), 10); 49 50 double dx = Math.abs(e.getX() - centerX); -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXYPictureAction.java
r33148 r33809 27 27 import java.awt.geom.Point2D; 28 28 29 import org.openstreetmap.josm. Main;29 import org.openstreetmap.josm.gui.MainApplication; 30 30 import org.openstreetmap.josm.gui.MapFrame; 31 31 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; … … 42 42 */ 43 43 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)); 45 46 } 46 47 47 48 @Override 48 49 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; 51 52 double d0 = Math.max(prevMousePoint.distance(centerX, centerY), 10); 52 53 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 25 25 import java.awt.event.MouseEvent; 26 26 27 import org.openstreetmap.josm. Main;27 import org.openstreetmap.josm.gui.MainApplication; 28 28 import org.openstreetmap.josm.gui.MapFrame; 29 29 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; … … 40 40 */ 41 41 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)); 43 44 } 44 45 45 46 @Override 46 47 protected void doAction(MouseEvent e) { 47 double centerY = Main .map.mapView.getHeight()/2;48 double centerY = MainApplication.getMap().mapView.getHeight()/2; 48 49 double dy0 = Math.max(Math.abs(prevMousePoint.getY() - centerY), 10); 49 50 double dy = Math.abs(e.getY() - centerY); -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ShearPictureAction.java
r32675 r33809 27 27 import java.awt.event.MouseEvent; 28 28 29 import org.openstreetmap.josm.Main;30 29 import org.openstreetmap.josm.data.coor.EastNorth; 30 import org.openstreetmap.josm.gui.MainApplication; 31 31 import org.openstreetmap.josm.gui.MapFrame; 32 32 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction; … … 48 48 @Override 49 49 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()); 51 51 currentLayer.shearPictureBy( 52 52 1000* (eastNorth.east() - prevEastNorth.east()), -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/MovePointAction.java
r30356 r33809 16 16 17 17 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)); 19 20 } 20 21 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/RemovePointAction.java
r32675 r33809 13 13 14 14 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)); 16 17 } 17 18 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/TransformPointAction.java
r32675 r33809 15 15 16 16 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)); 18 19 } 19 20 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/command/TransformCommand.java
r33384 r33809 10 10 import org.openstreetmap.josm.command.Command; 11 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 12 import org.openstreetmap.josm.gui. layer.Layer;12 import org.openstreetmap.josm.gui.MainApplication; 13 13 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract; 14 14 import org.openstreetmap.josm.plugins.piclayer.transform.PictureTransform; … … 23 23 24 24 public TransformCommand(PicLayerAbstract layer, String actionName) { 25 super(MainApplication.getLayerManager().getEditDataSet()); 25 26 this.layer = layer; 26 27 this.actionName = actionName; … … 61 62 62 63 @Override 63 public boolean invalidBecauselayerRemoved(Layer oldLayer) {64 return oldLayer == layer;65 }66 67 @Override68 64 public Icon getDescriptionIcon() { 69 65 return ImageProvider.get("layericon"); -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java
r33384 r33809 50 50 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 51 51 import org.openstreetmap.josm.data.projection.Projection; 52 import org.openstreetmap.josm.gui.MainApplication; 52 53 import org.openstreetmap.josm.gui.MapView; 53 54 import org.openstreetmap.josm.gui.layer.Layer; … … 58 59 import org.openstreetmap.josm.plugins.piclayer.actions.SavePictureCalibrationToWorldAction; 59 60 import org.openstreetmap.josm.plugins.piclayer.transform.PictureTransform; 61 import org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider; 62 import org.openstreetmap.josm.tools.Logging; 60 63 61 64 /** … … 156 159 157 160 // 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(); 161 164 162 165 // imagePosition = new EastNorth(center.east(), center.north()); … … 164 167 // initialImagePosition = new EastNorth(imagePosition.east(), imagePosition.north()); 165 168 // Initial scale at which the image was loaded 166 initialImageScale = Main .map.mapView.getDist100Pixel();169 initialImageScale = MainApplication.getMap().mapView.getDist100Pixel(); 167 170 } else { 168 171 throw new IOException(tr("Could not find the map object.")); … … 449 452 // initialize matrix 450 453 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")); 457 460 458 461 transform = new AffineTransform(matrix); … … 474 477 for (int i = 0; i < 6; ++i) { 475 478 String line = br.readLine(); 476 e[i] = Double.parseDouble(line);479 e[i] = JosmDecimalFormatSymbolsProvider.parseDouble(line); 477 480 } 478 481 double sx = e[0], ry = e[1], rx = e[2], sy = e[3], dx = e[4], dy = e[5]; … … 532 535 // Position image at the right graphical place 533 536 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); 536 539 // Number of pixels for one unit in east north space. 537 540 // 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()); 539 542 540 543 EastNorth imageCenter = transformer.getImagePosition(); … … 565 568 public void rotatePictureBy(double angle) { 566 569 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)); 569 572 transformer.concatenateTransformPoint(AffineTransform.getRotateInstance(angle), trans); 570 573 } catch (NoninvertibleTransformException e) { 571 e.printStackTrace();574 Logging.error(e); 572 575 } 573 576 } … … 575 578 public void scalePictureBy(double scalex, double scaley) { 576 579 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)); 579 582 transformer.concatenateTransformPoint(AffineTransform.getScaleInstance(scalex, scaley), trans); 580 583 } catch (NoninvertibleTransformException e) { 581 e.printStackTrace();584 Logging.error(e); 582 585 } 583 586 } … … 585 588 public void shearPictureBy(double shx, double shy) { 586 589 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)); 589 592 transformer.concatenateTransformPoint(AffineTransform.getShearInstance(shx, shy), trans); 590 593 } catch (NoninvertibleTransformException e) { 591 e.printStackTrace();594 Logging.error(e); 592 595 } 593 596 } -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerFromFile.java
r32675 r33809 37 37 38 38 import org.openstreetmap.josm.Main; 39 import org.openstreetmap.josm.tools.Logging; 39 40 /** 40 41 * Layer displaying a picture loaded from a file. … … 71 72 protected Image createImage() throws IOException { 72 73 // Try to load file 73 Image image = null;74 75 74 if (isZip) { 76 75 try (ZipFile zipFile = new ZipFile(m_file)) { … … 95 94 } 96 95 } 97 System.err.println("Warning: no image in zip file found");96 Logging.warn("Warning: no image in zip file found"); 98 97 return null; 99 98 } 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())); 101 100 return null; 102 101 } 103 102 } else { 104 image = ImageIO.read(m_file); 105 return image; 103 return ImageIO.read(m_file); 106 104 } 107 105 } … … 170 168 } 171 169 } 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())); 173 171 return; 174 172 }
Note:
See TracChangeset
for help on using the changeset viewer.