Statistics
| Revision:

root / trunk / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / Geometry.java @ 20861

History | View | Annotate | Download (5.62 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;
42

    
43

    
44
import java.awt.Shape;
45
import java.awt.geom.AffineTransform;
46
import java.awt.geom.PathIterator;
47
import java.awt.geom.Rectangle2D;
48
import java.io.Serializable;
49

    
50
import org.cresques.cts.ICoordTrans;
51
import org.gvsig.fmap.geom.handler.Handler;
52
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
53
import org.gvsig.fmap.geom.operation.GeometryOperationException;
54
import org.gvsig.fmap.geom.type.GeometryType;
55

    
56

    
57
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
58
*
59
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
60
*
61
* This program is free software; you can redistribute it and/or
62
* modify it under the terms of the GNU General Public License
63
* as published by the Free Software Foundation; either version 2
64
* of the License, or (at your option) any later version.
65
*
66
* This program is distributed in the hope that it will be useful,
67
* but WITHOUT ANY WARRANTY; without even the implied warranty of
68
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
69
* GNU General Public License for more details.
70
*
71
* You should have received a copy of the GNU General Public License
72
* along with this program; if not, write to the Free Software
73
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
74
*
75
* For more information, contact:
76
*
77
*  Generalitat Valenciana
78
*   Conselleria d'Infraestructures i Transport
79
*   Av. Blasco Ib��ez, 50
80
*   46010 VALENCIA
81
*   SPAIN
82
*
83
*      +34 963862235
84
*   gvsig@gva.es
85
*      www.gvsig.gva.es
86
*
87
*    or
88
*
89
*   IVER T.I. S.A
90
*   Salamanca 50
91
*   46005 Valencia
92
*   Spain
93
*
94
*   +34 963163400
95
*   dac@iver.es
96
*/
97

    
98
/**
99
 * Interfaz de Geometr�a.
100
 *
101
 * @author $author$
102
 */
103
public interface Geometry extends Shape, Serializable {
104
        public static int BEST = 0;
105
        public static int N = 1;
106
        public static int NE = 2;
107
        public static int E = 3;
108
        public static int SE = 4;
109
        public static int S = 5;
110
        public static int SW = 6;
111
        public static int W = 7;
112
        public static int NW = 8;
113

    
114
        public static int SELECTHANDLER=0;
115
        public static int STRETCHINGHANDLER=1;
116
        
117
        /**
118
         * Transforma esta Shape en un Geometry de JTS
119
         *
120
         * @return Geometr�a.
121
         */
122
        public com.vividsolutions.jts.geom.Geometry toJTSGeometry();
123

    
124
        /**
125
         * Obtiene el tipo de la geometr�a
126
         *
127
         * @return una de las constantes de FShape: POINT, LINE, POLIGON
128
         * @deprecated
129
         */
130
        public int getShapeType();
131

    
132
        /**
133
         * Clona la Geometr�a.
134
         *
135
         * @return Geometr�a clonada.
136
         */
137
        public Geometry cloneGeometry();
138

    
139
        /**
140
         * Devuelve true si la geometr�a intersecta con el rect�ngulo que se pasa
141
         * como par�metro.
142
         *
143
         * @param r Rect�ngulo.
144
         *
145
         * @return True, si intersecta.
146
         */
147
        public boolean intersects(Rectangle2D r);
148
        /**
149
         * Devuelve true si la geometr�a contiene al rect�ngulo que se pasa
150
         * como par�metro.
151
         *
152
         * @param r Rect�ngulo.
153
         *
154
         * @return True, si intersecta.
155
         */
156
        //boolean contains(IGeometry g);
157

    
158
        /**
159
         * Se usa en las strategies de dibujo para comprobar de manera r�pida
160
         * si intersecta con el rect�ngulo visible
161
         * @param x
162
         * @param y
163
         * @param w
164
         * @param h
165
         * @return
166
         */
167
        public boolean fastIntersects(double x, double y, double w, double h);
168

    
169
        /**
170
         * Devuelve el Rect�ngulo que ocupa la geometr�a.
171
         *
172
         * @return Rect�ngulo.
173
         */
174
        public Rectangle2D getBounds2D();
175

    
176
        /**
177
         * Reproyecta la geometr�a a partir del transformador de coordenadas.
178
         *
179
         * @param ct Coordinate Transformer.
180
         */
181
        public void reProject(ICoordTrans ct);
182

    
183
        /**
184
         * Devuelve el GeneralPathXIterator con la informaci�n relativa a la geometr�a.
185
         * @param at TODO
186
         *
187
         * @return PathIterator.
188
         */
189
        public PathIterator getPathIterator(AffineTransform at);
190

    
191
    //public byte[] toWKB() throws IOException;
192
    /**
193
         * It returns the handlers of the geomety,
194
         * these they can be of two types is straightening and of seleccion.
195
         *
196
         * @param type Type of handlers
197
         *
198
         * @return Handlers.
199
         */
200
        public Handler[] getHandlers(int type);
201

    
202
        public void transform(AffineTransform at);
203

    
204
        PathIterator getPathIterator(AffineTransform at, double flatness);
205

    
206
        /**
207
         * Useful to have the real shape behind the scenes.
208
         * May be uses to edit it knowing it it is a Circle, Ellipse, etc
209
         * @return
210
         */
211
        public Shape getInternalShape();
212
        
213
        public int getCoordinateDimension();
214
        
215
        public boolean isSimple();
216

    
217
        /**
218
         * @param index
219
         * @return
220
         */
221
        public Object invokeOperation(int index, GeometryOperationContext ctx) throws GeometryOperationException;
222
        
223
        public GeometryType getGeometryType();
224
        
225
}