|
@@ -3,9 +3,6 @@ include "modelling.alh"
|
|
|
include "object_operations.alh"
|
|
|
|
|
|
Boolean function main(model : Element):
|
|
|
- log("Got model to render!")
|
|
|
- log("Classes:")
|
|
|
-
|
|
|
Element elements
|
|
|
String class
|
|
|
Element attrs
|
|
@@ -17,9 +14,12 @@ Boolean function main(model : Element):
|
|
|
Integer text_loc
|
|
|
loc = 10
|
|
|
|
|
|
- log("Classes:")
|
|
|
- elements = allInstances(model, "abstract/Class")
|
|
|
+ Element locations_x
|
|
|
+ Element locations_y
|
|
|
+ locations_x = dict_create()
|
|
|
+ locations_y = dict_create()
|
|
|
|
|
|
+ elements = allInstances(model, "abstract/Class")
|
|
|
while (set_len(elements) > 0):
|
|
|
class = set_pop(elements)
|
|
|
attr_keys = dict_keys(getAttributeList(model, class))
|
|
@@ -28,6 +28,8 @@ Boolean function main(model : Element):
|
|
|
group = instantiate_node(model, "rendered/Group", "")
|
|
|
instantiate_attribute(model, group, "x", loc)
|
|
|
instantiate_attribute(model, group, "y", 10)
|
|
|
+ dict_add(locations_x, class, loc)
|
|
|
+ dict_add(locations_y, class, 10)
|
|
|
loc = loc + 200
|
|
|
|
|
|
elem = instantiate_node(model, "rendered/Rectangle", "")
|
|
@@ -68,6 +70,7 @@ Boolean function main(model : Element):
|
|
|
instantiate_attribute(model, elem, "targetY", 20)
|
|
|
instantiate_attribute(model, elem, "lineWidth", 1)
|
|
|
instantiate_attribute(model, elem, "lineColour", "black")
|
|
|
+ instantiate_attribute(model, elem, "arrow", False)
|
|
|
instantiate_link(model, "rendered/contains", "", group, elem)
|
|
|
|
|
|
attrs = getInstantiatableAttributes(model, class, "abstract/AttributeLink")
|
|
@@ -75,7 +78,6 @@ Boolean function main(model : Element):
|
|
|
while (dict_len(attr_keys) > 0):
|
|
|
attr_key = set_pop(attr_keys)
|
|
|
elem = instantiate_node(model, "rendered/Text", "")
|
|
|
- log(((" " + attr_key) + " : ") + cast_v2s(list_read(string_split(attrs[attr_key], "/"), 1)))
|
|
|
instantiate_attribute(model, elem, "x", 5)
|
|
|
instantiate_attribute(model, elem, "y", text_loc + 20)
|
|
|
instantiate_attribute(model, elem, "lineWidth", 1)
|
|
@@ -84,24 +86,37 @@ Boolean function main(model : Element):
|
|
|
instantiate_link(model, "rendered/contains", "", group, elem)
|
|
|
text_loc = text_loc + 15
|
|
|
|
|
|
- log("")
|
|
|
-
|
|
|
- log("Associations:")
|
|
|
elements = allInstances(model, "abstract/Association")
|
|
|
while (set_len(elements) > 0):
|
|
|
class = set_pop(elements)
|
|
|
attr_keys = dict_keys(getAttributeList(model, class))
|
|
|
|
|
|
+ group = instantiate_node(model, "rendered/Group", "")
|
|
|
+ instantiate_attribute(model, group, "x", 0)
|
|
|
+ instantiate_attribute(model, group, "y", 0)
|
|
|
+
|
|
|
+ elem = instantiate_node(model, "rendered/Line", "")
|
|
|
+ instantiate_attribute(model, elem, "x", locations_x[readAssociationSource(model, class)])
|
|
|
+ instantiate_attribute(model, elem, "y", locations_y[readAssociationSource(model, class)])
|
|
|
+ instantiate_attribute(model, elem, "targetX", locations_x[readAssociationSource(model, class)])
|
|
|
+ instantiate_attribute(model, elem, "targetY", locations_y[readAssociationDestination(model, class)])
|
|
|
+ instantiate_attribute(model, elem, "lineWidth", 1)
|
|
|
+ instantiate_attribute(model, elem, "lineColour", "black")
|
|
|
+ instantiate_attribute(model, elem, "arrow", False)
|
|
|
+ instantiate_link(model, "rendered/contains", "", group, elem)
|
|
|
+
|
|
|
+ elem = instantiate_node(model, "rendered/Line", "")
|
|
|
+ instantiate_attribute(model, elem, "x", locations_x[readAssociationSource(model, class)])
|
|
|
+ instantiate_attribute(model, elem, "y", locations_y[readAssociationDestination(model, class)])
|
|
|
+ instantiate_attribute(model, elem, "targetX", locations_x[readAssociationDestination(model, class)])
|
|
|
+ instantiate_attribute(model, elem, "targetY", locations_y[readAssociationDestination(model, class)])
|
|
|
+ instantiate_attribute(model, elem, "lineWidth", 1)
|
|
|
+ instantiate_attribute(model, elem, "lineColour", "black")
|
|
|
+ instantiate_attribute(model, elem, "arrow", True)
|
|
|
+ instantiate_link(model, "rendered/contains", "", group, elem)
|
|
|
+
|
|
|
while (set_len(attr_keys) > 0):
|
|
|
attr_key = set_pop(attr_keys)
|
|
|
log(((" " + attr_key) + " = ") + cast_v2s(read_attribute(model, class, attr_key)))
|
|
|
|
|
|
- attrs = getInstantiatableAttributes(model, class, "abstract/AttributeLink")
|
|
|
- attr_keys = dict_keys(attrs)
|
|
|
- while (dict_len(attr_keys) > 0):
|
|
|
- attr_key = set_pop(attr_keys)
|
|
|
- log(((" " + attr_key) + " : ") + cast_v2s(list_read(string_split(attrs[attr_key], "/"), 1)))
|
|
|
-
|
|
|
- log("")
|
|
|
-
|
|
|
return True!
|