Statistics
| Revision:

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

History | View | Annotate | Download (4.6 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.IOException;
46
import java.io.Serializable;
47

    
48
import org.cresques.cts.ICoordTrans;
49

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

    
57

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

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

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

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

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

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

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

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

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

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

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

    
174
    public byte[] toWKB() throws IOException;
175
}