X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationFeatureCreate.cpp;h=f08d83972f67e4fd554625036240b6962221400a;hb=036ba4eb4c2df048fd651a54f68882a01769eb08;hp=a1652fc482c575cebb7274b876077ddd138c7aaf;hpb=11496be069750941ff9cbcef21088a56bfd32cdf;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationFeatureCreate.cpp b/src/PartSet/PartSet_OperationFeatureCreate.cpp index a1652fc48..f08d83972 100644 --- a/src/PartSet/PartSet_OperationFeatureCreate.cpp +++ b/src/PartSet/PartSet_OperationFeatureCreate.cpp @@ -24,8 +24,8 @@ #include #include #include +#include -#include #include #include @@ -54,15 +54,15 @@ PartSet_OperationFeatureCreate::~PartSet_OperationFeatureCreate() bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId) { - return theId == SKETCH_LINE_KIND || theId == SKETCH_POINT_KIND || - theId == SKETCH_CIRCLE_KIND || - theId == SKETCH_ARC_KIND || - theId == SKETCH_CONSTRAINT_DISTANCE_KIND || - theId == SKETCH_CONSTRAINT_LENGTH_KIND || - theId == SKETCH_CONSTRAINT_RADIUS_KIND || - theId == SKETCH_CONSTRAINT_PARALLEL_KIND || - theId == SKETCH_CONSTRAINT_PERPENDICULAR_KIND || - theId == SKETCH_CONSTRAINT_COINCIDENCE_KIND; + return theId == SketchPlugin_Line::ID() || theId == SketchPlugin_Point::ID() || + theId == SketchPlugin_Circle::ID() || + theId == SketchPlugin_Arc::ID() || + theId == SketchPlugin_ConstraintDistance::ID() || + theId == SketchPlugin_ConstraintLength::ID() || + theId == SketchPlugin_ConstraintRadius::ID() || + theId == SketchPlugin_ConstraintParallel::ID() || + theId == SketchPlugin_ConstraintPerpendicular::ID() || + theId == SketchPlugin_ConstraintCoincidence::ID(); } bool PartSet_OperationFeatureCreate::canBeCommitted() const @@ -83,8 +83,8 @@ std::list PartSet_OperationFeatureCreate::getSelectionModes(FeaturePtr theF return aModes; } -void PartSet_OperationFeatureCreate::initSelection(const std::list& theSelected, - const std::list& /*theHighlighted*/) +void PartSet_OperationFeatureCreate::initSelection(const std::list& theSelected, + const std::list& /*theHighlighted*/) { myPreSelection = theSelected; } @@ -101,8 +101,8 @@ FeaturePtr PartSet_OperationFeatureCreate::sketch() const } void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView, - const std::list& theSelected, - const std::list& /*theHighlighted*/) + const std::list& theSelected, + const std::list& /*theHighlighted*/) { if (canBeCommitted()) { @@ -113,14 +113,14 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle return; } - double aX = 0, anY = 0; - gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView); + double aX = aPoint.X(), anY = aPoint.Y(); + if (theSelected.empty()) { PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY); } else { - XGUI_ViewerPrs aPrs = theSelected.front(); + ModuleBase_ViewerPrs aPrs = theSelected.front(); const TopoDS_Shape& aShape = aPrs.shape(); if (!aShape.IsNull()) // the point is selected { @@ -138,26 +138,28 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle { PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY); // move to selected line - if (feature()->getKind() == SKETCH_LINE_KIND) { + if (feature()->getKind() == SketchPlugin_Line::ID()) { //FeaturePtr aFeature = aPrs.feature(); //projectPointOnLine(aFeature, myPointSelectionMode, aPoint, theView, aX, anY); } } } } - FeaturePtr aFeature; + ResultPtr aFeature; if (!theSelected.empty()) { - XGUI_ViewerPrs aPrs = theSelected.front(); - aFeature = aPrs.feature(); + ModuleBase_ViewerPrs aPrs = theSelected.front(); + aFeature = aPrs.result(); } - else - aFeature = feature(); // for the widget distance only + // TODO + //else + // aFeature = feature(); // for the widget distance only - bool isApplyed = setWidgetValue(aFeature, aX, anY); + // TODO + /*bool isApplyed = setWidgetValue(aFeature, aX, anY); if (isApplyed) { flushUpdated(); emit activateNextWidget(myActiveWidget); - } + }*/ } void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView) @@ -190,9 +192,9 @@ void PartSet_OperationFeatureCreate::onWidgetActivated(ModuleBase_ModelWidget* t { myActiveWidget = theWidget; if ((myPreSelection.size() > 0) && myActiveWidget) { - const XGUI_ViewerPrs& aPrs = myPreSelection.front(); + const ModuleBase_ViewerPrs& aPrs = myPreSelection.front(); ModuleBase_WidgetValueFeature aValue; - aValue.setFeature(aPrs.feature()); + aValue.setResult(aPrs.result()); if (myActiveWidget->setValue(&aValue)) { myPreSelection.remove(aPrs); emit activateNextWidget(myActiveWidget); @@ -281,7 +283,7 @@ FeaturePtr PartSet_OperationFeatureCreate::createFeature(const bool theFlushMess bool PartSet_OperationFeatureCreate::setWidgetValue(FeaturePtr theFeature, double theX, double theY) { ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature(); - aValue->setFeature(theFeature); + aValue->setResult(theFeature->firstResult()); aValue->setPoint(boost::shared_ptr(new GeomAPI_Pnt2d(theX, theY))); bool isApplyed = myActiveWidget->setValue(aValue);