Class JImageCanvas

java.lang.Object
javafx.scene.Node
javafx.scene.canvas.Canvas
org.jorigin.jfx.JImageCanvas
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget, JImageFeatureLayerListener

public class JImageCanvas extends javafx.scene.canvas.Canvas implements JImageFeatureLayerListener
A JavaFX canvas that can display images.
Since:
1.0.11
Version:
"2.0.1" - b202507040900L
Author:
Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020 - github.com/jorigin/jcommon (contact@jorigin.org)
  • Property Summary

    Properties inherited from class javafx.scene.canvas.Canvas

    height, width

    Properties inherited from class javafx.scene.Node

    accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Image is scaled in order to fit longest dimension.
    static final int
    Image is scaled in x and Y in order to fit the canvas.
    static final int
    Image is scaled in order to the image height is fitting the canvas height.
    static final int
    No fit is applied to the image when displayed.
    static final int
    Image is scaled in order to the image width is fitting the canvas width.
    static final int
    A mask that enable to check if a selection is active.
    static final int
    No selection mode activated.
    static final int
    The selection with point mode.
    static final int
    The selection with polygon mode.
    static final String
    The image feature selection mode property name.
    static final int
    The selection with rectangle mode.

    Fields inherited from class javafx.scene.Node

    BASELINE_OFFSET_SAME_AS_HEIGHT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new image canvas with no attached image.
    JImageCanvas(javafx.scene.image.Image image)
    Create a new image canvas with an attached image.
    JImageCanvas(javafx.scene.image.Image image, double width, double height, int fit, int selection, boolean autoRepaint, boolean autoFit, boolean listeningControls)
    Create a new image canvas that display the given image.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Add the given layer to this canvas.
    final javafx.beans.property.BooleanProperty
    Get the auto fit property.
    javafx.beans.property.BooleanProperty
    Get the auto refresh property.
    javafx.scene.paint.Paint
    Get the background paint.
    final javafx.beans.property.ObjectProperty<javafx.scene.paint.Paint>
    Get the background paint property.
    javafx.geometry.Point2D
    Get the cursor current position.
    javafx.beans.property.ObjectProperty<javafx.geometry.Point2D>
    Get the cursor current position property.
    javafx.scene.image.Image
    Get the image that is displayed within the canvas.
    javafx.geometry.Bounds
    Get the bounding box of the image within the view referential.
    javafx.geometry.Point2D
    getImageCoordinate(double x, double y)
    Get the coordinate within the image referential of the point located at (x, y) on the panel component.
    javafx.geometry.Point2D
    getImageCoordinate(javafx.geometry.Point2D point)
    Get the coordinate within the image referential of the given point expressed within the canvas component referential.
    int
    Get the image fit method.
    javafx.beans.property.IntegerProperty
    Get the image fit method property.
    javafx.beans.property.BooleanProperty
    Get the listening controls property.
    final javafx.beans.property.BooleanProperty
    Get the refresh needed property.
    double
    Get the rotation applied to the view as an angle expressed in degree (°).
    double
    Get the current scale factor of the panel view.
    int
    Get the selection mode used by the panel.
    javafx.beans.property.IntegerProperty
    Get the selection mode property.
    javafx.scene.shape.Shape
    Get the current selection shape.
    javafx.geometry.Point2D
    Get the translation applied to the view as a 2D point.
    javafx.geometry.Point2D
    getViewCoordinate(double x, double y)
    Get the coordinate within the canvas referential of the given point located at (x, y) within the image referential.
    javafx.geometry.Point2D
    getViewCoordinate(javafx.geometry.Point2D point)
    Get the coordinate within the canvas referential of the given point expressed within the image referential.
    javafx.geometry.Insets
    Get the insets (in pixels) that the displayed image as to respect from the canvas borders.
    javafx.beans.property.BooleanProperty
    Get the property that control the use of clipping during a view translation.
    boolean
    Get if the canvas is auto fitting when dimension changes occur.
    boolean
    Get if the canvas is auto refreshing when changes occur.
    boolean
    Check if the given layer is displayed.
    boolean
    Get if the canvas is listening to controls (Mouse, Keyboard, ...).
    boolean
    Get if the canvas has to be refreshed (changes have occured).
    boolean
     
    boolean
    Get if the translation clipping is active.
    double
    maxHeight(double width)
     
    double
    maxWidth(double height)
     
    double
    minHeight(double width)
     
    double
    minWidth(double height)
     
    void
    A callback method that is triggered when a feature has been added to the listened layer.
    void
    A callback method that is triggered when a collection of feature has been modified from the listened layer.
    void
    A callback method that is triggered when a feature has been modified from the listened layer.
    void
    A callback method that is triggered when a feature has been removed from the listened layer.
    void
    A callback method that is triggered when a collection of feature has been added to the listened layer.
    void
    A callback method that is triggered when a collection of feature has been removed from the listened layer.
    double
    prefHeight(double width)
     
    void
    Refresh the GUI components
    void
    Add the given task to add to the refresh queue.
    boolean
    Remove the given layer from this canvas.
    void
    resize(double width, double height)
     
    void
    select(javafx.scene.shape.Shape shape)
    Select the features that are inside the given shape.
    void
    setAutoFit(boolean autoFit)
    Set if the canvas has to auto fit when dimension changes occur.
    void
    setAutoRefresh(boolean autoRefresh)
    Get if the canvas has to auto refresh when changes occur.
    void
    setBackgroundPaint(javafx.scene.paint.Paint paint)
    Set the background paint.
    void
    setImage(javafx.scene.image.Image image)
    Set the image to display within the canvas.
    void
    setImageFitMethod(int method)
    Set the image fit method.
    void
    setLayerDisplayed(String layer, boolean displayed)
    Set if the given layer has to be displayed.
    void
    setListeningControls(boolean listening)
    Set if the canvas has to listen to controls (Mouse, Keyboard, ...).
    void
    setResizable(boolean resizable)
    Set if the image canvas can be resized.
    void
    setRotation(double angle)
    Set the rotation to apply to the view.
    void
    setScale(double scale)
    Set the scale factor to apply to the panel view.
    void
    setSelectionMode(int mode)
    Set the selection mode that the panel has to use.
    void
    setTranslation(javafx.geometry.Point2D translation)
    Set the translation to apply to the view.
    void
    setViewInsets(javafx.geometry.Insets insets)
    Set the insets (in pixels) that the displayed image as to respect from the canvas borders.
    void
    Set if the translation clipping has to be active.
    void
    Fit the image view according to the active fit method.
    void
    viewRotate(double angle)
    Rotate the current view by the given angle.
    void
    viewTranslate(javafx.geometry.Point2D vector)
    Translate the current view by the given vector.

    Methods inherited from class javafx.scene.canvas.Canvas

    getGraphicsContext2D, getHeight, getWidth, heightProperty, setHeight, setWidth, widthProperty

    Methods inherited from class javafx.scene.Node

    accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Field Details

  • Constructor Details

    • JImageCanvas

      public JImageCanvas()
      Create a new image canvas with no attached image.
    • JImageCanvas

      public JImageCanvas(javafx.scene.image.Image image)
      Create a new image canvas with an attached image.
      Parameters:
      image - the image to display.
    • JImageCanvas

      public JImageCanvas(javafx.scene.image.Image image, double width, double height, int fit, int selection, boolean autoRepaint, boolean autoFit, boolean listeningControls)
      Create a new image canvas that display the given image.
      Parameters:
      image - the image to display.
      width - the width in pixels of the canvas
      height - the height in pixels of the canvas
      fit - The fit method for the input image. Can be FIT_NONE, FIT_COMPLETE, FIT_WIDTH, FIT_HEIGHT or FIT_AUTO
      selection - The selection mode to use. Can be MODE_SELECTION_NONE, MODE_SELECTION_POINT, MODE_SELECTION_RECTANGLE or MODE_SELECTION_POLYGON
      autoRepaint - true if the canvas GUI has to update automatically when modifications occurs (default) or false otherwise
      autoFit - true if the canvas GUI has to fit automatically when modifications occurs (default) or false otherwise
      listeningControls - true if the canvas has to listen to controls (like mouse, keyboard, ...) (default) or false otherwise
  • Method Details

    • minHeight

      public double minHeight(double width)
      Overrides:
      minHeight in class javafx.scene.Node
    • maxHeight

      public double maxHeight(double width)
      Overrides:
      maxHeight in class javafx.scene.Node
    • prefHeight

      public double prefHeight(double width)
      Overrides:
      prefHeight in class javafx.scene.Node
    • minWidth

      public double minWidth(double height)
      Overrides:
      minWidth in class javafx.scene.Node
    • maxWidth

      public double maxWidth(double height)
      Overrides:
      maxWidth in class javafx.scene.Node
    • resize

      public void resize(double width, double height)
      Overrides:
      resize in class javafx.scene.Node
    • isResizable

      public boolean isResizable()
      Overrides:
      isResizable in class javafx.scene.Node
    • setResizable

      public void setResizable(boolean resizable)
      Set if the image canvas can be resized.
      Parameters:
      resizable - true if the image canvas has to be resizable (default) or false otherwise.
      See Also:
    • onImageFeatureAdded

      public void onImageFeatureAdded(JImageFeatureLayer layer, JImageFeature feature)
      Description copied from interface: JImageFeatureLayerListener
      A callback method that is triggered when a feature has been added to the listened layer.
      Specified by:
      onImageFeatureAdded in interface JImageFeatureLayerListener
      Parameters:
      layer - the layer that holds the event
      feature - the feature that has been added
    • onImageFeatureRemoved

      public void onImageFeatureRemoved(JImageFeatureLayer layer, JImageFeature feature)
      Description copied from interface: JImageFeatureLayerListener
      A callback method that is triggered when a feature has been removed from the listened layer.
      Specified by:
      onImageFeatureRemoved in interface JImageFeatureLayerListener
      Parameters:
      layer - the layer that holds the event
      feature - the feature that has been removed
    • onImageFeatureModified

      public void onImageFeatureModified(JImageFeatureLayer layer, JImageFeature feature)
      Description copied from interface: JImageFeatureLayerListener
      A callback method that is triggered when a feature has been modified from the listened layer.
      Specified by:
      onImageFeatureModified in interface JImageFeatureLayerListener
      Parameters:
      layer - the layer that holds the event
      feature - the feature that has been removed
    • onImageFeaturesAdded

      public void onImageFeaturesAdded(JImageFeatureLayer layer, Collection<JImageFeature> features)
      Description copied from interface: JImageFeatureLayerListener
      A callback method that is triggered when a collection of feature has been added to the listened layer.
      Specified by:
      onImageFeaturesAdded in interface JImageFeatureLayerListener
      Parameters:
      layer - the layer that holds the event
      features - the collection of feature that have been added
    • onImageFeaturesRemoved

      public void onImageFeaturesRemoved(JImageFeatureLayer layer, Collection<JImageFeature> features)
      Description copied from interface: JImageFeatureLayerListener
      A callback method that is triggered when a collection of feature has been removed from the listened layer.
      Specified by:
      onImageFeaturesRemoved in interface JImageFeatureLayerListener
      Parameters:
      layer - the layer that holds the event
      features - the collection of feature that have been removed
    • onImageFeatureModified

      public void onImageFeatureModified(JImageFeatureLayer layer, Collection<JImageFeature> features)
      Description copied from interface: JImageFeatureLayerListener
      A callback method that is triggered when a collection of feature has been modified from the listened layer.
      Specified by:
      onImageFeatureModified in interface JImageFeatureLayerListener
      Parameters:
      layer - the layer that holds the event
      features - the collection of feature that has been removed
    • getImage

      public javafx.scene.image.Image getImage()
      Get the image that is displayed within the canvas.
      Returns:
      the image that is displayed within the canvas
      See Also:
    • setImage

      public void setImage(javafx.scene.image.Image image)
      Set the image to display within the canvas.
      Parameters:
      image - the image to display
      See Also:
    • getImageFitMethodProperty

      public javafx.beans.property.IntegerProperty getImageFitMethodProperty()
      Get the image fit method property.
      Returns:
      the image fit method property
    • getImageFitMethod

      public int getImageFitMethod()
      Get the image fit method. Possible return values are FIT_NONE, FIT_COMPLETE, FIT_WIDTH, FIT_HEIGHT or FIT_AUTO.
      Returns:
      the image fit method
      See Also:
    • getImageBoundsInView

      public javafx.geometry.Bounds getImageBoundsInView()
      Get the bounding box of the image within the view referential. The bounds can be greater / smaller than the view bounds.
      Returns:
      the bounding box of the image within the view referential
    • setImageFitMethod

      public void setImageFitMethod(int method)
      Set the image fit method. Possible return values are FIT_NONE, FIT_COMPLETE, FIT_WIDTH, FIT_HEIGHT or FIT_AUTO.
      Parameters:
      method - the image fit method
      Throws:
      IllegalArgumentException - if the given method is invalid
      See Also:
    • getCursorPositionProperty

      public javafx.beans.property.ObjectProperty<javafx.geometry.Point2D> getCursorPositionProperty()
      Get the cursor current position property. The cursor position is expressed within the canvas referential (scale, rotation and translation are taken in account).
      Returns:
      the cursor position property
    • getCursorPosition

      public javafx.geometry.Point2D getCursorPosition()
      Get the cursor current position. The cursor position is expressed within the canvas referential (scale, rotation and translation are taken in account).
      Returns:
      the cursor current position
      See Also:
    • getViewInsets

      public javafx.geometry.Insets getViewInsets()
      Get the insets (in pixels) that the displayed image as to respect from the canvas borders. Defining such insets is useful for avoiding the edge of the image to be on the edge of the canvas. This insets are expressed in pixels within view referential.
      Returns:
      the margin that the displayed image as to respect from the canvas borders
      See Also:
    • setViewInsets

      public void setViewInsets(javafx.geometry.Insets insets)
      Set the insets (in pixels) that the displayed image as to respect from the canvas borders. Defining such insets is useful for avoiding the edge of the image to be on the edge of the canvas. These insets are expressed in pixels within view referential.
      Parameters:
      insets - the insets that the displayed image as to respect from the canvas borders
      See Also:
    • getSelectionModeProperty

      public javafx.beans.property.IntegerProperty getSelectionModeProperty()
      Get the selection mode property.
      Returns:
      the selection mode property.
    • getSelectionMode

      public int getSelectionMode()
      Get the selection mode used by the panel. This can be one of:
      Returns:
      the selection mode used by the panel.
      See Also:
    • setSelectionMode

      public void setSelectionMode(int mode)
      Set the selection mode that the panel has to use. This can be one of:
      Parameters:
      mode - the selection mode that the panel has to use.
      See Also:
    • getSelectionShape

      public javafx.scene.shape.Shape getSelectionShape()
      Get the current selection shape. All coordinates and length are expressed within canvas referential.
      Returns:
      the current selection shape
    • getViewTranslationClippingProperty

      public javafx.beans.property.BooleanProperty getViewTranslationClippingProperty()
      Get the property that control the use of clipping during a view translation. If the clipping is active, translating the view using viewTranslate(Point2D) will ensure that the image cannot exit the view according to the view insets.
      Returns:
      the property that control the use of clipping during a view translation.
      See Also:
    • isViewTranslationClipping

      public boolean isViewTranslationClipping()
      Get if the translation clipping is active. If the clipping is active, translating the view using viewTranslate(Point2D) will ensure that the image cannot exit the view according to the view insets.
      Returns:
      true if the clipping is active and false otherwise
      See Also:
    • setViewTranslationClipping

      public void setViewTranslationClipping(boolean clip)
      Set if the translation clipping has to be active. If the clipping is active, translating the view using viewTranslate(Point2D) will ensure that the image cannot exit the view according to the view insets.
      Parameters:
      clip - true if the clipping has to be active and false otherwise
      See Also:
    • getRotation

      public double getRotation()
      Get the rotation applied to the view as an angle expressed in degree (°).
      Returns:
      the rotation applied to the view as an angle expressed in degree (°).
      See Also:
    • setRotation

      public void setRotation(double angle)
      Set the rotation to apply to the view. For a cumulative rotation, use viewRotate(double) method.
      Parameters:
      angle - the rotation angle, expressed in degree (°)
      See Also:
    • getScale

      public double getScale()
      Get the current scale factor of the panel view.
      Returns:
      the current scale factor of the panel view.
      See Also:
    • setScale

      public void setScale(double scale)
      Set the scale factor to apply to the panel view.
      Parameters:
      scale - the scale factor applied to the image.
      See Also:
    • getTranslation

      public javafx.geometry.Point2D getTranslation()
      Get the translation applied to the view as a 2D point.
      Returns:
      the translation applied to the view.
      See Also:
    • setTranslation

      public void setTranslation(javafx.geometry.Point2D translation)
      Set the translation to apply to the view. The translation is expressed within view referential in pixels (px). For a cumulative translation, use viewTranslate(Point2D) method.
      Parameters:
      translation - the translation to apply to the view as a 2D point.
      See Also:
    • viewRotate

      public void viewRotate(double angle)
      Rotate the current view by the given angle. The angle has to be expressed in degree (°). This method add the new rotation angle to the current one. If a reset of the rotation is needed, the method has to be used.
      Parameters:
      angle - the rotation angle, expressed in degree (°)
      See Also:
    • viewTranslate

      public void viewTranslate(javafx.geometry.Point2D vector)
      Translate the current view by the given vector. The vector is expressed within the view referential. This method substract the given vector from the existing translation. The reset of the translation can be done by calling setTranslation(Point2D).
      Parameters:
      vector - the translation vector, expressed within the view referential
      See Also:
    • isAutoFit

      public boolean isAutoFit()
      Get if the canvas is auto fitting when dimension changes occur.
      Returns:
      true if the canvas is auto fitting when dimension changes occur and false otherwise
      See Also:
    • setAutoFit

      public void setAutoFit(boolean autoFit)
      Set if the canvas has to auto fit when dimension changes occur.
      Parameters:
      autoFit - true if the canvas is auto fitting when dimension changes occur and false otherwise
      See Also:
    • getAutoFitProperty

      public final javafx.beans.property.BooleanProperty getAutoFitProperty()
      Get the auto fit property.
      Returns:
      the auto fit property
      See Also:
    • isAutoRefresh

      public boolean isAutoRefresh()
      Get if the canvas is auto refreshing when changes occur.
      Returns:
      true if the canvas is auto refreshing when changes occur and false otherwise
      See Also:
    • setAutoRefresh

      public void setAutoRefresh(boolean autoRefresh)
      Get if the canvas has to auto refresh when changes occur.
      Parameters:
      autoRefresh - true if the canvas has to auto refresh when changes occur and false otherwise
      See Also:
    • getAutoRefreshProperty

      public javafx.beans.property.BooleanProperty getAutoRefreshProperty()
      Get the auto refresh property.
      Returns:
      the auto refresh property
      See Also:
    • isListeningControls

      public boolean isListeningControls()
      Get if the canvas is listening to controls (Mouse, Keyboard, ...).
      Returns:
      true if the canvas is listening to controls (Mouse, Keyboard, ...) and false otherwise
      See Also:
    • setListeningControls

      public void setListeningControls(boolean listening)
      Set if the canvas has to listen to controls (Mouse, Keyboard, ...).
      Parameters:
      listening - true if the canvas has to listen to controls (Mouse, Keyboard, ...) and false otherwise
      See Also:
    • getListeningControlsProperty

      public javafx.beans.property.BooleanProperty getListeningControlsProperty()
      Get the listening controls property.
      Returns:
      the listening controls property
      See Also:
    • isRefreshNeeded

      public boolean isRefreshNeeded()
      Get if the canvas has to be refreshed (changes have occured).
      Returns:
      true if the canvas has to be refreshed and false otherwise
      See Also:
    • getRefreshNeededProperty

      public final javafx.beans.property.BooleanProperty getRefreshNeededProperty()
      Get the refresh needed property.
      Returns:
      the refresh needed property
      See Also:
    • getBackgroundPaint

      public javafx.scene.paint.Paint getBackgroundPaint()
      Get the background paint.
      Returns:
      the background paint
      See Also:
    • setBackgroundPaint

      public void setBackgroundPaint(javafx.scene.paint.Paint paint)
      Set the background paint.
      Parameters:
      paint - the background paint
      See Also:
    • getBackgroundPaintProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.paint.Paint> getBackgroundPaintProperty()
      Get the background paint property.
      Returns:
      the background paint property
      See Also:
    • getImageCoordinate

      public javafx.geometry.Point2D getImageCoordinate(double x, double y)
      Get the coordinate within the image referential of the point located at (x, y) on the panel component.
      Parameters:
      x - the x coordinate of the point on the panel component.
      y - the y coordinate of the point on the panel component.
      Returns:
      the coordinate within the image of the point located at (x, y) on the panel component.
      See Also:
    • getImageCoordinate

      public javafx.geometry.Point2D getImageCoordinate(javafx.geometry.Point2D point)
      Get the coordinate within the image referential of the given point expressed within the canvas component referential.
      Parameters:
      point - the point expressed within the canvas component referential.
      Returns:
      the point expressed within the image referential.
      See Also:
    • getViewCoordinate

      public javafx.geometry.Point2D getViewCoordinate(javafx.geometry.Point2D point)
      Get the coordinate within the canvas referential of the given point expressed within the image referential.
      Parameters:
      point - the point expressed within the image referential.
      Returns:
      the coordinate within the canvas referential of the given point expressed within the image referential.
      See Also:
    • getViewCoordinate

      public javafx.geometry.Point2D getViewCoordinate(double x, double y)
      Get the coordinate within the canvas referential of the given point located at (x, y) within the image referential.
      Parameters:
      x - the x coordinate of the point expressed within the image referential.
      y - the y coordinate of the point expressed within the image referential.
      Returns:
      the coordinate within the canvas referential of the point located at (x, y) within the image referential.
      See Also:
    • isLayerDisplayed

      public boolean isLayerDisplayed(String layer)
      Check if the given layer is displayed. If this method return true, then the features that are within the layer are visible on the image panel.
      Parameters:
      layer - the layer to check.
      Returns:
      true if the layer is displayed and false otherwise
      See Also:
    • setLayerDisplayed

      public void setLayerDisplayed(String layer, boolean displayed)
      Set if the given layer has to be displayed.
      Parameters:
      layer - the layer to check.
      displayed - true if the layer has to be displayed and false otherwise.
    • addImageFeatureLayer

      public boolean addImageFeatureLayer(JImageFeatureLayer layer)
      Add the given layer to this canvas.
      Parameters:
      layer - the layer to add
      Returns:
      true if the layer is successfully added and false otherwise
      See Also:
    • removeImageFeatureLayer

      public boolean removeImageFeatureLayer(JImageFeatureLayer layer)
      Remove the given layer from this canvas.
      Parameters:
      layer - the layer to remove
      Returns:
      true if the layer is successfully removed and false otherwise
      See Also:
    • viewFit

      public void viewFit()
      Fit the image view according to the active fit method.
      See Also:
    • refreshEnqueue

      public void refreshEnqueue(Runnable task) throws InterruptedException
      Add the given task to add to the refresh queue. The refresh queue is processed at the end of the refresh of the canvas.
      Parameters:
      task - the task to add to the refresh queue
      Throws:
      InterruptedException - if a error occurs during queuing
      See Also:
    • refresh

      public void refresh()
      Refresh the GUI components
    • select

      public void select(javafx.scene.shape.Shape shape)
      Select the features that are inside the given shape. The shape is expressed within view coordinates.
      Parameters:
      shape - the selection shape