Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / IGeometry.java @ 18621

History | View | Annotate | Download (6.15 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 com.iver.cit.gvsig.fmap.core;
42

    
43
import java.awt.Graphics2D;
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.IOException;
49
import java.io.Serializable;
50

    
51
import org.cresques.cts.ICoordTrans;
52

    
53
import com.iver.cit.gvsig.fmap.ViewPort;
54
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
55
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
56
import com.iver.cit.gvsig.fmap.rendering.FStyledShapePainter;
57
import com.iver.utiles.swing.threads.Cancellable;
58
import com.vividsolutions.jts.geom.Geometry;
59

    
60

    
61
/**
62
 * Interfaz de Geometr?a.
63
 *
64
 * @author $author$
65
 */
66
public interface IGeometry extends Shape, Serializable {
67
        public static int BEST = 0;
68
        public static int N = 1;
69
        public static int NE = 2;
70
        public static int E = 3;
71
        public static int SE = 4;
72
        public static int S = 5;
73
        public static int SW = 6;
74
        public static int W = 7;
75
        public static int NW = 8;
76

    
77
        public static int SELECTHANDLER=0;
78
        public static int STRETCHINGHANDLER=1;
79
        public final static FStyledShapePainter shpPainter = new FStyledShapePainter();
80

    
81
        /**
82
         * Dibujar? esta Shape en el Graphics con el s?mbolo que se pasa como
83
         * par?metro y despues de aplicarle la transformaci?n que se pasa tambi?n
84
         * como par?metro. El parametro image que recibe es la imagen de la cual
85
         * se obtuvo el graphics que tambi?n se pasa como par?metro. Dibujar? la
86
         * geometria en caso de que la IGeometry intersecte o est? contenida en el
87
         * rect?ngulo que se pasa como par?metro
88
         *
89
         * @param g DOCUMENT ME!
90
         * @param vp TODO
91
         * @param symbol DOCUMENT ME!
92
         */
93
        void draw(Graphics2D g, ViewPort vp, ISymbol symbol);
94

    
95
        /**
96
         * Dibuja la geometr?a sobre el Graphics2D que se pasa como par?metro.
97
         *
98
         * @param g Graphics2D.
99
         * @param vp ViewPort.
100
         * @param symbol S?mbolo.
101
         * @param cancel TODO
102
         */
103
        void draw(Graphics2D g, ViewPort vp, ISymbol symbol, Cancellable cancel);
104

    
105
    /**
106
     * You can use this function if you are going to draw into
107
     * a bitmap. (With ints coords). It will do a decimation,
108
     * drawing a shape with less coords (faster draw)
109
     * @param g
110
     * @param vp
111
     * @param symbol
112
     * @param cancel TODO
113
     */
114
    void drawInts(Graphics2D g, ViewPort vp, ISymbol symbol, Cancellable cancel);
115
    
116
    
117
    void drawInts(Graphics2D g, ViewPort vp, ISymbol symbol);
118
        /**
119
         * Transforma esta Shape en un Geometry de JTS
120
         *
121
         * @return Geometr?a.
122
         */
123
        Geometry toJTSGeometry();
124

    
125
        /**
126
         * Obtiene las posiciones donde se debe situar la etiqueta para esta
127
         * IGeometry. Es un array porque si una geometria es un multipunto por
128
         * ejemplo puede quererse etiquetar todos sus puntos. El par?metro que se
129
         * pasa indica como debe de colocar la geometria la etiqueta
130
         *
131
         * @param position TODO: POR AHORA NO SE HACE CASO A ESTO
132
         * @param duplicates TODO: POR AHORA NO SE HACE CASO A ESTO
133
         *
134
         * @return DOCUMENT ME!
135
         */
136
        FLabel[] createLabels(int position, boolean duplicates);
137

    
138
        /**
139
         * Obtiene el tipo de la geometr?a
140
         *
141
         * @return una de las constantes de FShape: POINT, LINE, POLIGON
142
         */
143
        int getGeometryType();
144

    
145
        /**
146
         * Clona la Geometr?a.
147
         *
148
         * @return Geometr?a clonada.
149
         */
150
        IGeometry cloneGeometry();
151

    
152
        /**
153
         * Devuelve true si la geometr?a intersecta con el rect?ngulo que se pasa
154
         * como par?metro.
155
         *
156
         * @param r Rect?ngulo.
157
         *
158
         * @return True, si intersecta.
159
         */
160
        boolean intersects(Rectangle2D r);
161
        /**
162
         * Devuelve true si la geometr?a contiene al rect?ngulo que se pasa
163
         * como par?metro.
164
         *
165
         * @param r Rect?ngulo.
166
         *
167
         * @return True, si intersecta.
168
         */
169
        //boolean contains(IGeometry g);
170

    
171
        /**
172
         * Se usa en las strategies de dibujo para comprobar de manera r?pida
173
         * si intersecta con el rect?ngulo visible
174
         * @param x
175
         * @param y
176
         * @param w
177
         * @param h
178
         * @return
179
         */
180
        public boolean fastIntersects(double x, double y, double w, double h);
181

    
182
        /**
183
         * Devuelve el Rect?ngulo que ocupa la geometr?a.
184
         *
185
         * @return Rect?ngulo.
186
         */
187
        Rectangle2D getBounds2D();
188

    
189
        /**
190
         * Reproyecta la geometr?a a partir del transformador de coordenadas.
191
         *
192
         * @param ct Coordinate Transformer.
193
         */
194
        void reProject(ICoordTrans ct);
195

    
196
        /**
197
         * Devuelve el GeneralPathXIterator con la informaci?n relativa a la geometr?a.
198
         * @param at TODO
199
         *
200
         * @return PathIterator.
201
         */
202
        PathIterator getPathIterator(AffineTransform at);
203

    
204
    public byte[] toWKB() throws IOException;
205
    /**
206
         * It returns the handlers of the geomety,
207
         * these they can be of two types is straightening and of seleccion.
208
         *
209
         * @param type Type of handlers
210
         *
211
         * @return Handlers.
212
         */
213
        public Handler[] getHandlers(int type);
214

    
215
        public void transform(AffineTransform at);
216

    
217
        PathIterator getPathIterator(AffineTransform at, double flatness);
218

    
219
        /**
220
         * Useful to have the real shape behind the scenes.
221
         * May be uses to edit it knowing it it is a Circle, Ellipse, etc
222
         * @return
223
         */
224
        Shape getInternalShape();
225

    
226
        void drawInts(Graphics2D graphics2D, ViewPort viewPort, double dpi, CartographicSupport cartographicSymbol, Cancellable cancel);
227

    
228
        //boolean intersects(IGeometry geom);
229
}