Copy/paste and EntityBundles

It should be emphasized that the Copy() method of the EntityBundle does not return a well-defined copy of the original bundle in the following sense; the collection of connections in the bundle is not connected to the shapes, it happens it the Unwrap method of the BinarySerializer class. So, regenerating the UID in the Copy method is not possible since this will break the binding between shapes and connections via the UID.

In principle the UnwrapBundle should always be follwed by the regenration of UID as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 //unwrap the bundle, this assigns the site and does some postserialization
GraphLib.IO.Binary.BinarySerializer.UnwrapBundle(bundle, this);
//change the UID
if(bundle!=null)
{
	for(int k=0; k
	{
		bundle.Shapes[k].GenerateNewUID();
		//the connectors as well
		foreach(Connector c in bundle.Shapes[k].Connectors)
		{
			c.GenerateNewUID();
		}
	}
	for(int k=0; k
}		bundle.Connections[k].GenerateNewUID();

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

top