101 |
101 |
* registered.
|
102 |
102 |
* </ul>
|
103 |
103 |
* </p>
|
104 |
|
*
|
|
104 |
*
|
105 |
105 |
* @author Vicente Caballero Navarro
|
106 |
106 |
*/
|
107 |
107 |
public class ViewPort implements Persistent, Cloneable {
|
... | ... | |
155 |
155 |
* {@linkplain #getAdjustedExtent()} method which returns the extent that
|
156 |
156 |
* contains this one but regarding the current view's aspect ratio.
|
157 |
157 |
* </p>
|
158 |
|
*
|
|
158 |
*
|
159 |
159 |
* @see #getExtent()
|
160 |
160 |
* @see #setEnvelope(Envelope)
|
161 |
161 |
*/
|
... | ... | |
167 |
167 |
* <p>
|
168 |
168 |
* Location and dimensions of the extent adjusted to the image size.
|
169 |
169 |
* </p>
|
170 |
|
*
|
|
170 |
*
|
171 |
171 |
* @see #getAdjustedExtent()
|
172 |
172 |
*/
|
173 |
173 |
protected Rectangle2D adjustedExtent;
|
... | ... | |
175 |
175 |
/**
|
176 |
176 |
* Draw version of the context. It's used for know when de componend has
|
177 |
177 |
* changed any visualization property
|
178 |
|
*
|
|
178 |
*
|
179 |
179 |
* @see getDrawVersion
|
180 |
180 |
* @see updateDrawVersion
|
181 |
181 |
*/
|
... | ... | |
185 |
185 |
* <p>
|
186 |
186 |
* History with the last extents of the view.
|
187 |
187 |
* </p>
|
188 |
|
*
|
|
188 |
*
|
189 |
189 |
* @see #setPreviousExtent()
|
190 |
190 |
* @see #getExtents()
|
191 |
191 |
*/
|
... | ... | |
208 |
208 |
* {@link #dist3pixel dist3pixel}) .
|
209 |
209 |
* </ul>
|
210 |
210 |
* </p>
|
211 |
|
*
|
|
211 |
*
|
212 |
212 |
* @see #getImageSize()
|
213 |
213 |
* @see #getImageHeight()
|
214 |
214 |
* @see #getImageWidth()
|
... | ... | |
222 |
222 |
* coordinates</i> to the image area in the screen, in <i>screen 2D
|
223 |
223 |
* coordinates</i> (pixels).
|
224 |
224 |
* </p>
|
225 |
|
*
|
|
225 |
*
|
226 |
226 |
* @see AffineTransform
|
227 |
227 |
* @see #getAffineTransform()
|
228 |
228 |
* @see #setAffineTransform(AffineTransform)
|
... | ... | |
234 |
234 |
* <p>
|
235 |
235 |
* Measurement unit used for measuring distances and displaying information.
|
236 |
236 |
* </p>
|
237 |
|
*
|
|
237 |
*
|
238 |
238 |
* @see #getDistanceUnits()
|
239 |
239 |
* @see #setDistanceUnits(int)
|
240 |
240 |
*/
|
... | ... | |
244 |
244 |
* <p>
|
245 |
245 |
* Measurement unit used for measuring areas and displaying information.
|
246 |
246 |
* </p>
|
247 |
|
*
|
|
247 |
*
|
248 |
248 |
* @see #getDistanceArea()
|
249 |
249 |
* @see #setDistanceArea(int)
|
250 |
250 |
*/
|
... | ... | |
254 |
254 |
* <p>
|
255 |
255 |
* Measurement unit used by this view port for the map.
|
256 |
256 |
* </p>
|
257 |
|
*
|
|
257 |
*
|
258 |
258 |
* @see #getMapUnits()
|
259 |
259 |
* @see #setMapUnits(int)
|
260 |
260 |
*/
|
... | ... | |
265 |
265 |
* Array with the {@link ViewPortListener ViewPortListener}s registered to
|
266 |
266 |
* this view port.
|
267 |
267 |
* </p>
|
268 |
|
*
|
|
268 |
*
|
269 |
269 |
* @see #addViewPortListener(ViewPortListener)
|
270 |
270 |
* @see #removeViewPortListener(ViewPortListener)
|
271 |
271 |
*/
|
... | ... | |
281 |
281 |
* But in a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s <i>Layout</i> it's
|
282 |
282 |
* up to the place where the <code>FFrameView</code> is located.
|
283 |
283 |
* </p>
|
284 |
|
*
|
|
284 |
*
|
285 |
285 |
* @see #getOffset()
|
286 |
286 |
* @see #setOffset(Point2D)
|
287 |
287 |
*/
|
... | ... | |
298 |
298 |
* <p>
|
299 |
299 |
* Background color of this view.
|
300 |
300 |
* </p>
|
301 |
|
*
|
|
301 |
*
|
302 |
302 |
* @see #getBackColor()
|
303 |
303 |
* @see #setBackColor(Color)
|
304 |
304 |
*/
|
... | ... | |
308 |
308 |
* <p>
|
309 |
309 |
* Information about the map projection used in this view.
|
310 |
310 |
* </p>
|
311 |
|
*
|
|
311 |
*
|
312 |
312 |
* @see #getProjection()
|
313 |
313 |
* @see #setProjection(IProjection)
|
314 |
314 |
*/
|
... | ... | |
319 |
319 |
* Represents the distance in <i>world coordinates</i> equivalent to 1 pixel
|
320 |
320 |
* in the view with the current extent.
|
321 |
321 |
* </p>
|
322 |
|
*
|
|
322 |
*
|
323 |
323 |
* @see #getDist1pixel()
|
324 |
324 |
* @see #setDist1pixel(double)
|
325 |
325 |
*/
|
... | ... | |
330 |
330 |
* Represents the distance in <i>world coordinates</i> equivalent to 3 pixels
|
331 |
331 |
* in the view with the current extent.
|
332 |
332 |
* </p>
|
333 |
|
*
|
|
333 |
*
|
334 |
334 |
* @see #getDist3pixel()
|
335 |
335 |
* @see #setDist3pixel(double)
|
336 |
336 |
*/
|
... | ... | |
340 |
340 |
* <p>
|
341 |
341 |
* Ratio between the size of <code>imageSize</code> and <code>extent</code>: <br>
|
342 |
342 |
* <i>
|
343 |
|
*
|
|
343 |
*
|
344 |
344 |
* <pre>
|
345 |
345 |
* min{(imageSize.getHeight()/extent.getHeight(), imageSize.getWidth()/extent.getWidth())}
|
346 |
346 |
* </pre>
|
347 |
|
*
|
|
347 |
*
|
348 |
348 |
* </i>
|
349 |
349 |
* </p>
|
350 |
350 |
*/
|
... | ... | |
354 |
354 |
* <p>
|
355 |
355 |
* Clipping area.
|
356 |
356 |
* </p>
|
357 |
|
*
|
|
357 |
*
|
358 |
358 |
* @see #setClipRect(Rectangle2D)
|
359 |
359 |
*/
|
360 |
360 |
private Rectangle2D cliprect;
|
... | ... | |
370 |
370 |
* Y) coordinates of the <code>extent</code> and an area that will be an scale
|
371 |
371 |
* of the image size. That area will have different height or width (not both)
|
372 |
372 |
* of the extent according the least ratio (height or width) in
|
373 |
|
*
|
|
373 |
*
|
374 |
374 |
* <pre>
|
375 |
375 |
* image.size/extent.size"
|
376 |
376 |
* </pre>.
|
... | ... | |
378 |
378 |
* <code>extent</code>.
|
379 |
379 |
* </ul>
|
380 |
380 |
* </p>
|
381 |
|
*
|
|
381 |
*
|
382 |
382 |
* @see #setAdjustable(boolean)
|
383 |
383 |
*/
|
384 |
384 |
private boolean adjustableExtent = true;
|
... | ... | |
388 |
388 |
* ViewPort resolution in <i>dots-per-inch</i>. Useful to calculate the
|
389 |
389 |
* geographic scale of the view.
|
390 |
390 |
* </p>
|
391 |
|
*
|
|
391 |
*
|
392 |
392 |
* @see Toolkit#getScreenResolution()
|
393 |
393 |
* @see MapContext#getScaleView()
|
394 |
394 |
*/
|
... | ... | |
411 |
411 |
* <li><i><code>offset</code></i> = <code>new Point2D.Double(0, 0);</code>
|
412 |
412 |
* </ul>
|
413 |
413 |
* </p>
|
414 |
|
*
|
|
414 |
*
|
415 |
415 |
* @param proj information of the projection for this view port
|
416 |
416 |
*/
|
417 |
417 |
public ViewPort(IProjection proj) {
|
... | ... | |
430 |
430 |
* original map in real coordinates. (Won't scale the image to adapt it to the
|
431 |
431 |
* available rectangular area).
|
432 |
432 |
* </p>
|
433 |
|
*
|
|
433 |
*
|
434 |
434 |
* @param boolean the boolean to be set
|
435 |
435 |
*/
|
436 |
436 |
public void setAdjustable(boolean adjustable) {
|
... | ... | |
446 |
446 |
* Appends the specified {@link ViewPortListener ViewPortListener} listener if
|
447 |
447 |
* weren't.
|
448 |
448 |
* </p>
|
449 |
|
*
|
|
449 |
*
|
450 |
450 |
* @param arg0 the listener to add
|
451 |
451 |
* @return <code>true</code> if has been added successfully
|
452 |
452 |
* @see #removeViewPortListener(ViewPortListener)
|
... | ... | |
463 |
463 |
* Removes the specified {@link ViewPortListener ViewPortListener} listener,
|
464 |
464 |
* if existed.
|
465 |
465 |
* </p>
|
466 |
|
*
|
|
466 |
*
|
467 |
467 |
* @param arg0 the listener to remove
|
468 |
468 |
* @return <code>true</code> if the contained the specified listener.
|
469 |
469 |
* @see #addViewPortListener(ViewPortListener)
|
... | ... | |
479 |
479 |
* with the transformation affine information in the {@link #trans #trans}
|
480 |
480 |
* attribute.
|
481 |
481 |
* </p>
|
482 |
|
*
|
|
482 |
*
|
483 |
483 |
* @param d distance in <i>map coordinates</i>
|
484 |
484 |
* @return distance equivalent in <i>screen coordinates</i>
|
485 |
485 |
* @see #toMapDistance(int)
|
... | ... | |
505 |
505 |
* coordinates</i> to <i>screen coordinates</i> (pixels) using the affine
|
506 |
506 |
* transformation in the {@link #trans #trans} attribute.
|
507 |
507 |
* </p>
|
508 |
|
*
|
|
508 |
*
|
509 |
509 |
* @param x the <code>x</code> <i>map coordinate</i> of a 2D point
|
510 |
510 |
* @param y the <code>y</code> <i>map coordinate</i> of a 2D point
|
511 |
511 |
* @return 2D point equivalent in <i>screen coordinates</i> (pixels)
|
... | ... | |
532 |
532 |
* coordinates</i> to <i>screen coordinates</i> (pixels) using the affine
|
533 |
533 |
* transformation in the {@link #trans #trans} attribute.
|
534 |
534 |
* </p>
|
535 |
|
*
|
|
535 |
*
|
536 |
536 |
* @param point the 2D point in <i>map coordinates</i>
|
537 |
537 |
* @return 2D point equivalent in <i>screen coordinates</i> (pixels)
|
538 |
538 |
* @see #toMapPoint(Point2D)
|
... | ... | |
548 |
548 |
* coordinates</i> (pixels) to <i>map coordinates</i> using the affine
|
549 |
549 |
* transformation in the {@link #trans #trans} attribute.
|
550 |
550 |
* </p>
|
551 |
|
*
|
|
551 |
*
|
552 |
552 |
* @param x the <code>x</code> <i>screen coordinate</i> of a 2D point
|
553 |
553 |
* @param y the <code>y</code> <i>screen coordinate</i> of a 2D point
|
554 |
554 |
* @return 2D point equivalent in <i>map coordinates</i>
|
... | ... | |
568 |
568 |
* <i>screen coordinates</i> (pixels) to <i>map coordinates</i> using
|
569 |
569 |
* {@linkplain #toMapDistance(int)}, and {@linkplain #toMapPoint(int, int)}.
|
570 |
570 |
* </p>
|
571 |
|
*
|
|
571 |
*
|
572 |
572 |
* @param r the 2D rectangle in <i>screen coordinates</i> (pixels)
|
573 |
573 |
* @return 2D rectangle equivalent in <i>map coordinates</i>
|
574 |
574 |
* @see #fromMapRectangle(Rectangle2D)
|
... | ... | |
589 |
589 |
* coordinates</i> to <i>map coordinates</i> using the transformation affine
|
590 |
590 |
* information in the {@link #trans #trans} attribute.
|
591 |
591 |
* </p>
|
592 |
|
*
|
|
592 |
*
|
593 |
593 |
* @param d distance in pixels
|
594 |
594 |
* @return distance equivalent in <i>map coordinates</i>
|
595 |
595 |
* @see #fromMapDistance(double)
|
... | ... | |
607 |
607 |
* coordinates</i> (pixels) to <i>map coordinates</i> using the inverse affine
|
608 |
608 |
* transformation of the {@link #trans #trans} attribute.
|
609 |
609 |
* </p>
|
610 |
|
*
|
|
610 |
*
|
611 |
611 |
* @param pScreen the 2D point in <i>screen coordinates</i> (pixels)
|
612 |
612 |
* @return 2D point equivalent in <i>map coordinates</i>
|
613 |
613 |
* @see #toMapPoint(int, int)
|
... | ... | |
657 |
657 |
* <p>
|
658 |
658 |
* If the projection of this view is UTM, considers the Earth curvature.
|
659 |
659 |
* </p>
|
660 |
|
*
|
|
660 |
*
|
661 |
661 |
* @param pt1 a 2D point in <i>map coordinates</i>
|
662 |
662 |
* @param pt2 another 2D point in <i>map coordinates</i>
|
663 |
663 |
* @return the distance in meters between the two points 2D
|
... | ... | |
682 |
682 |
* Sets as extent and adjusted extent of this view port, the previous.
|
683 |
683 |
* Recalculating its parameters.
|
684 |
684 |
* </p>
|
685 |
|
*
|
|
685 |
*
|
686 |
686 |
* @see #getExtents()
|
687 |
687 |
* @see #calculateAffineTransform()
|
688 |
688 |
* @deprecated use {@link ViewPort#setPreviousEnvelope()}
|
... | ... | |
697 |
697 |
* Recalculating its parameters.
|
698 |
698 |
* Stores the current extent in the next extents of the history.
|
699 |
699 |
* </p>
|
700 |
|
*
|
|
700 |
*
|
701 |
701 |
* @see #getExtents()
|
702 |
702 |
* @see #calculateAffineTransform()
|
703 |
703 |
*/
|
704 |
704 |
public void setPreviousEnvelope() {
|
705 |
705 |
this.updateDrawVersion();
|
706 |
|
|
|
706 |
|
707 |
707 |
// extentsHistory.putNext(extent);
|
708 |
708 |
// extent = extentsHistory.removePrev();
|
709 |
709 |
extent = extentsHistory.setPreviousExtent();
|
... | ... | |
721 |
721 |
* Recalculating its parameters.
|
722 |
722 |
* Stores the current extent in the previous extents of the history.
|
723 |
723 |
* </p>
|
724 |
|
*
|
|
724 |
*
|
725 |
725 |
* @see #getExtents()
|
726 |
726 |
* @see #calculateAffineTransform()
|
727 |
727 |
*/
|
728 |
728 |
public void setNextEnvelope() {
|
729 |
729 |
this.updateDrawVersion();
|
730 |
|
|
|
730 |
|
731 |
731 |
extent = extentsHistory.setNextExtent();
|
732 |
|
|
|
732 |
|
733 |
733 |
// Calcula la transformaci�n af�n
|
734 |
734 |
calculateAffineTransform();
|
735 |
735 |
|
... | ... | |
753 |
753 |
* If you are looking for the complete extent currently shown, you must use
|
754 |
754 |
* the {@linkplain #getAdjustedExtent()} method.
|
755 |
755 |
* </p>
|
756 |
|
*
|
|
756 |
*
|
757 |
757 |
* @return the current extent
|
758 |
758 |
* @see #setEnvelope(Envelope)
|
759 |
759 |
* @see #getAdjustedExtent()
|
... | ... | |
781 |
781 |
* If you are looking for the complete extent currently shown, you must use
|
782 |
782 |
* the {@linkplain #getAdjustedEnvelope()} method.
|
783 |
783 |
* </p>
|
784 |
|
*
|
|
784 |
*
|
785 |
785 |
* @return the current envelope
|
786 |
786 |
* @see #setEnvelope(Envelope)
|
787 |
787 |
* @see #getAdjustedEnvelope()
|
... | ... | |
810 |
810 |
* <ul>
|
811 |
811 |
* <li>Stores the previous extent.
|
812 |
812 |
* <li>Calculates the new extent using <code>r</code>:
|
813 |
|
*
|
|
813 |
*
|
814 |
814 |
* <pre>
|
815 |
815 |
* extent = new Rectangle2D.Double(r.getMinX() - 0.1, r.getMinY() - 0.1,
|
816 |
816 |
* r.getWidth() + 0.2, r.getHeight() + 0.2);
|
... | ... | |
823 |
823 |
* the extent has changed.
|
824 |
824 |
* </ul>
|
825 |
825 |
* </p>
|
826 |
|
*
|
|
826 |
*
|
827 |
827 |
* @param r the new extent
|
828 |
828 |
* @see #getExtent()
|
829 |
829 |
* @see #getExtents()
|
... | ... | |
859 |
859 |
|
860 |
860 |
// Calcula la transformaci�n af�n
|
861 |
861 |
calculateAffineTransform();
|
862 |
|
|
863 |
862 |
|
|
863 |
|
864 |
864 |
// Lanzamos los eventos de extent cambiado
|
865 |
865 |
callExtentChanged(getAdjustedExtent());
|
866 |
866 |
}
|
... | ... | |
877 |
877 |
* that the extent has changed.
|
878 |
878 |
* </ul>
|
879 |
879 |
* </p>
|
880 |
|
*
|
|
880 |
*
|
881 |
881 |
* @see #setEnvelope(Envelope)
|
882 |
882 |
* @see #calculateAffineTransform()
|
883 |
883 |
*/
|
... | ... | |
902 |
902 |
* scale that is the extent in <i>screen coordinates</i> from the image in
|
903 |
903 |
* <i>map coordinates</i>.
|
904 |
904 |
* </p>
|
905 |
|
*
|
|
905 |
*
|
906 |
906 |
* @return the scale <i>extent / image size</i> projected by this view port
|
907 |
907 |
* @deprecated since 07/09/07, use {@linkplain MapContext#getScaleView()}
|
908 |
908 |
*/
|
... | ... | |
932 |
932 |
* coordinates</i> (pixels), preserving the "straightness" and "parallelism"
|
933 |
933 |
* of the lines.
|
934 |
934 |
* </p>
|
935 |
|
*
|
|
935 |
*
|
936 |
936 |
* @return the affine transformation
|
937 |
937 |
* @see #setAffineTransform(AffineTransform)
|
938 |
938 |
* @see #calculateAffineTransform()
|
... | ... | |
945 |
945 |
* <p>
|
946 |
946 |
* Returns the size of the image projected.
|
947 |
947 |
* </p>
|
948 |
|
*
|
|
948 |
*
|
949 |
949 |
* @return the image size
|
950 |
950 |
* @see #setImageSize(Dimension)
|
951 |
951 |
* @see #getImageHeight()
|
... | ... | |
960 |
960 |
* Sets the size of the image projected, recalculating the parameters of this
|
961 |
961 |
* view port.
|
962 |
962 |
* </p>
|
963 |
|
*
|
|
963 |
*
|
964 |
964 |
* @param imageSize the image size
|
965 |
965 |
* @see #getImageSize()
|
966 |
966 |
* @see #calculateAffineTransform()
|
... | ... | |
979 |
979 |
* Notifies to all view port listeners registered, that the adjusted extent of
|
980 |
980 |
* this view port has changed.
|
981 |
981 |
* </p>
|
982 |
|
*
|
|
982 |
*
|
983 |
983 |
* @param newRect the new adjusted extend
|
984 |
984 |
* @see #refreshExtent()
|
985 |
985 |
* @see #setEnvelope(Envelope)
|
... | ... | |
1001 |
1001 |
* Notifies to all view port listeners registered, that the time of this view
|
1002 |
1002 |
* port has changed.
|
1003 |
1003 |
* </p>
|
1004 |
|
*
|
|
1004 |
*
|
1005 |
1005 |
* @param newTime the new time
|
1006 |
1006 |
* @see #refreshExtent()
|
1007 |
1007 |
* @see #setTime(Time)
|
... | ... | |
1022 |
1022 |
* Notifies to all view port listeners registered, that the background color
|
1023 |
1023 |
* of this view port has changed.
|
1024 |
1024 |
* </p>
|
1025 |
|
*
|
|
1025 |
*
|
1026 |
1026 |
* @param c the new background color
|
1027 |
1027 |
* @see #setBackColor(Color)
|
1028 |
1028 |
* @see ColorEvent
|
... | ... | |
1042 |
1042 |
* Notifies to all view port listeners registered, that the projection of this
|
1043 |
1043 |
* view port has changed.
|
1044 |
1044 |
* </p>
|
1045 |
|
*
|
|
1045 |
*
|
1046 |
1046 |
* @param projection the new projection
|
1047 |
1047 |
* @see #setProjection(IProjection)
|
1048 |
1048 |
* @see ProjectionEvent
|
... | ... | |
1075 |
1075 |
* {@link #dist3pixel dist3pixel}) .
|
1076 |
1076 |
* </ul>
|
1077 |
1077 |
* </p>
|
1078 |
|
*
|
|
1078 |
*
|
1079 |
1079 |
* @see #getAffineTransform()
|
1080 |
1080 |
* @see #setAffineTransform(AffineTransform)
|
1081 |
1081 |
* @see #refreshExtent()
|
... | ... | |
1175 |
1175 |
* <p>
|
1176 |
1176 |
* The offset is the position where start drawing the map.
|
1177 |
1177 |
* </p>
|
1178 |
|
*
|
|
1178 |
*
|
1179 |
1179 |
* @param p 2D point that represents the offset in pixels
|
1180 |
1180 |
* @see #getOffset()
|
1181 |
1181 |
*/
|
... | ... | |
1193 |
1193 |
* <p>
|
1194 |
1194 |
* The offset is the position where start drawing the map.
|
1195 |
1195 |
* </p>
|
1196 |
|
*
|
|
1196 |
*
|
1197 |
1197 |
* @return 2D point that represents the offset in pixels
|
1198 |
1198 |
* @see #setOffset(Point2D)
|
1199 |
1199 |
*/
|
... | ... | |
1205 |
1205 |
* <p>
|
1206 |
1206 |
* Sets the background color.
|
1207 |
1207 |
* </p>
|
1208 |
|
*
|
|
1208 |
*
|
1209 |
1209 |
* @param c the new background color
|
1210 |
1210 |
* @see #getBackColor()
|
1211 |
1211 |
*/
|
... | ... | |
1221 |
1221 |
* <p>
|
1222 |
1222 |
* Gets the background color.
|
1223 |
1223 |
* </p>
|
1224 |
|
*
|
|
1224 |
*
|
1225 |
1225 |
* @return the background color of the view
|
1226 |
1226 |
* @see #setBackColor(Color)
|
1227 |
1227 |
*/
|
... | ... | |
1234 |
1234 |
* Returns the extent currently covered by the view adjusted (scaled) to the
|
1235 |
1235 |
* image size aspect.
|
1236 |
1236 |
* </p>
|
1237 |
|
*
|
|
1237 |
*
|
1238 |
1238 |
* @return extent of the view adjusted to the image size aspect
|
1239 |
1239 |
* @see #setAdjustable(boolean)
|
1240 |
1240 |
* @deprecated use {@link ViewPort#getAdjustedEnvelope()} instead
|
... | ... | |
1248 |
1248 |
* Returns the envelope currently covered by the view adjusted (scaled) to the
|
1249 |
1249 |
* image size aspect.
|
1250 |
1250 |
* </p>
|
1251 |
|
*
|
|
1251 |
*
|
1252 |
1252 |
* @return envelope of the view adjusted to the image size aspect
|
1253 |
1253 |
* @see #setAdjustable(boolean)
|
1254 |
1254 |
*/
|
1255 |
|
public Envelope getAdjustedEnvelope() {
|
1256 |
|
if (cliprect != null) {
|
1257 |
|
Rectangle2D r = adjustedExtent.createIntersection(cliprect);
|
1258 |
|
try {
|
1259 |
|
return geomManager.createEnvelope(r.getX(), r.getY(), r.getMaxX(),
|
1260 |
|
r.getMaxY(), SUBTYPES.GEOM2D);
|
1261 |
|
}
|
1262 |
|
catch (CreateEnvelopeException e) {
|
1263 |
|
e.printStackTrace();
|
1264 |
|
logger.error("Error adjusting the extent", e);
|
1265 |
|
}
|
|
1255 |
public Envelope getAdjustedEnvelope() {
|
|
1256 |
if (adjustedExtent == null) {
|
|
1257 |
calculateAffineTransform();
|
|
1258 |
}
|
|
1259 |
if (cliprect != null) {
|
|
1260 |
Rectangle2D r = adjustedExtent.createIntersection(cliprect);
|
|
1261 |
try {
|
|
1262 |
return geomManager.createEnvelope(r.getX(), r.getY(), r.getMaxX(), r.getMaxY(), SUBTYPES.GEOM2D);
|
|
1263 |
} catch (CreateEnvelopeException e) {
|
|
1264 |
e.printStackTrace();
|
|
1265 |
logger.error("Error adjusting the extent", e);
|
|
1266 |
}
|
|
1267 |
}
|
|
1268 |
if (adjustedExtent != null) {
|
|
1269 |
try {
|
|
1270 |
return geomManager.createEnvelope(adjustedExtent.getX(), adjustedExtent.getY(),
|
|
1271 |
adjustedExtent.getMaxX(), adjustedExtent.getMaxY(), SUBTYPES.GEOM2D);
|
|
1272 |
} catch (CreateEnvelopeException e) {
|
|
1273 |
e.printStackTrace();
|
|
1274 |
logger.error("Error adjusting the extent", e);
|
|
1275 |
}
|
|
1276 |
}
|
|
1277 |
return null;
|
1266 |
1278 |
}
|
1267 |
|
if (adjustedExtent != null) {
|
1268 |
|
try {
|
1269 |
|
return geomManager.createEnvelope(adjustedExtent.getX(),
|
1270 |
|
adjustedExtent.getY(), adjustedExtent.getMaxX(),
|
1271 |
|
adjustedExtent.getMaxY(), SUBTYPES.GEOM2D);
|
1272 |
|
}
|
1273 |
|
catch (CreateEnvelopeException e) {
|
1274 |
|
e.printStackTrace();
|
1275 |
|
logger.error("Error adjusting the extent", e);
|
1276 |
|
}
|
1277 |
|
}
|
1278 |
|
return null;
|
1279 |
|
}
|
1280 |
1279 |
|
1281 |
1280 |
/**
|
1282 |
1281 |
* <p>
|
1283 |
1282 |
* Returns the measurement unit of this view port used for measuring distances
|
1284 |
1283 |
* and displaying information.
|
1285 |
1284 |
* </p>
|
1286 |
|
*
|
|
1285 |
*
|
1287 |
1286 |
* @return the measurement unit of this view used for measuring distances and
|
1288 |
1287 |
* displaying information
|
1289 |
1288 |
* @see #setDistanceUnits(int)
|
... | ... | |
1297 |
1296 |
* Returns the measurement unit of this view port used for measuring areas and
|
1298 |
1297 |
* displaying information.
|
1299 |
1298 |
* </p>
|
1300 |
|
*
|
|
1299 |
*
|
1301 |
1300 |
* @return the measurement unit of this view used for measuring areas and
|
1302 |
1301 |
* displaying information
|
1303 |
1302 |
* @see #setDistanceUnits(int)
|
... | ... | |
1311 |
1310 |
* Sets the measurement unit of this view port used for measuring distances
|
1312 |
1311 |
* and displaying information.
|
1313 |
1312 |
* </p>
|
1314 |
|
*
|
|
1313 |
*
|
1315 |
1314 |
* @param distanceUnits the measurement unit of this view used for measuring
|
1316 |
1315 |
* distances and displaying information
|
1317 |
1316 |
* @see #getDistanceUnits()
|
... | ... | |
1325 |
1324 |
* Sets the measurement unit of this view port used for measuring areas and
|
1326 |
1325 |
* displaying information.
|
1327 |
1326 |
* </p>
|
1328 |
|
*
|
|
1327 |
*
|
1329 |
1328 |
* @param distanceUnits the measurement unit of this view used for measuring
|
1330 |
1329 |
* areas and displaying information
|
1331 |
1330 |
* @see #getDistanceUnits()
|
... | ... | |
1338 |
1337 |
* <p>
|
1339 |
1338 |
* Gets the measurement unit used by this view port for the map.
|
1340 |
1339 |
* </p>
|
1341 |
|
*
|
|
1340 |
*
|
1342 |
1341 |
* @return Returns the current map measure unit
|
1343 |
1342 |
* @see #setMapUnits(int)
|
1344 |
1343 |
*/
|
... | ... | |
1350 |
1349 |
* <p>
|
1351 |
1350 |
* Sets the measurement unit used by this view port for the map.
|
1352 |
1351 |
* </p>
|
1353 |
|
*
|
|
1352 |
*
|
1354 |
1353 |
* @param mapUnits the new map measure unit
|
1355 |
1354 |
* @see #getMapUnits()
|
1356 |
1355 |
*/
|
... | ... | |
1375 |
1374 |
* {@link #dist3pixel dist3pixel}) .
|
1376 |
1375 |
* </ul>
|
1377 |
1376 |
* </p>
|
1378 |
|
*
|
|
1377 |
*
|
1379 |
1378 |
* @see #getImageHeight()
|
1380 |
1379 |
* @see #getImageSize()
|
1381 |
1380 |
* @see #setImageSize(Dimension)
|
... | ... | |
1401 |
1400 |
* {@link #dist3pixel dist3pixel}) .
|
1402 |
1401 |
* </ul>
|
1403 |
1402 |
* </p>
|
1404 |
|
*
|
|
1403 |
*
|
1405 |
1404 |
* @see #getImageWidth()
|
1406 |
1405 |
* @see #getImageSize()
|
1407 |
1406 |
* @see #setImageSize(Dimension)
|
... | ... | |
1415 |
1414 |
* Gets the distance in <i>world coordinates</i> equivalent to 1 pixel in the
|
1416 |
1415 |
* view with the current extent.
|
1417 |
1416 |
* </p>
|
1418 |
|
*
|
|
1417 |
*
|
1419 |
1418 |
* @return the distance
|
1420 |
1419 |
* @see #setDist1pixel(double)
|
1421 |
1420 |
*/
|
... | ... | |
1428 |
1427 |
* Sets the distance in <i>world coordinates</i> equivalent to 1 pixel in the
|
1429 |
1428 |
* view with the current extent.
|
1430 |
1429 |
* </p>
|
1431 |
|
*
|
|
1430 |
*
|
1432 |
1431 |
* @param dist1pixel the distance
|
1433 |
1432 |
* @see #getDist1pixel()
|
1434 |
1433 |
*/
|
... | ... | |
1445 |
1444 |
* Gets the distance in <i>world coordinates</i> equivalent to 3 pixels in the
|
1446 |
1445 |
* view with the current extent.
|
1447 |
1446 |
* </p>
|
1448 |
|
*
|
|
1447 |
*
|
1449 |
1448 |
* @return the distance
|
1450 |
1449 |
* @see #setDist3pixel(double)
|
1451 |
1450 |
*/
|
... | ... | |
1458 |
1457 |
* Sets the distance in <i>world coordinates</i> equivalent to 3 pixels in the
|
1459 |
1458 |
* view with the current extent.
|
1460 |
1459 |
* </p>
|
1461 |
|
*
|
|
1460 |
*
|
1462 |
1461 |
* @param dist3pixel the distance
|
1463 |
1462 |
* @see #getDist3pixel()
|
1464 |
1463 |
*/
|
... | ... | |
1474 |
1473 |
* <p>
|
1475 |
1474 |
* Returns the last previous extents of this view port.
|
1476 |
1475 |
* </p>
|
1477 |
|
*
|
|
1476 |
*
|
1478 |
1477 |
* @return the last previous extents of this view port
|
1479 |
1478 |
* @see #setPreviousExtent()
|
1480 |
1479 |
* @deprecated use {@link ViewPort#getEnvelopes()}
|
... | ... | |
1487 |
1486 |
* <p>
|
1488 |
1487 |
* Returns the last previous extents of this view port.
|
1489 |
1488 |
* </p>
|
1490 |
|
*
|
|
1489 |
*
|
1491 |
1490 |
* @return the last previous extents of this view port
|
1492 |
1491 |
* @see #setPreviousExtent()
|
1493 |
1492 |
*/
|
... | ... | |
1499 |
1498 |
* <p>
|
1500 |
1499 |
* Gets the projection used in this view port.
|
1501 |
1500 |
* </p>
|
1502 |
|
*
|
|
1501 |
*
|
1503 |
1502 |
* @return projection used in this view port
|
1504 |
1503 |
* @see #setProjection(IProjection)
|
1505 |
1504 |
*/
|
... | ... | |
1511 |
1510 |
* <p>
|
1512 |
1511 |
* Sets the projection to this view port.
|
1513 |
1512 |
* </p>
|
1514 |
|
*
|
|
1513 |
*
|
1515 |
1514 |
* @param proj the new projection
|
1516 |
1515 |
* @see #getProjection()
|
1517 |
1516 |
*/
|
... | ... | |
1540 |
1539 |
* <p>
|
1541 |
1540 |
* <b><i>This method could be problematic!</i></b>
|
1542 |
1541 |
* </p>
|
1543 |
|
*
|
|
1542 |
*
|
1544 |
1543 |
* @param at the affine transform to set
|
1545 |
1544 |
* @see #getAffineTransform()
|
1546 |
1545 |
* @see #calculateAffineTransform()
|
... | ... | |
1604 |
1603 |
* <li>XML entity of the internal {@link ExtentHistory ExtentHistory} .
|
1605 |
1604 |
* </ul>
|
1606 |
1605 |
* </ul>
|
1607 |
|
*
|
|
1606 |
*
|
1608 |
1607 |
* @return the XML entity
|
1609 |
1608 |
* @see #createFromXML(XMLEntity)
|
1610 |
1609 |
*/
|
... | ... | |
1697 |
1696 |
|
1698 |
1697 |
/**
|
1699 |
1698 |
* Clone the view port without clone the listeners nor the extent history.
|
1700 |
|
*
|
|
1699 |
*
|
1701 |
1700 |
* @return the cloned view port
|
1702 |
1701 |
*/
|
1703 |
1702 |
public Object clone() throws CloneNotSupportedException {
|
... | ... | |
1741 |
1740 |
* <code>{@linkplain #imageSize}</code>, <code>{@linkplain #scale}</code>, and
|
1742 |
1741 |
* <code>{@linkplain #trans}</code>.
|
1743 |
1742 |
* </p>
|
1744 |
|
*
|
|
1743 |
*
|
1745 |
1744 |
* @return a <code>string</code> representation of the main values of this
|
1746 |
1745 |
* view port
|
1747 |
1746 |
*/
|
... | ... | |
1759 |
1758 |
* <p>
|
1760 |
1759 |
* Sets the position and size of the clipping rectangle.
|
1761 |
1760 |
* </p>
|
1762 |
|
*
|
|
1761 |
*
|
1763 |
1762 |
* @param rectView the clipping rectangle to set
|
1764 |
1763 |
*/
|
1765 |
1764 |
public void setClipRect(Rectangle2D rectView) {
|
... | ... | |
1774 |
1773 |
* transform</i> with the transformation affine information in the
|
1775 |
1774 |
* {@link #trans #trans} attribute.
|
1776 |
1775 |
* </p>
|
1777 |
|
*
|
|
1776 |
*
|
1778 |
1777 |
* @param r the 2D rectangle in <i>map coordinates</i>
|
1779 |
1778 |
* @return 2D rectangle equivalent in <i>screen coordinates</i> (pixels)
|
1780 |
1779 |
* @see #toMapRectangle(Rectangle2D)
|
... | ... | |
1794 |
1793 |
* Recalculates the current <code>{@linkplain #extent}</code> using an scale.
|
1795 |
1794 |
* It's necessary execute {@linkplain #refreshExtent()} after.
|
1796 |
1795 |
* </p>
|
1797 |
|
*
|
|
1796 |
*
|
1798 |
1797 |
* @param s the scale to set
|
1799 |
1798 |
* @deprecated since 07/09/07, use {@linkplain MapContext#setScaleView(long)}
|
1800 |
1799 |
*/
|