DocumentObject

References
[DebuggerDisplay("{DebuggerDisplay}")] public abstract class DocumentObject : IDocumentObject
Abstract implementation of the IDocumentObject interface for all objects.

Constructors

DocumentObject

#
protected DocumentObject(IReader reader)
Deserialization constructor.
reader (IReader)Reader object.

DocumentObject

#
protected DocumentObject(Nomen nomen)
Base class constructor.
nomen (Nomen)Object description.

Properties

Activity

#
public ObjectActivity Activity { get; set; }
Gets or sets the active state of this object. Note that this property is meaningless for certain types of object.
Activity

Attributes

#
public IAttributes Attributes { get; }
Gets or sets the attributes for this object.
Attributes

ChildrenObjects

#
public virtual IEnumerable<IDocumentObject> ChildrenObjects { get; }
Gets all immediate child objects that belong to the current object. It is possible that an object does not have any children, and it is possible that a child object has children of its own.
ChildrenObjects

Connectivity

#
public abstract IObjectConnectivity Connectivity { get; }
Gets the topological connectivity of this object. The topology is not updated automatically, so be sure to get a fresh instance every time you need it.
Connectivity

CustomValues

#
public KeyedValues CustomValues { get; }
Gets a collection of keyed values which can be used to store custom data which will survive (de)serialisation.
CustomValues

Display

#
public ObjectDisplay Display { get; set; }
Gets or sets the display state of this object. Note that this property is meaningless for certain types of object.
Display

DisplayCapable

#
public virtual bool DisplayCapable { get; }
Gets whether this object makes allowance for 3D viewport displays.
DisplayCapable

DisplayName

#
public virtual string DisplayName { get; }
Gets the display name of this object. Often the DisplayName is identical to the UserName, but there could be more complicated algorithms involved.
DisplayName

DisplayStyle

#
public ObjectDisplayStyle DisplayStyle { get; set; }
Gets or sets the display style to use for the geometric data inside this object. Note that this property is meaningless for certain types of object.
DisplayStyle

Document

#
public Document Document { get; set; }
Gets or sets the document this object belongs to. It is possible an object does not belong to any document, however it can never belong to more than one document simultaneously.
Document

EntireFamily

#
public IEnumerable<IDocumentObject> EntireFamily { get; }
Enumerates over all objects in the hierarchy this object is part of. This enumeration starts at the root object and then continues over all children and grandchildren in a breadth-first fashion.
EntireFamily

FoundingObject

#
public IDocumentObject FoundingObject { get; }
Gets the root or founding object in the object hierarchy. If the current object does not have a parent, it is a founding object.
FoundingObject

Icon

#
public IIcon Icon { get; }
Gets the icon associated with this object.
Icon

IconInternal

#
protected virtual IIcon IconInternal { get; }
Override this method to provide an icon for this object. If the icon is an embedded resource in this assembly with the same name as the class, it will automatically be loaded. The Icon property calls this property and caches the result.

InstanceId

#
public Guid InstanceId { get; set; }
Gets or sets the instance Id for this object. The instance Id should be different for every instance of every type. Do *not* assign this Id unless you know exactly what you are doing.
InstanceId

Nomen

#
public Nomen Nomen { get; }
Gets the user friendly description of this object.
Nomen

Obsolete

#
public bool Obsolete { get; }
Gets whether this object is considered obsolete.
Obsolete

ParentObject

#
public IDocumentObject ParentObject { get; set; }
Gets or sets the parent object that owns this object. Top-level objects do not have parents. Do not assign or remove parents unless you know exactly what you are doing.
ParentObject

Phase

#
public virtual Phase Phase { get; }
Gets the current solution phase of this object.
Phase

ProgressPercentage

#
public int ProgressPercentage { get; }
Gets the progress as a percentage. If this object is currently not calculating a new solution, this number is not meaningful.
ProgressPercentage

Relevance

#
public ObjectRelevance Relevance { get; set; }
Gets or sets the auxiliary state of this object. Auxiliary objects are drawn in an inconspicuous way as they are considered in-between logic. Note that this property is meaningless for certain types of object.
Relevance

Selected

#
public bool Selected { get; }
Gets the main yes/no state from the SelectionState.
Selected

Selection

#
public ObjectSelection Selection { get; set; }
Gets or sets the selected state of this object. Note that the selected setting of secondary objects is inherited from the parent.
Selection

SharedOptionWidth

