Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Layout2DDocument.cs
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Reflection;
5using System.Text;
6using System.Threading.Tasks;
7using System.Xml;
8using SkiaSharp;
9using Waher.Content;
11using Waher.Events;
18using Waher.Script;
19
21{
25 public class Layout2DDocument : IDisposable
26 {
30 public const string LocalName = "Layout2D";
31
35 public const string Namespace = "http://waher.se/Schema/Layout2D.xsd";
36
40 public static readonly string SchemaResourceName = typeof(Layout2DDocument).Namespace + ".Schema.Layout2D.xsd";
41
42 private static Dictionary<string, ILayoutElement> elementTypes = new Dictionary<string, ILayoutElement>();
43 private static bool initialized = false;
44
45 private readonly Dictionary<string, ILayoutElement> elementsById = new Dictionary<string, ILayoutElement>();
46 private readonly Dictionary<string, object> attachments = new Dictionary<string, object>(StringComparer.CurrentCultureIgnoreCase);
47 private readonly Variables session;
48 private ILayoutElement root;
49
50 #region Construction
51
57 private Layout2DDocument(Variables Session, params KeyValuePair<string, object>[] Attachments)
58 {
59 this.session = Session;
60
61 if (!(Attachments is null))
62 {
63 foreach (KeyValuePair<string, object> P in Attachments)
64 this.attachments[P.Key] = P.Value;
65 }
66 }
67
68 internal async Task<ILayoutElement> CreateElement(XmlElement Xml, ILayoutElement Parent)
69 {
70 string Key = Xml.NamespaceURI + "#" + Xml.LocalName;
71
72 if (!elementTypes.TryGetValue(Key, out ILayoutElement E))
73 throw new LayoutSyntaxException("Layout element not recognized: " + Key);
74
75 ILayoutElement Result = E.Create(this, Parent);
76 await Result.FromXml(Xml);
77
78 EvaluationResult<string> Id = await Result.IdAttribute.TryEvaluate(this.session);
79 if (Id.Ok && !string.IsNullOrEmpty(Id.Result))
80 this.AddElementId(Id.Result, Result);
81
82 return Result;
83 }
84
90 public static Task<Layout2DDocument> FromFile(string FileName, params KeyValuePair<string, object>[] Attachments)
91 {
92 return FromFile(FileName, true, Attachments);
93 }
94
101 public static Task<Layout2DDocument> FromFile(string FileName, bool Preprocess, params KeyValuePair<string, object>[] Attachments)
102 {
103 return FromFile(FileName, Preprocess, new Variables(), Attachments);
104 }
105
113 public static async Task<Layout2DDocument> FromFile(string FileName, bool Preprocess, Variables Session, params KeyValuePair<string, object>[] Attachments)
114 {
115 string Xml = await Resources.ReadAllTextAsync(FileName);
116 return await FromXml(Xml, Preprocess, Session, Attachments);
117 }
118
125 public static Task<Layout2DDocument> FromStream(Stream Input, Encoding DefaultEncoding, params KeyValuePair<string, object>[] Attachments)
126 {
127 return FromStream(Input, DefaultEncoding, true, Attachments);
128 }
129
137 public static Task<Layout2DDocument> FromStream(Stream Input, Encoding DefaultEncoding, bool Preprocess, params KeyValuePair<string, object>[] Attachments)
138 {
139 return FromStream(Input, DefaultEncoding, Preprocess, new Variables(), Attachments);
140 }
141
150 public static Task<Layout2DDocument> FromStream(Stream Input, Encoding DefaultEncoding, bool Preprocess, Variables Session, params KeyValuePair<string, object>[] Attachments)
151 {
152 long c = Input.Length - Input.Position;
153 if (c > int.MaxValue)
154 throw new OutOfMemoryException("Input too large");
155
156 int c2 = (int)c;
157 byte[] Bin = new byte[c2];
158 Input.ReadAll(Bin, 0, c2);
159
160 string Xml = CommonTypes.GetString(Bin, DefaultEncoding);
161
162 return FromXml(Xml, Preprocess, Session, Attachments);
163 }
164
170 public static Task<Layout2DDocument> FromXml(string Xml, params KeyValuePair<string, object>[] Attachments)
171 {
172 return FromXml(Xml, true, Attachments);
173 }
174
181 public static Task<Layout2DDocument> FromXml(string Xml, bool Preprocess, params KeyValuePair<string, object>[] Attachments)
182 {
183 return FromXml(Xml, Preprocess, new Variables(), Attachments);
184 }
185
193 public static async Task<Layout2DDocument> FromXml(string Xml, bool Preprocess, Variables Session, params KeyValuePair<string, object>[] Attachments)
194 {
195 if (Preprocess)
196 Xml = await Expression.TransformAsync(Xml, "{{", "}}", Session);
197
198 XmlDocument Doc = new XmlDocument();
199
200 try
201 {
202 Doc.LoadXml(Xml);
203 }
204 catch (XmlException ex)
205 {
206 throw XML.AnnotateException(ex, Xml);
207 }
208
209 return await FromXml(Doc, Session, Attachments);
210 }
211
217 public static Task<Layout2DDocument> FromXml(XmlDocument Xml, params KeyValuePair<string, object>[] Attachments)
218 {
219 return FromXml(Xml.DocumentElement, new Variables(), Attachments);
220 }
221
228 public static Task<Layout2DDocument> FromXml(XmlDocument Xml, Variables Session, params KeyValuePair<string, object>[] Attachments)
229 {
230 return FromXml(Xml.DocumentElement, Session, Attachments);
231 }
232
238 public static Task<Layout2DDocument> FromXml(XmlElement Xml, params KeyValuePair<string, object>[] Attachments)
239 {
240 return FromXml(Xml, new Variables(), Attachments);
241 }
242
249 public static async Task<Layout2DDocument> FromXml(XmlElement Xml, Variables Session, params KeyValuePair<string, object>[] Attachments)
250 {
251 if (Xml.LocalName != LocalName || Xml.NamespaceURI != Namespace)
252 throw new ArgumentException("XML does not represent a 2D layout document.", nameof(Xml));
253
254 lock (elementTypes)
255 {
256 if (!initialized)
257 {
258 Type[] LayoutElementTypes = Types.GetTypesImplementingInterface(typeof(ILayoutElement));
259 Dictionary<string, ILayoutElement> TypesPerKey = new Dictionary<string, ILayoutElement>();
261
262 foreach (Type T in LayoutElementTypes)
263 {
264 TypeInfo TI = T.GetTypeInfo();
265 if (TI.IsAbstract || TI.IsInterface || TI.IsGenericTypeDefinition)
266 continue;
267
268 try
269 {
271 string Key = E.Namespace + "#" + E.LocalName;
272
273 if (TypesPerKey.ContainsKey(Key))
274 Log.Error("Layout element type already defined: " + Key);
275 else
276 TypesPerKey[Key] = E;
277 }
278 catch (Exception ex)
279 {
280 Log.Exception(ex);
281 }
282 }
283
284 elementTypes = TypesPerKey;
285 initialized = true;
286
287 Types.OnInvalidated += (Sender, e) => initialized = false;
288 }
289 }
290
291 Layout2DDocument Result = new Layout2DDocument(Session, Attachments);
292 Result.root = await Result.CreateElement(Xml, null);
293
294 return Result;
295 }
296
300 public void Dispose()
301 {
302 this.root?.Dispose();
303
304 foreach (object Attachment in this.attachments.Values)
305 {
306 if (Attachment is IDisposable Disposable)
307 Disposable.Dispose();
308 }
309 }
310
311 #endregion
312
313 #region Rendering
314
320 public async Task<KeyValuePair<SKImage, Map[]>> Render(RenderSettings Settings)
321 {
322 Map[] Maps = null; // TODO: Generate maps.
323
324 int Width;
325 int Height;
326
327 switch (Settings.ImageSize)
328 {
329 case RenderedImageSize.ResizeImage:
330 Width = Height = 10;
331 break;
332
333 case RenderedImageSize.ScaleToFit:
334 default:
335 Width = Settings.Width;
336 Height = Settings.Height;
337 break;
338 }
339
340 SKSurface Surface = SKSurface.Create(new SKImageInfo(Width, Height, SKImageInfo.PlatformColorType, SKAlphaType.Premul));
341 DrawingState State = null;
342 try
343 {
344 SKCanvas Canvas = Surface.Canvas;
345 State = new DrawingState(Canvas, Settings, this.session);
346
347 if (Settings.BackgroundColor != SKColor.Empty)
348 Canvas.Clear(Settings.BackgroundColor);
349
350 int Limit = 100;
351
352 while (!(this.root is null))
353 {
354 State.ClearRelativeMeasurement(--Limit <= 0);
355 await this.root.MeasureDimensions(State);
356
357 this.RaiseMeasuringDimensions(State);
358
359 if (!State.MeasureRelative)
360 break;
361
362 if (Limit <= 0)
363 {
364 string ShortestBranch = State.GetShortestRelativeMeasurementStateXml();
365 throw new InvalidOperationException("Layout positions not well defined. Dimensions diverge:\r\n\r\n" + ShortestBranch);
366 }
367 }
368
369 this.root?.MeasurePositions(State);
370 this.RaiseMeasuringPositions(State);
371
372 switch (Settings.ImageSize)
373 {
374 case RenderedImageSize.ResizeImage:
375 Surface.Dispose();
376 Surface = null;
377
378 if (!(this.root is null))
379 {
380 Width = (int)this.root.Right - (int)this.root.Left + 1;
381 Height = (int)this.root.Bottom - (int)this.root.Top - 1;
382 }
383
384 Surface = SKSurface.Create(new SKImageInfo(Width, Height, SKImageInfo.PlatformColorType, SKAlphaType.Premul));
385 if (Surface is null)
386 throw new InvalidOperationException("Unable to render layout.");
387
388 Canvas = Surface.Canvas;
389 State.Canvas = Canvas;
390
391 if (Settings.BackgroundColor != SKColor.Empty)
392 Canvas.Clear(Settings.BackgroundColor);
393
394 if (!(this.root is null) && this.root.Left.HasValue && this.root.Top.HasValue)
395 State.Canvas.Translate(-this.root.Left.Value, -this.root.Top.Value);
396 break;
397
398 case RenderedImageSize.ScaleToFit:
399 if (!(this.root is null))
400 {
401 if (this.root.Width.HasValue && this.root.Height.HasValue)
402 {
403 float Width2 = this.root.Width.Value + 1;
404 float Height2 = this.root.Height.Value + 1;
405 float ScaleX = Width / Width2;
406 float ScaleY = Height / Height2;
407
408 if (ScaleX < ScaleY)
409 {
410 State.Canvas.Translate(0, (Height - Height2 * ScaleX) / 2);
411 State.Canvas.Scale(ScaleX);
412 }
413 else if (ScaleY < ScaleX)
414 {
415 State.Canvas.Translate((Width - Width2 * ScaleY) / 2, 0);
416 State.Canvas.Scale(ScaleY);
417 }
418 }
419
420 if (this.root.Left.HasValue && this.root.Top.HasValue)
421 State.Canvas.Translate(-this.root.Left.Value, -this.root.Top.Value);
422 }
423 break;
424 }
425
426 if (!(this.root is null))
427 await this.root.Draw(State);
428
429 return new KeyValuePair<SKImage, Map[]>(Surface.Snapshot(), Maps);
430 }
431 finally
432 {
433 State?.Dispose();
434 Surface?.Dispose();
435 }
436 }
437
443
449 {
450 DrawingEventHandler h = this.OnMeasuringDimensions;
451
452 if (!(h is null))
453 {
454 try
455 {
456 h(this, new DrawingEventArgs(this, State));
457 }
458 catch (Exception ex)
459 {
460 Log.Exception(ex);
461 }
462 }
463 }
464
469
475 {
476 DrawingEventHandler h = this.OnMeasuringPositions;
477
478 if (!(h is null))
479 {
480 try
481 {
482 h(this, new DrawingEventArgs(this, State));
483 }
484 catch (Exception ex)
485 {
486 Log.Exception(ex);
487 }
488 }
489 }
490
491 #endregion
492
496 public event UpdatedEventHandler OnUpdated = null;
497
502 public void RaiseUpdated(ILayoutElement Element)
503 {
504 UpdatedEventHandler h = this.OnUpdated;
505
506 if (!(h is null))
507 {
508 try
509 {
510 h(this, new UpdatedEventArgs(this, Element));
511 }
512 catch (Exception ex)
513 {
514 Log.Exception(ex);
515 }
516 }
517 }
518
525 public bool TryGetContent(string ContentId, out object Content)
526 {
527 return this.attachments.TryGetValue(ContentId, out Content);
528 }
529
535 public bool DisposeContent(string ContentId)
536 {
537 if (this.attachments.TryGetValue(ContentId, out object Obj))
538 {
539 this.attachments.Remove(ContentId);
540
541 if (Obj is IDisposable Disposable)
542 Disposable.Dispose();
543
544 return true;
545 }
546 else
547 return false;
548 }
549
555 public string AddContent(object Content)
556 {
557 string ContentId;
558
559 do
560 {
561 ContentId = Guid.NewGuid().ToString();
562 }
563 while (this.attachments.ContainsKey(ContentId));
564
565 this.attachments[ContentId] = Content;
566
567 return ContentId;
568 }
569
575 public void AddContent(string ContentId, object Content)
576 {
577 this.DisposeContent(ContentId);
578 this.attachments[ContentId] = Content;
579 }
580
586 public void AddElementId(string Id, ILayoutElement Element)
587 {
588 this.elementsById[Id] = Element;
589 }
590
597 public bool TryGetElement(string Id, out ILayoutElement Element)
598 {
599 return this.elementsById.TryGetValue(Id, out Element);
600 }
601
605 public void ClearElementIds()
606 {
607 this.elementsById.Clear();
608 }
609
615 public async Task<RenderSettings> GetRenderSettings(Variables Session)
616 {
617 RenderSettings Result = new RenderSettings()
618 {
619 ImageSize = RenderedImageSize.ResizeImage // TODO: Theme colors, font, etc.
620 };
621
622 if (this.root is Model.Backgrounds.Layout2D Layout2D)
623 {
625 {
626 DrawingState State = new DrawingState(null, Result, Session);
627
629 if (Width.Ok)
630 {
631 float w = Result.Width;
632 State.CalcDrawingSize(Width.Result, ref w, true, this.root);
633 Result.Width = (int)(w + 0.5f);
634 }
635
637 if (Height.Ok)
638 {
639 float h = Result.Height;
640 State.CalcDrawingSize(Height.Result, ref h, false, this.root);
641 Result.Height = (int)(h + 0.5f);
642 }
643 }
644
646 if (BackgroundId.Ok &&
647 this.TryGetElement(BackgroundId.Result, out ILayoutElement Element) &&
649 {
651 if (Color.Ok)
652 Result.BackgroundColor = Color.Result;
653 }
654 }
655
656 return Result;
657 }
658
665 {
666 KeyValuePair<string, object>[] Attachments = new KeyValuePair<string, object>[this.attachments.Count];
667 int i = 0;
668
669 foreach (KeyValuePair<string, object> P in this.attachments)
670 Attachments[i++] = P;
671
672 Layout2DDocument Result = new Layout2DDocument(Session, Attachments)
673 {
674 root = this.root.Copy(null),
675 Dynamic = this.Dynamic
676 };
677
678 Result.root.RegisterIDs(Session);
679
680 return Result;
681 }
682
686 public bool Dynamic
687 {
688 get;
689 internal set;
690 }
691
696 public string ExportState()
697 {
698 return this.ExportState(XML.WriterSettings(true, true));
699 }
700
706 public string ExportState(XmlWriterSettings Settings)
707 {
708 StringBuilder Output = new StringBuilder();
709 this.ExportState(Output, Settings);
710 return Output.ToString();
711 }
712
718 public void ExportState(StringBuilder Output, XmlWriterSettings Settings)
719 {
720 using (XmlWriter w = XmlWriter.Create(Output, Settings))
721 {
722 this.ExportState(w);
723 w.Flush();
724 }
725 }
726
731 public void ExportState(XmlWriter Output)
732 {
733 Output.WriteStartElement("Layout2DState", "http://waher.se/Schema/Layout2DState.xsd");
734 this.root?.ExportState(Output);
735 Output.WriteEndElement();
736 }
737
738 }
739
740 /* TODO:
741 *
742 * Tree layout
743 * Radix/circular
744 * Directed graphs
745 * Smart Art/Graphs/Layout
746 * Mindmap (Example: https://bhavkaran.com/reconspider/mindmap.html)
747 *
748 * Blur when too small, and dont continue rendering
749 * Clip optimization
750 *
751 */
752
753}
Helps with parsing of commong data types.
Definition: CommonTypes.cs:13
static string GetString(byte[] Data, Encoding DefaultEncoding)
Gets a string from its binary representation, taking any Byte Order Mark (BOM) into account.
Static class managing loading of resources stored as embedded resources or in content files.
Definition: Resources.cs:15
static async Task< string > ReadAllTextAsync(string FileName)
Reads a text file asynchronously.
Definition: Resources.cs:205
Helps with common XML-related tasks.
Definition: XML.cs:19
static XmlException AnnotateException(XmlException ex)
Creates a new XML Exception object, with reference to the source XML file, for information.
Definition: XML.cs:1588
static XmlWriterSettings WriterSettings(bool Indent, bool OmitXmlDeclaration)
Gets an XML writer settings object.
Definition: XML.cs:1177
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:13
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1647
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Definition: Log.cs:682
Event raised when the layout model has been Drawing internally.
Event raised when the layout model has been updated internally.
Contains a 2D layout document.
UpdatedEventHandler OnUpdated
Event raised when the internal state of the layout has been updated.
Layout2DDocument Copy(Variables Session)
Makes a copy of the layout document.
static Task< Layout2DDocument > FromStream(Stream Input, Encoding DefaultEncoding, params KeyValuePair< string, object >[] Attachments)
Loads a 2D layout document from a stream.
void ClearElementIds()
Clears registered elements with IDs.
bool Dynamic
If the layout is dynamic (i.e. contains script).
void RaiseUpdated(ILayoutElement Element)
Raises the OnUpdated event.
static Task< Layout2DDocument > FromStream(Stream Input, Encoding DefaultEncoding, bool Preprocess, Variables Session, params KeyValuePair< string, object >[] Attachments)
Loads a 2D layout document from a stream.
static Task< Layout2DDocument > FromFile(string FileName, bool Preprocess, params KeyValuePair< string, object >[] Attachments)
Loads a 2D layout document from a file.
void RaiseMeasuringDimensions(DrawingState State)
Raises the OnMeasuringDimensions event.
DrawingEventHandler OnMeasuringPositions
Event raised when the layout positions are being measured. Event is eaised once after dimensions have...
void ExportState(StringBuilder Output, XmlWriterSettings Settings)
Exports the internal state of the layout.
void AddElementId(string Id, ILayoutElement Element)
Adds an element with an ID
string ExportState()
Exports the internal state of the layout.
void ExportState(XmlWriter Output)
Exports the internal state of the layout.
static Task< Layout2DDocument > FromXml(string Xml, bool Preprocess, params KeyValuePair< string, object >[] Attachments)
Parses a 2D layout document from its XML definition.
static Task< Layout2DDocument > FromXml(XmlDocument Xml, params KeyValuePair< string, object >[] Attachments)
Parses a 2D layout document from its XML definition.
static async Task< Layout2DDocument > FromXml(XmlElement Xml, Variables Session, params KeyValuePair< string, object >[] Attachments)
Parses a 2D layout document from its XML definition.
bool TryGetElement(string Id, out ILayoutElement Element)
Tries to get a layout element, given an ID reference
string AddContent(object Content)
Adds content to the layout.
async Task< KeyValuePair< SKImage, Map[]> > Render(RenderSettings Settings)
Renders the layout to an image
static readonly string SchemaResourceName
Schema resource name.
static Task< Layout2DDocument > FromXml(XmlDocument Xml, Variables Session, params KeyValuePair< string, object >[] Attachments)
Parses a 2D layout document from its XML definition.
DrawingEventHandler OnMeasuringDimensions
Event raised when the layout dimensions are being measured. Event can be raised multiple times during...
void AddContent(string ContentId, object Content)
Adds content to the layout.
bool DisposeContent(string ContentId)
Disposes of attached content, given its ID.
const string Namespace
http://waher.se/Schema/Layout2D.xsd
static Task< Layout2DDocument > FromFile(string FileName, params KeyValuePair< string, object >[] Attachments)
Loads a 2D layout document from a file.
static Task< Layout2DDocument > FromXml(string Xml, params KeyValuePair< string, object >[] Attachments)
Parses a 2D layout document from its XML definition.
static async Task< Layout2DDocument > FromXml(string Xml, bool Preprocess, Variables Session, params KeyValuePair< string, object >[] Attachments)
Parses a 2D layout document from its XML definition.
bool TryGetContent(string ContentId, out object Content)
Tries to get content from attached content.
static Task< Layout2DDocument > FromStream(Stream Input, Encoding DefaultEncoding, bool Preprocess, params KeyValuePair< string, object >[] Attachments)
Loads a 2D layout document from a stream.
void RaiseMeasuringPositions(DrawingState State)
Raises the OnMeasuringPositions event.
string ExportState(XmlWriterSettings Settings)
Exports the internal state of the layout.
async Task< RenderSettings > GetRenderSettings(Variables Session)
Creates a render settings object.
static Task< Layout2DDocument > FromXml(XmlElement Xml, params KeyValuePair< string, object >[] Attachments)
Parses a 2D layout document from its XML definition.
static async Task< Layout2DDocument > FromFile(string FileName, bool Preprocess, Variables Session, params KeyValuePair< string, object >[] Attachments)
Loads a 2D layout document from a file.
Contains information about an actionable area in a generated image.
Definition: Map.cs:7
Manages an attribute value or expression.
Definition: Attribute.cs:14
bool Defined
If the attribute is defined.
Definition: Attribute.cs:144
static async Task< EvaluationResult< T > > TryEvaluate(Attribute< T > Attribute, Variables Session)
Tries to evaluate the attribute value.
Definition: Attribute.cs:256
Root node for two-dimensional layouts
Definition: Layout2D.cs:14
StringAttribute BackgroundColorAttribute
Background Color
Definition: Layout2D.cs:75
SKCanvas Canvas
Current drawing canvas.
void Dispose()
IDisposable.Dispose
Definition: DrawingState.cs:81
void CalcDrawingSize(Length L, ref float Size, bool Horizontal, ILayoutElement Element)
Converts a defined length to drawing size.
string GetShortestRelativeMeasurementStateXml()
Gets the shortest subtree State XML of an element with relative measurements.
void ClearRelativeMeasurement(bool LogRelativeElements)
Clears information about first relative measurement.
bool MeasureRelative
If layout contains relative sizes and dimensions should be recalculated.
LengthAttribute WidthAttribute
Width
Definition: LayoutArea.cs:52
LengthAttribute HeightAttribute
Height
Definition: LayoutArea.cs:61
SKColor BackgroundColor
Background color
RenderedImageSize ImageSize
Offset along X-axis.
Static class that dynamically manages types and interfaces available in the runtime environment.
Definition: Types.cs:14
static object Instantiate(Type Type, params object[] Arguments)
Returns an instance of the type Type . If one needs to be created, it is. If the constructor requires...
Definition: Types.cs:1353
static Type[] GetTypesImplementingInterface(string InterfaceFullName)
Gets all types implementing a given interface.
Definition: Types.cs:84
Class managing a script expression.
Definition: Expression.cs:39
static Task< string > TransformAsync(string s, string StartDelimiter, string StopDelimiter, Variables Variables)
Transforms a string by executing embedded script.
Definition: Expression.cs:4441
Collection of variables.
Definition: Variables.cs:25
Base interface for all layout elements.
float? Bottom
Bottom coordinate of bounding box, after measurement.
Task RegisterIDs(Variables Session)
Registers any IDs defined with the encapsulating document.
ILayoutElement Copy(ILayoutElement Parent)
Creates a copy of the layout element.
float? Right
Right coordinate of bounding box, after measurement.
Task Draw(DrawingState State)
Draws layout entities.
Task MeasureDimensions(DrawingState State)
Measures layout entities and defines unassigned properties, related to dimensions....
string LocalName
Local name of type of element.
Task FromXml(XmlElement Input)
Populates the element (including children) with information from its XML definition.
float? Left
Left coordinate of bounding box, after measurement.
ILayoutElement Create(Layout2DDocument Document, ILayoutElement Parent)
Creates a new instance of the layout element.
string ExportState()
Exports the internal state of the layout.
void MeasurePositions(DrawingState State)
Measures layout entities and defines unassigned properties, related to positions.
StringAttribute IdAttribute
ID Attribute
delegate void DrawingEventHandler(object Sender, DrawingEventArgs e)
Delegate for Drawing event handlers.
delegate void UpdatedEventHandler(object Sender, UpdatedEventArgs e)
Delegate for Updated event handlers.
RenderedImageSize
Affects the size of the rendered image.