From: Artem Zhidkov Date: Wed, 16 Sep 2020 13:16:09 +0000 (+0300) Subject: Fix regressions after resolving issue #19890 (part II) X-Git-Tag: V9_6_0a1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c8382619ef38cf99efa1771f46e567becfe1a114;p=modules%2Fshaper.git Fix regressions after resolving issue #19890 (part II) --- diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index 7c42dd987..fb3eb3bed 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -189,6 +189,26 @@ bool Model_ResultPart::setDisabled(std::shared_ptr theThis, return false; } +static GeomShapePtr transformShape(const GeomShapePtr theShape, const gp_Trsf& theTrsf) +{ + GeomShapePtr aResult(new GeomAPI_Shape); + if (theTrsf.ScaleFactor() > 0) { + // just update the location of the shape in case of affine transformation + TopoDS_Shape aShape = theShape->impl(); + if (!aShape.IsNull()) { + aShape.Move(theTrsf); + aResult->setImpl(new TopoDS_Shape(aShape)); + } + } + else { + // all other transformations will modify the shape + GeomTrsfPtr aTrsf = std::make_shared(new gp_Trsf(theTrsf)); + GeomAlgoAPI_Transform aTransform(theShape, aTrsf); + aResult = aTransform.shape(); + } + return aResult; +} + std::shared_ptr Model_ResultPart::shape() { std::shared_ptr aResult(new GeomAPI_Shape); @@ -199,9 +219,7 @@ std::shared_ptr Model_ResultPart::shape() ResultPtr anOrigResult = baseRef(); std::shared_ptr anOrigShape = anOrigResult->shape(); if (anOrigShape.get()) { - GeomTrsfPtr aTrsf = std::make_shared(new gp_Trsf(*myTrsf)); - GeomAlgoAPI_Transform aTransform(anOrigShape, aTrsf); - aResult = aTransform.shape(); + aResult = transformShape(anOrigShape, *myTrsf); myShape = aResult->impl(); } if (!myShape.IsNull() && aToSendUpdate) {