Salome HOME
Issue #604 Creation of an unexpected line in the Sketcher
[modules/shaper.git] / src / ModelAPI / ModelAPI_Tools.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_Tools.h
4 // Created:     06 Aug 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef ModelAPI_Tools_HeaderFile
8 #define ModelAPI_Tools_HeaderFile
9
10 #include "ModelAPI.h"
11 #include <ModelAPI_Result.h>
12 #include <ModelAPI_ResultParameter.h>
13 #include <ModelAPI_Document.h>
14 #include <ModelAPI_Feature.h>
15 #include <GeomAPI_Shape.h>
16
17 #include <vector>
18
19 namespace ModelAPI_Tools {
20 /// Returns shape from the given Result object
21 MODELAPI_EXPORT std::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult);
22
23 /*!
24  * Searches for variable with name \param theName in the active document (Part), when
25  * in the root document (PartSet). If found, set it value in the \param outValue
26  * and returns true.
27  */
28 MODELAPI_EXPORT bool findVariable(const std::string& theName, double& outValue, 
29   ResultParameterPtr& theParam);
30
31 /*!
32  * Returns the values of the next random color. The values are in range [0, 255]
33  * \param theValues a container of component of RGB value: red, green, blue
34  */
35 MODELAPI_EXPORT void findRandomColor(std::vector<int>& theValues);
36
37 /*!
38  * Searches for Part result that contains the reference to the given document.
39  * \param theMain document that contains the searched feature
40  * \param theSub document that is searched, the resulting feature references to it
41  * \returns numm if not found
42  */
43 MODELAPI_EXPORT ResultPtr findPartResult(const DocumentPtr& theMain, const DocumentPtr& theSub);
44
45 }
46
47 #endif