Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / SketchSolver / SketchSolver_Error.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
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<mailto: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("The constraint is conflicting with others. "
37       "To fix this, you can either undo your operation or remove a conflicting constraint.");
38     return MY_ERROR_VALUE;
39   }
40   /// Cyclic dependency of copied features with their originals
41   inline static const std::string& INFINITE_LOOP()
42   {
43     static const std::string MY_ERROR_VALUE(
44       "There is a circular reference between copied sketch entities and their originals. "
45       "To fix this, you can either undo your operation or remove wrong constraint.");
46     return MY_ERROR_VALUE;
47   }
48   /// Constraints should use objects instead of features as attributes
49   inline static const std::string& NEED_OBJECT_NOT_FEATURE()
50   {
51     static const std::string
52       MY_ERROR_VALUE("Constraint should be based on object instead of feature");
53     return MY_ERROR_VALUE;
54   }
55   /// The entities need to have shared point, but they have not
56   inline static const std::string& NO_COINCIDENT_POINTS()
57   {
58     static const std::string MY_ERROR_VALUE("Objects should have coincident point");
59     return MY_ERROR_VALUE;
60   }
61   /// Attribute of a feature is not initialized
62   inline static const std::string& NOT_INITIALIZED()
63   {
64     static const std::string MY_ERROR_VALUE("Attribute is not initialized");
65     return MY_ERROR_VALUE;
66   }
67   /// Constraint has wrong attributes
68   inline static const std::string& INCORRECT_ATTRIBUTE()
69   {
70     static const std::string MY_ERROR_VALUE("Incorrect attribute");
71     return MY_ERROR_VALUE;
72   }
73   /// Tangency constraint has wrong attributes
74   inline static const std::string& INCORRECT_TANGENCY_ATTRIBUTE()
75   {
76     static const std::string MY_ERROR_VALUE("An arc should be an attribute of tangency constraint");
77     return MY_ERROR_VALUE;
78   }
79   /// Mirror constraint has wrong attributes
80   inline static const std::string& INCORRECT_MIRROR_ATTRIBUTE()
81   {
82     static const std::string MY_ERROR_VALUE("Mirror constraint has wrong attributes");
83     return MY_ERROR_VALUE;
84   }
85   /// Entity is already fixed
86   inline static const std::string& ALREADY_FIXED()
87   {
88     static const std::string MY_ERROR_VALUE("Entity already fixed");
89     return MY_ERROR_VALUE;
90   }
91   /// Tangency constraint has been built with wrong attributes
92   /// (for example, line and arc have two coincident points)
93   inline static const std::string& TANGENCY_FAILED()
94   {
95     static const std::string
96       MY_ERROR_VALUE("Unable to create tangency constraint on given attributes");
97     return MY_ERROR_VALUE;
98   }
99   /// Crash in SolveSpace
100   inline static const std::string& SOLVESPACE_CRASH()
101   {
102     static const std::string MY_ERROR_VALUE("Caution: SolveSpace crash! Constraints are wrong");
103     return MY_ERROR_VALUE;
104   }
105 };
106
107 #endif