Changeset 2904 in josm for trunk/src


Ignore:
Timestamp:
2010-01-29T21:25:17+01:00 (15 years ago)
Author:
bastiK
Message:

minor cleanup & hooks for plugin

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java

    r2891 r2904  
    152152            lblCurrentDownloadArea.setText(tr("<html>There is currently no download area selected.</html>"));
    153153        } else {
    154             lblCurrentDownloadArea.setText(tr("<html><strong>Current download area</strong> (minlat,minlon, maxlat, maxlon): </html>"));
     154            lblCurrentDownloadArea.setText(tr("<html><strong>Current download area</strong> (minlon, minlat, maxlon, maxlat): </html>"));
    155155            bboxDisplay.setText(
     156                    currentArea.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES)+","+
    156157                    currentArea.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES)+","+
    157                     currentArea.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES)+","+
    158                     currentArea.getMax().latToString(CoordinateFormat.DECIMAL_DEGREES)+","+
    159                     currentArea.getMax().lonToString(CoordinateFormat.DECIMAL_DEGREES)
     158                    currentArea.getMax().lonToString(CoordinateFormat.DECIMAL_DEGREES)+","+
     159                    currentArea.getMax().latToString(CoordinateFormat.DECIMAL_DEGREES)
    160160            );
    161161        }
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r2850 r2904  
    3232import java.util.HashSet;
    3333import java.util.LinkedHashSet;
     34import java.util.LinkedList;
    3435import java.util.List;
    3536
     
    5556import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    5657import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     58import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    5759import org.openstreetmap.josm.gui.layer.GpxLayer;
    5860import org.openstreetmap.josm.gui.layer.Layer;
     
    289291        return ImageProvider.get("dialogs/geoimage");
    290292    }
    291 
    292     @Override
    293     public Object getInfoComponent() {
    294         // TODO Auto-generated method stub
    295         return null;
     293   
     294    public static interface LayerMenuAddition {
     295        public Component getComponent(Layer layer);
     296    }
     297
     298    private static List<LayerMenuAddition> menuAdditions = new LinkedList<LayerMenuAddition>();
     299    public static void registerMenuAddition(LayerMenuAddition addition) {
     300        menuAdditions.add(addition);
    296301    }
    297302
     
    301306        JMenuItem correlateItem = new JMenuItem(tr("Correlate to GPX"), ImageProvider.get("dialogs/geoimage/gpx2img"));
    302307        correlateItem.addActionListener(new CorrelateGpxWithImages(this));
    303 
    304         return new Component[] {
    305                 new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)),
    306                 new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)),
    307                 new JMenuItem(new RenameLayerAction(null, this)),
    308                 new JSeparator(),
    309                 correlateItem
    310         };
    311     }
    312 
    313     @Override
    314     public String getToolTipText() {
     308       
     309        List<Component> entries = new ArrayList<Component>();
     310        entries.add(new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)));
     311        entries.add(new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)));
     312        entries.add(new JMenuItem(new RenameLayerAction(null, this)));
     313        entries.add(new JSeparator());
     314        entries.add(correlateItem);
     315        for (LayerMenuAddition addition : menuAdditions) {
     316            entries.add(addition.getComponent(this));
     317        }
     318        entries.add(new JSeparator());
     319        entries.add(new JMenuItem(new LayerListPopup.InfoAction(this)));
     320
     321        return entries.toArray(new Component[0]);
     322       
     323    }
     324
     325    private String infoText() {
    315326        int i = 0;
    316327        for (ImageEntry e : data)
     
    320331        return trn("{0} image loaded.", "{0} images loaded.", data.size(), data.size())
    321332        + " " + trn("{0} was found to be GPS tagged.", "{0} were found to be GPS tagged.", i, i);
     333    }
     334   
     335    @Override public Object getInfoComponent() {
     336        return infoText();
     337    }
     338
     339    @Override
     340    public String getToolTipText() {
     341        return infoText();
    322342    }
    323343
     
    730750        Main.map.mapView.repaint();
    731751    }
     752   
     753    public List<ImageEntry> getImages() {
     754        List<ImageEntry> copy = new ArrayList<ImageEntry>();
     755        for (ImageEntry ie : data) {
     756            copy.add(ie.clone());
     757        }
     758        return copy;
     759    }
    732760}
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java

    r2711 r2904  
    1717 */
    1818
    19 final class ImageEntry implements Comparable<ImageEntry>, Cloneable {
     19final public class ImageEntry implements Comparable<ImageEntry>, Cloneable {
    2020    File file;
    2121    Date time;
     
    3030    Image thumbnail;
    3131
     32    /**
     33     * When the corralation dialog is open, we like to show the image position
     34     * for the current time offset on the map in real time.
     35     * On the other hand, when the user aborts this operation, the old values
     36     * should be restored. We have a temprary copy, that overrides
     37     * the normal values if it is not null. (This may be not the most elegant
     38     * solution for this, but it works.)
     39     */
    3240    ImageEntry tmp;
    3341
     
    5563    public void setElevation(Double elevation) {
    5664        this.elevation = elevation;
     65    }
     66   
     67    public File getFile() {
     68        return file;
    5769    }
    5870
Note: See TracChangeset for help on using the changeset viewer.