Class SyntaxGraph

java.lang.Object
eu.bandm.tools.d2d2.base.SyntaxGraph

public class SyntaxGraph extends Object
Calculates and paints an extended regex as graphic. Usage is a little bit redundant, see Def2Doc(3):
 s = new SyntaxGraph(Graphics gr);
        SizeInfo = s.new Layouter().layout(def); 
        Image = create writeable image
        gri = image, get drawing Graphics
        s.setGraphic(gri);
 
The symbols follow the "Wirth"-tradition, and additionally render the permutation "a & b" like "(a|b)", but with special triangular symbols as border lines.
  • Field Details

    • layoutParameters

      protected final SyntaxGraph.LayoutParameters layoutParameters
    • graphics2D

      protected Graphics2D graphics2D
    • inX

      protected Map<Expression,Integer> inX
      All positions (inX, outX, y, and more) of each expression are RELATIVE to the enclosing construct. Therefore, when calculating, the graph of every expression starts at (0,0); when painting, every Expression before descending into a sub-expression opens a further AffineTransform, which maps the sub-expression's origin=(0,0) to the coordinates relative to its own origin=(0.0), where the sub-expression shall be positioned. These are the co-ordinates stored here.
    • outX

      protected Map<Expression,Integer> outX
    • y

      protected Map<Expression,Integer> y
    • y2

      protected Map<Expression,Integer> y2
      auxiliary ypos which cannot be easily calculated from contents, e.g. for plus/y pos of backline and subst/height of box
    • yaux

      protected Map<Expression,Integer> yaux
    • mainFont

      protected final Font mainFont
    • smallFont

      protected final Font smallFont
    • ttFont

      protected final Font ttFont
  • Constructor Details

  • Method Details

    • setGraphics

      public void setGraphics(Graphics2D graphics2D)
    • calcTextWidth

      protected int calcTextWidth(String s, Font f)
      FIXME 1) font/fontSize should be selectable,
      2) different kinds of text/represented objects dto.
    • getTag

      protected String getTag(Reference ref)