Re: Restricting possible connections



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?

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

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

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.

Can somebody help with point 3?

Cheers!



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