From: dbv Date: Tue, 23 Jun 2015 08:56:54 +0000 (+0300) Subject: Improvement #615: Widgets position in Extrusion and Rotation features must be changed. X-Git-Tag: V_1.3.0~209 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7e53ef4d34d299d8f78e72795b0178238ded5874;p=modules%2Fshaper.git Improvement #615: Widgets position in Extrusion and Rotation features must be changed. --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp index 4a3e69108..31015f839 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp @@ -4,7 +4,8 @@ // Created: 30 May 2014 // Author: Vitaly SMETANNIKOV -#include "FeaturesPlugin_Extrusion.h" +#include + #include #include #include @@ -17,65 +18,70 @@ #include #include #include -#include -#include + #include -using namespace std; #define _LATERAL_TAG 1 #define _FIRST_TAG 2 #define _LAST_TAG 3 #define EDGE 6 +//================================================================================================= FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion() { } +//================================================================================================= void FeaturesPlugin_Extrusion::initAttributes() { AttributeSelectionListPtr aSelection = std::dynamic_pointer_cast(data()->addAttribute( - FeaturesPlugin_Extrusion::LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); // extrusion works with faces always aSelection->setSelectionType("FACE"); - data()->addAttribute(FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); + + data()->addAttribute(TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_Extrusion::FROM_OBJECT_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_Extrusion::TO_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID()); } +//================================================================================================= void FeaturesPlugin_Extrusion::execute() { - AttributeSelectionListPtr aFaceRefs = selectionList(FeaturesPlugin_Extrusion::LIST_ID()); + AttributeSelectionListPtr aFaceRefs = selectionList(LIST_ID()); + + // Getting sizes. + double aFromSize = real(FROM_SIZE_ID())->value(); + double aToSize = real(TO_SIZE_ID())->value(); // Getting bounding planes. std::shared_ptr aFromShape; std::shared_ptr aToShape; - std::shared_ptr anObjRef = selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID()); - if(anObjRef.get() != NULL) { - aFromShape = std::dynamic_pointer_cast(anObjRef->value()); - if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) { - aFromShape = anObjRef->context()->shape(); + if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") { + std::shared_ptr anObjRef = selection(FROM_OBJECT_ID()); + if(anObjRef.get() != NULL) { + aFromShape = std::dynamic_pointer_cast(anObjRef->value()); + if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) { + aFromShape = anObjRef->context()->shape(); + } } - } - anObjRef = selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID()); - if(anObjRef.get() != NULL) { - aToShape = std::dynamic_pointer_cast(anObjRef->value()); - if(aToShape.get() == NULL && anObjRef->context().get() != NULL) { - aToShape = anObjRef->context()->shape(); + anObjRef = selection(TO_OBJECT_ID()); + if(anObjRef.get() != NULL) { + aToShape = std::dynamic_pointer_cast(anObjRef->value()); + if(aToShape.get() == NULL && anObjRef->context().get() != NULL) { + aToShape = anObjRef->context()->shape(); + } } } - // Getting sizes. - double aFromSize = real(FeaturesPlugin_Extrusion::FROM_SIZE_ID())->value(); - double aToSize = real(FeaturesPlugin_Extrusion::TO_SIZE_ID())->value(); - // for each selected face generate a result int anIndex = 0, aResultIndex = 0; for(; anIndex < aFaceRefs->size(); anIndex++) { @@ -111,7 +117,7 @@ void FeaturesPlugin_Extrusion::execute() aBaseShape = std::dynamic_pointer_cast(aConstruction->face(aFaceIndex)); } - GeomAlgoAPI_Prism aFeature(aBaseShape, aFromShape, aFromSize, aToShape, aToSize); + GeomAlgoAPI_Prism aFeature(aBaseShape, aToShape, aToSize, aFromShape, aFromSize); if(!aFeature.isDone()) { static const std::string aFeatureError = "Extrusion algorithm failed"; setError(aFeatureError); @@ -143,7 +149,7 @@ void FeaturesPlugin_Extrusion::execute() removeResults(aResultIndex); } -//============================================================================ +//================================================================================================= void FeaturesPlugin_Extrusion::LoadNamingDS(GeomAlgoAPI_Prism& theFeature, std::shared_ptr theResultBody, std::shared_ptr theBasis, diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h index 3a97d81bb..2d72d49bb 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h @@ -47,6 +47,13 @@ class FeaturesPlugin_Extrusion : public ModelAPI_Feature return MY_TO_OBJECT_ID; } + /// attribute name for creation method + inline static const std::string& CREATION_METHOD() + { + static const std::string METHOD_ATTR("CreationMethod"); + return METHOD_ATTR; + } + /// attribute name of extrusion size inline static const std::string& TO_SIZE_ID() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp index af44526a7..76bf4d291 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -16,46 +17,51 @@ //================================================================================================= void FeaturesPlugin_ExtrusionBoolean::initMakeSolidsAttributes() { - data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID()); + data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID()); } //================================================================================================= ListOfShape FeaturesPlugin_ExtrusionBoolean::MakeSolids(const ListOfShape& theFaces) { + // Getting extrusion sizes. + double aFromSize = real(FROM_SIZE_ID())->value(); + double aToSize = real(TO_SIZE_ID())->value(); + // Getting extrusion bounding planes. std::shared_ptr aFromShape; std::shared_ptr aToShape; - std::shared_ptr anObjRef = selection(FROM_OBJECT_ID()); - if(anObjRef.get() != NULL) { - aFromShape = std::dynamic_pointer_cast(anObjRef->value()); - if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) { - aFromShape = anObjRef->context()->shape(); + + if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") { + std::shared_ptr anObjRef = selection(FROM_OBJECT_ID()); + if(anObjRef.get() != NULL) { + aFromShape = std::dynamic_pointer_cast(anObjRef->value()); + if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) { + aFromShape = anObjRef->context()->shape(); + } } - } - anObjRef = selection(TO_OBJECT_ID()); - if(anObjRef.get() != NULL) { - aToShape = std::dynamic_pointer_cast(anObjRef->value()); - if(aToShape.get() == NULL && anObjRef->context().get() != NULL) { - aToShape = anObjRef->context()->shape(); + anObjRef = selection(TO_OBJECT_ID()); + if(anObjRef.get() != NULL) { + aToShape = std::dynamic_pointer_cast(anObjRef->value()); + if(aToShape.get() == NULL && anObjRef->context().get() != NULL) { + aToShape = anObjRef->context()->shape(); + } } } - // Getting extrusion sizes. - double aFromSize = real(FROM_SIZE_ID())->value(); - double aToSize = real(TO_SIZE_ID())->value(); - // Extrude faces. ListOfShape anExtrusionList; for(ListOfShape::const_iterator aFacesIt = theFaces.begin(); aFacesIt != theFaces.end(); aFacesIt++) { std::shared_ptr aBaseShape = *aFacesIt; - GeomAlgoAPI_Prism aPrismAlgo(aBaseShape, aFromShape, aFromSize, aToShape, aToSize); + GeomAlgoAPI_Prism aPrismAlgo(aBaseShape, aToShape, aToSize, aFromShape, aFromSize); // Checking that the algorithm worked properly. if(!aPrismAlgo.isDone() || aPrismAlgo.shape()->isNull() || !aPrismAlgo.isValid()) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h index a5963a348..8fd63449f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h @@ -15,6 +15,14 @@ class FeaturesPlugin_ExtrusionBoolean : public FeaturesPlugin_CompositeBoolean { public: + + /// attribute name for creation method + inline static const std::string& CREATION_METHOD() + { + static const std::string METHOD_ATTR("CreationMethod"); + return METHOD_ATTR; + } + /// Attribute name of an object from which the extrusion grows. inline static const std::string& FROM_OBJECT_ID() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp b/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp index 21aab4513..4a7795a06 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp @@ -6,21 +6,17 @@ #include -#include -#include -#include -#include -#include -#include -#include - #include #include +#include #include #include #include #include +#include +#include + #define FACE 4 #define EDGE 6 #define _LATERAL_TAG 1 @@ -37,55 +33,67 @@ void FeaturesPlugin_Revolution::initAttributes() { AttributeSelectionListPtr aSelection = std::dynamic_pointer_cast(data()->addAttribute( - FeaturesPlugin_Revolution::LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); // revolution works with faces always aSelection->setSelectionType("FACE"); - data()->addAttribute(FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + + data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_Revolution::FROM_OBJECT_ID()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_Revolution::TO_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID()); } //================================================================================================= void FeaturesPlugin_Revolution::execute() { - AttributeSelectionListPtr aFaceRefs = selectionList(FeaturesPlugin_Revolution::LIST_ID()); + AttributeSelectionListPtr aFaceRefs = selectionList(LIST_ID()); //Getting axis. std::shared_ptr anAxis; std::shared_ptr anEdge; - std::shared_ptr anObjRef = selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID()); + std::shared_ptr anObjRef = selection(AXIS_OBJECT_ID()); if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) { - anEdge = std::shared_ptr(new GeomAPI_Edge(anObjRef->value())); + anEdge = std::make_shared(anObjRef->value()); + } else if(anObjRef->context() && anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) { + anEdge = std::make_shared(anObjRef->context()->shape()); } if(anEdge) { - anAxis = std::shared_ptr(new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction())); + anAxis = std::make_shared(anEdge->line()->location(), anEdge->line()->direction()); } - // Getting bounding planes. - std::shared_ptr aFromShape(new GeomAPI_Shape()); - std::shared_ptr aToShape(new GeomAPI_Shape()); + // Getting angles. + double aFromAngle = real(FROM_ANGLE_ID())->value(); + double aToAngle = real(TO_ANGLE_ID())->value(); - anObjRef = selection(FeaturesPlugin_Revolution::FROM_OBJECT_ID()); - if(anObjRef) { - aFromShape = std::dynamic_pointer_cast(anObjRef->value()); - } - anObjRef = selection(FeaturesPlugin_Revolution::TO_OBJECT_ID()); - if(anObjRef) { - aToShape = std::dynamic_pointer_cast(anObjRef->value()); + // Getting bounding planes. + std::shared_ptr aFromShape; + std::shared_ptr aToShape; + + if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") { + anObjRef = selection(FROM_OBJECT_ID()); + if(anObjRef.get() != NULL) { + aFromShape = std::dynamic_pointer_cast(anObjRef->value()); + if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) { + aFromShape = anObjRef->context()->shape(); + } + } + anObjRef = selection(TO_OBJECT_ID()); + if(anObjRef.get() != NULL) { + aToShape = std::dynamic_pointer_cast(anObjRef->value()); + if(aToShape.get() == NULL && anObjRef->context().get() != NULL) { + aToShape = anObjRef->context()->shape(); + } + } } - // Getting angles. - double aFromAngle = real(FeaturesPlugin_Revolution::FROM_ANGLE_ID())->value(); - double aToAngle = real(FeaturesPlugin_Revolution::TO_ANGLE_ID())->value(); - // for each selected face generate a result int anIndex = 0, aResultIndex = 0; for(; anIndex < aFaceRefs->size(); anIndex++) { @@ -121,7 +129,7 @@ void FeaturesPlugin_Revolution::execute() aBaseShape = std::dynamic_pointer_cast(aConstruction->face(aFaceIndex)); } - GeomAlgoAPI_Revolution aFeature(aBaseShape, anAxis, aFromShape, aFromAngle, aToShape, aToAngle); + GeomAlgoAPI_Revolution aFeature(aBaseShape, anAxis, aToShape, aToAngle, aFromShape, aFromAngle); if(!aFeature.isDone()) { static const std::string aFeatureError = "Revolution algorithm failed"; setError(aFeatureError); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h index 160cc890c..9edc1dc0e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h @@ -46,6 +46,13 @@ class FeaturesPlugin_Revolution : public ModelAPI_Feature return MY_AXIS_ID; } + /// attribute name for creation method + inline static const std::string& CREATION_METHOD() + { + static const std::string METHOD_ATTR("CreationMethod"); + return METHOD_ATTR; + } + /// Attribute name of revolution angle. inline static const std::string& TO_ANGLE_ID() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp index 09a0fd72b..a5f5140a3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -20,14 +21,16 @@ void FeaturesPlugin_RevolutionBoolean::initMakeSolidsAttributes() { data()->addAttribute(FeaturesPlugin_RevolutionBoolean::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID()); + data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID()); } //================================================================================================= @@ -39,38 +42,43 @@ ListOfShape FeaturesPlugin_RevolutionBoolean::MakeSolids(const ListOfShape& theF std::shared_ptr anObjRef = selection(FeaturesPlugin_RevolutionBoolean::AXIS_OBJECT_ID()); if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) { anEdge = std::shared_ptr(new GeomAPI_Edge(anObjRef->value())); + } else if(anObjRef->context() && anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) { + anEdge = std::make_shared(anObjRef->context()->shape()); } if(anEdge) { anAxis = std::shared_ptr(new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction())); } + // Getting revolution angles. + double aFromAngle = real(FROM_ANGLE_ID())->value(); + double aToAngle = real(TO_ANGLE_ID())->value(); + // Getting revolution bounding planes. std::shared_ptr aFromShape; std::shared_ptr aToShape; - anObjRef = selection(FROM_OBJECT_ID()); - if(anObjRef.get() != NULL) { - aFromShape = std::dynamic_pointer_cast(anObjRef->value()); - if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) { - aFromShape = anObjRef->context()->shape(); + + if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") { + anObjRef = selection(FROM_OBJECT_ID()); + if(anObjRef.get() != NULL) { + aFromShape = std::dynamic_pointer_cast(anObjRef->value()); + if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) { + aFromShape = anObjRef->context()->shape(); + } } - } - anObjRef = selection(TO_OBJECT_ID()); - if(anObjRef.get() != NULL) { - aToShape = std::dynamic_pointer_cast(anObjRef->value()); - if(aToShape.get() == NULL && anObjRef->context().get() != NULL) { - aToShape = anObjRef->context()->shape(); + anObjRef = selection(TO_OBJECT_ID()); + if(anObjRef.get() != NULL) { + aToShape = std::dynamic_pointer_cast(anObjRef->value()); + if(aToShape.get() == NULL && anObjRef->context().get() != NULL) { + aToShape = anObjRef->context()->shape(); + } } } - // Getting revolution angles. - double aFromAngle = real(FROM_ANGLE_ID())->value(); - double aToAngle = real(TO_ANGLE_ID())->value(); - // Revol faces. ListOfShape aRevolutionList; for(ListOfShape::const_iterator aFacesIt = theFaces.begin(); aFacesIt != theFaces.end(); aFacesIt++) { std::shared_ptr aBaseShape = *aFacesIt; - GeomAlgoAPI_Revolution aRevolAlgo(aBaseShape, anAxis, aFromShape, aFromAngle, aToShape, aToAngle); + GeomAlgoAPI_Revolution aRevolAlgo(aBaseShape, anAxis, aToShape, aToAngle, aFromShape, aFromAngle); // Checking that the algorithm worked properly. if(!aRevolAlgo.isDone() || aRevolAlgo.shape()->isNull() || !aRevolAlgo.isValid()) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h index e9fe6fb7e..354f5badc 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h @@ -22,6 +22,13 @@ public: return MY_AXIS_ID; } + /// attribute name for creation method + inline static const std::string& CREATION_METHOD() + { + static const std::string METHOD_ATTR("CreationMethod"); + return METHOD_ATTR; + } + /// Attribute name of an object from which the revolution grows. inline static const std::string& FROM_OBJECT_ID() { diff --git a/src/FeaturesPlugin/extrusion_widget.xml b/src/FeaturesPlugin/extrusion_widget.xml index 76e185dac..85f3179d3 100644 --- a/src/FeaturesPlugin/extrusion_widget.xml +++ b/src/FeaturesPlugin/extrusion_widget.xml @@ -9,43 +9,71 @@ type_choice="Faces Compound"> - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/FeaturesPlugin/extrusioncut_widget.xml b/src/FeaturesPlugin/extrusioncut_widget.xml index bb0d6b5f8..4c1a3c256 100755 --- a/src/FeaturesPlugin/extrusioncut_widget.xml +++ b/src/FeaturesPlugin/extrusioncut_widget.xml @@ -5,38 +5,66 @@ /> + tooltip="Create or edit a sketch"> - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + /> + tooltip="Create or edit a sketch"> - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/FeaturesPlugin/revolutioncut_widget.xml b/src/FeaturesPlugin/revolutioncut_widget.xml index 9f0ca3732..6d1683b35 100644 --- a/src/FeaturesPlugin/revolutioncut_widget.xml +++ b/src/FeaturesPlugin/revolutioncut_widget.xml @@ -5,7 +5,7 @@ /> + tooltip="Create or edit a sketch"> - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + /> + tooltip="Create or edit a sketch"> - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + theBasis, - double theFromSize, - double theToSize) + double theToSize, + double theFromSize) : myDone(false) { - build(theBasis, std::shared_ptr(), theFromSize, std::shared_ptr(), theToSize); + build(theBasis, std::shared_ptr(), theToSize, std::shared_ptr(), theFromSize); } //================================================================================================= GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(std::shared_ptr theBasis, - std::shared_ptr theFromShape, - double theFromSize, std::shared_ptr theToShape, - double theToSize) + double theToSize, + std::shared_ptr theFromShape, + double theFromSize) : myDone(false) { - build(theBasis, theFromShape, theFromSize, theToShape, theToSize); + build(theBasis, theToShape, theToSize, theFromShape, theFromSize); } //================================================================================================= void GeomAlgoAPI_Prism::build(const std::shared_ptr& theBasis, - const std::shared_ptr& theFromShape, - double theFromSize, const std::shared_ptr& theToShape, - double theToSize) + double theToSize, + const std::shared_ptr& theFromShape, + double theFromSize) { if(!theBasis || (((!theFromShape && !theToShape) || (theFromShape && theToShape && theFromShape->isEqual(theToShape))) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h index 642ff9b30..9a5cf59cb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h @@ -24,25 +24,25 @@ class GeomAlgoAPI_Prism : public GeomAPI_Interface public: /** \brief Creates extrusion for the given shape along the normal for this shape. * \param[in] theBasis face or wire to be extruded. - * \param[in] theFromSize offset for "from" plane. * \param[in] theToSize offset for "to" plane. + * \param[in] theFromSize offset for "from" plane. */ GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr theBasis, - double theFromSize, - double theToSize); + double theToSize, + double theFromSize); /** \brief Creates extrusion for the given shape along the normal for this shape. * \param[in] theBasis face or wire to be extruded. - * \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis. - * \param[in] theFromSize offset for "from" plane. * \param[in] theToShape top bounding shape. Can be empty. In this case offset will be applied to the basis. * \param[in] theToSize offset for "to" plane. + * \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis. + * \param[in] theFromSize offset for "from" plane. */ GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr theBasis, - std::shared_ptr theFromShape, - double theFromSize, std::shared_ptr theToShape, - double theToSize); + double theToSize, + std::shared_ptr theFromShape, + double theFromSize); /// \return true if algorithm succeed. GEOMALGOAPI_EXPORT bool isDone() const; @@ -71,10 +71,10 @@ public: private: /// Builds resulting shape. void build(const std::shared_ptr& theBasis, - const std::shared_ptr& theFromShape, - double theFromSize, const std::shared_ptr& theToShape, - double theToSize); + double theToSize, + const std::shared_ptr& theFromShape, + double theFromSize); private: /// Fields. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp index 295886fbd..1489fcd4b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp @@ -30,23 +30,23 @@ //================================================================================================= GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(std::shared_ptr theBasis, std::shared_ptr theAxis, - double theFromAngle, - double theToAngle) + double theToAngle, + double theFromAngle) : myDone(false) { - build(theBasis, theAxis, std::shared_ptr(), theFromAngle, std::shared_ptr(), theToAngle); + build(theBasis, theAxis, std::shared_ptr(), theToAngle, std::shared_ptr(), theFromAngle); } //================================================================================================= GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(std::shared_ptr theBasis, std::shared_ptr theAxis, - std::shared_ptr theFromShape, - double theFromAngle, std::shared_ptr theToShape, - double theToAngle) + double theToAngle, + std::shared_ptr theFromShape, + double theFromAngle) : myDone(false) { - build(theBasis, theAxis, theFromShape, theFromAngle, theToShape, theToAngle); + build(theBasis, theAxis, theToShape, theToAngle, theFromShape, theFromAngle); } //================================================================================================= @@ -107,10 +107,10 @@ TopoDS_Shape GeomAlgoAPI_Revolution::findClosest(const TopoDS_Shape& theShape, c //================================================================================================= void GeomAlgoAPI_Revolution::build(const std::shared_ptr& theBasis, const std::shared_ptr& theAxis, - const std::shared_ptr& theFromShape, - double theFromAngle, const std::shared_ptr& theToShape, - double theToAngle) + double theToAngle, + const std::shared_ptr& theFromShape, + double theFromAngle) { if(!theBasis || !theAxis || (((!theFromShape && !theToShape) || (theFromShape && theToShape && theFromShape->isEqual(theToShape))) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h index a10b093b0..8e6a0033c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h @@ -34,27 +34,27 @@ class GeomAlgoAPI_Revolution : public GeomAPI_Interface public: /** \brief Creates revolution for the given shape. * \param[in] theBasis face for revolution. - * \param[in] theFromAngle from angle. * \param[in] theToAngle to angle. + * \param[in] theFromAngle from angle. */ GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr theBasis, std::shared_ptr theAxis, - double theFromAngle, - double theToAngle); + double theToAngle, + double theFromAngle); /** \brief Creates revolution for the given shape. * \param[in] theBasis face for revolution. - * \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis. - * \param[in] theFromAngle from angle. * \param[in] theToShape to bounding shape. Can be empty. In this case offset will be applied to the basis. * \param[in] theToAngle to angle. + * \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis. + * \param[in] theFromAngle from angle. */ GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr theBasis, std::shared_ptr theAxis, - std::shared_ptr theFromShape, - double theFromAngle, std::shared_ptr theToShape, - double theToAngle); + double theToAngle, + std::shared_ptr theFromShape, + double theFromAngle); /// \return true if algorithm succeed. GEOMALGOAPI_EXPORT const bool isDone() const; @@ -102,10 +102,10 @@ private: /// Builds resulting shape. void build(const std::shared_ptr& theBasis, const std::shared_ptr& theAxis, - const std::shared_ptr& theFromShape, - double theFromAngle, const std::shared_ptr& theToShape, - double theToAngle); + double theToAngle, + const std::shared_ptr& theFromShape, + double theFromAngle); private: /// Fields.