Revision 29519 branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java
ViewPort.java | ||
---|---|---|
70 | 70 |
import com.iver.utiles.StringUtilities; |
71 | 71 |
import com.iver.utiles.XMLEntity; |
72 | 72 |
|
73 |
|
|
74 | 73 |
/** |
75 |
* <p><code>ViewPort</code> class represents the logic needed to transform a rectangular area of a map |
|
76 |
* to the available area in screen to display it.</p> |
|
77 |
* |
|
78 |
* <p>Includes an affine transformation, between the rectangular area selected of the external map, in its own |
|
79 |
* <i>map coordinates</i>, to the rectangular area available of a view in <i>screen coordinates</i>.</p> |
|
80 |
* |
|
81 |
* <p>Elements: |
|
74 |
* <p> |
|
75 |
* <code>ViewPort</code> class represents the logic needed to transform a |
|
76 |
* rectangular area of a map to the available area in screen to display it. |
|
77 |
* </p> |
|
78 |
* |
|
79 |
* <p> |
|
80 |
* Includes an affine transformation, between the rectangular area selected of |
|
81 |
* the external map, in its own <i>map coordinates</i>, to the rectangular area |
|
82 |
* available of a view in <i>screen coordinates</i>. |
|
83 |
* </p> |
|
84 |
* |
|
85 |
* <p> |
|
86 |
* Elements: |
|
82 | 87 |
* <ul> |
83 | 88 |
* <li><i>extent</i>: the area selected of the map, in <i>map coordinates</i>. |
84 |
* <li><i>imageSize</i>: width and height in pixels (<i>screen coordinates</i>) of the area available |
|
85 |
* in screen to display the area selected of the map. |
|
86 |
* <li><i>adjustedExtent</i>: the area selected must be an scale of <i>imageSize</i>.<br>This implies adapt the |
|
87 |
* extent, preserving and centering it, and adding around the needed area to fill all the image size. That |
|
88 |
* added area will be extracted from the original map, wherever exists, and filled with the background color |
|
89 |
* wherever not. |
|
89 |
* <li><i>imageSize</i>: width and height in pixels (<i>screen coordinates</i>) |
|
90 |
* of the area available in screen to display the area selected of the map. |
|
91 |
* <li><i>adjustedExtent</i>: the area selected must be an scale of |
|
92 |
* <i>imageSize</i>.<br> |
|
93 |
* This implies adapt the extent, preserving and centering it, and adding around |
|
94 |
* the needed area to fill all the image size. That added area will be extracted |
|
95 |
* from the original map, wherever exists, and filled with the background color |
|
96 |
* wherever not. |
|
90 | 97 |
* <li><i>scale</i>: the scale between the adjusted extent and the image size. |
91 |
* <li><i>backColor</i>: the default background color in the view, if there is no map. |
|
98 |
* <li><i>backColor</i>: the default background color in the view, if there is |
|
99 |
* no map. |
|
92 | 100 |
* <li><i>trans</i>: the affine transformation. |
93 | 101 |
* <li><i>proj</i>: map projection used in this view. |
94 | 102 |
* <li><i>distanceUnits</i>: distance measurement units, of data in screen. |
95 | 103 |
* <li><i>mapUnits</i>: measurement units, of data in map. |
96 |
* <li><i>extents</i>: an {@link ExtentHistory ExtentHistory} with the last previous extents. |
|
97 |
* <li><i>offset</i>: position in pixels of the available rectangular area, where start drawing the map. |
|
98 |
* <li><i>dist1pixel</i>: the distance in <i>world coordinates</i> equivalent to 1 pixel in the view with the |
|
99 |
* current extent. |
|
100 |
* <li><i>dist3pixel</i>: the distance in <i>world coordinates</i> equivalent to 3 pixels in the view with the |
|
101 |
* current extent. |
|
102 |
* <li><i>listeners</i>: list with the {@link ViewPortListener ViewPortListener} registered. |
|
104 |
* <li><i>extents</i>: an {@link ExtentHistory ExtentHistory} with the last |
|
105 |
* previous extents. |
|
106 |
* <li><i>offset</i>: position in pixels of the available rectangular area, |
|
107 |
* where start drawing the map. |
|
108 |
* <li><i>dist1pixel</i>: the distance in <i>world coordinates</i> equivalent to |
|
109 |
* 1 pixel in the view with the current extent. |
|
110 |
* <li><i>dist3pixel</i>: the distance in <i>world coordinates</i> equivalent to |
|
111 |
* 3 pixels in the view with the current extent. |
|
112 |
* <li><i>listeners</i>: list with the {@link ViewPortListener ViewPortListener} |
|
113 |
* registered. |
|
103 | 114 |
* </ul> |
104 | 115 |
* </p> |
105 |
* |
|
116 |
*
|
|
106 | 117 |
* @author Vicente Caballero Navarro |
107 | 118 |
*/ |
108 | 119 |
public class ViewPort { |
109 |
// /** |
|
110 |
// * <p>Metric unit or length equal to 1000 meters.</p> |
|
111 |
// */ |
|
112 |
// public static int KILOMETROS = 0; |
|
113 |
// |
|
114 |
// /** |
|
115 |
// * <p>The base unit of length in the International System of Units that is equal to the distance |
|
116 |
// * traveled by light in a vacuum in {frac;1;299,792,458} second or to about 39.37 inches.</p> |
|
117 |
// */ |
|
118 |
// public static int METROS = 1; |
|
119 |
// |
|
120 |
// /** |
|
121 |
// * <p>Metric unit or length equal to 0'01 meters.</p> |
|
122 |
// */ |
|
123 |
// public static int CENTIMETRO = 2; |
|
124 |
// |
|
125 |
// /** |
|
126 |
// * <p>Metric unit or length equal to 0'001 meters.</p> |
|
127 |
// */ |
|
128 |
// public static int MILIMETRO = 3; |
|
129 |
// |
|
130 |
// /** |
|
131 |
// * <p>The international statute mile by international agreement. It is defined to be precisely |
|
132 |
// * 1,760 international yards (by definition, 0.9144 m each) and is therefore exactly 1,609.344 |
|
133 |
// * metres (1.609344 km).</p> |
|
134 |
// */ |
|
135 |
// public static int MILLAS = 4; |
|
136 |
// |
|
137 |
// /** |
|
138 |
// * <p>Unit of length equal in the United States to 0.9144 meter.</p> |
|
139 |
// */ |
|
140 |
// public static int YARDAS = 5; |
|
141 |
// |
|
142 |
// /** |
|
143 |
// * <p>Any of various units of length based on the length of the human foot; especially : |
|
144 |
// * a unit equal to 1/3 yard and comprising 12 inches.</p> |
|
145 |
// */ |
|
146 |
// public static int PIES = 6; |
|
147 |
// |
|
148 |
// /** |
|
149 |
// * <p>Unit of length equal to 1/36 yard.</p> |
|
150 |
// */ |
|
151 |
// public static int PULGADAS = 7; |
|
152 |
// |
|
153 |
// /** |
|
154 |
// * <p>Grades according the current projection.</p> |
|
155 |
// */ |
|
156 |
// public static int GRADOS = 8; |
|
157 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
158 |
private static final Logger logger = LoggerFactory.getLogger(GeometryManager.class); |
|
159 |
|
|
120 |
// /** |
|
121 |
// * <p>Metric unit or length equal to 1000 meters.</p> |
|
122 |
// */ |
|
123 |
// public static int KILOMETROS = 0; |
|
124 |
// |
|
125 |
// /** |
|
126 |
// * <p>The base unit of length in the International System of Units that is |
|
127 |
// equal to the distance |
|
128 |
// * traveled by light in a vacuum in {frac;1;299,792,458} second or to |
|
129 |
// about 39.37 inches.</p> |
|
130 |
// */ |
|
131 |
// public static int METROS = 1; |
|
132 |
// |
|
133 |
// /** |
|
134 |
// * <p>Metric unit or length equal to 0'01 meters.</p> |
|
135 |
// */ |
|
136 |
// public static int CENTIMETRO = 2; |
|
137 |
// |
|
138 |
// /** |
|
139 |
// * <p>Metric unit or length equal to 0'001 meters.</p> |
|
140 |
// */ |
|
141 |
// public static int MILIMETRO = 3; |
|
142 |
// |
|
143 |
// /** |
|
144 |
// * <p>The international statute mile by international agreement. It is |
|
145 |
// defined to be precisely |
|
146 |
// * 1,760 international yards (by definition, 0.9144 m each) and is |
|
147 |
// therefore exactly 1,609.344 |
|
148 |
// * metres (1.609344 km).</p> |
|
149 |
// */ |
|
150 |
// public static int MILLAS = 4; |
|
151 |
// |
|
152 |
// /** |
|
153 |
// * <p>Unit of length equal in the United States to 0.9144 meter.</p> |
|
154 |
// */ |
|
155 |
// public static int YARDAS = 5; |
|
156 |
// |
|
157 |
// /** |
|
158 |
// * <p>Any of various units of length based on the length of the human |
|
159 |
// foot; especially : |
|
160 |
// * a unit equal to 1/3 yard and comprising 12 inches.</p> |
|
161 |
// */ |
|
162 |
// public static int PIES = 6; |
|
163 |
// |
|
164 |
// /** |
|
165 |
// * <p>Unit of length equal to 1/36 yard.</p> |
|
166 |
// */ |
|
167 |
// public static int PULGADAS = 7; |
|
168 |
// |
|
169 |
// /** |
|
170 |
// * <p>Grades according the current projection.</p> |
|
171 |
// */ |
|
172 |
// public static int GRADOS = 8; |
|
173 |
private static final GeometryManager geomManager = GeometryLocator |
|
174 |
.getGeometryManager(); |
|
175 |
private static final Logger logger = LoggerFactory |
|
176 |
.getLogger(GeometryManager.class); |
|
177 |
|
|
160 | 178 |
/** |
161 |
* <p>Screen resolution in <i>dots-per-inch</i>. Useful to calculate the geographic scale of the view.</p> |
|
162 |
* |
|
179 |
* <p> |
|
180 |
* Screen resolution in <i>dots-per-inch</i>. Useful to calculate the |
|
181 |
* geographic scale of the view. |
|
182 |
* </p> |
|
183 |
* |
|
163 | 184 |
* @see Toolkit#getScreenResolution() |
164 | 185 |
* @see #getScale() |
165 | 186 |
*/ |
166 | 187 |
private static int dpi = java.awt.Toolkit.getDefaultToolkit() |
167 |
.getScreenResolution();
|
|
188 |
.getScreenResolution(); |
|
168 | 189 |
|
169 | 190 |
/** |
170 |
* <p>Area selected by user using some tool.</p> |
|
171 |
* |
|
172 |
* <p>When the zoom changes (for instance when using the zoom in or zoom out tools, |
|
173 |
* but also zooming to a selected feature or shape) the extent that covers that |
|
174 |
* area is the value returned by this method. It is not the actual area shown |
|
175 |
* in the view because it does not care about the aspect ratio of the available |
|
176 |
* area. However, any part of the real world contained in this extent is shown |
|
177 |
* in the view. |
|
191 |
* <p> |
|
192 |
* Area selected by user using some tool. |
|
178 | 193 |
* </p> |
194 |
* |
|
179 | 195 |
* <p> |
180 |
* Probably this is not what you are looking for. If you are looking for |
|
181 |
* the complete extent currently shown, you must use {@linkplain #getAdjustedExtent()} method |
|
182 |
* which returns the extent that contains this one but regarding the current |
|
183 |
* view's aspect ratio. |
|
196 |
* When the zoom changes (for instance when using the zoom in or zoom out |
|
197 |
* tools, but also zooming to a selected feature or shape) the extent that |
|
198 |
* covers that area is the value returned by this method. It is not the |
|
199 |
* actual area shown in the view because it does not care about the aspect |
|
200 |
* ratio of the available area. However, any part of the real world |
|
201 |
* contained in this extent is shown in the view. |
|
184 | 202 |
* </p> |
185 |
* |
|
203 |
* <p> |
|
204 |
* Probably this is not what you are looking for. If you are looking for the |
|
205 |
* complete extent currently shown, you must use |
|
206 |
* {@linkplain #getAdjustedExtent()} method which returns the extent that |
|
207 |
* contains this one but regarding the current view's aspect ratio. |
|
208 |
* </p> |
|
209 |
* |
|
186 | 210 |
* @see #getExtent() |
187 | 211 |
* @see #setEnvelope(Envelope) |
188 | 212 |
*/ |
189 | 213 |
protected Rectangle2D extent; |
190 | 214 |
|
191 | 215 |
/** |
192 |
* <p>Location and dimensions of the extent adjusted to the image size.</p> |
|
193 |
* |
|
216 |
* <p> |
|
217 |
* Location and dimensions of the extent adjusted to the image size. |
|
218 |
* </p> |
|
219 |
* |
|
194 | 220 |
* @see #getAdjustedExtent() |
195 | 221 |
*/ |
196 | 222 |
protected Rectangle2D adjustedExtent; |
197 | 223 |
|
198 |
|
|
199 | 224 |
/** |
200 |
* Draw version of the context. It's used for know when de componend has |
|
201 |
* changed any visualization property |
|
202 |
* |
|
203 |
* @see getDrawVersion |
|
204 |
* @see updateDrawVersion |
|
205 |
*/ |
|
206 |
private long drawVersion= 0L; |
|
207 |
|
|
208 |
/** |
|
209 |
* <p>History with the last extents of the view.</p> |
|
210 |
* |
|
225 |
* Draw version of the context. It's used for know when de componend has |
|
226 |
* changed any visualization property |
|
227 |
* |
|
228 |
* @see getDrawVersion |
|
229 |
* @see updateDrawVersion |
|
230 |
*/ |
|
231 |
private long drawVersion = 0L; |
|
232 |
|
|
233 |
/** |
|
234 |
* <p> |
|
235 |
* History with the last extents of the view. |
|
236 |
* </p> |
|
237 |
* |
|
211 | 238 |
* @see #setPreviousExtent() |
212 | 239 |
* @see #getExtents() |
213 | 240 |
*/ |
214 | 241 |
protected ExtentHistory extents = new ExtentHistory(); |
215 | 242 |
|
216 | 243 |
/** |
217 |
* <p>Size in <i>screen coordinates</i> of the rectangle where the image is displayed.</p> |
|
218 |
* <p>Used by {@linkplain #calculateAffineTransform()} to calculate:<br> |
|
219 |
* |
|
244 |
* <p> |
|
245 |
* Size in <i>screen coordinates</i> of the rectangle where the image is |
|
246 |
* displayed. |
|
247 |
* </p> |
|
248 |
* <p> |
|
249 |
* Used by {@linkplain #calculateAffineTransform()} to calculate:<br> |
|
250 |
* |
|
220 | 251 |
* <ul> |
221 | 252 |
* <li>The new {@link #scale scale} . |
222 | 253 |
* <li>The new {@link #adjustedExtent adjustableExtent} . |
223 | 254 |
* <li>The new {@link #trans trans} . |
224 |
* <li>The new real world coordinates equivalent to 1 pixel ({@link #dist1pixel dist1pixel}) . |
|
225 |
* <li>The new real world coordinates equivalent to 3 pixels ({@link #dist3pixel dist3pixel}) . |
|
255 |
* <li>The new real world coordinates equivalent to 1 pixel ( |
|
256 |
* {@link #dist1pixel dist1pixel}) . |
|
257 |
* <li>The new real world coordinates equivalent to 3 pixels ( |
|
258 |
* {@link #dist3pixel dist3pixel}) . |
|
226 | 259 |
* </ul> |
227 | 260 |
* </p> |
228 |
* |
|
261 |
*
|
|
229 | 262 |
* @see #getImageSize() |
230 | 263 |
* @see #getImageHeight() |
231 | 264 |
* @see #getImageWidth() |
... | ... | |
234 | 267 |
private Dimension imageSize; |
235 | 268 |
|
236 | 269 |
/** |
237 |
* <p>the affine transformation between the {@link #extent extent} in <i>map 2D coordinates</i> to |
|
238 |
* the image area in the screen, in <i>screen 2D coordinates</i> (pixels).</p> |
|
239 |
* |
|
270 |
* <p> |
|
271 |
* the affine transformation between the {@link #extent extent} in <i>map 2D |
|
272 |
* coordinates</i> to the image area in the screen, in <i>screen 2D |
|
273 |
* coordinates</i> (pixels). |
|
274 |
* </p> |
|
275 |
* |
|
240 | 276 |
* @see AffineTransform |
241 |
* |
|
277 |
*
|
|
242 | 278 |
* @see #getAffineTransform() |
243 | 279 |
* @see #setAffineTransform(AffineTransform) |
244 | 280 |
* @see #calculateAffineTransform() |
... | ... | |
246 | 282 |
private AffineTransform trans = new AffineTransform(); |
247 | 283 |
|
248 | 284 |
/** |
249 |
* <p>Measurement unit used for measuring distances and displaying information.</p> |
|
250 |
* |
|
285 |
* <p> |
|
286 |
* Measurement unit used for measuring distances and displaying information. |
|
287 |
* </p> |
|
288 |
* |
|
251 | 289 |
* @see #getDistanceUnits() |
252 | 290 |
* @see #setDistanceUnits(int) |
253 | 291 |
*/ |
254 | 292 |
private int distanceUnits = 1; |
255 | 293 |
/** |
256 |
* <p>Measurement unit used for measuring areas and displaying information.</p> |
|
257 |
* |
|
294 |
* <p> |
|
295 |
* Measurement unit used for measuring areas and displaying information. |
|
296 |
* </p> |
|
297 |
* |
|
258 | 298 |
* @see #getDistanceArea() |
259 | 299 |
* @see #setDistanceArea(int) |
260 | 300 |
*/ |
261 | 301 |
private int distanceArea = 1; |
262 | 302 |
/** |
263 |
* <p>Measurement unit used by this view port for the map.</p> |
|
264 |
* |
|
303 |
* <p> |
|
304 |
* Measurement unit used by this view port for the map. |
|
305 |
* </p> |
|
306 |
* |
|
265 | 307 |
* @see #getMapUnits() |
266 | 308 |
* @see #setMapUnits(int) |
267 | 309 |
*/ |
268 | 310 |
private int mapUnits = 1; |
269 | 311 |
|
270 | 312 |
/** |
271 |
* <p>Array with the {@link ViewPortListener ViewPortListener}s registered to this view port.</p> |
|
272 |
* |
|
313 |
* <p> |
|
314 |
* Array with the {@link ViewPortListener ViewPortListener}s registered to |
|
315 |
* this view port. |
|
316 |
* </p> |
|
317 |
* |
|
273 | 318 |
* @see #addViewPortListener(ViewPortListener) |
274 | 319 |
* @see #removeViewPortListener(ViewPortListener) |
275 | 320 |
*/ |
276 | 321 |
private ArrayList listeners = new ArrayList(); |
277 | 322 |
|
278 | 323 |
/** |
279 |
* <p>The offset is the position where start drawing the map.</p> |
|
280 |
* <p>The offset of a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s <i>View</i> is |
|
281 |
* always (0, 0) because the drawing area fits with the full window area. But in |
|
282 |
* a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s <i>Layout</i> it's up to the place where |
|
283 |
* the <code>FFrameView</code> is located.</p> |
|
284 |
* |
|
324 |
* <p> |
|
325 |
* The offset is the position where start drawing the map. |
|
326 |
* </p> |
|
327 |
* <p> |
|
328 |
* The offset of a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s |
|
329 |
* <i>View</i> is always (0, 0) because the drawing area fits with the full |
|
330 |
* window area. But in a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s |
|
331 |
* <i>Layout</i> it's up to the place where the <code>FFrameView</code> is |
|
332 |
* located. |
|
333 |
* </p> |
|
334 |
* |
|
285 | 335 |
* @see #getOffset() |
286 | 336 |
* @see #setOffset(Point2D) |
287 | 337 |
*/ |
288 | 338 |
private Point2D offset = new Point2D.Double(0, 0); |
289 | 339 |
|
290 | 340 |
/** |
291 |
* <p>Clipping area.</p> |
|
341 |
* <p> |
|
342 |
* Clipping area. |
|
343 |
* </p> |
|
292 | 344 |
*/ |
293 | 345 |
private Rectangle2D clip; |
294 | 346 |
|
295 | 347 |
/** |
296 |
* <p>Background color of this view.</p> |
|
297 |
* |
|
348 |
* <p> |
|
349 |
* Background color of this view. |
|
350 |
* </p> |
|
351 |
* |
|
298 | 352 |
* @see #getBackColor() |
299 | 353 |
* @see #setBackColor(Color) |
300 | 354 |
*/ |
301 |
private Color backColor = null; //Color.WHITE; |
|
355 |
private Color backColor = null; // Color.WHITE;
|
|
302 | 356 |
|
303 | 357 |
/** |
304 |
* <p>Information about the map projection used in this view.</p> |
|
305 |
* |
|
358 |
* <p> |
|
359 |
* Information about the map projection used in this view. |
|
360 |
* </p> |
|
361 |
* |
|
306 | 362 |
* @see #getProjection() |
307 | 363 |
* @see #setProjection(IProjection) |
308 | 364 |
*/ |
309 | 365 |
private IProjection proj; |
310 | 366 |
|
311 | 367 |
/** |
312 |
* <p>Represents the distance in <i>world coordinates</i> equivalent to 1 pixel in the view with the current extent.</p> |
|
313 |
* |
|
368 |
* <p> |
|
369 |
* Represents the distance in <i>world coordinates</i> equivalent to 1 pixel |
|
370 |
* in the view with the current extent. |
|
371 |
* </p> |
|
372 |
* |
|
314 | 373 |
* @see #getDist1pixel() |
315 | 374 |
* @see #setDist1pixel(double) |
316 | 375 |
*/ |
317 | 376 |
private double dist1pixel; |
318 | 377 |
|
319 | 378 |
/** |
320 |
* <p>Represents the distance in <i>world coordinates</i> equivalent to 3 pixels in the view with the current extent.</p> |
|
321 |
* |
|
379 |
* <p> |
|
380 |
* Represents the distance in <i>world coordinates</i> equivalent to 3 |
|
381 |
* pixels in the view with the current extent. |
|
382 |
* </p> |
|
383 |
* |
|
322 | 384 |
* @see #getDist3pixel() |
323 | 385 |
* @see #setDist3pixel(double) |
324 | 386 |
*/ |
325 | 387 |
private double dist3pixel; |
326 | 388 |
|
327 | 389 |
/** |
328 |
* <p>Ratio between the size of <code>imageSize</code> and <code>extent</code>:<br> <i><pre>min{(imageSize.getHeight()/extent.getHeight(), imageSize.getWidth()/extent.getWidth())}</pre></i></p> |
|
390 |
* <p> |
|
391 |
* Ratio between the size of <code>imageSize</code> and <code>extent</code>: |
|
392 |
* <br> |
|
393 |
* <i> |
|
394 |
* |
|
395 |
* <pre> |
|
396 |
* min{(imageSize.getHeight()/extent.getHeight(), imageSize.getWidth()/extent.getWidth())} |
|
397 |
* </pre> |
|
398 |
* |
|
399 |
* </i> |
|
400 |
* </p> |
|
329 | 401 |
*/ |
330 | 402 |
private double scale; |
331 | 403 |
|
332 | 404 |
/** |
333 |
* <p>Clipping area.</p> |
|
334 |
* |
|
405 |
* <p> |
|
406 |
* Clipping area. |
|
407 |
* </p> |
|
408 |
* |
|
335 | 409 |
* @see #setClipRect(Rectangle2D) |
336 | 410 |
*/ |
337 | 411 |
private Rectangle2D cliprect; |
338 | 412 |
|
339 | 413 |
/** |
340 |
* <p>Enables or disables the <i>"adjustable extent"</i> mode.</p> |
|
341 |
* |
|
342 | 414 |
* <p> |
415 |
* Enables or disables the <i>"adjustable extent"</i> mode. |
|
416 |
* </p> |
|
417 |
* |
|
418 |
* <p> |
|
343 | 419 |
* When calculates the affine transform, if |
344 | 420 |
* <ul> |
345 |
* <li><i>enabled</i>: the new <code>adjustedExtent</code> will have the (X, Y) coordinates of the <code>extent</code> and |
|
346 |
* an area that will be an scale of the image size. That area will have different |
|
347 |
* height or width (not both) of the extent according the least ratio (height or width) in <pre>image.size/extent.size"</pre>. |
|
348 |
* <li><i>disabled</i>: the new <code>adjustedExtent</code> will be like <code>extent</code>. |
|
421 |
* <li><i>enabled</i>: the new <code>adjustedExtent</code> will have the (X, |
|
422 |
* Y) coordinates of the <code>extent</code> and an area that will be an |
|
423 |
* scale of the image size. That area will have different height or width |
|
424 |
* (not both) of the extent according the least ratio (height or width) in |
|
425 |
* |
|
426 |
* <pre> |
|
427 |
* image.size/extent.size" |
|
428 |
* </pre>. |
|
429 |
* <li><i>disabled</i>: the new <code>adjustedExtent</code> will be like |
|
430 |
* <code>extent</code>. |
|
349 | 431 |
* </ul> |
350 | 432 |
* </p> |
351 |
* |
|
433 |
*
|
|
352 | 434 |
* @see #setAdjustable(boolean) |
353 | 435 |
*/ |
354 |
private boolean adjustableExtent=true;
|
|
436 |
private boolean adjustableExtent = true;
|
|
355 | 437 |
|
356 | 438 |
/** |
357 |
* <p>Creates a new view port with the information of the projection in <code>proj</code> argument, and |
|
358 |
* default configuration:</p> |
|
359 | 439 |
* <p> |
440 |
* Creates a new view port with the information of the projection in |
|
441 |
* <code>proj</code> argument, and default configuration: |
|
442 |
* </p> |
|
443 |
* <p> |
|
360 | 444 |
* <ul> |
361 |
* <li><i><code>distanceUnits</code></i> = meters
|
|
362 |
* <li><i><code>mapUnits</code></i> = meters
|
|
363 |
* <li><i><code>backColor</code></i> = <i>undefined</i>
|
|
364 |
* <li><i><code>offset</code></i> = <code>new Point2D.Double(0, 0);</code>
|
|
445 |
* <li><i><code>distanceUnits</code></i> = meters |
|
446 |
* <li><i><code>mapUnits</code></i> = meters |
|
447 |
* <li><i><code>backColor</code></i> = <i>undefined</i> |
|
448 |
* <li><i><code>offset</code></i> = <code>new Point2D.Double(0, 0);</code> |
|
365 | 449 |
* </ul> |
366 | 450 |
* </p> |
367 |
* |
|
368 |
* @param proj information of the projection for this view port |
|
451 |
* |
|
452 |
* @param proj |
|
453 |
* information of the projection for this view port |
|
369 | 454 |
*/ |
370 | 455 |
public ViewPort(IProjection proj) { |
371 | 456 |
// Por defecto |
... | ... | |
373 | 458 |
} |
374 | 459 |
|
375 | 460 |
/** |
376 |
* <p>Changes the status of the <i>"adjustable extent"</i> option to enabled or disabled.</p> |
|
377 |
* |
|
378 |
* <p>If view port isn't adjustable, won't bear in mind the aspect ratio of the available rectangular area to |
|
379 |
* calculate the affine transform from the original map in real coordinates. (Won't scale the image to adapt |
|
380 |
* it to the available rectangular area).</p> |
|
381 |
* |
|
461 |
* <p> |
|
462 |
* Changes the status of the <i>"adjustable extent"</i> option to enabled or |
|
463 |
* disabled. |
|
464 |
* </p> |
|
465 |
* |
|
466 |
* <p> |
|
467 |
* If view port isn't adjustable, won't bear in mind the aspect ratio of the |
|
468 |
* available rectangular area to calculate the affine transform from the |
|
469 |
* original map in real coordinates. (Won't scale the image to adapt it to |
|
470 |
* the available rectangular area). |
|
471 |
* </p> |
|
472 |
* |
|
382 | 473 |
* @param boolean the boolean to be set |
383 | 474 |
*/ |
384 | 475 |
public void setAdjustable(boolean adjustable) { |
385 |
if (adjustable == adjustableExtent){
|
|
386 |
return; |
|
476 |
if (adjustable == adjustableExtent) {
|
|
477 |
return;
|
|
387 | 478 |
} |
388 | 479 |
adjustableExtent = adjustable; |
389 |
this.updateDrawVersion(); |
|
480 |
this.updateDrawVersion();
|
|
390 | 481 |
} |
391 | 482 |
|
392 | 483 |
/** |
393 |
* <p>Appends the specified {@link ViewPortListener ViewPortListener} listener if weren't.</p> |
|
394 |
* |
|
395 |
* @param arg0 the listener to add |
|
396 |
* |
|
484 |
* <p> |
|
485 |
* Appends the specified {@link ViewPortListener ViewPortListener} listener |
|
486 |
* if weren't. |
|
487 |
* </p> |
|
488 |
* |
|
489 |
* @param arg0 |
|
490 |
* the listener to add |
|
491 |
* |
|
397 | 492 |
* @return <code>true</code> if has been added successfully |
398 |
* |
|
493 |
*
|
|
399 | 494 |
* @see #removeViewPortListener(ViewPortListener) |
400 | 495 |
*/ |
401 | 496 |
public boolean addViewPortListener(ViewPortListener arg0) { |
... | ... | |
406 | 501 |
} |
407 | 502 |
|
408 | 503 |
/** |
409 |
* <p>Removes the specified {@link ViewPortListener ViewPortListener} listener, if existed.</p> |
|
410 |
* |
|
411 |
* @param arg0 the listener to remove |
|
412 |
* |
|
504 |
* <p> |
|
505 |
* Removes the specified {@link ViewPortListener ViewPortListener} listener, |
|
506 |
* if existed. |
|
507 |
* </p> |
|
508 |
* |
|
509 |
* @param arg0 |
|
510 |
* the listener to remove |
|
511 |
* |
|
413 | 512 |
* @return <code>true</code> if the contained the specified listener. |
414 |
* |
|
513 |
*
|
|
415 | 514 |
* @see #addViewPortListener(ViewPortListener) |
416 | 515 |
*/ |
417 | 516 |
public boolean removeViewPortListener(ViewPortListener arg0) { |
... | ... | |
419 | 518 |
} |
420 | 519 |
|
421 | 520 |
/** |
422 |
* <p>Converts and returns the distance <code>d</code>, that is in <i>map |
|
423 |
* coordinates</i> to <i>screen coordinates</i> using a <i>delta transform</i> with |
|
424 |
* the transformation affine information in the {@link #trans #trans} attribute.</p> |
|
425 |
* |
|
426 |
* @param d distance in <i>map coordinates</i> |
|
427 |
* |
|
521 |
* <p> |
|
522 |
* Converts and returns the distance <code>d</code>, that is in <i>map |
|
523 |
* coordinates</i> to <i>screen coordinates</i> using a <i>delta |
|
524 |
* transform</i> with the transformation affine information in the |
|
525 |
* {@link #trans #trans} attribute. |
|
526 |
* </p> |
|
527 |
* |
|
528 |
* @param d |
|
529 |
* distance in <i>map coordinates</i> |
|
530 |
* |
|
428 | 531 |
* @return distance equivalent in <i>screen coordinates</i> |
429 |
* |
|
532 |
*
|
|
430 | 533 |
* @see #toMapDistance(int) |
431 | 534 |
* @see AffineTransform#deltaTransform(Point2D, Point2D)S |
432 | 535 |
*/ |
... | ... | |
444 | 547 |
} |
445 | 548 |
|
446 | 549 |
/** |
447 |
* <p>Converts and returns the 2D point <code>(x,y)</code>, that is in <i>map |
|
448 |
* coordinates</i> to <i>screen coordinates</i> (pixels) using |
|
449 |
* the affine transformation in the {@link #trans #trans} attribute.</p> |
|
450 |
* |
|
451 |
* @param x the <code>x</code> <i>map coordinate</i> of a 2D point |
|
452 |
* @param y the <code>y</code> <i>map coordinate</i> of a 2D point |
|
453 |
* |
|
550 |
* <p> |
|
551 |
* Converts and returns the 2D point <code>(x,y)</code>, that is in <i>map |
|
552 |
* coordinates</i> to <i>screen coordinates</i> (pixels) using the affine |
|
553 |
* transformation in the {@link #trans #trans} attribute. |
|
554 |
* </p> |
|
555 |
* |
|
556 |
* @param x |
|
557 |
* the <code>x</code> <i>map coordinate</i> of a 2D point |
|
558 |
* @param y |
|
559 |
* the <code>y</code> <i>map coordinate</i> of a 2D point |
|
560 |
* |
|
454 | 561 |
* @return 2D point equivalent in <i>screen coordinates</i> (pixels) |
455 |
* |
|
562 |
*
|
|
456 | 563 |
* @see #fromMapPoint(Point2D) |
457 | 564 |
* @see AffineTransform#transform(Point2D, Point2D) |
458 | 565 |
*/ |
... | ... | |
470 | 577 |
} |
471 | 578 |
|
472 | 579 |
/** |
473 |
* <p>Converts and returns the 2D point argument, that is in <i>map |
|
474 |
* coordinates</i> to <i>screen coordinates</i> (pixels) using |
|
475 |
* the affine transformation in the {@link #trans #trans} attribute.</p> |
|
476 |
* |
|
477 |
* @param point the 2D point in <i>map coordinates</i> |
|
478 |
* |
|
580 |
* <p> |
|
581 |
* Converts and returns the 2D point argument, that is in <i>map |
|
582 |
* coordinates</i> to <i>screen coordinates</i> (pixels) using the affine |
|
583 |
* transformation in the {@link #trans #trans} attribute. |
|
584 |
* </p> |
|
585 |
* |
|
586 |
* @param point |
|
587 |
* the 2D point in <i>map coordinates</i> |
|
588 |
* |
|
479 | 589 |
* @return 2D point equivalent in <i>screen coordinates</i> (pixels) |
480 |
* |
|
590 |
*
|
|
481 | 591 |
* @see #toMapPoint(Point2D) |
482 | 592 |
* @see #fromMapPoint(double, double) |
483 | 593 |
*/ |
... | ... | |
486 | 596 |
} |
487 | 597 |
|
488 | 598 |
/** |
489 |
* <p>Converts and returns the 2D point <code>(x,y)</code>, that is in <i>screen coordinates</i> |
|
490 |
* (pixels) to <i>map coordinates</i> using |
|
491 |
* the affine transformation in the {@link #trans #trans} attribute.</p> |
|
492 |
* |
|
493 |
* @param x the <code>x</code> <i>screen coordinate</i> of a 2D point |
|
494 |
* @param y the <code>y</code> <i>screen coordinate</i> of a 2D point |
|
495 |
* |
|
599 |
* <p> |
|
600 |
* Converts and returns the 2D point <code>(x,y)</code>, that is in |
|
601 |
* <i>screen coordinates</i> (pixels) to <i>map coordinates</i> using the |
|
602 |
* affine transformation in the {@link #trans #trans} attribute. |
|
603 |
* </p> |
|
604 |
* |
|
605 |
* @param x |
|
606 |
* the <code>x</code> <i>screen coordinate</i> of a 2D point |
|
607 |
* @param y |
|
608 |
* the <code>y</code> <i>screen coordinate</i> of a 2D point |
|
609 |
* |
|
496 | 610 |
* @return 2D point equivalent in <i>map coordinates</i> |
497 |
* |
|
611 |
*
|
|
498 | 612 |
* @see #toMapPoint(Point2D) |
499 | 613 |
* @see #fromMapPoint(double, double) |
500 | 614 |
*/ |
... | ... | |
505 | 619 |
} |
506 | 620 |
|
507 | 621 |
/** |
508 |
* <p>Converts and returns the {@link Rectangle2D Rectangle2D}, that is in <i>screen |
|
509 |
* coordinates</i> (pixels) to <i>map coordinates</i> using {@linkplain #toMapDistance(int)}, |
|
510 |
* and {@linkplain #toMapPoint(int, int)}.</p> |
|
511 |
* |
|
512 |
* @param r the 2D rectangle in <i>screen coordinates</i> (pixels) |
|
622 |
* <p> |
|
623 |
* Converts and returns the {@link Rectangle2D Rectangle2D}, that is in |
|
624 |
* <i>screen coordinates</i> (pixels) to <i>map coordinates</i> using |
|
625 |
* {@linkplain #toMapDistance(int)}, and {@linkplain #toMapPoint(int, int)}. |
|
626 |
* </p> |
|
627 |
* |
|
628 |
* @param r |
|
629 |
* the 2D rectangle in <i>screen coordinates</i> (pixels) |
|
513 | 630 |
* @return 2D rectangle equivalent in <i>map coordinates</i> |
514 |
* |
|
631 |
*
|
|
515 | 632 |
* @see #fromMapRectangle(Rectangle2D) |
516 | 633 |
* @see #toMapDistance(int) |
517 | 634 |
* @see #toMapPoint(int, int) |
518 | 635 |
*/ |
519 |
public Rectangle2D toMapRectangle(Rectangle2D r){ |
|
520 |
Rectangle2D rect=new Rectangle2D.Double();
|
|
521 |
Point2D p1=toMapPoint((int)r.getX(),(int)r.getY());
|
|
522 |
Point2D p2=toMapPoint((int)r.getMaxX(),(int)r.getMaxY());
|
|
523 |
rect.setFrameFromDiagonal(p1,p2); |
|
636 |
public Rectangle2D toMapRectangle(Rectangle2D r) {
|
|
637 |
Rectangle2D rect = new Rectangle2D.Double();
|
|
638 |
Point2D p1 = toMapPoint((int) r.getX(), (int) r.getY());
|
|
639 |
Point2D p2 = toMapPoint((int) r.getMaxX(), (int) r.getMaxY());
|
|
640 |
rect.setFrameFromDiagonal(p1, p2);
|
|
524 | 641 |
return rect; |
525 | 642 |
} |
526 | 643 |
|
527 | 644 |
/** |
528 |
* <p>Converts and returns the distance <code>d</code>, that is in <i>screen |
|
529 |
* coordinates</i> to <i>map coordinates</i> using the transformation affine information |
|
530 |
* in the {@link #trans #trans} attribute.</p> |
|
531 |
* |
|
532 |
* @param d distance in pixels |
|
533 |
* |
|
645 |
* <p> |
|
646 |
* Converts and returns the distance <code>d</code>, that is in <i>screen |
|
647 |
* coordinates</i> to <i>map coordinates</i> using the transformation affine |
|
648 |
* information in the {@link #trans #trans} attribute. |
|
649 |
* </p> |
|
650 |
* |
|
651 |
* @param d |
|
652 |
* distance in pixels |
|
653 |
* |
|
534 | 654 |
* @return distance equivalent in <i>map coordinates</i> |
535 |
* |
|
655 |
*
|
|
536 | 656 |
* @see #fromMapDistance(double) |
537 | 657 |
* @see AffineTransform |
538 | 658 |
*/ |
... | ... | |
543 | 663 |
} |
544 | 664 |
|
545 | 665 |
/** |
546 |
* <p>Converts and returns the 2D point argument, that is in <i>screen coordinates</i> |
|
547 |
* (pixels) to <i>map coordinates</i> using the |
|
548 |
* inverse affine transformation of the {@link #trans #trans} attribute.</p> |
|
549 |
* |
|
550 |
* @param pScreen the 2D point in <i>screen coordinates</i> (pixels) |
|
551 |
* |
|
666 |
* <p> |
|
667 |
* Converts and returns the 2D point argument, that is in <i>screen |
|
668 |
* coordinates</i> (pixels) to <i>map coordinates</i> using the inverse |
|
669 |
* affine transformation of the {@link #trans #trans} attribute. |
|
670 |
* </p> |
|
671 |
* |
|
672 |
* @param pScreen |
|
673 |
* the 2D point in <i>screen coordinates</i> (pixels) |
|
674 |
* |
|
552 | 675 |
* @return 2D point equivalent in <i>map coordinates</i> |
553 |
* |
|
676 |
*
|
|
554 | 677 |
* @see #toMapPoint(int, int) |
555 | 678 |
* @see AffineTransform#createInverse() |
556 | 679 |
* @see AffineTransform#transform(Point2D, Point2D) |
... | ... | |
563 | 686 |
at = trans.createInverse(); |
564 | 687 |
at.transform(pScreen, pWorld); |
565 | 688 |
} catch (NoninvertibleTransformException e) { |
566 |
throw new RuntimeException("Non invertible transform Exception",e); |
|
689 |
throw new RuntimeException("Non invertible transform Exception", e);
|
|
567 | 690 |
} |
568 | 691 |
|
569 | 692 |
return pWorld; |
570 | 693 |
} |
571 | 694 |
|
572 | 695 |
/** |
573 |
* <p>Returns the real distance (in <i>world coordinates</i>) at the graphic layers of two 2D points |
|
574 |
* (in <i>map coordinates</i>) of the plane where is selected the <i>extent</i>.</p> |
|
575 |
* <p>If the projection of this view is UTM, considers the Earth curvature.</p> |
|
576 |
* |
|
577 |
* @param pt1 a 2D point in <i>map coordinates</i> |
|
578 |
* @param pt2 another 2D point in <i>map coordinates</i> |
|
579 |
* |
|
696 |
* <p> |
|
697 |
* Returns the real distance (in <i>world coordinates</i>) at the graphic |
|
698 |
* layers of two 2D points (in <i>map coordinates</i>) of the plane where is |
|
699 |
* selected the <i>extent</i>. |
|
700 |
* </p> |
|
701 |
* <p> |
|
702 |
* If the projection of this view is UTM, considers the Earth curvature. |
|
703 |
* </p> |
|
704 |
* |
|
705 |
* @param pt1 |
|
706 |
* a 2D point in <i>map coordinates</i> |
|
707 |
* @param pt2 |
|
708 |
* another 2D point in <i>map coordinates</i> |
|
709 |
* |
|
580 | 710 |
* @return the distance in meters between the two points 2D |
581 |
* |
|
711 |
*
|
|
582 | 712 |
* @see GeoCalcImpl#distanceVincenty(Point2D, Point2D) |
583 | 713 |
*/ |
584 | 714 |
public double distanceWorld(Point2D pt1, Point2D pt2) { |
... | ... | |
586 | 716 |
dist = pt1.distance(pt2); |
587 | 717 |
|
588 | 718 |
if ((proj != null) && !(proj instanceof UTM)) { |
589 |
dist = new GeoCalc(proj).distanceVincenty(proj.toGeo(pt1), |
|
590 |
proj.toGeo(pt2));
|
|
719 |
dist = new GeoCalc(proj).distanceVincenty(proj.toGeo(pt1), proj
|
|
720 |
.toGeo(pt2)); |
|
591 | 721 |
return dist; |
592 | 722 |
} |
593 |
return (dist*MapContext.getDistanceTrans2Meter()[getMapUnits()]);
|
|
723 |
return (dist * MapContext.getDistanceTrans2Meter()[getMapUnits()]);
|
|
594 | 724 |
} |
595 | 725 |
|
596 | 726 |
/** |
597 |
* <p>Sets as extent and adjusted extent of this view port, the previous. Recalculating |
|
598 |
* its parameters.</p> |
|
599 |
* |
|
727 |
* <p> |
|
728 |
* Sets as extent and adjusted extent of this view port, the previous. |
|
729 |
* Recalculating its parameters. |
|
730 |
* </p> |
|
731 |
* |
|
600 | 732 |
* @see #getExtents() |
601 | 733 |
* @see #calculateAffineTransform() |
602 | 734 |
* @deprecated use {@link ViewPort#setPreviousEnvelope()} |
... | ... | |
604 | 736 |
public void setPreviousExtent() { |
605 | 737 |
setPreviousEnvelope(); |
606 | 738 |
} |
607 |
|
|
739 |
|
|
608 | 740 |
/** |
609 |
* <p>Sets as envelope and adjusted envelope of this view port, the previous. Recalculating |
|
610 |
* its parameters.</p> |
|
611 |
* |
|
741 |
* <p> |
|
742 |
* Sets as envelope and adjusted envelope of this view port, the previous. |
|
743 |
* Recalculating its parameters. |
|
744 |
* </p> |
|
745 |
* |
|
612 | 746 |
* @see #getExtents() |
613 | 747 |
* @see #calculateAffineTransform() |
614 | 748 |
*/ |
... | ... | |
616 | 750 |
this.updateDrawVersion(); |
617 | 751 |
extent = extents.removePrev(); |
618 | 752 |
|
619 |
//Calcula la transformaci�n af�n |
|
753 |
// Calcula la transformaci�n af�n
|
|
620 | 754 |
calculateAffineTransform(); |
621 | 755 |
|
622 | 756 |
// Lanzamos los eventos de extent cambiado |
... | ... | |
624 | 758 |
} |
625 | 759 |
|
626 | 760 |
/** |
627 |
* <p>Gets the area selected by user using some tool.</p> |
|
628 |
* |
|
629 |
* <p>When the zoom changes (for instance using the <i>zoom in</i> or <i>zoom out</i> tools, |
|
630 |
* but also zooming to a selected feature or shape) the extent that covers that |
|
631 |
* area is the value returned by this method. It is not the actual area shown |
|
632 |
* because it doesn't care about the aspect ratio of the image size of the view. However, any |
|
633 |
* part of the real world contained in this extent is shown in the view.</p> |
|
634 |
* |
|
635 |
* <p>If you are looking for the complete extent currently shown, you must use the |
|
636 |
* {@linkplain #getAdjustedExtent()} method.</p> |
|
637 |
* |
|
761 |
* <p> |
|
762 |
* Gets the area selected by user using some tool. |
|
763 |
* </p> |
|
764 |
* |
|
765 |
* <p> |
|
766 |
* When the zoom changes (for instance using the <i>zoom in</i> or <i>zoom |
|
767 |
* out</i> tools, but also zooming to a selected feature or shape) the |
|
768 |
* extent that covers that area is the value returned by this method. It is |
|
769 |
* not the actual area shown because it doesn't care about the aspect ratio |
|
770 |
* of the image size of the view. However, any part of the real world |
|
771 |
* contained in this extent is shown in the view. |
|
772 |
* </p> |
|
773 |
* |
|
774 |
* <p> |
|
775 |
* If you are looking for the complete extent currently shown, you must use |
|
776 |
* the {@linkplain #getAdjustedExtent()} method. |
|
777 |
* </p> |
|
778 |
* |
|
638 | 779 |
* @return the current extent |
639 |
* |
|
780 |
*
|
|
640 | 781 |
* @see #setEnvelope(Envelope) |
641 | 782 |
* @see #getAdjustedExtent() |
642 | 783 |
* @see #setPreviousExtent() |
... | ... | |
647 | 788 |
public Rectangle2D getExtent() { |
648 | 789 |
return extent; |
649 | 790 |
} |
650 |
|
|
791 |
|
|
651 | 792 |
/** |
652 |
* <p>Gets the envelope selected by user using some tool.</p> |
|
653 |
* |
|
654 |
* <p>When the zoom changes (for instance using the <i>zoom in</i> or <i>zoom out</i> tools, |
|
655 |
* but also zooming to a selected feature or shape) the envelope that covers that |
|
656 |
* area is the value returned by this method. It is not the actual envelope shown |
|
657 |
* because it doesn't care about the aspect ratio of the image size of the view. However, any |
|
658 |
* part of the real world contained in this envelope is shown in the view.</p> |
|
659 |
* |
|
660 |
* <p>If you are looking for the complete extent currently shown, you must use the |
|
661 |
* {@linkplain #getAdjustedEnvelope()} method.</p> |
|
662 |
* |
|
793 |
* <p> |
|
794 |
* Gets the envelope selected by user using some tool. |
|
795 |
* </p> |
|
796 |
* |
|
797 |
* <p> |
|
798 |
* When the zoom changes (for instance using the <i>zoom in</i> or <i>zoom |
|
799 |
* out</i> tools, but also zooming to a selected feature or shape) the |
|
800 |
* envelope that covers that area is the value returned by this method. It |
|
801 |
* is not the actual envelope shown because it doesn't care about the aspect |
|
802 |
* ratio of the image size of the view. However, any part of the real world |
|
803 |
* contained in this envelope is shown in the view. |
|
804 |
* </p> |
|
805 |
* |
|
806 |
* <p> |
|
807 |
* If you are looking for the complete extent currently shown, you must use |
|
808 |
* the {@linkplain #getAdjustedEnvelope()} method. |
|
809 |
* </p> |
|
810 |
* |
|
663 | 811 |
* @return the current envelope |
664 |
* |
|
812 |
*
|
|
665 | 813 |
* @see #setEnvelope(Envelope) |
666 | 814 |
* @see #getAdjustedEnvelope() |
667 | 815 |
* @see #setPreviousEnvelope() |
668 | 816 |
* @see #getEnvelopes() |
669 | 817 |
*/ |
670 |
public Envelope getEnvelope(){ |
|
818 |
public Envelope getEnvelope() {
|
|
671 | 819 |
try { |
672 |
return geomManager.createEnvelope( |
|
673 |
extent.getMinX(), extent.getMinY(), |
|
674 |
extent.getMaxX(), extent.getMaxY(), |
|
820 |
return geomManager.createEnvelope(extent.getMinX(), extent |
|
821 |
.getMinY(), extent.getMaxX(), extent.getMaxY(), |
|
675 | 822 |
SUBTYPES.GEOM2D); |
676 |
//This class has to use Envelope instead of Rectangle2D. This catch will disappear |
|
823 |
// This class has to use Envelope instead of Rectangle2D. This catch |
|
824 |
// will disappear |
|
677 | 825 |
} catch (CreateEnvelopeException e) { |
678 |
logger.error("Error creating the envelope");
|
|
826 |
logger.error("Error creating the envelope"); |
|
679 | 827 |
} |
680 | 828 |
return null; |
681 | 829 |
} |
682 | 830 |
|
683 | 831 |
/** |
684 |
* <p>Changes the <i>extent</i> and <i>adjusted extent</i> of this view port:<br> |
|
832 |
* <p> |
|
833 |
* Changes the <i>extent</i> and <i>adjusted extent</i> of this view port:<br> |
|
685 | 834 |
* <ul> |
686 | 835 |
* <li>Stores the previous extent. |
687 | 836 |
* <li>Calculates the new extent using <code>r</code>: |
688 |
* <pre>extent = new Rectangle2D.Double(r.getMinX() - 0.1, r.getMinY() - 0.1, r.getWidth() + 0.2, r.getHeight() + 0.2);</pre> |
|
689 |
* <li>Executes {@linkplain #calculateAffineTransform()}: getting the new scale, adjusted extent, affine transformation between |
|
690 |
* map and screen coordinates, the real world coordinates equivalent to 1 pixel, and the real world coordinates equivalent to 3 pixels. |
|
691 |
* <li>Notifies all {@link ViewPortListener ViewPortListener} registered that the extent has changed. |
|
837 |
* |
|
838 |
* <pre> |
|
839 |
* extent = new Rectangle2D.Double(r.getMinX() - 0.1, r.getMinY() - 0.1, r |
|
840 |
* .getWidth() + 0.2, r.getHeight() + 0.2); |
|
841 |
* </pre> |
|
842 |
* |
|
843 |
* <li>Executes {@linkplain #calculateAffineTransform()}: getting the new |
|
844 |
* scale, adjusted extent, affine transformation between map and screen |
|
845 |
* coordinates, the real world coordinates equivalent to 1 pixel, and the |
|
846 |
* real world coordinates equivalent to 3 pixels. |
|
847 |
* <li>Notifies all {@link ViewPortListener ViewPortListener} registered |
|
848 |
* that the extent has changed. |
|
692 | 849 |
* </ul> |
693 | 850 |
* </p> |
694 |
* |
|
695 |
* @param r the new extent |
|
696 |
* |
|
851 |
* |
|
852 |
* @param r |
|
853 |
* the new extent |
|
854 |
* |
|
697 | 855 |
* @see #getExtent() |
698 | 856 |
* @see #getExtents() |
699 | 857 |
* @see #calculateAffineTransform() |
700 | 858 |
* @see #setPreviousExtent() |
701 | 859 |
*/ |
702 | 860 |
public void setEnvelope(Envelope r) { |
703 |
Rectangle2D newExtent=null;
|
|
704 |
//Esto comprueba que el extent no es de anchura o altura = "0" |
|
705 |
//y si es as� lo redimensiona. |
|
706 |
if (r!=null) {
|
|
861 |
Rectangle2D newExtent = null;
|
|
862 |
// Esto comprueba que el extent no es de anchura o altura = "0"
|
|
863 |
// y si es as� lo redimensiona.
|
|
864 |
if (r != null) {
|
|
707 | 865 |
if ((r.getMaximum(0) - r.getMinimum(0) == 0) |
708 | 866 |
|| (r.getMaximum(1) - r.getMinimum(1) == 0)) { |
709 |
newExtent = new Rectangle2D.Double(r.getMinimum(0) - 0.1, |
|
710 |
r.getMinimum(1) - 0.1, r.getMaximum(0)-r.getMinimum(0) + 0.2, r.getMaximum(1)-r.getMinimum(1) + 0.2); |
|
867 |
newExtent = new Rectangle2D.Double(r.getMinimum(0) - 0.1, r |
|
868 |
.getMinimum(1) - 0.1, r.getMaximum(0) - r.getMinimum(0) |
|
869 |
+ 0.2, r.getMaximum(1) - r.getMinimum(1) + 0.2); |
|
711 | 870 |
} else { |
712 |
newExtent = new Rectangle2D.Double(r.getMinimum(0),r.getMinimum(1),Math.abs(r.getMaximum(0)-r.getMinimum(0)),Math.abs(r.getMaximum(1)-r.getMinimum(1))); |
|
871 |
newExtent = new Rectangle2D.Double(r.getMinimum(0), r |
|
872 |
.getMinimum(1), Math.abs(r.getMaximum(0) |
|
873 |
- r.getMinimum(0)), Math.abs(r.getMaximum(1) |
|
874 |
- r.getMinimum(1))); |
|
713 | 875 |
} |
714 | 876 |
} |
715 | 877 |
|
716 |
if (this.extent != null && this.extent.equals(newExtent)){ |
|
878 |
if (this.extent != null && this.extent.equals(newExtent)) {
|
|
717 | 879 |
return; |
718 | 880 |
} |
719 | 881 |
if (extent != null) { |
... | ... | |
722 | 884 |
this.updateDrawVersion(); |
723 | 885 |
this.extent = newExtent; |
724 | 886 |
|
725 |
//Calcula la transformaci�n af�n |
|
887 |
// Calcula la transformaci�n af�n
|
|
726 | 888 |
calculateAffineTransform(); |
727 | 889 |
|
728 | 890 |
// Lanzamos los eventos de extent cambiado |
... | ... | |
730 | 892 |
} |
731 | 893 |
|
732 | 894 |
/** |
733 |
* <p>Changes the <i>extent</i> and <i>adjusted extent</i> of this view port:<br> |
|
895 |
* <p> |
|
896 |
* Changes the <i>extent</i> and <i>adjusted extent</i> of this view port:<br> |
|
734 | 897 |
* <ul> |
735 |
* <li>Executes {@linkplain #calculateAffineTransform()}: getting the new scale, adjusted extent, affine transformation between |
|
736 |
* map and screen coordinates, the real world coordinates equivalent to 1 pixel, and the real world coordinates equivalent to 3 pixels. |
|
737 |
* <li>Notifies to all {@link ViewPortListener ViewPortListener} registered that the extent has changed. |
|
898 |
* <li>Executes {@linkplain #calculateAffineTransform()}: getting the new |
|
899 |
* scale, adjusted extent, affine transformation between map and screen |
|
900 |
* coordinates, the real world coordinates equivalent to 1 pixel, and the |
|
901 |
* real world coordinates equivalent to 3 pixels. |
|
902 |
* <li>Notifies to all {@link ViewPortListener ViewPortListener} registered |
|
903 |
* that the extent has changed. |
|
738 | 904 |
* </ul> |
739 | 905 |
* </p> |
740 |
* |
|
906 |
*
|
|
741 | 907 |
* @see #setEnvelope(Envelope) |
742 | 908 |
* @see #calculateAffineTransform() |
743 | 909 |
*/ |
744 | 910 |
public void refreshExtent() { |
745 |
//this.scale = scale; |
|
911 |
// this.scale = scale;
|
|
746 | 912 |
|
747 |
//Calcula la transformaci�n af�n |
|
913 |
// Calcula la transformaci�n af�n
|
|
748 | 914 |
calculateAffineTransform(); |
749 | 915 |
|
750 | 916 |
// Lanzamos los eventos de extent cambiado |
... | ... | |
752 | 918 |
} |
753 | 919 |
|
754 | 920 |
/** |
755 |
* <p>Calculates and returns using the current projection of this view port, the scale that |
|
756 |
* is the extent in <i>screen coordinates</i> from the image in <i>map coordinates</i>.</p> |
|
757 |
* |
|
921 |
* <p> |
|
922 |
* Calculates and returns using the current projection of this view port, |
|
923 |
* the scale that is the extent in <i>screen coordinates</i> from the image |
|
924 |
* in <i>map coordinates</i>. |
|
925 |
* </p> |
|
926 |
* |
|
758 | 927 |
* @return the scale <i>extent / image size</i> projected by this view port |
759 |
* |
|
928 |
*
|
|
760 | 929 |
* @deprecated since 07/09/07, use {@linkplain MapContext#getScaleView()} |
761 | 930 |
*/ |
762 | 931 |
public double getScale() { |
763 | 932 |
return proj.getScale(extent.getMinX(), extent.getMaxX(), |
764 |
imageSize.width, dpi); |
|
933 |
imageSize.width, dpi);
|
|
765 | 934 |
} |
766 | 935 |
|
767 | 936 |
/** |
768 |
* <p>Affine transformation between <i>map 2D coordinates</i> to <i>screen 2D coordinates</i> (pixels), |
|
769 |
* preserving the "straightness" and "parallelism" of the lines.</p> |
|
770 |
* |
|
937 |
* <p> |
|
938 |
* Affine transformation between <i>map 2D coordinates</i> to <i>screen 2D |
|
939 |
* coordinates</i> (pixels), preserving the "straightness" and "parallelism" |
|
940 |
* of the lines. |
|
941 |
* </p> |
|
942 |
* |
|
771 | 943 |
* @return the affine transformation |
772 |
* |
|
944 |
*
|
|
773 | 945 |
* @see #setAffineTransform(AffineTransform) |
774 | 946 |
* @see #calculateAffineTransform() |
775 | 947 |
*/ |
... | ... | |
778 | 950 |
} |
779 | 951 |
|
780 | 952 |
/** |
781 |
* <p>Returns the size of the image projected.</p> |
|
782 |
* |
|
953 |
* <p> |
|
954 |
* Returns the size of the image projected. |
|
955 |
* </p> |
|
956 |
* |
|
783 | 957 |
* @return the image size |
784 |
* |
|
958 |
*
|
|
785 | 959 |
* @see #setImageSize(Dimension) |
786 | 960 |
* @see #getImageHeight() |
787 | 961 |
* @see #getImageWidth() |
... | ... | |
791 | 965 |
} |
792 | 966 |
|
793 | 967 |
/** |
794 |
* <p>Sets the size of the image projected, recalculating the parameters of this view port.</p> |
|
795 |
* |
|
796 |
* @param imageSize the image size |
|
797 |
* |
|
968 |
* <p> |
|
969 |
* Sets the size of the image projected, recalculating the parameters of |
|
970 |
* this view port. |
|
971 |
* </p> |
|
972 |
* |
|
973 |
* @param imageSize |
|
974 |
* the image size |
|
975 |
* |
|
798 | 976 |
* @see #getImageSize() |
799 | 977 |
* @see #calculateAffineTransform() |
800 | 978 |
*/ |
801 | 979 |
public void setImageSize(Dimension imageSize) { |
802 | 980 |
|
803 |
if (this.imageSize == null || (!this.imageSize.equals(imageSize))){
|
|
804 |
this.updateDrawVersion();
|
|
805 |
this.imageSize = imageSize;
|
|
806 |
calculateAffineTransform();
|
|
981 |
if (this.imageSize == null || (!this.imageSize.equals(imageSize))) {
|
|
982 |
this.updateDrawVersion(); |
|
983 |
this.imageSize = imageSize; |
|
984 |
calculateAffineTransform(); |
|
807 | 985 |
} |
808 | 986 |
} |
809 | 987 |
|
810 | 988 |
/** |
811 |
* <p>Notifies to all view port listeners registered, that the adjusted extent of this view port |
|
812 |
* has changed.</p> |
|
813 |
* |
|
814 |
* @param newRect the new adjusted extend |
|
815 |
* |
|
989 |
* <p> |
|
990 |
* Notifies to all view port listeners registered, that the adjusted extent |
|
991 |
* of this view port has changed. |
|
992 |
* </p> |
|
993 |
* |
|
994 |
* @param newRect |
|
995 |
* the new adjusted extend |
|
996 |
* |
|
816 | 997 |
* @see #refreshExtent() |
817 | 998 |
* @see #setEnvelope(Envelope) |
818 | 999 |
* @see #setPreviousExtent() |
... | ... | |
829 | 1010 |
} |
830 | 1011 |
|
831 | 1012 |
/** |
832 |
* <p>Notifies to all view port listeners registered, that the background color of this view port |
|
833 |
* has changed.</p> |
|
834 |
* |
|
835 |
* @param c the new background color |
|
836 |
* |
|
1013 |
* <p> |
|
1014 |
* Notifies to all view port listeners registered, that the background color |
|
1015 |
* of this view port has changed. |
|
1016 |
* </p> |
|
1017 |
* |
|
1018 |
* @param c |
|
1019 |
* the new background color |
|
1020 |
* |
|
837 | 1021 |
* @see #setBackColor(Color) |
838 | 1022 |
* @see ColorEvent |
839 | 1023 |
* @see ViewPortListener |
... | ... | |
848 | 1032 |
} |
849 | 1033 |
|
850 | 1034 |
/** |
851 |
* <p>Notifies to all view port listeners registered, that the projection of this view port |
|
852 |
* has changed.</p> |
|
853 |
* |
|
854 |
* @param projection the new projection |
|
855 |
* |
|
1035 |
* <p> |
|
1036 |
* Notifies to all view port listeners registered, that the projection of |
|
1037 |
* this view port has changed. |
|
1038 |
* </p> |
|
1039 |
* |
|
1040 |
* @param projection |
|
1041 |
* the new projection |
|
1042 |
* |
|
856 | 1043 |
* @see #setProjection(IProjection) |
857 | 1044 |
* @see ProjectionEvent |
858 | 1045 |
* @see ViewPortListener |
... | ... | |
867 | 1054 |
} |
868 | 1055 |
|
869 | 1056 |
/** |
870 |
* <p>Calculates the affine transformation between the {@link #extent extent} in <i>map 2D coordinates</i> to |
|
871 |
* the image area in the screen, in <i>screen 2D coordinates</i> (pixels).</p> |
|
872 |
* |
|
873 |
* <p>This process recalculates some parameters of this view port:<br> |
|
874 |
* |
|
1057 |
* <p> |
|
1058 |
* Calculates the affine transformation between the {@link #extent extent} |
|
1059 |
* in <i>map 2D coordinates</i> to the image area in the screen, in |
|
1060 |
* <i>screen 2D coordinates</i> (pixels). |
|
1061 |
* </p> |
|
1062 |
* |
|
1063 |
* <p> |
|
1064 |
* This process recalculates some parameters of this view port:<br> |
|
1065 |
* |
|
875 | 1066 |
* <ul> |
876 | 1067 |
* <li>The new {@link #scale scale} . |
877 | 1068 |
* <li>The new {@link #adjustedExtent adjustedExtent} . |
878 | 1069 |
* <li>The new {@link #trans trans} . |
879 |
* <li>The new real world coordinates equivalent to 1 pixel ({@link #dist1pixel dist1pixel}) . |
|
880 |
* <li>The new real world coordinates equivalent to 3 pixels ({@link #dist3pixel dist3pixel}) . |
|
1070 |
* <li>The new real world coordinates equivalent to 1 pixel ( |
|
1071 |
* {@link #dist1pixel dist1pixel}) . |
|
1072 |
* <li>The new real world coordinates equivalent to 3 pixels ( |
|
1073 |
* {@link #dist3pixel dist3pixel}) . |
|
881 | 1074 |
* </ul> |
882 | 1075 |
* </p> |
883 |
* |
|
1076 |
*
|
|
884 | 1077 |
* @see #getAffineTransform() |
885 | 1078 |
* @see #setAffineTransform(AffineTransform) |
886 | 1079 |
* @see #refreshExtent() |
... | ... | |
891 | 1084 |
* @see AffineTransform |
892 | 1085 |
*/ |
893 | 1086 |
private void calculateAffineTransform() { |
894 |
if ((imageSize == null) || (extent == null) || |
|
895 |
(imageSize.width <= 0) || (imageSize.height <= 0)) {
|
|
1087 |
if ((imageSize == null) || (extent == null) || (imageSize.width <= 0)
|
|
1088 |
|| (imageSize.height <= 0)) { |
|
896 | 1089 |
return; |
897 | 1090 |
} |
898 | 1091 |
|
... | ... | |
917 | 1110 |
scale = escalaX; |
918 | 1111 |
newHeight = imageSize.height / scale; |
919 | 1112 |
adjustedExtent.setRect(xCenter - (extent.getWidth() / 2.0), |
920 |
yCenter - (newHeight / 2.0), extent.getWidth(), newHeight); |
|
1113 |
yCenter - (newHeight / 2.0), extent.getWidth(), |
|
1114 |
newHeight); |
|
921 | 1115 |
} else { |
922 | 1116 |
scale = escalaY; |
923 | 1117 |
newWidth = imageSize.width / scale; |
924 |
adjustedExtent.setRect(xCenter - (newWidth / 2.0), |
|
925 |
yCenter - (extent.getHeight() / 2.0), newWidth,
|
|
926 |
extent.getHeight());
|
|
1118 |
adjustedExtent.setRect(xCenter - (newWidth / 2.0), yCenter
|
|
1119 |
- (extent.getHeight() / 2.0), newWidth, extent
|
|
1120 |
.getHeight());
|
|
927 | 1121 |
} |
928 | 1122 |
escalado.setToScale(scale, -scale); |
929 |
} |
|
930 |
else { // adjusted is same as extent |
|
1123 |
} else { // adjusted is same as extent |
|
931 | 1124 |
scale = escalaX; |
932 | 1125 |
adjustedExtent.setFrame(extent); |
933 | 1126 |
escalado.setToScale(escalaX, -escalaY); |
934 | 1127 |
} |
935 |
Envelope env=getAdjustedExtent();
|
|
1128 |
Envelope env = getAdjustedExtent();
|
|
936 | 1129 |
if (env == null) { |
937 | 1130 |
return; |
938 | 1131 |
} |
939 |
translacion.setToTranslation(-env.getMinimum(0), |
|
940 |
-env.getMinimum(1) - getAdjustedExtent().getLength(1));
|
|
1132 |
translacion.setToTranslation(-env.getMinimum(0), -env.getMinimum(1)
|
|
1133 |
- getAdjustedExtent().getLength(1));
|
|
941 | 1134 |
|
942 | 1135 |
AffineTransform offsetTrans = new AffineTransform(); |
943 | 1136 |
offsetTrans.setToTranslation(offset.getX(), offset.getY()); |
... | ... | |
948 | 1141 |
|
949 | 1142 |
trans.concatenate(translacion); |
950 | 1143 |
|
951 |
// Calculamos las distancias de 1 pixel y 3 pixel con esa transformaci�n |
|
952 |
// de coordenadas, de forma que est�n precalculadas para cuando las necesitemos |
|
1144 |
// Calculamos las distancias de 1 pixel y 3 pixel con esa |
|
1145 |
// transformaci�n |
|
1146 |
// de coordenadas, de forma que est�n precalculadas para cuando las |
|
1147 |
// necesitemos |
|
953 | 1148 |
AffineTransform at; |
954 | 1149 |
|
955 | 1150 |
try { |
... | ... | |
963 | 1158 |
dist3pixel = 3 * pProv.x; |
964 | 1159 |
} catch (NoninvertibleTransformException e) { |
965 | 1160 |
System.err.println("transformada afin = " + trans.toString()); |
966 |
System.err.println("extent = " + extent.toString() + |
|
967 |
" imageSize= " + imageSize.toString());
|
|
968 |
throw new RuntimeException("Non invertible transform Exception",e); |
|
1161 |
System.err.println("extent = " + extent.toString() + " imageSize= "
|
|
1162 |
+ imageSize.toString());
|
|
1163 |
throw new RuntimeException("Non invertible transform Exception", e);
|
|
969 | 1164 |
} |
970 | 1165 |
} |
971 | 1166 |
|
972 | 1167 |
/** |
973 |
* <p>Sets the offset.</p> |
|
974 |
* <p>The offset is the position where start drawing the map.</p> |
|
975 |
* |
|
976 |
* @param p 2D point that represents the offset in pixels |
|
977 |
* |
|
1168 |
* <p> |
|
1169 |
* Sets the offset. |
|
1170 |
* </p> |
|
1171 |
* <p> |
|
1172 |
* The offset is the position where start drawing the map. |
|
1173 |
* </p> |
|
1174 |
* |
|
1175 |
* @param p |
|
1176 |
* 2D point that represents the offset in pixels |
|
1177 |
* |
|
978 | 1178 |
* @see #getOffset() |
979 | 1179 |
*/ |
980 | 1180 |
public void setOffset(Point2D p) { |
981 |
if (!offset.equals(p)){ |
|
1181 |
if (!offset.equals(p)) {
|
|
982 | 1182 |
this.updateDrawVersion(); |
983 | 1183 |
offset = p; |
984 | 1184 |
} |
985 | 1185 |
} |
986 | 1186 |
|
987 | 1187 |
/** |
988 |
* <p>Gets the offset.</p> |
|
989 |
* <p>The offset is the position where start drawing the map.</p> |
|
990 |
* |
|
1188 |
* <p> |
|
1189 |
* Gets the offset. |
|
1190 |
* </p> |
|
1191 |
* <p> |
|
1192 |
* The offset is the position where start drawing the map. |
|
1193 |
* </p> |
|
1194 |
* |
|
991 | 1195 |
* @return 2D point that represents the offset in pixels |
992 |
* |
|
1196 |
*
|
|
993 | 1197 |
* @see #setOffset(Point2D) |
994 | 1198 |
*/ |
995 | 1199 |
public Point2D getOffset() { |
... | ... | |
997 | 1201 |
} |
998 | 1202 |
|
999 | 1203 |
/** |
1000 |
* <p>Sets the background color.</p> |
|
1001 |
* |
|
1002 |
* @param c the new background color |
|
1003 |
* |
|
1204 |
* <p> |
|
1205 |
* Sets the background color. |
|
1206 |
* </p> |
|
1207 |
* |
|
1208 |
* @param c |
|
1209 |
* the new background color |
|
1210 |
* |
|
1004 | 1211 |
* @see #getBackColor() |
1005 | 1212 |
*/ |
1006 | 1213 |
public void setBackColor(Color c) { |
1007 |
if (!c.equals(this.backColor)){ |
|
1214 |
if (!c.equals(this.backColor)) {
|
|
1008 | 1215 |
this.updateDrawVersion(); |
1009 | 1216 |
backColor = c; |
1010 | 1217 |
callColorChanged(backColor); |
... | ... | |
1012 | 1219 |
} |
1013 | 1220 |
|
1014 | 1221 |
/** |
1015 |
* <p>Gets the background color.</p> |
|
1016 |
* |
|
1222 |
* <p> |
|
1223 |
* Gets the background color. |
|
1224 |
* </p> |
|
1225 |
* |
|
1017 | 1226 |
* @return the background color of the view |
1018 |
* |
|
1227 |
*
|
|
1019 | 1228 |
* @see #setBackColor(Color) |
1020 | 1229 |
*/ |
1021 | 1230 |
public Color getBackColor() { |
... | ... | |
1023 | 1232 |
} |
1024 | 1233 |
|
1025 | 1234 |
/** |
1026 |
* <p>Returns the extent currently covered by the view adjusted (scaled) to the image size aspect.</p> |
|
1027 |
* |
|
1235 |
* <p> |
|
1236 |
* Returns the extent currently covered by the view adjusted (scaled) to the |
|
1237 |
* image size aspect. |
|
1238 |
* </p> |
|
1239 |
* |
|
1028 | 1240 |
* @return extent of the view adjusted to the image size aspect |
1029 |
* |
|
1241 |
*
|
|
1030 | 1242 |
* @see #setAdjustable(boolean) |
1031 | 1243 |
* @deprecated use {@link ViewPort#getAdjustedEnvelope()} instead |
1032 | 1244 |
*/ |
1033 | 1245 |
public Envelope getAdjustedExtent() { |
1034 | 1246 |
return getAdjustedEnvelope(); |
1035 | 1247 |
} |
1036 |
|
|
1248 |
|
|
1037 | 1249 |
/** |
1038 |
* <p>Returns the envelope currently covered by the view adjusted (scaled) to the image size aspect.</p> |
|
1039 |
* |
|
1250 |
* <p> |
|
1251 |
* Returns the envelope currently covered by the view adjusted (scaled) to |
|
1252 |
* the image size aspect. |
|
1253 |
* </p> |
|
1254 |
* |
|
1040 | 1255 |
* @return envelope of the view adjusted to the image size aspect |
1041 |
* |
|
1256 |
*
|
|
1042 | 1257 |
* @see #setAdjustable(boolean) |
1043 | 1258 |
*/ |
1044 | 1259 |
public Envelope getAdjustedEnvelope() { |
1045 |
if (cliprect!=null){
|
|
1046 |
Rectangle2D r= adjustedExtent.createIntersection(cliprect); |
|
1260 |
if (cliprect != null) {
|
|
1261 |
Rectangle2D r = adjustedExtent.createIntersection(cliprect);
|
|
1047 | 1262 |
try { |
1048 |
return geomManager.createEnvelope(r.getX(),r.getY(),r.getMaxX(),r.getMaxY(), SUBTYPES.GEOM2D); |
|
1263 |
return geomManager.createEnvelope(r.getX(), r.getY(), r |
|
1264 |
.getMaxX(), r.getMaxY(), SUBTYPES.GEOM2D); |
|
1049 | 1265 |
} catch (CreateEnvelopeException e) { |
1050 | 1266 |
e.printStackTrace(); |
1051 | 1267 |
logger.error("Error adjusting the extent", e); |
Also available in: Unified diff