Changeset 34519 in osm


Ignore:
Timestamp:
2018-08-18T18:05:42+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/ImportImagePlugin
Files:
5 edited

Legend:

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

    r33557 r34519  
    55    <property name="commit.message" value="use consistent plugin name (don't mix up the words)" />
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="12671" />
     7    <property name="plugin.main.version" value="14153" />
    88
    99    <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  
    2727import org.opengis.referencing.NoSuchAuthorityCodeException;
    2828import org.opengis.referencing.crs.CoordinateReferenceSystem;
    29 import org.openstreetmap.josm.Main;
    3029import org.openstreetmap.josm.actions.RenameLayerAction;
    3130import org.openstreetmap.josm.data.Bounds;
     
    3332import org.openstreetmap.josm.data.coor.EastNorth;
    3433import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     34import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    3535import org.openstreetmap.josm.gui.ExtendedDialog;
    3636import org.openstreetmap.josm.gui.MainApplication;
     
    9696
    9797            // now reproject grid coverage
    98             coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode(Main.getProjection().toCode()));
     98            coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode(ProjectionRegistry.getProjection().toCode()));
    9999
    100100        } catch (FactoryException e) {
     
    105105                int val = 2;
    106106                if (!GraphicsEnvironment.isHeadless()) {
    107                     ExtendedDialog ex = new ExtendedDialog(Main.parent, tr("Warning"),
     107                    ExtendedDialog ex = new ExtendedDialog(MainApplication.getMainFrame(), tr("Warning"),
    108108                        new String[] {tr("Default image projection"), tr("JOSM''s current projection"), tr("Cancel")});
    109109                    // CHECKSTYLE.OFF: LineLength
     
    111111                        + "You can choose the default image projection ({0}) or JOSM''s current editor projection ({1}) as original image projection.<br>"
    112112                        + "(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()));
    114114                    // CHECKSTYLE.ON: LineLength
    115115                    val = ex.showDialog().getValue();
     
    125125                    } else {
    126126                        logger.debug("Passing through image un-projected.");
    127                         src = CRS.decode(Main.getProjection().toCode());
     127                        src = CRS.decode(ProjectionRegistry.getProjection().toCode());
    128128                    }
    129129                    // create a grid coverage from the image
     
    131131                    this.sourceRefSys = coverage.getCoordinateReferenceSystem();
    132132                    if (val == 1) {
    133                         coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode(Main.getProjection().toCode()));
     133                        coverage = PluginOperations.reprojectCoverage(coverage, CRS.decode(ProjectionRegistry.getProjection().toCode()));
    134134                    }
    135135                } catch (Exception e1) {
     
    298298        logger.debug("resample");
    299299        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()));
    301301        this.bbox = coverage.getEnvelope2D();
    302302        this.image = ((PlanarImage) coverage.getRenderedImage()).getAsBufferedImage();
     
    328328        public void actionPerformed(ActionEvent arg0) {
    329329            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);
    331331            layerProps.setVisible(true);
    332332        }
  • applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImageFileImporter.java

    r34219 r34519  
    1111
    1212import org.apache.log4j.Logger;
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.actions.ExtensionFileFilter;
    1514import org.openstreetmap.josm.gui.MainApplication;
     
    6059                logger.error("Error while creating image layer: \n" + e.getMessage());
    6160                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())));
    6362                continue;
    6463            }
  • applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImagePlugin.java

    r34443 r34519  
    1212import org.apache.log4j.Logger;
    1313import org.apache.log4j.PropertyConfigurator;
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.actions.ExtensionFileFilter;
    1615import org.openstreetmap.josm.actions.JosmAction;
     16import org.openstreetmap.josm.data.Preferences;
    1717import org.openstreetmap.josm.gui.MainApplication;
    1818import org.openstreetmap.josm.gui.MainMenu;
     
    4040
    4141    // path constants
    42     static final String PLUGIN_DIR = Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/";
     42    static final String PLUGIN_DIR = Preferences.main().getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/";
    4343    static final String PLUGINPROPERTIES_FILENAME = "pluginProperties.properties";
    4444    static final String PLUGINPROPERTIES_PATH = PLUGIN_DIR + PLUGINPROPERTIES_FILENAME;
     
    4646    static final String LOGGING_PROPERTIES_FILEPATH = PLUGIN_DIR + "log4j.properties/";
    4747
     48    /**
     49     * Returns Import image plugin properties.
     50     * @return Import image plugin properties
     51     */
    4852    public Properties getPluginProps() {
    4953        return pluginProps;
     
    5256    /**
    5357     * constructor
     58     * @param info plugin information
    5459     *
    5560     * @throws IOException if any I/O error occurs
     
    7883            loadFileAction = new LoadImageAction();
    7984            loadFileAction.setEnabled(true);
    80             if (Main.main != null) {
    81                 MainMenu.add(MainApplication.getMenu().imagerySubMenu, loadFileAction);
    82             }
     85            MainMenu.add(MainApplication.getMenu().imagerySubMenu, loadFileAction);
    8386
    8487            ExtensionFileFilter.addImporter(new ImportImageFileImporter());
     
    160163            // Set file for logging here:
    161164            props.setProperty("log4j.appender.MyRoFiAppender.file",
    162                     (Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/" + "log.log"));
     165                    (Preferences.main().getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/" + "log.log"));
    163166
    164167            PropertyConfigurator.configure(props);
     
    186189        // Set file for logging here:
    187190        props.setProperty("log4j.appender.A.file",
    188                 (Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/" + "log.log"));
     191                (Preferences.main().getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/" + "log.log"));
    189192
    190193        PropertyConfigurator.configure(props);
  • applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/LoadImageAction.java

    r33563 r34519  
    1111
    1212import org.apache.log4j.Logger;
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.actions.JosmAction;
    1514import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    1615import org.openstreetmap.josm.gui.MainApplication;
    1716import org.openstreetmap.josm.plugins.ImportImagePlugin.ImageLayer.LayerCreationCanceledException;
     17import org.openstreetmap.josm.spi.preferences.Config;
    1818
    1919/**
     
    3535
    3636    @Override
    37     public void actionPerformed(ActionEvent arg0) {
     37    public void actionPerformed(ActionEvent event) {
    3838
    3939        // 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));
    4141        fc.setAcceptAllFileFilterUsed(false);
    42         int result = fc.showOpenDialog(Main.parent);
     42        int result = fc.showOpenDialog(MainApplication.getMainFrame());
    4343
    4444        ImageLayer layer = null;
    4545        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());
    4747            logger.info("File chosen:" + fc.getSelectedFile());
    4848            try {
Note: See TracChangeset for help on using the changeset viewer.