Logo Search packages:      
Sourcecode: opencascade version File versions  Download package

XCAFDoc_ShapeTool Class Reference

#include <XCAFDoc_ShapeTool.hxx>

Inheritance diagram for XCAFDoc_ShapeTool:

TDF_Attribute MMgt_TShared Standard_Transient

List of all members.


Detailed Description

A tool to store shapes in an XDE
document in the form of assembly structure, and to maintain this structure.
The API provided by this class allows to work with this
structure regardless of its low-level implementation.
All the shapes are stored on child labels of a main label which is
XCAFDoc_DocumentTool::LabelShapes(). The label for assembly also has
sub-labels, each of which represents the instance of
another shape in that assembly (component). Such sub-label
stores reference to the label of the original shape in the form
of TDataStd_TreeNode with GUID XCAFDoc::ShapeRefGUID(), and its
location encapsulated into the NamedShape.
For correct work with an XDE document, it is necessary to use
methods for analysis and methods for working with shapes.
For example:
if ( STool->IsAssembly(aLabel) )
{ Standard_Boolean subchilds = Standard_False; (default)
Standard_Integer nbc = STool->NbComponents
(aLabel[,subchilds]);
}
If subchilds is True, commands also consider sub-levels. By
default, only level one is checked.
In this example, number of children from the first level of
assembly will be returned. Methods for creation and initialization:
Constructor:
XCAFDoc_ShapeTool::XCAFDoc_ShapeTool()
Getting a guid:
Standard_GUID GetID ();
Creation (if does not exist) of ShapeTool on label L:
Handle(XCAFDoc_ShapeTool) XCAFDoc_ShapeTool::Set(const TDF_Label& L)
Analyze whether shape is a simple shape or an instance or a
component of an assembly or it is an assembly ( methods of analysis).
For example:
STool->IsShape(aLabel) ;
Analyze that the label represents a shape (simple
shape, assembly or reference) or
STool->IsTopLevel(aLabel);
Analyze that the label is a label of a top-level shape.
Work with simple shapes, assemblies and instances (
methods for work with shapes).
For example:
Add shape:
Standard_Boolean makeAssembly;
True to interpret a Compound as an Assembly, False to take it
as a whole
aLabel = STool->AddShape(aShape, makeAssembly);
Get shape:
TDF_Label aLabel...
A label must be present if
(aLabel.IsNull()) { ... no such label : abandon .. }
TopoDS_Shape aShape;
aShape = STool->GetShape(aLabel);
if (aShape.IsNull())
{ ... this label is not for a Shape ... }
To get a label from shape.
Standard_Boolean findInstance = Standard_False;
(this is default value)
aLabel = STool->FindShape(aShape [,findInstance]);
if (aLabel.IsNull())
{ ... no label found for this shape ... }

Definition at line 126 of file XCAFDoc_ShapeTool.hxx.


Public Member Functions

Standard_EXPORT void AddAttribute (const Handle(TDF_Attribute)&other) const
Standard_EXPORT TDF_Label AddComponent (const TDF_Label &assembly, const TopoDS_Shape &comp, const Standard_Boolean expand=Standard_False)
Standard_EXPORT TDF_Label AddComponent (const TDF_Label &assembly, const TDF_Label &comp, const TopLoc_Location &Loc) const
Standard_EXPORT TDF_Label AddShape (const TopoDS_Shape &S, const Standard_Boolean makeAssembly=Standard_True, const Standard_Boolean makePrepare=Standard_True)
Standard_EXPORT TDF_Label AddSubShape (const TDF_Label &shapeL, const TopoDS_Shape &sub) const
virtual Standard_EXPORT void AfterAddition ()
 Something to do after adding an Attribute to a label.
.
virtual Standard_EXPORT void AfterResume ()
virtual Standard_EXPORT
Standard_Boolean 
AfterRetrieval (const Standard_Boolean forceIt=Standard_False)
virtual Standard_EXPORT
Standard_Boolean 
AfterUndo (const Handle(TDF_AttributeDelta)&anAttDelta, const Standard_Boolean forceIt=Standard_False)
Standard_EXPORT void Backup ()
virtual Standard_EXPORT
Handle_TDF_Attribute 
BackupCopy () const
Standard_EXPORT TDF_Label BaseLabel () const
 returns the label under which shapes are stored

