using Microsoft.Msagl.Core.Layout;
namespace Microsoft.Msagl.Prototype.LayoutEditing
{
///
/// Helper class for creating RestoreData objects from GeometryGraph objects.
///
public static class RestoreHelper
{
///
/// creates node restore datat
///
///
public static RestoreData GetRestoreData(Node node)
{
return new NodeRestoreData(node.BoundaryCurve.Clone());
}
///
/// gets restore data for an edge
///
///
public static RestoreData GetRestoreData(Edge edge)
{
return new EdgeRestoreData(edge);
}
///
/// creates graph restore data
///
///
public static RestoreData GetRestoreData(GeometryGraph graph)
{
return new GraphRestoreData();
}
///
/// creates label restore data
///
///
public static RestoreData GetRestoreData(Label label)
{
return new LabelRestoreData(label.Center);
}
///
/// calculates the restore data
///
///
public static RestoreData GetRestoreData(GeometryObject geometryObject)
{
Node node = geometryObject as Node;
if (node != null)
{
return GetRestoreData(node);
}
Edge edge = geometryObject as Edge;
if (edge != null)
{
return GetRestoreData(edge);
}
Label label = geometryObject as Label;
if (label != null)
{
return GetRestoreData(label);
}
GeometryGraph graph = geometryObject as GeometryGraph;
if (graph != null)
{
return GetRestoreData(graph);
}
return null;
}
}
}