Class GeneralMechanism
General Mechanism.
public class GeneralMechanism : IMakeXmlSource, ITopo, IGetAsmb, IGetAnchoredDisplayeeList, IGetAnchorToSolidDictionary, IAnchoredDisplayee, IGetAnchor, IGetTopoIndex, IDisplayee, IExpandToBox3d
- Inheritance
-
GeneralMechanism
- Implements
- Inherited Members
- Extension Methods
Remarks
The XML IO is according to self-contained principle.
Constructors
GeneralMechanism()
Initializes a new instance of the GeneralMechanism class.
public GeneralMechanism()
GeneralMechanism(XElement, string)
Initializes a new instance of the GeneralMechanism class from XML.
public GeneralMechanism(XElement src, string baseDirectory)
Parameters
src
XElementThe XML element containing the mechanism data.
baseDirectory
stringThe base directory for resolving relative file paths.
Properties
AnchorToSolid
Gets the dictionary mapping anchors to their corresponding solids.
public Dictionary<Anchor, Solid> AnchorToSolid { get; }
Property Value
Asmb
Gets the assembly containing the mechanism components.
public Asmb Asmb { get; }
Property Value
Root
Gets the root anchor of the mechanism.
public Anchor Root { get; }
Property Value
XName
Name for XML IO.
public static string XName { get; }
Property Value
Methods
Display(Bind)
Display function called in DispEngine rendering loop.
public void Display(Bind bind)
Parameters
bind
BindBind with DispEngine. See Bind.
ExpandToBox3d(Box3d)
Expands the destination box. This function is usually used to compute the bounding box of elements.
public void ExpandToBox3d(Box3d dst)
Parameters
dst
Box3dDestination box
GetAnchor()
Get key anchor. (i.e. root anchor)
public Anchor GetAnchor()
Returns
- Anchor
key anchor
GetAnchorToSolidDictionary()
public Dictionary<Anchor, Solid> GetAnchorToSolidDictionary()
Returns
- Dictionary<Anchor, Solid>
A dictionary where keys are anchors and values are their associated solids.
GetAnchoredDisplayeeList()
Gets a list of anchored displayable objects.
public List<IAnchoredDisplayee> GetAnchoredDisplayeeList()
Returns
- List<IAnchoredDisplayee>
A list of IAnchoredDisplayee objects
GetAsmb()
Gets the key asmb.
public Asmb GetAsmb()
Returns
- Asmb
The key asmb.
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectory
stringThe base directory for resolving relative paths
relFile
stringThe relative file path for the XML source
exhibitionOnly
boolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory
is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.