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
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
2
 *
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
 *   Av. Blasco Ib��ez, 50
24
 *   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
package org.gvsig.fmap.geom.primitive.impl;
42

    
43
import java.awt.geom.Rectangle2D;
44

    
45
import org.cresques.cts.IProjection;
46
import org.gvsig.fmap.geom.GeometryLocator;
47
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
import org.gvsig.fmap.geom.type.GeometryType;
52

    
53
/**
54
 * Pol�gono 2D.
55
 *
56
 * @author Vicente Caballero Navarro
57
 */
58
public class Surface2D extends OrientableSurface2D implements Surface {
59
        private static final long serialVersionUID = -8448256617197415743L;
60

    
61

    
62
        private static GeometryType geomType = GeometryLocator.getGeometryManager()
63
                        .registerGeometryType(Surface2D.class, "Surface2D", TYPES.SURFACE, SUBTYPES.GEOM2D);
64

    
65
        /**
66
         * Constructor without arguments. It is necessary to create
67
         * geometries using the {@link GeometryType}{@link #create()}
68
         * method
69
         */
70
        public Surface2D() {
71
                super();
72
        }
73

    
74
        /**
75
         * Crea un nuevo Polygon2D.
76
         *
77
         * @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
        /*
89
         * (non-Javadoc)
90
         * @see org.gvsig.fmap.geom.Geometry#getShapeType()
91
         */
92
        public int getShapeType() {
93
                return TYPES.SURFACE;
94
        }
95

    
96
        /*
97
         * (non-Javadoc)
98
         * @see org.gvsig.fmap.geom.primitive.FShape#cloneFShape()
99
         */
100
        public FShape cloneFShape() {
101
                return new Surface2D(id, projection, (GeneralPathX) gp.clone());
102
        }
103

    
104
        /*
105
         * (non-Javadoc)
106
         * @see org.gvsig.fmap.geom.primitive.impl.OrientablePrimitive2D#intersects(java.awt.geom.Rectangle2D)
107
         */
108
        public boolean intersects(Rectangle2D r) {
109
                return gp.intersects(r);
110
        }
111

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

    
120
        /*
121
         * (non-Javadoc)
122
         * @see org.gvsig.fmap.geom.Geometry#getType()
123
         */
124
        public int getType() {
125
                return geomType.getType();
126
        }
127

    
128
        /*
129
         * (non-Javadoc)
130
         * 
131
         * @see org.gvsig.fmap.geom.Geometry#getGeneralPath()
132
         */
133
        public GeneralPathX getGeneralPath() {
134
                // TODO Auto-generated method stub
135
                return super.getGeneralPathX();
136
        }
137

    
138
        /*
139
         * (non-Javadoc)
140
         * @see org.gvsig.fmap.geom.primitive.Surface#setGeneralPath(org.gvsig.fmap.geom.primitive.GeneralPathX)
141
         */
142
        public void setGeneralPath(GeneralPathX generalPathX) {
143
                gp = generalPathX;
144
        }
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
                throw new UnsupportedOperationException("Use setGeneralPathX");
151
        }
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
                gp.lineTo(point.getX(), point.getY());
158
        }
159

    
160
        /* (non-Javadoc)
161
         * @see org.gvsig.fmap.geom.primitive.Surface#getNumVertex()
162
         */
163
        public int getNumVertices() {
164
                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
                throw new UnsupportedOperationException("Method not implemented");
172
        }
173

    
174
        /*
175
         * @see org.gvsig.fmap.geom.primitive.Curve#removeVertex(int)
176
         */
177
        public void removeVertex(int index) {
178
                throw new UnsupportedOperationException("Method not implemented");
179
        }
180

    
181
        /* (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

    
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
}