-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// File : GEOMToolsGUI_1.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
+#ifndef DISABLE_PYCONSOLE
#include <PyConsole_Console.h>
+#endif
#include "GEOMToolsGUI.h"
#include "GEOMToolsGUI_TransparencyDlg.h"
#include <GEOMBase.h>
#include <GEOM_Actor.h>
+#ifndef DISABLE_GRAPHICSVIEW
#include <DependencyTree_ViewModel.h>
#include <DependencyTree_View.h>
#include <DependencyTree_Selector.h>
-
-#include <Basics_OCCTVersion.hxx>
+#endif
#include <SALOME_ListIO.hxx>
#include "utilities.h"
// OCCT Includes
-#include <AIS_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
// Below macro, when uncommented, switches on simplified (more performant) algorithm
// of auto-color picking up
#define SIMPLE_AUTOCOLOR
-// Below macro, when defined, switches on automatic layouting of OCC and Dependecy views
+// Below macro, when defined, switches on automatic layouting of OCC and Dependency views
// on Show Dependencies operation
#define LAYOUT_DEPVIEW
+#ifndef DISABLE_PYCONSOLE
void GEOMToolsGUI::OnCheckGeometry()
{
SalomeApp_Application* app =
if (pyConsole)
pyConsole->exec("from GEOM_usinggeom import *");
}
+#endif
void GEOMToolsGUI::OnAutoColor()
{
_PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aMainSObject(aStudy->FindObjectID(anIObject->getEntry()));
GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
- if (CORBA::is_nil(aMainObject)) return;
+ if (CORBA::is_nil(aMainObject) || !GeometryGUI::IsInGeomComponent( aMainSObject )) return;
aMainObject->SetAutoColor( true );
QList<SALOMEDS::Color> aReservedColors;
- GEOM_Displayer displayer ( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
QColor c( (int)( aColor.R * 255.0 ), (int)( aColor.G * 255.0 ), (int)( aColor.B * 255.0 ) );
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
appStudy->setObjectProperty( aMgrId, aChildObject->GetStudyEntry(), GEOM::propertyName( GEOM::Color ), c );
Handle( SALOME_InteractiveObject ) io = new SALOME_InteractiveObject( aChildObject->GetStudyEntry(), "GEOM", "" );
_PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
- if( CORBA::is_nil( aMainObject ) )
+ if( CORBA::is_nil( aMainObject ) || !GeometryGUI::IsInGeomComponent( aMainSObject ))
return;
aMainObject->SetAutoColor( false );
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
// get active view
SALOME_View* window = displayer.GetActiveView();
aSColor.B = (double)color.blue() / 255.0;
// iterate through list of objects and assign new color
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle( SALOME_InteractiveObject ) io = It.Value();
GEOM::GEOM_Object_var aObject = GEOMBase::ConvertIOinGEOMObject( io );
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
NbIsosDlg->setV( VIso );
if ( NbIsosDlg->exec() ) {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
newNbUIso = NbIsosDlg->getU();
newNbVIso = NbIsosDlg->getV();
} else //Cancel case
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Deflection ), QVariant() );
- double aDC = v.isValid() ? v.toDouble() : SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "deflection_coef", 0.001 );
+ double aDC = v.isValid() ? v.toDouble() : SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "deflection_coeff", 0.001 );
GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg
( SUIT_Session::session()->activeApplication()->desktop() );
DeflectionDlg->setTheDC( aDC );
if ( DeflectionDlg->exec() ) {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
aDC = DeflectionDlg->getTheDC();
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
{
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( app ) {
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
- GEOM_Displayer aDisp (appStudy);
+ GEOM_Displayer aDisp;
aDisp.GlobalSelection(mode);
getGeometryGUI()->setLocalSelectionMode(mode);
}
return;
}
+ SUIT_OverrideCursor wc;
+ bool toUpdateColorScale = disp->SetUpdateColorScale( false ); // IPAL54049
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
if ( obj ) {
_PTR(AttributeExpandable) aExp = B->FindOrCreateAttribute( obj, "AttributeExpandable" );
aExp->SetExpandable( show );
- if(!show)
+ if ( !show ) {
disp->EraseWithChildren(IObject,true);
+ }
} // if ( obj )
} // iterator
+ disp->SetUpdateColorScale( toUpdateColorScale );
}
}
app->updateObjectBrowser( false );
QObject::tr( "WRN_STUDY_LOCKED" ) );
return;
}
-
+ SUIT_OverrideCursor wc;
+ bool toUpdateColorScale = disp->SetUpdateColorScale( false ); // IPAL54049
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
disp->EraseWithChildren(IObject);
// hide references if any
std::vector< _PTR(SObject) > vso = aStudy->FindDependances(obj);
- for ( int i = 0; i < vso.size(); i++ ) {
+ for ( int i = 0; i < (int)vso.size(); i++ ) {
_PTR(SObject) refObj = vso[i];
aDrw = B->FindOrCreateAttribute( refObj, "AttributeDrawable" );
aDrw->SetDrawable( false );
}
} // if ( obj )
} // iterator
+ disp->SetUpdateColorScale( toUpdateColorScale ); // IPAL54049
aSelMgr->clearSelected();
}
}
app->updateObjectBrowser( false );
app->updateActions();
}
-
}
void GEOMToolsGUI::OnPublishObject() {
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
Dlg->setTheLW( aWidth );
if ( Dlg->exec() ) {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
aWidth = Dlg->getTheLW();
} else
return; //Cancel case
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
Dlg->setTheLW( aWidth );
if ( Dlg->exec() ) {
- SUIT_OverrideCursor();
+ SUIT_OverrideCursor wc;
aWidth = Dlg->getTheLW();
} else
return; //Cancel case
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
if ( !appStudy ) return;
- GEOM_Displayer displayer( appStudy );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
if ( selected.IsEmpty() ) return;
- GEOM_Displayer displayer( study );
+ GEOM_Displayer displayer;
SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
_PTR(SObject) aFatherSO(aStudy->FindObjectID(anIObject->getEntry()));
if ( !aFatherSO ) return;
- GeometryGUI::GetGeomGen()->CreateFolder( tr("NEW_FOLDER_NAME").toLatin1().constData(),
- _CAST(SObject, aFatherSO)->GetSObject() );
+ GeometryGUI::GetGeomGen()->CreateFolder( tr("NEW_FOLDER_NAME").toUtf8().constData(),
+ _CAST(SObject, aFatherSO)->GetSObject() );
app->updateObjectBrowser( false );
}
app->updateObjectBrowser( true );
}
+#ifndef DISABLE_GRAPHICSVIEW
void GEOMToolsGUI::OnShowDependencyTree()
{
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ //SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app ) return;
#endif
depVw->setFocus();
}
+#endif
void GEOMToolsGUI::OnReduceStudy()
{