Salome HOME
#2027 Sketcher Trim Feature: 1. preview/selected attributes in trim; 2. avoid includi...
[modules/shaper.git] / src / ModelGeomAlgo / ModelGeomAlgo_Shape.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_Tools.cpp
4 // Created:     19 Mar 2017
5 // Author:      Natalia ERMOLAEVA
6
7 #include <GeomAPI_Shape.h>
8
9 #include "ModelGeomAlgo_Shape.h"
10
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Result.h>
13
14
15 #ifdef WIN32
16 #pragma warning(disable : 4996) // for sprintf
17 #endif
18
19 namespace ModelGeomAlgo_Shape
20 {
21   void shapesOfType(const FeaturePtr& theFeature,
22                     const GeomAPI_Shape::ShapeType& theType,
23                     std::set<ResultPtr>& theShapeResults)
24   {
25     theShapeResults.clear();
26     std::list<ResultPtr> aResults = theFeature->results();
27     std::list<ResultPtr>::const_iterator aRIter = aResults.cbegin();
28     for (; aRIter != aResults.cend(); aRIter++) {
29       ResultPtr aResult = *aRIter;
30       GeomShapePtr aShape = aResult->shape();
31       if (aShape.get() && aShape->shapeType() == theType)
32         theShapeResults.insert(aResult);
33     }
34   }
35 } // namespace ModelGeomAlgo_Shape