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 @ 42464

History | View | Annotate | Download (6.24 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * 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
 *
11
 * 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
 *
16
 * 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
 *
20
 * For any additional information, do not hesitate to contact us at info AT
21
 * gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.fmap.geom.primitive;
24

    
25
import org.cresques.cts.ICoordTrans;
26
import org.gvsig.fmap.geom.Geometry;
27
import org.gvsig.tools.lang.Cloneable;
28
import org.gvsig.tools.persistence.Persistent;
29

    
30
/**
31
 * <p>
32
 * This interface is equivalent to the GM_Envelope specified in
33
 * <a
34
 * href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO
35
 * 19107</a>. A minimum bounding box or rectangle. Regardless of dimension, an
36
 * Envelope can be represented without ambiguity as two direct positions
37
 * (coordinate points). To encode an Envelope, it is sufficient to encode these
38
 * two points. This is consistent with all of the data types in this
39
 * specification, their state is represented by their publicly accessible
40
 * attributes.
41
 * </p>
42
 *
43
 * @see <a
44
 * href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO
45
 * 19107</a>
46
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
47
 */
48
public interface Envelope extends Persistent, Cloneable {
49

    
50
    /**
51
     * Returns the center ordinate along the specified dimension.
52
     *
53
     * @param dimension. The dimension
54
     * @return The value of the ordinate.
55
     * @throws EnvelopeNotInitializedException if the envelope is empty.
56
     */
57
    double getCenter(int dimension);
58

    
59
    /**
60
     * The length of coordinate sequence (the number of entries) in this
61
     * envelope.
62
     *
63
     * @return The dimension of the envelope.
64
     */
65
    int getDimension();
66

    
67
    /**
68
     * Returns the envelope length along the specified dimension.
69
     *
70
     * @param dimension The dimension.
71
     * @return The envelope length along a dimension.
72
     * @throws EnvelopeNotInitializedException if the envelope is empty.
73
     */
74
    double getLength(int dimension);
75

    
76
    /**
77
     * A coordinate position consisting of all the minimal ordinates for each
78
     * dimension for all points within the Envelope.
79
     *
80
     * @return The lower corner.
81
     */
82
    Point getLowerCorner();
83

    
84
    /**
85
     * Sets the coordinate position consisting of all the minimal ordinates for
86
     * each dimension for all points within the Envelope.
87
     *
88
     * @param point The lower corner.
89
     */
90
    void setLowerCorner(Point point);
91

    
92
    /**
93
     * Returns the maximal ordinate along the specified dimension.
94
     *
95
     * @param dimension The dimension.
96
     * @return The maximum value
97
     * @throws EnvelopeNotInitializedException if the envelope is empty.
98
     */
99
    double getMaximum(int dimension);
100

    
101
    /**
102
     * Returns the minimal ordinate along the specified dimension.
103
     *
104
     * @param dimension The dimension.
105
     * @return The minimum value.
106
     * @throws EnvelopeNotInitializedException if the envelope is empty.
107
     */
108
    double getMinimum(int dimension);
109

    
110
    /**
111
     * A coordinate position consisting of all the maximal ordinates for each
112
     * dimension for all points within the Envelope.
113
     *
114
     * @return The upper corner
115
     */
116
    Point getUpperCorner();
117

    
118
    /**
119
     * Sets the coordinate position consisting of all the maximal ordinates for
120
     * each dimension for all points within the Envelope.
121
     *
122
     * @param point The upper corner.
123
     */
124
    void setUpperCorner(Point upperCorner);
125

    
126
    /**
127
     * Adds a envelope to the current envelope.
128
     *
129
     * If the envelope to add is null or empty do not modify the current
130
     * enevelop and don't throw a exception.
131
     *
132
     * @param envelope The envelope to add.
133
     */
134
    void add(Envelope envelope);
135

    
136
    /**
137
     * Utility method to add the envelop of geometry to the current envelope.
138
     *
139
     * Is equivalent to:
140
     *  <code>add(geometry.getEnvelope())</code>
141
     *
142
     * @param envelope The envelope to add.
143
     */
144
    void add(Geometry geometry);
145

    
146
    /**
147
     * It returns the equivalent of an envelope like a geometry.
148
     *
149
     * @return A geometry that contains the same area that the envelope.
150
     *
151
     * @throws EnvelopeNotInitializedException if the envelope is empty.
152
     */
153
    Geometry getGeometry();
154

    
155
    /**
156
     * Returns <code>true</code> if the new envelope is contained in the current
157
     * envelope.
158
     *
159
     * @param envelope The envelope to compare.
160
     * @return If the current envelope contains the new envelope
161
     */
162
    boolean contains(Envelope envelope);
163

    
164
    /**
165
     * Returns <code>true</code> if the new envelope intersects with the current
166
     * envelope.
167
     *
168
     * @param envelope The envelope to compare.
169
     * @return If the current envelope intersects with the new envelope
170
     */
171
    boolean intersects(Envelope envelope);
172

    
173
    /**
174
     * Returns <code>true</code> if the geometry intersects with the current
175
     * envelope.
176
     *
177
     * @param geometry The geometry to compare.
178
     * @return If the current envelope intersects with the geometry
179
     */
180
    boolean intersects(Geometry geometry);
181

    
182
    /**
183
     * Converts the envelope to other coordinate reference system
184
     *
185
     * @param trans The CRS conversor
186
     * @return A new envelope in other CRS
187
     * @throws EnvelopeNotInitializedException if the envelope is empty.
188
     */
189
    Envelope convert(ICoordTrans trans);
190

    
191
    /**
192
     * Gets if the envelope is <code>null</code> or not. Is Empty means that the
193
     * lower and upper corner are <code>null</code>.
194
     *
195
     * @return <code>null</code> or not if is empty.
196
     */
197
    boolean isEmpty();
198

    
199
    void clear();
200

    
201
}