java.lang.Object
com.port80.graph.dot.impl.RouteFactory
- All Implemented Interfaces:
- com.port80.util.attr.IAttrFactory
- public class RouteFactory
- extends java.lang.Object
- implements com.port80.util.attr.IAttrFactory
Route (DotRoute) attribute factory.
|
Method Summary |
static DotRoute |
create(java.lang.String stringvalue)
|
private DotRoute |
createBezier(com.port80.util.struct.FloatList pts,
com.port80.util.struct.FloatList startpt,
com.port80.util.struct.FloatList endpt,
boolean isReversed)
The Bezier points from the .dot file looks like a mess. |
java.lang.Object |
createObject(java.lang.String str)
Create an instance of route from the String spec. |
private DotRoute |
createPolyline(com.port80.util.struct.FloatList pts,
com.port80.util.struct.FloatList startpt,
com.port80.util.struct.FloatList endpt,
boolean isReversed)
|
static void |
dotModeOff()
|
static void |
dotModeOn(double maxy)
|
static RouteFactory |
getInstance()
|
boolean |
isValid(java.lang.Object a)
Check that given object is valid value for this factory. |
private int |
parsePoint(java.lang.String str,
int start,
int max,
com.port80.util.struct.FloatList pts)
|
java.lang.Object |
promptUser(java.lang.String prompt)
Prompt user and present a user interface to obtain an
attribute value from user. |
private int |
skipWhiteSpace(java.lang.String str,
int start,
int max)
|
java.lang.String |
toString()
The String representation of attribute type itself. |
java.lang.String |
toString(java.lang.Object attrObject)
The String representation of an attribute value. |
NAME
private static final java.lang.String NAME
- See Also:
- Constant Field Values
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
instance
private static RouteFactory instance
isDotMode
private static boolean isDotMode
maxY
private static double maxY
RouteFactory
private RouteFactory()
dotModeOn
public static void dotModeOn(double maxy)
dotModeOff
public static void dotModeOff()
getInstance
public static RouteFactory getInstance()
create
public static DotRoute create(java.lang.String stringvalue)
createObject
public java.lang.Object createObject(java.lang.String str)
- Create an instance of route from the String spec.
Current accepted .dot file string format:
For beizer curves:
[x0,y0 (x11,y11 x12,y12 x13,y13)+]
p0-p1-...
[e|E,xe,ye x0,y0 (x11,y11 x12,y12 x13,y13)+]
p0-p1-...->pe
[s|S,xs,ys [e,xe,ye] x0,y0 (x11,y11 x12,y12 x13,y13)+]
ps<-p0-p1-...->pe
For polyline:
[p x0,y0 x1,y1 ...]
[p s|S,xs,ys x0,y0 x1,y1 ...]
[p e|E,xs,ys x0,y0 x1,y1 ...]
s=location of tail arrow head from start of spline.
S=location of head arrow head from start of spline.
e=location of head arrow head from end of spline.
E=location of tail arrow head from end of spline.
where xs,ys and xe,ye are the arrow end points away from the curve.
- Specified by:
createObject in interface com.port80.util.attr.IAttrFactory
isValid
public boolean isValid(java.lang.Object a)
- Description copied from interface:
com.port80.util.attr.IAttrFactory
- Check that given object is valid value for this factory.
- Specified by:
isValid in interface com.port80.util.attr.IAttrFactory
toString
public java.lang.String toString(java.lang.Object attrObject)
- The String representation of an attribute value.
- Specified by:
toString in interface com.port80.util.attr.IAttrFactory
toString
public java.lang.String toString()
- The String representation of attribute type itself.
- Specified by:
toString in interface com.port80.util.attr.IAttrFactory
promptUser
public java.lang.Object promptUser(java.lang.String prompt)
- Prompt user and present a user interface to obtain an
attribute value from user.
- Specified by:
promptUser in interface com.port80.util.attr.IAttrFactory
parsePoint
private int parsePoint(java.lang.String str,
int start,
int max,
com.port80.util.struct.FloatList pts)
skipWhiteSpace
private int skipWhiteSpace(java.lang.String str,
int start,
int max)
createPolyline
private DotRoute createPolyline(com.port80.util.struct.FloatList pts,
com.port80.util.struct.FloatList startpt,
com.port80.util.struct.FloatList endpt,
boolean isReversed)
createBezier
private DotRoute createBezier(com.port80.util.struct.FloatList pts,
com.port80.util.struct.FloatList startpt,
com.port80.util.struct.FloatList endpt,
boolean isReversed)
- The Bezier points from the .dot file looks like a mess. It
appears to be arranged like this:
'e' x0,y0 (xn3,yn3 xn2,yn2 xn1,yn1) ... (x13,y13 x12,y12 x11,y11) x_ y_
p_<-p0->p1->...->pn
's' x_,y_ (xn3,yn3 xn2,yn2 xn1,yn1) ... (x13,y13 x12,y12 x11,y11) x0 y0
p0->p1->...->pn->p_
where
p_ is the arrow head.