// attribute (applies to "unseen" relations)
continue;
}
// Set the new location attribute.
Locatable locatable = (Locatable) locationList.get(0);
// Give default values in case the previous locations value
// has not yet been set
double[] newLocation = new double[] { 0, 0 };
if (locatable.getLocation() != null) {
newLocation = locatable.getLocation();
}
// NOTE: we use the transform worked out for the drag to
// set the original MoML location
double[] oldLocation = new double[2];
oldLocation[0] = newLocation[0] + transform[0];
oldLocation[1] = newLocation[1] + transform[1];
// Create the MoML, wrapping the new location attribute
// in an element refering to the container
String containingElementName = element.getElementName();
String elementToMove = "<" + containingElementName + " name=\""
+ element.getName() + "\" >\n";
moml.append(elementToMove);
undoMoml.append(elementToMove);
// NOTE: use the moml info element name here in case the
// location is a vertex
String momlInfo = ((NamedObj) locatable).getElementName();
moml.append("<" + momlInfo + " name=\"" + locatable.getName()
+ "\" value=\"[" + newLocation[0] + ", " + newLocation[1]
+ "]\" />\n");
undoMoml.append("<" + momlInfo + " name=\"" + locatable.getName()
+ "\" value=\"[" + oldLocation[0] + ", " + oldLocation[1]
+ "]\" />\n");
moml.append("</" + containingElementName + ">\n");
undoMoml.append("</" + containingElementName + ">\n");
}