From 94c0b2267fd680580912e1554ebc9ef0343d5924 Mon Sep 17 00:00:00 2001 From: dish Date: Thu, 13 Jun 2024 12:09:25 +0000 Subject: [PATCH] [bos #35154][EDF](2023-T1) Edge thickness. Remove duplicated methods. --- src/Model/Model_Document.h | 8 ------ src/Model/Model_Objects.cpp | 9 ++----- src/Model/Model_ResultBody.cpp | 44 +------------------------------- src/ModelAPI/ModelAPI_Document.h | 8 ------ 4 files changed, 3 insertions(+), 66 deletions(-) diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 7fe1e21eb..f8e40c760 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -154,14 +154,6 @@ class Model_Document : public ModelAPI_Document std::shared_ptr theShape, const bool theAllowFolder = false); - //! Returns the shape index in the result. - //! \param theResult result - //! \param theShape result subshape - //! \returns index started from zero, or -1 if shape is not stored or is not a subshape of the result - MODEL_EXPORT virtual const int index(std::shared_ptr theResult, - std::shared_ptr theShape, - const bool theAllowFolder = false); - //! Internal sub-document by ID MODEL_EXPORT virtual std::shared_ptr subDoc(int theDocID); diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index cd69e1623..ffdd25689 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -807,7 +807,7 @@ void Model_Objects::setAttribute(const Handle(TDF_Attribute)& theAttribute, aResultLabel = resultLabel(theResult->data(), index(theResult)); TDF_Label anAttributeLabel = subShapeLabel(aResultLabel, index(theResult, theShape)).FindChild(TAG_FEATURE_ARGUMENTS); - if (Standard_GUID::IsEqual(theAttribute->ID(), TDataStd_IntegerArray::GetID())) + if (theAttribute->ID() == TDataStd_IntegerArray::GetID()) { Handle(TDataStd_IntegerArray) anColor; Handle(TDataStd_IntegerArray) anAttr = @@ -855,7 +855,7 @@ Handle(TDF_Attribute) Model_Objects::getAttribute(const Standard_GUID& theID, TDF_Label anAttributeLabel = subShapeLabel(aResultLabel, anIndex).FindChild(TAG_FEATURE_ARGUMENTS); Handle(TDF_Attribute) anAttr; - anAttributeLabel.FindAttribute(theID, anAttr); // ? TDataStd_IntegerArray::GetID() or TDataStd_Integer::GetID() + anAttributeLabel.FindAttribute(theID, anAttr); return anAttr; } @@ -922,11 +922,6 @@ void Model_Objects::removeShapeColors(const std::shared_ptr the } } -TDF_Label Model_Objects::shapesFromResult(TDF_Label theResult) const -{ - return theResult.Father().FindChild(TAG_RESULT_SHAPES); -} - void Model_Objects::getSubShapesWithEdgeThickness( const std::shared_ptr theResult, std::map, int>& oShapes diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 8c2a2af58..2368d0e8c 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -298,49 +299,6 @@ void Model_ResultBody::getSubShapesWithEdgeThickness( anObjects->getSubShapesWithEdgeThickness(theResult, oShapes); } -void Model_ResultBody::setSubShapeEdgeThickness( - const std::shared_ptr theResult, - const std::shared_ptr theSubShape, - int theEdgeThickness -) -{ - TopoDS_Shape aShape = shape()->impl(); - TopoDS_Shape aSubShape = theSubShape->impl(); - if (!shape()->isSubShape(theSubShape)) - return; - - Model_Objects* anObjects = std::dynamic_pointer_cast(document())->objects(); - document()->storeShape(data(), theResult, theSubShape); - - Handle(TDataStd_Integer) aThickness = new TDataStd_Integer(); - aThickness->Set(theEdgeThickness); - anObjects->setAttribute(aThickness, theResult, theSubShape); -} - -int Model_ResultBody::getSubShapeEdgeThickness(const std::shared_ptr theResult, const std::shared_ptr theSubShape) const -{ - TopoDS_Shape aShape = shape()->impl(); - TopoDS_Shape aSubShape = theSubShape->impl(); - if (!shape()->isSubShape(theSubShape)) - return -1; - - Model_Objects* anObjects = std::dynamic_pointer_cast(document())->objects(); - auto anAttr = Handle(TDataStd_Integer)::DownCast(anObjects->getAttribute(TDataStd_Integer::GetID(), theResult, theSubShape)); - if (anAttr.IsNull()) - return; - - return anAttr->Get(); -} - -void Model_ResultBody::getSubShapesWithEdgeThickness( - const std::shared_ptr theResult, - std::map, int>& oShapes -) const -{ - Model_Objects* anObjects = std::dynamic_pointer_cast(document())->objects(); - anObjects->getSubShapesWithEdgeThickness(theResult, oShapes); -} - void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector& color) { if (myColorsShape.find(theName) == myColorsShape.end()) diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index da907084d..64f638942 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -117,14 +117,6 @@ public: std::shared_ptr theShape, const bool theAllowFolder = false) = 0; - //! Returns the shape index in the result. - //! \param theResult result - //! \param theShape result subshape - //! \returns index started from zero, or -1 if shape is not stored or is not a subshape of the result - virtual const int index(std::shared_ptr theResult, - std::shared_ptr theShape, - const bool theAllowFolder = false) = 0; - //! Returns the number of objects in the group of objects //! \param theGroupID group of objects //! \param theAllowFolder take into account grouping feature by folders -- 2.39.2