Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchSolver / SketchSolver_Error.h
1 // Copyright (C) 2014-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef SketchSolver_Error_H_
21 #define SketchSolver_Error_H_
22
23 #include <string>
24
25 /** \class SketchSolver_Error
26  *  \ingroup Plugins
27  *  \brief Collects all sketch solver error' codes
28  *         as inline static functions
29  */
30 class SketchSolver_Error
31 {
32  public:
33   /// The value parameter for the constraint
34   inline static const std::string& CONSTRAINTS()
35   {
36     static const std::string MY_ERROR_VALUE("<b>The constraint is conflicting with others. "
37       "To fix this, you can either <font color='red'>undo (Ctrl+Z)</font> your operation or "
38       "<font color='red'>remove</font> a conflicting constraint.</b>");
39     return MY_ERROR_VALUE;
40   }
41   /// Cyclic dependency of copied features with their originals
42   inline static const std::string& INFINITE_LOOP()
43   {
44     static const std::string MY_ERROR_VALUE(
45       "<b>There is a circular reference between copied sketch entities and their originals. "
46       "To fix this, you can either <font color='red'>undo (Ctrl+Z)</font> your operation or "
47       "<font color='red'>remove</font> wrong constraint.</b>");
48     return MY_ERROR_VALUE;
49   }
50   /// Constraints should use objects instead of features as attributes
51   inline static const std::string& NEED_OBJECT_NOT_FEATURE()
52   {
53     static const std::string
54       MY_ERROR_VALUE("Constraint should be based on object instead of feature");
55     return MY_ERROR_VALUE;
56   }
57   /// The entities need to have shared point, but they have not
58   inline static const std::string& NO_COINCIDENT_POINTS()
59   {
60     static const std::string MY_ERROR_VALUE("Objects should have coincident point");
61     return MY_ERROR_VALUE;
62   }
63   /// Attribute of a feature is not initialized
64   inline static const std::string& NOT_INITIALIZED()
65   {
66     static const std::string MY_ERROR_VALUE("Attribute is not initialized");
67     return MY_ERROR_VALUE;
68   }
69   /// Constraint has wrong attributes
70   inline static const std::string& INCORRECT_ATTRIBUTE()
71   {
72     static const std::string MY_ERROR_VALUE("Incorrect attribute");
73     return MY_ERROR_VALUE;
74   }
75   /// Tangency constraint has wrong attributes
76   inline static const std::string& INCORRECT_TANGENCY_ATTRIBUTE()
77   {
78     static const std::string MY_ERROR_VALUE("An arc should be an attribute of tangency constraint");
79     return MY_ERROR_VALUE;
80   }
81   /// Mirror constraint has wrong attributes
82   inline static const std::string& INCORRECT_MIRROR_ATTRIBUTE()
83   {
84     static const std::string MY_ERROR_VALUE("Mirror constraint has wrong attributes");
85     return MY_ERROR_VALUE;
86   }
87   /// Entity is already fixed
88   inline static const std::string& ALREADY_FIXED()
89   {
90     static const std::string MY_ERROR_VALUE("Entity already fixed");
91     return MY_ERROR_VALUE;
92   }
93   /// Tangency constraint has been built with wrong attributes
94   /// (for example, line and arc have two coincident points)
95   inline static const std::string& TANGENCY_FAILED()
96   {
97     static const std::string
98       MY_ERROR_VALUE("Unable to create tangency constraint on given attributes");
99     return MY_ERROR_VALUE;
100   }
101   /// Crash in SolveSpace
102   inline static const std::string& SOLVESPACE_CRASH()
103   {
104     static const std::string MY_ERROR_VALUE("Caution: SolveSpace crashed! Constraints are wrong");
105     return MY_ERROR_VALUE;
106   }
107   /// Constraint has wrong type
108   inline static const std::string& WRONG_CONSTRAINT_TYPE()
109   {
110     static const std::string MY_ERROR_VALUE("Unsupported type of constraint");
111     return MY_ERROR_VALUE;
112   }
113   /// Sketch contains degenerated geometry
114   inline static const std::string& DEGENERATED_GEOMETRY()
115   {
116     static const std::string MY_ERROR_VALUE(
117       "The set of constraints lead to degenerated geometry. "
118       "To fix this, you can either undo your operation or "
119       "remove a constraint or the degenerated geometry.");
120     return MY_ERROR_VALUE;
121   }
122 };
123
124 #endif