Changeset 1914 in josm for trunk/src/org


Ignore:
Timestamp:
2009-08-05T11:40:38+02:00 (15 years ago)
Author:
Gubaer
Message:

Preparing for a WMSPlugin update

File:
1 edited

Legend:

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

    r1895 r1914  
    305305        tempG.fillRect(0, 0, getWidth(), getHeight());
    306306
     307        Layer activeLayer = getActiveLayer();
    307308        for (int i = layers.size()-1; i >= 0; --i) {
    308309            Layer l = layers.get(i);
    309             if (l.isVisible()/* && l != getActiveLayer()*/) {
     310            if (l.isVisible() && l != getActiveLayer()) {
    310311                l.paint(tempG, this);
    311312            }
    312313        }
    313 
    314         /*if (getActiveLayer() != null && getActiveLayer().visible)
    315             getActiveLayer().paint(tempG, this);*/
     314        if (activeLayer != null) {
     315            activeLayer.paint(tempG, this);
     316        }
    316317
    317318        for (MapViewPaintable mvp : temporaryLayers) {
     
    392393    public List<Layer> getAllLayersAsList() {
    393394        return Collections.unmodifiableList(layers);
     395    }
     396
     397    /**
     398     * Replies an unmodifiable list of layers of a certain type.
     399     *
     400     * Example:
     401     * <pre>
     402     *     List<WMSLayer> wmsLayers = getLayersOfType(WMSLayer.class);
     403     * </pre>
     404     *
     405     * @return an unmodifiable list of layers of a certain type.
     406     */
     407    public <T> List<T>  getLayersOfType(Class<T> ofType) {
     408        ArrayList<T> ret = new ArrayList<T>();
     409        for (Layer layer : getAllLayersAsList()) {
     410            if (ofType.isInstance(layer)) {
     411                ret.add(ofType.cast(layer));
     412            }
     413        }
     414        return ret;
    394415    }
    395416
Note: See TracChangeset for help on using the changeset viewer.