From f12c9b8ec759f1388b1059ca1beb963358265808 Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 25 Mar 2016 18:30:40 +0300 Subject: [PATCH] Compilation fix --- src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h | 2 +- src/GeomValidators/CMakeLists.txt | 2 - .../GeomValidators_BaseForGeneration.cpp | 123 ------------------ .../GeomValidators_BaseForGeneration.h | 35 ----- 4 files changed, 1 insertion(+), 161 deletions(-) delete mode 100644 src/GeomValidators/GeomValidators_BaseForGeneration.cpp delete mode 100644 src/GeomValidators/GeomValidators_BaseForGeneration.h diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h index 8814118d1..197e1be80 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h @@ -51,7 +51,7 @@ public: /// \param[in] theShape base shape. /// \param[out] theHistory generated shapes. GEOMALGOAPI_EXPORT void generated(const std::shared_ptr theShape, - ListOfShape& theHistory) override; + ListOfShape& theHistory); private: void build(const std::shared_ptr theBaseShape, diff --git a/src/GeomValidators/CMakeLists.txt b/src/GeomValidators/CMakeLists.txt index c0f6b1cba..af20eedc4 100644 --- a/src/GeomValidators/CMakeLists.txt +++ b/src/GeomValidators/CMakeLists.txt @@ -19,7 +19,6 @@ SET(PROJECT_HEADERS GeomValidators_Different.h GeomValidators_BooleanSelection.h GeomValidators_IntersectionSelection.h - GeomValidators_BaseForGeneration.h ) SET(PROJECT_SOURCES @@ -38,7 +37,6 @@ SET(PROJECT_SOURCES GeomValidators_Different.cpp GeomValidators_BooleanSelection.cpp GeomValidators_IntersectionSelection.cpp - GeomValidators_BaseForGeneration.cpp ) SET(PROJECT_LIBRARIES diff --git a/src/GeomValidators/GeomValidators_BaseForGeneration.cpp b/src/GeomValidators/GeomValidators_BaseForGeneration.cpp deleted file mode 100644 index 7ef5502a7..000000000 --- a/src/GeomValidators/GeomValidators_BaseForGeneration.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: GeomValidators_BaseForGeneration.cpp -// Created: 18 March 2016 -// Author: Dmitry Bobylev - -#include "GeomValidators_BaseForGeneration.h" - -#include -#include - -#include - -//================================================================================================= -bool GeomValidators_BaseForGeneration::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - std::string& theError) const -{ - // Checking attribute. - if(!isValidAttribute(theAttribute, theError)) { - if(theError.empty()) { - theError = "Attribute contains shape with unacceptable type."; - } - return false; - } - - return true; -} - -//================================================================================================= -bool GeomValidators_BaseForGeneration::isValidAttribute(const AttributePtr& theAttribute, - std::string& theError) const -{ - if(!theAttribute.get()) { - theError = "Empty attribute."; - return false; - } - - std::string anAttributeType = theAttribute->attributeType(); - if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aListAttr = std::dynamic_pointer_cast(theAttribute); - for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { - // If at least one attribute is invalid, the result is false. - if(!isValidAttribute(aListAttr->value(anIndex), theError)) { - return false; - } - } - } else if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { - // Getting context. - AttributeSelectionPtr anAttr = std::dynamic_pointer_cast(theAttribute); - ResultPtr aContext = anAttr->context(); - if(!aContext.get()) { - theError = "Attribute have empty context."; - return false; - } - - // Getting feature. - FeaturePtr aFeature = ModelAPI_Feature::feature(aContext); - if(!aFeature.get()) { - theError = "Empty feature."; - return false; - } - - // Checking feature kind. - std::string aFeatureKind = aFeature->getKind(); - if(aFeatureKind == "Axis" || - aFeatureKind == "Plane") { - theError = "Shape from feature \"" + aFeatureKind +"\" is not allowed for selection."; - return false; - } - - GeomShapePtr aShape = anAttr->value(); - GeomShapePtr aContextShape = aContext->shape(); - if(!aShape.get()) { - aShape = aContextShape; - } - if(!aShape.get()) { - theError = "Empty shape selected"; - return false; - } - - if(aFeatureKind == "Sketch") { - if(aShape->isEqual(aContextShape)) { - // Whole sketch selected. Check that it have faces. - ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aContext); - if(aConstruction->facesNum() == 0) { - theError = "Selected sketch does not have faces."; - return false; - } - } else { - // Shape on sketch selected. Check that it is a face. - if(aShape->shapeType() != GeomAPI_Shape::FACE) { - theError = "Selected shape has unacceptable type. Acceptable types are: faces on sketch, \ - whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face."; - return false; - } - } - } else { - if(!aShape->isEqual(aContextShape)) { - // Local selection does not allowed. - theError = "Selected shape is in the local selection. Only global selection is allowed."; - return false; - } else { - // Check that object is a shape with allowed type. - aShape = aContext->shape(); - GeomAPI_Shape::ShapeType aShapeType = aShape->shapeType(); - if(aShapeType != GeomAPI_Shape::VERTEX && - aShapeType != GeomAPI_Shape::EDGE && - aShapeType != GeomAPI_Shape::WIRE && - aShapeType != GeomAPI_Shape::FACE) { - theError = "Selected shape has unacceptable type. Acceptable types are: faces on sketch, \ - whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face."; - return false; - } - } - } - } else { - theError = "Following attribute does not supported: " + anAttributeType + "."; - return false; - } - - return true; -} \ No newline at end of file diff --git a/src/GeomValidators/GeomValidators_BaseForGeneration.h b/src/GeomValidators/GeomValidators_BaseForGeneration.h deleted file mode 100644 index eebff32a2..000000000 --- a/src/GeomValidators/GeomValidators_BaseForGeneration.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: GeomValidators_BaseForGeneration.h -// Created: 18 March 2016 -// Author: Dmitry Bobylev - -#ifndef GeomValidators_BaseForGeneration_H -#define GeomValidators_BaseForGeneration_H - -#include "GeomValidators.h" - -#include - -#include - -/// \ingroup Validators -/// A validator for selection base for generation. Allows to select faces on sketch, -/// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face. -class GeomValidators_BaseForGeneration : public ModelAPI_AttributeValidator -{ -public: - //! Returns true if attribute has selection type listed in the parameter arguments. - //! \param[in] theAttribute the checked attribute. - //! \param[in] theArguments arguments of the attribute. - //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - std::string& theError) const; - -private: - bool isValidAttribute(const AttributePtr& theAttribute, - std::string& theError) const; -}; - -#endif -- 2.39.2