1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SketchSolver_Error_H_
21 #define SketchSolver_Error_H_
25 /** \class SketchSolver_Error
27 * \brief Collects all sketch solver error' codes
28 * as inline static functions
30 class SketchSolver_Error
33 /// The value parameter for the constraint
34 inline static const std::string& CONSTRAINTS()
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;
40 /// Cyclic dependency of copied features with their originals
41 inline static const std::string& INFINITE_LOOP()
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;
48 /// Constraints should use objects instead of features as attributes
49 inline static const std::string& NEED_OBJECT_NOT_FEATURE()
51 static const std::string
52 MY_ERROR_VALUE("Constraint should be based on object instead of feature");
53 return MY_ERROR_VALUE;
55 /// The entities need to have shared point, but they have not
56 inline static const std::string& NO_COINCIDENT_POINTS()
58 static const std::string MY_ERROR_VALUE("Objects should have coincident point");
59 return MY_ERROR_VALUE;
61 /// Attribute of a feature is not initialized
62 inline static const std::string& NOT_INITIALIZED()
64 static const std::string MY_ERROR_VALUE("Attribute is not initialized");
65 return MY_ERROR_VALUE;
67 /// Constraint has wrong attributes
68 inline static const std::string& INCORRECT_ATTRIBUTE()
70 static const std::string MY_ERROR_VALUE("Incorrect attribute");
71 return MY_ERROR_VALUE;
73 /// Tangency constraint has wrong attributes
74 inline static const std::string& INCORRECT_TANGENCY_ATTRIBUTE()
76 static const std::string MY_ERROR_VALUE("An arc should be an attribute of tangency constraint");
77 return MY_ERROR_VALUE;
79 /// Mirror constraint has wrong attributes
80 inline static const std::string& INCORRECT_MIRROR_ATTRIBUTE()
82 static const std::string MY_ERROR_VALUE("Mirror constraint has wrong attributes");
83 return MY_ERROR_VALUE;
85 /// Entity is already fixed
86 inline static const std::string& ALREADY_FIXED()
88 static const std::string MY_ERROR_VALUE("Entity already fixed");
89 return MY_ERROR_VALUE;
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()
95 static const std::string
96 MY_ERROR_VALUE("Unable to create tangency constraint on given attributes");
97 return MY_ERROR_VALUE;
99 /// Crash in SolveSpace
100 inline static const std::string& SOLVESPACE_CRASH()
102 static const std::string MY_ERROR_VALUE("Caution: SolveSpace crashed! Constraints are wrong");
103 return MY_ERROR_VALUE;
105 /// Constraint has wrong type
106 inline static const std::string& WRONG_CONSTRAINT_TYPE()
108 static const std::string MY_ERROR_VALUE("Unsupported type of constraint");
109 return MY_ERROR_VALUE;
111 /// Sketch contains degenerated geometry
112 inline static const std::string& DEGENERATED_GEOMETRY()
114 static const std::string MY_ERROR_VALUE(
115 "The set of constraints lead to degenerated geometry. "
116 "To fix this, you can either undo your operation or "
117 "remove a constraint or the degenerated geometry.");
118 return MY_ERROR_VALUE;