gvsig-raster / org.gvsig.raster.georeferencing / trunk / org.gvsig.raster.georeferencing / org.gvsig.raster.georeferencing.swing / org.gvsig.raster.georeferencing.swing.impl / src / main / java / org / gvsig / raster / georeferencing / swing / impl / option / GCPListImpl.java @ 1725
History | View | Annotate | Download (1.63 KB)
1 |
package org.gvsig.raster.georeferencing.swing.impl.option; |
---|---|
2 |
|
3 |
import java.util.ArrayList; |
4 |
import java.util.List; |
5 |
|
6 |
import org.gvsig.fmap.dal.coverage.datastruct.GeoPoint; |
7 |
import org.gvsig.fmap.dal.coverage.datastruct.GeoPointList; |
8 |
import org.gvsig.raster.georeferencing.swing.GCPList; |
9 |
import org.gvsig.raster.georeferencing.swing.impl.layer.GPGraphic; |
10 |
|
11 |
/**
|
12 |
* @author Nacho Brodin nachobrodin@gmail.com
|
13 |
*/
|
14 |
public class GCPListImpl implements GCPList { |
15 |
private List<GPGraphic> pList = new ArrayList<GPGraphic>(); |
16 |
|
17 |
class GeoPointListImpl extends ArrayList<GeoPoint> implements GeoPointList { |
18 |
private static final long serialVersionUID = 1L; |
19 |
} |
20 |
|
21 |
public void buildNewList(GeoPointList geoPointList) { |
22 |
long id = System.currentTimeMillis(); |
23 |
if(geoPointList != null) { |
24 |
pList.clear(); |
25 |
for (int i = 0; i < geoPointList.size(); i++) { |
26 |
GPGraphic graphicGCP = new GPGraphic(geoPointList.get(i));
|
27 |
graphicGCP.setId(id); |
28 |
geoPointList.get(i).setNumber(i); |
29 |
pList.add(graphicGCP); |
30 |
id += 1;
|
31 |
} |
32 |
} |
33 |
} |
34 |
|
35 |
public GeoPoint getGeoPoint(int i) { |
36 |
return pList.get(i).getGeoPoint();
|
37 |
} |
38 |
|
39 |
public GeoPointList getGeoPointList() {
|
40 |
GeoPointList geoPointList = new GeoPointListImpl();
|
41 |
for (int i = 0; i < pList.size(); i++) { |
42 |
geoPointList.add(pList.get(i).getGeoPoint()); |
43 |
} |
44 |
return geoPointList;
|
45 |
} |
46 |
|
47 |
public Object getGraphicPoint(int i) { |
48 |
return pList.get(i);
|
49 |
} |
50 |
|
51 |
public int size() { |
52 |
return pList.size();
|
53 |
} |
54 |
|
55 |
public void add(Object graphicPoint) { |
56 |
pList.add((GPGraphic)graphicPoint); |
57 |
} |
58 |
|
59 |
public void remove(int i) { |
60 |
pList.remove(i); |
61 |
} |
62 |
|
63 |
public void removeAll() { |
64 |
for (int i = pList.size() - 1; i >= 0; i--) { |
65 |
pList.remove(i); |
66 |
} |
67 |
} |
68 |
} |