x = $x; $this->y = $y; $this->radius = $radius; } /** * Create the SVG representation from this Drawable * * @param RenderContext $ctx The context to use for rendering * @return DOMElement The SVG Element */ public function toSvg(RenderContext $ctx) { $coords = $ctx->toAbsolute($this->x, $this->y); $circle = $ctx->getDocument()->createElement('circle'); $circle->setAttribute('cx', Format::formatSVGNumber($coords[0])); $circle->setAttribute('cy', Format::formatSVGNumber($coords[1])); $circle->setAttribute('r', $this->radius); $id = $this->id ?? uniqid('circle-'); $circle->setAttribute('id', $id); $this->setId($id); $this->applyAttributes($circle); $style = new DOMDocument(); $style->loadHTML($this->getStyle()); $circle->appendChild( $circle->ownerDocument->importNode( $style->getElementsByTagName('style')->item(0), true ) ); return $circle; } }