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 @ 45941
History | View | Annotate | Download (6.69 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 java.awt.geom.AffineTransform; |
26 |
import org.cresques.cts.ICoordTrans; |
27 |
import org.cresques.cts.IProjection; |
28 |
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 |
* 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 |
* specification, their state is represented by their publicly accessible
|
42 |
* attributes.
|
43 |
* </p>
|
44 |
*
|
45 |
* @see <a
|
46 |
* href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO
|
47 |
* 19107</a>
|
48 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
49 |
*/
|
50 |
public interface Envelope extends Persistent, Cloneable { |
51 |
|
52 |
/**
|
53 |
* Returns the center ordinate along the specified dimension.
|
54 |
*
|
55 |
* @param dimension. The dimension
|
56 |
* @return The value of the ordinate.
|
57 |
* @throws EnvelopeNotInitializedException if the envelope is empty.
|
58 |
*/
|
59 |
double getCenter(int dimension); |
60 |
|
61 |
/**
|
62 |
* The length of coordinate sequence (the number of entries) in this
|
63 |
* envelope.
|
64 |
*
|
65 |
* @return The dimension of the envelope.
|
66 |
*/
|
67 |
int getDimension();
|
68 |
|
69 |
/**
|
70 |
* Returns the envelope length along the specified dimension.
|
71 |
*
|
72 |
* @param dimension The dimension.
|
73 |
* @return The envelope length along a dimension.
|
74 |
* @throws EnvelopeNotInitializedException if the envelope is empty.
|
75 |
*/
|
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 |
*
|
82 |
* @return The lower corner.
|
83 |
*/
|
84 |
Point getLowerCorner();
|
85 |
|
86 |
/**
|
87 |
* 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 |
*/
|
92 |
void setLowerCorner(Point point); |
93 |
|
94 |
/**
|
95 |
* Returns the maximal ordinate along the specified dimension.
|
96 |
*
|
97 |
* @param dimension The dimension.
|
98 |
* @return The maximum value
|
99 |
* @throws EnvelopeNotInitializedException if the envelope is empty.
|
100 |
*/
|
101 |
double getMaximum(int dimension); |
102 |
|
103 |
/**
|
104 |
* Returns the minimal ordinate along the specified dimension.
|
105 |
*
|
106 |
* @param dimension The dimension.
|
107 |
* @return The minimum value.
|
108 |
* @throws EnvelopeNotInitializedException if the envelope is empty.
|
109 |
*/
|
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 |
*
|
116 |
* @return The upper corner
|
117 |
*/
|
118 |
Point getUpperCorner();
|
119 |
|
120 |
/**
|
121 |
* Sets the coordinate position consisting of all the maximal ordinates for
|
122 |
* each dimension for all points within the Envelope.
|
123 |
*
|
124 |
* @param upperCorner The upper corner.
|
125 |
*/
|
126 |
void setUpperCorner(Point upperCorner); |
127 |
|
128 |
/**
|
129 |
* Adds a envelope to the current envelope.
|
130 |
*
|
131 |
* If the envelope to add is null or empty do not modify the current
|
132 |
* enevelop and don't throw a exception.
|
133 |
*
|
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 |
*
|
144 |
* @param geometry The geometry to add.
|
145 |
*/
|
146 |
void add(Geometry geometry);
|
147 |
|
148 |
/**
|
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 |
|
157 |
/**
|
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 |
|
166 |
/**
|
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 |
|
175 |
/**
|
176 |
* 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 |
* 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 |
|
193 |
/**
|
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 |
/**
|
204 |
* Centers the envelope to a given point
|
205 |
* @param p Point to be centered
|
206 |
*/
|
207 |
public void centerTo(Point p); |
208 |
|
209 |
public void setProjection(IProjection projection); |
210 |
|
211 |
public void setProjectionIffNull(IProjection projection); |
212 |
|
213 |
public IProjection getProjection();
|
214 |
|
215 |
public boolean isCollapsed(); |
216 |
|
217 |
public boolean isCollapsed(int subtype); |
218 |
} |