PhpOffice\PhpPresentation\Shape\Group::addShape PHP Method

addShape() public method

Add shape to slide
public addShape ( AbstractShape $shape ) : AbstractShape
$shape PhpOffice\PhpPresentation\AbstractShape
return PhpOffice\PhpPresentation\AbstractShape
    public function addShape(AbstractShape $shape)
    {
        $shape->setContainer($this);
        return $shape;
    }

Usage Example

Exemplo n.º 1
0
 public function testExtentsAndOffsetsForTwoShapes()
 {
     // Since Groups and Slides cache offsets and extents on first
     // calculation, this test is separate from the above.
     // Should the calculation be performed every GET, this test can be
     // combined with the above.
     $offsetX = 100;
     $offsetY = 100;
     $extentX = 1000;
     $extentY = 450;
     $increase = 50;
     $line1 = new Line($offsetX, $offsetY, $extentX, $extentY);
     $line2 = new Line($offsetX + $increase, $offsetY + $increase, $extentX + $increase, $extentY + $increase);
     $object = new Group();
     $object->addShape($line1);
     $object->addShape($line2);
     $this->assertEquals($offsetX, $object->getOffsetX());
     $this->assertEquals($offsetY, $object->getOffsetY());
     $this->assertEquals($extentX + $increase, $object->getExtentX());
     $this->assertEquals($extentY + $increase, $object->getExtentY());
 }
All Usage Examples Of PhpOffice\PhpPresentation\Shape\Group::addShape