Revision 42513

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLayers.java
54 54
import org.gvsig.fmap.mapcontext.layers.operations.LayerNotFoundInCollectionException;
55 55
import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitable;
56 56
import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
57
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
57 58
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable;
58 59
import org.gvsig.metadata.exceptions.MetadataException;
59 60
import org.gvsig.tools.ToolsLocator;
......
85 86
 * @see FLyrDefault
86 87
 */
87 88
public class FLayers extends FLyrDefault implements LayerCollection,
88
        InfoByPoint, List {
89
        InfoByPoint, List<FLayer> {
89 90

  
90 91
    /**
91 92
     * List with all listeners registered for this kind of node.
......
118 119
     * @see #getLayersCount()
119 120
     * @see #getFullEnvelope()
120 121
     */
121
    protected List layers = null;
122
    protected List<FLayer> layers = null;
122 123

  
123 124
    /**
124 125
     * The model of the layer.
......
1451 1452
        }
1452 1453
        return null;
1453 1454
    }
1455

  
1456
    public FLyrVect getFirstActiveVectorLayer() {
1457
        LayersIterator it = new LayersIterator(this) {
1458
            public boolean evaluate(FLayer layer) {
1459
                return layer.isActive() && layer instanceof FLyrVect;
1460
            }
1461
        };
1462
        if( it.hasNext() ) {
1463
            return (FLyrVect) it.next();
1464
        }
1465
        return null;
1466
    }
1454 1467
    
1455 1468
    public Iterator iterator() {
1456 1469
        return this.layers.iterator();
......
1465 1478
        return this.layers.size();
1466 1479
    }
1467 1480
    
1468
    public Object get(int index) {
1481
    public FLayer get(int index) {
1469 1482
        return this.layers.get(index);
1470 1483
    }
1471 1484
    
......
1485 1498
        return this.layers.toArray(ts);
1486 1499
    }
1487 1500

  
1488
    public boolean add(Object e) {
1489
        this.addLayer((FLayer) e);
1501
    public boolean add(FLayer e) {
1502
        this.addLayer(e);
1490 1503
        return true;
1491 1504
    }
1492 1505

  
......
1499 1512
        return this.layers.containsAll(clctn);
1500 1513
    }
1501 1514

  
1502
    public void add(int i, Object e) {
1515
    public void add(int i, FLayer e) {
1503 1516
        this.addLayer(i, (FLayer) e);
1504 1517
    }
1505 1518

  
1506
    public Object remove(int i) {
1519
    public FLayer remove(int i) {
1507 1520
        FLayer o = this.getLayer(i);
1508 1521
        this.removeLayer(i);
1509 1522
        return o;
......
1532 1545
    public boolean addAll(Collection clctn) {
1533 1546
        Iterator it = clctn.iterator();
1534 1547
        while( it.hasNext() ) {
1535
            this.add(it.next());
1548
            this.add((FLayer) it.next());
1536 1549
        }
1537 1550
        return true;
1538 1551
    }
......
1540 1553
    public boolean addAll(int i, Collection clctn) {
1541 1554
        Iterator it = clctn.iterator();
1542 1555
        while( it.hasNext() ) {
1543
            this.add(i,it.next());
1556
            this.add(i, (FLayer) it.next());
1544 1557
        }
1545 1558
        return true;
1546 1559
    }
......
1548 1561
    public boolean removeAll(Collection clctn) {
1549 1562
        Iterator it = clctn.iterator();
1550 1563
        while( it.hasNext() ) {
1551
            this.remove(it.next());
1564
            this.remove((FLayer) it.next());
1552 1565
        }
1553 1566
        return true;
1554 1567
    }
......
1558 1571
        while( it.hasNext() ) {
1559 1572
            Object o = it.next();
1560 1573
            if( !clctn.contains(o) ) {
1561
                this.remove(o);
1574
                this.remove((FLayer) o);
1562 1575
            }
1563 1576
        }
1564 1577
        return true;
1565 1578
    }
1566 1579

  
1567
    public Object set(int i, Object e) {
1580
    public FLayer set(int i, FLayer e) {
1568 1581
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1569 1582
    }
1570 1583

  
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/MapContext.java
105 105
 * @author Fernando Gonz?lez Cort?s
106 106
 */
107 107
public class MapContext extends AbstractDisposable implements Projected,
108
        Persistent, Observer {
108
        Persistent, Observer, Iterable<FLayer> {
109 109

  
110 110
    /**
111 111
     * <p>
......
1853 1853
        return false;
1854 1854
    }
1855 1855
    
1856
    public Iterator iterator() {
1856
    @Override
1857
    public Iterator<FLayer> iterator() {
1857 1858
        return this.layers.iterator();
1858 1859
    }
1859 1860

  

Also available in: Unified diff