Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / primitive / impl / Surface2D.java @ 29018

History | View | Annotate | Download (6.67 KB)

1 29018 jtorres
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
2 20761 jmvivo
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23 29018 jtorres
 *   Av. Blasco Ib��ez, 50
24 20761 jmvivo
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41 27029 jpiera
package org.gvsig.fmap.geom.primitive.impl;
42 20761 jmvivo
43
import java.awt.geom.Rectangle2D;
44
45 21870 vcaballero
import org.cresques.cts.IProjection;
46 26328 jpiera
import org.gvsig.fmap.geom.GeometryLocator;
47 27029 jpiera
import org.gvsig.fmap.geom.primitive.FShape;
48
import org.gvsig.fmap.geom.primitive.GeneralPathX;
49
import org.gvsig.fmap.geom.primitive.Point;
50
import org.gvsig.fmap.geom.primitive.Surface;
51 20761 jmvivo
import org.gvsig.fmap.geom.type.GeometryType;
52
53
/**
54
 * Pol�gono 2D.
55 21731 vcaballero
 *
56 20761 jmvivo
 * @author Vicente Caballero Navarro
57
 */
58 20861 jiyarza
public class Surface2D extends OrientableSurface2D implements Surface {
59 27049 jpiera
        private static final long serialVersionUID = -8448256617197415743L;
60 20761 jmvivo
61 21731 vcaballero
62 26328 jpiera
        private static GeometryType geomType = GeometryLocator.getGeometryManager()
63 28089 vcaballero
                        .registerGeometryType(Surface2D.class, "Surface2D", TYPES.SURFACE, SUBTYPES.GEOM2D);
64
65 20761 jmvivo
        /**
66 26788 jpiera
         * Constructor without arguments. It is necessary to create
67
         * geometries using the {@link GeometryType}{@link #create()}
68
         * method
69
         */
70
        public Surface2D() {
71 28089 vcaballero
                super();
72 26788 jpiera
        }
73 28089 vcaballero
74 26788 jpiera
        /**
75 20761 jmvivo
         * Crea un nuevo Polygon2D.
76 21731 vcaballero
         *
77 20761 jmvivo
         * @param gpx
78
         *            GeneralPathX.
79
         */
80
        public Surface2D(String id, IProjection projection, GeneralPathX gpx) {
81
                super(id, projection, gpx);
82
        }
83
84
        public Surface2D(GeneralPathX gpx) {
85
                this(null, null, gpx);
86
        }
87
88 27049 jpiera
        /*
89
         * (non-Javadoc)
90
         * @see org.gvsig.fmap.geom.Geometry#getShapeType()
91 20761 jmvivo
         */
92
        public int getShapeType() {
93 28996 jpiera
                return TYPES.SURFACE;
94 20761 jmvivo
        }
95
96 27049 jpiera
        /*
97
         * (non-Javadoc)
98
         * @see org.gvsig.fmap.geom.primitive.FShape#cloneFShape()
99 20761 jmvivo
         */
100
        public FShape cloneFShape() {
101
                return new Surface2D(id, projection, (GeneralPathX) gp.clone());
102
        }
103
104
        /*
105
         * (non-Javadoc)
106 27049 jpiera
         * @see org.gvsig.fmap.geom.primitive.impl.OrientablePrimitive2D#intersects(java.awt.geom.Rectangle2D)
107 20761 jmvivo
         */
108
        public boolean intersects(Rectangle2D r) {
109
                return gp.intersects(r);
110
        }
111 21731 vcaballero
112 27049 jpiera
        /*
113
         * (non-Javadoc)
114
         * @see org.gvsig.fmap.geom.Geometry#getGeometryType()
115
         */
116 20761 jmvivo
        public GeometryType getGeometryType() {
117
                return geomType;
118
        }
119 21731 vcaballero
120 27049 jpiera
        /*
121
         * (non-Javadoc)
122
         * @see org.gvsig.fmap.geom.Geometry#getType()
123
         */
124 20918 jiyarza
        public int getType() {
125 26788 jpiera
                return geomType.getType();
126 21382 csanchez
        }
127
128 27049 jpiera
        /*
129
         * (non-Javadoc)
130 28626 jmvivo
         *
131 27049 jpiera
         * @see org.gvsig.fmap.geom.Geometry#getGeneralPath()
132
         */
133 21382 csanchez
        public GeneralPathX getGeneralPath() {
134
                // TODO Auto-generated method stub
135 28626 jmvivo
                return super.getGeneralPathX();
136 21731 vcaballero
        }
137 26788 jpiera
138 27049 jpiera
        /*
139
         * (non-Javadoc)
140 26788 jpiera
         * @see org.gvsig.fmap.geom.primitive.Surface#setGeneralPath(org.gvsig.fmap.geom.primitive.GeneralPathX)
141
         */
142
        public void setGeneralPath(GeneralPathX generalPathX) {
143 28089 vcaballero
                gp = generalPathX;
144 26788 jpiera
        }
145
146
        /* (non-Javadoc)
147
         * @see org.gvsig.fmap.geom.primitive.Surface#setCoordinateAt(int, int, double)
148
         */
149
        public void setCoordinateAt(int index, int dimension, double value) {
150 28089 vcaballero
                throw new UnsupportedOperationException("Use setGeneralPathX");
151 26788 jpiera
        }
152
153
        /* (non-Javadoc)
154
         * @see org.gvsig.fmap.geom.primitive.Surface#addVertex(org.gvsig.fmap.geom.primitive.Point)
155
         */
156
        public void addVertex(Point point) {
157 28089 vcaballero
                gp.lineTo(point.getX(), point.getY());
158 26788 jpiera
        }
159 27032 jpiera
160
        /* (non-Javadoc)
161
         * @see org.gvsig.fmap.geom.primitive.Surface#getNumVertex()
162
         */
163 28341 jpiera
        public int getNumVertices() {
164 27032 jpiera
                throw new UnsupportedOperationException("Method not implemented");
165
        }
166
167
        /* (non-Javadoc)
168
         * @see org.gvsig.fmap.geom.primitive.Surface#insertVertex(int, org.gvsig.fmap.geom.primitive.Point)
169
         */
170
        public void insertVertex(int index, Point p) {
171 28089 vcaballero
                throw new UnsupportedOperationException("Method not implemented");
172 27032 jpiera
        }
173 28089 vcaballero
174 27032 jpiera
        /*
175
         * @see org.gvsig.fmap.geom.primitive.Curve#removeVertex(int)
176
         */
177
        public void removeVertex(int index) {
178 28089 vcaballero
                throw new UnsupportedOperationException("Method not implemented");
179 27032 jpiera
        }
180 28089 vcaballero
181 27032 jpiera
        /* (non-Javadoc)
182
         * @see org.gvsig.fmap.geom.primitive.Curve#getVertex(int)
183
         */
184
        public Point getVertex(int index) {
185
                throw new UnsupportedOperationException("Method not implemented");
186
        }
187 29018 jtorres
188
        public void addColor(Point p) {
189
                throw new UnsupportedOperationException("Method not implemented");
190
191
        }
192
193
        public void addNormal(Point p) {
194
                throw new UnsupportedOperationException("Method not implemented");
195
196
        }
197
198
        public void addTextureCoord(int index, Point p) {
199
                throw new UnsupportedOperationException("Method not implemented");
200
201
        }
202
203
        public Point getColorAt(int index) {
204
                throw new UnsupportedOperationException("Method not implemented");
205
206
        }
207
208
        public AttributeBinding getColorBinding() {
209
                throw new UnsupportedOperationException("Method not implemented");
210
211
        }
212
213
        public Point getNormalAt(int index) {
214
                throw new UnsupportedOperationException("Method not implemented");
215
216
        }
217
218
        public AttributeBinding getNormalBinding() {
219
                throw new UnsupportedOperationException("Method not implemented");
220
221
        }
222
223
        public int getNumColors() {
224
                throw new UnsupportedOperationException("Method not implemented");
225
226
        }
227
228
        public int getNumNormals() {
229
                throw new UnsupportedOperationException("Method not implemented");
230
231
        }
232
233
        public int getNumTextureCoords() {
234
                throw new UnsupportedOperationException("Method not implemented");
235
236
        }
237
238
        public Point getTextureCoordAt(int index) {
239
                throw new UnsupportedOperationException("Method not implemented");
240
241
        }
242
243
        public void setColorAt(int index, Point p) {
244
                throw new UnsupportedOperationException("Method not implemented");
245
246
        }
247
248
        public void setColorBinding(AttributeBinding binding) {
249
                throw new UnsupportedOperationException("Method not implemented");
250
251
        }
252
253
        public void setNormalAt(int index, Point p) {
254
                throw new UnsupportedOperationException("Method not implemented");
255
256
        }
257
258
        public void setNormalBinding(AttributeBinding binding) {
259
                throw new UnsupportedOperationException("Method not implemented");
260
261
        }
262
263
        public void setTextureCoordAt(int index, Point p) {
264
                throw new UnsupportedOperationException("Method not implemented");
265
266
        }
267 20761 jmvivo
}