X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationSketchBase.cpp;h=e8f081e4d581d19beab5a3cf4f46dc48dd91e42d;hb=e30796dab1aa68c01201b2b89d4292d3fcbbc4d4;hp=daa0211b1d8b0656ccaf4f0162af8357a5057598;hpb=3bb056033567ef420a3eb7cdc2a2cada3d94ee06;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index daa0211b1..e8f081e4d 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -3,10 +3,17 @@ // Author: Natalia ERMOLAEVA #include +#include +#include #include - #include +#include +#include + +#include +#include +#include #ifdef _DEBUG #include @@ -14,9 +21,8 @@ using namespace std; -PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId, - QObject* theParent) -: ModuleBase_Operation(theId, theParent) +PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId, QObject* theParent) + : ModuleBase_Operation(theId, theParent) { } @@ -24,36 +30,77 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase() { } -boost::shared_ptr PartSet_OperationSketchBase::preview( - boost::shared_ptr theFeature) const +boost::shared_ptr PartSet_OperationSketchBase::preview(FeaturePtr theFeature) { - boost::shared_ptr aFeature = - boost::dynamic_pointer_cast(theFeature); - return aFeature->preview(); + boost::shared_ptr aFeature = boost::dynamic_pointer_cast< + SketchPlugin_Feature>(theFeature); + if (aFeature) { + ResultPtr aRes = aFeature->firstResult(); + ResultBodyPtr aBody = boost::dynamic_pointer_cast(aRes); + if (aBody) + return aBody->shape(); + } + return boost::shared_ptr(); } -std::map, boost::shared_ptr > - PartSet_OperationSketchBase::preview() const +std::list PartSet_OperationSketchBase::subFeatures() const { - return std::map, boost::shared_ptr >(); + return std::list(); } -boost::shared_ptr PartSet_OperationSketchBase::createFeature() +std::list PartSet_OperationSketchBase::getSelectionModes(ObjectPtr theFeature) const { - boost::shared_ptr aFeature = ModuleBase_Operation::createFeature(); - emit featureConstructed(aFeature, FM_Activation); - return aFeature; + //TODO: Define position of selection modes definition + std::list aModes; + FeaturePtr aFeature = boost::dynamic_pointer_cast(theFeature); + if (aFeature && PartSet_Tools::isConstraintFeature(aFeature->getKind())) { + aModes.push_back(AIS_DSM_Text); + aModes.push_back(AIS_DSM_Line); + } else { + aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX)); + aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE)); + } + return aModes; +} +FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage) +{ + ModuleBase_Operation::createFeature(theFlushMessage); + if (myFeature) + emit featureConstructed(myFeature, FM_Activation); + return myFeature; } - -void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView) +void PartSet_OperationSketchBase::mousePressed( + QMouseEvent* theEvent, Handle_V3d_View theView, + const std::list& theSelected, + const std::list& theHighlighted) { } -void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView, - const std::list& theSelected) +void PartSet_OperationSketchBase::mouseReleased( + QMouseEvent* theEvent, Handle_V3d_View theView, + const std::list& theSelected, + const std::list& theHighlighted) { } -void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView, - const std::list& theSelected) +void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView) +{ +} +void PartSet_OperationSketchBase::mouseDoubleClick( + QMouseEvent* theEvent, Handle_V3d_View theView, + const std::list& theSelected, + const std::list& theHighlighted) +{ +} + +void PartSet_OperationSketchBase::restartOperation(const std::string& theType, ObjectPtr theFeature) { + FeaturePtr aFeature = ModelAPI_Feature::feature(theFeature); + if (aFeature) { + QStringList aNested = this->nestedFeatures(); + if (!aNested.isEmpty()) { + if (!aNested.contains(QString(aFeature->getKind().c_str()))) + return; + } + } + emit restartRequired(theType, theFeature); }