Changeset 34519 in osm
- Timestamp:
- 2018-08-18T18:05:42+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/ImportImagePlugin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ImportImagePlugin/build.xml
r33557 r34519 5 5 <property name="commit.message" value="use consistent plugin name (don't mix up the words)" /> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 2671" />7 <property name="plugin.main.version" value="14153" /> 8 8 9 9 <property name="plugin.author" value="Christoph Beekmans, Fabian Kowitz, Anna Robaszkiewicz, Oliver Kuhn, Martin Ulitzny"/> -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayer.java
r34445 r34519 27 27 import org.opengis.referencing.NoSuchAuthorityCodeException; 28 28 import org.opengis.referencing.crs.CoordinateReferenceSystem; 29 import org.openstreetmap.josm.Main;30 29 import org.openstreetmap.josm.actions.RenameLayerAction; 31 30 import org.openstreetmap.josm.data.Bounds; … … 33 32 import org.openstreetmap.josm.data.coor.EastNorth; 34 33 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 34 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 35 35 import org.openstreetmap.josm.gui.ExtendedDialog; 36 36 import org.openstreetmap.josm.gui.MainApplication; … … 96 96 97 97 // now reproject grid coverage 98 coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode( Main.getProjection().toCode()));98 coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode(ProjectionRegistry.getProjection().toCode())); 99 99 100 100 } catch (FactoryException e) { … … 105 105 int val = 2; 106 106 if (!GraphicsEnvironment.isHeadless()) { 107 ExtendedDialog ex = new ExtendedDialog(Main .parent, tr("Warning"),107 ExtendedDialog ex = new ExtendedDialog(MainApplication.getMainFrame(), tr("Warning"), 108 108 new String[] {tr("Default image projection"), tr("JOSM''s current projection"), tr("Cancel")}); 109 109 // CHECKSTYLE.OFF: LineLength … … 111 111 + "You can choose the default image projection ({0}) or JOSM''s current editor projection ({1}) as original image projection.<br>" 112 112 + "(It can be changed later from the right click menu of the image layer.)", 113 ImportImagePlugin.pluginProps.getProperty("default_crs_srid"), Main.getProjection().toCode()));113 ImportImagePlugin.pluginProps.getProperty("default_crs_srid"), ProjectionRegistry.getProjection().toCode())); 114 114 // CHECKSTYLE.ON: LineLength 115 115 val = ex.showDialog().getValue(); … … 125 125 } else { 126 126 logger.debug("Passing through image un-projected."); 127 src = CRS.decode( Main.getProjection().toCode());127 src = CRS.decode(ProjectionRegistry.getProjection().toCode()); 128 128 } 129 129 // create a grid coverage from the image … … 131 131 this.sourceRefSys = coverage.getCoordinateReferenceSystem(); 132 132 if (val == 1) { 133 coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode( Main.getProjection().toCode()));133 coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode(ProjectionRegistry.getProjection().toCode())); 134 134 } 135 135 } catch (Exception e1) { … … 298 298 logger.debug("resample"); 299 299 GridCoverage2D coverage = PluginOperations.createGridFromFile(this.imageFile, refSys, true); 300 coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode( Main.getProjection().toCode()));300 coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode(ProjectionRegistry.getProjection().toCode())); 301 301 this.bbox = coverage.getEnvelope2D(); 302 302 this.image = ((PlanarImage) coverage.getRenderedImage()).getAsBufferedImage(); … … 328 328 public void actionPerformed(ActionEvent arg0) { 329 329 LayerPropertiesDialog layerProps = new LayerPropertiesDialog(imageLayer, PluginOperations.crsDescriptions); 330 layerProps.setLocation(Main .parent.getWidth() / 4, Main.parent.getHeight() / 4);330 layerProps.setLocation(MainApplication.getMainFrame().getWidth() / 4, MainApplication.getMainFrame().getHeight() / 4); 331 331 layerProps.setVisible(true); 332 332 } -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImageFileImporter.java
r34219 r34519 11 11 12 12 import org.apache.log4j.Logger; 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.ExtensionFileFilter; 15 14 import org.openstreetmap.josm.gui.MainApplication; … … 60 59 logger.error("Error while creating image layer: \n" + e.getMessage()); 61 60 GuiHelper.runInEDT(() -> 62 JOptionPane.showMessageDialog(Main .parent, tr("Error while creating image layer: {0}", e.getCause())));61 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Error while creating image layer: {0}", e.getCause()))); 63 62 continue; 64 63 } -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImagePlugin.java
r34443 r34519 12 12 import org.apache.log4j.Logger; 13 13 import org.apache.log4j.PropertyConfigurator; 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.actions.ExtensionFileFilter; 16 15 import org.openstreetmap.josm.actions.JosmAction; 16 import org.openstreetmap.josm.data.Preferences; 17 17 import org.openstreetmap.josm.gui.MainApplication; 18 18 import org.openstreetmap.josm.gui.MainMenu; … … 40 40 41 41 // path constants 42 static final String PLUGIN_DIR = Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/";42 static final String PLUGIN_DIR = Preferences.main().getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/"; 43 43 static final String PLUGINPROPERTIES_FILENAME = "pluginProperties.properties"; 44 44 static final String PLUGINPROPERTIES_PATH = PLUGIN_DIR + PLUGINPROPERTIES_FILENAME; … … 46 46 static final String LOGGING_PROPERTIES_FILEPATH = PLUGIN_DIR + "log4j.properties/"; 47 47 48 /** 49 * Returns Import image plugin properties. 50 * @return Import image plugin properties 51 */ 48 52 public Properties getPluginProps() { 49 53 return pluginProps; … … 52 56 /** 53 57 * constructor 58 * @param info plugin information 54 59 * 55 60 * @throws IOException if any I/O error occurs … … 78 83 loadFileAction = new LoadImageAction(); 79 84 loadFileAction.setEnabled(true); 80 if (Main.main != null) { 81 MainMenu.add(MainApplication.getMenu().imagerySubMenu, loadFileAction); 82 } 85 MainMenu.add(MainApplication.getMenu().imagerySubMenu, loadFileAction); 83 86 84 87 ExtensionFileFilter.addImporter(new ImportImageFileImporter()); … … 160 163 // Set file for logging here: 161 164 props.setProperty("log4j.appender.MyRoFiAppender.file", 162 ( Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/" + "log.log"));165 (Preferences.main().getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/" + "log.log")); 163 166 164 167 PropertyConfigurator.configure(props); … … 186 189 // Set file for logging here: 187 190 props.setProperty("log4j.appender.A.file", 188 ( Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/" + "log.log"));191 (Preferences.main().getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/" + "log.log")); 189 192 190 193 PropertyConfigurator.configure(props); -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/LoadImageAction.java
r33563 r34519 11 11 12 12 import org.apache.log4j.Logger; 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.JosmAction; 15 14 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 16 15 import org.openstreetmap.josm.gui.MainApplication; 17 16 import org.openstreetmap.josm.plugins.ImportImagePlugin.ImageLayer.LayerCreationCanceledException; 17 import org.openstreetmap.josm.spi.preferences.Config; 18 18 19 19 /** … … 35 35 36 36 @Override 37 public void actionPerformed(ActionEvent arg0) {37 public void actionPerformed(ActionEvent event) { 38 38 39 39 // Choose a file 40 JFileChooser fc = new JFileChooser( Main.pref.get("plugins.importimage.importpath", null));40 JFileChooser fc = new JFileChooser(Config.getPref().get("plugins.importimage.importpath", null)); 41 41 fc.setAcceptAllFileFilterUsed(false); 42 int result = fc.showOpenDialog(Main .parent);42 int result = fc.showOpenDialog(MainApplication.getMainFrame()); 43 43 44 44 ImageLayer layer = null; 45 45 if (result == JFileChooser.APPROVE_OPTION) { 46 Main.pref.put("plugins.importimage.importpath", fc.getCurrentDirectory().getAbsolutePath());46 Config.getPref().put("plugins.importimage.importpath", fc.getCurrentDirectory().getAbsolutePath()); 47 47 logger.info("File chosen:" + fc.getSelectedFile()); 48 48 try {
Note:
See TracChangeset
for help on using the changeset viewer.