On 28 Oct 2003, saintiss@gmx.net wrote:
> Hi,
>
> On Tuesday 28 October 2003 11:20, SainTiss wrote:
>> Hmm, I think I found out why associations aren't handled... As far as I
>> can see, there's no way of telling what classes are at the end-points of
>> the association, just by looking at dia's save format... There's only
>> graphical, positional information...
>>
>> Yet, in the diagram itself, it's possible to "attach" the association to
>> a class by making sure it matches with one of the 8 handles of that
>> class... So I guess it must be possible to find out which classes are
>> connected by an association...
>
>
> I got this idea that I might be able to find the classes by getting the
> connectionpoint of the associationend-handle, and then looking in the
> "connected" GList... However, it seems that, in that list, only the
> association object itself is present (there's only 1 element in the
> list)...
>
> Here's what I tried:
>
> orth = &(assoc->orth);
> handle = (orth->handles)[0];
> conpoint = handle->connected_to;
> connObjs = conpoint->connected;
> obj = (Object*) g_list_nth_data(connObjs, 0);
>
> Printing out the address of obj and the address of assoc, showed that
> both objects are the same... Playing around with the indices, I learned
> that there are 3 handles in the association (seems logical), and 1 object
> in the connObjs list...
Take a look at select_transitively() in app/select.c, it does the same kind
of thing, both ways.
You're quite right that you're getting the same thing. The connection
point is what's visualized by a little blue x, the handle is the box. A
handle can only be connected to one thing, a connection point can have a
number of handles connected to it. So when you go from handle to object,
you need to look at handle->connected_to->object.
> Am I doing this the wrong way, or is this a bug?
>
> Also, I noticed that, when loading a *.dia file where an association was
> connected to UMLClasses, after loading the connection is lost (i.e. when
> connected, the end points of the association are red, yet after loading,
That sounds really strange, I'm sure people would have noticed by now --
and indeed, it doesn't do that for me. Can you send me a diagram that
behaves this way?
-Lars
--
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| HĂ„rdgrim of Numenor
"I do not agree with a word that you say, but I |----------------------------
will defend to the death your right to say it." | Where are we going, and
--Evelyn Beatrice Hall paraphrasing Voltaire | what's with the handbasket?