|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdevisor2.grid.backend.GridCloner
This class performs the actual cloning which is basically used for
the copy&paste operation. Here is how it works to make sure that not only
shallow copies are created, but that after cloning, the object references
are correct.
A Vector of selected items is passed as input for this class.
Firstly, the given nodes are cloned, which means all the nodes contained
in the vector and the nodes implicitely contained (as part of Tri and
Quad elements or as BoundaryNodes). The original ones and the cloned
copies are both stored in an array at the same index so that later on, it
is still possible to figure out what node is a clone of what node.
After that, the elements are cloned shallowly, and for every node
contained in the original, its clone is assigned to the element clone.
After that, parent-child-relationships are updated in the cloned elements.
Last but not least, the affine transform to the new position is
applied, and everything is added to the Domain.
This class provides methods to perform that, but is not intelligent:
The whole copy&paste operation is controlled by the GridListener and
MainActionListener classes. See there for more details about how
this class is to be used.
Field Summary | |
protected ControlCenter |
cc
|
protected Boundary[] |
clonedBounds
|
protected Cell2D[] |
clonedCells
|
protected Edge[] |
clonedEdges
|
protected Node[] |
clonedNodes
|
protected Segment[] |
clonedSegments
|
protected Boundary[] |
origBounds
|
protected Cell2D[] |
origCells
|
protected Edge[] |
origEdges
|
protected java.util.Vector |
originals
|
protected Node[] |
origNodes
|
protected Segment[] |
origSegments
|
Constructor Summary | |
GridCloner(java.util.Vector itemsToBeCloned)
the constructor just sets the references correctly |
Method Summary | |
void |
createClone()
creates a deep clone of the given items and stores it in the corresponding inner variable |
Segment |
getClone(Segment s)
get cloned Segment of the given Segment |
Boundary[] |
getClonedBoundaries()
|
java.util.Vector |
getClones()
returns all cloned items in one vector |
Boundary[] |
getOrigBoundaries()
|
Segment |
getOrigSegment(int index,
int bno)
|
void |
print(java.lang.Object[] array)
debug purposes: prints out the contents of the given array |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ControlCenter cc
protected java.util.Vector originals
protected Node[] origNodes
protected Node[] clonedNodes
protected Edge[] origEdges
protected Edge[] clonedEdges
protected Cell2D[] origCells
protected Cell2D[] clonedCells
protected Segment[] origSegments
protected Segment[] clonedSegments
protected Boundary[] origBounds
protected Boundary[] clonedBounds
Constructor Detail |
public GridCloner(java.util.Vector itemsToBeCloned)
Method Detail |
public java.util.Vector getClones()
public Boundary[] getOrigBoundaries()
public Boundary[] getClonedBoundaries()
public Segment getClone(Segment s)
public Segment getOrigSegment(int index, int bno)
public void createClone()
public void print(java.lang.Object[] array)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |