void EventSink_NodeClick(NodeMouseEventArgs evtArgs) { diagram1.BeginUpdate(); if (newSelection) { this.textBox2.Text = ""; this.textBox1.Text = ""; } if (evtArgs.Node is Group && seats.Contains(evtArgs.Node)) { bool alreadySelected = false; Group seatNode = evtArgs.Node as Group; foreach (string val in selectedSeats) { if (val == seatNode.Name) { alreadySelected = true; } } if (seatsReserved.ContainsKey(seatNode.Name)) { #if !NETCORE MessageBoxAdv.Show("This seat is already reserved", "Reservation Status", MessageBoxButtons.OK, MessageBoxIcon.Warning); #else MessageBox.Show("This seat is already reserved", "Reservation Status", MessageBoxButtons.OK, MessageBoxIcon.Warning); #endif if (alreadySelected) { selectedSeats.Remove(seatNode.Name); } } else { if (!selectedSeats.Contains(seatNode.Name)) { foreach (Node node in seatNode.Nodes) { if (node is FilledPath) { ((FilledPath)node).FillStyle.Color = Color.FromArgb(0, 155, 0); ((FilledPath)node).FillStyle.ForeColor = Color.FromArgb(80, 255, 89); node.LineStyle.LineColor = Color.Black; } } selectedSeats.Add(seatNode.Name); if (textBox1.Text == "") { textBox1.Text = ""; } textBox1.Text += seatNode.Name + ", "; newSelection = false; } } } diagram1.EndUpdate(); }
/// <summary> /// Generate nodes at the ends of the paths in this collection. /// It is not necessary for the geometry to be part of a Model for this /// function, nor will any newly created nodes be added automatically /// to the current model - this should be done subsequently if necessary. /// </summary> /// <typeparam name="TPath"></typeparam> /// <param name="paths"></param> /// <param name="refreshNodes">Refresh nodes by removing any existing ones before beginning</param> /// <returns></returns> public static NodeCollection GenerateNetworkPathNodes <TPath>(this IList <TPath> paths, NodeGenerationParameters gParams, bool refreshNodes = false) where TPath : IWidePath { var nodes = new NodeCollection(); foreach (TPath path in paths) { if (refreshNodes) { if (path.Spine?.Start != null) { path.Spine.Start.Node = null; } if (path.Spine?.End != null) { path.Spine.End.Node = null; } } else { Node sNode = path.Spine?.Start?.Node; if (sNode != null && !nodes.Contains(sNode.GUID)) { nodes.Add(sNode); } Node eNode = path.Spine?.End?.Node; if (eNode != null && !nodes.Contains(eNode.GUID)) { nodes.Add(eNode); } } } var tree = new NodeDDTree(nodes); foreach (TPath path in paths) { path.Spine?.Start.GenerateNode(gParams, nodes, tree); path.Spine?.End.GenerateNode(gParams, nodes, tree); } return(nodes); }
/// <summary> /// Deselect the specified node. /// </summary> /// <param name="node">The node in the tree to deselect.</param> public void DeselectNode(TreeNode node) { if (multiSelect) { if (selectedNodes.Contains(node)) { selectedNodes.Remove(node); Coloring coloring = colorings.GetColoring(node); if (coloring == null && node.IsSelected) { node.BackColor = SystemColors.Window; node.ForeColor = SystemColors.WindowText; } else if (coloring != null) { node.BackColor = coloring.BackColor; node.ForeColor = coloring.ForeColor; } this.Invalidate(node.Bounds); } } else { if (this.SelectedNode == node) { this.SelectedNode = null; Coloring coloring = colorings.GetColoring(node); if (coloring != null) { node.BackColor = coloring.BackColor; node.ForeColor = coloring.ForeColor; } } } if (AfterDeselect != null) { AfterDeselect(this, new TreeViewEventArgs(node)); } }
/// <summary> /// Extract from this collection of paths all of the unique nodes at the ends of the /// path spine geometry. /// </summary> /// <typeparam name="TPath"></typeparam> /// <param name="paths"></param> /// <returns></returns> public static NodeCollection ExtractNetworkPathNodes <TPath>(this IList <TPath> paths) where TPath : IWidePath { var result = new NodeCollection(); foreach (TPath path in paths) { var nodeS = path.Spine?.Start?.Node; if (nodeS != null && !result.Contains(nodeS.GUID)) { result.Add(nodeS); } var nodeE = path.Spine?.End?.Node; if (nodeE != null && !result.Contains(nodeE.GUID)) { result.Add(nodeE); } } return(result); }
/// <summary> /// Generate a node at this vertex, if it does not already posess one. /// This override can be used to generate nodes independent of a full model/element system. /// </summary> /// <param name="options"></param> public void GenerateNode(NodeGenerationParameters options, NodeCollection nodes, NodeDDTree nodeTree) { if (Node == null) { Node = nodeTree.NearestTo(Position, options.ConnectionTolerance); if (Node == null) { Node = new Node(Position); } } if (!nodes.Contains(Node.GUID)) { nodes.Add(Node); nodeTree.Add(Node); } }
public override bool Execute(ExecutionInfo exInfo = null) { if (Node?.Vertices != null && Node.Vertices.Count > 1) { Nodes = new NodeCollection(); //Nodes.Add(Node); VertexCollection vertices = new VertexCollection(Node.Vertices); for (int i = 0; i < vertices.Count; i++) { Vertex v = vertices[i]; if (v.Node != null && v.Owner != null) { if (Nodes.Contains(v.Node)) { Node newNode = Model.Create.CopyOf(Node);//, exInfo); v.Node = newNode; } Nodes.Add(v.Node); } } } return(true); }
public bool Contains(TBlock block, TOpEnum op) { return(m_blocks.Contains(op, block, false)); }
public bool Contains(TItem item, TOpEnum op) { return(m_items.Contains(op, item, false)); }
/// <summary> /// Update the properties of a Nucleus node from a GWA string /// in EL.2 version syntax /// </summary> /// <param name="element"></param> /// <param name="gwa"></param> public void ReadElement(string gwa, Model.Model model, GSAConversionContext context) { // EL.2 | num | name | colour | type | prop | group | topo() | orient_node | orient_angle | // is_rls { | rls { | k } } // is_offset { | ox | oy | oz } | dummy Element element; var tr = new TokenReader(gwa); tr.Next(); // EL string gsaID = tr.Next(); // num string name = tr.Next(); // name tr.Next(); // colour int nodeCount = NodeCountOf(tr.Next()); // type string propID = tr.Next(); // prop tr.NextInt(); // group if (nodeCount == 0) { return; //Not valid! } else if (nodeCount == 2) { // Linear element var linEl = context.IDMap.GetModelObject <LinearElement>(model, gsaID.ToString()); if (linEl == null) { linEl = model.Create.LinearElement(null); } element = linEl; var family = context.IDMap.GetModelObject <SectionFamily>(model, propID); if (family == null) { family = model.Create.SectionFamily(); context.IDMap.Add(family, propID); } linEl.Family = family; Node n0 = context.IDMap.GetModelObject <Node>(model, tr.Next()); // Start node Node n1 = context.IDMap.GetModelObject <Node>(model, tr.Next()); // End node linEl.Geometry = new Line(n0, n1); } else { //Panel element var panEl = context.IDMap.GetModelObject <PanelElement>(model, gsaID.ToString()); if (panEl == null) { panEl = model.Create.PanelElement(null); } element = panEl; var family = context.IDMap.GetModelObject <BuildUpFamily>(model, propID); if (family == null) { family = model.Create.BuildUpFamily(); context.IDMap.Add(family, propID); } panEl.Family = family; var nodes = new NodeCollection(); for (int i = 0; i < nodeCount; i++) { var node = context.IDMap.GetModelObject <Node>(model, tr.Next()); if (node != null && !nodes.Contains(node.GUID)) { nodes.Add(node); } } panEl.Geometry = new Mesh(nodes, true); } tr.Next(); // orient_node TODO: Make orientation relative to this element.Orientation = Angle.FromDegrees(tr.NextDouble()); var verts = element.ElementVertices; string is_rls = tr.Next(); // is_rls if (is_rls.EqualsIgnoreCase("RLS") || is_rls.EqualsIgnoreCase("STIFF")) { for (int i = 0; i < nodeCount; i++) { string rls = tr.Next(); // rls if (i < verts.Count) { Bool6D fixity = Bool6D.FromTokensList(rls.ToCharArray(), 0, 'R'); ElementVertex v = verts[i]; v.Releases = fixity; if (is_rls.EqualsIgnoreCase("STIFF")) { for (int j = 0; j < rls.Length; j++) { char c = rls[j]; if (c.EqualsIgnoreCase('K')) { v.Stiffness = v.Stiffness.With(j, tr.NextDouble()); // k } } } } } } if (tr.NextIs("OFFSET")) // is_offset { for (int i = 0; i < nodeCount; i++) { if (verts.Count > i) { var vert = verts[i]; vert.Offset = vert.Offset.WithX(tr.NextDouble()); // ox vert.Offset = vert.Offset.WithY(tr.NextDouble()); // oy vert.Offset = vert.Offset.WithZ(tr.NextDouble()); // oz } else { tr.Skip(3); } } //TODO: Local offsets } // TODO: Dummy? context.IDMap.Add(element, gsaID); }