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 @ 40767
History | View | Annotate | Download (5.55 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
|
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.
|
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.
|
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.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
package org.gvsig.fmap.geom.primitive; |
26 |
|
27 |
import org.cresques.cts.ICoordTrans; |
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 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
|
40 |
* specification, their state is represented by their publicly accessible
|
41 |
* attributes.
|
42 |
* </p>
|
43 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
45 |
*/
|
46 |
public interface Envelope extends Persistent, Cloneable{ |
47 |
/**
|
48 |
* 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.
|
55 |
*/
|
56 |
double getCenter(int dimension); |
57 |
|
58 |
/**
|
59 |
* The length of coordinate sequence (the number of entries) in this
|
60 |
* envelope.
|
61 |
* @return
|
62 |
* The dimension of the envelope.
|
63 |
*/
|
64 |
int getDimension();
|
65 |
|
66 |
/**
|
67 |
* 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.
|
74 |
*/
|
75 |
double getLength(int dimension); |
76 |
|
77 |
/**
|
78 |
* A coordinate position consisting of all the minimal ordinates for each
|
79 |
* dimension for all points within the Envelope.
|
80 |
* @return
|
81 |
* The lower corner.
|
82 |
*/
|
83 |
Point getLowerCorner();
|
84 |
|
85 |
/**
|
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.
|
90 |
*/
|
91 |
void setLowerCorner(Point point); |
92 |
|
93 |
/**
|
94 |
* 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.
|
101 |
*/
|
102 |
double getMaximum(int dimension); |
103 |
|
104 |
/**
|
105 |
* 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.
|
112 |
*/
|
113 |
double getMinimum(int dimension); |
114 |
|
115 |
/**
|
116 |
* A coordinate position consisting of all the maximal ordinates for each
|
117 |
* dimension for all points within the Envelope.
|
118 |
* @return
|
119 |
* The upper corner
|
120 |
*/
|
121 |
Point getUpperCorner();
|
122 |
|
123 |
/**
|
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.
|
128 |
*/
|
129 |
void setUpperCorner(Point upperCorner); |
130 |
|
131 |
/**
|
132 |
* Adds a envelope to the current envelope.
|
133 |
* @param envelope
|
134 |
* The envelope to add.
|
135 |
*/
|
136 |
void add(Envelope envelope);
|
137 |
|
138 |
/**
|
139 |
* It returns the equivalent of an envelope like a geometry.
|
140 |
* @return
|
141 |
* A geometry that contains the same area that the envelope.
|
142 |
* @throws EnvelopeNotInitializedException
|
143 |
* if the envelope is empty.
|
144 |
*/
|
145 |
Geometry getGeometry(); |
146 |
|
147 |
/**
|
148 |
* Returns <code>true</code> if the new envelope is contained in the
|
149 |
* current envelope.
|
150 |
* @param envelope
|
151 |
* The envelope to compare.
|
152 |
* @return
|
153 |
* If the current envelope contains the new envelope
|
154 |
*/
|
155 |
boolean contains(Envelope envelope);
|
156 |
|
157 |
/**
|
158 |
* Returns <code>true</code> if the new envelope intersects with the
|
159 |
* current envelope.
|
160 |
* @param envelope
|
161 |
* The envelope to compare.
|
162 |
* @return
|
163 |
* If the current envelope intersects with the new envelope
|
164 |
*/
|
165 |
boolean intersects(Envelope envelope);
|
166 |
|
167 |
/**
|
168 |
* Converts the envelope to other coordinate reference system
|
169 |
* @param trans
|
170 |
* The CRS conversor
|
171 |
* @return
|
172 |
* A new envelope in other CRS
|
173 |
* @throws EnvelopeNotInitializedException
|
174 |
* if the envelope is empty.
|
175 |
*/
|
176 |
Envelope convert(ICoordTrans trans); |
177 |
|
178 |
/**
|
179 |
* Gets if the envelope is <code>null</code> or not. Is
|
180 |
* Empty means that the lower and upper corner are
|
181 |
* <code>null</code>.
|
182 |
* @return
|
183 |
* <code>null</code> or not if is empty.
|
184 |
*/
|
185 |
boolean isEmpty();
|
186 |
} |