Salome HOME
Task 2.7. Horizontal and Vertical Distance constraint
[modules/shaper.git] / src / SketchSolver / SketchSolver_Error.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_Error.h
4 // Created: 29 Mar 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_Error_H_
8 #define SketchSolver_Error_H_
9
10 #include <string>
11
12 /** \class SketchSolver_Error
13  *  \ingroup Plugins
14  *  \brief Collects all sketch solver error' codes
15  *         as inline static functions
16  */
17 class SketchSolver_Error
18 {
19  public:
20   /// The value parameter for the constraint
21   inline static const std::string& CONSTRAINTS()
22   {
23     static const std::string MY_ERROR_VALUE("The constraint is conflicting with others. "
24       "To fix this, you can either undo your operation or remove a conflicting constraint.");
25     return MY_ERROR_VALUE;
26   }
27   /// Cyclic dependency of copied features with their originals
28   inline static const std::string& INFINITE_LOOP()
29   {
30     static const std::string MY_ERROR_VALUE(
31       "There is a circular reference between copied sketch entities and their originals. "
32       "To fix this, you can either undo your operation or remove wrong constraint.");
33     return MY_ERROR_VALUE;
34   }
35   /// Constraints should use objects instead of features as attributes
36   inline static const std::string& NEED_OBJECT_NOT_FEATURE()
37   {
38     static const std::string
39       MY_ERROR_VALUE("Constraint should be based on object instead of feature");
40     return MY_ERROR_VALUE;
41   }
42   /// The entities need to have shared point, but they have not
43   inline static const std::string& NO_COINCIDENT_POINTS()
44   {
45     static const std::string MY_ERROR_VALUE("Objects should have coincident point");
46     return MY_ERROR_VALUE;
47   }
48   /// Attribute of a feature is not initialized
49   inline static const std::string& NOT_INITIALIZED()
50   {
51     static const std::string MY_ERROR_VALUE("Attribute is not initialized");
52     return MY_ERROR_VALUE;
53   }
54   /// Constraint has wrong attributes
55   inline static const std::string& INCORRECT_ATTRIBUTE()
56   {
57     static const std::string MY_ERROR_VALUE("Incorrect attribute");
58     return MY_ERROR_VALUE;
59   }
60   /// Tangency constraint has wrong attributes
61   inline static const std::string& INCORRECT_TANGENCY_ATTRIBUTE()
62   {
63     static const std::string MY_ERROR_VALUE("An arc should be an attribute of tangency constraint");
64     return MY_ERROR_VALUE;
65   }
66   /// Mirror constraint has wrong attributes
67   inline static const std::string& INCORRECT_MIRROR_ATTRIBUTE()
68   {
69     static const std::string MY_ERROR_VALUE("Mirror constraint has wrong attributes");
70     return MY_ERROR_VALUE;
71   }
72   /// Entity is already fixed
73   inline static const std::string& ALREADY_FIXED()
74   {
75     static const std::string MY_ERROR_VALUE("Entity already fixed");
76     return MY_ERROR_VALUE;
77   }
78   /// Tangency constraint has been built with wrong attributes
79   /// (for example, line and arc have two coincident points)
80   inline static const std::string& TANGENCY_FAILED()
81   {
82     static const std::string
83       MY_ERROR_VALUE("Unable to create tangency constraint on given attributes");
84     return MY_ERROR_VALUE;
85   }
86   /// Crash in SolveSpace
87   inline static const std::string& SOLVESPACE_CRASH()
88   {
89     static const std::string MY_ERROR_VALUE("Caution: SolveSpace crash! Constraints are wrong");
90     return MY_ERROR_VALUE;
91   }
92   /// Constraint has wrong type
93   inline static const std::string& WRONG_CONSTRAINT_TYPE()
94   {
95     static const std::string MY_ERROR_VALUE("Unsupported type of constraint");
96     return MY_ERROR_VALUE;
97   }
98 };
99
100 #endif