Ignore:
Timestamp:
2011-06-29T10:06:35+02:00 (13 years ago)
Author:
stoecker
Message:

fix #6432 - projection handling for TMS and WMS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/Layer.java

    r4126 r4183  
    1616import javax.swing.Action;
    1717import javax.swing.Icon;
     18import javax.swing.JOptionPane;
    1819import javax.swing.JSeparator;
    1920
     21import org.openstreetmap.josm.Main;
    2022import org.openstreetmap.josm.actions.GpxExportAction;
    2123import org.openstreetmap.josm.actions.SaveAction;
     
    7577    static public final String NAME_PROP = Layer.class.getName() + ".name";
    7678
    77 
    7879    /** keeps track of property change listeners */
    7980    protected PropertyChangeSupport propertyChangeSupport;
     
    308309
    309310    /**
    310      *
     311     * Check changed status of layer
    311312     *
    312313     * @return True if layer was changed since last paint
     
    314315    public boolean isChanged() {
    315316        return true;
     317    }
     318
     319    /**
     320     * allows to check whether a projection is supported or not
     321     *
     322     * @return True if projection is supported for this layer
     323     */
     324    public boolean isProjectionSupported(Projection proj) {
     325        return true;
     326    }
     327
     328    /**
     329     * Specify user information about projections
     330     *
     331     * @return User readable text telling about supported projections
     332     */
     333    public String nameSupportedProjections() {
     334        return tr("All projections are supported");
    316335    }
    317336
     
    370389    @Override
    371390    public void projectionChanged(Projection oldValue, Projection newValue) {
    372         // default implementation does nothing - override in subclasses
     391        if(!isProjectionSupported(newValue)) {
     392              JOptionPane.showMessageDialog(Main.parent,
     393                  tr("The layer {0} does not support the new projection {1}.\n{2}\n"
     394                  + "Change the projection again or remove the layer.",
     395                      getName(), newValue.toCode(), nameSupportedProjections()),
     396                      tr("Warning"),
     397                      JOptionPane.WARNING_MESSAGE);
     398        }
    373399    }
    374400}
Note: See TracChangeset for help on using the changeset viewer.