Hello all,
I'm creating some kind of object oriented drawing program, my classes
consist of points, lines, quads, etc...
Right now I'm implementing undo/redo and copy/paste functionality.
For that I need to create deep copies of my objects, but set some
property fields to null in some cases.
For example I have an attachment feature which attaches one point of a
line to a point of another shape.
For that I store a reference to an attachment point for each Line point
in the line class and a children array list in each shape.
My question now is, how to copy a list of shapes and not copy the
attachment parents which are not on this list?
And how to copy the cross link between children array and reference to
attach point?
I draw some simple sketch to visualize this:
http://fragman.seriouszone.com/bilder/copying.PNG
I don't really know how to make sure nothing gets copied more than once
and that all links get updated.