|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjsky.image.graphics.ShapeUtil
public class ShapeUtil
Utility methods for generating various common Shapes for drawing figures.
Field Summary | |
---|---|
static int |
ARROW_SIZE
Default length of an arrow |
Constructor Summary | |
---|---|
ShapeUtil()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ARROW_SIZE
Constructor Detail |
---|
public ShapeUtil()
Method Detail |
---|
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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |