Mercurial > projects > doodle
view doodle/fig/diagram_elements.d @ 73:6f2525e170f2
Cairo/OpenGL checkpoint
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Sun, 15 Aug 2010 01:02:15 +0930 |
parents | 31d10176415d |
children | b759414d2b72 |
line wrap: on
line source
module doodle.fig.diagram_elements; private { import doodle.tk.geometry; import doodle.tk.cairo; } interface IDiagram { void add(DiagramElement element); } abstract class DiagramElement { Rectangle bounds() const; void draw(in Rectangle damage, scope Context 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 Context cr) const { rectangle(cr, bounds); } override Rectangle bounds() const { return _bounds; } private { Rectangle _bounds; } }