Layer tree model
Schleimer, Ben
bensch128 at yahoo.com
Fri Mar 23 14:42:33 CET 2007
Hey Boud,
> * layers need to be able to access their parents
Absolutely.
> * layers need to be able to access their siblings
Layers don't necessarily need to track their siblings. It might be better for a layer to be able
ask its parent to accept a compositing visitor to all of the children following the requesting
layer. The Parent would need to decide which of the children follow the layer and apply the
visitor but it would eliminate the need for maintaining sibling pointers.
> * groups need to know their children
Here's a thought: Let all KisLayers have children and use constraint rules in the datamodel to
determine when it's valid to add a layer as a child to another layer. Then KisMaskLayer and
KisSelectionLayer can be a subclass of KisPaintLayer. Add a constraint rule that says only
KisPaintLayers can have KisMaskLayers or KisSelectionLayers as children and that a KisPaintLayer
can only have one KisSelectionLayer.
UML is designed by using similar contraint rules and I've found that they are a lot easier and
more flexible to use for arbitrary tree structures.
>
> * Keep the hierarchy administration inside KisGroupLayer and KisLayer. Access
> only through KisImage. Keep the external KisLayerModel updated from KisLayer.
I agree with Cyrilleb here and say that the data should be separated from the model interface.
http://doc.trolltech.com/4.3/itemviews-simpletreemodel.html seems like it's pretty similar
situation (simplier of course) to the layer system.
More information about the kimageshop
mailing list