Esempio n. 1
0
 /**
  * Creates and returns an Buildable literal token element.
  * 
  * @access  private
  * @return Hoathis\Regex\Visitor\Buildable
  */
 private function createLiteralToken($value, $fill_color)
 {
     $textCell = new \Hoathis\GraphicTools\Text($value);
     $textCell->setAttributes(array('text-anchor' => 'middle'));
     $rect = new \Hoathis\GraphicTools\Rect();
     $rect->setHeight($textCell->getHeight() + self::MARGIN * 2);
     $rect->setWidth($textCell->getWidth() + self::MARGIN * 2);
     $rect->setAttributes(array('fill' => $fill_color));
     $rect->setAttributes(array('rx' => SvgCreator::TOKEN_ROUND_CORNER, 'ry' => SvgCreator::TOKEN_ROUND_CORNER));
     $literal = new \Hoathis\GraphicTools\Svg();
     $literal->setHeight($rect->getHeight());
     $literal->setWidth($rect->getWidth());
     $literal->addChild($rect);
     $literal->addChild($textCell);
     return $literal;
 }
Esempio n. 2
0
 /**
  * Sets the children elements positions for a condition statement.
  *
  * @access private
  */
 private function buildCondition()
 {
     // We have 3 children in condition statement : if then else
     $ifStatement = $this->elements[0];
     // if is child[0]
     $thenStatement = $this->elements[1];
     // then is child[1]
     $elseStatement = $this->elements[2];
     // else is child[2]
     unset($this->elements[1]);
     unset($this->elements[2]);
     $thenElse = new \Hoathis\GraphicTools\Svg();
     $thenElse->setVerticalLayout();
     $thenElse->addPaths();
     $thenElse->setMargin(SvgCreator::BIG_MARGIN);
     $thenElse->setHeight(-SvgCreator::BIG_MARGIN);
     $thenElse->addChild($thenStatement);
     $thenElse->addChild($elseStatement);
     $this->addChild($thenElse);
     $this->setWidth($this->getWidth() + $this->margin * 2);
 }