Salome HOME
Fix for the issue #1733 : collect all the transformations in part-transformation...
authormpv <mpv@opencascade.com>
Thu, 8 Sep 2016 07:40:06 +0000 (10:40 +0300)
committermpv <mpv@opencascade.com>
Thu, 8 Sep 2016 07:40:06 +0000 (10:40 +0300)
src/Model/Model_ResultPart.cpp
src/Model/Model_ResultPart.h

index f1e51b21f208fa684e288af6d21b2684635d222c..105a9c1a07572cafb9ebb10da55ce0655652b618 100644 (file)
@@ -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<GeomAPI_Shape> Model_ResultPart::shapeInPart(
   const std::string& theName, const std::string& theType, int& theIndex)
 {
@@ -305,6 +314,11 @@ std::shared_ptr<GeomAPI_Shape> 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<TopoDS_Shape>().Moved(aSumTrsf);
+    aResult->setImpl(new TopoDS_Shape(anOrigMoved));
+  }
   return aResult;
 }
 
@@ -317,6 +331,11 @@ std::shared_ptr<GeomAPI_Shape> 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<TopoDS_Shape>().Moved(aSumTrsf);
+    aResult->setImpl(new TopoDS_Shape(anOrigMoved));
+  }
   return aResult;
 }
 
index 49adb855ae316261456e5d9460e83dc17b9ca4cb..e42df61e8f6726c171dc4bf6bde032fe9543f216 100644 (file)
@@ -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();