Class GeomCombination
A class that manages multiple STL sources as a single source.
public class GeomCombination : IStlSource, IGetStl, IMakeXmlSource, IGenStl, IExpandToBox3d, IDuplicate, IReleaseStlCache
- Inheritance
-
GeomCombination
- Implements
- Inherited Members
- Extension Methods
Constructors
GeomCombination()
Default constructor that initializes an empty collection of STL sources.
public GeomCombination()
GeomCombination(params IStlSource[])
Initializes a new instance with a set of STL sources.
public GeomCombination(params IStlSource[] stlSources)
Parameters
stlSourcesIStlSource[]A set of STL sources
GeomCombination(XElement, string, string, IProgress<IMessage>)
Ctor.
public GeomCombination(XElement src, string baseDirectory, string relFile, IProgress<IMessage> progress)
Parameters
srcXElementXML
baseDirectorystringBase directory path
relFilestringRelative file path
progressIProgress<IMessage>Optional progress reporter for the XML parsing chain
Properties
StlSources
Collection of STL sources managed by this instance.
public List<IStlSource> StlSources { get; }
Property Value
XName
Name for XML IO.
public static string XName { get; }
Property Value
Methods
CleanStlCache()
Clears the cached STL data, forcing it to be regenerated on the next request.
public void CleanStlCache()
Duplicate(params object[])
Creates a deep copy of the object, excluding any source file references.
public object Duplicate(params object[] res)
Parameters
resobject[]Optional parameters that may be needed during the duplication process
Returns
- object
A new instance that is a deep copy of the original object
ExpandToBox3d(ref box3d_t)
Expands the given box by the sources' own boxes.
public void ExpandToBox3d(ref box3d_t dst)
Parameters
dstbox3d_tThe box to expand.
Remarks
A rough, quick operation: bounds queries never generate a mesh, so a source without IExpandToBox3d support contributes nothing.
GenStl(IPolarResolution2d)
Generates a new STL.
public Stl GenStl(IPolarResolution2d resolution)
Parameters
resolutionIPolarResolution2dPolar resolution
Returns
- Stl
A newly created STL.
GetStl()
Gets the combined STL mesh with each source at its own default resolution. Resolution-aware callers pass their value through GenStl(IPolarResolution2d) instead.
public Stl GetStl()
Returns
- Stl
The combined STL mesh.
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
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif 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.
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory
ReleaseStlCache()
Lets go of the kept mesh when GetStl() produces it again.
public bool ReleaseStlCache()
Returns
- bool
True when the kept mesh is gone (or already was) and GetStl() produces it again; false when the mesh has to stay as the only copy there is (a mesh handed in by hand, a file since deleted or overwritten), or when there is nothing to produce.
Remarks
Forwards to every source. When any source let its mesh go, the combined mesh cached here goes too (GenStl(IPolarResolution2d) builds it again from the sources); when none did, the combined mesh stays and the answer is false.