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
Modifier and TypeFieldDescriptionprotected Color
Stored costructor parameterprotected final Stroke
Line type for all normal lines and boxes.protected SyntaxGraph.RectMap
Visitor result register: the map from areas to Strings, for clickability.protected SyntaxGraph.RefPainter
The object used to paint references.protected final Stroke
Line 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Paint an alt-expresion.void
Paint a character set binaryoperator.void
Paint a character set binaryoperator.void
Paint a character set binaryoperator.void
Paint a character set binaryoperator.void
action
(CharSetConst cs) Paint a character set constant.void
Render a greedy operator as a dashed and decorated box around the contained expression.void
Render an insertion.void
Paint an option-expresion.void
action
(ParseParticle pp) Paint the graphical representation of a tag-generating parse particle in a character parser.void
Paint the graphic representation of pc-data content.void
void
Paint an plus-expresion.void
Render a reference.void
Paint a seq-expression.void
Paint a star-expresion.void
action
(StringConst sc) Paint the graphical representation of a String constant.void
Render a substituion operator as a dashed and decorated box around the contained expression.(package private) void
drawArc
(int xc, int yc, int quad, boolean isTight) Draw a quarter of a circle.(package private) void
drawLine
(int x0, int y0, int x1, int y1, boolean isTight) Draw a straight line.protected void
drawtriangle
(int x0, int x1, int x2, int y0, int y1, int y2) Draw a triangle which frames the Perm-expression.protected void
paintCharBin
(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) void
paintMetaBox
(Expression exp, Expression sub, String text) Paint a dashed box for insertion/substitution/greediness.(package private) void
paintOptOrStar
(GrUnary x, boolean isStar, boolean istight) Paint an option- or star-expresion.(package private) void
paintPassline
(int xw, int y_inout, boolean hasBackline, boolean istight) Draws a pass-line (for creating epsilon) and additionally a back-line beneath, iff selected.(package private) AffineTransform
shiftCoordinates
(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_xattributes
Methods 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.y
andSyntaxGraph.inX
positions, 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:
action
in 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:
action
in classSinglePhase
-
action
Render a greedy operator as a dashed and decorated box around the contained expression.- Overrides:
action
in classSinglePhase
-
action
Render a substituion operator as a dashed and decorated box around the contained expression.- Overrides:
action
in classSinglePhase
-
action
Render a reference. CallsprocessReferring(Expression,String,boolean,boolean)
- Overrides:
action
in classSinglePhase
-
paintPassline
void paintPassline(int xw, int y_inout, 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:
action
in classSinglePhase
-
action
Paint a star-expresion.- Overrides:
action
in classSinglePhase
-
action
Paint an plus-expresion.- Overrides:
action
in classSinglePhase
-
action
Paint an alt-expresion. Assumes that alt.on is not a singleton, not "deprivated".- Overrides:
action
in 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:
action
in classSinglePhase
-
action
Paint a seq-expression.- Overrides:
action
in classSinglePhase
-
action
Paint a character set constant.- Overrides:
action
in classSinglePhase
-
paintCharBin
Paint a character set binaryoperator. -
action
Paint a character set binaryoperator.- Overrides:
action
in classSinglePhase
-
action
Paint a character set binaryoperator.- Overrides:
action
in classSinglePhase
-
action
Paint a character set binaryoperator.- Overrides:
action
in classSinglePhase
-
action
Paint a character set binaryoperator.- Overrides:
action
in classSinglePhase
-
action
Paint the graphical representation of a tag-generating parse particle in a character parser.- Overrides:
action
in classSinglePhase
-
action
Paint the graphical representation of a String constant.- Overrides:
action
in classSinglePhase
-