40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace swf2ass;
|
|
|
|
class ShapeDefinition implements ObjectDefinition {
|
|
public int $id;
|
|
public Rectangle $bounds;
|
|
public DrawPathList $shapeList;
|
|
|
|
public function __construct(int $id, Rectangle $bounds, DrawPathList $shapes) {
|
|
$this->id = $id;
|
|
$this->bounds = $bounds;
|
|
$this->shapeList = $shapes;
|
|
}
|
|
|
|
public function getObjectId(): int {
|
|
return $this->id;
|
|
}
|
|
|
|
public function getShapeList(?float $ratio): DrawPathList {
|
|
return $this->shapeList;
|
|
}
|
|
|
|
static function fromArray(array $element): ShapeDefinition {
|
|
$styles = StyleList::fromArray($element["shapes"]);
|
|
|
|
//$drawPathList = new DrawPathList([]);
|
|
//foreach ($element["shapes"] as $node) {
|
|
//$drawPathList = $drawPathList->merge(DrawPathList::fromArray($node["shapeRecords"], $styles));
|
|
//}
|
|
|
|
$drawPathList = DrawPathList::fromArray($element["shapes"]["shapeRecords"], $styles);
|
|
|
|
return new ShapeDefinition($element["shapeId"], Rectangle::fromArray($element["shapeBounds"]), $drawPathList);
|
|
}
|
|
|
|
public function getSafeObject() : ShapeDefinition{
|
|
return $this;
|
|
}
|
|
} |