public class Hexagon extends Polygon
fillProperty, smoothProperty, strokeDashOffsetProperty, strokeLineCapProperty, strokeLineJoinProperty, strokeMiterLimitProperty, strokeProperty, strokeTypeProperty, strokeWidthPropertyaccessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, cacheHintProperty, cacheProperty, clipProperty, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, focusedProperty, focusTraversableProperty, hoverProperty, idProperty, impl_showMnemonicsProperty, impl_treeVisibleProperty, inputMethodRequestsProperty, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParentTransformProperty, localToSceneTransformProperty, managedProperty, mouseTransparentProperty, nodeOrientationProperty, 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, pickOnBoundsProperty, pressedProperty, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, styleProperty, translateXProperty, translateYProperty, translateZProperty, visibleProperty| Modifier and Type | Field and Description |
|---|---|
Hexagon |
aStarCameFrom |
int |
aStarFscore |
int |
aStarGscore |
GridPosition |
position |
BASELINE_OFFSET_SAME_AS_HEIGHT| Constructor and Description |
|---|
Hexagon(int q,
int r)
The position of the Hexagon is specified with axial coordinates
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(GraphicsContext gc) |
void |
drawContour(GraphicsContext gc) |
void |
drawHexagon(GraphicsContext gc) |
void |
drawHexagon(GraphicsContext gc,
HexagonMap.Direction... directions) |
boolean |
equals(Object obj)
Two Hexagons are equal if they have the same q and r
|
HexagonMap.Direction |
getDirectionTo(Hexagon target)
Finds the direction (NORTHWEST, NORTHEAST, EAST, SOUTHEAST, SOUTHWEST or WEST) If target is a neighbour, then it
is quite simple.
|
int |
getDistance(Hexagon target)
Calculates the distance (number of hexagons) to the target hexagon
|
int |
getGraphicsXoffset() |
int |
getGraphicsYoffset() |
List<Hexagon> |
getHexagonsInRingArea(int radius)
Returns all Hexagons that are located within a certain distance from here
|
List<Hexagon> |
getHexagonsOnRingEdge(int radius)
Returns all Hexagons that are located a certain distance from here
|
List<Hexagon> |
getLine(Hexagon origin,
Hexagon destination)
Finds all Hexagons that are on a line between this and destination
|
Hexagon |
getNeighbour(HexagonMap.Direction direction)
Finds the neighbour of this Hexagon
|
List<Hexagon> |
getNeighbours()
Finds all neighbours of this Hexagon
|
List<Hexagon> |
getPathTo(Hexagon destination)
Finds the cheapest path from here to the destination.
|
List<Hexagon> |
getPathTo(Hexagon destination,
IPathInfoSupplier pathInfoSupplier)
Finds the cheapest path from start to the goal.
|
int |
getQ() |
int |
getR() |
List<Hexagon> |
getVisibleHexes(int visibleRange)
Calculates all Hexagons that are visible from this Hexagon.
|
int |
hashCode() |
void |
init() |
boolean |
isBlockingPath()
This affects the pathfinding calculations
|
boolean |
isVisualObstacle()
This affects the field of view calculations.
|
void |
renderCoordinates(GraphicsContext gc) |
void |
setBackgroundColor(Color c)
This method is the safe way to change the background color since it makes sure that the change is made on the
JavaFX Application thread.
|
void |
setIsBlockingPath(boolean b)
This affects the pathfinding calculations.
|
void |
setIsVisualObstacle(boolean b)
This affects the field of view calculations.
|
void |
setMap(HexagonMap map)
This gives the Hexagon access a HexagonMap without actually adding it to the HexagonMap.
|
String |
toString() |
getPoints, impl_computeGeomBounds, impl_configShape, impl_createPeer, impl_updatePeerfillProperty, getClassCssMetaData, getCssMetaData, getFill, getStroke, getStrokeDashArray, getStrokeDashOffset, getStrokeLineCap, getStrokeLineJoin, getStrokeMiterLimit, getStrokeType, getStrokeWidth, impl_computeContains, impl_cssGetFillInitialValue, impl_cssGetStrokeInitialValue, impl_markDirty, impl_processMXNode, impl_setShapeChangeListener, intersect, isSmooth, setFill, setSmooth, setStroke, setStrokeDashOffset, setStrokeLineCap, setStrokeLineJoin, setStrokeMiterLimit, setStrokeType, setStrokeWidth, smoothProperty, strokeDashOffsetProperty, strokeLineCapProperty, strokeLineJoinProperty, strokeMiterLimitProperty, strokeProperty, strokeTypeProperty, strokeWidthProperty, subtract, unionaccessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, 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, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_computeLayoutBounds, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_notifyLayoutBoundsChanged, impl_pickNode, impl_pickNodeLocal, impl_processCSS, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, 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, maxHeight, maxWidth, minHeight, minWidth, 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, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic final GridPosition position
public int aStarGscore
public int aStarFscore
public Hexagon aStarCameFrom
public Hexagon(int q,
int r)
q - the Q coordinater - the R coordinatepublic void draw(GraphicsContext gc)
public void drawContour(GraphicsContext gc)
public void drawHexagon(GraphicsContext gc)
public void drawHexagon(GraphicsContext gc, HexagonMap.Direction... directions)
public boolean equals(Object obj)
public HexagonMap.Direction getDirectionTo(Hexagon target)
target - target hexagonpublic int getDistance(Hexagon target)
target - destination hex tilepublic int getGraphicsXoffset()
public int getGraphicsYoffset()
public List<Hexagon> getHexagonsInRingArea(int radius)
radius - in hex grid coordinatespublic List<Hexagon> getHexagonsOnRingEdge(int radius)
radius - in hex grid coordinatespublic List<Hexagon> getLine(Hexagon origin, Hexagon destination)
origin - source hex tiledestination - target hex tilepublic Hexagon getNeighbour(HexagonMap.Direction direction)
direction - direction from sourcepublic List<Hexagon> getNeighbours()
public List<Hexagon> getPathTo(Hexagon destination) throws NoPathFoundException
destination - the target HexagonNoPathFoundException - if there exists no path between start and the goalpublic List<Hexagon> getPathTo(Hexagon destination, IPathInfoSupplier pathInfoSupplier) throws NoPathFoundException
destination - the target HexagonpathInfoSupplier - a class implementing the IPathInfoSupplier interface. This can be used to add inpassable
hexagons and customize the movement costs.NoPathFoundException - if there exists no path between start and the goalpublic int getQ()
public int getR()
public List<Hexagon> getVisibleHexes(int visibleRange)
visibleRange - a limit of how long distance can be seen assuming there are no obstaclespublic void init()
public boolean isBlockingPath()
public boolean isVisualObstacle()
public void renderCoordinates(GraphicsContext gc)
public void setBackgroundColor(Color c)
c - the colorpublic void setIsBlockingPath(boolean b)
b - true: blocking hexagonpublic void setIsVisualObstacle(boolean b)
b - true: opaque hexagonpublic void setMap(HexagonMap map)
map - global map referenceCopyright © 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH. All rights reserved.