Re: Restricting possible connections

On Thu, 24 Oct 2002, ml knorke in-berlin de wrote:
On Thu, Oct 24, 2002 at 09:23:48AM -0500, Lars Clausen wrote:
The right place to add a checking call would be in
layer_find_closest_connectionpoint() in app/diagramdata.c.  Problem is,
that loop goes over all objects in a layer, so we can't afford to spend
a lot of time there.  Well, we can keep it within the if, that'll cut
out most of it.  And instead of adding code to DrawFunc, a new object
func should be defined for it.

OK, I try to resume:

1. A restriction on possible connections seems to be a good
   idea.  Think of network diagrams, not to speak of
   UML/Database/SDL/... code generation.

2. Of course, this must be an option to the user.  Maybe a
   diagram specific or a global option?

Hmmm... good question.  Global options are easier to make and do away
with.  I really don't know which is better.

3. The method to check has to be a new object function.
   Something like:

   typedef gboolean (*AllowConnectFunc) (Object* obj_me,
                                         Object* obj_other,
                                         ... /* ? */ );

You may want to give the handle and connection point to the function.
Could be some objects will allow objects to connect in certain ways and not
in others.

4. This function will be called twice (once for the
   connecting object, once for the connected one) from
   layer_find_closest_connectionpoint().  I don't see
   performance hits, if functions will be called after
   the "if (dist<mindist)" and only if the option is set.

Sounds about right.


Lars Clausen (| 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?

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]