Statistics
| Revision:

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

History | View | Annotate | Download (4.91 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
     * You can use this function if you are going to draw into
100
     * a bitmap. (With ints coords). It will do a decimation,
101
     * drawing a shape with less coords (faster draw)
102
     * @param g
103
     * @param vp
104
     * @param symbol
105
     */
106
    void drawInts(Graphics2D g, ViewPort vp, FSymbol symbol);
107
        /**
108
         * Transforma esta Shape en un Geometry de JTS
109
         *
110
         * @return Geometr?a.
111
         */
112
        Geometry toJTSGeometry();
113

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

    
127
        /**
128
         * Obtiene el tipo de la geometr?a
129
         *
130
         * @return una de las constantes de FShape: POINT, LINE, POLIGON
131
         */
132
        int getGeometryType();
133

    
134
        /**
135
         * Clona la Geometr?a.
136
         *
137
         * @return Geometr?a clonada.
138
         */
139
        IGeometry cloneGeometry();
140

    
141
        /**
142
         * Devuelve true si la geometr?a intersecta con el rect?ngulo que se pasa
143
         * como par?metro.
144
         *
145
         * @param r Rect?ngulo.
146
         *
147
         * @return True, si intersecta.
148
         */
149
        boolean intersects(Rectangle2D r);
150
        
151
        /**
152
         * Se usa en las strategies de dibujo para comprobar de manera r?pida
153
         * si intersecta con el rect?ngulo visible
154
         * @param x
155
         * @param y
156
         * @param w
157
         * @param h
158
         * @return
159
         */
160
        public boolean fastIntersects(double x, double y, double w, double h);
161

    
162
        /**
163
         * Devuelve el Rect?ngulo que ocupa la geometr?a.
164
         *
165
         * @return Rect?ngulo.
166
         */
167
        Rectangle2D getBounds2D();
168

    
169
        /**
170
         * Reproyecta la geometr?a a partir de las coordenadas de transformaci?n.
171
         *
172
         * @param ct Coordenadas de transformaci?n.
173
         */
174
        void reProject(ICoordTrans ct);
175

    
176
        /**
177
         * Devuelve el GeneralPathXIterator con la informaci?n relativa a la geometr?a.
178
         *
179
         * @return GeneralPathXIterator.
180
         */
181
        GeneralPathXIterator getGeneralPathXIterator();
182

    
183
    public byte[] toWKB() throws IOException;
184
}