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 | 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 | 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 | 41675 | jjdelcerro | * 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 | 40435 | jjdelcerro | * specification, their state is represented by their publicly accessible
|
40 | * attributes.
|
||
41 | * </p>
|
||
42 | 41675 | jjdelcerro | *
|
43 | * @see <a
|
||
44 | * href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO
|
||
45 | * 19107</a>
|
||
46 | 40435 | jjdelcerro | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
47 | */
|
||
48 | 41675 | jjdelcerro | public interface Envelope extends Persistent, Cloneable { |
49 | |||
50 | 40435 | jjdelcerro | /**
|
51 | * Returns the center ordinate along the specified dimension.
|
||
52 | 41675 | jjdelcerro | *
|
53 | * @param dimension. The dimension
|
||
54 | * @return The value of the ordinate.
|
||
55 | * @throws EnvelopeNotInitializedException if the envelope is empty.
|
||
56 | 40435 | jjdelcerro | */
|
57 | double getCenter(int dimension); |
||
58 | |||
59 | /**
|
||
60 | * The length of coordinate sequence (the number of entries) in this
|
||
61 | * envelope.
|
||
62 | 41675 | jjdelcerro | *
|
63 | * @return The dimension of the envelope.
|
||
64 | 40435 | jjdelcerro | */
|
65 | int getDimension();
|
||
66 | |||
67 | /**
|
||
68 | * Returns the envelope length along the specified dimension.
|
||
69 | 41675 | jjdelcerro | *
|
70 | * @param dimension The dimension.
|
||
71 | * @return The envelope length along a dimension.
|
||
72 | * @throws EnvelopeNotInitializedException if the envelope is empty.
|
||
73 | 40435 | jjdelcerro | */
|
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 | 41675 | jjdelcerro | *
|
80 | * @return The lower corner.
|
||
81 | 40435 | jjdelcerro | */
|
82 | Point getLowerCorner();
|
||
83 | 41675 | jjdelcerro | |
84 | 40435 | jjdelcerro | /**
|
85 | 41675 | jjdelcerro | * 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 | 40435 | jjdelcerro | */
|
90 | void setLowerCorner(Point point); |
||
91 | |||
92 | /**
|
||
93 | * Returns the maximal ordinate along the specified dimension.
|
||
94 | 41675 | jjdelcerro | *
|
95 | * @param dimension The dimension.
|
||
96 | * @return The maximum value
|
||
97 | * @throws EnvelopeNotInitializedException if the envelope is empty.
|
||
98 | 40435 | jjdelcerro | */
|
99 | double getMaximum(int dimension); |
||
100 | |||
101 | /**
|
||
102 | * Returns the minimal ordinate along the specified dimension.
|
||
103 | 41675 | jjdelcerro | *
|
104 | * @param dimension The dimension.
|
||
105 | * @return The minimum value.
|
||
106 | * @throws EnvelopeNotInitializedException if the envelope is empty.
|
||
107 | 40435 | jjdelcerro | */
|
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 | 41675 | jjdelcerro | *
|
114 | * @return The upper corner
|
||
115 | 40435 | jjdelcerro | */
|
116 | Point getUpperCorner();
|
||
117 | 41675 | jjdelcerro | |
118 | 40435 | jjdelcerro | /**
|
119 | 41675 | jjdelcerro | * 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 | 40435 | jjdelcerro | */
|
124 | void setUpperCorner(Point upperCorner); |
||
125 | |||
126 | /**
|
||
127 | * Adds a envelope to the current envelope.
|
||
128 | 41675 | jjdelcerro | *
|
129 | * If the envelope to add is null or empty do not modify the current
|
||
130 | 41417 | jjdelcerro | * enevelop and don't throw a exception.
|
131 | 41675 | jjdelcerro | *
|
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 | 42464 | fdiaz | *
|
142 | 41675 | jjdelcerro | * @param envelope The envelope to add.
|
143 | 40435 | jjdelcerro | */
|
144 | 41675 | jjdelcerro | void add(Geometry geometry);
|
145 | 42464 | fdiaz | |
146 | 41675 | jjdelcerro | /**
|
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 | 40435 | jjdelcerro | |
155 | 41675 | jjdelcerro | /**
|
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 | 40435 | jjdelcerro | |
164 | 41675 | jjdelcerro | /**
|
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 | 40435 | jjdelcerro | |
173 | 41675 | jjdelcerro | /**
|
174 | 42464 | fdiaz | * 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 | 41675 | jjdelcerro | * 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 | 40435 | jjdelcerro | |
191 | 41675 | jjdelcerro | /**
|
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 | 40435 | jjdelcerro | } |