Changeset 28445 in osm for applications/editors/josm


Ignore:
Timestamp:
2012-06-18T22:36:22+02:00 (12 years ago)
Author:
jttt
Message:

adapted to latest josm, not tested (plugin is not in josm plugin list so I'm not sure i'ts actually used)

Location:
applications/editors/josm/plugins/epsg31287
Files:
2 added
3 edited

Legend:

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

    r26605 r28445  
    3636    <property name="commit.message" value="fixed proj4 Parameters (thanks to Hetzi + Mikael Rittri)"/>
    3737    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    38     <property name="plugin.main.version" value="4394"/>
     38    <property name="plugin.main.version" value="5248"/>
    3939    <!--
    4040      ************************************************
     
    154154    </target>
    155155    <!--
    156     ************************** Publishing the plugin *********************************** 
    157     -->
    158     <!--
    159         ** extracts the JOSM release for the JOSM version in ../core and saves it in the 
     156    ************************** Publishing the plugin ***********************************
     157    -->
     158    <!--
     159        ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    160160        ** property ${coreversion.info.entry.revision}
    161161        **
     
    207207    </target>
    208208    <!--
    209         ** commits the plugin.jar 
     209        ** commits the plugin.jar
    210210        -->
    211211    <target name="commit-dist">
    212212        <echo>
    213213    ***** Properties of published ${plugin.jar} *****
    214     Commit message    : '${commit.message}'                   
     214    Commit message    : '${commit.message}'
    215215    Plugin-Mainversion: ${plugin.main.version}
    216216    JOSM build version: ${coreversion.info.entry.revision}
    217217    Plugin-Version    : ${version.entry.commit.revision}
    218     ***** / Properties of published ${plugin.jar} *****                   
    219                        
     218    ***** / Properties of published ${plugin.jar} *****
     219
    220220    Now commiting ${plugin.jar} ...
    221221    </echo>
  • applications/editors/josm/plugins/epsg31287/src/org/openstreetmap/josm/plugins/epsg31287/Epsg31287.java

    r25262 r28445  
    33package org.openstreetmap.josm.plugins.epsg31287;
    44
    5 import org.openstreetmap.josm.data.projection.Projections;
     5import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    66import org.openstreetmap.josm.plugins.Plugin;
    77import org.openstreetmap.josm.plugins.PluginInformation;
     
    1010    public Epsg31287(PluginInformation info) {
    1111        super(info);
    12         Projections.addProjection(new ProjectionEPSG31287());
     12        ProjectionPreference.registerProjectionChoice(new Epsg31287Gui());
    1313    }
    1414}
  • applications/editors/josm/plugins/epsg31287/src/org/openstreetmap/josm/plugins/epsg31287/ProjectionEPSG31287.java

    r25122 r28445  
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    7 import java.awt.GridBagLayout;
    8 import java.awt.event.ActionListener;
    97import java.awt.geom.Point2D;
    10 import java.util.Arrays;
    11 import java.util.Collection;
    12 
    13 import javax.swing.JLabel;
    14 import javax.swing.JPanel;
    15 import javax.swing.JTextField;
    168
    179import org.openstreetmap.josm.data.Bounds;
    1810import org.openstreetmap.josm.data.coor.EastNorth;
    1911import org.openstreetmap.josm.data.coor.LatLon;
    20 import org.openstreetmap.josm.tools.GBC;
    2112
    22 public class ProjectionEPSG31287 implements org.openstreetmap.josm.data.projection.Projection, org.openstreetmap.josm.data.projection.ProjectionSubPrefs {
     13public class ProjectionEPSG31287 implements org.openstreetmap.josm.data.projection.Projection {
    2314
    24         private double dx = 0.0;
    25         private double dy = 0.0;
     15        private final double dx;
     16        private final double dy;
    2617        private final static String projCode = "EPSG:31287";
    2718
     
    2920
    3021        public ProjectionEPSG31287() {
    31                 super();
     22                this(0,0);
     23        }
     24
     25        public ProjectionEPSG31287(double dx, double dy) {
     26                this.dx = dx;
     27                this.dy = dy;
    3228                // use use com.jhlabs.map.proj.ProjectionFactory for doing all the math
    3329                projection = com.jhlabs.map.proj.ProjectionFactory.fromPROJ4Specification(
     
    4541                                }
    4642                );
    47         }
    48 
    49         // PreferencePanel, not used in plugin mode, useful for JOSM custom-build
    50         @Override
    51         public void setupPreferencePanel(JPanel p, ActionListener actionListener) {
    52                 //p.add(new HtmlPanel("<i>EPSG:31287 - Bessel 1841 in Lambert_Conformal_Conic_2SP</i>"), GBC.eol().fill(GBC.HORIZONTAL));
    53                 //p.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH));
    54                 p.setLayout(new GridBagLayout());
    55 
    56                 JTextField gdx = new JTextField(""+dx);
    57                 JTextField gdy = new JTextField(""+dy);
    58 
    59                 p.add(new JLabel(tr("dx")), GBC.std().insets(5,5,0,5));
    60                 p.add(GBC.glue(1, 0), GBC.std().fill(GBC.HORIZONTAL));
    61                 p.add(gdx, GBC.eop().fill(GBC.HORIZONTAL));
    62 
    63                 p.add(new JLabel(tr("dy")), GBC.std().insets(5,5,0,5));
    64                 p.add(GBC.glue(1, 0), GBC.std().fill(GBC.HORIZONTAL));
    65                 p.add(gdy, GBC.eop().fill(GBC.HORIZONTAL));
    66                 p.add(GBC.glue(1, 1), GBC.eol().fill(GBC.BOTH));
    67 
    68         }
    69 
    70         // for PreferencePanel, not used in plugin mode, useful for JOSM custom-build
    71         @Override
    72         public Collection<String> getPreferences(JPanel p) {
    73                 dx = new Double(((JTextField)p.getComponent(2)).getText());
    74                 dy = new Double(((JTextField)p.getComponent(5)).getText());
    75                 return Arrays.asList(""+dx,""+dy);
    76         }
    77 
    78         // for PreferencePanel, not used in plugin mode, useful for JOSM custom-build
    79         @Override
    80         public Collection<String> getPreferencesFromCode(String code) {
    81                 dx = 85.0;
    82                 dy = 45.0;
    83                 return null;
    84         }
    85 
    86         // for PreferencePanel, not used in plugin mode, useful for JOSM custom-build
    87         @Override
    88         public void setPreferences(Collection<String> args) {
    89                 if(args != null)
    90                 {
    91                         String[] array = args.toArray(new String[0]);
    92                         if (array.length > 0) {
    93                                 try {
    94                                         dx = Double.parseDouble(array[0]);
    95                                 } catch(NumberFormatException e) {}
    96                         }
    97                         if (array.length > 1) {
    98                                 try {
    99                                         dy = Double.parseDouble(array[1]);
    100                                 } catch(NumberFormatException e) {}
    101                         }
    102                 }
    10343        }
    10444
     
    162102        }
    163103
    164         @Override
    165         public String[] allCodes() {
    166                 return new String[] {projCode};
    167         }
    168104
    169105}
Note: See TracChangeset for help on using the changeset viewer.