Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / aggregate / impl / MultiSurface2D.java @ 28996

History | View | Annotate | Download (3.7 KB)

1
package org.gvsig.fmap.geom.aggregate.impl;
2

    
3
import org.cresques.cts.IProjection;
4
import org.gvsig.fmap.geom.Geometry;
5
import org.gvsig.fmap.geom.GeometryLocator;
6
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
7
import org.gvsig.fmap.geom.aggregate.MultiSurface;
8
import org.gvsig.fmap.geom.primitive.FShape;
9
import org.gvsig.fmap.geom.primitive.Surface;
10
import org.gvsig.fmap.geom.primitive.impl.Surface2D;
11
import org.gvsig.fmap.geom.type.GeometryType;
12

    
13
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
14
 *
15
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
16
 *
17
 * This program is free software; you can redistribute it and/or
18
 * modify it under the terms of the GNU General Public License
19
 * as published by the Free Software Foundation; either version 2
20
 * of the License, or (at your option) any later version.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
30
 *
31
 * For more information, contact:
32
 *
33
 *  Generalitat Valenciana
34
 *   Conselleria d'Infraestructures i Transport
35
 *   Av. Blasco Ib??ez, 50
36
 *   46010 VALENCIA
37
 *   SPAIN
38
 *
39
 *      +34 963862235
40
 *   gvsig@gva.es
41
 *      www.gvsig.gva.es
42
 *
43
 *    or
44
 *
45
 *   IVER T.I. S.A
46
 *   Salamanca 50
47
 *   46005 Valencia
48
 *   Spain
49
 *
50
 *   +34 963163400
51
 *   dac@iver.es
52
 */
53
/* CVS MESSAGES:
54
 *
55
 * $Id: FMultiPolygon2D.java,v 1.2 2008/03/25 08:47:41 cvs Exp $
56
 * $Log: FMultiPolygon2D.java,v $
57
 * Revision 1.2  2008/03/25 08:47:41  cvs
58
 * Visitors removed
59
 *
60
 * Revision 1.1  2008/03/12 08:46:20  cvs
61
 * *** empty log message ***
62
 *
63
 *
64
 */
65
/**
66
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
67
 */
68
public class MultiSurface2D extends BaseMultiPrimitive implements MultiSurface {
69

    
70
        private static final long serialVersionUID = 1L;
71

    
72
        private static GeometryType geomType = GeometryLocator.getGeometryManager()
73
                        .registerGeometryType(MultiSurface2D.class, null, TYPES.MULTISURFACE, SUBTYPES.GEOM2D);
74
        public static int CODE = geomType.getId();
75

    
76
        /**
77
         * Constructor without arguments. It is necessary to create
78
         * geometries using the {@link GeometryType}{@link #create()}
79
         * method
80
         */
81
        public MultiSurface2D() {
82
                super();                
83
        }
84
        
85
        public MultiSurface2D(String id, IProjection projection) {
86
                super(id, projection);
87
        }
88

    
89
        public MultiSurface2D(String id, IProjection projection,
90
                        Surface2D[] polygons) {
91
                super(id, projection, polygons);
92
        }
93

    
94
        /*
95
         * (non-Javadoc)
96
         * 
97
         * @see com.iver.cit.gvsig.fmap.core.FGeometryCollection#cloneGeometry()
98
         */
99
        public Geometry cloneGeometry() {
100
                MultiSurface2D auxSurface = new MultiSurface2D(id, projection);
101
                for (int i = 0; i < getPrimitivesNumber(); i++) {
102
                        auxSurface.addSurface((Surface)((Surface) geometries.get(i)).cloneGeometry());
103
                }
104
                return auxSurface;
105
        }
106

    
107
        /* (non-Javadoc)
108
         * @see org.gvsig.fmap.geom.primitive.AbstractPrimitive#getGeometryType()
109
         */
110
        public GeometryType getGeometryType() {
111
                return geomType;
112
        }
113

    
114
        /* (non-Javadoc)
115
         * @see org.gvsig.fmap.geom.Geometry#getType()
116
         */
117
        public int getType() {
118
                return geomType.getType();
119
        }
120

    
121
        /* (non-Javadoc)
122
         * @see org.gvsig.fmap.geom.aggregate.MultiSurface#addSurface(org.gvsig.fmap.geom.primitive.Surface)
123
         */
124
        public void addSurface(Surface surface) {
125
                addPrimitive(surface);                
126
        }
127

    
128
        /* (non-Javadoc)
129
         * @see org.gvsig.fmap.geom.aggregate.MultiSurface#getSurfaceAt(int)
130
         */
131
        public Surface getSurfaceAt(int index) {
132
                return (Surface)getPrimitiveAt(index);
133
        }
134

    
135
}