public class ShapeUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ARROW_SIZE
Default length of an arrow
|
Constructor and Description |
---|
ShapeUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addArrowLine(GeneralPath path,
Point2D.Double startPos,
Point2D.Double endPos)
Add a line with an arrow at the end to the given GeneralPath.
|
static void |
main(String[] args)
test main: usage: java GraphicsImageDisplay
|
static Shape |
makeArrow(Point2D.Double center,
Point2D.Double north)
Return a Shape object for the "arrow" symbol (a line
from center to north with an arrow at north).
|
static Polygon2D |
makeArrowHead(Point2D.Double pos,
double length,
double angle,
boolean flip)
Make and return an arrow head shape at the given position.
|
static Shape |
makeCompass(Point2D.Double center,
Point2D.Double north,
Point2D.Double east)
Return a Shape object for a "compass" symbol (has two lines,
from the center point, pointing north and east).
|
static Shape |
makeCross(double x,
double y,
double size)
Return a Shape object for a "cross" (x) symbol.
|
static Shape |
makeDiamond(double x,
double y,
double size)
Return a Shape object for a "diamond" symbol.
|
static Shape |
makeEllipse(double x,
double y,
double size)
Return a Shape object for an "ellipse" symbol.
|
static Shape |
makeEllipse(Point2D.Double center,
Point2D.Double north,
Point2D.Double east)
Return a Shape object for an "ellipse" symbol.
|
static Shape |
makeLine(Point2D.Double center,
Point2D.Double north,
Point2D.Double east)
Return a Shape object for the "line" symbol.
|
static Shape |
makePlus(Point2D.Double center,
Point2D.Double north,
Point2D.Double east)
Return a Shape object for a "plus" (+) symbol.
|
static Shape |
makeSquare(double x,
double y,
double size)
Return a Shape object for a "square" symbol.
|
static Shape |
makeTriangle(double x,
double y,
double size)
Return a Shape object for a "triangle" symbol.
|
public static final int ARROW_SIZE
public static Shape makePlus(Point2D.Double center, Point2D.Double north, Point2D.Double east)
center
- the center point in screen coordsnorth
- the north point in screen coordseast
- the east point in screen coordspublic static Shape makeCross(double x, double y, double size)
x
- the center X coord in screen coordsy
- the center Y coord in screen coordssize
- the radius of the symbolpublic static Shape makeTriangle(double x, double y, double size)
x
- the center X coord in screen coordsy
- the center Y coord in screen coordssize
- the radius of the symbolpublic static Shape makeDiamond(double x, double y, double size)
x
- the center X coord in screen coordsy
- the center Y coord in screen coordssize
- the radius of the symbolpublic static Shape makeSquare(double x, double y, double size)
x
- the center X coord in screen coordsy
- the center Y coord in screen coordssize
- the radius of the symbolpublic static Shape makeEllipse(double x, double y, double size)
x
- the center X coord in screen coordsy
- the center Y coord in screen coordssize
- the radius of the symbolpublic static Shape makeEllipse(Point2D.Double center, Point2D.Double north, Point2D.Double east)
center
- the center point in screen coordsnorth
- the north point in screen coordseast
- the east point in screen coordspublic static Shape makeCompass(Point2D.Double center, Point2D.Double north, Point2D.Double east)
center
- the center point in screen coordsnorth
- the north point in screen coordseast
- the east point in screen coordspublic static Shape makeLine(Point2D.Double center, Point2D.Double north, Point2D.Double east)
center
- the center point in screen coordsnorth
- the north point in screen coordseast
- the east point in screen coordspublic static Shape makeArrow(Point2D.Double center, Point2D.Double north)
center
- the center point in screen coordsnorth
- the north point in screen coordspublic static void addArrowLine(GeneralPath path, Point2D.Double startPos, Point2D.Double endPos)
path
- the line and arrow are added to the GeneralPathstartPos
- the start of the lineendPos
- the end of the line (where the arrow should be)public static Polygon2D makeArrowHead(Point2D.Double pos, double length, double angle, boolean flip)
pos
- the position of the point of the arrow in screen coordslength
- the length of the arrowangle
- the rotation angle in radiansflip
- if true flip the arrow directionpublic static void main(String[] args)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.