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 cuttype parameter controls how the line/area is delimited.
CUT_BORDER extends the line/area out to the hex borders
CUT_VERT 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_LBORDER, CUT_RBORDER, CUT_LVERT, CUT_RVERT, CUT_LINSIDE, CUT_RINSIDE 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 cuttype parameter controls how the line/area is delimited.
CUT_BORDER extends the line/area out to the hex borders
CUT_VERT 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_LBORDER, CUT_RBORDER, CUT_LVERT, CUT_RVERT, CUT_LINSIDE, CUT_RINSIDE can be ORed to achieve different cuts left and right.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final Point2D.Double
static final double
static final Point2D.Double
static final Point2D.Double
static final Point2D.Double
static final Point2D.Double
static final Point2D.Double
static final Point2D.Double
static final double
static final AffineTransform
static final double
-
Method Summary
Modifier and TypeMethodDescriptionstatic Shape
getHexBorderArea
(int cuttype, double thickness) static Shape
getHexBorderArea
(int cuttype, double thickness, double inset) static Shape
getHexBorderArea
(int hexFace, int cuttype, double thickness) static Shape
getHexBorderArea
(int hexFace, int cuttype, double thickness, double inset) static Point2D.Double
getHexBorderAreaMid
(int hexFace, double thickness, double inset) static Shape
getHexBorderLine
(int hexFace) static Shape
getHexBorderLine
(int hexFace, int cuttype, double inset) static Shape
getHexCrossArea01
(int hexFace, double thickness) static Shape
getHexCrossArea012
(int hexFace, double thickness) static Shape
getHexCrossArea0123
(int hexFace, double thickness) static Shape
getHexCrossArea01234
(int hexFace, double thickness) static Shape
getHexCrossLine01
(int hexFace, double thickness) static Shape
getHexCrossLine012
(int hexFace, double thickness) static Shape
getHexCrossLine0123
(int hexFace, double thickness) static Shape
getHexCrossLine01234
(int hexFace, double thickness) static Shape
static Shape
static Shape
getHexFull
(Point p) static Shape
getHexFull
(Point p, float scale) static Shape
getHexFullBorderArea
(double thickness) static Shape
getHexFullBorderArea
(double thickness, double inset) static Shape
getHexFullBorderLine
(double inset) static AffineTransform
getHexRotation
(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_LBORDER
public static final int CUT_LBORDER- See Also:
-
CUT_RBORDER
public static final int CUT_RBORDER- See Also:
-
CUT_LINSIDE
public static final int CUT_LINSIDE- See Also:
-
CUT_RINSIDE
public static final int CUT_RINSIDE- See Also:
-
CUT_LVERT
public static final int CUT_LVERT- See Also:
-
CUT_RVERT
public static final int CUT_RVERT- See Also:
-
CUT_VERT
public static final int CUT_VERT- 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
-