Class CustomInfiniteCanvas
java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
org.eclipse.gef.fx.nodes.InfiniteCanvas
com.amalgamasimulation.graphicaleditor.views.CustomInfiniteCanvas
- All Implemented Interfaces:
javafx.css.Styleable,javafx.event.EventTarget
public class CustomInfiniteCanvas
extends org.eclipse.gef.fx.nodes.InfiniteCanvas
-
Property Summary
Properties inherited from class org.eclipse.gef.fx.nodes.InfiniteCanvas
clipContent, contentBounds, contentTransform, gridCellHeight, gridCellWidth, horizontalScrollBarPolicy, horizontalScrollOffset, scrollableBounds, showGrid, verticalScrollBarPolicy, verticalScrollOffset, zoomGridProperties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties 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, 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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected intprotected doubleprotected doubleprotected doubleprotected doubleprotected org.eclipse.nebula.widgets.geomap.internal.GeoMapHelperprotected org.eclipse.nebula.widgets.geomap.internal.GeoMapHelperListenerprotected booleanprotected javafx.scene.image.ImageViewprotected Pointprotected Pointprotected intprotected javafx.scene.Groupprotected org.eclipse.nebula.widgets.geomap.PointDprotected org.eclipse.swt.graphics.Imageprotected javafx.scene.control.Labelprotected booleanprotected javafx.scene.control.Labelprotected doubleprotected doubleprotected TiledMapCoordinatesConverterprotected InfiniteCanvasViewerFields inherited from class org.eclipse.gef.fx.nodes.InfiniteCanvas
DEFAULT_GRID_CELL_HEIGHT, DEFAULT_GRID_CELL_WIDTH, DEFAULT_GRID_POINT_COLORFields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
ConstructorsConstructorDescriptionCustomInfiniteCanvas(InfiniteCanvasViewer viewer, boolean showMap, boolean isContentViewer) -
Method Summary
Modifier and TypeMethodDescriptionprotected floatcomputeStringWidth(String text, javafx.scene.text.Font font) javafx.geometry.Point2DReturns the bottom-left corner coordinates of the visible area in model space, adjusted for both the palette offset and ruler dimensions.javafx.geometry.Point2DReturns the visible area dimensions in model space, adjusted for both the palette offset and ruler dimensions.doubledouble[]Union of visible surface raster tile bounds in model space ([minX, minY, maxX, maxY]), ornullwhen the tile layer is hidden or has no loaded tiles.getTileLayerSiblingsPoints(double x, double y) Retrieves all distinct endpoints of line segments located in the tile containing the specified point and its eight neighboring tiles.voidinitializeBaseMapPoint(double latitude, double longitude, int baseMapZoom) protected voidbooleanbooleanReturns the current visibility state of the rulers and grid.booleanbooleanGets the current visibility state of the tile layervoidnavigateTo(InfiniteCanvasViewer viewer, List<javafx.scene.Node> childs) voidnavigateTo(InfiniteCanvasViewer viewer, List<javafx.scene.Node> childs, boolean zoom) voidnavigateTo(InfiniteCanvasViewer viewer, List<javafx.scene.Node> childs, double[] modelBounds) voidnavigateTo(InfiniteCanvasViewer viewer, List<javafx.scene.Node> childs, double[] modelBounds, boolean zoom) Centers the viewport on GEF visuals and optionally extends the fit area with a model-space rectangle (surface raster tiles ontileLayerCanvas).voidnavigateTo(InfiniteCanvasViewer viewer, javafx.scene.Node child) voidnavigateTo(InfiniteCanvasViewer viewer, javafx.scene.Node child, boolean zoom) voidonCurrentScaleChanged(InfiniteCanvasViewer viewer, double currentScale) voidonCurrentScaleChanged(InfiniteCanvasViewer viewer, double currentScale, double sceneX, double sceneY) voidonCurrentViewChanged(double x, double y) protected voidvoidresize(double width, double height) voidsetAdjustRequired(boolean adjustRequired) voidsetCurrentZoom(double currentZoom) voidsetLegend(javafx.scene.Group legend) voidsetRulerOffset(double offset) Sets the horizontal offset for rulers to accommodate external components (typically a palette).voidsetRulersVisible(boolean visible) Sets the visibility state of both rulers (horizontal and vertical) and the associated grid.voidsetShowMap(boolean showMap) voidsetStatusMessage(String statusMessage, double fontSize, boolean bold, javafx.scene.paint.Paint statusMessagePaint, String removeMessage, javafx.scene.paint.Paint removeMessagePaint, Runnable removeHandler) voidsetTileLayerShape(com.amalgamasimulation.animation.shapes.shapes2d.GroupShape groupShape) Sets the tile layer content from a GroupShapevoidsetTileLayerVisible(boolean visible) Controls the visibility of the tile layerstatic javafx.scene.image.WritableImagetoFXImage(org.eclipse.swt.graphics.ImageData imageData, javafx.scene.image.WritableImage image) voidupdateMapZoom(int baseMapZoom) Methods inherited from class org.eclipse.gef.fx.nodes.InfiniteCanvas
clipContent, clipContentProperty, computeContentBoundsInLocal, computeHv, computeScrollableBoundsInLocal, computeTx, computeTy, computeVv, contentBoundsProperty, contentTransformProperty, createGrid, createGridTile, createLayers, createScrollBarGroup, createScrolledLayers, fitToSize, getContentBounds, getContentGroup, getContentTransform, getGridCanvas, getGridCellHeight, getGridCellWidth, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getHorizontalScrollOffset, getOverlayGroup, getScrollableBounds, getScrollBarGroup, getScrolledOverlayGroup, getScrolledPane, getScrolledUnderlayGroup, getUnderlayGroup, getVerticalScrollBar, getVerticalScrollBarPolicy, getVerticalScrollOffset, gridCellHeightProperty, gridCellWidthProperty, hideGrid, horizontalScrollBarPolicyProperty, horizontalScrollOffsetProperty, isClipContent, isShowGrid, isZoomGrid, lerp, norm, registerFadeInOutTransitions, registerUpdateScrollBarsOnBoundsChanges, registerUpdateScrollBarsOnPolicyChanges, registerUpdateScrollBarsOnSizeChanges, reveal, scrollableBoundsProperty, setClipContent, setContentTransform, setGridCellHeight, setGridCellWidth, setHorizontalScrollBarPolicy, setHorizontalScrollOffset, setShowGrid, setVerticalScrollBarPolicy, setVerticalScrollOffset, setZoomGrid, showGrid, showGridProperty, unclipContent, unregisterUpdateScrollBarsOnBoundsChanges, unzoomGrid, updateGridTransform, updateScrollBars, verticalScrollBarPolicyProperty, verticalScrollOffsetProperty, zoomGrid, zoomGridPropertyMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBackground, getBorder, getClassCssMetaData, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthPropertyMethods inherited from class javafx.scene.Parent
getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods 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, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, 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, 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, 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, pressedProperty, pseudoClassStateChanged, 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, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Field Details
-
statusTextYOffset
protected double statusTextYOffset -
statusTextXOffset
protected double statusTextXOffset -
viewer
-
imageView
protected javafx.scene.image.ImageView imageView -
showMap
protected boolean showMap -
currentZoom
protected double currentZoom -
lonLatPointD
protected org.eclipse.nebula.widgets.geomap.PointD lonLatPointD -
baseMapZoom
protected int baseMapZoom -
geoMapHelper
protected org.eclipse.nebula.widgets.geomap.internal.GeoMapHelper geoMapHelper -
tiledMapCoordinatesConverter
-
mapImage
protected org.eclipse.swt.graphics.Image mapImage -
currentScale
protected double currentScale -
currentX
protected double currentX -
currentY
protected double currentY -
lastMapPosition
-
lastMapSize
-
lastMapZoom
protected int lastMapZoom -
geoMapInitialized
protected boolean geoMapInitialized -
geoMapHelperListener
protected org.eclipse.nebula.widgets.geomap.internal.GeoMapHelperListener geoMapHelperListener -
adjustRequired
protected boolean adjustRequired -
statusText
protected javafx.scene.control.Label statusText -
removeStatusText
protected javafx.scene.control.Label removeStatusText -
legend
protected javafx.scene.Group legend
-
-
Constructor Details
-
CustomInfiniteCanvas
-
-
Method Details
-
setLegend
public void setLegend(javafx.scene.Group legend) -
setStatusMessage
-
computeStringWidth
-
initializeStatusMessage
protected void initializeStatusMessage() -
initializeBaseMapPoint
public void initializeBaseMapPoint(double latitude, double longitude, int baseMapZoom) -
isShowMap
public boolean isShowMap() -
setAdjustRequired
public void setAdjustRequired(boolean adjustRequired) -
isAdjustRequired
public boolean isAdjustRequired() -
setShowMap
public void setShowMap(boolean showMap) -
getCurrentZoom
public double getCurrentZoom() -
setCurrentZoom
public void setCurrentZoom(double currentZoom) -
repaintGrid
protected void repaintGrid()- Overrides:
repaintGridin classorg.eclipse.gef.fx.nodes.InfiniteCanvas
-
toFXImage
public static javafx.scene.image.WritableImage toFXImage(org.eclipse.swt.graphics.ImageData imageData, javafx.scene.image.WritableImage image) -
updateMapZoom
public void updateMapZoom(int baseMapZoom) -
onCurrentScaleChanged
-
getAdjustedBottomLeftModelCoordinates
public javafx.geometry.Point2D getAdjustedBottomLeftModelCoordinates()Returns the bottom-left corner coordinates of the visible area in model space, adjusted for both the palette offset and ruler dimensions. This method:- Accounts for the horizontal palette offset (right side of palette)
- Maintains original vertical position (no vertical offset)
- Reflects current zoom level for accurate coordinate calculation
- The palette width on the left side
- The horizontal ruler height at the top
- Returns:
- Point2D representing adjusted bottom-left coordinates in model space,
where:
- X: Original X + (palette width / current zoom)
- Y: Original Y coordinate (unmodified)
-
getAdjustedVisibleAreaModelSize
public javafx.geometry.Point2D getAdjustedVisibleAreaModelSize()Returns the visible area dimensions in model space, adjusted for both the palette offset and ruler dimensions. This method:- Subtracts the palette width from horizontal visibility
- Maintains full vertical visibility height
- Accounts for current zoom level for accurate dimension calculation
- The palette width on the left side
- The horizontal ruler height at the top
- Returns:
- Point2D representing adjusted visible area dimensions in model space,
where:
- X: Visible width - (palette width / current zoom)
- Y: Full visible height (unmodified)
-
onCurrentScaleChanged
public void onCurrentScaleChanged(InfiniteCanvasViewer viewer, double currentScale, double sceneX, double sceneY) -
onCurrentViewChanged
public void onCurrentViewChanged(double x, double y) -
resize
public void resize(double width, double height) - Overrides:
resizein classjavafx.scene.layout.Region
-
setRulersVisible
public void setRulersVisible(boolean visible) Sets the visibility state of both rulers (horizontal and vertical) and the associated grid. When set totrue:- Horizontal ruler becomes visible at the top of the content area
- Vertical ruler becomes visible on the left side of the content area
- Grid lines aligned with ruler ticks become visible
- Ruler positions are recalculated to account for current palette width
false:- All ruler components are hidden
- Grid lines are immediately removed
- Parameters:
visible-trueto show rulers and grid,falseto hide them
-
isRulersVisible
public boolean isRulersVisible()Returns the current visibility state of the rulers and grid.- Returns:
trueif rulers and grid are currently visible,falseif hidden
-
setRulerOffset
public void setRulerOffset(double offset) Sets the horizontal offset for rulers to accommodate external components (typically a palette). This method:- Adjusts both horizontal and vertical ruler positions
- Triggers immediate ruler repositioning and redraw
- Updates grid calculations to match new layout
- Maintains ruler/grid alignment with content area
- Parameters:
offset- Horizontal space in pixels to offset rulers from left edge. Must be ≥ 0. Typical value equals palette width.
-
setTileLayerShape
public void setTileLayerShape(com.amalgamasimulation.animation.shapes.shapes2d.GroupShape groupShape) Sets the tile layer content from a GroupShape- Parameters:
groupShape- the shape container to render as the tile layer
-
setTileLayerVisible
public void setTileLayerVisible(boolean visible) Controls the visibility of the tile layer- Parameters:
visible- true to show the tile layer, false to hide
-
getTileLayerSiblingsPoints
Retrieves all distinct endpoints of line segments located in the tile containing the specified point and its eight neighboring tiles. -
isTileLayerVisible
public boolean isTileLayerVisible()Gets the current visibility state of the tile layer- Returns:
- true if the tile layer is visible, false if hidden
-
getTileLayerModelBounds
public double[] getTileLayerModelBounds()Union of visible surface raster tile bounds in model space ([minX, minY, maxX, maxY]), ornullwhen the tile layer is hidden or has no loaded tiles.
-