svn-gvsig-desktop / trunk / libraries / libCq CMS for java.old / src / org / cresques / px / gml / MultiGeometry.java @ 2
History | View | Annotate | Download (1.19 KB)
1 |
package org.cresques.px.gml; |
---|---|
2 |
/*
|
3 |
* Created on 21-abr-2004
|
4 |
*/
|
5 |
|
6 |
import java.util.Vector; |
7 |
import java.util.Iterator; |
8 |
|
9 |
import java.awt.Graphics2D; |
10 |
|
11 |
import org.cresques.geo.Projection; |
12 |
import org.cresques.geo.ReProjection; |
13 |
import org.cresques.geo.ViewPort; |
14 |
import org.cresques.px.Extent; |
15 |
|
16 |
/**
|
17 |
* Clase base para geometrias m?ltiples.
|
18 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
19 |
*/
|
20 |
|
21 |
public class MultiGeometry extends Geometry { |
22 |
Vector data = null; |
23 |
public MultiGeometry() {
|
24 |
super();
|
25 |
data = new Vector(); |
26 |
} |
27 |
public void add(Geometry geometry) { |
28 |
extent.add(geometry.getExtent()); |
29 |
data.add(geometry); |
30 |
} |
31 |
|
32 |
public Projection getProjection() { return proj; } |
33 |
public void setProjection(Projection p) { proj = p; } |
34 |
public void reProject(ReProjection rp) { |
35 |
extent = new Extent();
|
36 |
Geometry geometry; |
37 |
Iterator iter = data.iterator();
|
38 |
while (iter.hasNext()) {
|
39 |
geometry = (Geometry) iter.next(); |
40 |
geometry.reProject(rp); |
41 |
extent.add(geometry.getExtent()); |
42 |
} |
43 |
setProjection(rp.getPDest()); |
44 |
} |
45 |
|
46 |
public void draw(Graphics2D g, ViewPort vp) { |
47 |
Geometry geometry; |
48 |
Iterator iter = data.iterator();
|
49 |
while (iter.hasNext()) {
|
50 |
geometry = (Geometry) iter.next(); |
51 |
geometry.draw(g, vp); |
52 |
} |
53 |
} |
54 |
} |
55 |
|