virtual Standard_EXPORT void BeforeCommitTransaction ()
virtual Standard_EXPORT void BeforeForget ()
virtual Standard_EXPORT void BeforeRemoval ()
virtual Standard_EXPORT
Standard_Boolean 
BeforeUndo (const Handle(TDF_AttributeDelta)&anAttDelta, const Standard_Boolean forceIt=Standard_False)
Standard_EXPORT void ComputeShapes (const TDF_Label &L)
 recursive

Standard_EXPORT void ComputeSimpleShapes ()
 Compute a sequence of simple shapes
.
virtual Standard_EXPORT void Delete () const
 Memory deallocator for transient classes.
virtual Standard_EXPORT
Handle_TDF_DeltaOnAddition 
DeltaOnAddition () const
virtual Standard_EXPORT
Handle_TDF_DeltaOnForget 
DeltaOnForget () const
virtual Standard_EXPORT void DeltaOnModification (const Handle(TDF_DeltaOnModification)&aDelta)
 Applies a DeltaOnModification to <me>.
.
virtual Standard_EXPORT
Handle_TDF_DeltaOnModification 
DeltaOnModification (const Handle(TDF_Attribute)&anOldAttribute) const
virtual Standard_EXPORT
Handle_TDF_DeltaOnRemoval 
DeltaOnRemoval () const
virtual Standard_EXPORT
Handle_TDF_DeltaOnResume 
DeltaOnResume () const
virtual Standard_EXPORT
Standard_OStream & 
Dump (Standard_OStream &anOS) const
Standard_EXPORT void Dump (const Standard_Boolean deep=Standard_False) const
virtual Standard_EXPORT const
Handle_Standard_Type & 
DynamicType () const
 Returns a type information object about this object.
virtual Standard_EXPORT const
Handle_Standard_Type & 
DynamicType () const
 Returns a type information object about this object.
virtual Standard_EXPORT void ExtendedDump (Standard_OStream &anOS, const TDF_IDFilter &aFilter, TDF_AttributeIndexedMap &aMap) const
Standard_EXPORT Standard_Boolean FindAttribute (const Standard_GUID &anID, Handle(TDF_Attribute)&anAttribute) const
Standard_EXPORT Standard_Boolean FindComponent (const TopoDS_Shape &theShape, TDF_LabelSequence &Labels) const
Standard_EXPORT TDF_Label FindMainShape (const TopoDS_Shape &sub) const
Standard_EXPORT TDF_Label FindMainShapeUsingMap (const TopoDS_Shape &sub) const
Standard_EXPORT TDF_Label FindShape (const TopoDS_Shape &S, const Standard_Boolean findInstance=Standard_False) const
Standard_EXPORT Standard_Boolean FindShape (const TopoDS_Shape &S, TDF_Label &L, const Standard_Boolean findInstance=Standard_False) const
Standard_EXPORT Standard_Boolean FindSubShape (const TDF_Label &shapeL, const TopoDS_Shape &sub, TDF_Label &L) const
Standard_EXPORT void Forget (const Standard_Integer aTransaction)
Standard_EXPORT void ForgetAllAttributes (const Standard_Boolean clearChildren=Standard_True) const
Standard_EXPORT Standard_Boolean ForgetAttribute (const Standard_GUID &aguid) const
Standard_EXPORT Standard_Boolean GetAllSHUOInstances (const Handle(XCAFDoc_GraphNode)&theSHUO, TopTools_SequenceOfShape &theSHUOShapeSeq) const
Standard_EXPORT void GetFreeShapes (TDF_LabelSequence &FreeLabels) const
Standard_EXPORT Standard_Integer GetRefCount () const
 Get the reference counter of this object.
Standard_EXPORT Standard_Integer GetRefCount () const
 Get the reference counter of this object.
Standard_EXPORT void GetShapes (TDF_LabelSequence &Labels) const
 Returns a sequence of all top-level shapes
.
Standard_EXPORT TopoDS_Shape GetSHUOInstance (const Handle(XCAFDoc_GraphNode)&theSHUO) const
Standard_EXPORT const Handle (Standard_Type)&DynamicType() const
virtual Standard_EXPORT
Standard_Integer 
HashCode (const Standard_Integer Upper) const
virtual Standard_EXPORT
Standard_Integer 
HashCode (const Standard_Integer Upper) const
Standard_EXPORT const
Standard_GUID & 
ID () const
Standard_EXPORT void Init ()
 set hasComponents into false

