From 888b3b52e179ae1505352d56ba63477275693919 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 27 Oct 2022 16:31:43 +0300 Subject: [PATCH] [bos #32517][EDF] Dynamic log messages switched on and off by SALOME_VERBOSE environment variable --- src/ARCHIMEDE/Archimede_VolumeSection.cxx | 18 +-- src/EntityGUI/EntityGUI.cxx | 4 +- .../EntityGUI_FeatureDetectorDlg.cxx | 12 +- src/EntityGUI/EntityGUI_PictureImportDlg.cxx | 4 +- src/EntityGUI/EntityGUI_PolylineDlg.cxx | 2 +- src/EntityGUI/EntityGUI_SketcherDlg.cxx | 20 ++-- src/GEOM/GEOM_Engine.cxx | 62 +++++------ src/GEOMBase/GEOMBase_Helper.cxx | 16 +-- src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 6 +- src/GEOMUtils/GEOMUtils_XmlHandler.cxx | 12 +- src/GEOM_I/GEOM_IShapesOperations_i.cc | 2 +- src/OBJECT/GEOM_Actor.cxx | 103 ++++++------------ src/OBJECT/GEOM_OCCReader.cxx | 8 +- .../ShapeRec_FeatureDetector.cxx | 2 +- 14 files changed, 115 insertions(+), 156 deletions(-) diff --git a/src/ARCHIMEDE/Archimede_VolumeSection.cxx b/src/ARCHIMEDE/Archimede_VolumeSection.cxx index a3911ae85..c4a9479a3 100644 --- a/src/ARCHIMEDE/Archimede_VolumeSection.cxx +++ b/src/ARCHIMEDE/Archimede_VolumeSection.cxx @@ -88,7 +88,7 @@ void VolumeSection::CenterOfGravity() TopoDS_Face F = TopoDS::Face(ex.Current()); Handle(Poly_Triangulation) Tr = BRep_Tool::Triangulation(F, L); if(Tr.IsNull()) - MESSAGE("Error, null layer" ) + MESSAGE("Error, null layer" ); nbNodes = Tr->NbNodes(); const TColgp_Array1OfPnt& Nodes = Tr->Nodes(); @@ -113,8 +113,8 @@ void VolumeSection::CenterOfGravity() } } - // Creation du point d'initialisation, c'est € dire le centre de gravit‰ - //g‰om‰trique de la boite englobante + // Creation du point d'initialisation, c'est e dire le centre de gravite + // geometrique de la boite englobante InitPoint.SetX(0.5 * (Xmin + Xmax)); InitPoint.SetY(0.5 * (Ymin + Ymax)); @@ -141,14 +141,14 @@ Standard_Real VolumeSection::CalculateVolume(Standard_Real Elevation) TopoDS_Face F = TopoDS::Face(ex.Current()); Handle(Poly_Triangulation) Tr = BRep_Tool::Triangulation(F, L); if(Tr.IsNull()) - MESSAGE("Error, null layer" ) + MESSAGE("Error, null layer" ); const Poly_Array1OfTriangle& triangles = Tr->Triangles(); Standard_Integer nbTriangles = Tr->NbTriangles(); //nbNodes = Tr->NbNodes(); const TColgp_Array1OfPnt& Nodes = Tr->Nodes(); // Calcul des volumes de chaque triangle, de chaque face - //en tenant compte des triangles coup‰s par le plan de section + // en tenant compte des triangles coupes par le plan de section for (i=1;i<=nbTriangles;i++) { @@ -234,7 +234,7 @@ Standard_Real VolumeSection::Archimede(Standard_Real Constante , Standard_Real E Bsup = Zmax; if(Binf>Bsup) { - MESSAGE("error, Bound + < Bound - in dichotomy") + MESSAGE("error, Bound + < Bound - in dichotomy"); return -1; } tempBsupVolume = CalculateVolume(Bsup); @@ -242,7 +242,7 @@ Standard_Real VolumeSection::Archimede(Standard_Real Constante , Standard_Real E if (Constante>tempBsupVolume || ConstantegetApp(); if ( !app ) return; @@ -401,7 +401,7 @@ void EntityGUI::DisplaySimulationShape( const TopoDS_Shape& S1, const TopoDS_Sha //================================================================================== void EntityGUI::EraseSimulationShape() { - MESSAGE("EntityGUI::EraseSimulationShape") + MESSAGE("EntityGUI::EraseSimulationShape"); SalomeApp_Application* app = getGeometryGUI()->getApp(); if ( !app ) return; diff --git a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx index 5c2495d65..af84e6b57 100644 --- a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx +++ b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx @@ -505,7 +505,7 @@ bool EntityGUI_FeatureDetectorDlg::ClickOnApply() //================================================================================= void EntityGUI_FeatureDetectorDlg::ConstructorsClicked(int id) { - MESSAGE("Constructor id ="<GetImgHeight() > 0) showImageSample(); } @@ -814,10 +814,10 @@ bool EntityGUI_FeatureDetectorDlg::execute( ObjectList& objects ) bool insert; - MESSAGE("hierarchy.size() =" << hierarchy.size()) + MESSAGE("hierarchy.size() =" << hierarchy.size()); if ( hierarchy.size() < 1 ) { - getOperation()->SetErrorCode( "Impossible detected contours" ); - return false; + getOperation()->SetErrorCode( "Impossible detected contours" ); + return false; } for( ; idx >= 0; idx = hierarchy[idx][0]) diff --git a/src/EntityGUI/EntityGUI_PictureImportDlg.cxx b/src/EntityGUI/EntityGUI_PictureImportDlg.cxx index 68774a9c6..dc82efdd3 100644 --- a/src/EntityGUI/EntityGUI_PictureImportDlg.cxx +++ b/src/EntityGUI/EntityGUI_PictureImportDlg.cxx @@ -135,7 +135,7 @@ void EntityGUI_PictureImportDlg::FileSelectionClicked() //================================================================================= void EntityGUI_PictureImportDlg::ClickOnOk() { - MESSAGE("EntityGUI_PictureImportDlg::ClickOnOk()") + MESSAGE("EntityGUI_PictureImportDlg::ClickOnOk()"); setIsApplyAndClose( true ); if ( ClickOnApply() ) ClickOnCancel(); @@ -147,7 +147,7 @@ void EntityGUI_PictureImportDlg::ClickOnOk() //================================================================================= bool EntityGUI_PictureImportDlg::ClickOnApply() { - MESSAGE("EntityGUI_PictureImportDlg::ClickOnApply()") + MESSAGE("EntityGUI_PictureImportDlg::ClickOnApply()"); if ( !onAccept() ) return false; diff --git a/src/EntityGUI/EntityGUI_PolylineDlg.cxx b/src/EntityGUI/EntityGUI_PolylineDlg.cxx index f3e06896f..6fcec142f 100644 --- a/src/EntityGUI/EntityGUI_PolylineDlg.cxx +++ b/src/EntityGUI/EntityGUI_PolylineDlg.cxx @@ -671,7 +671,7 @@ gp_Ax3 EntityGUI_PolylineDlg::WPlaneToLCS(GEOM::GeomObjPtr theGeomObj) gp_Ax3 aLCS; if (theGeomObj || aShape.IsNull()) { - MESSAGE("CORBA::is_nil(theGeomObj) || aShape.IsNull()") + MESSAGE("CORBA::is_nil(theGeomObj) || aShape.IsNull()"); } aLCS.Transform(aShape.Location().Transformation()); diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index 82865e9cf..7d20265f2 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -529,7 +529,7 @@ void EntityGUI_SketcherDlg::Init() //================================================================================= void EntityGUI_SketcherDlg::InitClick() { - MESSAGE("EntityGUI_SketcherDlg::InitClick()") + MESSAGE("EntityGUI_SketcherDlg::InitClick()"); disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 ); myCheckFlag = 0; @@ -694,7 +694,7 @@ void EntityGUI_SketcherDlg::DestClicked( int constructorId ) //================================================================================= void EntityGUI_SketcherDlg::PointClicked( int constructorId ) { - MESSAGE("PointClicked") + MESSAGE("PointClicked"); myConstructorPntId = constructorId; GroupPt->RB_Point3->setEnabled( true ); int buttonId = GroupPt2->ButtonGroup->checkedId(); @@ -713,7 +713,7 @@ void EntityGUI_SketcherDlg::PointClicked( int constructorId ) //================================================================================= void EntityGUI_SketcherDlg::Point2Clicked( int constructorId ) { - MESSAGE("Point2Clicked") + MESSAGE("Point2Clicked"); InitClick(); // Get setting of step value from file configuration @@ -1134,7 +1134,7 @@ void EntityGUI_SketcherDlg::ClickOnCancel() //================================================================================= void EntityGUI_SketcherDlg::ClickOnEnd() { - MESSAGE("EntityGUI_SketcherDlg::ClickOnEnd()") + MESSAGE("EntityGUI_SketcherDlg::ClickOnEnd()"); if ( sender() == MainWidget->buttonClose ) { // Verify validity of commands if ( myCommand.count() <= 2 ) { @@ -1190,7 +1190,7 @@ void EntityGUI_SketcherDlg::ClickOnEnd() //================================================================================= bool EntityGUI_SketcherDlg::ClickOnApply() { - MESSAGE("EntityGUI_SketcherDlg::ClickOnApply()") + MESSAGE("EntityGUI_SketcherDlg::ClickOnApply()"); if ( sender() && sender()->inherits( "QPushButton" ) ) ( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948) @@ -1357,7 +1357,7 @@ void EntityGUI_SketcherDlg::setEnabledRedo( bool value ) //================================================================================= void EntityGUI_SketcherDlg::SelectionIntoArgument() { - MESSAGE("EntityGUI_SketcherDlg::SelectionIntoArgument") + MESSAGE("EntityGUI_SketcherDlg::SelectionIntoArgument"); myEditCurrentArgument->setText( "" ); LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr(); @@ -1627,7 +1627,7 @@ void EntityGUI_SketcherDlg::DeactivateActiveDialog() //================================================================================= void EntityGUI_SketcherDlg::ActivateThisDialog() { - MESSAGE("EntityGUI_SketcherDlg::ActivateThisDialog()") + MESSAGE("EntityGUI_SketcherDlg::ActivateThisDialog()"); myGeometryGUI->EmitSignalDeactivateDialog(); setEnabled( true ); myGeometryGUI->SetActiveDialogBox( this ); @@ -1679,7 +1679,7 @@ void EntityGUI_SketcherDlg::enterEvent( QEvent* ) //================================================================================= void EntityGUI_SketcherDlg::closeEvent( QCloseEvent* e ) { - MESSAGE("EntityGUI_SketcherDlg::closeEvent") + MESSAGE("EntityGUI_SketcherDlg::closeEvent"); //myGeometryGUI->SetState( -1 ); disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 ); myGeometryGUI->getApp()->updateActions(); @@ -2317,7 +2317,7 @@ bool EntityGUI_SketcherDlg::isValid( QString& msg ) //================================================================================= bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) { - MESSAGE("EntityGUI_SketcherDlg::execute") + MESSAGE("EntityGUI_SketcherDlg::execute"); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand @@ -2789,7 +2789,7 @@ gp_Ax3 EntityGUI_SketcherDlg::WPlaneToLCS( GEOM::GEOM_Object_var geomObj ) gp_Ax3 aLCS; if (CORBA::is_nil( geomObj ) || aShape.IsNull()) { - MESSAGE("CORBA::is_nil( geomObj ) || aShape.IsNull()") + MESSAGE("CORBA::is_nil( geomObj ) || aShape.IsNull()"); } aLCS.Transform(aShape.Location().Transformation()); if (aShape.ShapeType() == TopAbs_FACE) diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 46426c6fd..14a0c516d 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -83,13 +83,6 @@ #define C_SQR_BRACKET ']' #define PY_NULL "None" -#ifdef _DEBUG_ -static int MYDEBUG = 0; -using namespace std; -#else -static int MYDEBUG = 0; -#endif - // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump // Next macro, when defined, causes appearing of SubShapeAllIDs(), SubShapeAllSortedIDs(), GetSameIDs() // and other such commands in Python dump. @@ -1302,10 +1295,10 @@ Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin void ReplaceVariables(TCollection_AsciiString& theCommand, const TVariablesList& theVariables) { - if (MYDEBUG) + if (SALOME::VerbosityActivated()) std::cout<<"Command : "<GetCurrectState(); - if(MYDEBUG) { + if(SALOME::VerbosityActivated()) { std::cout<<"Variables from SObject:"<= aVariables.size()) continue; @@ -1495,27 +1488,30 @@ void ReplaceVariables(TCollection_AsciiString& theCommand, aReplacedParameter.InsertAfter(aReplacedParameter.Length(),"'"); } - if(MYDEBUG) - std::cout<<"aSection before : "<IncrementState(); } - if (MYDEBUG) + if (SALOME::VerbosityActivated()) std::cout<<"Command : "<_is_nil() = true") - } + MESSAGE("anOp->_is_nil() = true"); + } return res; } @@ -857,7 +857,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, b SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); if ( !appStudy ) { - MESSAGE("appStudy is empty") + MESSAGE("appStudy is empty"); return false; } _PTR(Study) aStudy = appStudy->studyDS(); @@ -968,13 +968,13 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, b catch( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); abortCommand(); - MESSAGE("Exception caught") - } + MESSAGE("Exception caught"); + } updateViewer(); - MESSAGE("result ="<GetValue(); if (aMainShape.IsNull()) { - MESSAGE("NULL main shape") + MESSAGE("NULL main shape"); return NULL; } @@ -1867,7 +1867,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetSubShapesIndic TopoDS_Shape aSubShape = (*it)->GetValue(); if (aSubShape.IsNull()) { - MESSAGE("NULL subshape") + MESSAGE("NULL subshape"); return NULL; } int id = anIndices.FindIndex(aSubShape); diff --git a/src/GEOMUtils/GEOMUtils_XmlHandler.cxx b/src/GEOMUtils/GEOMUtils_XmlHandler.cxx index 8adaf196e..e56cb5599 100644 --- a/src/GEOMUtils/GEOMUtils_XmlHandler.cxx +++ b/src/GEOMUtils/GEOMUtils_XmlHandler.cxx @@ -19,6 +19,7 @@ #include "GEOMUtils_XmlHandler.hxx" #include +#include "utilities.h" #include #include @@ -30,8 +31,6 @@ #include #endif -//#define MYDEBUG - namespace { const char* env_var = "GEOM_PluginsList"; @@ -186,7 +185,6 @@ namespace return xmlPaths; } -#ifdef MYDEBUG void dumpinfo(const GEOMUtils::PluginInfo& info) { printf("DUMPING PLUGIN INFO\n"); @@ -210,7 +208,6 @@ namespace printf("-----\n"); } } -#endif } namespace GEOMUtils @@ -284,9 +281,10 @@ namespace GEOMUtils //xmlCleanupParser();//vsr: xmlCleanupParser should not be called from the application } // end xml doc } -#ifdef MYDEBUG - dumpinfo(info); -#endif + + if (SALOME::VerbosityActivated()) + dumpinfo(info); + return info; } } diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index 751c8839c..1c2a0aa0e 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -977,7 +977,7 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices Handle(::GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]); if (aSh.IsNull()) { - MESSAGE("NULL shape") + MESSAGE("NULL shape"); return aSeq._retn(); } aShapes.push_back(aSh); diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx index f7ddfe78c..6ca9b475f 100644 --- a/src/OBJECT/GEOM_Actor.cxx +++ b/src/OBJECT/GEOM_Actor.cxx @@ -73,10 +73,6 @@ //vtkStandardNewMacro(GEOM_Actor) -#ifndef MYDEBUG -//#define MYDEBUG -#endif - GEOM_Actor::GEOM_Actor(): isOnlyVertex(false), @@ -127,9 +123,8 @@ GEOM_Actor::GEOM_Actor(): // defined in this class !!! myPolyDataMapper(GEOM_PainterPolyDataMapper::New(),true) { -#ifdef MYDEBUG - MESSAGE (this<< " GEOM_Actor::GEOM_Actor"); -#endif + + MESSAGE(this<< " GEOM_Actor::GEOM_Actor"); myPolyDataMapper->SetInputConnection(myAppendFilter->GetOutputPort()); vtkProperty* aProperty; @@ -215,9 +210,8 @@ GEOM_Actor::GEOM_Actor(): GEOM_Actor::~GEOM_Actor() { -#ifdef MYDEBUG - MESSAGE (this<< " ~GEOM_Actor::GEOM_Actor"); -#endif + MESSAGE(this << " ~GEOM_Actor::GEOM_Actor"); + myTextActor->Delete(); myHighlightProp->Delete(); myPreHighlightProp->Delete(); @@ -319,9 +313,7 @@ void GEOM_Actor:: setDisplayMode(int theMode) { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::setDisplayMode = "<myHighlightActor->GetProperty()->DeepCopy(Prop); } void GEOM_Actor::SetWireframeProperty(vtkProperty* Prop) { -#ifdef MYDEBUG - MESSAGE ( this << " GEOM_Actor::SetWireframeProperty" ); -#endif + MESSAGE(this << " GEOM_Actor::SetWireframeProperty"); + // must be filled myWireframeFaceActor->SetProperty(Prop); } @@ -602,9 +588,8 @@ vtkProperty* GEOM_Actor::GetFaceEdgeProperty() void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::SetShadingProperty" ); -#endif + MESSAGE("GEOM_Actor::SetShadingProperty"); + myShadingFaceProp->DeepCopy(Prop); } @@ -617,9 +602,7 @@ vtkProperty* GEOM_Actor::GetShadingProperty() void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper) { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::Render" ); -#endif + MESSAGE("GEOM_Actor::Render"); if(!GetVisibility()) return; @@ -695,18 +678,13 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper) void GEOM_Actor::ReleaseGraphicsResources(vtkWindow *) { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::ReleaseGraphicsResources" ); -#endif + MESSAGE("GEOM_Actor::ReleaseGraphicsResources"); } - - void GEOM_Actor::ShallowCopy(vtkProp *prop) { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::ShallowCopy" ); -#endif + MESSAGE("GEOM_Actor::ShallowCopy"); + GEOM_Actor *f = GEOM_Actor::SafeDownCast(prop); if ( f != NULL ) { @@ -717,48 +695,40 @@ void GEOM_Actor::ShallowCopy(vtkProp *prop) this->SALOME_Actor::ShallowCopy(prop); } -const TopoDS_Shape& GEOM_Actor::getTopo() { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::getTopo" ); -#endif +const TopoDS_Shape& GEOM_Actor::getTopo() +{ + MESSAGE("GEOM_Actor::getTopo"); + return myShape; } void GEOM_Actor::setInputShape(const TopoDS_Shape& /*ashape*/, double /*adef1*/, int /*imode*/, bool /*isVector*/) { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::setInputShape" ); -#endif + MESSAGE("GEOM_Actor::setInputShape"); } double GEOM_Actor::isVector() { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::isVector" ); -#endif + MESSAGE("GEOM_Actor::isVector"); + return 0; } void GEOM_Actor::SubShapeOn() { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::SubShapeOn" ); -#endif + MESSAGE("GEOM_Actor::SubShapeOn"); } void GEOM_Actor::SubShapeOff() { -#ifdef MYDEBUG - MESSAGE ( "GEOM_Actor::SubShapeOff" ); -#endif + MESSAGE("GEOM_Actor::SubShapeOff"); } void GEOM_Actor::highlight(bool highlight) { -#ifdef MYDEBUG - MESSAGE ( this << " GEOM_Actor::highlight highlight="<