Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.api / src / main / java / org / gvsig / fmap / geom / primitive / Envelope.java @ 45673

History | View | Annotate | Download (6.6 KB)

1 40559 jjdelcerro
/**
2
 * gvSIG. Desktop Geographic Information System.
3 40435 jjdelcerro
 *
4 40559 jjdelcerro
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6 41675 jjdelcerro
 * This program is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License as published by the Free Software
8
 * Foundation; either version 3 of the License, or (at your option) any later
9
 * version.
10 40559 jjdelcerro
 *
11 41675 jjdelcerro
 * This program is distributed in the hope that it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14
 * details.
15 40559 jjdelcerro
 *
16 41675 jjdelcerro
 * You should have received a copy of the GNU General Public License along with
17
 * this program; if not, write to the Free Software Foundation, Inc., 51
18
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 40559 jjdelcerro
 *
20 41675 jjdelcerro
 * For any additional information, do not hesitate to contact us at info AT
21
 * gvsig.com, or visit our website www.gvsig.com.
22 40435 jjdelcerro
 */
23
package org.gvsig.fmap.geom.primitive;
24
25 43329 jjdelcerro
import java.awt.geom.AffineTransform;
26 40435 jjdelcerro
import org.cresques.cts.ICoordTrans;
27 44003 jjdelcerro
import org.cresques.cts.IProjection;
28 40435 jjdelcerro
import org.gvsig.fmap.geom.Geometry;
29
import org.gvsig.tools.lang.Cloneable;
30
import org.gvsig.tools.persistence.Persistent;
31
32
/**
33
 * <p>
34 41675 jjdelcerro
 * This interface is equivalent to the GM_Envelope specified in
35
 * <a
36
 * href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO
37
 * 19107</a>. A minimum bounding box or rectangle. Regardless of dimension, an
38
 * Envelope can be represented without ambiguity as two direct positions
39
 * (coordinate points). To encode an Envelope, it is sufficient to encode these
40
 * two points. This is consistent with all of the data types in this
41 40435 jjdelcerro
 * specification, their state is represented by their publicly accessible
42
 * attributes.
43
 * </p>
44 41675 jjdelcerro
 *
45
 * @see <a
46
 * href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO
47
 * 19107</a>
48 40435 jjdelcerro
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
49
 */
