Changeset 43 in josm for src/org/openstreetmap/josm/data/projection/Projection.java
- Timestamp:
- 2006-01-22T16:10:57+01:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/projection/Projection.java
r41 r43 1 1 package org.openstreetmap.josm.data.projection; 2 2 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;11 3 import org.openstreetmap.josm.data.GeoPoint; 12 4 … … 17 9 * @author imi 18 10 */ 19 abstractpublicclassProjectionimplements Cloneable{11 public interface Projection { 20 12 21 13 public static double MAX_LAT = 85; 22 14 public static double MAX_LON = 180; 23 24 /**25 * The event list with all state chaned listener26 */27 List<ChangeListener> listener = new LinkedList<ChangeListener>();28 15 29 16 /** … … 32 19 * @param p The geo point to convert. x/y members of the point are filled. 33 20 */ 34 abstract publicvoid latlon2xy(GeoPoint p);21 void latlon2xy(GeoPoint p); 35 22 36 23 /** … … 39 26 * @param p The geo point to convert. lat/lon members of the point are filled. 40 27 */ 41 abstract publicvoid xy2latlon(GeoPoint p);28 void xy2latlon(GeoPoint p); 42 29 43 30 … … 47 34 * Describe the projection converter in one or two words. 48 35 */ 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(); 115 37 }
Note:
See TracChangeset
for help on using the changeset viewer.