From: mpv Date: Thu, 8 Sep 2016 07:40:06 +0000 (+0300) Subject: Fix for the issue #1733 : collect all the transformations in part-transformation... X-Git-Tag: V_2.5.0~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c55c087c730ab3708439e36bc0204f824c10f53c;p=modules%2Fshaper.git Fix for the issue #1733 : collect all the transformations in part-transformation features. --- diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index f1e51b21f..105a9c1a0 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -283,6 +283,15 @@ bool Model_ResultPart::updateInPart(const int theIndex) return false; // something is wrong } +gp_Trsf Model_ResultPart::sumTrsf() { + gp_Trsf aResult; + if (myTrsf) { + aResult = *myTrsf; + aResult = aResult * baseRef()->sumTrsf(); + } + return aResult; +} + std::shared_ptr Model_ResultPart::shapeInPart( const std::string& theName, const std::string& theType, int& theIndex) { @@ -305,6 +314,11 @@ std::shared_ptr Model_ResultPart::shapeInPart( aSelAttr->append(theName, theType); theIndex = aSelAttr->size(); aResult = aSelAttr->value(theIndex - 1)->value(); + if (myTrsf.get() && aResult.get() && !aResult->isNull()) { + gp_Trsf aSumTrsf = sumTrsf(); + TopoDS_Shape anOrigMoved = aResult->impl().Moved(aSumTrsf); + aResult->setImpl(new TopoDS_Shape(anOrigMoved)); + } return aResult; } @@ -317,6 +331,11 @@ std::shared_ptr Model_ResultPart::selectionValue(const int theInd AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature(); aResult = aSelAttr->value(theIndex - 1)->value(); + if (myTrsf.get() && aResult.get() && !aResult->isNull()) { + gp_Trsf aSumTrsf = sumTrsf(); + TopoDS_Shape anOrigMoved = aResult->impl().Moved(aSumTrsf); + aResult->setImpl(new TopoDS_Shape(anOrigMoved)); + } return aResult; } diff --git a/src/Model/Model_ResultPart.h b/src/Model/Model_ResultPart.h index 49adb855a..e42df61e8 100644 --- a/src/Model/Model_ResultPart.h +++ b/src/Model/Model_ResultPart.h @@ -79,6 +79,9 @@ protected: /// makes a result on a temporary feature (an action) Model_ResultPart(); + /// returns sum of transformations of the whole sequence of transformation-parts + gp_Trsf sumTrsf(); + /// Returns true if document is activated (loaded into the memory) virtual bool isActivated();