Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager)
: Priority (Structure_MAX_PRIORITY / 2),
PreviousPriority (Structure_MAX_PRIORITY / 2),
- ContainsFacet (0),
//
myGraphicDriver (theManager->GraphicDriver()),
myZLayer (Graphic3d_ZLayerId_Default),
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayer)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Priority)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, PreviousPriority)
- OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, ContainsFacet)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsInfinite)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, stick)
Standard_Integer Priority;
Standard_Integer PreviousPriority;
- Standard_Integer ContainsFacet;
-
protected:
//! Create empty structure.
}
}
-// =======================================================================
-// function : ContainsFacet
-// purpose :
-// =======================================================================
-Standard_Boolean Graphic3d_CView::ContainsFacet() const
-{
- for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
- {
- if (aStructIter.Key()->ContainsFacet())
- {
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
-// =======================================================================
-// function : ContainsFacet
-// purpose :
-// =======================================================================
-Standard_Boolean Graphic3d_CView::ContainsFacet (const Graphic3d_MapOfStructure& theSet) const
-{
- for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (theSet); aStructIter.More(); aStructIter.Next())
- {
- if (aStructIter.Key()->ContainsFacet())
- {
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
// =======================================================================
// function : DisplayedStructures
// purpose :
//! Computes the new presentation of the structures displayed in this view with the type Graphic3d_TOS_COMPUTED.
Standard_EXPORT void Compute();
- //! Returns Standard_True if one of the structures displayed in the view contains Polygons, Triangles or Quadrangles.
- Standard_EXPORT Standard_Boolean ContainsFacet() const;
-
- //! Returns Standard_True if one of the structures in the set contains Polygons, Triangles or Quadrangles.
- Standard_EXPORT Standard_Boolean ContainsFacet (const Graphic3d_MapOfStructure& theSet) const;
-
//! Returns the set of structures displayed in this view.
Standard_EXPORT void DisplayedStructures (Graphic3d_MapOfStructure& theStructures) const;
// purpose :
// =======================================================================
Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& theStruct)
-: myStructure (theStruct.operator->()),
- myIsClosed (false),
- myContainsFacet (false)
+: myStructure(theStruct.operator->()),
+ myIsClosed (false)
{
//
}
myBounds.Clear();
- if (myContainsFacet)
- {
- myStructure->GroupsWithFacet (-1);
- myContainsFacet = false;
- }
-
// clear method could be used on Graphic3d_Structure destruction,
// and its structure manager could be already destroyed, in that
// case we don't need to update it;
return;
}
- if (myContainsFacet)
- {
- myStructure->GroupsWithFacet (-1);
- myContainsFacet = false;
- }
myStructure->Remove (this);
Update();
const Handle(Graphic3d_BoundBuffer)& ,
const Standard_Boolean theToEvalMinMax)
{
+ (void )theType;
if (IsDeleted()
|| theAttribs.IsNull())
{
return;
}
- if (!myContainsFacet
- && theType != Graphic3d_TOPA_POLYLINES
- && theType != Graphic3d_TOPA_SEGMENTS
- && theType != Graphic3d_TOPA_POINTS)
- {
- myStructure->GroupsWithFacet (1);
- myContainsFacet = true;
- }
-
if (!theToEvalMinMax)
{
Update();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBounds)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsClosed)
- OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myContainsFacet)
}
//! Set transformation persistence.
Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
- //! Returns true if the group contains Polygons, Triangles or Quadrangles.
- bool ContainsFacet() const { return myContainsFacet; }
-
//! Returns Standard_True if the group <me> is deleted.
//! <me> is deleted after the call Remove (me) or the
//! associated structure is deleted.
Graphic3d_Structure* myStructure; //!< pointer to the parent structure
Graphic3d_BndBox4f myBounds; //!< bounding box
bool myIsClosed; //!< flag indicating closed volume
- bool myContainsFacet; //!< flag indicating that this group contains face primitives
};
// clean groups in graphics driver at first
GraphicClear (theWithDestruction);
- myCStructure->ContainsFacet = 0;
myCStructure->SetGroupTransformPersistence (false);
myStructureManager->Clear (this, theWithDestruction);
}
}
-//=============================================================================
-//function : ContainsFacet
-//purpose :
-//=============================================================================
-Standard_Boolean Graphic3d_Structure::ContainsFacet() const
-{
- if (IsDeleted())
- {
- return Standard_False;
- }
- else if (myCStructure->ContainsFacet > 0)
- {
- // if one of groups contains at least one facet, the structure contains it too
- return Standard_True;
- }
-
- // stop at the first descendant containing at least one facet
- for (NCollection_IndexedMap<Graphic3d_Structure*>::Iterator anIter (myDescendants); anIter.More(); anIter.Next())
- {
- if (anIter.Value()->ContainsFacet())
- {
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
//=============================================================================
//function : IsEmpty
//purpose :
return Standard_True;
}
-//=============================================================================
-//function : GroupsWithFacet
-//purpose :
-//=============================================================================
-void Graphic3d_Structure::GroupsWithFacet (const Standard_Integer theDelta)
-{
- myCStructure->ContainsFacet = myCStructure->ContainsFacet + theDelta;
- if (myCStructure->ContainsFacet < 0)
- {
- myCStructure->ContainsFacet = 0;
- }
-}
-
//=============================================================================
//function : ReCompute
//purpose :
//! if <me> is displayed in <aProjetor> and TOS_COMPUTED.
Standard_EXPORT void ReCompute (const Handle(Graphic3d_DataStructureManager)& aProjector);
- //! Returns Standard_True if the structure <me> contains
- //! Polygons, Triangles or Quadrangles.
- Standard_EXPORT Standard_Boolean ContainsFacet() const;
-
//! Returns the groups sequence included in this structure.
const Graphic3d_SequenceOfGroup& Groups() const { return myCStructure->Groups(); }
//! It will be erased at the next screen update.
Standard_EXPORT void Remove (const Handle(Graphic3d_Group)& theGroup);
- //! Manages the number of groups in the structure <me>
- //! which contains facet.
- //! Polygons, Triangles or Quadrangles.
- //! <ADelta> = +1 or -1
- Standard_EXPORT void GroupsWithFacet (const Standard_Integer ADelta);
-
//! Returns the extreme coordinates found in the structure <me> without transformation applied.
Standard_EXPORT Graphic3d_BndBox4f minMaxCoord() const;
Handle(OpenGl_StructureShadow) aShadow = Handle(OpenGl_StructureShadow)::DownCast (theStructure);
myParent = aShadow.IsNull() ? theStructure : aShadow->myParent;
- ContainsFacet = myParent->ContainsFacet;
IsInfinite = myParent->IsInfinite;
myBndBox = myParent->BoundingBox();