Statistics
| Revision:

gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.api / src / main / java / org / gvsig / fmap / dal / coverage / datastruct / Extent.java @ 2443

History | View | Annotate | Download (6.79 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.dal.coverage.datastruct;
23

    
24
import java.awt.geom.Point2D;
25
import java.awt.geom.Rectangle2D;
26

    
27
import org.cresques.cts.ICoordTrans;
28
import org.gvsig.fmap.geom.primitive.EnvelopeNotInitializedException;
29
import org.gvsig.tools.persistence.Persistent;
30

    
31
/**
32
 * Representaci?n de la extensi?n de una imagen.
33
 * 
34
 * @author Nacho Brodin (nachobrodin@gmail.com)
35
 */
36
public interface Extent extends Persistent {
37
        /**
38
         * Builds a new GridExtent using this extension
39
         * @param cellSize
40
         * @return
41
         */
42
        public GridExtent getGridExtent(double cellSize);
43
        
44
    /**
45
     * Obtiene la coordenada X m?nima
46
     * @return valor de la coordenada X m?nima
47
     */
48
    public double minX();
49

    
50
    /**
51
     * Obtiene la coordenada Y m?nima
52
     * @return valor de la coordenada X m?nima
53
     */
54
    public double minY();
55

    
56
    /**
57
     * Obtiene la coordenada X m?xima
58
     * @return valor de la coordenada X m?xima
59
     */
60
    public double maxX();
61

    
62
    /**
63
     * Obtiene la coordenada Y m?xima
64
     * @return valor de la coordenada Y m?xima
65
     */
66
    public double maxY();
67
    
68
    /**
69
     * Obtiene el punto m?nimo
70
     * @return m?nimo
71
     */
72
    public Point2D getMin();
73

    
74
    /**
75
     * Obtiene el punto m?ximo
76
     * @return m?ximo
77
     */
78
    public Point2D getMax();
79

    
80
    /**
81
     * Obtiene el ancho
82
     * @return
83
     */
84
    public double width();
85

    
86
    /**
87
     * Obtiene el alto
88
     * @return
89
     */
90
    public double height();
91
    
92
    /**
93
     * Obtiene el centro en X del extent
94
     * @return
95
     */
96
    public double getCenterX();
97
    
98
    /**
99
     * Obtiene el centro en Y del extent
100
     * @return
101
     */
102
    public double getCenterY();
103

    
104

    
105
    public Rectangle2D toRectangle2D();
106
    
107
    /**
108
     * Gets the upper left corner
109
     * @return
110
     */
111
    public Point2D getUL();
112
    
113
    /**
114
     * Gets the lower right corner
115
     * @return
116
     */
117
    public Point2D getLR();
118
    
119
    /**
120
     * Obtiene la coordenada X de la esquina superior izquierda. Esta, en condiciones normales
121
     * conincide con el minimo en X pero cuando un raster est? rotado esto puede variar.
122
     * @return ulx
123
     */
124
    public double getULX();
125
    
126
    /**
127
     * Obtiene la coordenada Y de la esquina superior izquierda. Esta, en condiciones normales
128
     * conincide con el maximo en Y pero cuando un raster est? rotado esto puede variar.
129
     * @return uly
130
     */
131
    public double getULY();
132
    
133
    /**
134
     * Obtiene la coordenada X de la esquina inferior derecha. Esta, en condiciones normales
135
     * conincide con el m?ximo en X pero cuando un raster est? rotado esto puede variar.
136
     * @return lrx
137
     */
138
    public double getLRX();
139
    
140
    /**
141
     * Obtiene la coordenada Y de la esquina inferior derecha. Esta, en condiciones normales
142
     * conincide con el minimo en Y pero cuando un raster est? rotado esto puede variar.
143
     * @return lry
144
     */
145
    public double getLRY();
146
    
147
    /**
148
     * Obtiene la coordenada X de la esquina superior derecha. 
149
     * @return urx
150
     */
151
    public double getURX();
152
    
153
    /**
154
     * Obtiene la coordenada Y de la esquina superior derecha.
155
     * @return uly
156
     */
157
    public double getURY();
158
    
159
    /**
160
     * Obtiene la coordenada X de la esquina inferior izquierda.
161
     * @return lrx
162
     */
163
    public double getLLX();
164
    
165
    /**
166
     * Obtiene la coordenada Y de la esquina inferior izquierda.
167
     * @return lly
168
     */
169
    public double getLLY();
170
    
171
    /**
172
     * Asigna la coordenada X de la esquina superior izquierda al m?nimo X
173
     */
174
    public void setULXToMin();
175
    
176
    /**
177
     * Asigna la coordenada X de la esquina superior izquierda al m?ximo X
178
     */
179
    public void setULXToMax();
180
    
181
    /**
182
     * Asigna la coordenada Y de la esquina superior izquierda al m?nimo Y
183
     */
184
    public void setULYToMin();
185
    
186
    /**
187
     * Asigna la coordenada Y de la esquina superior izquierda al m?ximo Y
188
     */
189
    public void setULYToMax();
190
    
191
    /**
192
     * Asigna la coordenada X de la esquina inferior derecha al m?nimo X
193
     */
194
    public void setLRXToMin();
195
    
196
    /**
197
     * Asigna la coordenada X de la esquina inferior derecha al m?ximo X
198
     */
199
    public void setLRXToMax();
200
    
201
    /**
202
     * Asigna la coordenada Y de la esquina inferior derecha al m?nimo Y
203
     */
204
    public void setLRYToMin();
205
    
206
    /**
207
     * Asigna la coordenada Y de la esquina inferior derecha al m?ximo Y
208
     */
209
    public void setLRYToMax();
210
    
211
    /**
212
     * Adds the current extent to the selected extent and returns the maximum 
213
     * bounding box that enclose both.
214
     * @param ext
215
     * @return
216
     */
217
    public Extent encloseBoundinBoxes(Extent ext);
218
    
219
    /**
220
     * Gets the intersection between two bounding box
221
     * @param ext
222
     * @return
223
     */
224
    public Extent intersection(Extent ext);
225
    
226
    /**
227
     * Returns true if the selected bounding box intersects with the 
228
     * current
229
     * @param ext
230
     * @return
231
     */
232
    public boolean intersects(Extent ext);
233
    
234
    /**
235
     * Obtiene la escala
236
     * @param width        Ancho
237
     * @param height        Alto
238
     * @return
239
     */
240
    public double[] getScale(int width, int height);
241

    
242
    public double[] getScale(double width, double height);
243
    
244
        /**
245
         * Converts the bounding box to other coordinate reference system
246
         * @param trans
247
         * The CRS conversor
248
         * @return
249
         * A new envelope in other CRS 
250
         * @throws EnvelopeNotInitializedException
251
     * if the envelope is empty.
252
         */
253
    public Extent convert(ICoordTrans trans);
254
    
255
        /**
256
         * Given a cell size, converts a point in raster coordinates to world coordinates
257
         * @param pt Point to transform
258
         */
259
        public Point2D rasterToWorld(Point2D pt, double cellsize);
260

    
261
        /**
262
         * Given a cell size, converts a point in world coordinates to pixel coordinates
263
         * @param pt Point to transform
264
         */
265
        public Point2D worldToRaster(Point2D pt, double cellsize);
266
    
267
    /**
268
     * Compares two extents
269
     * @param obj
270
     * @return
271
     */
272
    public boolean equals(Object obj);
273
    
274
    public Extent clone();
275
}