public void AddVertex(GraphApp app, GraphAppGUI appGUI, Point p) { Vertex v = app.AddVertex(); GraphPanel gp = appGUI.CurrentGraphPanel; gp.AddVertex(v, p); }
public void DeleteSelection(GraphApp app) { List <GUIEdge> localEdges = new List <GUIEdge>(); foreach (ISelectable i in currentSelection) { GUIVertex gv = i as GUIVertex; if (gv != null) { RemoveVertex(gv, app); foreach (GUIEdge ge in gv.GetEdges()) { localEdges.Add(ge); } continue; } GUIEdge e = i as GUIEdge; if (e != null) { RemoveEdge(e, app); continue; } } foreach (GUIEdge connected in localEdges) { RemoveEdge(connected, app); } Refresh(); }
public GraphAppViewModel(RevitToGraphPublisher pubisher, GraphApp app) { _publishToGraphCommand = new Command(PublishToGraph); _cancelCommand = new Command(Close); _publisher = pubisher; _settings = app.SessionSettings; _app = app; }
public GraphAppGUI() { InitializeComponent(); Output.Initialize(textBox1); app = new GraphApp(); AppTool.SelectTool.AddFilter(new SelectionFilter(typeof(Vertex))); AppTool.SelectTool.AddFilter(new SelectionFilter(typeof(Edge))); AppTool.SelectTool.AddFilter(new SelectionFilter(typeof(FlowEdge))); }
private int graphCounter; //Counter which keeps track of how many graphs we have #endregion Fields #region Constructors public GraphAppGUI() { InitializeComponent(); Output.Initialize(textBox1); app = new GraphApp(); AppTool.SelectTool.AddFilter(new SelectionFilter(typeof(Vertex))); AppTool.SelectTool.AddFilter(new SelectionFilter(typeof(Edge))); AppTool.SelectTool.AddFilter(new SelectionFilter(typeof(FlowEdge))); }
public void EndSelect(GraphApp app, GraphAppGUI appGUI, Point p, bool shiftHeld) { Console.WriteLine("Selection end: " + p.ToString()); Started = false; endPoint = p; Rectangle selectionRect = getSelectionRectangle(startPoint, endPoint); GraphPanel gp = appGUI.CurrentGraphPanel; if (!shiftHeld) { gp.Deselect(); } List<ISelectable> selectables = gp.Selectables; int selectTotal = 0; foreach (ISelectable s in selectables) { if (s.Intersects(selectionRect)) { bool filterPass = false; foreach (SelectionFilter filter in filters) { if (filter.PassesFilter(s.GetItem())) { filterPass = true; } } if (!filterPass) { continue; } gp.Select(s); s.Select(); selectTotal++; Console.WriteLine("Selected " + s.ToString()); } } if (selectTotal == 0) { Console.WriteLine("Selected nothing"); gp.Deselect(); } gp.Refresh(); }
public void End(GraphApp app, GraphAppGUI appGUI, Point p) { if (!HasBegun) { return; } GraphPanel gp = appGUI.CurrentGraphPanel; List<GUIVertex> verts = gp.Vertices; bool foundVert = false; foreach (GUIVertex v in verts) { if (GeometryHelper.Intersects(p, new Circle(v.Pos, v.Radius))) { endVert = v; Console.WriteLine("Edge tool ended on vertex " + v.Vertex.Label); foundVert = true; //Add vertex if (isFlowNetwork) { FlowEdge fe = app.AddFlowEdge(startVert.Vertex, endVert.Vertex); gp.AddEdge(startVert, endVert, fe); } else { //Change to add two edges, for both directions Edge e = app.AddEdge(startVert.Vertex, endVert.Vertex); gp.AddEdge(startVert, endVert, e); } break; } } HasBegun = false; if (!foundVert) { startVert = null; endVert = null; return; } }
public void End(GraphApp app, GraphAppGUI appGUI, Point p) { if (!HasBegun) { return; } GraphPanel gp = appGUI.CurrentGraphPanel; List <GUIVertex> verts = gp.Vertices; bool foundVert = false; foreach (GUIVertex v in verts) { if (GeometryHelper.Intersects(p, new Circle(v.Pos, v.Radius))) { endVert = v; Console.WriteLine("Edge tool ended on vertex " + v.Vertex.Label); foundVert = true; //Add vertex if (isFlowNetwork) { FlowEdge fe = app.AddFlowEdge(startVert.Vertex, endVert.Vertex); gp.AddEdge(startVert, endVert, fe); } else { //Change to add two edges, for both directions Edge e = app.AddEdge(startVert.Vertex, endVert.Vertex); gp.AddEdge(startVert, endVert, e); } break; } } HasBegun = false; if (!foundVert) { startVert = null; endVert = null; return; } }
private void RemoveVertex(GUIVertex gv, GraphApp app) { app.RemoveVertex(gv.Vertex); verts.Remove(gv); selectables.Remove(gv); }
private void RemoveEdge(GUIEdge e, GraphApp app) { app.RemoveEdge(e.Edge); edges.Remove(e); selectables.Remove(e); }
public void DeleteSelection(GraphApp app) { List<GUIEdge> localEdges = new List<GUIEdge>(); foreach (ISelectable i in currentSelection) { GUIVertex gv = i as GUIVertex; if (gv != null) { RemoveVertex(gv, app); foreach (GUIEdge ge in gv.GetEdges()) { localEdges.Add(ge); } continue; } GUIEdge e = i as GUIEdge; if (e != null) { RemoveEdge(e, app); continue; } } foreach (GUIEdge connected in localEdges) { RemoveEdge(connected, app); } Refresh(); }