#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeReference.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <string>
#include <map>
GeomValidators_ShapeType::TypeOfShape GeomValidators_ShapeType::shapeType(const std::string& theType)
{
if (MyShapeTypes.size() == 0) {
- MyShapeTypes["empty"] = Empty;
- MyShapeTypes["vertex"] = Vertex;
- MyShapeTypes["edge"] = Edge;
- MyShapeTypes["line"] = Line;
- MyShapeTypes["circle"] = Circle;
- MyShapeTypes["face"] = Face;
- MyShapeTypes["solid"] = Solid;
- MyShapeTypes["plane"] = Plane;
+ MyShapeTypes["empty"] = Empty;
+ MyShapeTypes["vertex"] = Vertex;
+ MyShapeTypes["edge"] = Edge;
+ MyShapeTypes["line"] = Line;
+ MyShapeTypes["circle"] = Circle;
+ MyShapeTypes["wire"] = Wire;
+ MyShapeTypes["face"] = Face;
+ MyShapeTypes["plane"] = Plane;
+ MyShapeTypes["shell"] = Shell;
+ MyShapeTypes["solid"] = Solid;
+ MyShapeTypes["compsolid"] = CompSolid;
+ MyShapeTypes["compound"] = Compound;
}
std::string aType = std::string(theType.c_str());
if (MyShapeTypes.find(aType) != MyShapeTypes.end())
return MyShapeTypes[aType];
-
- Events_Error::send("Shape type defined in XML is not implemented!");
+
+ Events_InfoMessage("Shape type defined in XML is not implemented!").send();
return AnyShape;
}
bool GeomValidators_ShapeType::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
- std::string& theError) const
+ Events_InfoMessage& theError) const
{
bool aValid = false;
if (!aTypes.empty())
aTypes += ", ";
}
- theError = "It does not contain element with acceptable shape type. The type should be one of the next: "
- + aTypes;
+ theError = "It does not contain element with acceptable shape type. The type should be one of the next: %1";
+ theError.arg(aTypes);
}
return aValid;
bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute,
const TypeOfShape theShapeType,
- std::string& theError) const
+ Events_InfoMessage& theError) const
{
bool aValid = true;
else {
std::string anAttributeType = aRefAttr->attributeType();
aValid = anAttributeType == GeomDataAPI_Point2D::typeId();
- if (!aValid)
- theError = "Shape type is \"" + anAttributeType +
- "\", it should be \"" + getShapeTypeDescription(theShapeType) + "\"";
+ if (!aValid) {
+ theError = "Shape type is \"%1\", it should be \"%2\"";
+ theError.arg(anAttributeType).arg(getShapeTypeDescription(theShapeType));
+ }
}
}
}
}
else {
aValid = false;
- theError = "The attribute with the " + anAttributeType + " type is not processed";
+ theError = "The attribute with the %1 type is not processed";
+ theError.arg(anAttributeType);
}
return aValid;
}
bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
const TypeOfShape theShapeType,
- std::string& theError) const
+ Events_InfoMessage& theError) const
{
bool aValid = true;
if (!theObject.get()) {
bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
const TypeOfShape theShapeType,
- std::string& theError) const
+ Events_InfoMessage& theError) const
{
bool aValid = true;
}
else {
switch (theShapeType) {
+ case Vertex:
+ aValid = theShape->isVertex();
+ break;
case Edge:
aValid = theShape->isEdge();
break;
- case Line:
- aValid = theShape->isEdge() && !GeomAPI_Curve(theShape).isCircle();
+ case Line:
+ aValid = theShape->isEdge() && !GeomAPI_Curve(theShape).isCircle();
break;
- case Circle:
- aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle();
+ case Circle:
+ aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle();
break;
- case Vertex:
- aValid = theShape->isVertex();
+ case Wire:
+ aValid = theShape->shapeType() == GeomAPI_Shape::WIRE;
+ break;
+ case Face:
+ aValid = theShape->isFace();
+ break;
+ case Shell:
+ aValid = theShape->shapeType() == GeomAPI_Shape::SHELL;
+ break;
+ case Solid:
+ aValid = theShape->isSolid() || theShape->isCompSolid() ||
+ theShape->isCompoundOfSolids();
+ break;
+ case CompSolid:
+ aValid = theShape->shapeType() == GeomAPI_Shape::COMPSOLID;
+ break;
+ case Compound:
+ aValid = theShape->isCompound();
+ break;
+ default:
+ aValid = false;
break;
- case Solid:
- aValid = theShape->isSolid() || theShape->isCompSolid() ||
- theShape->isCompoundOfSolids();
- break;
- case Face:
- aValid = theShape->isFace();
- break;
- case Compound:
- aValid = theShape->isCompound();
- break;
- default:
- aValid = false;
- break;
}
}
return aValid;