Ignore:
Timestamp:
2006-01-22T16:10:57+01:00 (14 years ago)
Author:
imi
Message:
  • removed UTM (too complex)
  • added please wait dialog for down-/uploading
  • added created_by=JOSM to every new element
Location:
src/org/openstreetmap/josm/data/projection
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/data/projection/Epsg4263.java

    r42 r43  
    11package org.openstreetmap.josm.data.projection;
    2 
    3 import javax.swing.JComponent;
    42
    53import org.openstreetmap.josm.data.GeoPoint;
     
    108 * @author imi
    119 */
    12 public class Epsg4263 extends Projection {
     10public class Epsg4263 implements Projection {
    1311
    14         @Override
    1512        public void latlon2xy(GeoPoint p) {
    1613                p.x = p.lon;
     
    1815        }
    1916
    20         @Override
    2117        public void xy2latlon(GeoPoint p) {
    2218                p.lat = p.y;
     
    2824                return "EPSG:4263";
    2925        }
    30 
    31         @Override
    32         public JComponent getConfigurationPanel() {
    33                 return null;
    34         }
    35 
    36         @Override
    37         public void commitConfigurationPanel() {
    38         }
    3926}
  • src/org/openstreetmap/josm/data/projection/Mercator.java

    r39 r43  
    11package org.openstreetmap.josm.data.projection;
    2 
    3 import javax.swing.JComponent;
    42
    53import org.openstreetmap.josm.data.GeoPoint;
     
    1412 * @author imi
    1513 */
    16 public class Mercator extends Projection {
     14public class Mercator implements Projection {
    1715
    18         @Override
    1916        public void latlon2xy(GeoPoint p) {
    2017                p.x = p.lon*Math.PI/180;
     
    2219        }
    2320
    24         @Override
    2521        public void xy2latlon(GeoPoint p) {
    2622                p.lon = p.x*180/Math.PI;
     
    3228                return "Mercator";
    3329        }
    34 
    35         @Override
    36         public JComponent getConfigurationPanel() {
    37                 return null;
    38         }
    39 
    40         @Override
    41         public void commitConfigurationPanel() {
    42         }
    4330}
  • src/org/openstreetmap/josm/data/projection/Projection.java

    r41 r43  
    11package org.openstreetmap.josm.data.projection;
    22
    3 import java.util.LinkedList;
    4 import java.util.List;
    5 
    6 import javax.swing.JComponent;
    7 import javax.swing.event.ChangeEvent;
    8 import javax.swing.event.ChangeListener;
    9 
    10 import org.openstreetmap.josm.data.Bounds;
    113import org.openstreetmap.josm.data.GeoPoint;
    124
     
    179 * @author imi
    1810 */
    19 abstract public class Projection implements Cloneable {
     11public interface Projection {
    2012
    2113        public static double MAX_LAT = 85;
    2214        public static double MAX_LON = 180;
    23 
    24         /**
    25          * The event list with all state chaned listener
    26          */
    27         List<ChangeListener> listener = new LinkedList<ChangeListener>();
    2815       
    2916        /**
     
    3219         * @param p             The geo point to convert. x/y members of the point are filled.
    3320         */
    34         abstract public void latlon2xy(GeoPoint p);
     21        void latlon2xy(GeoPoint p);
    3522       
    3623        /**
     
    3926         * @param p             The geo point to convert. lat/lon members of the point are filled.
    4027         */
    41         abstract public void xy2latlon(GeoPoint p);
     28        void xy2latlon(GeoPoint p);
    4229
    4330       
     
    4734         * Describe the projection converter in one or two words.
    4835         */
    49         @Override
    50         abstract public String toString();
    51        
    52         // miscellous functions
    53        
    54         /**
    55          * If the projection supports any configuration, this function return
    56          * the configuration panel. If no configuration needed,
    57          * return <code>null</code>.
    58          *
    59          * The items on the configuration panel should not update the configuration
    60          * directly, but remember changed settings so a call to commitConfigurationPanel
    61          * can set them.
    62          *
    63          * This function also rolls back all changes to the configuration panel interna
    64          * components.
    65          */
    66         abstract public JComponent getConfigurationPanel();
    67         /**
    68          * Commits any changes from components created by addToConfigurationPanel.
    69          * The projection should now obtain the new settings. If any setting has
    70          * changed, the implementation have to call to fireStateChanged to inform
    71          * the listeners.
    72          */
    73         abstract public void commitConfigurationPanel();
    74 
    75         /**
    76          * Initialize itself with the given bounding rectangle (regarding lat/lon).
    77          *
    78          * This function should initialize own parameters needed to do the
    79          * projection at best effort.
    80          *
    81          * Init must not fire an state changed event, since it is usually called
    82          * during the initialization of the mapFrame.
    83          *
    84          * This implementation does nothing. It is provided only for subclasses
    85          * to initialize their data members.
    86          */
    87         public void init(Bounds b) {}
    88        
    89         /**
    90          * Add an event listener to the state changed event queue. If passed
    91          * <code>null</code>, nothing happens.
    92          */
    93         public final void addChangeListener(ChangeListener l) {
    94                 if (l != null)
    95                         listener.add(l);
    96         }
    97         /**
    98          * Remove an event listener from the event queue. If passed
    99          * <code>null</code>, nothing happens.
    100          */
    101         public final void removeChangeListener(ChangeListener l) {
    102                 listener.remove(l);
    103         }
    104         /**
    105          * Fire an ChangeEvent to every listener on the queue.
    106          */
    107         public final void fireStateChanged() {
    108                 ChangeEvent e = null;
    109                 for(ChangeListener l : listener) {
    110                         if (e == null)
    111                                 e = new ChangeEvent(this);
    112                         l.stateChanged(e);
    113                 }
    114         }
     36        String toString();
    11537}
Note: See TracChangeset for help on using the changeset viewer.