Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Vertices.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
3using System.Xml;
5
7{
11 public abstract class Vertices : Figure
12 {
16 protected Vertex[] points;
17
23 public Vertices(Layout2DDocument Document, ILayoutElement Parent)
24 : base(Document, Parent)
25 {
26 }
27
32 public override async Task FromXml(XmlElement Input)
33 {
34 await base.FromXml(Input);
35 this.points = this.GetVertices();
36 }
37
38 private Vertex[] GetVertices()
39 {
40 List<Vertex> Result = null;
41
42 if (this.HasChildren)
43 {
44 foreach (ILayoutElement Child in this.Children)
45 {
46 if (Child is Vertex P)
47 {
48 if (Result is null)
49 Result = new List<Vertex>();
50
51 Result.Add(P);
52 }
53 }
54 }
55
56 return Result?.ToArray();
57 }
58
63 public override void CopyContents(ILayoutElement Destination)
64 {
65 base.CopyContents(Destination);
66
67 if (Destination is Vertices Dest)
68 Dest.points = Dest.GetVertices();
69 }
70
71 }
72}
Contains a 2D layout document.
Abstract base class for figures
Definition: Figure.cs:14
override async Task FromXml(XmlElement Input)
Populates the element (including children) with information from its XML definition.
Definition: Vertices.cs:32
Vertices(Layout2DDocument Document, ILayoutElement Parent)
A sequence of points
Definition: Vertices.cs:23
override void CopyContents(ILayoutElement Destination)
Copies contents (attributes and children) to the destination element.
Definition: Vertices.cs:63
Defines a vertex in the graf
Definition: Vertex.cs:7
Base interface for all layout elements.