#
protected static int SharedOptionWidth { get; }
Gets the minimum width needed for drawing the widest option label.

SiblingObjects

#
public IEnumerable<IDocumentObject> SiblingObjects { get; }
Gets all sibling objects in the object family tree.
SiblingObjects

StandardColourOverrides

#
public static IEnumerable<(OpenColor.Family family, Color colour)> StandardColourOverrides { get; }

State

#
public abstract ObjectSolutionState State { get; }
Gets the current solution state of this object.
State

UserName

#
public string UserName { get; set; }
Gets the user specified name of this object.
UserName

Methods

AddUndoRecord

#
public void AddUndoRecord(Record record)
Add a custom undo record for this object.
record (Record)Undo record to add.
Id of undo record.
AddUndoRecord

AddUndoRecord

#
public void AddUndoRecord(VerbNoun name, Action action)
Add a single action undo record for this object.
name (VerbNoun)Name of undo record.
action (Action)Specific action to undo.
Id of undo record.
AddUndoRecord

AppendBakeInput

#
protected void AppendBakeInput(InputPanel panel)
Append the baking input panel.
panel (InputPanel)

AppendStateInput

#
protected void AppendStateInput(InputPanel panel, bool enabledState, bool displayState)
Append the 'Enabled' and 'Display' states to this input panel.
panel (InputPanel)Panel to append to.
enabledState (bool)If true, the Enabled state button will be modifiable.
displayState (bool)If true, the Display state button will be modifiable.

AppendToInputPanel

#
public virtual void AppendToInputPanel(InputPanel panel)
Override this method to populate the popover panel. The base implementation does not add any panel inputs, however the DocumentObject class does provide a slew of protected utility methods for adding standard inputs.
panel (InputPanel)
AppendToInputPanel

AppendUserNameInput

#
protected void AppendUserNameInput(InputPanel panel)
Append the user name text box within a category labelled 'Attributes'.
panel (InputPanel)

ChangeInstanceIds

#
public void ChangeInstanceIds(Dictionary<Guid, Guid> map)
map (Dictionary<Guid, Guid>)

Compute

#
public abstract SolutionData Compute(Solution solution, CallStack stack)
Compute a new solution for this object, or return a completed solution if one is available.
solution (Solution)Document solution info.
stack (CallStack)Call stack leading up to this call.
Result of computation.
Compute

CreateAttributes

#
protected abstract IAttributes CreateAttributes()
Create default attributes for this object. If attributes already exist, this method will not replace them.

DisplayBounds

#
public virtual BoundingBox DisplayBounds()
Gets the bounds of the geometry this object might display.
DisplayBounds

DisplayFaces

#
public virtual void DisplayFaces(DisplayPipeline pipeline, Guises guises, ref BoundingBox extents)
Draw the shaded faces for this object.
pipeline (DisplayPipeline)
guises (Guises)
extents (ref BoundingBox)
DisplayFaces

DisplayWires

#
public virtual void DisplayWires(DisplayPipeline pipeline, Guises guises, ref BoundingBox extents)
Draw the wires for this object.
pipeline (DisplayPipeline)
guises (Guises)
extents (ref BoundingBox)
DisplayWires

Expire

#
public abstract void Expire()
Expire this object and all objects that depend on it. This will request-cancel any running solutions inside whatever document contains this object.
Expire

ExpireDisplay

#
protected void ExpireDisplay()
Expire the attributes and raise the DisplayChanged event.

GetCreationInfo

#
public bool GetCreationInfo(out string name, out DateTime time)
Gets information about who created this component and when.
name (out string)Name of creator.
time (out DateTime)Time of creation in UTC coordinates.
True if the creation data was available.
GetCreationInfo

GetModificationInfo

#
public bool GetModificationInfo(out string name, out DateTime time)
Gets information about who last modified this component and when.
name (out string)Name of modifier.
time (out DateTime)Time of modification in UTC coordinates.
True if the modification data was available.

InvalidateExistingLayout

#
protected void InvalidateExistingLayout()
Invalidate the attribute layout, but only if the attributes already exist.

ModifyIcon

#
public void ModifyIcon(IIcon newIcon, bool overrideExtrinsicIcon = true)
Override the icon for this object. Use this judiciously.
newIcon (IIcon)New icon to assign, or null to revert to the default icon.
overrideExtrinsicIcon (bool = true)If true, the permanent extrinsic icon will be overwritten. If false, the temporary intrinsic icon will be overwritten.
ModifyIcon

