2using System.Threading.Tasks;
24 private bool clockDir;
25 private bool includeCenter;
33 : base(Document, Parent)
48 set => this.radius = value;
56 get => this.startDegrees;
57 set => this.startDegrees = value;
65 get => this.endDegrees;
66 set => this.endDegrees = value;
74 get => this.spanDegrees;
75 set => this.spanDegrees = value;
83 get => this.clockwise;
84 set => this.clockwise = value;
93 set => this.center = value;
100 public override Task
FromXml(XmlElement Input)
109 return base.FromXml(Input);
118 base.ExportAttributes(Output);
120 this.radius?.
Export(Output);
121 this.startDegrees?.
Export(Output);
122 this.endDegrees?.
Export(Output);
123 this.spanDegrees?.
Export(Output);
124 this.clockwise?.
Export(Output);
125 this.center?.
Export(Output);
145 base.CopyContents(Destination);
165 await base.DoMeasureDimensions(State);
171 this.defined =
false;
173 this.clockDir = await this.clockwise.Evaluate(State.
Session,
true);
174 this.includeCenter = await this.center.Evaluate(State.
Session,
false);
178 this.start = (float)Math.IEEERemainder(Degrees.
Result, 360);
180 this.defined =
false;
185 this.end = (float)Math.IEEERemainder(Degrees.
Result, 360);
188 this.span = this.end - this.start;
190 this.span = this.start - this.end;
200 this.span = Degrees.
Result;
202 this.end = this.start + this.span;
204 this.end = this.start - this.span;
206 this.end = (float)Math.IEEERemainder(
this.end, 360);
209 this.defined =
false;
214 if (this.span >= 360)
223 float a = this.start;
224 float r = (float)Math.IEEERemainder(
this.start, 90);
231 if (this.end < this.start)
249 if (this.end > this.start)
266 if (this.start != this.end)
269 if (this.includeCenter)
283 if (this.span >= 360)
289 SKPaint Pen = await this.
TryGetPen(State);
295 float Sweep = this.clockDir ? this.span : -this.span;
296 SKRect Oval =
new SKRect(
300 this.start = (float)Math.IEEERemainder(
this.start, 360);
304 this.end = (float)Math.IEEERemainder(
this.end, 360);
310 State.
Canvas.DrawArc(Oval, this.start, Sweep, this.includeCenter, Fill);
312 SKPaint Pen = await this.
TryGetPen(State);
314 State.
Canvas.DrawArc(Oval, this.start, Sweep, this.includeCenter, Pen);
318 await base.Draw(State);
327 base.ExportStateAttributes(Output);
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.
BooleanAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
Result of asynchronous evaluation.
T Result
Evaluated result, if successful.
bool Ok
If evaluation was successful.
Floating point (Single) attribute
FloatAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
LengthAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
SKCanvas Canvas
Current drawing canvas.
Variables Session
Current session.
void CalcDrawingSize(Length L, ref float Size, bool Horizontal, ILayoutElement Element)
Converts a defined length to drawing size.
void IncludePoint(float X, float Y, float RX, float RY, float Angle)
Includes a point in the area measurement.
Layout2DDocument Document
Layout document.
bool defined
If element is well-defined.
Base interface for all layout elements.
Layout2DDocument Document
Layout document.