From: dish Date: Wed, 5 Jun 2024 09:24:57 +0000 (+0000) Subject: Update PartSet_SketcherMgr.cpp and PartSet_WidgetPoint2d.cpp X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fdish%2FCR35153--Sketch_Grid;p=modules%2Fshaper.git Update PartSet_SketcherMgr.cpp and PartSet_WidgetPoint2d.cpp --- diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index f4478d220..526011229 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -120,8 +120,6 @@ #include -#include - //#define DEBUG_DO_NOT_BY_ENTER //#define DEBUG_SKETCHER_ENTITIES //#define DEBUG_SKETCH_ENTITIES_ON_MOVE @@ -378,8 +376,6 @@ static bool MyMultiselectionState = true; void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { - std::wcout << "PartSet_SketcherMgr::onMousePressed BEGIN" << std::endl; - MyModeByDrag = isDragModeCreation(); // Clear dragging mode @@ -388,15 +384,11 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE myMousePoint.setX(theEvent->x()); myMousePoint.setY(theEvent->y()); - if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent)) { - std::wcout << "PartSet_SketcherMgr::onMousePressed END A" << std::endl; + if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent)) return; - } //get2dPoint(theWnd, theEvent, myClickedPoint); - if (!(theEvent->buttons() & Qt::LeftButton)) { - std::wcout << "PartSet_SketcherMgr::onMousePressed END B" << std::endl; + if (!(theEvent->buttons() & Qt::LeftButton)) return; - } ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); ModuleBase_IViewer* aViewer = aWorkshop->viewer(); @@ -405,10 +397,8 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE ModuleBase_OperationFeature* aFOperation = dynamic_cast (getCurrentOperation()); - if (!aFOperation) { - std::wcout << "PartSet_SketcherMgr::onMousePressed END C" << std::endl; + if (!aFOperation) return; - } bool isEditing = aFOperation->isEditOperation(); bool aCanDrag = aViewer->canDragByMouse(); @@ -421,27 +411,21 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE if (isEditing) { // If the current widget is a selector, do nothing, it processes the mouse press ModuleBase_ModelWidget* anActiveWidget = getActiveWidget(); - if(anActiveWidget && anActiveWidget->isViewerSelector()) { - std::wcout << "PartSet_SketcherMgr::onMousePressed END D" << std::endl; + if(anActiveWidget && anActiveWidget->isViewerSelector()) return; - } } // Use only for sketch operations if (myCurrentSketch) { - if (!PartSet_Tools::sketchPlane(myCurrentSketch)) { - std::wcout << "PartSet_SketcherMgr::onMousePressed END E" << std::endl; + if (!PartSet_Tools::sketchPlane(myCurrentSketch)) return; - } bool isSketcher = isSketchOperation(aFOperation); bool isSketchOpe = isNestedSketchOperation(aFOperation); // Avoid non-sketch operations - if ((!isSketchOpe) && (!isSketcher)) { - std::wcout << "PartSet_SketcherMgr::onMousePressed END F" << std::endl; + if ((!isSketchOpe) && (!isSketcher)) return; - } // Ignore creation sketch operation if ((!isSketcher) && (!isEditing)) { @@ -460,7 +444,6 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE aProcessor->mouseReleased(theWnd, theEvent); } } - std::wcout << "PartSet_SketcherMgr::onMousePressed END G" << std::endl; return; } bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier); @@ -472,7 +455,6 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE if (!aFOperation->commit()) aFOperation->abort(); - std::wcout << "PartSet_SketcherMgr::onMousePressed END H" << std::endl; return; } // Init flyout point for radius rotation @@ -541,7 +523,6 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE } } } - std::wcout << "PartSet_SketcherMgr::onMousePressed END LAST" << std::endl; } void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) @@ -664,7 +645,6 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { - std::wcout << "PartSet_SketcherMgr::onMouseMoved START" << std::endl; #ifdef DEBUG_SKETCH_ENTITIES_ON_MOVE CompositeFeaturePtr aSketch = activeSketch(); if (aSketch.get()) { @@ -679,10 +659,8 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve } #endif - if (myModule->sketchReentranceMgr()->processMouseMoved(theWnd, theEvent)) { - std::wcout << "PartSet_SketcherMgr::onMouseMoved END A" << std::endl; + if (myModule->sketchReentranceMgr()->processMouseMoved(theWnd, theEvent)) return; - } ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); @@ -728,15 +706,10 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve // mouse press signal in the viewer(it call Select for AIS context and the dragged objects are // deselected). This flag should be restored in the slot, processed the mouse release signal. ModuleBase_Operation* aCurrentOperation = getCurrentOperation(); - if (!aCurrentOperation) { - std::wcout << "PartSet_SketcherMgr::onMouseMoved END B" << std::endl; + if (!aCurrentOperation) return; - } - if (isSketchOperation(aCurrentOperation)) { - std::wcout << "PartSet_SketcherMgr::onMouseMoved END C" << std::endl; + if (isSketchOperation(aCurrentOperation)) return; // No edit operation activated - } - #ifdef DRAGGING_DEBUG QTime t; t.start(); @@ -828,8 +801,6 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve get2dPoint(theWnd, theEvent, aMousePnt, true /*theSnap*/); myCurrentPoint = aMousePnt; } - - std::wcout << "PartSet_SketcherMgr::onMouseMoved END LAST" << std::endl; } void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 51d4dbf6e..f097f9591 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -82,8 +82,6 @@ #include #include -#include - const double MaxCoordinate = 1e12; static QStringList MyFeaturesForCoincedence; @@ -136,8 +134,6 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, bool PartSet_WidgetPoint2D::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) { - std::wcout << "PartSet_WidgetPoint2D::isValidSelectionCustom BEGIN" << std::endl; - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); if (aModule->sketchReentranceMgr()->isInternalEditActive()) return true; /// when internal edit is started a new feature is created. I has not results, AIS @@ -193,8 +189,6 @@ bool PartSet_WidgetPoint2D::isValidSelectionForAttribute_( const ModuleBase_ViewerPrsPtr& theValue, const AttributePtr& theAttribute) { - std::wcout << "PartSet_WidgetPoint2D::isValidSelectionForAttribute_ BEGIN" << std::endl; - bool aValid = false; // stores the current values of the widget attribute @@ -222,8 +216,6 @@ bool PartSet_WidgetPoint2D::isValidSelectionForAttribute_( bool PartSet_WidgetPoint2D::setSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) { - std::wcout << "PartSet_WidgetPoint2D::setSelectionCustom BEGIN" << std::endl; - bool isDone = false; GeomShapePtr aShape = theValue->shape(); if (aShape.get() && !aShape->isNull()) { @@ -244,8 +236,6 @@ bool PartSet_WidgetPoint2D::setSelectionCustom(const ModuleBase_ViewerPrsPtr& th bool PartSet_WidgetPoint2D::resetCustom() { - std::wcout << "PartSet_WidgetPoint2D::resetCustom BEGIN" << std::endl; - bool aDone = false; if (!isUseReset() || isComputedDefault() /*|| myXSpin->hasVariable() || myYSpin->hasVariable()*/) { @@ -283,8 +273,6 @@ PartSet_WidgetPoint2D::~PartSet_WidgetPoint2D() bool PartSet_WidgetPoint2D::setSelection(QList& theValues, const bool theToValidate) { - std::wcout << "PartSet_WidgetPoint2D::setSelection BEGIN" << std::endl; - bool isDone = false; if (theValues.empty()) return isDone; @@ -316,8 +304,6 @@ bool PartSet_WidgetPoint2D::setSelection(QList& theValu bool PartSet_WidgetPoint2D::setPoint(double theX, double theY) { - std::wcout << "PartSet_WidgetPoint2D::setPoint BEGIN" << std::endl; - if (fabs(theX) >= MaxCoordinate) return false; if (fabs(theY) >= MaxCoordinate) @@ -335,8 +321,6 @@ bool PartSet_WidgetPoint2D::setPoint(double theX, double theY) bool PartSet_WidgetPoint2D::storeValueCustom() { - std::wcout << "PartSet_WidgetPoint2D::storeValueCustom BEGIN" << std::endl; - std::shared_ptr aData = myFeature->data(); if (!aData || !aData->isValid()) // can be on abort of sketcher element return false; @@ -379,8 +363,6 @@ bool PartSet_WidgetPoint2D::storeValueCustom() bool PartSet_WidgetPoint2D::restoreValueCustom() { - std::wcout << "PartSet_WidgetPoint2D::restoreValueCustom BEGIN" << std::endl; - std::shared_ptr aData = myFeature->data(); AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( aData->attribute(attributeID())); @@ -396,8 +378,6 @@ bool PartSet_WidgetPoint2D::restoreValueCustom() void PartSet_WidgetPoint2D::storeCurentValue() { - std::wcout << "PartSet_WidgetPoint2D::storeCurentValue BEGIN" << std::endl; - // do not use cash if a variable is used //if (myXSpin->hasVariable() || myYSpin->hasVariable()) // return; @@ -411,8 +391,6 @@ void PartSet_WidgetPoint2D::storeCurentValue() bool PartSet_WidgetPoint2D::restoreCurentValue() { - std::wcout << "PartSet_WidgetPoint2D::restoreCurentValue BEGIN" << std::endl; - bool aRestoredAndHidden = true; bool isVisible = myIsFeatureVisibleInCash; @@ -439,8 +417,6 @@ bool PartSet_WidgetPoint2D::restoreCurentValue() QList PartSet_WidgetPoint2D::getControls() const { - std::wcout << "PartSet_WidgetPoint2D::getControls BEGIN" << std::endl; - QList aControls; aControls.append(myXSpin); aControls.append(myYSpin); @@ -450,8 +426,6 @@ QList PartSet_WidgetPoint2D::getControls() const //******************************************************************** void PartSet_WidgetPoint2D::selectionModes(int& theModuleSelectionModes, QIntList& theModes) { - std::wcout << "PartSet_WidgetPoint2D::selectionModes BEGIN" << std::endl; - theModuleSelectionModes = -1; theModes << TopAbs_VERTEX; theModes << TopAbs_EDGE; @@ -460,8 +434,6 @@ void PartSet_WidgetPoint2D::selectionModes(int& theModuleSelectionModes, QIntLis //******************************************************************** void PartSet_WidgetPoint2D::activateCustom() { - std::wcout << "PartSet_WidgetPoint2D::activateCustom BEGIN" << std::endl; - if (!isEditingMode()) { FeaturePtr aFeature = feature(); if (aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID()) @@ -475,8 +447,6 @@ void PartSet_WidgetPoint2D::setHighlighted(bool isHighlighted) void PartSet_WidgetPoint2D::deactivate() { - std::wcout << "PartSet_WidgetPoint2D::deactivate BEGIN" << std::endl; - // the value of the control should be stored to model if it was not // initialized yet. It is important when we leave this control by Tab key. // It should not be performed by the widget activation as the preview @@ -491,8 +461,6 @@ void PartSet_WidgetPoint2D::deactivate() bool PartSet_WidgetPoint2D::setConstraintToPoint(double theClickedX, double theClickedY, const std::shared_ptr& theValue) { - std::wcout << "PartSet_WidgetPoint2D::setConstraintToPoint BEGIN" << std::endl; - AttributeRefAttrPtr aRefAttr = attributeRefAttr(); if (aRefAttr.get()) fillRefAttribute(theClickedX, theClickedY, theValue); @@ -533,8 +501,6 @@ bool PartSet_WidgetPoint2D::setConstraintToPoint(double theClickedX, double theC bool PartSet_WidgetPoint2D::setConstraintToObject(const ObjectPtr& theObject) { - std::wcout << "PartSet_WidgetPoint2D::setConstraintToObject BEGIN" << std::endl; - AttributeRefAttrPtr aRefAttr = attributeRefAttr(); if (aRefAttr.get()) { fillRefAttribute(theObject); @@ -617,8 +583,6 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo void PartSet_WidgetPoint2D::processSelection(const ModuleBase_ViewerPrsPtr& theValue, double theX, double theY) { - std::wcout << "PartSet_WidgetPoint2D::processSelection BEGIN" << std::endl; - if (!setPoint(theX, theY)) return; // if we have selection and use it @@ -761,8 +725,6 @@ void PartSet_WidgetPoint2D::setPreSelection( ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { - std::wcout << "PartSet_WidgetPoint2D::setPreSelection BEGIN" << std::endl; - myPreSelected = thePreSelected; mouseReleased(theWnd, theEvent); } @@ -776,14 +738,10 @@ void PartSet_WidgetPoint2D::getGeomSelection_(const std::shared_ptr(myWorkshop->module()); - if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) { - std::wcout << "PartSet_WidgetPoint2D:::mouseMoved if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) BEGIN" << std::endl; + if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) return; - } double aX = 0, aY = 0; // Coords at sketch plane. bool success = PartSet_MouseProcessor::convertPointToLocal(myWorkshop, mySketch, theWindow, theEvent->pos(), aX, aY, true, true, true); @@ -813,8 +771,6 @@ double PartSet_WidgetPoint2D::y() const bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr& theFeature, double theX, double theY) { - std::wcout << "PartSet_WidgetPoint2D:::isFeatureContainsPoint BEGIN" << std::endl; - bool aPointIsFound = false; if (feature()->getKind() != SketchPlugin_Line::ID())