comparison 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
comparison
equal deleted inserted replaced
28:1754cb773d41 29:960b408d3ac5
1 //module doodle.dog.presentation.model;
2
3 version(none) {
4
5 import doodle.presentation.types;
6 import util.list;
7
8 class Property {
9 this(char[] key, char[] value) {
10 _key = key;
11 _value = value;
12 }
13
14 char[] key() { return _key; }
15 char[] value() { return _value; }
16
17 private {
18 char[] _key;
19 char[] _value;
20 }
21 }
22
23 interface IVisitor {
24 void visit(GraphEdge);
25 void visit(GraphNode);
26 }
27
28 class Diagram {
29 }
30
31 abstract class DiagramElement {
32 this() {
33 _is_visible = true;
34 }
35
36 abstract void accept(in IVisitor visitor);
37
38 bool is_visible() { return _is_visible; }
39
40 void add_property(Property property) {
41 // TODO
42 _properties.addTail(property);
43 }
44
45 private {
46 List!(Property) _properties;
47 bool _is_visible;
48 GraphElement _container;
49 }
50 }
51
52 abstract class SemanticModelBridge {
53 this(char[] presentation) {
54 _presentation = presentation;
55 }
56
57 char[] presentation() { return _presentation; }
58
59 private {
60 char[] _presentation;
61 }
62 }
63
64 class SimpleSemanticModelElement : SemanticModelBridge {
65 this(char[] type_info, char[] presentation) {
66 super(presentation);
67 _type_info = type_info;
68 }
69
70 char[] type_info() { return _type_info; }
71
72 private {
73 char[] _type_info;
74 }
75 }
76
77 abstract class GraphElement : DiagramElement {
78 this() {
79 }
80
81 void add_anchorage(GraphConnector anchorage) {
82 // TODO
83 }
84
85 void remove_anchorage(GraphConnector anchorage) {
86 }
87
88 private {
89 SemanticModelBridge _semantic_model;
90 Point _position;
91 List!(GraphConnector) _anchorages;
92 List!(DiagramElement) _containeds;
93 }
94 }
95
96 class GraphConnector {
97 this(Point point) {
98 _point = point;
99 }
100
101 private {
102 Point _point;
103 GraphElement _element;
104 GraphEdge[] _edges;
105 }
106 }
107
108 class GraphEdge : GraphElement {
109 this() {
110 }
111
112 void accept(IVisitor visitor) {
113 visitor.visit(this);
114 }
115
116 private {
117 }
118 }
119
120 class GraphNode : GraphElement {
121 this() {
122 }
123
124 void accept(IVisitor visitor) {
125 visitor.visit(this);
126 }
127
128 private {
129 }
130 }
131
132 }