#include "SVTK_RenderWindow.h"
#include "SVTK_ViewWindow.h"
-
#include "SVTK_ViewModel.h"
#include "SVTK_Functor.h"
+#include "SPlot2d_ViewModel.h"
+#include "SPlot2d_SetupPlot2dDlg.h"
+
#include "OB_Browser.h"
#include "SALOME_ListIO.hxx"
OnImportFromFile()
{
if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
- CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
+ CheckLock(GetCStudy(GetAppStudy(this)));
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
QStringList aFilter;
{
if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
_PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
- CheckLock(GetDSStudy(aStudy),this);
+ CheckLock(aStudy);
SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
OnImportTableFromFile()
{
if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
- CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
+ CheckLock(GetCStudy(GetAppStudy(this)));
QStringList aFilter;
aFilter.append( tr("FLT_TABLE_FILES") );
void
CreatePrs3d(SalomeApp_Module* theModule)
{
- if(CheckLock(GetDSStudy(GetCStudy(GetAppStudy(theModule))),theModule))
+ if(CheckLock(GetCStudy(GetAppStudy(theModule))))
return;
SALOMEDS::SObject_var aTimeStampSObj;
VisuGUI::
OnCreateMesh()
{
- SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
- if (CheckLock(aStudy, this))
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aStudy))
return;
// Get selected SObject
if (anIO.IsNull() || !anIO->hasEntry())
return;
- aResultSObj = aStudy->FindObjectID(anIO->getEntry());
+ aResultSObj = GetDSStudy(aStudy)->FindObjectID(anIO->getEntry());
// Get VISU::Result
VISU::Result_var aResult;
VisuGUI::
OnCreatePlot2dView()
{
- CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
+ CheckLock(GetCStudy(GetAppStudy(this)));
GetVisuGen( this )->CreateContainer();
updateObjBrowser();
}
VisuGUI::
OnDeleteObject()
{
- SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
- if (CheckLock(aStudy, this))
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
Handle(SALOME_InteractiveObject) anIO;
CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
VisuGUI::
OnPlotData()
{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
+ _PTR(SObject) SO;
+ _PTR(GenericAttribute) anAttr;
+ _PTR(AttributeName) aName;
+ QString SOName;
+ _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
+
+ if ( !CORBA::is_nil( anObject ) ) {
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
+ // Table (VISU object) is selected
+ CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
+ if( !CORBA::is_nil( aTbl ) ) {
+ VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
+ if ( table ) {
+ _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
+ if ( IsSObjectTable(SO) ) {
+ // get name of SObject
+ if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
+ aName = anAttr;
+ SOName = aName->Value();
+ }
+ SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
+ if ( dlg->exec() == QDialog::Accepted ) {
+ if ( !IsStudyLocked( aStudy ) ) {
+ // if study is not locked - create new container, create curves
+ // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
+ int horIndex;
+ QValueList<int> verIndices;
+ dlg->getCurvesSource( horIndex, verIndices );
+ if ( horIndex >= 0 && verIndices.count() > 0 ) {
+ CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
+ if( !CORBA::is_nil( aContainer ) ) {
+ VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+ if ( pContainer ) {
+ for ( int i = 0; i < verIndices.count(); i++ ) {
+ CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
+ if( !CORBA::is_nil( aNewCurve ) ) {
+ VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
+ if ( pCrv ) {
+ bool isAuto;
+ int marker, line, lineWidth;
+ QColor color;
+ if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
+ SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
+ pCrv->SetColor( c );
+ pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
+ pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+ }
+ pContainer->AddCurve( pCrv->_this() );
+ }
+ }
+ }
+ updateObjBrowser();
+ PlotContainer( this, pContainer, VISU::eDisplay );
+ }
+ }
+ }
+ }
+ else {
+ // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
+ QPtrList<Plot2d_Curve> container;
+ dlg->getCurves( container );
+ if ( !container.isEmpty() ) {
+ GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
+ GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
+ }
+ }
+ }
+ delete dlg;
+ }
+ }
+ }
+ }
+ }
+ else if ( !anIO.IsNull() ) {
+ // check if Table SObject is selected
+ SO = aStudy->FindObjectID( anIO->getEntry() );
+ if ( IsSObjectTable(SO) ) {
+ // get name of SObject
+ if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
+ aName = anAttr;
+ SOName = aName->Value();
+ }
+ SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
+ if ( dlg->exec() == QDialog::Accepted ) {
+ if ( !IsStudyLocked( aStudy ) ) {
+ // if study is not locked - create new table and container objects, create curves
+ // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
+ int horIndex;
+ QValueList<int> verIndices;
+ dlg->getCurvesSource( horIndex, verIndices );
+ if ( horIndex >= 0 && verIndices.count() > 0 ) {
+ CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
+ CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
+ if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
+ VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
+ VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+
+ if ( pContainer && pTable ) {
+ for ( int i = 0; i < verIndices.count(); i++ ) {
+ CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
+ if( !CORBA::is_nil( aNewCurve ) ) {
+ VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
+ if ( pCrv ) {
+ bool isAuto;
+ int marker, line, lineWidth;
+ QColor color;
+ if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
+ SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
+ pCrv->SetColor( c );
+ pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
+ pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+ }
+ pContainer->AddCurve( pCrv->_this() );
+ }
+ }
+ }
+ updateObjBrowser();
+ PlotContainer( this, pContainer, VISU::eDisplay );
+ }
+ }
+ }
+ } else {
+ // if study is locked just get curves info and plot them
+ QPtrList<Plot2d_Curve> container;
+ dlg->getCurves( container );
+ if ( !container.isEmpty() ) {
+ GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
+ GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
+ }
+ }
+ }
+ delete dlg;
+ }
+ }
}
void
VisuGUI::
OnClearContainer()
{
- SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
- if (CheckLock(aStudy, this))
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
return;
-
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
Handle(SALOME_InteractiveObject) anIO;
CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
if (anIO.IsNull() || CORBA::is_nil(anObject))
OnSaveViewParams()
{
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
- SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
- if (CheckLock(aStudy, this))
+ if (CheckLock(aCStudy))
return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
if (aViewMgr->getType() != SVTK_Viewer::Type())
OnDeleteViewParams()
{
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
- SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
- if (CheckLock(aStudy, this))
+ if (CheckLock(aCStudy))
return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
Handle(SALOME_InteractiveObject) anIO;
CORBA::Object_var anObject = GetSelectedObj(this, &anIO);