Class HexDrawUtilities
java.lang.Object
megamek.client.ui.clientGUI.boardview.HexDrawUtilities
Provides utility methods and constants for drawing hex-related shapes Internally all methods work as if the game hex
was
- as wide as BoardView1.HEX_W (usually == 84)
- perfectly hex-shaped, i.e. slightly higher than BoardView1.HEX_H.
The methods named ...Full...Line() return closed shapes for all 6 faces. They can be used to both graph.draw() and graph.fill().
When a border line is moved inside the hex (inset > 0) and for all border areas, the cut type parameter controls how the line/area is delimited.
CUT_BORDER extends the line/area out to the hex borders
CUT_VERTEX leaves the line/area with the length of the hex border
CUT_INSIDE shrinks the line/area to be inside the triangle between the hex face and the center point. CUT_LEFT_BORDER, CUT_RIGHT_BORDER, CUT_LEFT_VERTEX, CUT_RIGHT_VERTEX, CUT_LEFT_INSIDE, CUT_RIGHT_INSIDE can be ORed to achieve different cuts left and right.
- as wide as BoardView1.HEX_W (usually == 84)
- perfectly hex-shaped, i.e. slightly higher than BoardView1.HEX_H.
The methods named ...Full...Line() return closed shapes for all 6 faces. They can be used to both graph.draw() and graph.fill().
When a border line is moved inside the hex (inset > 0) and for all border areas, the cut type parameter controls how the line/area is delimited.
CUT_BORDER extends the line/area out to the hex borders
CUT_VERTEX leaves the line/area with the length of the hex border
CUT_INSIDE shrinks the line/area to be inside the triangle between the hex face and the center point. CUT_LEFT_BORDER, CUT_RIGHT_BORDER, CUT_LEFT_VERTEX, CUT_RIGHT_VERTEX, CUT_LEFT_INSIDE, CUT_RIGHT_INSIDE can be ORed to achieve different cuts left and right.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final Point2D.Doublestatic final doublestatic final Point2D.Doublestatic final Point2D.Doublestatic final Point2D.Doublestatic final Point2D.Doublestatic final Point2D.Doublestatic final Point2D.Doublestatic final doublestatic final AffineTransformstatic final double -
Method Summary
Modifier and TypeMethodDescriptionstatic ShapegetHexBorderArea(int cutType, double thickness) static ShapegetHexBorderArea(int cutType, double thickness, double inset) static ShapegetHexBorderArea(int hexFace, int cutType, double thickness) static ShapegetHexBorderArea(int hexFace, int cutType, double thickness, double inset) static Point2D.DoublegetHexBorderAreaMid(int hexFace, double thickness, double inset) static ShapegetHexBorderLine(int hexFace) static ShapegetHexBorderLine(int hexFace, int cutType, double inset) static ShapegetHexCrossArea01(int hexFace, double thickness) static ShapegetHexCrossArea012(int hexFace, double thickness) static ShapegetHexCrossArea0123(int hexFace, double thickness) static ShapegetHexCrossArea01234(int hexFace, double thickness) static ShapegetHexCrossLine01(int hexFace, double thickness) static ShapegetHexCrossLine012(int hexFace, double thickness) static ShapegetHexCrossLine0123(int hexFace, double thickness) static ShapegetHexCrossLine01234(int hexFace, double thickness) static Shapestatic Shapestatic ShapegetHexFull(Point p) static ShapegetHexFull(Point p, float scale) static ShapegetHexFullBorderArea(double thickness) static ShapegetHexFullBorderArea(double thickness, double inset) static ShapegetHexFullBorderLine(double inset) static AffineTransformgetHexRotation(int facing)
-
Field Details
-
HEX_WID
public static final double HEX_WID- See Also:
-
HEX_HGT
public static final double HEX_HGT -
HEX_CTR
-
HEX_UL
-
HEX_UR
-
HEX_ML
-
HEX_MR
-
HEX_LL
-
HEX_LR
-
PerfectHexToHexY
public static final double PerfectHexToHexY -
PerfectHexToHex
-
CUT_LEFT_BORDER
public static final int CUT_LEFT_BORDER- See Also:
-
CUT_RIGHT_BORDER
public static final int CUT_RIGHT_BORDER- See Also:
-
CUT_LEFT_INSIDE
public static final int CUT_LEFT_INSIDE- See Also:
-
CUT_RIGHT_INSIDE
public static final int CUT_RIGHT_INSIDE- See Also:
-
CUT_LEFT_VERTEX
public static final int CUT_LEFT_VERTEX- See Also:
-
CUT_RIGHT_VERTEX
public static final int CUT_RIGHT_VERTEX- See Also:
-
CUT_VERTEX
public static final int CUT_VERTEX- See Also:
-
CUT_BORDER
public static final int CUT_BORDER- See Also:
-
CUT_INSIDE
public static final int CUT_INSIDE- See Also:
-
-
Method Details
-
getHexBorderLine
-
getHexRotation
-
getHexBorderLine
-
getHexFullBorderLine
-
getHexBorderArea
-
getHexBorderArea
-
getHexFullBorderArea
-
getHexFullBorderArea
-
getHexBorderArea
-
getHexBorderArea
-
getHexFull
-
getHexFull
-
getHexFull
-
getHexFull
-
getHexBorderAreaMid
-
getHexCrossArea01
-
getHexCrossLine01
-
getHexCrossArea012
-
getHexCrossLine012
-
getHexCrossArea0123
-
getHexCrossLine0123
-
getHexCrossArea01234
-
getHexCrossLine01234
-