import { DrawElement } from "./draw" interface PropEllipse { cx: number cy: number rx: number ry: number } interface SvgOptions { color?: string storkWidth?: number, strokeWidth?: number, stroke?:string, dasharray?: string, fill?: string, opacity?: number } export class DrawEllipse extends DrawElement { constructor(private posAndSize: PropEllipse) { super(); // Default Attribute this.attributes.set('strokeWidth', 1); this.attributes.set('stroke', "#000000"); this.attributes.set('fill', 'none'); } setAtrr(att: Partial) { Object.entries(att).forEach(([key, value]) => { this.attributes.set(key, value); }); } drawSvg() { const paraStr = this.convertAttributesToString(this.attributes); const posSvg = this.getSvgPositions(this.posAndSize) const posStr = this.convertAttributesToString(posSvg); const shape = this.drawElementSvg(posStr, paraStr); return shape; } drawXaml(): string { const paraStr = this.convertAttributesToString(this.attributes, true); const posXaml = this.getXamlPositions(this.posAndSize) const posStr = this.convertAttributesToString(posXaml, true); const shape = this.drawElementXaml(posStr, paraStr); return shape; } drawElementSvg(position: string, options: string) { return `` } drawElementXaml(position: string, options: string) { return `` } getSvgPositions(dim: PropEllipse) { let retValue = new Map(); retValue.set('cx', dim.cx); retValue.set('cy', dim.cy); retValue.set('rx', dim.rx); retValue.set('ry', dim.ry); return retValue; } getXamlPositions(dim: PropEllipse) { let retValue = new Map(); retValue.set('Canvas.Left', dim.cx - dim.rx); retValue.set('Canvas.Top', dim.cy - dim.ry); retValue.set('Width', dim.rx * 2); retValue.set('Height', dim.ry * 2); return retValue; } }