Package org.apache.sis.gui.map
Class MapCanvasAWT
Object
Canvas
PlanarCanvas
MapCanvas
MapCanvasAWT
- All Implemented Interfaces:
- Localized
- Direct Known Subclasses:
- CoverageCanvas
A canvas for maps to be rendered using Java2D from Abstract Window Toolkit.
 The map is rendered using Java2D in a background thread, then copied in a JavaFX image.
 Java2D is used for rendering the map because it may contain too many elements for a scene graph.
 After the map has been rendered, other JavaFX nodes can be put on top of the map, typically for
 controls by the user.
- Since:
- 1.1
Defined in the sis-javafx module
- 
Property Summary
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static classA snapshot ofMapCanvasAWTstate to paint as an image.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final ImageViewThe node where the rendered map will be shown.final ObjectProperty<Insets>Number of additional pixels to paint on each sides of the image, outside the viewing area.Fields inherited from class MapCanvasfixedPane, floatingPaneFields inherited from class PlanarCanvasBIDIMENSIONAL, objectiveToDisplayFields inherited from class CanvasDISPLAY_BOUNDS_PROPERTY, OBJECTIVE_CRS_PROPERTY, OBJECTIVE_TO_DISPLAY_PROPERTY, POINT_OF_INTEREST_PROPERTY
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Registers a listener for the property of the given name.protected voidclear()Clears the image and all intermediate buffer.protected abstract MapCanvasAWT.RendererInvoked in JavaFX thread for creating a renderer to be executed in a background thread.protected voidNotifies all registered listeners that a property changed its value.protected voidfirePropertyChange(String propertyName, Object oldValue, Object newValue) Notifies all registered listeners that a property of the given name changed its value.protected final booleanhasPropertyChangeListener(String propertyName) Returnstrueif the given property has at least one listener.final voidremovePropertyChangeListener(String propertyName, PropertyChangeListener listener) Unregisters a property listener.Methods inherited from class MapCanvasclearError, errorOccurred, errorProperty, getObjectiveBounds, initialize, renderingProperty, requestRepaint, reset, runAfterRendering, setObjectiveBounds, setObjectiveToDisplay, toString, transformDisplayCoordinates, transformObjectiveCoordinatesMethods inherited from class PlanarCanvasgetDisplayBounds
- 
Field Details- 
imageMarginpublic final ObjectProperty<Insets> imageMarginNumber of additional pixels to paint on each sides of the image, outside the viewing area. Computing a larger image reduces the black borders that user sees during translations or during zoom out before the new image is repainted.
- 
imageprotected final ImageView imageThe node where the rendered map will be shown. Its content is prepared in a background thread byMapCanvasAWT.Renderer. Subclasses should not set the image content directly.
 
- 
- 
Constructor Details- 
MapCanvasAWTCreates a new canvas for JavaFX application.- Parameters:
- locale- the locale to use for labels and some messages, or- nullfor default.
 
 
- 
- 
Method Details- 
createRendererInvoked in JavaFX thread for creating a renderer to be executed in a background thread. Subclasses should copy in this method allMapCanvasproperties that the background thread will need for performing the rendering process.- Specified by:
- createRendererin class- MapCanvas
- Returns:
- rendering process to be executed in background thread,
         or nullif there is nothing to paint.
 
- 
clearprotected void clear()Clears the image and all intermediate buffer. Invoking this method may help to release memory when the map is no longer shown.UsageOverriding methods in subclasses should invokesuper.clear(). Other methods should generally not invoke this method directly, and use the following code instead:runAfterRendering(this::clear); - Overrides:
- clearin class- MapCanvas
- See Also:
 
- 
addPropertyChangeListenerRegisters a listener for the property of the given name. The listener will be notified every time that the property of the given name got a new value. If the same listener is registered twice for the same property, then it will be notified twice (this method does not perform duplication checks).- Parameters:
- propertyName- name of the property to listen (should be one of the- *_PROPERTYconstants).
- listener- property listener to register.
 
- 
removePropertyChangeListenerpublic final void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) Unregisters a property listener. The givenpropertyNameshould be the name used during listener registration. If the specified listener is not registered for the named property, then nothing happen. If the listener has been registered twice, then only one registration is removed (one registration will remain).- Parameters:
- propertyName- name of the listened property.
- listener- property listener to unregister.
 
- 
hasPropertyChangeListenerReturnstrueif the given property has at least one listener.- Parameters:
- propertyName- name of the property to test.
- Returns:
- trueif the given property has at least one listener.
- Since:
- 1.3
 
- 
firePropertyChangeNotifies all registered listeners that a property of the given name changed its value. The change event source will bethis. It is caller responsibility to verify that the old and new values are different (this method does not check for equality).- Parameters:
- propertyName- name of the property that changed its value.
- oldValue- the old property value (may be- null).
- newValue- the new property value (may be- null).
- See Also:
 
- 
firePropertyChangeNotifies all registered listeners that a property changed its value. It is caller responsibility to verify that the event source and property name are valid.- Parameters:
- event- the event to forward. Cannot be null.
- See Also:
 
 
-