Statistics
| Revision:

svn-gvsig-desktop / branches / Fmap_GisPlanet / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / IGeometry.java @ 1848

History | View | Annotate | Download (4.53 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.geom.Rectangle2D;
45
import java.io.Serializable;
46

    
47
import org.cresques.cts.ICoordTrans;
48

    
49
import com.iver.cit.gvsig.fmap.ViewPort;
50
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
51
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
52
import com.iver.cit.gvsig.fmap.rendering.FStyledShapePainter;
53
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
54
import com.vividsolutions.jts.geom.Geometry;
55

    
56

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

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

    
88
        /**
89
         * Dibuja la geometr?a sobre el Graphics2D que se pasa como par?metro.
90
         *
91
         * @param g Graphics2D.
92
         * @param vp ViewPort.
93
         * @param symbol S?mbolo.
94
         */
95
        void draw(Graphics2D g, ViewPort vp, FSymbol symbol);
96

    
97
        /**
98
         * Transforma esta Shape en un Geometry de JTS
99
         *
100
         * @return Geometr?a.
101
         */
102
        Geometry toJTSGeometry();
103

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

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

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

    
131
        /**
132
         * Devuelve true si la geometr?a intersecta con el rect?ngulo que se pasa
133
         * como par?metro.
134
         *
135
         * @param r Rect?ngulo.
136
         *
137
         * @return True, si intersecta.
138
         */
139
        boolean intersects(Rectangle2D r);
140
        
141
        /**
142
         * Se usa en las strategies de dibujo para comprobar de manera r?pida
143
         * si intersecta con el rect?ngulo visible
144
         * @param x
145
         * @param y
146
         * @param w
147
         * @param h
148
         * @return
149
         */
150
        public boolean fastIntersects(double x, double y, double w, double h);
151

    
152
        /**
153
         * Devuelve el Rect?ngulo que ocupa la geometr?a.
154
         *
155
         * @return Rect?ngulo.
156
         */
157
        Rectangle2D getBounds2D();
158

    
159
        /**
160
         * Reproyecta la geometr?a a partir de las coordenadas de transformaci?n.
161
         *
162
         * @param ct Coordenadas de transformaci?n.
163
         */
164
        void reProject(ICoordTrans ct);
165

    
166
        /**
167
         * Devuelve el GeneralPathXIterator con la informaci?n relativa a la geometr?a.
168
         *
169
         * @return GeneralPathXIterator.
170
         */
171
        GeneralPathXIterator getGeneralPathXIterator();
172
}