Standard_EXPORT Standard_Boolean IsAttribute (const Standard_GUID &anID) const
Standard_Boolean IsBackuped () const
Standard_Boolean IsForgotten () const
Standard_EXPORT Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName.
Standard_EXPORT Standard_Boolean IsInstance (const Handle_Standard_Type &theType) const
 Returns a true value if this is an instance of Type.
Standard_EXPORT Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName.
Standard_EXPORT Standard_Boolean IsInstance (const Handle_Standard_Type &theType) const
 Returns a true value if this is an instance of Type.
Standard_EXPORT Standard_Boolean IsKind (const Standard_CString theTypeName) const
Standard_EXPORT Standard_Boolean IsKind (const Handle_Standard_Type &theType) const
Standard_EXPORT Standard_Boolean IsKind (const Standard_CString theTypeName) const
Standard_EXPORT Standard_Boolean IsKind (const Handle_Standard_Type &theType) const
Standard_Boolean IsNew () const
Standard_EXPORT Standard_Boolean IsSubShape (const TDF_Label &shapeL, const TopoDS_Shape &sub) const
Standard_EXPORT Standard_Boolean IsTopLevel (const TDF_Label &L) const
Standard_Boolean IsValid () const
Standard_EXPORT const TDF_Label Label () const
Standard_EXPORT
Handle_TDF_Attribute 
NewEmpty () const
Standard_EXPORT TDF_Label NewShape () const
void operator delete (void *anAddress)
 Operator delete symmetric to operator new.
void operator delete (void *anAddress)
 Operator delete symmetric to operator new.
void * operator new (size_t size)
 Operator new for memory allocation uses Open CASCADE memory manager.
void * operator new (size_t, void *anAddress)
 Operator new for placement in pre-allocated memory.
void * operator new (size_t size)
 Operator new for memory allocation uses Open CASCADE memory manager.
void * operator new (size_t, void *anAddress)
 Operator new for placement in pre-allocated memory.
Standard_OStream & operator<< (Standard_OStream &anOS) const
Standard_EXPORT void Paste (const Handle(TDF_Attribute)&into, const Handle(TDF_RelocationTable)&RT) const
virtual Standard_EXPORT void References (const Handle(TDF_DataSet)&aDataSet) const
Standard_EXPORT void RemoveComponent (const TDF_Label &comp) const
 Removes a component from its assembly
.
Standard_EXPORT Standard_Boolean RemoveShape (const TDF_Label &L) const
Standard_EXPORT Standard_Boolean RemoveSHUO (const TDF_Label &SHUOLabel) const
Standard_EXPORT void Restore (const Handle(TDF_Attribute)&with)
Standard_EXPORT Standard_Boolean Search (const TopoDS_Shape &S, TDF_Label &L, const Standard_Boolean findInstance=Standard_True, const Standard_Boolean findComponent=Standard_True, const Standard_Boolean findSubshape=Standard_True) const
Standard_EXPORT Standard_Boolean SearchUsingMap (const TopoDS_Shape &S, TDF_Label &L, const Standard_Boolean findWithoutLoc, const Standard_Boolean findSubshape) const
Standard_EXPORT void SetExternRefs (const TDF_Label &L, const TColStd_SequenceOfHAsciiString &SHAS) const
 Sets the names of references on the no-step files
.
Standard_EXPORT TDF_Label SetExternRefs (const TColStd_SequenceOfHAsciiString &SHAS) const
 Sets the names of references on the no-step files
.
Standard_EXPORT
Handle_XCAFDoc_GraphNode 
SetInstanceSHUO (const TopoDS_Shape &theShape) const
Standard_EXPORT void SetShape (const TDF_Label &L, const TopoDS_Shape &S)
 Sets representation (TopoDS_Shape) for top-level shape
.
Standard_EXPORT Standard_Boolean SetSHUO (const TDF_LabelSequence &Labels, Handle(XCAFDoc_GraphNode)&MainSHUOAttr) const
virtual Standard_EXPORT void ShallowDump (Standard_OStream &) const
virtual Standard_EXPORT void ShallowDump (Standard_OStream &) const
virtual Standard_EXPORT
Handle_Standard_Transient 
This () const
virtual Standard_EXPORT
Handle_Standard_Transient 
This () const
Standard_Integer Transaction () const
Standard_EXPORT Standard_Integer UntilTransaction () const
Standard_EXPORT void UpdateAssembly (const TDF_Label &L) const
 Update an assembly at label <L>
