Revision 47439
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 | ||
---|---|---|
35 | 35 |
import java.util.List; |
36 | 36 |
import java.util.Map; |
37 | 37 |
import java.util.Set; |
38 |
import java.util.function.Predicate; |
|
38 | 39 |
import org.apache.commons.lang3.ArrayUtils; |
39 | 40 |
|
40 | 41 |
import org.cresques.cts.ICoordTrans; |
... | ... | |
496 | 497 |
* Color used to represent the selections.</p> |
497 | 498 |
*/ |
498 | 499 |
private static Color selectionColor = new Color(Color.YELLOW.getRed(), Color.YELLOW.getGreen(), Color.YELLOW.getBlue(), 127); |
499 |
private Set<FLyrVect> layersToSnap = new HashSet<>();
|
|
500 |
private Set<FLyrVect> layersToSnap = new LayersToSnap();
|
|
500 | 501 |
|
501 | 502 |
/** |
502 | 503 |
* <p> |
... | ... | |
1569 | 1570 |
return layersToSnap; |
1570 | 1571 |
} |
1571 | 1572 |
|
1572 |
public void setLayersToSnap(Set<FLyrVect> layersToSnap) { |
|
1573 |
this.layersToSnap = layersToSnap; |
|
1573 |
/** |
|
1574 |
* Adds the layers to the current "layersToSnap" without |
|
1575 |
* replacing the current instance of "layersToSnap" |
|
1576 |
* |
|
1577 |
* @param layers |
|
1578 |
*/ |
|
1579 |
public void setLayersToSnap(Set<FLyrVect> layers) { |
|
1580 |
this.layersToSnap.removeIf((FLyrVect t) -> !layers.contains(t)); |
|
1581 |
this.layersToSnap.addAll(layers); |
|
1574 | 1582 |
|
1575 | 1583 |
} |
1576 | 1584 |
|
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/LayersToSnap.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.fmap.mapcontext; |
|
7 |
|
|
8 |
import java.util.Collection; |
|
9 |
import java.util.HashSet; |
|
10 |
import java.util.function.Predicate; |
|
11 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
12 |
|
|
13 |
/** |
|
14 |
* |
|
15 |
* @author fdiaz |
|
16 |
*/ |
|
17 |
public class LayersToSnap extends HashSet<FLyrVect> { |
|
18 |
|
|
19 |
public LayersToSnap() { |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public boolean add(FLyrVect e) { |
|
24 |
return super.add(e); //To change body of generated methods, choose Tools | Templates. |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public boolean addAll(Collection<? extends FLyrVect> c) { |
|
29 |
return super.addAll(c); //To change body of generated methods, choose Tools | Templates. |
|
30 |
} |
|
31 |
|
|
32 |
@Override |
|
33 |
public void clear() { |
|
34 |
super.clear(); //To change body of generated methods, choose Tools | Templates. |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public boolean remove(Object o) { |
|
39 |
return super.remove(o); //To change body of generated methods, choose Tools | Templates. |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public boolean removeAll(Collection<?> c) { |
|
44 |
return super.removeAll(c); //To change body of generated methods, choose Tools | Templates. |
|
45 |
} |
|
46 |
|
|
47 |
} |
Also available in: Unified diff