X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Validators.cpp;h=5f27c10ce8af8fc3a349e28e890b610f396bff35;hb=596cc06a3cdc89783d15e893e7da4b6b882fb442;hp=107815387167cc41b77a3484e754f0eaeb1f4f2b;hpb=7569b92a8570dab734c5336241457bec4f2cdb1c;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 107815387..5f27c10ce 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -44,7 +44,7 @@ bool FeaturesPlugin_ValidatorPipePath::isValid(const AttributePtr& theAttribute, const std::list& theArguments, Events_InfoMessage& theError) const { - AttributeSelectionPtr aPathAttrSelection = + AttributeSelectionPtr aPathAttrSelection = std::dynamic_pointer_cast(theAttribute); if(!aPathAttrSelection.get()) { theError = "Error: This validator can only work with path selector in \"Pipe\" feature."; @@ -58,7 +58,7 @@ bool FeaturesPlugin_ValidatorPipePath::isValid(const AttributePtr& theAttribute, return false; } GeomShapePtr aContextShape = aContext->shape(); - if(aPathShape.get() && aPathShape->shapeType() == GeomAPI_Shape::WIRE && + if(aPathShape.get() && aPathShape->shapeType() == GeomAPI_Shape::WIRE && !aPathShape->isEqual(aContextShape)) { theError = "Error: Local selection of wires not allowed."; return false; @@ -108,7 +108,7 @@ bool FeaturesPlugin_ValidatorPipeLocations::isValid( return false; } - if(aLocationsSelectionList->size() > 0 && + if(aLocationsSelectionList->size() > 0 && aLocationsSelectionList->size() != aBaseObjectsSelectionList->size()) { theError = "Error: Number of locations should be the same as base objects."; return false; @@ -118,7 +118,7 @@ bool FeaturesPlugin_ValidatorPipeLocations::isValid( } //================================================================================================== -bool FeaturesPlugin_ValidatorPipeLocations::isNotObligatory(std::string theFeature, +bool FeaturesPlugin_ValidatorPipeLocations::isNotObligatory(std::string theFeature, std::string theAttribute) { return false; @@ -157,10 +157,10 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theA return false; } - ResultConstructionPtr aResultConstruction = + ResultConstructionPtr aResultConstruction = std::dynamic_pointer_cast(aContext); if(!aResultConstruction.get()) { - // It is not a result construction. + // It is not a result construction. // If shape is compound check that it contains only faces and edges. GeomShapePtr aShape = aSelectionAttr->value(); if(!aShape.get()) { @@ -209,7 +209,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theA } if(aSelectedWiresFromObjects.isBound(aWire)) { - theError = + theError = "Error: Objects with such wire already selected. Don't allow to select this object."; return false; } @@ -236,7 +236,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute std::string anAttributeType = theAttribute->attributeType(); if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aListAttr = + 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. @@ -246,7 +246,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute } } else if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { // Getting context. - AttributeSelectionPtr anAttr = + AttributeSelectionPtr anAttr = std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttr->context(); if(!aContext.get()) { @@ -264,7 +264,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute return false; } - ResultConstructionPtr aConstruction = + ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aContext); if(aConstruction.get()) { // Construciotn selected. Check that is is not infinite. @@ -280,7 +280,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute } } else { // Shape on construction selected. Check that it is a face or wire. - if(aShape->shapeType() == GeomAPI_Shape::WIRE || + if(aShape->shapeType() == GeomAPI_Shape::WIRE || aShape->shapeType() == GeomAPI_Shape::FACE) { return true; } @@ -380,7 +380,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( return false; } - std::list::const_iterator + std::list::const_iterator anArgsIt = theArguments.begin(), aLast = theArguments.end(); AttributePtr aCheckAttribute = theFeature->attribute(*anArgsIt); @@ -413,7 +413,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( std::shared_ptr aDirEdge(new GeomAPI_Edge(aDirShape)); // If faces selected check that direction not parallel with them. - AttributeSelectionListPtr aListAttr = + AttributeSelectionListPtr aListAttr = std::dynamic_pointer_cast(aCheckAttribute); for(int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) { AttributeSelectionPtr anAttr = aListAttr->value(anIndex); @@ -422,9 +422,9 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( aShapeInList = anAttr->context()->shape(); } bool isParallel = true; - if(aShapeInList->shapeType() == GeomAPI_Shape::FACE || + if(aShapeInList->shapeType() == GeomAPI_Shape::FACE || aShapeInList->shapeType() == GeomAPI_Shape::SHELL) { - for(GeomAPI_ShapeExplorer + for(GeomAPI_ShapeExplorer anExp(aShapeInList, GeomAPI_Shape::FACE); anExp.more(); anExp.next()) { std::shared_ptr aFace(new GeomAPI_Face(anExp.current())); isParallel = GeomAlgoAPI_ShapeTools::isParallel(aDirEdge, aFace); @@ -433,7 +433,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( } } } else if(aShapeInList->shapeType() == GeomAPI_Shape::COMPOUND) { - std::shared_ptr aPlanarEdges = + std::shared_ptr aPlanarEdges = std::dynamic_pointer_cast(aShapeInList); if(aPlanarEdges.get()) { std::shared_ptr aSketchDir = aPlanarEdges->norm(); @@ -450,7 +450,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( isParallel = false; } if(isParallel) { - theError = + theError = "Error: Direction is parallel to one of the selected face or face on selected shell."; return false; } @@ -460,7 +460,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( } //================================================================================================== -bool FeaturesPlugin_ValidatorExtrusionDir::isNotObligatory(std::string theFeature, +bool FeaturesPlugin_ValidatorExtrusionDir::isNotObligatory(std::string theFeature, std::string theAttribute) { return false; @@ -476,7 +476,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isShapesCanBeEmpty(const AttributePtr std::string anAttributeType = theAttribute->attributeType(); if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aListAttr = + 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. @@ -486,7 +486,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isShapesCanBeEmpty(const AttributePtr } } else if(anAttributeType == ModelAPI_AttributeSelection::typeId()) { // Getting context. - AttributeSelectionPtr anAttr = + AttributeSelectionPtr anAttr = std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttr->context(); if(!aContext.get()) { @@ -519,10 +519,10 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt const std::list& theArguments, Events_InfoMessage& theError) const { - AttributeSelectionListPtr anAttrSelectionList = + AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); if(!anAttrSelectionList.get()) { - theError = + theError = "Error: This validator can only work with selection list attributes in \"Boolean\" feature."; return false; } @@ -589,7 +589,7 @@ bool FeaturesPlugin_ValidatorPartitionSelection::isValid(const AttributePtr& the const std::list& theArguments, Events_InfoMessage& theError) const { - AttributeSelectionListPtr anAttrSelectionList = + AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); if(!anAttrSelectionList.get()) { theError = "Error: This validator can only work with selection list in \"Partition\" feature."; @@ -610,14 +610,14 @@ bool FeaturesPlugin_ValidatorPartitionSelection::isValid(const AttributePtr& the } ResultPtr aContext = aSelectAttr->context(); - ResultConstructionPtr aResultConstruction = + ResultConstructionPtr aResultConstruction = std::dynamic_pointer_cast(aContext); if(aResultConstruction.get()) { theError = "Error: Only body shapes and construction planes are allowed for selection."; return false; } - ResultCompSolidPtr aResultCompsolid = + ResultCompSolidPtr aResultCompsolid = std::dynamic_pointer_cast(aContext); if(aResultCompsolid.get()) { continue; @@ -636,10 +636,10 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid(const AttributePt const std::list& theArguments, Events_InfoMessage& theError) const { - AttributeSelectionListPtr aSubShapesAttrList = + AttributeSelectionListPtr aSubShapesAttrList = std::dynamic_pointer_cast(theAttribute); if(!aSubShapesAttrList.get()) { - theError = + theError = "Error: This validator can only work with selection list in \"Remove Sub-Shapes\" feature."; return false; } @@ -752,7 +752,7 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttr const std::list& theArguments, Events_InfoMessage& theError) const { - AttributeSelectionListPtr aBaseObjectsAttrList = + AttributeSelectionListPtr aBaseObjectsAttrList = std::dynamic_pointer_cast(theAttribute); if(!aBaseObjectsAttrList.get()) { theError = "Error: This validator can only work with selection list in \"%1\" feature."; @@ -763,7 +763,7 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttr for(int anIndex = 0; anIndex < aBaseObjectsAttrList->size(); ++anIndex) { bool isSameFound = false; AttributeSelectionPtr anAttrSelectionInList = aBaseObjectsAttrList->value(anIndex); - ResultCompSolidPtr aResult = + ResultCompSolidPtr aResult = std::dynamic_pointer_cast(anAttrSelectionInList->context()); if(!aResult.get()) { continue; @@ -791,7 +791,7 @@ bool FeaturesPlugin_ValidatorUnionArguments::isValid( } // Get base objects attribute list. - AttributeSelectionListPtr aBaseObejctsAttrList = + AttributeSelectionListPtr aBaseObejctsAttrList = theFeature->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID()); if(!aBaseObejctsAttrList.get()) { theError = "Error: Could not get \"%1\" attribute.";