Statistics
| Revision:

root / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / px / gml / MultiGeometry.java @ 2249

History | View | Annotate | Download (2.52 KB)

1
/*
2
 * Created on 21-jun-2005
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
package org.cresques.px.gml;
48

    
49
import java.util.Vector;
50
import java.util.Iterator;
51

    
52
import java.awt.Graphics2D;
53

    
54
import org.cresques.cts.ICoordTrans;
55
import org.cresques.cts.IProjection;
56
import org.cresques.geo.ViewPortData;
57
import org.cresques.px.Extent;
58

    
59
/**
60
 * Clase base para geometrias m?ltiples.
61
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
62
 */
63

    
64
public class MultiGeometry extends Geometry {
65
        Vector data = null;
66
        public MultiGeometry() {
67
                super();
68
                data = new Vector();
69
        }
70
        public void add(Geometry geometry) {
71
                extent.add(geometry.getExtent());
72
                data.add(geometry);
73
        }
74
        
75
        public IProjection getProjection() { return proj; }
76
        public void setProjection(IProjection p) { proj = p; }
77
        public void reProject(ICoordTrans rp) {
78
                extent = new Extent();
79
                Geometry geometry;
80
                Iterator iter = data.iterator();
81
                while (iter.hasNext()) {
82
                        geometry = (Geometry) iter.next();
83
                        geometry.reProject(rp);
84
                        extent.add(geometry.getExtent());
85
                }
86
                setProjection(rp.getPDest());
87
        }
88
        
89
        public void draw(Graphics2D g, ViewPortData vp) {
90
                Geometry geometry;
91
                Iterator iter = data.iterator();
92
                while (iter.hasNext()) {
93
                        geometry = (Geometry) iter.next();
94
                        geometry.draw(g, vp);
95
                }
96
        }
97
}
98