Statistics
| Revision:

root / branches / FMap_piloto_CAD_Layout_version / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / IGeometry.java @ 1762

History | View | Annotate | Download (5.48 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 com.iver.cit.gvsig.fmap.ViewPort;
44
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
45
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
46
import com.iver.cit.gvsig.fmap.rendering.FStyledShapePainter;
47
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
48

    
49
import com.vividsolutions.jts.geom.Geometry;
50

    
51
import org.cresques.cts.ICoordTrans;
52

    
53
import java.awt.Graphics2D;
54
import java.awt.geom.AffineTransform;
55
import java.awt.geom.Point2D;
56
import java.awt.geom.Rectangle2D;
57

    
58

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

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

    
90
        /**
91
         * Dibuja la geometr?a sobre el Graphics2D que se pasa como par?metro.
92
         *
93
         * @param g Graphics2D.
94
         * @param vp ViewPort.
95
         * @param symbol S?mbolo.
96
         */
97
        void draw(Graphics2D g, ViewPort vp, FSymbol symbol);
98
        void draw(Graphics2D g, AffineTransform at, FSymbol symbol);
99
        /**
100
         * Transforma esta Shape en un Geometry de JTS
101
         *
102
         * @return Geometr?a.
103
         */
104
        Geometry toJTSGeometry();
105

    
106
        /**
107
         * Obtiene las posiciones donde se debe situar la etiqueta para esta
108
         * IGeometry. Es un array porque si una geometria es un multipunto por
109
         * ejemplo puede quererse etiquetar todos sus puntos. El par?metro que se
110
         * pasa indica como debe de colocar la geometria la etiqueta
111
         *
112
         * @param position DOCUMENT ME!
113
         * @param duplicates DOCUMENT ME!
114
         *
115
         * @return DOCUMENT ME!
116
         */
117
        FLabel[] createLabels(int position, boolean duplicates);
118

    
119
        /**
120
         * Obtiene el tipo de la geometr?a
121
         *
122
         * @return una de las constantes de FShape: POINT, LINE, POLIGON
123
         */
124
        int getGeometryType();
125

    
126
        /**
127
         * Clona la Geometr?a.
128
         *
129
         * @return Geometr?a clonada.
130
         */
131
        IGeometry cloneGeometry();
132

    
133
        /**
134
         * Devuelve true si la geometr?a intersecta con el rect?ngulo que se pasa
135
         * como par?metro.
136
         *
137
         * @param r Rect?ngulo.
138
         *
139
         * @return True, si intersecta.
140
         */
141
        boolean intersects(Rectangle2D r);
142

    
143
        /**
144
         * Se usa en las strategies de dibujo para comprobar de manera r?pida si
145
         * intersecta con el rect?ngulo visible
146
         *
147
         * @param x
148
         * @param y
149
         * @param w
150
         * @param h
151
         *
152
         * @return
153
         */
154
        public boolean fastIntersects(double x, double y, double w, double h);
155

    
156
        /**
157
         * Devuelve el Rect?ngulo que ocupa la geometr?a.
158
         *
159
         * @return Rect?ngulo.
160
         */
161
        Rectangle2D getBounds2D();
162

    
163
        /**
164
         * Reproyecta la geometr?a a partir de las coordenadas de transformaci?n.
165
         *
166
         * @param ct Coordenadas de transformaci?n.
167
         */
168
        void reProject(ICoordTrans ct);
169

    
170
        /**
171
         * Devuelve el GeneralPathXIterator con la informaci?n relativa a la
172
         * geometr?a.
173
         *
174
         * @return GeneralPathXIterator.
175
         */
176
        GeneralPathXIterator getGeneralPathXIterator();
177

    
178
        /**
179
         * Mueve la geometr?a x unidades en el eje X, e y unidades en el eje Y.
180
         *
181
         * @param x desplazamiento x.
182
         * @param y desplazamineto y.
183
         */
184
        void move(double x, double y);
185

    
186
        /**
187
         * Gira la geometr?a.
188
         *
189
         * @param r ?ngulo de roci?n.
190
         * @param x Coordenada x de rotaci?n.
191
         * @param y Coordenada y de rotaci?n.
192
         */
193
        void rotate(double r, double x, double y);
194

    
195
        /**
196
         * DOCUMENT ME!
197
         *
198
         * @param type DOCUMENT ME!
199
         *
200
         * @return DOCUMENT ME!
201
         */
202
        public Handler[] getHandlers(int type);
203

    
204
        /**
205
         * Escala el gr?fico desde un punto en concreto.
206
         *
207
         * @param point 
208
         * @param x 
209
         * @param y 
210
         */
211
        public void scale(Point2D point, double x, double y);
212

    
213
        /**
214
         * Soluci?n provisional.
215
         *
216
         * @return Devuelve un array con los shapes que contiene la geometr?a.
217
         */
218
        public FShape[] getShapes();
219
        public FSymbol getSymbol();
220
        public void setSymbol(FSymbol s);
221
}