Statistics
| Revision:

root / trunk / libraries / libCq_CMS_praster / src / org / cresques / px / gml / MultiGeometry.java @ 8026

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.cresques.px.gml;
25

    
26
import org.cresques.cts.ICoordTrans;
27
import org.cresques.cts.IProjection;
28

    
29
import org.cresques.geo.ViewPortData;
30

    
31
import org.cresques.px.Extent;
32

    
33
import java.awt.Graphics2D;
34

    
35
import java.util.Iterator;
36
import java.util.Vector;
37

    
38

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

    
46
    public MultiGeometry() {
47
        super();
48
        data = new Vector();
49
    }
50

    
51
    public void add(Geometry geometry) {
52
        extent.add(geometry.getExtent());
53
        data.add(geometry);
54
    }
55

    
56
    public IProjection getProjection() {
57
        return proj;
58
    }
59

    
60
    public void setProjection(IProjection p) {
61
        proj = p;
62
    }
63

    
64
    public void reProject(ICoordTrans rp) {
65
        extent = new Extent();
66

    
67
        Geometry geometry;
68
        Iterator iter = data.iterator();
69

    
70
        while (iter.hasNext()) {
71
            geometry = (Geometry) iter.next();
72
            geometry.reProject(rp);
73
            extent.add(geometry.getExtent());
74
        }
75

    
76
        setProjection(rp.getPDest());
77
    }
78

    
79
    public void draw(Graphics2D g, ViewPortData vp) {
80
        Geometry geometry;
81
        Iterator iter = data.iterator();
82

    
83
        while (iter.hasNext()) {
84
            geometry = (Geometry) iter.next();
85
            geometry.draw(g, vp);
86
        }
87
    }
88
}