X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_Tools.cpp;h=2245d51e0a2045469d80a4a05aa44b3ede228342;hb=cab05e015079888e5cd3a501e9d5b6d23facfc96;hp=851ae64a43ec9cf0411bcfffab04bd04239a3f45;hpb=e38c476552a606fe5c3fa5d5e743335f41ff576a;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 851ae64a4..2245d51e0 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2021 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -54,10 +54,10 @@ #include #include +#include #ifdef HAVE_SALOME #include -#include #include #endif @@ -92,6 +92,7 @@ #include #include #include +#include #include #include @@ -479,36 +480,6 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe } } -/*bool setDefaultDeviationCoefficient(std::shared_ptr theGeomShape) -{ - if (!theGeomShape.get()) - return false; - // if the shape could not be exploded on faces, it contains only wires, edges, and vertices - // correction of deviation for them should not influence to the application performance - GeomAPI_ShapeExplorer anExp(theGeomShape, GeomAPI_Shape::FACE); - bool anEmpty = anExp.empty(); - return !anExp.more(); -}*/ - -/*void setDefaultDeviationCoefficient(const std::shared_ptr& theResult, - const Handle(Prs3d_Drawer)& theDrawer) -{ - if (!theResult.get()) - return; - bool aUseDeviation = false; - - std::string aResultGroup = theResult->groupName(); - if (aResultGroup == ModelAPI_ResultConstruction::group()) - aUseDeviation = true; - else if (aResultGroup == ModelAPI_ResultBody::group()) { - GeomShapePtr aGeomShape = theResult->shape(); - if (aGeomShape.get()) - aUseDeviation = setDefaultDeviationCoefficient(aGeomShape); - } - if (aUseDeviation) - theDrawer->SetDeviationCoefficient(DEFAULT_DEVIATION_COEFFICIENT); -} -*/ void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer) { @@ -1103,10 +1074,7 @@ bool askToDelete(const std::set theFeatures, aText += QString(QObject::tr(aMsg)); aDetailedText += QString(QObject::tr(aMsgDetails)) .arg(aParamFeatureNames.join(aSep)); -#ifdef _DEBUG - QPushButton *aReplaceButton = -#endif - aMessageBox.addButton(QObject::tr("Replace"), QMessageBox::ActionRole); + aMessageBox.addButton(QObject::tr("Replace"), QMessageBox::ActionRole); } if (!aText.isEmpty()) { @@ -1131,6 +1099,33 @@ bool askToDelete(const std::set theFeatures, return true; } +//************************************************************** +bool warningAboutConflict(QWidget* theParent, const std::string& theWarningText) +{ + QMessageBox aMessageBox(theParent); + aMessageBox.setWindowTitle(QObject::tr("Conflicts in constraint")); + aMessageBox.setIcon(QMessageBox::Warning); + aMessageBox.setText((theWarningText + "\nConstraints will be removed or substituted").c_str()); + + QCheckBox* aCheckBox = new QCheckBox; + + aCheckBox->setTristate(false); + aCheckBox->setText("switch off the notifications."); + + aMessageBox.setCheckBox(aCheckBox); + aMessageBox.setStandardButtons(QMessageBox::Ok); + + aMessageBox.exec(); + + if (aCheckBox->isChecked()) + { + ModuleBase_Preferences::resourceMgr()->setValue(SKETCH_TAB_NAME, + "notify_change_constraint", false); + } + + return true; +} + //************************************************************** void convertToFeatures(const QObjectPtrList& theObjects, std::set& theFeatures) { @@ -1406,7 +1401,8 @@ static void setDisplayingByLoop(DocumentPtr theDoc, int theSize, { for (int anIndex = theSize - 1; anIndex >= 0; --anIndex) { ObjectPtr anObject = theDoc->object(theGroup, anIndex); - anObject->setDisplayed((theDisplayingId == 1 && anIndex == theSize - 1) || theDisplayingId == 2); + anObject->setDisplayed((theDisplayingId == 1 && anIndex == theSize - 1) || + theDisplayingId == 2); } } @@ -1440,11 +1436,14 @@ void setDisplaying(ResultPartPtr thePart, bool theDisplayFromScript) return; } - setDisplayingByLoop(aDoc, aConstructionSize, - ModelAPI_ResultConstruction::group(), theDisplayFromScript, aDisplayingId); - setDisplayingByLoop(aDoc, aGroupSize, ModelAPI_ResultGroup::group(), theDisplayFromScript, aDisplayingId); - setDisplayingByLoop(aDoc, aFieldSize, ModelAPI_ResultField::group(), theDisplayFromScript, aDisplayingId); - setDisplayingByLoop(aDoc, aResultSize, ModelAPI_ResultBody::group(), theDisplayFromScript, aDisplayingId); + setDisplayingByLoop(aDoc, aConstructionSize, ModelAPI_ResultConstruction::group(), + theDisplayFromScript, aDisplayingId); + setDisplayingByLoop(aDoc, aGroupSize, ModelAPI_ResultGroup::group(), + theDisplayFromScript, aDisplayingId); + setDisplayingByLoop(aDoc, aFieldSize, ModelAPI_ResultField::group(), + theDisplayFromScript, aDisplayingId); + setDisplayingByLoop(aDoc, aResultSize, ModelAPI_ResultBody::group(), + theDisplayFromScript, aDisplayingId); isDoingDisplay = false; }