ModifyNameAndInfo

#
public void ModifyNameAndInfo(string name = null, string info = null)
Programmatically modify the nickname, name and/or info strings on the Nomen.
name (string = null)New name if not null.
info (string = null)New info if not null.
ModifyNameAndInfo

OnDisplayChanged

#
public void OnDisplayChanged()
Raise the DisplayChanged event.
OnDisplayChanged

OnExpired

#
protected internal void OnExpired()
Raise the Expired event.

OnLayoutChanged

#
public void OnLayoutChanged()
Raise the LayoutChanged event.
OnLayoutChanged

OverrideAttributes

#
public bool OverrideAttributes(IAttributes attributes)
Assign new attributes to this object. Not all attributes may be accepted, it depends on the implementation.
attributes (IAttributes)New attributes to assign. Assigning null will revert to default attributes.
True if attributes were accepted.
OverrideAttributes

RequestAutoSave

#
public AutoSaveResult RequestAutoSave(AutoSaveReason reason, Guid autosaveId)
Request an autosave.
reason (AutoSaveReason)Autosave reason.
autosaveId (Guid)Autosave Id. Consecutive requests with identical Ids are ignored.
RequestAutoSave

RequestAutoSave

#
public AutoSaveResult RequestAutoSave(AutoSaveReason reason)
Request an autosave using the instance ID of this object as a filter. This means hat subsequent autosave requests coming from the same object will be ignored.
reason (AutoSaveReason)Autosave reason.
RequestAutoSave

SetCreationInfo

#
public void SetCreationInfo()
Set the CreatedBy and CreatedAt fields if they haven't been set already.
SetCreationInfo

SetModificationInfo

#
public void SetModificationInfo()
Set the ModifiedBy and ModifiedAt fields.

SetProgressPercentage

#
public void SetProgressPercentage(int percentage)
Set the ProgressPercentage field directly. The percentage is automatically limited to the [0, 100] interval.
percentage (int)

SetProgressPercentage

#
public void SetProgressPercentage(long partial, long total)
Set the ProgressPercentage field based on a step count. This method always limits the percentage to the [1, 99] range, as 0% and 100% are oftentimes indicative of unstarted or completed processes, which probably gives the wrong impression.
partial (long)Current step.
total (long)Total steps.

Store

#
public virtual void Store(IWriter writer)
Serialise this object.
writer (IWriter)
Store

UpdateDisplay

#
public virtual void UpdateDisplay(SolutionData data, DisplayRules rules, CancellationToken token)
Recreate the display caches based on the given solution data and display rules.
data (SolutionData)Data from which to extract display caches.
rules (DisplayRules)Optional display rules.
token (CancellationToken)Cancellation token.
UpdateDisplay

Events

ActivityChanged

#
public event EventHandler<ObjectEventArgs> ActivityChanged
Raised whenever the Enabled state of this object changes.
ActivityChanged

AutosaveRequested

#
public event EventHandler<ObjectAutoSaveEventArgs> AutosaveRequested
Raised whenever this object requests an autosave.
AutosaveRequested

DisplayChanged

#
public event EventHandler<ObjectEventArgs> DisplayChanged
Raised whenever the display state of this object changes.
DisplayChanged

DocumentChanged

#
public event EventHandler<ObjectDocumentEventArgs> DocumentChanged
Raised whenever this object becomes part of a different document.
DocumentChanged

Expired

#
public event EventHandler<ObjectEventArgs> Expired
Raised whenever the solution currently held by this object is expired.
Expired

InstanceIdChanged

#
public event EventHandler<ObjectGuidEventArgs> InstanceIdChanged
Raised whenever the InstanceId of this object changes.
InstanceIdChanged

LayoutChanged

#
public event EventHandler<ObjectEventArgs> LayoutChanged
Raised whenever the layout of this object changes. Layout invalidation triggers a canvas redraw.
LayoutChanged

NameChanged

#
public event EventHandler<ObjectNameEventArgs> NameChanged
Raised whenever the UserName of this object changes. This typically infers that the DisplayName also changes.
NameChanged

RelevanceChanged

#
public event EventHandler<ObjectEventArgs> RelevanceChanged
Raised whenever the Auxiliary state of this object changes.
RelevanceChanged

SelectedChanged

#
public event EventHandler<ObjectEventArgs> SelectedChanged
Raised whenever the Selected state of this object changes.
SelectedChanged