public static void doDisassemblyDirections(string dir) { state = new ProgramState(); if (dir == "") { dir = "."; } if (serverMode) { ProgramState.Load(dir + slash + "intermediate" + slash + "ProgramState.xml", ref state); } else { ProgramState.Load(dir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml", ref state); } LoadState(); AssemblyGraph.RepairGraphConnections(); //RefreshGraphArcs (); //$ Adding this so that bounding box related functionalities still work BoundingGeometry.OrientedBoundingBoxDic = new Dictionary <TessellatedSolid, BoundingBox>(); BoundingGeometry.BoundingCylinderDic = new Dictionary <TessellatedSolid, BoundingCylinder>(); BoundingGeometry.CreateOBB2(Solids); BoundingGeometry.CreateBoundingCylinder(Solids); DeserializeSolidProperties(); globalDirPool = DisassemblyDirectionsWithFastener.RunGraphGeneration(AssemblyGraph, SolidsNoFastener); //the second user interaction must happen here SaveDirections(); SaveState(); if (serverMode) { state.Save(state.inputDir + slash + "intermediate" + slash + "ProgramState.xml"); } else { state.Save(state.inputDir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml"); } Console.WriteLine("\nDone"); }
public new virtual void Paste() { var ClipboardString = Clipboard.GetText(); var copiedSelection = SelectionClass.DeSerializeClipboardFormatFromXML(ClipboardString); RestoreDisplayShapes(copiedSelection.ReadInXmlShapes, copiedSelection.selectedNodes, copiedSelection.selectedArcs, copiedSelection.selectedHyperArcs); var newSelection = new List <UIElement>(); var copiedData = new designGraph(copiedSelection.selectedNodes, copiedSelection.selectedArcs, copiedSelection.selectedHyperArcs); copiedData.RepairGraphConnections(); foreach (var n in copiedData.nodes) { n.name = graph.makeUniqueNodeName(n.name); n.X = n.X + MouseLocation.X - copiedSelection.ReferencePoint.X - Origin.X; n.Y = n.Y + MouseLocation.Y - copiedSelection.ReferencePoint.Y - Origin.Y; addNodeShape(n); graph.addNode(n); newSelection.Add((Shape)n.DisplayShape.Shape); } foreach (var a in copiedData.arcs) { a.name = graph.makeUniqueArcName(a.name); graph.arcs.Add(a); AddArcShape(a); SetUpNewArcShape(a); newSelection.Add((ArcShape)a.DisplayShape.Shape); } foreach (var h in copiedData.hyperarcs) { h.name = graph.makeUniqueHyperArcName(h.name); graph.addHyperArc(h); //note that the list of nodes is not sent because it is //already connected to those from copiedData AddHyperArcShape(h); newSelection.Add((HyperArcShape)h.DisplayShape.Shape); } Select(newSelection); storeOnUndoStack(); }
public override void Paste() { var ClipboardString = Clipboard.GetText(); var copiedSelection = SelectionClass.DeSerializeClipboardFormatFromXML(ClipboardString); RestoreDisplayShapes(copiedSelection.ReadInXmlShapes, copiedSelection.selectedNodes, copiedSelection.selectedArcs, copiedSelection.selectedHyperArcs); var newSelection = new List <UIElement>(); if (copiedSelection != null) { var tempGraph = new designGraph(); foreach (node n in copiedSelection.selectedNodes) { if (n is ruleNode) { tempGraph.addNode(n); } else { tempGraph.addNode(new ruleNode(n)); } } foreach (arc a in copiedSelection.selectedArcs) { if (a is ruleArc) { tempGraph.arcs.Add(a); } else { tempGraph.arcs.Add(new ruleArc(a)); } } foreach (hyperarc a in copiedSelection.selectedHyperArcs) { if (a is ruleHyperarc) { tempGraph.addHyperArc(a); } else { tempGraph.addHyperArc(new ruleHyperarc(a)); } } tempGraph.RepairGraphConnections(); foreach (node n in tempGraph.nodes) { var mousePos = Mouse.GetPosition(this); n.X = mousePos.X + n.X - copiedSelection.ReferencePoint.X - Origin.X; n.Y = mousePos.Y + n.Y - copiedSelection.ReferencePoint.Y - Origin.Y; n.name = rW.rule.makeUniqueNodeName(n.name); addNodeShape(n); graph.addNode(n); newSelection.Add((Shape)n.DisplayShape.Shape); if (rW.graphGUIK == this) { AddKNodeToLandR(n); } } foreach (arc a in tempGraph.arcs) { a.name = rW.rule.makeUniqueArcName(a.name); graph.arcs.Add(a); AddArcShape(a); SetUpNewArcShape(a); newSelection.Add((ArcShape)a.DisplayShape.Shape); if (rW.graphGUIK == this) { AddKArcToLandR(a); } } foreach (hyperarc h in tempGraph.hyperarcs) { h.name = rW.rule.makeUniqueHyperarcName(h.name); graph.addHyperArc(h); AddHyperArcShape(h); newSelection.Add((HyperArcShape)h.DisplayShape.Shape); if (rW.graphGUIK == this) { AddKHyperToLandR(h); } } Select(newSelection); } }