Salome HOME
Fix for issue #1000
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Transform.cpp
index 65840c27357c821b210229751b1f7ac995c314ce..8c7cefb3229ddf1a2eb33a9b9d169e29f06657bd 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <GeomAlgoAPI_Transform.h>
 
-#include <GeomAlgoAPI_ShapeProps.h>
+#include <GeomAlgoAPI_ShapeTools.h>
 
 #include <BRepBuilderAPI_Transform.hxx>
 #include <BRepCheck_Analyzer.hxx>
 GeomAlgoAPI_Transform::GeomAlgoAPI_Transform(std::shared_ptr<GeomAPI_Shape> theSourceShape,
                                              std::shared_ptr<GeomAPI_Trsf>  theTrsf)
 : myDone(false),
-  myTrsf(theTrsf),
-  myShape(new GeomAPI_Shape()),
-  myMap(new GeomAPI_DataMapOfShapeShape()),
-  myMkShape(new GeomAlgoAPI_MakeShape())
+  myTrsf(theTrsf)
 {
   build(theSourceShape, theTrsf);
 }
@@ -44,6 +41,7 @@ void GeomAlgoAPI_Transform::build(std::shared_ptr<GeomAPI_Shape> theSourceShape,
   if(!aBuilder) {
     return;
   }
+  myMkShape.reset(new GeomAlgoAPI_MakeShape(aBuilder));
 
   myDone = aBuilder->IsDone() == Standard_True;
   if(!myDone) {
@@ -53,13 +51,14 @@ void GeomAlgoAPI_Transform::build(std::shared_ptr<GeomAPI_Shape> theSourceShape,
   TopoDS_Shape aResult = aBuilder->Shape();
 
   // Fill data map to keep correct orientation of sub-shapes.
+  myMap.reset(new GeomAPI_DataMapOfShapeShape());
   for(TopExp_Explorer anExp(aResult, TopAbs_FACE); anExp.More(); anExp.Next()) {
     std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
     aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
     myMap->bind(aCurrentShape, aCurrentShape);
   }
 
-  myMkShape->setImpl(aBuilder);
+  myShape.reset(new GeomAPI_Shape());
   myShape->setImpl(new TopoDS_Shape(aResult));
 }
 
@@ -74,7 +73,7 @@ const bool GeomAlgoAPI_Transform::isValid() const
 const bool GeomAlgoAPI_Transform::hasVolume() const
 {
   bool hasVolume(false);
-  if(isValid() && (GeomAlgoAPI_ShapeProps::volume(myShape) > Precision::Confusion())) {
+  if(isValid() && (GeomAlgoAPI_ShapeTools::volume(myShape) > Precision::Confusion())) {
     hasVolume = true;
   }
   return hasVolume;