|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttreebolic.view.Mapper
treebolic.view.AbstractPainter
treebolic.view.Painter
public class Painter
Painter class
Nested Class Summary | |
---|---|
private class |
Painter.NodeData
Class collecting drawing data |
Field Summary | |
---|---|
private static float[] |
theDashPattern
Dash pattern |
private static java.awt.BasicStroke |
theDashStroke
Dash stroke |
private static int |
theDebugFlag
Debug flag, bit1=draw circles, bit2=suppress |
private static float[] |
theDotPattern
Dot pattern |
private static java.awt.BasicStroke |
theDotStroke
Dot stroke |
private static int |
theMinSpanForTerminators
Minimum span for terminators |
private static double |
theTerminatorWidth
Edge terminator width |
private static double |
theTerminorLength
Edge terminator length |
private static int |
theTextPadding
Text padding |
Fields inherited from class treebolic.view.AbstractPainter |
---|
hyperbolicEdges, isDragging, NFONTS, theBackColor, theBackgroundImage, theDefaultEdgeImage, theDefaultNodeImage, theDefaultTreeEdgeImage, theEdgeColor, theEdgeStyle, theFonts, theForeColor, theGraphics, theNodeBackColor, theNodeForeColor, theTreeEdgeColor, theTreeEdgeStyle, theXInset, theYInset |
Fields inherited from class treebolic.view.Mapper |
---|
theLeft, theScaleX, theScaleY, theSize, theTop, theXShift, theYShift |
Constructor Summary | |
---|---|
Painter()
|
Method Summary | |
---|---|
private boolean |
boxesIntersect(java.awt.geom.Rectangle2D thisBox1,
java.awt.geom.Rectangle2D thisBox2)
Get whether boxes intersect (boxes have to be infalted by one pixel) |
private Painter.NodeData |
computeNodeData(INode thisNode)
Compute node data |
private void |
computeTree(INode thisNode)
Compute tree recursively |
private void |
draw(Arc thisArc,
java.lang.String thisLabel,
java.awt.Image thisImage,
int thisStyle,
java.awt.geom.Rectangle2D thisFromBox,
java.awt.geom.Rectangle2D thisToBox,
boolean isBorder)
Draw arc |
private void |
draw(IEdge thisEdge)
Draw non-tree edge |
private void |
drawArc(java.awt.geom.Arc2D thisArc2D,
java.awt.geom.Point2D thisFromAnchor,
java.awt.geom.Point2D thisToAnchor,
int thisStyle)
Draw arc2D |
private void |
drawArc(Complex z1,
Complex z2,
java.lang.String thisLabel,
java.awt.Image thisImage,
int thisStyle,
java.awt.geom.Rectangle2D thisFromBox,
java.awt.geom.Rectangle2D thisToBox,
boolean isBorder)
Draw geodesic arc from z1 to z2 which models line from z1 to z2 |
private void |
drawCircle(double x,
double y,
double r,
java.awt.Color thisColor)
Draw circle |
private void |
drawEdgeEnds(java.awt.geom.Point2D thisFrom,
java.awt.geom.Point2D thisTo,
java.awt.geom.Arc2D thisArc2D,
int thisStyle)
Draw edge ends |
private void |
drawImage(java.awt.Image thisImage,
java.awt.geom.Point2D where)
Draw image at point |
private void |
drawLine(java.awt.geom.Point2D thisFromPoint,
java.awt.geom.Point2D thisToPoint,
int thisStyle)
Draw line from p1 to p2 |
private void |
drawNode(Painter.NodeData thisNodeData)
Draw node |
private void |
drawSpace(INode thisNode)
Draw node's space |
private void |
drawText(java.lang.String thisString,
java.awt.geom.Point2D thisWhere,
double thisOrientation)
Draw text |
private void |
drawText(java.lang.String thisString,
java.awt.geom.Point2D thisFrom,
java.awt.geom.Point2D thisTo)
Draw text from (x1,y1) to (x2,y2) |
private void |
drawTree(INode thisNode)
Draw tree recursively |
private void |
drawTreeEdge(INode thisParent,
INode thisNode)
Draw tree edge, from parent to child |
private static double |
getEccentricity(java.awt.geom.Arc2D thisArc2D)
Get arc eccentricity |
private java.awt.geom.Point2D |
getIntersection(java.awt.geom.Rectangle2D thisRect,
java.awt.geom.Arc2D thisArc)
Get intersection between arc and rectangle |
private java.awt.geom.Point2D |
getIntersection(java.awt.geom.Rectangle2D thisRect,
java.awt.geom.Point2D thisFrom,
java.awt.geom.Point2D thisTo)
Get intersection between line and rectangle |
private java.awt.geom.Point2D |
getMidArc(java.awt.geom.Arc2D thisArc2D)
Get mid-arc point |
private java.awt.geom.Point2D |
getMiddle(java.awt.geom.Point2D x1,
java.awt.geom.Point2D x2)
Get middle |
private double |
getTangent(java.awt.geom.Arc2D thisArc2D,
java.awt.geom.Point2D thisWhere)
Get tangent to this Arc2D at given point |
private boolean |
isOnArc(double dx,
double dy,
java.awt.geom.Arc2D thisArc)
Test whether point is on arc |
private java.lang.String |
mangleString(java.lang.String thisString,
java.awt.geom.Point2D thisFrom,
java.awt.geom.Point2D thisTo)
Mangle string to fit in |
void |
paint(INode thisRoot,
java.util.List<IEdge> thisEdgeList)
Paint |
void |
paintBackground()
Paint background |
private double |
pointToAngle(double dx,
double dy,
java.awt.geom.Arc2D thisArc)
Compute angle for point |
private java.awt.geom.Arc2D |
toArc2D(Arc thisArc)
Convert Arc to Arc2D |
Methods inherited from class treebolic.view.AbstractPainter |
---|
enterDrag, getHyperbolicEdges, leaveDrag, resetColors, setColors, setEdgeStyles, setFonts, setHyperbolicEdges, setImages, setup |
Methods inherited from class treebolic.view.Mapper |
---|
computeScale, getSize, getViewLocation, getXShift, getYShift, hUnitCircleToView, hViewToUnitCircle, setXShift, setYShift, setZoomFactor, viewToUnitCircle, wUnitCircleToView, wViewToUnitCircle, xUnitCircleToView, xViewToUnitCircle, yUnitCircleToView, yViewToUnitCircle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final float[] theDotPattern
private static final java.awt.BasicStroke theDotStroke
private static final float[] theDashPattern
private static final java.awt.BasicStroke theDashStroke
private static final int theMinSpanForTerminators
private static final int theTextPadding
private static final double theTerminorLength
private static final double theTerminatorWidth
private static final int theDebugFlag
Constructor Detail |
---|
public Painter()
Method Detail |
---|
public void paintBackground()
AbstractPainter
paintBackground
in class AbstractPainter
public void paint(INode thisRoot, java.util.List<IEdge> thisEdgeList)
AbstractPainter
paint
in class AbstractPainter
thisRoot
- starting nodethisEdgeList
- edgesprivate void computeTree(INode thisNode)
thisNode
- starting nodeprivate void drawTree(INode thisNode)
thisNode
- starting nodeprivate void drawNode(Painter.NodeData thisNodeData)
thisNodeData
- computed node dataprivate Painter.NodeData computeNodeData(INode thisNode)
thisNode
- node
private void drawTreeEdge(INode thisParent, INode thisNode)
thisParent
- from-nodethisNode
- to-nodeprivate void draw(IEdge thisEdge)
thisEdge
- edgeprivate void drawArc(Complex z1, Complex z2, java.lang.String thisLabel, java.awt.Image thisImage, int thisStyle, java.awt.geom.Rectangle2D thisFromBox, java.awt.geom.Rectangle2D thisToBox, boolean isBorder)
z1
- from-endz2
- to-endthisLabel
- arc labelthisImage
- arc imagethisStyle
- code for edge stylethisFromBox
- from-node boxthisToBox
- to-node boxisBorder
- true if arc neighbours borderprivate void draw(Arc thisArc, java.lang.String thisLabel, java.awt.Image thisImage, int thisStyle, java.awt.geom.Rectangle2D thisFromBox, java.awt.geom.Rectangle2D thisToBox, boolean isBorder)
thisArc
- arcthisLabel
- arc labelthisImage
- arc imageisBorder
- true if arc neighbours borderprivate void drawArc(java.awt.geom.Arc2D thisArc2D, java.awt.geom.Point2D thisFromAnchor, java.awt.geom.Point2D thisToAnchor, int thisStyle)
thisArc2D
- arcprivate void drawEdgeEnds(java.awt.geom.Point2D thisFrom, java.awt.geom.Point2D thisTo, java.awt.geom.Arc2D thisArc2D, int thisStyle)
thisFrom
- from-endthisTo
- to-endthisArc2D
- arcthisStyle
- style codeprivate java.awt.geom.Arc2D toArc2D(Arc thisArc)
thisArc
- arc
private static double getEccentricity(java.awt.geom.Arc2D thisArc2D)
thisArc2D
- arc
private java.awt.geom.Point2D getMidArc(java.awt.geom.Arc2D thisArc2D)
thisArc2D
- arc
private double getTangent(java.awt.geom.Arc2D thisArc2D, java.awt.geom.Point2D thisWhere)
thisArc2D
- arcthisWhere
- point on arc
private void drawText(java.lang.String thisString, java.awt.geom.Point2D thisWhere, double thisOrientation)
thisString
- string to be drawnthisWhere
- where to put text (centered on this point)thisOrientation
- text orientationprivate void drawText(java.lang.String thisString, java.awt.geom.Point2D thisFrom, java.awt.geom.Point2D thisTo)
thisString
- textthisFrom
- from-pointthisTo
- to-pointprivate java.lang.String mangleString(java.lang.String thisString, java.awt.geom.Point2D thisFrom, java.awt.geom.Point2D thisTo)
thisString
- thisFrom
- from-pointthisTo
- to-point
private void drawLine(java.awt.geom.Point2D thisFromPoint, java.awt.geom.Point2D thisToPoint, int thisStyle)
thisFromPoint
- from-pointthisToPoint
- to-pointprivate void drawImage(java.awt.Image thisImage, java.awt.geom.Point2D where)
thisImage
- imagewhere
- locationprivate java.awt.geom.Point2D getMiddle(java.awt.geom.Point2D x1, java.awt.geom.Point2D x2)
x1
- from pointx2
- to mpoint
private void drawSpace(INode thisNode)
thisNode
- nodeprivate void drawCircle(double x, double y, double r, java.awt.Color thisColor)
x
- center x-coordinatey
- center y-coordinater
- radiusthisColor
- colorprivate java.awt.geom.Point2D getIntersection(java.awt.geom.Rectangle2D thisRect, java.awt.geom.Point2D thisFrom, java.awt.geom.Point2D thisTo)
thisRect
- rectanglethisFrom
- from-point on linethisTo
- to-point on line
private boolean boxesIntersect(java.awt.geom.Rectangle2D thisBox1, java.awt.geom.Rectangle2D thisBox2)
thisBox1
- box1thisBox2
- box2
private java.awt.geom.Point2D getIntersection(java.awt.geom.Rectangle2D thisRect, java.awt.geom.Arc2D thisArc)
thisRect
- rectanglethisArc
- arc
private boolean isOnArc(double dx, double dy, java.awt.geom.Arc2D thisArc)
dx
- x-offset from arc centerdy
- y-offset from arc centerthisArc
- arc
private double pointToAngle(double dx, double dy, java.awt.geom.Arc2D thisArc)
dx
- x-offset from arc centerdy
- y-offset from arc centerthisArc
- arc
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |