Changeset 33793 in osm for applications
- Timestamp:
- 2017-11-06T23:07:30+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/OsmInspectorPlugin
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/OsmInspectorPlugin/build.xml
r32680 r33793 5 5 <property name="commit.message" value="Commit message"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 0580"/>7 <property name="plugin.main.version" value="12881"/> 8 8 9 9 <property name="plugin.author" value="Nikhil Shirahatti"/> -
applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/GeoFabrikWFSClient.java
r30815 r33793 24 24 import org.opengis.referencing.NoSuchAuthorityCodeException; 25 25 import org.opengis.referencing.crs.CoordinateReferenceSystem; 26 import org.openstreetmap.josm.Main;27 26 import org.openstreetmap.josm.data.Bounds; 28 27 import org.openstreetmap.josm.data.coor.LatLon; 28 import org.openstreetmap.josm.gui.MainApplication; 29 import org.openstreetmap.josm.tools.Logging; 29 30 30 31 public class GeoFabrikWFSClient { … … 51 52 FeatureSource<SimpleFeatureType, SimpleFeature> source = data 52 53 .getFeatureSource(typeName); 53 Main.info("Source Metadata Bounds:" + source.getBounds());54 Main.info("Source schema: " + source.getSchema());54 Logging.info("Source Metadata Bounds:" + source.getBounds()); 55 Logging.info("Source schema: " + source.getSchema()); 55 56 56 57 progressMonitor.setProgress(40); … … 61 62 CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4236"); 62 63 63 Bounds bounds = Main .map.mapView.getLatLonBounds(Main.map.mapView64 64 Bounds bounds = MainApplication.getMap().mapView.getLatLonBounds( 65 MainApplication.getMap().mapView.getBounds()); 65 66 66 67 LatLon minLL = bounds.getMin(); … … 73 74 ReferencedEnvelope bboxRef = new ReferencedEnvelope(minLon, maxLon, 74 75 minLat, maxLat, targetCRS); 75 Main.info("Reference Bounds:" + bboxRef);76 Logging.info("Reference Bounds:" + bboxRef); 76 77 77 78 progressMonitor.setProgress(50); -
applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/ImportOsmInspectorBugsAction.java
r32450 r33793 12 12 13 13 import org.opengis.referencing.FactoryException; 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.actions.JosmAction; 16 15 import org.openstreetmap.josm.data.Bounds; 16 import org.openstreetmap.josm.gui.MainApplication; 17 import org.openstreetmap.josm.gui.MapView; 18 import org.openstreetmap.josm.tools.Logging; 17 19 import org.openstreetmap.josm.tools.Shortcut; 18 20 … … 38 40 public void actionPerformed(ActionEvent event) { 39 41 if (isEnabled()) { 40 ProgressMonitor monitor = new ProgressMonitor(Main.map.mapView, 42 MapView mapView = MainApplication.getMap().mapView; 43 ProgressMonitor monitor = new ProgressMonitor(mapView, 41 44 "Querying WFS Geofabrik", "Dowloading features", 0, 100); 42 45 43 46 try { 44 Bounds bounds = Main.map.mapView 45 .getLatLonBounds(Main.map.mapView.getBounds()); 47 Bounds bounds = mapView.getLatLonBounds(mapView.getBounds()); 46 48 47 Main.info("OSMI View bounds" + bounds);49 Logging.info("OSMI View bounds" + bounds); 48 50 49 51 monitor.setProgress(10); … … 54 56 wfs.initializeDataStore(); 55 57 inspector = new OsmInspectorLayer(wfs, monitor); 56 Main .getLayerManager().addLayer(inspector);58 MainApplication.getLayerManager().addLayer(inspector); 57 59 plugin.setLayer(inspector); 58 60 } else { … … 63 65 } 64 66 } catch (IOException | IndexOutOfBoundsException | NoSuchElementException | FactoryException | ParseException e) { 65 Main.error(e);67 Logging.error(e); 66 68 } finally { 67 69 monitor.close(); … … 71 73 } 72 74 } else { 73 Main.warn("Osm Inspector Action not enabled");75 Logging.warn("Osm Inspector Action not enabled"); 74 76 } 75 77 } -
applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/OsmInspectorLayer.java
r30828 r33793 151 151 * 152 152 */ 153 public class BugInfo implements Comparable<BugInfo>{153 public static class BugInfo implements Comparable<BugInfo>{ 154 154 155 155 public Geometry getGeom() { … … 255 255 * 256 256 */ 257 public class BugIndex {257 public static class BugIndex { 258 258 private int nextIndex; 259 259 private int previousIndex; -
applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/OsmInspectorPlugin.java
r32450 r33793 9 9 import org.openstreetmap.josm.Main; 10 10 import org.openstreetmap.josm.data.Bounds; 11 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 12 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 13 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 11 import org.openstreetmap.josm.data.UserIdentityManager; 12 import org.openstreetmap.josm.gui.MainApplication; 14 13 import org.openstreetmap.josm.gui.MapFrame; 15 14 import org.openstreetmap.josm.gui.NavigatableComponent; … … 19 18 import org.openstreetmap.josm.plugins.Plugin; 20 19 import org.openstreetmap.josm.plugins.PluginInformation; 20 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent; 21 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; 21 22 import org.openstreetmap.josm.tools.Shortcut; 22 23 … … 26 27 27 28 /** The JOSM user identity manager, it is used for obtaining the user name */ 28 private final JosmUserIdentityManager userIdentityManager;29 private final UserIdentityManager userIdentityManager; 29 30 30 31 … … 36 37 public OsmInspectorPlugin(PluginInformation info) { 37 38 super(info); 38 userIdentityManager = JosmUserIdentityManager.getInstance();39 userIdentityManager = UserIdentityManager.getInstance(); 39 40 initializePlugin(); 40 41 } … … 53 54 /* add default values for static variables */ 54 55 Main.pref.put("osmInspector.nickname", "osmi"); 55 Main.pref.put ("osmInspector.showBugs", true);56 Main.pref.putBoolean("osmInspector.showBugs", true); 56 57 Main.pref.put("osmInspector.version", getPluginInformation().version); 57 58 Main.pref.put("osmInspector.localVersion",getPluginInformation().localversion); … … 60 61 @Override 61 62 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 62 Main .toolbar.register( new ImportOsmInspectorBugsAction( this ) );63 MainApplication.getToolbar().register( new ImportOsmInspectorBugsAction( this ) ); 63 64 if (newFrame == null) { 64 65 /* if new MapFrame is null, remove listener */ … … 66 67 } else { 67 68 /* add MapDust dialog window */ 68 if (Main .map != null && Main.map.mapView != null) {69 if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) { 69 70 /* add MapdustGUI */ 70 Main .map.setBounds(newFrame.getBounds());71 MainApplication.getMap().setBounds(newFrame.getBounds()); 71 72 72 73 /* add Listeners */ 73 74 NavigatableComponent.addZoomChangeListener(this); 74 Main .map.mapView.addMouseListener(this);75 MainApplication.getMap().mapView.addMouseListener(this); 75 76 Main.pref.addPreferenceChangeListener(this); 76 77 /* put username to preferences */ 77 78 Main.pref.put("osmInspector.josmUserName", 78 79 userIdentityManager.getUserName()); 79 Main .toolbar.control.add( new ImportOsmInspectorBugsAction( this ) );80 MainApplication.getToolbar().control.add( new ImportOsmInspectorBugsAction( this ) ); 80 81 } 81 82 } … … 91 92 // Delegate feature selection to layer 92 93 // 93 public void mouseClicked(MouseEvent arg0) {94 public void mouseClicked(MouseEvent e) { 94 95 if (inspectorLayer != null) { 95 inspectorLayer.selectFeatures( arg0.getX(), arg0.getY());96 inspectorLayer.selectFeatures(e.getX(), e.getY()); 96 97 } 97 98 } 98 99 99 100 @Override 100 public void mouseEntered(MouseEvent arg0) {101 public void mouseEntered(MouseEvent e) { 101 102 102 103 } 103 104 104 105 @Override 105 public void mouseExited(MouseEvent arg0) {106 public void mouseExited(MouseEvent e) { 106 107 107 108 } 108 109 109 110 @Override 110 public void mousePressed(MouseEvent arg0) {111 public void mousePressed(MouseEvent e) { 111 112 112 113 } 113 114 114 115 @Override 115 public void mouseReleased(MouseEvent arg0) {116 public void mouseReleased(MouseEvent e) { 116 117 117 118 } -
applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/gui/OsmInspectorBugInfoDialog.java
r32450 r33793 8 8 import javax.swing.JTextPane; 9 9 10 import org.openstreetmap.josm. Main;10 import org.openstreetmap.josm.gui.MainApplication; 11 11 import org.openstreetmap.josm.gui.SideButton; 12 12 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; … … 23 23 */ 24 24 protected void buildContentPanel() { 25 Main .map.addToggleDialog(this, true);25 MainApplication.getMap().addToggleDialog(this, true); 26 26 27 27 bugTextArea = new JTextPane(); -
applications/editors/josm/plugins/OsmInspectorPlugin/src/org/openstreetmap/josm/plugins/osminspector/gui/OsmInspectorDialog.java
r32450 r33793 17 17 import javax.swing.event.ListSelectionListener; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.coor.LatLon; 20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.gui.SideButton; 22 22 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; … … 54 54 */ 55 55 protected void buildContentPanel() { 56 Main .map.addToggleDialog(this, true);56 MainApplication.getMap().addToggleDialog(this, true); 57 57 58 58 model = new DefaultListModel<>(); … … 77 77 Point centroid = geom.getCentroid(); 78 78 LatLon center = new LatLon(centroid.getY(), centroid.getX()); 79 Main .map.mapView.zoomTo(center);79 MainApplication.getMap().mapView.zoomTo(center); 80 80 layer.selectFeatures(center); 81 81 bugInfoDialog.setBugDescription(next); … … 88 88 actNext = new OsmInspectorNextAction(layer)); 89 89 nextButton.createArrow(new ActionListener() { 90 @Override 90 91 public void actionPerformed(ActionEvent e) { 91 92 int index = bugsList.getSelectedIndex(); … … 93 94 Point centroid = geom.getCentroid(); 94 95 LatLon center = new LatLon(centroid.getY(), centroid.getX()); 95 Main .map.mapView.zoomTo(center);96 MainApplication.getMap().mapView.zoomTo(center); 96 97 layer.selectFeatures(center); 97 98 } … … 102 103 actPrev = new OsmInspectorPrevAction(layer)); 103 104 prevButton.createArrow(new ActionListener() { 105 @Override 104 106 public void actionPerformed(ActionEvent e) { 105 107 } … … 112 114 Shortcut sprev = Shortcut.registerShortcut("osmi:prev", tr("Prev OSMI bug"), 113 115 KeyEvent.VK_J, Shortcut.CTRL_SHIFT); 114 Main .registerActionShortcut(actPrev, sprev);116 MainApplication.registerActionShortcut(actPrev, sprev); 115 117 116 118 Shortcut snext = Shortcut.registerShortcut("osmi:next", tr("Next OSMI bug"), 117 119 KeyEvent.VK_K, Shortcut.CTRL_SHIFT); 118 Main .registerActionShortcut(actNext, snext);120 MainApplication.registerActionShortcut(actNext, snext); 119 121 } 120 122 … … 177 179 Point centroid = geom.getCentroid(); 178 180 LatLon center = new LatLon(centroid.getY(), centroid.getX()); 179 Main .map.mapView.zoomTo(center);181 MainApplication.getMap().mapView.zoomTo(center); 180 182 inspectlayer.selectFeatures(center); 181 183 bugInfoDialog.setBugDescription(next); … … 207 209 Point centroid = geom.getCentroid(); 208 210 LatLon center = new LatLon(centroid.getY(), centroid.getX()); 209 Main .map.mapView.zoomTo(center);211 MainApplication.getMap().mapView.zoomTo(center); 210 212 inspectlayer.selectFeatures(center); 211 213 bugInfoDialog.setBugDescription(prev); … … 216 218 @Override 217 219 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 218 Layer newLayer = Main .getLayerManager().getActiveLayer();220 Layer newLayer = MainApplication.getLayerManager().getActiveLayer(); 219 221 if (newLayer instanceof OsmInspectorLayer) { 220 222 this.layer = (OsmInspectorLayer) newLayer;
Note:
See TracChangeset
for help on using the changeset viewer.