From bf2884afbe96274c90c6de5427ad8ae1886147ab Mon Sep 17 00:00:00 2001 From: kgv Date: Wed, 8 Dec 2021 14:10:11 +0300 Subject: [PATCH] 0032724: Coding Rules, Graphic3d_Structure - remove unused property Graphic3d_Structure::ContainsFacet() --- src/Graphic3d/Graphic3d_CStructure.cxx | 2 -- src/Graphic3d/Graphic3d_CStructure.hxx | 2 -- src/Graphic3d/Graphic3d_CView.cxx | 32 -------------------- src/Graphic3d/Graphic3d_CView.hxx | 6 ---- src/Graphic3d/Graphic3d_Group.cxx | 27 ++--------------- src/Graphic3d/Graphic3d_Group.hxx | 4 --- src/Graphic3d/Graphic3d_Structure.cxx | 41 -------------------------- src/Graphic3d/Graphic3d_Structure.hxx | 10 ------- src/OpenGl/OpenGl_StructureShadow.cxx | 1 - 9 files changed, 3 insertions(+), 122 deletions(-) diff --git a/src/Graphic3d/Graphic3d_CStructure.cxx b/src/Graphic3d/Graphic3d_CStructure.cxx index e60815de53..bfde61d4b0 100644 --- a/src/Graphic3d/Graphic3d_CStructure.cxx +++ b/src/Graphic3d/Graphic3d_CStructure.cxx @@ -29,7 +29,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CStructure,Standard_Transient) 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), @@ -67,7 +66,6 @@ void Graphic3d_CStructure::DumpJson (Standard_OStream& theOStream, Standard_Inte 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) diff --git a/src/Graphic3d/Graphic3d_CStructure.hxx b/src/Graphic3d/Graphic3d_CStructure.hxx index 1210025d75..b80d78ba44 100644 --- a/src/Graphic3d/Graphic3d_CStructure.hxx +++ b/src/Graphic3d/Graphic3d_CStructure.hxx @@ -211,8 +211,6 @@ public: Standard_Integer Priority; Standard_Integer PreviousPriority; - Standard_Integer ContainsFacet; - protected: //! Create empty structure. diff --git a/src/Graphic3d/Graphic3d_CView.cxx b/src/Graphic3d/Graphic3d_CView.cxx index 1461965552..6718b60ebf 100644 --- a/src/Graphic3d/Graphic3d_CView.cxx +++ b/src/Graphic3d/Graphic3d_CView.cxx @@ -384,38 +384,6 @@ void Graphic3d_CView::InvalidateZLayerBoundingBox (const Graphic3d_ZLayerId theL } } -// ======================================================================= -// 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 : diff --git a/src/Graphic3d/Graphic3d_CView.hxx b/src/Graphic3d/Graphic3d_CView.hxx index 6373a8dfb5..13cf37e1eb 100644 --- a/src/Graphic3d/Graphic3d_CView.hxx +++ b/src/Graphic3d/Graphic3d_CView.hxx @@ -134,12 +134,6 @@ public: //! 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; diff --git a/src/Graphic3d/Graphic3d_Group.cxx b/src/Graphic3d/Graphic3d_Group.cxx index ad202ca899..1a704ec9d7 100644 --- a/src/Graphic3d/Graphic3d_Group.cxx +++ b/src/Graphic3d/Graphic3d_Group.cxx @@ -47,9 +47,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Group,Standard_Transient) // purpose : // ======================================================================= Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& theStruct) -: myStructure (theStruct.operator->()), - myIsClosed (false), - myContainsFacet (false) +: myStructure(theStruct.operator->()), + myIsClosed (false) { // } @@ -77,12 +76,6 @@ void Graphic3d_Group::Clear (Standard_Boolean theUpdateStructureMgr) 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; @@ -103,11 +96,6 @@ void Graphic3d_Group::Remove() return; } - if (myContainsFacet) - { - myStructure->GroupsWithFacet (-1); - myContainsFacet = false; - } myStructure->Remove (this); Update(); @@ -255,21 +243,13 @@ void Graphic3d_Group::AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray th 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(); @@ -481,5 +461,4 @@ void Graphic3d_Group::DumpJson (Standard_OStream& theOStream, Standard_Integer t OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBounds) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsClosed) - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myContainsFacet) } diff --git a/src/Graphic3d/Graphic3d_Group.hxx b/src/Graphic3d/Graphic3d_Group.hxx index c8462b90c7..47db10e404 100644 --- a/src/Graphic3d/Graphic3d_Group.hxx +++ b/src/Graphic3d/Graphic3d_Group.hxx @@ -140,9 +140,6 @@ public: //! 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 is deleted. //! is deleted after the call Remove (me) or the //! associated structure is deleted. @@ -301,7 +298,6 @@ protected: 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 }; diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index cfe5ff8ecc..062b264097 100644 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -85,7 +85,6 @@ void Graphic3d_Structure::clear (const Standard_Boolean theWithDestruction) // clean groups in graphics driver at first GraphicClear (theWithDestruction); - myCStructure->ContainsFacet = 0; myCStructure->SetGroupTransformPersistence (false); myStructureManager->Clear (this, theWithDestruction); @@ -294,33 +293,6 @@ void Graphic3d_Structure::UnHighlight() } } -//============================================================================= -//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::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) - { - if (anIter.Value()->ContainsFacet()) - { - return Standard_True; - } - } - return Standard_False; -} - //============================================================================= //function : IsEmpty //purpose : @@ -355,19 +327,6 @@ Standard_Boolean Graphic3d_Structure::IsEmpty() const 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 : diff --git a/src/Graphic3d/Graphic3d_Structure.hxx b/src/Graphic3d/Graphic3d_Structure.hxx index 04fa9348e5..8b9e438173 100644 --- a/src/Graphic3d/Graphic3d_Structure.hxx +++ b/src/Graphic3d/Graphic3d_Structure.hxx @@ -198,10 +198,6 @@ public: //! if is displayed in and TOS_COMPUTED. Standard_EXPORT void ReCompute (const Handle(Graphic3d_DataStructureManager)& aProjector); - //! Returns Standard_True if the structure 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(); } @@ -477,12 +473,6 @@ private: //! 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 - //! which contains facet. - //! Polygons, Triangles or Quadrangles. - //! = +1 or -1 - Standard_EXPORT void GroupsWithFacet (const Standard_Integer ADelta); - //! Returns the extreme coordinates found in the structure without transformation applied. Standard_EXPORT Graphic3d_BndBox4f minMaxCoord() const; diff --git a/src/OpenGl/OpenGl_StructureShadow.cxx b/src/OpenGl/OpenGl_StructureShadow.cxx index 64672018d6..c068661e43 100644 --- a/src/OpenGl/OpenGl_StructureShadow.cxx +++ b/src/OpenGl/OpenGl_StructureShadow.cxx @@ -31,7 +31,6 @@ OpenGl_StructureShadow::OpenGl_StructureShadow (const Handle(Graphic3d_Structure Handle(OpenGl_StructureShadow) aShadow = Handle(OpenGl_StructureShadow)::DownCast (theStructure); myParent = aShadow.IsNull() ? theStructure : aShadow->myParent; - ContainsFacet = myParent->ContainsFacet; IsInfinite = myParent->IsInfinite; myBndBox = myParent->BoundingBox();