[Drawkit] DKShapeGroups and DXF blocks

Graham Cox graham.cox at bigpond.com
Tue Apr 14 18:59:53 PDT 2009


On 15/04/2009, at 1:06 AM, Graham Cox wrote:

> Yes, groups can be nested. Just treat a group as a shape.



A couple of other things to know about groups, just FYI.

When constructing groups from objects programatically, some operations  
are recorded for undo, to permit the "Group" command to be entirely  
undaoble. This includes undoing the change of container that normally  
occurs. When building a group from objects in the way suggested for  
your DXF import, there will be no initial container - the group is the  
first one. This shouldn't matter, since there won't be an undo manager  
known to the group either, but if for some reason you do end up with a  
funky undo task recorded, you could deal with that by temporarily  
suspending registration of undo tasks then restoring them afterwards.  
Since you are going to be creating the groups during a file import I  
don't think this is an issue, but bear it in mind. Basically as long  
as you add the fully constructed group to the layer last, this issue  
shouldn't rear its head.

The current API has methods to do with enabling caching of the drawn  
content. This currently doesn't work properly, so don't be tempted to  
turn on caching.

Between b5 and b6 (not yet released), I've moved many of the informal  
protocols dealing with drawable objects and the objects that contain  
them, such as layers and groups, to a formal protocol so that the  
requirements for a correct container are much less hit-and-miss. This  
shouldn't affect any code you write now unless you are creating  
entirely new kinds of container objects, but I'll mention it just in  
case.

b6 includes a way to set a path on a group that clips its contents. b5  
groups have the path, which defaults to a simple rect, but do nothing  
with it at all. In b6 there will be no change in behaviour unless you  
explicitly enable path clipping. Again, this shouldn't affect you at  
all, but just to flag it up FYI.

--Graham






More information about the Drawkit mailing list