Mercurial > projects > doodle
diff doodle/import/p_model.d @ 29:960b408d3ac5
Builds and runs ok with builder now.
Still heaps of cleaning up to do, especially code roughly
imported from dog.
author | Graham St Jack <graham.stjack@internode.on.net> |
---|---|
date | Mon, 03 Aug 2009 23:19:55 +0930 |
parents | doodle/import/p-model.d@1754cb773d41 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doodle/import/p_model.d Mon Aug 03 23:19:55 2009 +0930 @@ -0,0 +1,132 @@ +//module doodle.dog.presentation.model; + +version(none) { + +import doodle.presentation.types; +import util.list; + +class Property { + this(char[] key, char[] value) { + _key = key; + _value = value; + } + + char[] key() { return _key; } + char[] value() { return _value; } + + private { + char[] _key; + char[] _value; + } +} + +interface IVisitor { + void visit(GraphEdge); + void visit(GraphNode); +} + +class Diagram { +} + +abstract class DiagramElement { + this() { + _is_visible = true; + } + + abstract void accept(in IVisitor visitor); + + bool is_visible() { return _is_visible; } + + void add_property(Property property) { + // TODO + _properties.addTail(property); + } + + private { + List!(Property) _properties; + bool _is_visible; + GraphElement _container; + } +} + +abstract class SemanticModelBridge { + this(char[] presentation) { + _presentation = presentation; + } + + char[] presentation() { return _presentation; } + + private { + char[] _presentation; + } +} + +class SimpleSemanticModelElement : SemanticModelBridge { + this(char[] type_info, char[] presentation) { + super(presentation); + _type_info = type_info; + } + + char[] type_info() { return _type_info; } + + private { + char[] _type_info; + } +} + +abstract class GraphElement : DiagramElement { + this() { + } + + void add_anchorage(GraphConnector anchorage) { + // TODO + } + + void remove_anchorage(GraphConnector anchorage) { + } + + private { + SemanticModelBridge _semantic_model; + Point _position; + List!(GraphConnector) _anchorages; + List!(DiagramElement) _containeds; + } +} + +class GraphConnector { + this(Point point) { + _point = point; + } + + private { + Point _point; + GraphElement _element; + GraphEdge[] _edges; + } +} + +class GraphEdge : GraphElement { + this() { + } + + void accept(IVisitor visitor) { + visitor.visit(this); + } + + private { + } +} + +class GraphNode : GraphElement { + this() { + } + + void accept(IVisitor visitor) { + visitor.visit(this); + } + + private { + } +} + +}