.
Standard_EXPORT XCAFDoc_ShapeTool ()

Static Public Member Functions

static Standard_EXPORT void DumpShape (const TDF_Label &L, const Standard_Integer level=0, const Standard_Boolean deep=Standard_False)
static Standard_EXPORT
Standard_Boolean 
FindSHUO (const TDF_LabelSequence &Labels, Handle(XCAFDoc_GraphNode)&theSHUOAttr)
static Standard_EXPORT
Standard_Boolean 
GetAllComponentSHUO (const TDF_Label &CompLabel, TDF_AttributeSequence &SHUOAttrs)
static Standard_EXPORT
Standard_Boolean 
GetComponents (const TDF_Label &L, TDF_LabelSequence &Labels, const Standard_Boolean getsubchilds=Standard_False)
static Standard_EXPORT void GetExternRefs (const TDF_Label &L, TColStd_SequenceOfHAsciiString &SHAS)
 Gets the names of references on the no-step files
.
static Standard_EXPORT const
Standard_GUID & 
GetID ()
static Standard_EXPORT
TopLoc_Location 
GetLocation (const TDF_Label &L)
 Returns location of instance
.
static Standard_EXPORT
Standard_Boolean 
GetReferredShape (const TDF_Label &L, TDF_Label &Label)
static Standard_EXPORT TopoDS_Shape GetShape (const TDF_Label &L)
static Standard_EXPORT
Standard_Boolean 
GetShape (const TDF_Label &L, TopoDS_Shape &S)
static Standard_EXPORT
Standard_Boolean 
GetSHUO (const TDF_Label &SHUOLabel, Handle(XCAFDoc_GraphNode)&aSHUOAttr)
static Standard_EXPORT
Standard_Boolean 
GetSHUONextUsage (const TDF_Label &UpperUsageL, TDF_LabelSequence &Labels)
static Standard_EXPORT
Standard_Boolean 
GetSHUOUpperUsage (const TDF_Label &NextUsageL, TDF_LabelSequence &Labels)
static Standard_EXPORT
Standard_Boolean 
GetSubShapes (const TDF_Label &L, TDF_LabelSequence &Labels)
static Standard_EXPORT
Standard_Integer 
GetUsers (const TDF_Label &L, TDF_LabelSequence &Labels, const Standard_Boolean getsubchilds=Standard_False)
static Standard_EXPORT
Standard_Boolean 
IsAssembly (const TDF_Label &L)
static Standard_EXPORT
Standard_Boolean 
IsComponent (const TDF_Label &L)
static Standard_EXPORT
Standard_Boolean 
IsCompound (const TDF_Label &L)
static Standard_EXPORT
Standard_Boolean 
IsExternRef (const TDF_Label &L)
static Standard_EXPORT
Standard_Boolean 
IsFree (const TDF_Label &L)
static Standard_EXPORT
Standard_Boolean 
IsReference (const TDF_Label &L)
static Standard_EXPORT
Standard_Boolean 
IsShape (const TDF_Label &L)
static Standard_EXPORT
Standard_Boolean 
IsSimpleShape (const TDF_Label &L)
 Returns True if the label is a label of simple shape
.
static Standard_EXPORT
Standard_Boolean 
IsSubShape (const TDF_Label &L)
 Return true if <L> is subshape of the top-level shape
.
static Standard_EXPORT
Standard_Integer 
NbComponents (const TDF_Label &L, const Standard_Boolean getsubchilds=Standard_False)
 Returns number of Assembles components
.
static Standard_EXPORT
Handle_XCAFDoc_ShapeTool 
Set (const TDF_Label &L)
 Create (if not exist) ShapeTool from XCAFDoc on <L>.
.

Private Member Functions

Standard_EXPORT TDF_Label addShape (const TopoDS_Shape &S, const Standard_Boolean makeAssembly=Standard_True)

Static Private Member Functions

static Standard_EXPORT void MakeReference (const TDF_Label &L, const TDF_Label &refL, const TopLoc_Location &loc)

Private Attributes

Standard_Boolean hasSimpleShapes
XCAFDoc_DataMapOfShapeLabel myShapeLabels
XCAFDoc_DataMapOfShapeLabel mySimpleShapes
XCAFDoc_DataMapOfShapeLabel mySubShapes

Friends

class TDF_AttributeIterator
class TDF_Data
class TDF_DeltaOnForget
class TDF_Label
class TDF_LabelNode

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index