[Clam-devel] Copy & Paste processings on canvas patch

Pau Arumí Albó parumi at iua.upf.edu
Fri Jun 13 06:32:28 PDT 2008


El dv 13 de 06 de 2008 a les 15:13 +0200, en/na David García Garzón va
escriure:

> > >  Also that
> > > way of doing will ask for every processing even if you don't have
> > > geometry for it (transition period, see previous comment) so you don't
> > > have a way to know whether (0,0,0,0) was a real geometry or just it hadnt
> > > geometry at all.
> >
> > Easy, let (*,*,0,0) be a non-existing geometry (we don't want invisible
> > boxes).
> 
> Yes, Pau but you should compare the size with zero in order to use the one in 
> the pos file. For me is even clearer to iterate along a map and set just the 
> ones that are present. At that point it is just a matter of taste.
> 
> if (posfile exist)
> 	load pos file
> dict = network.GetAndClearGeometries()
> for key, geometry in dict
> 	boxes[key].setGeometry(geometry)
> 
> c++ code would be not that clear but i like this procedure.


I also like this scheme, but the point is "do we want to couple the
Canvas with two new Network types?"
Specially when we are in the process of abstracting the Canvas so it can
be used with an abstract Model interface (that is, in non NetworkEditor
contexts)

What about that? Do you buy it?

for key in Canvas:
        int x,y, w,h
        bool exists

        network.getGeometry(x,y,w,h,exists)
        if not exists: continue
        boxes[key].setGeometry(x,y,w,h)
        
P





More information about the clam-devel mailing list