Changeset 35027 in osm for applications
- Timestamp:
- 2019-06-03T14:35:47+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/piclayer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/build.xml
r35005 r35027 1 1 <?xml version="1.0" encoding="utf-8"?> 2 3 2 <project name="PicLayer" default="dist" basedir="."> 4 5 3 <property name="commit.message" value="[josm/PicLayer] - #12045 add ability to localize dialog titles"/> 6 7 4 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 8 9 <property name="plugin.main.version" value="11713"/> 10 11 12 5 <property name="plugin.main.version" value="14153"/> 6 13 7 <!-- Configure these properties (replace "..." accordingly). 14 15 8 See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins 16 17 9 --> 18 19 <property name="plugin.author" value="Tomasz Stelmach, Rebecca Schmidt"/> 20 10 <property name="plugin.author" value="Tomasz Stelmach"/> 21 11 <property name="plugin.class" value="org.openstreetmap.josm.plugins.piclayer.PicLayerPlugin"/> 22 23 12 <property name="plugin.description" value="This plugin allows to display any picture as a background in the editor and align it with the map."/> 24 25 13 <property name="plugin.icon" value="images/layericon.png"/> 26 27 14 <property name="plugin.link" value="https://josm.openstreetmap.de/wiki/Help/Plugin/PicLayer"/> 28 29 15 <property name="plugin.canloadatruntime" value="true"/> 30 16 31 32 33 17 <!-- ** include targets that all plugins have in common ** --> 34 35 18 <import file="../build-common.xml"/> 36 19 37 38 39 20 </project> -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/autocalibrate/AutoCalibrateHandler.java
r35005 r35027 39 39 import org.openstreetmap.josm.plugins.piclayer.gui.autocalibrate.ResultCheckView; 40 40 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract; 41 import org.openstreetmap.josm.tools.Logging; 41 42 42 43 /** … … 115 116 * 116 117 */ 117 private class HelpButtonListener implements ActionListener {118 private static class HelpButtonListener implements ActionListener { 118 119 @Override 119 120 public void actionPerformed(ActionEvent e) { … … 176 177 // calibrate 177 178 callCalibrator(); 178 mainWindow.setVisible(false);179 179 currentPicLayer.clearDrawReferencePoints(); 180 180 currentPicLayer.invalidate(); 181 181 MainApplication.getLayerManager().setActiveLayer(currentPicLayer); 182 mainWindow.setVisible(false); 182 183 // let user check calibration 183 184 ResultCheckView checkView = new ResultCheckView(); … … 233 234 @Override 234 235 public void propertyChange(PropertyChangeEvent event) { 235 String propName = event.getPropertyName(); 236 int size = Integer.parseInt(propName.replaceAll("\\D", "")); 236 int size = (int) event.getNewValue(); 237 237 if(currentPicLayer.getTransformer().getLatLonOriginPoints() != null) { 238 238 originPointList.clear(); … … 256 256 @Override 257 257 public void propertyChange(PropertyChangeEvent event) { 258 String propName = event.getPropertyName(); 259 int size = Integer.parseInt(propName.replaceAll("\\D", "")); 258 int size = (int) event.getNewValue(); 260 259 mainWindow.setReferencePoints(referencePointList); 261 260 … … 517 516 translatedPoint = currentPicLayer.transformPoint(new Point2D.Double(en.getInViewX(), en.getInViewY())); 518 517 } catch (NoninvertibleTransformException e) { 519 e.printStackTrace();518 Logging.error(e); 520 519 } 521 520 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/autocalibrate/AutoCalibratePictureAction.java
r35005 r35027 47 47 currentLayer = (PicLayerAbstract) MainApplication.getLayerManager().getActiveLayer(); 48 48 49 if(currentLayer != null && currentLayer instanceof PicLayerAbstract) {49 if(currentLayer != null) { 50 50 calibrationHandler.prepare(currentLayer); 51 51 calibrationWindow = calibrationHandler.getMainWindow(); -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/autocalibrate/AutoCalibrator.java
r35005 r35027 13 13 import org.openstreetmap.josm.plugins.piclayer.gui.autocalibrate.CalibrationErrorView; 14 14 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract; 15 import org.openstreetmap.josm.tools.Logging; 15 16 16 17 … … 181 182 translatedPoint = currentLayer.transformPoint(new Point2D.Double(en.getInViewX(), en.getInViewY())); 182 183 } catch (NoninvertibleTransformException e) { 183 e.printStackTrace();184 Logging.error(e); 184 185 } 185 186 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/autocalibrate/helper/ObservableArrayList.java
r35005 r35027 5 5 import java.util.ArrayList; 6 6 import java.util.Collection; 7 8 import javafx.beans.property.SimpleIntegerProperty;9 7 10 8 /** … … 15 13 public class ObservableArrayList<E> extends ArrayList<E>{ 16 14 17 private SimpleIntegerProperty sizeProperty; 18 protected PropertyChangeSupport propertyChangeSupport; 15 private PropertyChangeSupport changes = new PropertyChangeSupport(this); 19 16 20 17 public ObservableArrayList() { 21 18 super(); 22 propertyChangeSupport = new PropertyChangeSupport(this);23 sizeProperty = new SimpleIntegerProperty(0);24 19 } 25 20 26 public ObservableArrayList(int initialCapacity) { 27 super(initialCapacity); 28 propertyChangeSupport = new PropertyChangeSupport(this); 29 sizeProperty = new SimpleIntegerProperty(0); 21 public ObservableArrayList(int cap) { 22 super(cap); 30 23 } 31 24 32 25 public ObservableArrayList(Collection<? extends E> c) { 33 26 super(c); 34 propertyChangeSupport = new PropertyChangeSupport(this);35 sizeProperty = new SimpleIntegerProperty(0);36 27 } 37 28 … … 39 30 @Override 40 31 public boolean add(E e) { 41 boolean returnValue = super.add(e); 42 sizeProperty.set(size()); 43 propertyChangeSupport.firePropertyChange(sizeProperty.toString(), false, true); 44 return returnValue; 32 int oldSize = super.size(); 33 if(super.add(e)) { 34 changes.firePropertyChange("size", oldSize, super.size()); 35 return true; 36 }; 37 return false; 45 38 } 46 39 40 47 41 @Override 48 49 super.add(index, element);50 sizeProperty.set(size());51 propertyChangeSupport.firePropertyChange(sizeProperty.toString(), false, true);42 public void add(int index, E element) { 43 int oldSize = super.size(); 44 super.add(index, element); 45 changes.firePropertyChange("size", oldSize, super.size()); 52 46 } 53 47 54 48 @Override 55 public E remove(int index) { 56 E returnValue = super.remove(index); 57 sizeProperty.set(size()); 58 propertyChangeSupport.firePropertyChange(sizeProperty.toString(), false, true); 59 return returnValue; 49 public boolean addAll(Collection<? extends E> c) { 50 int oldSize = super.size(); 51 if(super.addAll(c)) { 52 changes.firePropertyChange("size", oldSize, super.size()); 53 return true; 54 }; 55 return false; 60 56 } 61 57 62 58 @Override 63 public void clear() { 64 super.clear(); 65 sizeProperty.set(size()); 66 propertyChangeSupport.firePropertyChange(sizeProperty.toString(), false, true); 59 public E remove(int index) { 60 int oldSize = super.size(); 61 E removed = super.remove(index); 62 changes.firePropertyChange("size", oldSize, super.size()); 63 return removed; 67 64 } 68 65 69 66 @Override 70 public boolean remove(Object o) { 71 boolean returnValue = super.remove(o); 72 if(returnValue){ 73 sizeProperty.set(size()); 74 propertyChangeSupport.firePropertyChange(sizeProperty.toString(), false, true); 75 } 76 return returnValue; 67 public boolean remove(Object o) { 68 int oldSize = super.size(); 69 if(super.remove(o)) { 70 changes.firePropertyChange("size", oldSize, super.size()); 71 return true; 72 } 73 return false; 74 } 75 76 @Override 77 public void clear() { 78 int oldSize = super.size(); 79 super.clear(); 80 changes.firePropertyChange("size", oldSize, super.size()); 77 81 } 78 82 79 83 public void addPropertyChangeListener(PropertyChangeListener listener) { 80 propertyChangeSupport.addPropertyChangeListener(listener);84 changes.addPropertyChangeListener(listener); 81 85 } 82 86 83 87 public void removePropertyChangeListener(PropertyChangeListener listener) { 84 propertyChangeSupport.removePropertyChangeListener(listener);88 changes.removePropertyChangeListener(listener); 85 89 } 86 90
Note:
See TracChangeset
for help on using the changeset viewer.