Salome HOME
Boost has been removed from code
[modules/shaper.git] / src / ModelAPI / ModelAPI_Tools.cpp
1 // File:        ModelAPI_Tools.cpp
2 // Created:     06 Aug 2014
3 // Author:      Vitaly Smetannikov
4
5 #include "ModelAPI_Tools.h"
6 #include <ModelAPI_ResultBody.h>
7 #include <ModelAPI_ResultConstruction.h>
8 #include <ModelAPI_ResultGroup.h>
9
10 namespace ModelAPI_Tools {
11
12   std::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult)
13   {
14
15     ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
16     if (aBody)
17       return aBody->shape();
18
19     ResultConstructionPtr aConstruct = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
20       theResult);
21     if (aConstruct)
22       return aConstruct->shape();
23
24     ResultGroupPtr aGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(theResult);
25     if (aGroup)
26       return aGroup->shape();
27     return std::shared_ptr<GeomAPI_Shape>();
28   }
29 }