50 41675 jjdelcerro
public interface Envelope extends Persistent, Cloneable {
51
52 40435 jjdelcerro
    /**
53
     * Returns the center ordinate along the specified dimension.
54 41675 jjdelcerro
     *
55
     * @param dimension. The dimension
56
     * @return The value of the ordinate.
57
     * @throws EnvelopeNotInitializedException if the envelope is empty.
58 40435 jjdelcerro
     */
59
    double getCenter(int dimension);
60
61
    /**
62
     * The length of coordinate sequence (the number of entries) in this
63
     * envelope.
64 41675 jjdelcerro
     *
65
     * @return The dimension of the envelope.
66 40435 jjdelcerro
     */
67
    int getDimension();
68
69
    /**
70
     * Returns the envelope length along the specified dimension.
71 41675 jjdelcerro
     *
72
     * @param dimension The dimension.
73
     * @return The envelope length along a dimension.
74
     * @throws EnvelopeNotInitializedException if the envelope is empty.
75 40435 jjdelcerro
     */
76
    double getLength(int dimension);
77
78
    /**
79
     * A coordinate position consisting of all the minimal ordinates for each
80
     * dimension for all points within the Envelope.
81 41675 jjdelcerro
     *
82
     * @return The lower corner.
83 40435 jjdelcerro
     */
84
    Point getLowerCorner();
85 41675 jjdelcerro
86 40435 jjdelcerro
    /**
87 41675 jjdelcerro
     * Sets the coordinate position consisting of all the minimal ordinates for
88
     * each dimension for all points within the Envelope.
89
     *
90
     * @param point The lower corner.
91 40435 jjdelcerro
     */
92
    void setLowerCorner(Point point);
93
94
    /**
95
     * Returns the maximal ordinate along the specified dimension.
96 41675 jjdelcerro
     *
97
     * @param dimension The dimension.
98
     * @return The maximum value
99
     * @throws EnvelopeNotInitializedException if the envelope is empty.
100 40435 jjdelcerro
     */
101
    double getMaximum(int dimension);
102
103
    /**
104
     * Returns the minimal ordinate along the specified dimension.
105 41675 jjdelcerro
     *
106
     * @param dimension The dimension.
107
     * @return The minimum value.
108
     * @throws EnvelopeNotInitializedException if the envelope is empty.
109 40435 jjdelcerro
     */
110
    double getMinimum(int dimension);
111
112
    /**
113
     * A coordinate position consisting of all the maximal ordinates for each
114
     * dimension for all points within the Envelope.
115 41675 jjdelcerro
     *
116
     * @return The upper corner
117 40435 jjdelcerro
     */
118
    Point getUpperCorner();
119 41675 jjdelcerro
120 40435 jjdelcerro
    /**
121 41675 jjdelcerro
     * Sets the coordinate position consisting of all the maximal ordinates for
122
     * each dimension for all points within the Envelope.
123
     *
124 43329 jjdelcerro
     * @param upperCorner The upper corner.
125 40435 jjdelcerro
     */
126
    void setUpperCorner(Point upperCorner);
127
128
    /**
129
     * Adds a envelope to the current envelope.
130 41675 jjdelcerro
     *
131
     * If the envelope to add is null or empty do not modify the current
132 41417 jjdelcerro
     * enevelop and don't throw a exception.
133 41675 jjdelcerro
     *
134
     * @param envelope The envelope to add.
135
     */
136
    void add(Envelope envelope);
137
138
    /**
139
     * Utility method to add the envelop of geometry to the current envelope.
140
     *
141
     * Is equivalent to:
142
     *  <code>add(geometry.getEnvelope())</code>
143 42464 fdiaz
     *
144 43329 jjdelcerro
     * @param geometry The geometry to add.
145 40435 jjdelcerro
     */
146 41675 jjdelcerro
    void add(Geometry geometry);
147 42464 fdiaz
148 41675 jjdelcerro
    /**
149
     * It returns the equivalent of an envelope like a geometry.
150
     *
151
     * @return A geometry that contains the same area that the envelope.
152
     *
153
     * @throws EnvelopeNotInitializedException if the envelope is empty.
154
     */
155
    Geometry getGeometry();
156 40435 jjdelcerro
157 41675 jjdelcerro
    /**
158
     * Returns <code>true</code> if the new envelope is contained in the current
159
     * envelope.
160
     *
161
     * @param envelope The envelope to compare.
162
     * @return If the current envelope contains the new envelope
163
     */
164
    boolean contains(Envelope envelope);
165 40435 jjdelcerro
166 41675 jjdelcerro
    /**
167
     * Returns <code>true</code> if the new envelope intersects with the current
168
     * envelope.
169
     *
170
     * @param envelope The envelope to compare.
171
     * @return If the current envelope intersects with the new envelope
172
     */
173
    boolean intersects(Envelope envelope);
174 40435 jjdelcerro
175 41675 jjdelcerro
    /**
176 42464 fdiaz
     * Returns <code>true</code> if the geometry intersects with the current
177
     * envelope.
178
     *
179
     * @param geometry The geometry to compare.
180
     * @return If the current envelope intersects with the geometry
181
     */
182
    boolean intersects(Geometry geometry);
183
184
    /**
185 41675 jjdelcerro
     * Converts the envelope to other coordinate reference system
186
     *
187
     * @param trans The CRS conversor
188
     * @return A new envelope in other CRS
189
     * @throws EnvelopeNotInitializedException if the envelope is empty.
190
     */
191
    Envelope convert(ICoordTrans trans);
192 40435 jjdelcerro
193 41675 jjdelcerro
    /**
194
     * Gets if the envelope is <code>null</code> or not. Is Empty means that the
195
     * lower and upper corner are <code>null</code>.
196
     *
197
     * @return <code>null</code> or not if is empty.
198
     */
199
    boolean isEmpty();
200
201
    void clear();
202
203 42772 dmartinezizquierdo
    /**
204
     * Centers the envelope to a given point
205
     * @param p Point to be centered
206
     */
207
    public void centerTo(Point p);
208 44003 jjdelcerro
209
    public void setProjection(IProjection projection);
210
211
    public void setProjectionIffNull(IProjection projection);
212
213
    public IProjection getProjection();
214 40435 jjdelcerro
}