SHAPER  9.12.0
GeomValidators_ShapeType.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 GeomValidators_ShapeType_H
21 #define GeomValidators_ShapeType_H
22 
23 #include "GeomValidators.h"
24 #include "ModelAPI_AttributeValidator.h"
25 
26 #include <GeomAPI_Shape.h>
27 
28 #include <string>
29 
37 {
38  public:
41  {
42  Empty,
43  Vertex,
44  Edge,
45  Line,
46  Circle,
47  Wire,
48  Face,
49  Plane,
50  Shell,
51  Solid,
52  CompSolid,
53  Compound,
54  AnyShape
55  };
56 
57  public:
58  GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() {}
63  GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
64  const std::list<std::string>& theArguments,
65  Events_InfoMessage& theError) const;
66 
69  GEOMVALIDATORS_EXPORT static TypeOfShape shapeType(const std::string& theType);
70 
71 protected:
76  GEOMVALIDATORS_EXPORT
77  bool isValidAttribute(const AttributePtr& theAttribute,
78  const TypeOfShape theShapeType,
79  Events_InfoMessage& theError) const;
80 
85  bool isValidObject(const ObjectPtr& theObject,
86  const TypeOfShape theShapeType,
87  const bool theIsGeometricalSelection,
88  Events_InfoMessage& theError) const;
89 
94  bool isValidShape(const GeomShapePtr theShape,
95  const TypeOfShape theShapeType,
96  const bool theIsGeometricalSelection,
97  Events_InfoMessage& theError) const;
98 
99 };
100 
101 #endif
An event message for sending a string message which has to be translated.
Definition: Events_InfoMessage.h:35
A validator for shape types, such as vertex, line, circe or arc.
Definition: GeomValidators_ShapeType.h:37
bool isValidObject(const ObjectPtr &theObject, const TypeOfShape theShapeType, const bool theIsGeometricalSelection, Events_InfoMessage &theError) const
Returns true if the attibute's object type satisfies the argument value.
Definition: GeomValidators_ShapeType.cpp:216
TypeOfShape
Type of shape.
Definition: GeomValidators_ShapeType.h:41
bool isValidShape(const GeomShapePtr theShape, const TypeOfShape theShapeType, const bool theIsGeometricalSelection, Events_InfoMessage &theError) const
Returns true if the attibute's object type satisfies the argument value.
Definition: GeomValidators_ShapeType.cpp:258
bool isValidAttribute(const AttributePtr &theAttribute, const TypeOfShape theShapeType, Events_InfoMessage &theError) const
Returns true if the attibute's object type satisfies the argument value.
Definition: GeomValidators_ShapeType.cpp:131
static TypeOfShape shapeType(const std::string &theType)
Convert string to TypeOfShape value.
Definition: GeomValidators_ShapeType.cpp:45
virtual bool isValid(const AttributePtr &theAttribute, const std::list< std::string > &theArguments, Events_InfoMessage &theError) const
Returns true if attribute has shape type listed in the parameter arguments.
Definition: GeomValidators_ShapeType.cpp:95
Generic validator for any attribute of a feature.
Definition: ModelAPI_AttributeValidator.h:31