Mercurial > projects > doodle
view doodle/fig/diagram_elements.d @ 80:b759414d2b72
Switched from cairo to Drawable abstraction
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Sun, 15 Aug 2010 23:43:04 +0930 |
parents | 6f2525e170f2 |
children | cdd4fc728d94 |
line wrap: on
line source
module doodle.fig.diagram_elements; private { import doodle.tk.geometry; import doodle.tk.drawable; } interface IDiagram { void add(DiagramElement element); } abstract class DiagramElement { Rectangle bounds() const; void draw(in Rectangle damage, scope Drawable cr) const; private { //GraphElement _container; // FIXME use an interface to the container } } /* abstract class SemanticModelBridge { }; abstract class GraphElement : DiagramElement { // Link to model via bridge goes here private { SemanticModelBridge _modelBridge; GraphConnector[] _anchorages; } } class GraphConnector { } final class GraphNode : GraphElement { } final class GraphEdge : GraphElement { private { GraphConnector[2] _anchors; } } */ abstract class LeafElement : DiagramElement { } /* class TextElement : LeafElement { } */ abstract class GraphicPrimitive : LeafElement { } /* class PolylinePrimitive : GraphicPrimitive { private { Point[] _waypoints; } } */ final class RectanglePrimitive : GraphicPrimitive { override void draw(in Rectangle damage, scope Drawable drawable) const { drawable.drawRectangle(bounds, false); } override Rectangle bounds() const { return _bounds; } private { Rectangle _bounds; } }