Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libDXF / src / org / gvsig / dxf / px / gml / MultiGeometry.java @ 29630

History | View | Annotate | Download (2.23 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.gvsig.dxf.px.gml;
25

    
26
import java.awt.Graphics2D;
27
import java.util.Iterator;
28
import java.util.Vector;
29

    
30
import org.cresques.cts.ICoordTrans;
31
import org.cresques.cts.IProjection;
32
import org.cresques.geo.ViewPortData;
33
import org.cresques.px.Extent;
34

    
35

    
36
/**
37
 * Clase base para geometrias m?ltiples.
38
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
39
 */
40
public class MultiGeometry extends Geometry {
41
    Vector data = null;
42

    
43
    public MultiGeometry() {
44
        super();
45
        data = new Vector();
46
    }
47

    
48
    public void add(Geometry geometry) {
49
        extent.add(geometry.getExtent());
50
        data.add(geometry);
51
    }
52

    
53
    public IProjection getProjection() {
54
        return proj;
55
    }
56

    
57
    public void setProjection(IProjection p) {
58
        proj = p;
59
    }
60

    
61
    public void reProject(ICoordTrans rp) {
62
        extent = new Extent();
63

    
64
        Geometry geometry;
65
        Iterator iter = data.iterator();
66

    
67
        while (iter.hasNext()) {
68
            geometry = (Geometry) iter.next();
69
            geometry.reProject(rp);
70
            extent.add(geometry.getExtent());
71
        }
72

    
73
        setProjection(rp.getPDest());
74
    }
75

    
76
    public void draw(Graphics2D g, ViewPortData vp) {
77
        Geometry geometry;
78
        Iterator iter = data.iterator();
79

    
80
        while (iter.hasNext()) {
81
            geometry = (Geometry) iter.next();
82
            geometry.draw(g, vp);
83
        }
84
    }
85
}