Exemplo n.º 1
0
 public function drawQuadrilateral(Quadrilateral $quadri, array $options = array())
 {
     $point1 = $this->drawPoint($quadri->getPointA(), $options);
     $point2 = $this->drawPoint($quadri->getPointB(), $options);
     $point3 = $this->drawPoint($quadri->getPointC(), $options);
     $point4 = $this->drawPoint($quadri->getPointD(), $options);
     $data = json_encode(array_merge($options, $this->getOptionsByPrefix(self::POLYGONE_PREFIX)), JSON_NUMERIC_CHECK);
     $name_quadri = 'pol' . uniqid();
     $this->addOutput("var {$name_quadri} = {$this->_brd}.create('polygon', [{$point1},{$point2},{$point3},{$point4}], {$data});");
     if ($this->getOption('build_polygon_group') == true && (!array_key_exists('build_polygon_group', $options) || $options['build_polygon_group'] == true)) {
         $this->addOutput("var gr{$name_quadri} = {$this->_brd}.create('group', [{$point1},{$point2},{$point3},{$point4}]);");
     }
     return $name_quadri;
 }
Exemplo n.º 2
0
 /**
  * @param   null|\Maths\Point(s)    $point_a
  * @param   null|\Maths\Point(s)    $point_b
  * @param   null|\Maths\Point(s)    $point_c
  * @param   null|\Maths\Point(s)    $point_d
  * @param   int                             $space_type
  */
 public function __construct($point_a = null, $point_b = null, $point_c = null, $point_d = null, $space_type = Maths::CARTESIAN_2D)
 {
     parent::__construct($point_a, $point_b, $point_c, $point_d, $space_type);
 }