|
For the sake of simplicity, there are a couple of classes one can use
to create a simple application. TestVisual uses the 3 dimensional graph
elements in uml3d.visual to show 2 boxes which are connected by an arrow.
UmlCanvas is a wrapper class around all the Java3D stuff such as
navigation, light and pick support. It creates a universe the
user can walk in by using the arrow keys. Two lights (one directional
and one ambient) are placed in the universe. Dragging of shapes is
implemented by a PickTranslateBehavior object.
One can regard a UmlWorld as a dynamic three dimensional graph. A
SimpleBox is a node and a SimpleConnection is an edge. Either can be
added to the world by invoking addChild(Node) on
UmlWorld (unless the world has been made alive). But to support correct
dragging, one should only add Boxes this way or by invoking
add(SimpleBox sb). Connections can by created and added by invoking
connect(box1,box2,con1). This way, two SimpleBoxes are connected and
whenever either of them changes its translation, an instance of
SimpleObjectBehavior is woken up and changes translation, orientation
and length of the SimpleConnection Connections may be of any
form: arrows represent message invokations or inheritance
relationships, arrows without heads may represent associations. They
are distinguished by the h and r variables in the class Arrow. Thus, a
SimpleConnection looks like an association without a name, roles and
multiplicities.
|