Revision 20100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/MapContext.java
MapContext.java | ||
---|---|---|
78 | 78 |
/** |
79 | 79 |
* <p>The <code>MapContext</code> class represents the model and a part of the control and view around graphical layers |
80 | 80 |
* used by {@link MapControl MapControl}.</p> |
81 |
* |
|
81 |
*
|
|
82 | 82 |
* <p>An instance of <code>MapContext</code> is made up with: |
83 | 83 |
* <ul> |
84 | 84 |
* <li>a hierarchy of {@link FLayers FLayers} nodes |
85 | 85 |
* <li>a {@link GraphicLayer GraphicLayer} layer |
86 | 86 |
* <li>a {@link ViewPort ViewPort} |
87 | 87 |
* <li>an {@link EventBuffer EventButter} |
88 |
* <li>some {@link com.iver.cit.gvsig.fmap.rendering.LegendListener LegendListener}s
|
|
88 |
* <li>some {@link com.iver.cit.gvsig.fmap.layers.LegendListener LegendListener}s
|
|
89 | 89 |
* <li>some {@link LayerDrawingListener LayerDrawingListener}s |
90 | 90 |
* <li>some {@link LayerEventListener LayerEventListener}s |
91 | 91 |
* <li>some {@link ErrorListener ErrorListener}s |
... | ... | |
97 | 97 |
public class MapContext implements Projected { |
98 | 98 |
/** |
99 | 99 |
* <p>Defines the value which a unit of a distance measurement must be divided to obtain its equivalent <b>in meters</b>.</p> |
100 |
* |
|
100 |
*
|
|
101 | 101 |
* <p><b><i>Conversion values of distance measurements:</i></b> |
102 | 102 |
* <ul> |
103 | 103 |
* <li><code>MapContext.CHANGEM[0]</code>: kilometer |
... | ... | |
110 | 110 |
* <li><code>MapContext.CHANGEM[7]</code>: inch |
111 | 111 |
* <li><code>MapContext.CHANGEM[8]</code>: grade |
112 | 112 |
* </ul> |
113 |
* |
|
113 |
*
|
|
114 | 114 |
* <p><h3>Examples:</h3> |
115 | 115 |
* <pre>1 international statute mile / MapContext.CHANGEM[4] = X meters</pre> |
116 | 116 |
* <pre>1 kilometer / MapContext.CHANGEM[0] = X meters</pre> |
117 | 117 |
* <pre>1 grade / MapContext.CHANGEM[8] = X meters</pre> |
118 | 118 |
* </p> |
119 |
* |
|
120 |
* <p><h3>Grade conversion value: <code>MapContext.CHANGEM[8]</code></h3> |
|
119 |
*
|
|
120 |
* <p><h3>Grade conversion value: <code>MapContext.CHANGEM[8]</code></h3>
|
|
121 | 121 |
* The value of <code>MapContext.CHANGEM[8]</code> represents the meters of a straight line between two |
122 |
* points on the Earth surface that are 1 grade far each other of the center of the Earth. This value has been calculated using |
|
122 |
* points on the Earth surface that are 1 grade far each other of the center of the Earth. This value has been calculated using
|
|
123 | 123 |
* a radius approximated of R<sub>Earth</sub>=6.37846082678100774672e6 meters, according these equations: |
124 | 124 |
* <pre>D = 2 * (sin (1)) * R<sub>Earth</sub></pre> |
125 | 125 |
* <pre>MapContext.CHANGEM[8] = 1 / D</pre> |
... | ... | |
132 | 132 |
public static final double[] CHANGEM = { 1000, 1, 0.01, 0.001, 1609.344, |
133 | 133 |
0.9144, 0.3048, 0.0254, 1/8.983152841195214E-6 }; |
134 | 134 |
|
135 |
|
|
135 | 136 |
/** |
136 | 137 |
* <p>Defines the value which a unit of a distance measurement must be divided to obtain its equivalent <b>in centimeters</b>.</p> |
137 |
* |
|
138 |
*
|
|
138 | 139 |
* <p><b><i>Conversion values of distance measurements:</i></b> |
139 | 140 |
* <ul> |
140 | 141 |
* <li><code>MapContext.CHANGE[0]</code>: kilometer |
... | ... | |
147 | 148 |
* <li><code>MapContext.CHANGE[7]</code>: inch |
148 | 149 |
* <li><code>MapContext.CHANGE[8]</code>: grade |
149 | 150 |
* </ul> |
150 |
* |
|
151 |
*
|
|
151 | 152 |
* <p><h3>Examples:</h3> |
152 | 153 |
* <pre>1 international statute mile / MapContext.CHANGE[4] = X centimeters</pre> |
153 | 154 |
* <pre>1 kilometer / MapContext.CHANGE[0] = X centimeters</pre> |
154 | 155 |
* <pre>1 grade / MapContext.CHANGE[8] = X centimeters</pre> |
155 | 156 |
* </p> |
156 |
* |
|
157 |
* <p><h3>Grade conversion value: <code>MapContext.CHANGE[8]</code></h3> |
|
157 |
*
|
|
158 |
* <p><h3>Grade conversion value: <code>MapContext.CHANGE[8]</code></h3>
|
|
158 | 159 |
* The value of <code>MapContext.CHANGE[8]</code> represents the centimeters of a straight line between two |
159 |
* points on the Earth surface that are 1 grade far each other of the center of the Earth. This value has been calculated using |
|
160 |
* points on the Earth surface that are 1 grade far each other of the center of the Earth. This value has been calculated using
|
|
160 | 161 |
* a radius approximated of R<sub>Earth</sub>=6.37846082678100774672e6 meters, according these equations: |
161 | 162 |
* <pre>D = 2 * (sin (1)) * R<sub>Earth</sub></pre> |
162 | 163 |
* <pre>MapContext.CHANGE[8] = 1 / D</pre> |
... | ... | |
211 | 212 |
|
212 | 213 |
/** |
213 | 214 |
* A hierarchy of {@link FLayers FLayers} nodes. |
214 |
* |
|
215 |
*
|
|
215 | 216 |
* @see #getLayers() |
216 | 217 |
* @see #print(Graphics2D, double, PrintRequestAttributeSet) |
217 | 218 |
*/ |
... | ... | |
219 | 220 |
|
220 | 221 |
/** |
221 | 222 |
* A layer with graphical items: geometries and symbols. |
222 |
* |
|
223 |
*
|
|
223 | 224 |
* @see #getGraphicsLayer() |
224 | 225 |
* @see #setGraphicsLayer(GraphicLayer) |
225 | 226 |
* @see #drawGraphics(BufferedImage, Graphics2D, Cancellable, double) |
... | ... | |
229 | 230 |
|
230 | 231 |
/** |
231 | 232 |
* Information for draw layers in a view. |
232 |
* |
|
233 |
*
|
|
233 | 234 |
* @see #getViewPort() |
234 | 235 |
* @see #setViewPort(ViewPort) |
235 | 236 |
*/ |
... | ... | |
239 | 240 |
|
240 | 241 |
/** |
241 | 242 |
* Array list with all {@link LegendListener LegendListener} registered to this map. |
242 |
* |
|
243 |
*
|
|
243 | 244 |
* @see #addLayerListener(LegendListener) |
244 | 245 |
* @see #removeLayerListener(LegendListener) |
245 | 246 |
* @see #callLegendChanged() |
... | ... | |
248 | 249 |
|
249 | 250 |
/** |
250 | 251 |
* Array list with all {@link LayerDrawingListener LayerDrawingListener} registered to this map. |
251 |
* |
|
252 |
*
|
|
252 | 253 |
* @see #addLayerDrawingListener(LayerDrawingListener) |
253 | 254 |
* @see #removeLayerDrawListener(LayerDrawingListener) |
254 | 255 |
* @see #fireLayerDrawingEvent(LayerDrawEvent) |
... | ... | |
266 | 267 |
* <li>Selection events on an {@link AlphanumericData AlphanumericData} data layer. |
267 | 268 |
* </ul> |
268 | 269 |
* </p> |
269 |
* |
|
270 |
*
|
|
270 | 271 |
* @see #addAtomicEventListener(AtomicEventListener) |
271 | 272 |
* @see #removeAtomicEventListener(AtomicEventListener) |
272 | 273 |
* @see #beginAtomicEvent() |
... | ... | |
281 | 282 |
|
282 | 283 |
/** |
283 | 284 |
* List with information of all errors produced on all layers. |
284 |
* |
|
285 |
*
|
|
285 | 286 |
* @see #addLayerError(String) |
286 | 287 |
* @see #getLayersError() |
287 | 288 |
* @see #clearErrors() |
... | ... | |
302 | 303 |
// ResourceBundle.getBundle("FMap"); |
303 | 304 |
|
304 | 305 |
/** |
305 |
* <p>Default zoom in factor.</p>
|
|
306 |
* <p>Default <i>zoom in</i> factor.</p>
|
|
306 | 307 |
* <p>Doing a <i>zoom in</i> operation, decreases the focal distance and increases the eyesight angle to the surface. This allows view an smaller |
307 | 308 |
* area but with the items bigger.</p> |
308 | 309 |
*/ |
309 | 310 |
public static double ZOOMINFACTOR=2; |
310 | 311 |
|
311 | 312 |
/** |
312 |
* <p>Default zoom out factor.</p>
|
|
313 |
* <p>Default <i>zoom out</i> factor.</p>
|
|
313 | 314 |
* <p>Doing a <i>zoom out</i> operation, increases the focal distance and decreases the eyesight angle to the surface. This allows view a bigger |
314 | 315 |
* area but with the items smaller.</p> |
315 | 316 |
*/ |
... | ... | |
319 | 320 |
* <p>Creates a new map context with the drawing information defined in the view port argument, and |
320 | 321 |
* without layers.</p> |
321 | 322 |
* |
322 |
* @param vp information for drawing the layers of this map as a view
|
|
323 |
* @param vp information for drawing the layers of this map in the available rectangular area according a projection
|
|
323 | 324 |
*/ |
324 | 325 |
public MapContext(ViewPort vp) { |
325 | 326 |
this.layers = new FLayers(this, null); |
... | ... | |
333 | 334 |
|
334 | 335 |
/** |
335 | 336 |
* <p>Creates a new map context with the layers and the drawing information defined in the view port arguments.</p> |
336 |
* |
|
337 |
*
|
|
337 | 338 |
* @param fLayers the initial hierarchy of nodes of layers that this map will have |
338 |
* @param vp information for drawing the layers of this map as a view
|
|
339 |
* @param vp information for drawing the layers of this map in the available rectangular area according a projection
|
|
339 | 340 |
*/ |
340 | 341 |
public MapContext(FLayers fLayers, ViewPort vp) { |
341 | 342 |
this.layers = fLayers; |
... | ... | |
348 | 349 |
} |
349 | 350 |
|
350 | 351 |
/** |
351 |
* <p>Reports to all driver error listeners registered of a bundle of driver exceptions caused in the same map atomic transaction.</p> |
|
352 |
* |
|
352 |
* <p>Reports to all driver error listeners registered of a bundle of driver exceptions caused in the same map atomic transaction.</p>
|
|
353 |
*
|
|
353 | 354 |
* @param introductoryText introductory text specified by developer. If <code>null</code>, use "" |
354 | 355 |
* @param driverExceptions list with a bundle of driver exceptions caught during an atomic event |
355 |
* |
|
356 |
*
|
|
356 | 357 |
* @see #addErrorListener(ErrorListener) |
357 | 358 |
* @see #removeErrorListener(LegendListener) |
358 | 359 |
* @see #callNewErrorEvent(ErrorEvent) |
... | ... | |
369 | 370 |
* <p>Adds the specified legend listener (if didn't exist) to receive legend events from this map.</p> |
370 | 371 |
* |
371 | 372 |
* @param listener the legend listener |
372 |
* |
|
373 |
*
|
|
373 | 374 |
* @see #removeLayerListener(LegendListener) |
374 | 375 |
* @see #callLegendChanged() |
375 | 376 |
*/ |
... | ... | |
385 | 386 |
|
386 | 387 |
/** |
387 | 388 |
* <p>Adds the specified layer drawing listener to catch and handle drawing events from layers of this map.</p> |
388 |
* |
|
389 |
*
|
|
389 | 390 |
* @param listener the listener to add |
390 |
* |
|
391 |
*
|
|
391 | 392 |
* @see #removeLayerDrawListener(LayerDrawingListener) |
392 | 393 |
* @see #fireLayerDrawingEvent(LayerDrawEvent) |
393 | 394 |
*/ |
... | ... | |
397 | 398 |
|
398 | 399 |
/** |
399 | 400 |
* <p>Removes the specified layer drawing listener from this map.</p> |
400 |
* |
|
401 |
*
|
|
401 | 402 |
* @param listener the listener to remove |
402 |
* |
|
403 |
*
|
|
403 | 404 |
* @see #addLayerDrawingListener(LayerDrawingListener) |
404 | 405 |
* @see #fireLayerDrawingEvent(LayerDrawEvent) |
405 | 406 |
*/ |
... | ... | |
409 | 410 |
|
410 | 411 |
/** |
411 | 412 |
* <p>Adds the specified error listener to receive error events from this map.</p> |
412 |
* |
|
413 |
*
|
|
413 | 414 |
* @param listener the listener to add |
414 |
* |
|
415 |
*
|
|
415 | 416 |
* @see #removeErrorListener(LegendListener) |
416 | 417 |
* @see #callNewErrorEvent(ErrorEvent) |
417 | 418 |
* @see #reportDriverExceptions(String, List) |
... | ... | |
422 | 423 |
|
423 | 424 |
/** |
424 | 425 |
* <p>Removes the specified error listener from this map.</p> |
425 |
* |
|
426 |
*
|
|
426 | 427 |
* @param listener the listener to remove |
427 |
* |
|
428 |
*
|
|
428 | 429 |
* @see #addErrorListener(ErrorListener) |
429 | 430 |
* @see #callNewErrorEvent(ErrorEvent) |
430 | 431 |
* @see #reportDriverExceptions(String, List) |
... | ... | |
439 | 440 |
|
440 | 441 |
/** |
441 | 442 |
* <p>Notifies to all legend listeners registered, that one legend has changed.</p> |
442 |
* <p>This method must be call only if it's wanted to reflect a legend change.</p> |
|
443 |
* |
|
443 |
* <p>This method must be called only if it's wanted to reflect a legend change.</p>
|
|
444 |
*
|
|
444 | 445 |
* @see #addLayerListener(LegendListener) |
445 | 446 |
* @see #removeLayerListener(LegendListener) |
446 | 447 |
*/ |
... | ... | |
454 | 455 |
/** |
455 | 456 |
* <p>Fires a layer drawing event to all {@link LayerDrawingListener LayerDrawingListener} listeners registered, |
456 | 457 |
* distinguishing the kind of event.</p> |
457 |
* |
|
458 |
*
|
|
458 | 459 |
* @param e the event |
459 | 460 |
* |
460 | 461 |
* @see #addLayerDrawingListener(LayerDrawingListener) |
... | ... | |
485 | 486 |
|
486 | 487 |
/** |
487 | 488 |
* <p>Notifies to all error listeners registered, that one error has been produced.</p> |
488 |
* |
|
489 |
*
|
|
489 | 490 |
* @param e the event with information of the error |
490 |
* |
|
491 |
*
|
|
491 | 492 |
* @see #addErrorListener(ErrorListener) |
492 | 493 |
* @see #removeErrorListener(LegendListener) |
493 | 494 |
* @see #reportDriverExceptions(String, List) |
... | ... | |
501 | 502 |
|
502 | 503 |
/** |
503 | 504 |
* <p>Removes the specified layer listener from this map.</p> |
504 |
* |
|
505 |
*
|
|
505 | 506 |
* @param listener the listener to remove |
506 |
* |
|
507 |
*
|
|
507 | 508 |
* @see #addLayerListener(LegendListener) |
508 | 509 |
* @see #callLegendChanged() |
509 | 510 |
*/ |
... | ... | |
548 | 549 |
* @param properties a set with the settings to be applied to a whole print job and to all the documents in the print job |
549 | 550 |
* |
550 | 551 |
* @throws DriverException if fails using some driver. |
551 |
* |
|
552 |
*
|
|
552 | 553 |
* @see FLayers#print(Graphics2D, ViewPort, Cancellable, double, PrintRequestAttributeSet) |
553 | 554 |
* @see GraphicLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double) |
554 | 555 |
*/ |
... | ... | |
581 | 582 |
} |
582 | 583 |
|
583 | 584 |
/** |
584 |
* <p>Returns a new map with the information of the <code>vp</code> argument, and the layers of this map.</p>
|
|
585 |
* <p>Returns a new <code>MapContext</code> instance with the information of the <code>vp</code> argument, and the layers of this map.</p>
|
|
585 | 586 |
* |
586 |
* @param vp information for drawing the layers |
|
587 |
* @param vp information for drawing the layers of this map in the available rectangular area according a projection
|
|
587 | 588 |
* |
588 |
* @return a new map
|
|
589 |
* @return a new <code>MapContext</code> instance projected by <code>vp</code>
|
|
589 | 590 |
*/ |
590 | 591 |
public MapContext createNewFMap(ViewPort vp) { |
591 | 592 |
MapContext ret = new MapContext(vp); |
... | ... | |
595 | 596 |
} |
596 | 597 |
|
597 | 598 |
/** |
598 |
* <p>Creates a new independent map, that has a clone of the layers and the view port of this one.</p>
|
|
599 |
* <p>Creates a new independent <code>MapContext</code> instance, that has a clone of the layers and the view port of this one.</p>
|
|
599 | 600 |
* <p>The new map will have the same data source drivers to avoid waste memory, and work faster.</p> |
600 | 601 |
* |
601 |
* @return the new map
|
|
602 |
* @return the new <code>MapContext</code> instance
|
|
602 | 603 |
* |
603 | 604 |
* @throws XMLException if fails cloning the view port or a layer |
604 |
* |
|
605 |
*
|
|
605 | 606 |
* @see FLayer#cloneLayer() |
606 | 607 |
* @see ViewPort#cloneViewPort() |
607 | 608 |
*/ |
... | ... | |
627 | 628 |
|
628 | 629 |
/** |
629 | 630 |
* Like {@linkplain #cloneFMap()}, but now doesn't clone the layers, rather copies them. |
630 |
* |
|
631 |
*
|
|
631 | 632 |
* @return the new map |
632 | 633 |
*/ |
633 | 634 |
public MapContext cloneToDraw() { |
... | ... | |
670 | 671 |
* <li><code>-1</code> if there is no image |
671 | 672 |
* <li><code>0</code> if there is no extent defined for the image |
672 | 673 |
* </ul> |
673 |
* |
|
674 |
*
|
|
674 | 675 |
* @see #setScaleView(long) |
675 | 676 |
* @see ViewPort#getAdjustedExtent() |
676 | 677 |
* @see IProjection#getScale(double, double, double, double) |
... | ... | |
701 | 702 |
(viewPort.getAdjustedExtent().getMaxX()*CHANGEM[1]), viewPort.getImageSize() |
702 | 703 |
.getWidth(), dpi)); |
703 | 704 |
} |
705 |
|
|
704 | 706 |
/** |
705 | 707 |
* <p>Sets the new extent of the view, calculated using the scale argument.</p> |
706 | 708 |
* <p>Doesn't updates the scale if there isn't information about the dimension of the image or the |
707 | 709 |
* adjusted extent.</p> |
708 | 710 |
* |
709 | 711 |
* @param scale the new scale for the view |
710 |
* |
|
712 |
*
|
|
711 | 713 |
* @see ViewPort#setProjection(IProjection) |
712 | 714 |
* @see #getScaleView() |
713 | 715 |
*/ |
... | ... | |
751 | 753 |
* <p>Sets the new projection.</p> |
752 | 754 |
* |
753 | 755 |
* @param proj the new projection |
754 |
* |
|
756 |
*
|
|
755 | 757 |
* @see #getProjection() |
756 | 758 |
* @see ViewPort#setProjection(IProjection) |
757 | 759 |
* @see #reProject(ICoordTrans) |
... | ... | |
771 | 773 |
|
772 | 774 |
/** |
773 | 775 |
* @see com.iver.cit.gvsig.fmap.operations.strategies.Strategy#getSelectionBounds() |
774 |
* |
|
776 |
*
|
|
775 | 777 |
* @see SelectedZoomVisitor#getSelectBound() |
776 | 778 |
*/ |
777 | 779 |
public Rectangle2D getSelectionBounds() { |
... | ... | |
796 | 798 |
* <p>Draws this map if its {@link ViewPort ViewPort} has an extent defined:<br> |
797 | 799 |
* <ol> |
798 | 800 |
* <li>Selects only the layers that have to be drawn: {@linkplain #prepareDrawing(BufferedImage, Graphics2D, double)}. |
799 |
* <li>Sets quality: antialiasing by text and images, and quality rendering. |
|
801 |
* <li>Sets quality: antialiasing by text and images, and quality rendering.
|
|
800 | 802 |
* <li>Draws the layers. |
801 | 803 |
* <li>Fires a <code>LayerDrawEvent.GRAPHICLAYER_BEFORE_DRAW</code>. |
802 | 804 |
* <li>Draws the graphic layer. |
803 | 805 |
* <li>Fires a <code>LayerDrawEvent.GRAPHICLAYER_AFTER_DRAW</code>. |
804 | 806 |
* <li>Invokes the garbage collector and memory clean. |
805 | 807 |
* </ol></p> |
806 |
* |
|
808 |
*
|
|
807 | 809 |
* @param image buffer used sometimes instead <code>g</code> to accelerate the draw. For example, if two points are as closed that can't be distinguished, draws only one. |
808 | 810 |
* @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform |
809 |
* @param cancel an object thread that implements the {@link Cancellable Cancellable} interface, and will allow to cancel the draw
|
|
811 |
* @param cancel shared object that determines if this layer can continue being drawn
|
|
810 | 812 |
* @param scale the scale of the view. Must be between {@linkplain FLayer#getMinScale()} and {@linkplain FLayer#getMaxScale()}. |
811 | 813 |
* @throws DriverException if fails using some driver. |
812 | 814 |
*/ |
... | ... | |
864 | 866 |
* that layer must be repainted. </p> |
865 | 867 |
* <p>If one layer node needn't to be repainted, checks out it recursively.</p> |
866 | 868 |
* <p><i>The cache of "previous image drawn" allows accelerate the repaint process.</i></p> |
867 |
* |
|
869 |
*
|
|
868 | 870 |
* @see #draw(BufferedImage, Graphics2D, Cancellable, double) |
869 | 871 |
* @see #recursivePrepareDrawing(FLayers, int) |
870 | 872 |
*/ |
... | ... | |
902 | 904 |
* <p>Each layer node can decide validate or not it's sub-layers according its implementation.</p> |
903 | 905 |
* <p>This is useful when it's editing, for accelerate the draw, because the layers of a {@link FLayers FLayers} node |
904 | 906 |
* are painted according its index in the collection, and each one upper the previous.</p> |
905 |
* |
|
906 |
* @param layers a node with layers |
|
907 |
*
|
|
908 |
* @param layers a node with layers
|
|
907 | 909 |
* @param index index of the current layer in the internal list of layers |
908 |
* |
|
910 |
*
|
|
909 | 911 |
* @see #recursivePrepareDrawing(FLayers, int) |
910 | 912 |
* @see #prepareDrawing(BufferedImage, Graphics2D, double) |
911 | 913 |
*/ |
... | ... | |
929 | 931 |
/** |
930 | 932 |
* <p>Checks out recursively, layers that have a cache with an image of previous layers drawn, and if are dirty |
931 | 933 |
* notify the previous layers that are valid.</p> |
932 |
* |
|
934 |
*
|
|
933 | 935 |
* @param parent node that contains the layers |
934 | 936 |
* @param indexInParent the least layer index in the <code>parent</code> argument. This allows reduce the time processing |
935 | 937 |
* if is known that the first layers aren't a collection and will (or won't) be validated |
936 |
* |
|
938 |
*
|
|
937 | 939 |
* @see #prepareDrawing(BufferedImage, Graphics2D, double) |
938 | 940 |
*/ |
939 | 941 |
private void recursivePrepareDrawing(FLayers parent) |
... | ... | |
958 | 960 |
|
959 | 961 |
/** |
960 | 962 |
* <p>Draws only the internal graphic layer using the information of the {@link ViewPort ViewPort} of this map.</p> |
961 |
* |
|
963 |
*
|
|
962 | 964 |
* @param image image used to accelerate the screen draw |
963 | 965 |
* @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform |
964 |
* @param cancel an object thread that implements the {@link Cancellable Cancellable} interface, and will allow to cancel the draw
|
|
966 |
* @param cancel shared object that determines if this layer can continue being drawn
|
|
965 | 967 |
* @param scale value that represents the scale |
966 | 968 |
* @throws DriverException if fails using some driver. |
967 |
* |
|
969 |
*
|
|
968 | 970 |
* @see GraphicLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double) |
969 | 971 |
*/ |
970 | 972 |
public void drawGraphics(BufferedImage image, Graphics2D g, |
... | ... | |
977 | 979 |
/** |
978 | 980 |
* <p>Like {@linkplain MapContext#draw(BufferedImage, Graphics2D, Cancellable, double)}, but creating |
979 | 981 |
* the task as cancellable.</p> |
980 |
* |
|
982 |
*
|
|
981 | 983 |
* @param image buffer used sometimes instead <code>g</code> to accelerate the draw. For example, if two points are as closed that can't be distinguished, draws only one. |
982 | 984 |
* @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform |
983 | 985 |
* @param scale the scale of the view. Must be between {@linkplain FLayer#getMinScale()} and {@linkplain FLayer#getMaxScale()}. |
984 |
* |
|
986 |
*
|
|
985 | 987 |
* @throws DriverException if fails using some driver. |
986 |
* |
|
988 |
*
|
|
987 | 989 |
* @see #draw(BufferedImage, Graphics2D, Cancellable, double) |
988 | 990 |
*/ |
989 | 991 |
public void draw(BufferedImage image, Graphics2D g, double scale) |
... | ... | |
1011 | 1013 |
* <p>Gets the {@link ViewPort ViewPort} associated to this map.</p> |
1012 | 1014 |
* |
1013 | 1015 |
* @return the view port |
1014 |
* |
|
1016 |
*
|
|
1015 | 1017 |
* @see #setViewPort(ViewPort) |
1016 | 1018 |
*/ |
1017 | 1019 |
public ViewPort getViewPort() { |
... | ... | |
1025 | 1027 |
* adds the new one.</p> |
1026 | 1028 |
* |
1027 | 1029 |
* @param viewPort the viewPort |
1028 |
* |
|
1030 |
*
|
|
1029 | 1031 |
* @see #getViewPort() |
1030 | 1032 |
*/ |
1031 | 1033 |
public void setViewPort(ViewPort viewPort) { |
... | ... | |
1053 | 1055 |
* |
1054 | 1056 |
* @return full extent of layers of this map |
1055 | 1057 |
* @throws DriverException if fails using a driver. |
1056 |
* |
|
1058 |
*
|
|
1057 | 1059 |
* @see FLayers#getFullExtent() |
1058 | 1060 |
*/ |
1059 | 1061 |
public Rectangle2D getFullExtent() throws DriverException { |
... | ... | |
1066 | 1068 |
* <li>XML entity of the internal {@link ViewPort ViewPort}. |
1067 | 1069 |
* <li>XML entity of the internal {@link FLayers FLayers}. |
1068 | 1070 |
* </ul> |
1069 |
* |
|
1071 |
*
|
|
1070 | 1072 |
* @return XMLEntity the XML entity |
1071 | 1073 |
* @throws XMLException if there is any error creating the XML from the map. |
1072 |
* |
|
1074 |
*
|
|
1073 | 1075 |
* @see #createFromXML(XMLEntity) |
1074 | 1076 |
* @see #createFromXML03(XMLEntity) |
1075 | 1077 |
* @see ViewPort#getXMLEntity() |
... | ... | |
1085 | 1087 |
} |
1086 | 1088 |
|
1087 | 1089 |
/** |
1088 |
* <p>Creates a new <code>MapContext</code> from an XML entity, with |
|
1090 |
* <p>Creates a new <code>MapContext</code> instance from an XML entity, with
|
|
1089 | 1091 |
* the data of the {@link ViewPort ViewPort} and |
1090 | 1092 |
* {@link FLayers FLayers}.</p> |
1091 | 1093 |
* |
1092 | 1094 |
* @param xml an XML entity |
1093 | 1095 |
* |
1094 |
* @return the new <code>MapContext</code> |
|
1096 |
* @return the new <code>MapContext</code> instance
|
|
1095 | 1097 |
* |
1096 | 1098 |
* @throws XMLException if there is any error creating the map from the XML. |
1097 |
* |
|
1099 |
*
|
|
1098 | 1100 |
* @see #getXMLEntity() |
1099 | 1101 |
* @see #createFromXML(XMLEntity) |
1100 | 1102 |
* @see ViewPort#createFromXML03(XMLEntity) |
... | ... | |
1109 | 1111 |
} |
1110 | 1112 |
|
1111 | 1113 |
/** |
1112 |
* <p>Creates a new <code>MapContext</code> from an XML entity, with |
|
1114 |
* <p>Creates a new <code>MapContext</code> instance from an XML entity, with
|
|
1113 | 1115 |
* with the data of the {@link ViewPort ViewPort} and |
1114 | 1116 |
* {@link FLayers FLayers}.</p> |
1115 | 1117 |
* |
1116 | 1118 |
* @param xml an XML entity |
1117 | 1119 |
* |
1118 |
* @return the new <code>MapContext</code> |
|
1120 |
* @return the new <code>MapContext</code> instance
|
|
1119 | 1121 |
* |
1120 | 1122 |
* @throws XMLException if there is any error creating the map from the XML. |
1121 |
* |
|
1123 |
*
|
|
1122 | 1124 |
* @see #getXMLEntity() |
1123 | 1125 |
* @see #createFromXML03(XMLEntity) |
1124 | 1126 |
* @see ViewPort#createFromXML(XMLEntity) |
... | ... | |
1138 | 1140 |
* @param listener the new listener |
1139 | 1141 |
* |
1140 | 1142 |
* @return <code>true</code> if has added the listener successfully |
1141 |
* |
|
1142 |
* @see #removeAtomicEventListener(AtomicEventListener) |
|
1143 |
*
|
|
1144 |
* @see #removeAtomicEventListener(AtomicEventListener)
|
|
1143 | 1145 |
* @see EventBuffer#addAtomicEventListener(AtomicEventListener) |
1144 | 1146 |
*/ |
1145 | 1147 |
public boolean addAtomicEventListener(AtomicEventListener listener) { |
... | ... | |
1150 | 1152 |
* <p>Removes a listener of atomic events from the internal {@link EventBuffer EventBuffer}.</p> |
1151 | 1153 |
* |
1152 | 1154 |
* @param listener the listener to remove |
1153 |
* |
|
1155 |
*
|
|
1154 | 1156 |
* @return <tt>true</tt> if the list contained the specified element |
1155 |
* |
|
1157 |
*
|
|
1156 | 1158 |
* @see #addAtomicEventListener(AtomicEventListener) |
1157 | 1159 |
* @see EventBuffer#removeAtomicEventListener(AtomicEventListener) |
1158 | 1160 |
*/ |
... | ... | |
1162 | 1164 |
|
1163 | 1165 |
/** |
1164 | 1166 |
* @see EventBuffer#beginAtomicEvent() |
1165 |
* |
|
1167 |
*
|
|
1166 | 1168 |
* @see #endAtomicEvent() |
1167 | 1169 |
*/ |
1168 | 1170 |
public void beginAtomicEvent() { |
... | ... | |
1171 | 1173 |
|
1172 | 1174 |
/** |
1173 | 1175 |
* @see EventBuffer#endAtomicEvent() |
1174 |
* |
|
1176 |
*
|
|
1175 | 1177 |
* @see #beginAtomicEvent() |
1176 | 1178 |
*/ |
1177 | 1179 |
public void endAtomicEvent() { |
... | ... | |
1211 | 1213 |
* |
1212 | 1214 |
* <p>Each {@link FLayer FLayer} of this map must have an event buffer for all kind |
1213 | 1215 |
* of specific listeners of that layer. This method distinguish between {@link Classifiable Classifiable}, |
1214 |
* {@link AlphanumericData AlphanumericData}, and {@link FLayers FLayers} layers, and for each one, |
|
1215 |
* registers, for their specific listeners, the <code>eventBuffer</code> as a listener.</p> |
|
1216 |
* |
|
1216 |
* {@link AlphanumericData AlphanumericData}, and {@link FLayers FLayers} layers, and for each one,
|
|
1217 |
* registers, for their specific listeners, the <code>eventBuffer</code> as a listener.</p>
|
|
1218 |
*
|
|
1217 | 1219 |
* @param the layer or layers |
1218 | 1220 |
*/ |
1219 | 1221 |
private void selectionListener(FLayer lyr){ |
... | ... | |
1300 | 1302 |
} |
1301 | 1303 |
|
1302 | 1304 |
/** |
1303 |
* <p>Adds the {@link LayerEventListener LayerEventListener} of this map to the |
|
1304 |
* collection of layers argument.</p> |
|
1305 |
* |
|
1305 |
* <p>Adds the {@link LayerEventListener LayerEventListener} of this map to the
|
|
1306 |
* collection of layers argument.</p>
|
|
1307 |
*
|
|
1306 | 1308 |
* @param a collection of layers |
1307 | 1309 |
*/ |
1308 | 1310 |
public void addAsCollectionListener(FLayers layers2) { |
... | ... | |
1311 | 1313 |
|
1312 | 1314 |
/** |
1313 | 1315 |
* <p>Returns the internal {@link GraphicLayer GraphicLayer}.</p> |
1314 |
* |
|
1316 |
*
|
|
1315 | 1317 |
* @return the graphic layer of this map |
1316 |
* |
|
1318 |
*
|
|
1317 | 1319 |
* @see #setGraphicsLayer(GraphicLayer) |
1318 | 1320 |
*/ |
1319 | 1321 |
public GraphicLayer getGraphicsLayer() { |
... | ... | |
1322 | 1324 |
|
1323 | 1325 |
/** |
1324 | 1326 |
* <p>Sets a new {@link GraphicLayer GraphicLayer} to this map.</p> |
1325 |
* |
|
1327 |
*
|
|
1326 | 1328 |
* @param graphicLayer the new graphic layer |
1327 |
* |
|
1329 |
*
|
|
1328 | 1330 |
* @see #getGraphicsLayer() |
1329 | 1331 |
*/ |
1330 | 1332 |
public void setGraphicsLayer(GraphicLayer graphicLayer) { |
... | ... | |
1334 | 1336 |
/** |
1335 | 1337 |
* <p>Indicates whether some other object is "equal to" this map.</p> |
1336 | 1338 |
* <p>Returns <code>true</code> if success one of this options: |
1337 |
* <ol>
|
|
1339 |
* <ul>
|
|
1338 | 1340 |
* <li>Both objects are equal according to {@linkplain Object#equals(Object)}. |
1339 | 1341 |
* <li>Both maps have the same layers. |
1340 | 1342 |
* <li>Both maps have the same number of layers and with the same name. |
1341 |
* </ol>
|
|
1343 |
* </ul>
|
|
1342 | 1344 |
* </p> |
1343 |
* |
|
1345 |
*
|
|
1344 | 1346 |
* @param obj the reference object with which to compare. |
1345 |
* @return <code>true</code> if this object is the same as the <code>arg0</code> argument; <code>false</code> otherwise.
|
|
1346 |
* |
|
1347 |
* @return <code>true</code> if this object is the same as the <code>arg0</code> argument; otherwise <code>false</code>.
|
|
1348 |
*
|
|
1347 | 1349 |
* @see Object#equals(Object) |
1348 | 1350 |
*/ |
1349 | 1351 |
public boolean equals(Object arg0) { |
... | ... | |
1370 | 1372 |
|
1371 | 1373 |
/** |
1372 | 1374 |
* <p>Registers the message of an error associated to this map.</p> |
1373 |
* |
|
1375 |
*
|
|
1374 | 1376 |
* @param stringProperty the error message |
1375 |
* |
|
1377 |
*
|
|
1376 | 1378 |
* @see #getLayersError() |
1377 | 1379 |
* @see #clearErrors() |
1378 | 1380 |
*/ |
... | ... | |
1381 | 1383 |
} |
1382 | 1384 |
|
1383 | 1385 |
/** |
1384 |
* <p>Gets the list with all errors messages registered to this map.</p>
|
|
1385 |
* |
|
1386 |
* <p>Gets the list with all error messages registered to this map.</p> |
|
1387 |
*
|
|
1386 | 1388 |
* @return the list of errors registered to this map |
1387 |
* |
|
1389 |
*
|
|
1388 | 1390 |
* @see #addLayerError(String) |
1389 | 1391 |
* @see #clearErrors() |
1390 | 1392 |
*/ |
... | ... | |
1394 | 1396 |
|
1395 | 1397 |
/** |
1396 | 1398 |
* <p>Removes all error messages associated to this map.</p> |
1397 |
* |
|
1399 |
*
|
|
1398 | 1400 |
* @see #addLayerError(String) |
1399 | 1401 |
* @see #getLayersError() |
1400 | 1402 |
*/ |
... | ... | |
1404 | 1406 |
|
1405 | 1407 |
/** |
1406 | 1408 |
* <p>Removes from this map, all caching images of drawn layers, registered.</p> |
1407 |
* |
|
1409 |
*
|
|
1408 | 1410 |
* @see #clearCachingImageDrawnLayers(FLayers) |
1409 | 1411 |
*/ |
1410 | 1412 |
public void clearAllCachingImageDrawnLayers() { |
1411 | 1413 |
clearCachingImageDrawnLayers(this.layers); |
1412 | 1414 |
} |
1413 |
|
|
1415 |
|
|
1414 | 1416 |
/** |
1415 | 1417 |
* <p>Removes from the layer collection argument, all caching images of drawn layers, registered.</p> |
1416 |
* |
|
1418 |
*
|
|
1417 | 1419 |
* @param layers a layer collection |
1418 |
* |
|
1420 |
*
|
|
1419 | 1421 |
* @see #clearAllCachingImageDrawnLayers() |
1420 | 1422 |
*/ |
1421 | 1423 |
private void clearCachingImageDrawnLayers(FLayers layers){ |
... | ... | |
1431 | 1433 |
} |
1432 | 1434 |
} |
1433 | 1435 |
|
1436 |
|
|
1434 | 1437 |
/** |
1435 |
* <p>Applies for a refresh everything what depends on this map: TOC, <code>MapControl</code>, |
|
1436 |
* <code>FFrameView</code>, ... To do this, it produces an event of layer order change.</p> |
|
1438 |
* <p>Refreshes all layers.</p> |
|
1439 |
* |
|
1440 |
* <p>To do this, it produces an event of layer order change.</p> |
|
1437 | 1441 |
*/ |
1438 | 1442 |
public void redraw() { |
1439 | 1443 |
// truco |
Also available in: Unified diff