1using System.Collections.Generic;
2using System.Threading.Tasks;
29 : base(Document, Parent)
44 set => this.head = value;
53 set => this.tail = value;
61 get => this.shapeFill;
62 set => this.shapeFill = value;
69 public override async Task
FromXml(XmlElement Input)
71 await base.FromXml(Input);
77 this.segments = this.GetSegments();
82 List<ISegment> Segments =
null;
91 Segments =
new List<ISegment>();
93 Segments.Add(Segment);
100 return Segments?.ToArray();
109 base.ExportAttributes(Output);
111 this.head?.
Export(Output);
112 this.tail?.
Export(Output);
113 this.shapeFill?.
Export(Output);
124 return new Path(Document, Parent);
133 base.CopyContents(Destination);
135 if (Destination is
Path Dest)
141 Dest.segments = Dest.GetSegments();
152 await base.DoMeasureDimensions(State);
161 this.headElement =
Shape;
166 this.Document.TryGetElement(RefId.
Result, out Element) &&
167 Element is
Shape Shape2)
169 this.tailElement = Shape2;
174 this.Document.TryGetElement(RefId.
Result, out Element) &&
180 if (!(this.segments is
null))
182 foreach (
ISegment Segment
in this.segments)
187 private Shape headElement;
188 private Shape tailElement;
198 SKPaint Pen = await this.
TryGetPen(State);
200 bool CalcStart = !(this.tailElement is
null);
201 bool CalcEnd = !(this.headElement is
null);
203 if (!(this.segments is
null))
205 using (SKPath
Path =
new SKPath())
221 if (CalcStart || CalcEnd)
223 if (!(this.shapeFiller is
null))
224 Fill = this.shapeFiller.
Paint;
226 this.tailElement?.
DrawTail(State,
this, Pen, Fill);
227 this.headElement?.
DrawHead(State,
this, Pen, Fill);
230 await base.Draw(State);
240 if (!(this.segments is
null))
242 foreach (
ISegment Segment
in this.segments)
246 this.hasStart =
false;
258 if (!(this.segments is
null))
262 foreach (
ISegment Segment
in this.segments)
270 DirectedElement.
TryGetStart(out
this.startX, out
this.startY, out
this.startDirection))
273 this.hasStart =
true;
280 int i = this.segments.Length;
285 DirectedElement.
TryGetEnd(out
this.endX, out
this.endY, out
this.endDirection))
295 private float startX;
296 private float startY;
297 private float startDirection;
298 private bool hasStart;
301 private float endDirection;
311 public bool TryGetStart(out
float X, out
float Y, out
float Direction)
317 Direction = this.startDirection;
323 X = Y = Direction = 0;
335 public bool TryGetEnd(out
float X, out
float Y, out
float Direction)
341 Direction = this.endDirection;
347 X = Y = Direction = 0;
358 base.ExportStateAttributes(Output);
Syntax-related layout exception
Contains a 2D layout document.
void Export(XmlWriter Output)
Exports the attribute.
void ExportState(XmlWriter Output)
Exports the state of the attribute.
static async Task< EvaluationResult< T > > TryEvaluate(Attribute< T > Attribute, Variables Session)
Tries to evaluate the attribute value.
Result of asynchronous evaluation.
T Result
Evaluated result, if successful.
bool Ok
If evaluation was successful.
StringAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
Abstract base class for backgrounds.
SKCanvas Canvas
Current drawing canvas.
Variables Session
Current session.
Layout2DDocument Document
Layout document.
Defines a shape for use elsewhere in the layout.
Task DrawTail(DrawingState State, IDirectedElement DirectedElement, SKPaint DefaultPen, SKPaint DefaultFill)
Draws shape as a tail
Task DrawHead(DrawingState State, IDirectedElement DirectedElement, SKPaint DefaultPen, SKPaint DefaultFill)
Draws shape as a head
Interface for directed elements.
bool TryGetStart(out float X, out float Y, out float Direction)
Tries to get start position and initial direction.
bool TryGetEnd(out float X, out float Y, out float Direction)
Tries to get end position and terminating direction.
Base interface for all layout elements.
bool IsVisible
If the element is visible or not.
string LocalName
Local name of type of element.
string Namespace
Namespace of type of element.
Layout2DDocument Document
Layout document.