Revision 41675 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
Envelope.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 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 3
|
|
9 |
* of the License, or (at your option) any later version.
|
|
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 | 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.
|
|
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 | 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. |
|
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. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 |
|
|
25 | 23 |
package org.gvsig.fmap.geom.primitive; |
26 | 24 |
|
27 | 25 |
import org.cresques.cts.ICoordTrans; |
... | ... | |
31 | 29 |
|
32 | 30 |
/** |
33 | 31 |
* <p> |
34 |
* This interface is equivalent to the GM_Envelope specified in |
|
35 |
* <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>. |
|
36 |
* A minimum bounding box or rectangle. Regardless of dimension, an Envelope |
|
37 |
* can be represented without ambiguity as two direct positions (coordinate |
|
38 |
* points). To encode an Envelope, it is sufficient to encode these two |
|
39 |
* points. This is consistent with all of the data types in this |
|
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 |
|
40 | 39 |
* specification, their state is represented by their publicly accessible |
41 | 40 |
* attributes. |
42 | 41 |
* </p> |
43 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a> |
|
42 |
* |
|
43 |
* @see <a |
|
44 |
* href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO |
|
45 |
* 19107</a> |
|
44 | 46 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
45 | 47 |
*/ |
46 |
public interface Envelope extends Persistent, Cloneable{ |
|
48 |
public interface Envelope extends Persistent, Cloneable { |
|
49 |
|
|
47 | 50 |
/** |
48 | 51 |
* Returns the center ordinate along the specified dimension. |
49 |
* @param dimension. |
|
50 |
* The dimension |
|
51 |
* @return |
|
52 |
* The value of the ordinate. |
|
53 |
* @throws EnvelopeNotInitializedException |
|
54 |
* if the envelope is empty. |
|
52 |
* |
|
53 |
* @param dimension. The dimension |
|
54 |
* @return The value of the ordinate. |
|
55 |
* @throws EnvelopeNotInitializedException if the envelope is empty. |
|
55 | 56 |
*/ |
56 | 57 |
double getCenter(int dimension); |
57 | 58 |
|
58 | 59 |
/** |
59 | 60 |
* The length of coordinate sequence (the number of entries) in this |
60 | 61 |
* envelope. |
61 |
* @return
|
|
62 |
* The dimension of the envelope. |
|
62 |
* |
|
63 |
* @return The dimension of the envelope.
|
|
63 | 64 |
*/ |
64 | 65 |
int getDimension(); |
65 | 66 |
|
66 | 67 |
/** |
67 | 68 |
* Returns the envelope length along the specified dimension. |
68 |
* @param dimension |
|
69 |
* The dimension. |
|
70 |
* @return |
|
71 |
* The envelope length along a dimension. |
|
72 |
* @throws EnvelopeNotInitializedException |
|
73 |
* if the envelope is empty. |
|
69 |
* |
|
70 |
* @param dimension The dimension. |
|
71 |
* @return The envelope length along a dimension. |
|
72 |
* @throws EnvelopeNotInitializedException if the envelope is empty. |
|
74 | 73 |
*/ |
75 | 74 |
double getLength(int dimension); |
76 | 75 |
|
77 | 76 |
/** |
78 | 77 |
* A coordinate position consisting of all the minimal ordinates for each |
79 | 78 |
* dimension for all points within the Envelope. |
80 |
* @return
|
|
81 |
* The lower corner. |
|
79 |
* |
|
80 |
* @return The lower corner.
|
|
82 | 81 |
*/ |
83 | 82 |
Point getLowerCorner(); |
84 |
|
|
83 |
|
|
85 | 84 |
/** |
86 |
* Sets the coordinate position consisting of all the minimal ordinates for each
|
|
87 |
* dimension for all points within the Envelope. |
|
88 |
* @param point
|
|
89 |
* The lower corner. |
|
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.
|
|
90 | 89 |
*/ |
91 | 90 |
void setLowerCorner(Point point); |
92 | 91 |
|
93 | 92 |
/** |
94 | 93 |
* Returns the maximal ordinate along the specified dimension. |
95 |
* @param dimension |
|
96 |
* The dimension. |
|
97 |
* @return |
|
98 |
* The maximum value |
|
99 |
* @throws EnvelopeNotInitializedException |
|
100 |
* if the envelope is empty. |
|
94 |
* |
|
95 |
* @param dimension The dimension. |
|
96 |
* @return The maximum value |
|
97 |
* @throws EnvelopeNotInitializedException if the envelope is empty. |
|
101 | 98 |
*/ |
102 | 99 |
double getMaximum(int dimension); |
103 | 100 |
|
104 | 101 |
/** |
105 | 102 |
* Returns the minimal ordinate along the specified dimension. |
106 |
* @param dimension |
|
107 |
* The dimension. |
|
108 |
* @return |
|
109 |
* The minimum value. |
|
110 |
* @throws EnvelopeNotInitializedException |
|
111 |
* if the envelope is empty. |
|
103 |
* |
|
104 |
* @param dimension The dimension. |
|
105 |
* @return The minimum value. |
|
106 |
* @throws EnvelopeNotInitializedException if the envelope is empty. |
|
112 | 107 |
*/ |
113 | 108 |
double getMinimum(int dimension); |
114 | 109 |
|
115 | 110 |
/** |
116 | 111 |
* A coordinate position consisting of all the maximal ordinates for each |
117 | 112 |
* dimension for all points within the Envelope. |
118 |
* @return
|
|
119 |
* The upper corner |
|
113 |
* |
|
114 |
* @return The upper corner
|
|
120 | 115 |
*/ |
121 | 116 |
Point getUpperCorner(); |
122 |
|
|
117 |
|
|
123 | 118 |
/** |
124 |
* Sets the coordinate position consisting of all the maximal ordinates for each
|
|
125 |
* dimension for all points within the Envelope. |
|
126 |
* @param point
|
|
127 |
* The upper corner. |
|
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.
|
|
128 | 123 |
*/ |
129 | 124 |
void setUpperCorner(Point upperCorner); |
130 | 125 |
|
131 | 126 |
/** |
132 | 127 |
* Adds a envelope to the current envelope. |
133 |
*
|
|
134 |
* If the envelope to add is null or empty do not modify the current
|
|
128 |
* |
|
129 |
* If the envelope to add is null or empty do not modify the current |
|
135 | 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> |
|
136 | 141 |
* |
137 |
* @param envelope |
|
138 |
* The envelope to add. |
|
142 |
* @param envelope The envelope to add. |
|
139 | 143 |
*/ |
140 |
void add(Envelope envelope); |
|
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(); |
|
141 | 154 |
|
142 |
/** |
|
143 |
* It returns the equivalent of an envelope like a geometry. |
|
144 |
* |
|
145 |
* @return |
|
146 |
* A geometry that contains the same area that the envelope. |
|
147 |
* |
|
148 |
* @throws EnvelopeNotInitializedException |
|
149 |
* if the envelope is empty. |
|
150 |
*/ |
|
151 |
Geometry getGeometry(); |
|
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); |
|
152 | 163 |
|
153 |
/** |
|
154 |
* Returns <code>true</code> if the new envelope is contained in the |
|
155 |
* current envelope. |
|
156 |
* @param envelope |
|
157 |
* The envelope to compare. |
|
158 |
* @return |
|
159 |
* If the current envelope contains the new envelope |
|
160 |
*/ |
|
161 |
boolean contains(Envelope envelope); |
|
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); |
|
162 | 172 |
|
163 |
/** |
|
164 |
* Returns <code>true</code> if the new envelope intersects with the |
|
165 |
* current envelope. |
|
166 |
* @param envelope |
|
167 |
* The envelope to compare. |
|
168 |
* @return |
|
169 |
* If the current envelope intersects with the new envelope |
|
170 |
*/ |
|
171 |
boolean intersects(Envelope envelope); |
|
173 |
/** |
|
174 |
* Converts the envelope to other coordinate reference system |
|
175 |
* |
|
176 |
* @param trans The CRS conversor |
|
177 |
* @return A new envelope in other CRS |
|
178 |
* @throws EnvelopeNotInitializedException if the envelope is empty. |
|
179 |
*/ |
|
180 |
Envelope convert(ICoordTrans trans); |
|
172 | 181 |
|
173 |
/** |
|
174 |
* Converts the envelope to other coordinate reference system |
|
175 |
* @param trans |
|
176 |
* The CRS conversor |
|
177 |
* @return |
|
178 |
* A new envelope in other CRS |
|
179 |
* @throws EnvelopeNotInitializedException |
|
180 |
* if the envelope is empty. |
|
181 |
*/ |
|
182 |
Envelope convert(ICoordTrans trans); |
|
183 |
|
|
184 |
/** |
|
185 |
* Gets if the envelope is <code>null</code> or not. Is |
|
186 |
* Empty means that the lower and upper corner are |
|
187 |
* <code>null</code>. |
|
188 |
* @return |
|
189 |
* <code>null</code> or not if is empty. |
|
190 |
*/ |
|
191 |
boolean isEmpty(); |
|
182 |
/** |
|
183 |
* Gets if the envelope is <code>null</code> or not. Is Empty means that the |
|
184 |
* lower and upper corner are <code>null</code>. |
|
185 |
* |
|
186 |
* @return <code>null</code> or not if is empty. |
|
187 |
*/ |
|
188 |
boolean isEmpty(); |
|
189 |
|
|
190 |
void clear(); |
|
191 |
|
|
192 | 192 |
} |
Also available in: Unified diff