Mercurial > projects > doodle
view doodle/fig/diagram_elements.d @ 97:dcd641209671
What to do...
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Fri, 27 Aug 2010 18:01:33 +0930 |
parents | 66210d8ea37a |
children | bc5baa585b32 |
line wrap: on
line source
module doodle.fig.diagram_elements; public { import doodle.tk.geometry; } private { import doodle.tk.renderer; } interface IDiagram { void add(DiagramElement element); } abstract class DiagramElement { Rectangle bounds() const; void draw(in Rectangle damage, scope Renderer cr) const; private { GraphElement _container; } } abstract class SemanticModelBridge { } final class SimpleSemanticModelElement : SemanticModelBridge { private { string _typeInfo; } } abstract class GraphElement : DiagramElement { // Link to model via bridge goes here private { SemanticModelBridge _modelBridge; GraphConnector[] _anchorages; DiagramElement[] _containeds; } } class GraphConnector { private { GraphElement _graphElement; GraphEdge[] _graphEdges; } } final class GraphNode : GraphElement { override Rectangle bounds() const { return _bounds; } override void draw(in Rectangle damage, scope Renderer cr) const { } private { Rectangle _bounds; } } final class GraphEdge : GraphElement { override Rectangle bounds() const { return _bounds; } override void draw(in Rectangle damage, scope Renderer cr) const { } private { GraphConnector[2] _anchors; Point[] _waypoints; Rectangle _bounds; } } abstract class LeafElement : DiagramElement { } class TextElement : LeafElement { override Rectangle bounds() const { return _bounds; } override void draw(in Rectangle damage, scope Renderer cr) const { } private { Rectangle _bounds; } } abstract class GraphicPrimitive : LeafElement { } class PolylinePrimitive : GraphicPrimitive { override Rectangle bounds() const { return _bounds; } override void draw(in Rectangle damage, scope Renderer cr) const { } private { Point[] _waypoints; Rectangle _bounds; } } final class RectanglePrimitive : GraphicPrimitive { override Rectangle bounds() const { return _bounds; } override void draw(in Rectangle damage, scope Renderer drawable) const { drawable.drawRectangle(bounds, false); } private { Rectangle _bounds; } }