Re: Differentiating between Connectors and Objects




Am 09.07.2008 19:50, Fred Morcos schrieb:
Is it possible to get the type of an object without using a returned
string (object_get_type)? I want to loop over all the selected objects
and count the number of "connection objects" and the number of "other
normal objects" without having to go through this:

IMO your definition is not really working because:
 - even connectors are "normal" objects
 - there are "connectors" which are also connectable by connectors,
   e.g. "Standard - Line"
 - there are objects which I think you would classify as "normal object"
   which still can connect: "are connectors" (and are not connectable),
   e.g. "Standard - Text"

(pseudo code)
if (objtype == "Standard - Line" || "UML - Generalization" || "UML -
Dependency" || etc...)

If I had to solve this abstract task I would try *very* hard to not do it type specific but property specific. See "Help/Dia Object Types" (otypes.py
in the Dia distribution) for some heuristic.

But for your task "Auto-Layouting" I think you are not really interested in the type difference at all but in the objects use. IMHO there is no point in auto-layouting a "connector" if it is not connecting anything.

So basically you want to modify all connected "connectors" given by Object.connections[].connected_to

Of course all this is possible in C as well, just more to type.

Regards,
        Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



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