Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Point3.cs
1using System.Threading.Tasks;
2using System.Xml;
4
6{
10 public abstract class Point3 : Point2
11 {
12 private LengthAttribute x3;
13 private LengthAttribute y3;
14 private StringAttribute ref3;
15
21 public Point3(Layout2DDocument Document, ILayoutElement Parent)
22 : base(Document, Parent)
23 {
24 }
25
30 {
31 get => this.x3;
32 set => this.x3 = value;
33 }
34
39 {
40 get => this.y3;
41 set => this.y3 = value;
42 }
43
48 {
49 get => this.ref3;
50 set => this.ref3 = value;
51 }
52
57 public override Task FromXml(XmlElement Input)
58 {
59 this.x3 = new LengthAttribute(Input, "x3", this.Document);
60 this.y3 = new LengthAttribute(Input, "y3", this.Document);
61 this.ref3 = new StringAttribute(Input, "ref3", this.Document);
62
63 return base.FromXml(Input);
64 }
65
70 public override void ExportAttributes(XmlWriter Output)
71 {
72 base.ExportAttributes(Output);
73
74 this.x3?.Export(Output);
75 this.y3?.Export(Output);
76 this.ref3?.Export(Output);
77 }
78
83 public override void CopyContents(ILayoutElement Destination)
84 {
85 base.CopyContents(Destination);
86
87 if (Destination is Point3 Dest)
88 {
89 Dest.x3 = this.x3?.CopyIfNotPreset(Destination.Document);
90 Dest.y3 = this.y3?.CopyIfNotPreset(Destination.Document);
91 Dest.ref3 = this.ref3?.CopyIfNotPreset(Destination.Document);
92 }
93 }
94
100 public override async Task DoMeasureDimensions(DrawingState State)
101 {
102 await base.DoMeasureDimensions(State);
103
104 CalculatedPoint P = await this.CalcPoint(State, this.x3, this.y3, this.@ref3, this.xCoordinate3, this.yCoordinate3);
105 if (P.Ok)
106 {
107 this.xCoordinate3 = P.X;
108 this.yCoordinate3 = P.Y;
109 }
110 else
111 this.defined = false;
112 }
113
117 protected float xCoordinate3;
118
122 protected float yCoordinate3;
123
128 public override void ExportStateAttributes(XmlWriter Output)
129 {
130 base.ExportStateAttributes(Output);
131
132 this.x3?.ExportState(Output);
133 this.y3?.ExportState(Output);
134 this.ref3?.ExportState(Output);
135 }
136
137 }
138}
Contains a 2D layout document.
void Export(XmlWriter Output)
Exports the attribute.
Definition: Attribute.cs:187
void ExportState(XmlWriter Output)
Exports the state of the attribute.
Definition: Attribute.cs:199
LengthAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
StringAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
Layout2DDocument Document
Layout document.
async Task< CalculatedPoint > CalcPoint(DrawingState State, LengthAttribute XAttribute, LengthAttribute YAttribute, StringAttribute RefAttribute, float X, float Y)
Includes a point in the area measurement.
Abstract base class for layout elements with two points.
Definition: Point2.cs:11
Abstract base class for layout elements with three points.
Definition: Point3.cs:11
float xCoordinate3
Measured X-coordinate
Definition: Point3.cs:117
override void ExportAttributes(XmlWriter Output)
Exports attributes to XML.
Definition: Point3.cs:70
override async Task DoMeasureDimensions(DrawingState State)
Measures layout entities and defines unassigned properties, related to dimensions.
Definition: Point3.cs:100
override Task FromXml(XmlElement Input)
Populates the element (including children) with information from its XML definition.
Definition: Point3.cs:57
Point3(Layout2DDocument Document, ILayoutElement Parent)
Abstract base class for layout elements with three points.
Definition: Point3.cs:21
override void CopyContents(ILayoutElement Destination)
Copies contents (attributes and children) to the destination element.
Definition: Point3.cs:83
LengthAttribute X3Attribute
X-coordinate 3
Definition: Point3.cs:30
override void ExportStateAttributes(XmlWriter Output)
Exports the local attributes of the current element.
Definition: Point3.cs:128
StringAttribute Reference3Attribute
Reference 3
Definition: Point3.cs:48
float yCoordinate3
Measured Y-coordinate
Definition: Point3.cs:122
LengthAttribute Y3Attribute
Y-coordinate 3
Definition: Point3.cs:39
Base interface for all layout elements.
Layout2DDocument Document
Layout document.
Represents a calculated point.
bool Ok
If point is successfully evaluated