From aceff7878bbcc7a44510096de268a781e7380c6f Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 30 Mar 2022 14:45:44 +0300 Subject: [PATCH] Suppression of warnings, application launching problems in different cases (on Windows) and minor improvements of the SHAPER source code. --- .../CollectionPlugin_GroupShape.cpp | 3 +-- src/ExchangePlugin/ExchangePlugin_Import.h | 4 ++-- .../ExchangePlugin_ImportFeature.cpp | 8 +++---- .../FeaturesPlugin_NormalToFace.cpp | 2 +- src/FeaturesPlugin/doc/translationFeature.rst | 7 ++++--- src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp | 21 +++++++++---------- .../GeomAlgoAPI_STEPImportXCAF.cpp | 5 ++--- src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp | 2 +- src/Model/Model_AttributeImage.cpp | 4 ++-- src/ModelAPI/ModelAPI_Tools.h | 2 +- src/ModuleBase/ModuleBase_Preferences.cpp | 4 ++++ src/ModuleBase/ModuleBase_ResultPrs.cpp | 2 +- src/ModuleBase/ModuleBase_Tools.cpp | 2 +- .../ModuleBase_WidgetSelectionFilter.cpp | 4 ++++ .../ParametersPlugin_WidgetParamsMgr.cpp | 4 ++++ src/PartSet/PartSet_CenterPrs.cpp | 3 +-- src/PartSet/PartSet_ExternalPointsMgr.cpp | 4 ++++ src/PartSet/PartSet_FieldStepPrs.cpp | 3 +-- src/PartSet/PartSet_Module.cpp | 13 ++++++------ src/PartSet/PartSet_ResultSketchPrs.cpp | 2 +- src/PartSet/PartSet_WidgetSketchCreator.cpp | 4 ++++ src/PartSet/PartSet_WidgetSketchLabel.cpp | 4 ++++ .../PrimitivesPlugin_Tube.cpp | 1 - src/SketcherPrs/SketcherPrs_Coincident.cpp | 3 +-- src/SketcherPrs/SketcherPrs_Collinear.cpp | 3 +-- src/SketcherPrs/SketcherPrs_HVDirection.cpp | 3 +-- src/SketcherPrs/SketcherPrs_Middle.cpp | 3 +-- src/SketcherPrs/SketcherPrs_Mirror.cpp | 4 +--- src/SketcherPrs/SketcherPrs_Parallel.cpp | 4 +--- src/XGUI/XGUI_ActionsMgr.cpp | 5 ++++- src/XGUI/XGUI_ContextMenuMgr.cpp | 4 ++++ src/XGUI/XGUI_Displayer.cpp | 12 ++--------- src/XGUI/XGUI_FacesPanel.cpp | 4 ++++ src/XGUI/XGUI_Selection.cpp | 4 ++++ src/XGUI/XGUI_SelectionMgr.cpp | 4 ++++ src/XGUI/XGUI_Workshop.cpp | 2 ++ src/XGUI/XGUI_WorkshopListener.cpp | 18 ++++++++++------ 37 files changed, 105 insertions(+), 76 deletions(-) diff --git a/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp b/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp index 037380041..6069ee18a 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp @@ -35,9 +35,8 @@ void CollectionPlugin_GroupShape::execute() /// unique shape, remove compound on type TopoDS_Iterator anIt(aShape); - TopoDS_Shape aShape = anIt.Value(); std::shared_ptr aRes(new GeomAPI_Shape); - aRes->setImpl(new TopoDS_Shape(aShape)); + aRes->setImpl(new TopoDS_Shape(anIt.Value())); aGroup->store(GeomShapePtr()); aGroup->store(aRes); aCompound = aGroup->shape(); diff --git a/src/ExchangePlugin/ExchangePlugin_Import.h b/src/ExchangePlugin/ExchangePlugin_Import.h index c9f98594d..dcf9e5135 100644 --- a/src/ExchangePlugin/ExchangePlugin_Import.h +++ b/src/ExchangePlugin/ExchangePlugin_Import.h @@ -85,7 +85,7 @@ class ExchangePlugin_ImportBase : public ModelAPI_Feature AttributeIntegerPtr& aTargetAttr); }; -EXCHANGEPLUGIN_EXPORT class ExchangePlugin_Import : public ExchangePlugin_ImportBase +class ExchangePlugin_Import : public ExchangePlugin_ImportBase { public: /// Feature kind @@ -158,7 +158,7 @@ EXCHANGEPLUGIN_EXPORT class ExchangePlugin_Import : public ExchangePlugin_Import }; -EXCHANGEPLUGIN_EXPORT class ExchangePlugin_Import_Image : public ExchangePlugin_ImportBase +class ExchangePlugin_Import_Image : public ExchangePlugin_ImportBase { public: /// Feature kind diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index e077e4ca7..a13a1a445 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -341,10 +341,10 @@ void ExchangePlugin_ImportFeature::setMaterielGroup( if (aRes->get() && ((*aRes)->data()->name() == (*aResMat))) { if (aShape->isCompound() || aShape->isCompSolid()) { - GeomAPI_ShapeIterator anIt(aShape); - for (; anIt.more(); anIt.next()) { - aSelectionList->setSelectionType(anIt.current()->shapeTypeStr()); - aSelectionList->append(theResultBody,anIt.current()); + GeomAPI_ShapeIterator aShapeIt(aShape); + for (; aShapeIt.more(); aShapeIt.next()) { + aSelectionList->setSelectionType(aShapeIt.current()->shapeTypeStr()); + aSelectionList->append(theResultBody, aShapeIt.current()); } } else { aSelectionList->setSelectionType(aShape->shapeTypeStr()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp index 862707655..1930054e0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp @@ -55,7 +55,7 @@ void FeaturesPlugin_NormalToFace::initAttributes() } //================================================================================================= -void FeaturesPlugin_NormalToFace::attributeChanged(const std::string& theID) +void FeaturesPlugin_NormalToFace::attributeChanged(const std::string& /*theID*/) { } diff --git a/src/FeaturesPlugin/doc/translationFeature.rst b/src/FeaturesPlugin/doc/translationFeature.rst index 81dc77ab0..e36901d2e 100644 --- a/src/FeaturesPlugin/doc/translationFeature.rst +++ b/src/FeaturesPlugin/doc/translationFeature.rst @@ -146,9 +146,10 @@ The result of operation is a shifted initial shape. .. _transformation_subshapes: -Transformation of COMPSOLID subshapes is prohibited. Read more about transformation of COMPOUND subshapes. -====================== +Transformation of COMPSOLID subshapes is prohibited. +=========== -If you select one or more subshapes of COMPOUND as transformation **Main objects**, all other subshapes will be also included in result at their original locations. +If you select one or more subshapes of COMPOUND as transformation (translation or other operation that changes the shape position or orientation) **Main objects**, +all other subshapes will be also included in result at their original locations. Transformation of COMPSOLID subshapes is prohibited, because we cannot guarantee the result still be a COMPSOLID after moving/duplicating some parts of it. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp index 99c3dc372..7a0c0df94 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp @@ -95,7 +95,7 @@ bool readUnits(STEPControl_Reader& aReader, else { //cout<<"need re-scale a model"< STEPImport(const std::string& theFileName, - const std::string& theFormatName, + const std::string& /*theFormatName*/, const bool theScalInterUnits, std::string& theError) { @@ -116,7 +116,7 @@ std::shared_ptr STEPImport(const std::string& theFileName, STEPControl_Reader aReader; //VSR: 16/09/09: Convert to METERS - Interface_Static::SetCVal("xstep.cascade.unit","M"); + Interface_Static::SetCVal("xstep.cascade.unit", "M"); Interface_Static::SetIVal("read.step.ideas", 1); Interface_Static::SetIVal("read.step.nonmanifold", 1); @@ -131,7 +131,7 @@ std::shared_ptr STEPImport(const std::string& theFileName, if (status == IFSelect_RetDone) { // Regard or not the model units - if( !readUnits(aReader,theScalInterUnits,theError)) { + if( !readUnits(aReader, theScalInterUnits, theError)) { std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape()); return aGeomShape; @@ -188,7 +188,7 @@ std::shared_ptr STEPImport(const std::string& theFileName, aResShape = compound; // Check if any BRep entity has been read, there must be at least a vertex - if ( !TopExp_Explorer( aResShape, TopAbs_VERTEX ).More() ) + if (!TopExp_Explorer(aResShape, TopAbs_VERTEX).More()) { theError = "No geometrical data in the imported file."; std::shared_ptr aGeomShape(new GeomAPI_Shape); @@ -215,7 +215,7 @@ GeomShapePtr STEPImportAttributs(const std::string& theFileName, std::shared_ptr theResultBody, const bool theScalInterUnits, const bool theMaterials, - const bool theColor, + const bool /*theColor*/, std::map< std::wstring, std::list>& theMaterialShape, std::string& theError) @@ -225,7 +225,7 @@ GeomShapePtr STEPImportAttributs(const std::string& theFileName, STEPControl_Reader aReader; std::shared_ptr aGeomShape(new GeomAPI_Shape); - Interface_Static::SetCVal("xstep.cascade.unit","M"); + Interface_Static::SetCVal("xstep.cascade.unit", "M"); Interface_Static::SetIVal("read.step.ideas", 1); Interface_Static::SetIVal("read.step.nonmanifold", 1); @@ -236,7 +236,7 @@ GeomShapePtr STEPImportAttributs(const std::string& theFileName, if (status == IFSelect_RetDone) { // Regard or not the model units - if( !readUnits(aReader,theScalInterUnits,theError)) { + if( !readUnits(aReader, theScalInterUnits, theError)) { aGeomShape->setImpl(new TopoDS_Shape()); return aGeomShape; } @@ -254,7 +254,6 @@ GeomShapePtr STEPImportAttributs(const std::string& theFileName, if (aCafreader.ReadFile(theFileName.c_str()) != IFSelect_RetDone) { theError = "Wrong format of the imported file. Can't import file."; - std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape()); return aGeomShape; } @@ -264,8 +263,8 @@ GeomShapePtr STEPImportAttributs(const std::string& theFileName, theMaterials, theMaterialShape, theError); - } catch (OSD_Exception& e) { + } catch (OSD_Exception&) { //Try to load STEP file without colors... - return STEPImport(theFileName,"",theScalInterUnits,theError); + return STEPImport(theFileName, "", theScalInterUnits, theError); } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp index 9aeaf48a3..d9926abae 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp @@ -120,7 +120,7 @@ std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, //============================================================================= std::shared_ptr setgeom(const Handle(XCAFDoc_ShapeTool) &theShapeTool, - const TDF_Label &theLabel, + const TDF_Label& /*theLabel*/, std::string& theError) { BRep_Builder aB; @@ -164,7 +164,6 @@ std::shared_ptr setgeom(const Handle(XCAFDoc_ShapeTool) &theShape // Check if any BRep entity has been read, there must be at least a vertex if (!TopExp_Explorer( aShape, TopAbs_VERTEX ).More()) { theError = "No geometrical data in the imported file."; - std::shared_ptr aGeomShape(new GeomAPI_Shape); aGeomShape->setImpl(new TopoDS_Shape()); return aGeomShape; } @@ -302,7 +301,7 @@ void storeMaterial( std::shared_ptr theResultBody, const Handle(Standard_Transient) &theEnti, const TopTools_IndexedMapOfShape &theIndices, const Handle(Transfer_TransientProcess) &theTP, - const TDF_Label &theShapeLabel, + const TDF_Label &/*theShapeLabel*/, std::map< std::wstring, std::list> &theMaterialShape ) { // Treat Product Definition Shape only. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp index a26b7257e..3f466b59b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp @@ -65,7 +65,7 @@ std::string File_Tools::path(const std::string& theFileName) { OSD_Path aPath (theFileName.c_str()); Standard_Integer aTrekLen = - theFileName.size() - aPath.Extension().Length() - aPath.Name().Length(); + int(theFileName.size()) - aPath.Extension().Length() - aPath.Name().Length(); return theFileName.substr(0, aTrekLen); } diff --git a/src/Model/Model_AttributeImage.cpp b/src/Model/Model_AttributeImage.cpp index c74e42945..36362a2dc 100644 --- a/src/Model/Model_AttributeImage.cpp +++ b/src/Model/Model_AttributeImage.cpp @@ -41,7 +41,7 @@ void Model_AttributeImage::setTexture(const int theWidth, if (theWidth > 0 && theHeight > 0 && theByteArray.size() > 0) { // set new data // Find or create attributes Handle_TDataStd_ByteArray aByteArray = - TDataStd_ByteArray::Set(myLab, 0, theByteArray.size() - 1); + TDataStd_ByteArray::Set(myLab, 0, int(theByteArray.size()) - 1); Handle_TDataStd_IntegerArray aDimensions = TDataStd_IntegerArray::Set(myLab, 0, 1); Handle_TDataStd_Comment aFormat = TDataStd_Comment::Set(myLab, theFormat.c_str()); @@ -52,7 +52,7 @@ void Model_AttributeImage::setTexture(const int theWidth, // Texture Handle(TColStd_HArray1OfByte) aNewArray = - new TColStd_HArray1OfByte(0, theByteArray.size() - 1); + new TColStd_HArray1OfByte(0, int(theByteArray.size()) - 1); std::list::const_iterator itBA = theByteArray.begin(); for (int j = 0; itBA != theByteArray.end(); ++itBA, ++j) { aNewArray->SetValue(j, (Standard_Byte)(*itBA)); diff --git a/src/ModelAPI/ModelAPI_Tools.h b/src/ModelAPI/ModelAPI_Tools.h index 904b82132..c3d7b9901 100644 --- a/src/ModelAPI/ModelAPI_Tools.h +++ b/src/ModelAPI/ModelAPI_Tools.h @@ -51,7 +51,7 @@ MODELAPI_EXPORT std::shared_ptr shape( */ MODELAPI_EXPORT std::string getFeatureError(const std::shared_ptr& theFeature); -MODELAPI_EXPORT struct ResultBaseAlgo { +struct ResultBaseAlgo { std::shared_ptr resultBody; std::shared_ptr baseShape; std::shared_ptr makeShape; diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index d8d1c417a..5be988134 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -33,6 +33,10 @@ #include #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + const QString ModuleBase_Preferences::VIEWER_SECTION = "Viewer"; const QString ModuleBase_Preferences::MENU_SECTION = "Menu"; const QString ModuleBase_Preferences::GENERAL_SECTION = "General"; diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 54107b53f..9047d3a39 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -444,7 +444,7 @@ bool ModuleBase_ResultPrs::appendVertexSelection(const Handle(SelectMgr_Selectio /// visualizes it in Ring style) OCCT version is 7.0.0 with path for SHAPER module. Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(aShape, aPriority, Standard_True); StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection, - aDeflection, myDrawer->HLRAngle(), 9, 500); + aDeflection, myDrawer->DeviationAngle(), 9, 500); NCollection_Vector anEntities = aSelection->Entities(); diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index f1cf9f0d1..c4ae53fe1 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -54,10 +54,10 @@ #include #include +#include #ifdef HAVE_SALOME #include -#include #include #endif diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp index e027461f6..83c800cf5 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp @@ -57,6 +57,10 @@ #include #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + FeaturePtr ModuleBase_WidgetSelectionFilter::SelectorFeature; std::string ModuleBase_WidgetSelectionFilter::AttributeId; diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index 6cad00013..514726b11 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -56,6 +56,10 @@ #include #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + enum ColumnType { Col_Name, Col_Equation, diff --git a/src/PartSet/PartSet_CenterPrs.cpp b/src/PartSet/PartSet_CenterPrs.cpp index 1d791dcf2..d323e7cf8 100644 --- a/src/PartSet/PartSet_CenterPrs.cpp +++ b/src/PartSet/PartSet_CenterPrs.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -59,7 +58,7 @@ void PartSet_CenterPrs::drawPoint(const Handle(Prs3d_Presentation)& thePrs, PtA->SetColor(theColor); Handle(Geom_Point) aPnt = Component(); - Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(thePrs); + Handle(Graphic3d_Group) TheGroup = thePrs->CurrentGroup(); TheGroup->SetPrimitivesAspect(PtA); Handle(Graphic3d_ArrayOfPoints) aPoint = new Graphic3d_ArrayOfPoints (1); diff --git a/src/PartSet/PartSet_ExternalPointsMgr.cpp b/src/PartSet/PartSet_ExternalPointsMgr.cpp index b28d5dd46..0c16d6e8b 100644 --- a/src/PartSet/PartSet_ExternalPointsMgr.cpp +++ b/src/PartSet/PartSet_ExternalPointsMgr.cpp @@ -44,6 +44,10 @@ #include #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + PartSet_ExternalPointsMgr::PartSet_ExternalPointsMgr(ModuleBase_IWorkshop* theWorkshop, const CompositeFeaturePtr& theSketch) : QObject(theWorkshop), myWorkshop(theWorkshop), mySketch(theSketch) diff --git a/src/PartSet/PartSet_FieldStepPrs.cpp b/src/PartSet/PartSet_FieldStepPrs.cpp index c09da9f91..ae396483b 100644 --- a/src/PartSet/PartSet_FieldStepPrs.cpp +++ b/src/PartSet/PartSet_FieldStepPrs.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include @@ -217,7 +216,7 @@ void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t QStringList aValues = strings(); AttributeSelectionListPtr aSelList = aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); - Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs); + Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); for (int i = 0; i < aSelList->size(); i++) { AttributeSelectionPtr aSelection = aSelList->value(i); GeomShapePtr aShapePtr = aSelection->value(); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index f3e8ad1a5..683173100 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1144,10 +1144,9 @@ void PartSet_Module::onViewTransformed(int theTrsfType) Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer(); Handle(V3d_View) aView; double aScale = 0; - for (aV3dViewer->InitDefinedViews(); - aV3dViewer->MoreDefinedViews(); - aV3dViewer->NextDefinedViews()) { - Handle(V3d_View) aV = aV3dViewer->DefinedView(); + V3d_ListOfView::Iterator aDefinedViews(aV3dViewer->DefinedViews()); + for (; aDefinedViews.More(); aDefinedViews.Next()) { + Handle(V3d_View) aV = aDefinedViews.Value(); double aS = aV->Scale(); if (aS > aScale) { aScale = aS; @@ -1810,11 +1809,11 @@ void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex) { if (!aPart.get() && aObj->groupName() == ModelAPI_ResultParameter::group()) { - QObjectPtrList aObjects = aWorkshop->objectBrowser()->selectedObjects(); + QObjectPtrList aSelectedObjects = aWorkshop->objectBrowser()->selectedObjects(); FeaturePtr aFeature; ResultParameterPtr aParam; - foreach(ObjectPtr aObj, aObjects) { - aParam = std::dynamic_pointer_cast(aObj); + foreach(ObjectPtr aSelected, aSelectedObjects) { + aParam = std::dynamic_pointer_cast(aSelected); if (aParam.get()) break; } diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 497f5a0b2..d44711dd9 100644 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -232,7 +232,7 @@ void PartSet_ResultSketchPrs::appendShapeSelection(const Handle(SelectMgr_Select theShape, theTypeOfSelection, aDeflection, - myDrawer->HLRAngle(), + myDrawer->DeviationAngle(), myDrawer->IsAutoTriangulation()); } catch ( Standard_Failure ) { } diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index 14bfd60fa..7db82ccdb 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -69,6 +69,10 @@ #include #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + #define DEBUG_UNDO_INVALID_SKETCH diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 4b0581d6f..de6dce00b 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -80,6 +80,10 @@ #include #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + #ifndef DBL_MAX #define DBL_MAX 1.7976931348623158e+308 #endif diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp index d9a90d9ff..2891effa9 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp @@ -66,7 +66,6 @@ void PrimitivesPlugin_Tube::loadNamingDS(std::shared_ptr theTu theTubeAlgo->prepareNamingFaces(); // Insert to faces - int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theTubeAlgo->getCreatedFaces(); for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index 364d6aac6..9f3fa216e 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -153,7 +152,7 @@ void SketcherPrs_Coincident::Compute( aPtA->SetScale(2. * aRatio); aPtA->SetColor(aExternalColor); - Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation); + Handle(Graphic3d_Group) aGroup = thePresentation->CurrentGroup(); aGroup->SetPrimitivesAspect(aPtA); Handle(Graphic3d_ArrayOfPoints) aPntArray = new Graphic3d_ArrayOfPoints(1); aPntArray->AddVertex (myPoint.X(), myPoint.Y(), myPoint.Z()); diff --git a/src/SketcherPrs/SketcherPrs_Collinear.cpp b/src/SketcherPrs/SketcherPrs_Collinear.cpp index 3b2fb1ad2..1e44309fe 100644 --- a/src/SketcherPrs/SketcherPrs_Collinear.cpp +++ b/src/SketcherPrs/SketcherPrs_Collinear.cpp @@ -24,7 +24,6 @@ #include #include -#include IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs); @@ -76,7 +75,7 @@ bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep, bool withColo void SketcherPrs_Collinear::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const { - Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs); + Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.cpp b/src/SketcherPrs/SketcherPrs_HVDirection.cpp index d4a29174e..9ce852ac5 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.cpp +++ b/src/SketcherPrs/SketcherPrs_HVDirection.cpp @@ -24,7 +24,6 @@ #include #include -#include IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs); @@ -67,7 +66,7 @@ bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep, bool withCo void SketcherPrs_HVDirection::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const { - Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs); + Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); // Draw constrained object Handle(Graphic3d_AspectLine3d) aLineAspect = diff --git a/src/SketcherPrs/SketcherPrs_Middle.cpp b/src/SketcherPrs/SketcherPrs_Middle.cpp index bb96cd07a..4e9025ca0 100644 --- a/src/SketcherPrs/SketcherPrs_Middle.cpp +++ b/src/SketcherPrs/SketcherPrs_Middle.cpp @@ -24,7 +24,6 @@ #include #include -#include IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs); @@ -93,7 +92,7 @@ bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep, bool withColor) void SketcherPrs_Middle::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const { - Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs); + Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index 97b4a4047..d051f9d47 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -24,11 +24,9 @@ #include #include -#include #include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Mirror, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; @@ -134,7 +132,7 @@ void SketcherPrs_Mirror::drawLines(const Handle(Prs3d_Presentation)& thePrs, if (aNb != anAttrC->size()) return; - Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs); + Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); // drawListOfShapes uses myDrawer for attributes definition Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1); diff --git a/src/SketcherPrs/SketcherPrs_Parallel.cpp b/src/SketcherPrs/SketcherPrs_Parallel.cpp index e3b8bc367..2b6a14be5 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.cpp +++ b/src/SketcherPrs/SketcherPrs_Parallel.cpp @@ -24,8 +24,6 @@ #include #include -#include - IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs); @@ -78,7 +76,7 @@ bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep, bool withColor void SketcherPrs_Parallel::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const { - Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs); + Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup(); Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index 971ae1097..05eca8c0c 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -39,10 +39,13 @@ #include #include - #include #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + #ifdef _DEBUG #include #include diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 10a1f7f36..99e9bc0fb 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -66,6 +66,10 @@ #include #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop* theParent) : QObject(theParent), myWorkshop(theParent), diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index c0824cf1d..cda24e471 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -1194,11 +1194,7 @@ GeomPlanePtr XGUI_Displayer::getScreenPlane() const Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { Handle(V3d_Viewer) aViewer = aContext->CurrentViewer(); - Handle(V3d_View) aView; - for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews()) { - aView = aViewer->ActiveView(); - break; - } + Handle(V3d_View) aView = aViewer->ActiveViews().First(); if (!aView.IsNull()) { double aEyeX, aEyeY, aEyeZ; aView->Eye(aEyeX, aEyeY, aEyeZ); @@ -1220,11 +1216,7 @@ double XGUI_Displayer::getViewScale() const Handle(AIS_InteractiveContext) aContext = AISContext(); if (!aContext.IsNull()) { Handle(V3d_Viewer) aViewer = aContext->CurrentViewer(); - Handle(V3d_View) aView; - for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews()) { - aView = aViewer->ActiveView(); - break; - } + Handle(V3d_View) aView = aViewer->ActiveViews().First(); return aView->Camera()->Scale(); } return 1; diff --git a/src/XGUI/XGUI_FacesPanel.cpp b/src/XGUI/XGUI_FacesPanel.cpp index d312092cf..2f9bee2a4 100644 --- a/src/XGUI/XGUI_FacesPanel.cpp +++ b/src/XGUI/XGUI_FacesPanel.cpp @@ -56,6 +56,10 @@ #include #include +#ifdef WIN32 +#pragma warning(disable : 4189) // for skipping MAYBE_UNUSED on Win +#endif + static const int LayoutMargin = 3; //******************************************************************** diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp index 30d41b7b6..78e37d959 100644 --- a/src/XGUI/XGUI_Selection.cpp +++ b/src/XGUI/XGUI_Selection.cpp @@ -56,6 +56,10 @@ #include +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + #define DEBUG_DELIVERY XGUI_Selection::XGUI_Selection(XGUI_Workshop* theWorkshop) diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index fa83cf2a2..b55a16c87 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -56,6 +56,10 @@ #include #endif +#ifdef WIN32 +#pragma warning(disable : 4456) // for nested foreach +#endif + #define OPTIMIZATION_LEVEL 50 diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index f95053cbd..fb55eef8b 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -172,6 +172,8 @@ static Handle(VInspector_CallBack) MyVCallBack; #ifdef WIN32 #include +#pragma warning(disable : 4456) // for nested foreach +#pragma warning(disable : 4189) // for declaration of unused variables (MAYBE_UNUSED) #else #include #endif diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 370cbe793..ff49e6bfd 100644 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -50,10 +50,8 @@ #include #include -#ifdef HAVE_SALOME #include #include -#endif #include "XGUI_ActionsMgr.h" #include "XGUI_Displayer.h" @@ -77,6 +75,10 @@ #include #endif +#ifdef WIN32 +#pragma warning(disable : 4189) // for declaration of unused variables (MAYBE_UNUSED) +#endif + //#define DEBUG_FEATURE_CREATED //#define DEBUG_FEATURE_REDISPLAY //#define DEBUG_FEATURE_UPDATED @@ -397,9 +399,13 @@ void XGUI_WorkshopListener:: void XGUI_WorkshopListener:: onFeatureCreatedMsg(const std::shared_ptr& theMsg) { - SUIT_Application * app = SUIT_Session::session()->activeApplication(); - - QVariant aVar = app->property("IsLoadedScript"); + bool isLoadedScript = false; + SUIT_Session* aSession = SUIT_Session::session(); + if (aSession) + { + QVariant aVar = aSession->activeApplication()->property("IsLoadedScript"); + isLoadedScript = !aVar.isNull() && aVar.toBool(); + } std::set anObjects = theMsg->objects(); std::set::const_iterator aIt; @@ -415,7 +421,7 @@ void XGUI_WorkshopListener:: //bool aHasPart = false; bool aDisplayed = false; - if (aVar.isNull() || !aVar.toBool()) { + if (!isLoadedScript) { for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { ObjectPtr anObject = *aIt; -- 2.39.2