Package eu.bandm.tools.d2d2.base
Class SyntaxGraph.Painter
java.lang.Object
eu.bandm.tools.d2d2.model.MATCH_ONLY_00
eu.bandm.tools.d2d2.model.SinglePhase
eu.bandm.tools.d2d2.base.SyntaxGraph.Painter
- Enclosing class:
SyntaxGraph
Class which does the painting and creates the data structures for the
"clickable" image.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ColorStored costructor parameterprotected final StrokeLine type for all normal lines and boxes.protected SyntaxGraph.RectMapVisitor result register: the map from areas to Strings, for clickability.protected SyntaxGraph.RefPainterThe object used to paint references.protected final StrokeLine type for operators without any intervening whitespace, like "~+" and "~".Fields inherited from class eu.bandm.tools.d2d2.model.MATCH_ONLY_00
_visitor_debug_stream, partial -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidPaint an alt-expresion.voidPaint a character set binaryoperator.voidPaint a character set binaryoperator.voidPaint a character set binaryoperator.voidPaint a character set binaryoperator.voidaction(CharSetConst cs) Paint a character set constant.voidRender a greedy operator as a dashed and decorated box around the contained expression.voidRender an insertion.voidPaint an option-expresion.voidaction(ParseParticle pp) Paint the graphical representation of a tag-generating parse particle in a character parser.voidPaint the graphic representation of pc-data content.voidvoidPaint an plus-expresion.voidRender a reference.voidPaint a seq-expression.voidPaint a star-expresion.voidaction(StringConst sc) Paint the graphical representation of a String constant.voidRender a substituion operator as a dashed and decorated box around the contained expression.(package private) voiddrawArc(int xc, int yc, int quad, boolean isTight) Draw a quarter of a circle.(package private) voiddrawLine(int x0, int y0, int x1, int y1, boolean isTight) Draw a straight line.protected voiddrawtriangle(int x0, int x1, int x2, int y0, int y1, int y2) Draw a triangle which frames the Perm-expression.protected voidpaintCharBin(CharBinary bin, String operator) Paint a character set binaryoperator.paintIt(Expression expr, @Opt SyntaxGraph.RefPainter refPainter, Color backgroundColor) Central Service Access: Paint the complete expression tree.(package private) voidpaintMetaBox(Expression exp, Expression sub, String text) Paint a dashed box for insertion/substitution/greediness.(package private) voidpaintOptOrStar(GrUnary x, boolean isStar, boolean istight) Paint an option- or star-expresion.(package private) voidpaintPassline(int xw, int yInOut, boolean hasBackline, boolean istight) Draws a pass-line (for creating epsilon) and additionally a back-line beneath, iff selected.(package private) AffineTransformshiftCoordinates(int x, int y) Add a new transformation to the transformation pipeline and return its former state.Methods inherited from class eu.bandm.tools.d2d2.model.SinglePhase
action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, follow_definitions, follow_defInstances, follow_docu, follow_firsts, follow_globalSubsts, follow_imports, follow_itemDocu, follow_localdefs, follow_localSubsts, follow_modules, follow_namespaces, follow_obligates, follow_on, follow_rawModules, follow_text, follow_weakfirsts, follow_xattributesMethods inherited from class eu.bandm.tools.d2d2.model.MATCH_ONLY_00
_visitor_trace, action, action, action, action, action, compile, followAll_definitions, followAll_defInstances, followAll_docu, followAll_firsts, followAll_globalSubsts, followAll_imports, followAll_itemDocu, followAll_localdefs, followAll_localSubsts, followAll_modules, followAll_namespaces, followAll_obligates, followAll_on, followAll_rawModules, followAll_text, followAll_weakfirsts, followAll_xattributes, foreignObject, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, nomatch
-
Field Details
-
backgroundColor
Stored costructor parameter -
rectMap
Visitor result register: the map from areas to Strings, for clickability. -
refPainter
The object used to paint references. -
normalStroke
Line type for all normal lines and boxes. -
tightStroke
Line type for operators without any intervening whitespace, like "~+" and "~". Is broader than the normal line.
-
-
Constructor Details
-
Painter
public Painter()
-
-
Method Details
-
paintIt
public SyntaxGraph.RectMap paintIt(Expression expr, @Opt @Opt SyntaxGraph.RefPainter refPainter, Color backgroundColor) Central Service Access: Paint the complete expression tree. Initial coordinate system is the image to create.
All compound expressions update the affine transform state according to their ownSyntaxGraph.yandSyntaxGraph.inXpositions, then draw their (more or less complex) line systems and descend into the sub-expressions.
All simple expressions do not change the affine transform state, but use their stored coordinate to paramtrize draw commands. (But they could do it also via the transform state.)- Parameters:
expr- expression which shall be printedrefPainter- used to paint the references. If ==null, a default will be used.- Returns:
- the map of areas for to be clickable
-
drawArc
void drawArc(int xc, int yc, int quad, boolean isTight) Draw a quarter of a circle.- Parameters:
xc- x coordinate of centeryc- y coordinate of centerquad- quadrant to paint, in mathematical numberingisTight- whether to draw with a bold line
-
drawLine
void drawLine(int x0, int y0, int x1, int y1, boolean isTight) Draw a straight line.- Parameters:
x0- x coordinate of starty0- y coordinate of startx1- x coordinate of endy1- y coordinate of endisTight- whether to draw with a bold line
-
shiftCoordinates
Add a new transformation to the transformation pipeline and return its former state. -
action
Paint the graphic representation of pc-data content.- Overrides:
actionin classSinglePhase
-
paintMetaBox
Paint a dashed box for insertion/substitution/greediness.- Parameters:
exp- the higher expressionsub- the contained expressiontext- to print
-
action
Render an insertion. Either as a dashed box araound an expression, or simply containing the name of a reference.- Overrides:
actionin classSinglePhase
-
action
Render a greedy operator as a dashed and decorated box around the contained expression.- Overrides:
actionin classSinglePhase
-
action
Render a substituion operator as a dashed and decorated box around the contained expression.- Overrides:
actionin classSinglePhase
-
action
Render a reference. CallsprocessReferring(Expression,String,boolean,boolean)- Overrides:
actionin classSinglePhase
-
paintPassline
void paintPassline(int xw, int yInOut, boolean hasBackline, boolean istight) Draws a pass-line (for creating epsilon) and additionally a back-line beneath, iff selected. Assumes that this fact has already been respected when calculating the y_in and y_out coordinates and the y-coordinates of the sub-object ! -
paintOptOrStar
Paint an option- or star-expresion. -
action
Paint an option-expresion.- Overrides:
actionin classSinglePhase
-
action
Paint a star-expresion.- Overrides:
actionin classSinglePhase
-
action
Paint an plus-expresion.- Overrides:
actionin classSinglePhase
-
action
Paint an alt-expresion. Assumes that alt.on is not a singleton, not "deprivated".- Overrides:
actionin classSinglePhase
-
drawtriangle
protected void drawtriangle(int x0, int x1, int x2, int y0, int y1, int y2) Draw a triangle which frames the Perm-expression. -
action
- Overrides:
actionin classSinglePhase
-
action
Paint a seq-expression.- Overrides:
actionin classSinglePhase
-
action
Paint a character set constant.- Overrides:
actionin classSinglePhase
-
paintCharBin
Paint a character set binaryoperator. -
action
Paint a character set binaryoperator.- Overrides:
actionin classSinglePhase
-
action
Paint a character set binaryoperator.- Overrides:
actionin classSinglePhase
-
action
Paint a character set binaryoperator.- Overrides:
actionin classSinglePhase
-
action
Paint a character set binaryoperator.- Overrides:
actionin classSinglePhase
-
action
Paint the graphical representation of a tag-generating parse particle in a character parser.- Overrides:
actionin classSinglePhase
-
action
Paint the graphical representation of a String constant.- Overrides:
actionin classSinglePhase
-