-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// VISU VISUGUI : GUI of VISU component
// File : VisuGUI.cxx
// Author :
// Module : VISU
-//
+
+#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
+#ifdef HAVE_FINITE
+#undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
+#endif
+#include "Python.h"
+
#include "VisuGUI.h"
// STL Includes
#include "VisuGUI_SetupPlot2dDlg.h"
#include "Plot2d_SetupCurveDlg.h"
#include "Plot2d_ViewManager.h"
+#include "Plot2d_SetupCurveScaleDlg.h"
#include "QtxPagePrefMgr.h"
#include "OB_Browser.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Study.h"
+#include "SalomeApp_DataObject.h"
#include "SalomeApp_CheckFileDlg.h"
#include "LightApp_SelectionMgr.h"
}
}
+void
+VisuGUI
+::OnImportFromSauvFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromSauvFile()");
+
+ if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
+ return;
+
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+
+ // Get file name(s)
+ QStringList aFilter;
+ aFilter.append( tr( "FLT_SAUV_FILES" ) );
+ aFilter.append( tr( "FLT_ALL_FILES" ) );
+
+ bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
+
+ SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
+ fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
+ fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
+ fd.setFilters( aFilter );
+ fd.SetChecked( toUseBuildProgress );
+ if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
+ fd.setDirectory( QDir::currentPath() );
+
+ QStringList fileNames;
+ if ( !fd.exec() )
+ return; // cancelled, return
+
+ fileNames = fd.selectedFiles();
+ toUseBuildProgress = fd.IsChecked();
+
+ if ( fileNames.count() == 0 )
+ return; // nothing selected, return
+
+ SUIT_OverrideCursor wc;
+ QStringList errors;
+
+ for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
+ QFileInfo aFileInfo( *it );
+
+ if ( !aFileInfo.exists() ) {
+ // file not exist
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
+ }
+ else {
+ std::string file_in = aFileInfo.filePath().toLatin1().constData();
+ std::string file_tmp = file_in + ".med";
+#ifdef WNT
+ std::string cmd = "%PYTHONBIN% ";
+#else
+ std::string cmd = "python ";
+#endif
+ cmd += "-c \"";
+ cmd += "from medutilities import convert ; convert(r'" + file_in + "', 'GIBI', 'MED', 1, r'" + file_tmp + "')";
+ cmd += "\"";
+ system(cmd.c_str());
+ QString fff(file_tmp.c_str());
+ aFileInfo = fff;
+ try {
+ if ( !toUseBuildProgress ) {
+ // build progress is not used, use build flags from settings
+ bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
+ bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
+ bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
+ bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
+ bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
+
+ QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
+ application()->putInfo( anInfo );
+
+ VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
+
+ if ( CORBA::is_nil( aResult.in() ) ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
+ }
+ else {
+ aResult->SetBuildFields( toBuildFields, toBuildMinMax );
+ aResult->SetBuildGroups( toBuildGroups );
+ aResult->Build( toBuildAll, toBuildAtOnce );
+ application()->putInfo( anInfo + tr("INF_DONE") );
+ }
+ } // if ( !toUseBuildProgress )
+ else {
+ // use build progress
+ wc.suspend();
+ VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
+ aBuildProgressDlg->setFileName( aFileInfo.filePath() );
+ aBuildProgressDlg->setGenerator( GetVisuGen(this) );
+ aBuildProgressDlg->exec();
+ wc.resume();
+ }
+ } // try
+ catch(...) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+ }
+ } // else // if ( !aFileInfo.exists() )
+ } // for (...)
+
+ if ( errors.count() > 0 ) {
+ SUIT_MessageBox::critical( GetDesktop(this),
+ tr("ERR_ERROR"),
+ tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ }
+ else {
+ UpdateObjBrowser(this);
+ }
+}
+
void
VisuGUI
::OnImportFromFile()
SUIT_OverrideCursor wc;
QStringList errors;
+ QStringList anEntryList;
for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
QFileInfo aFileInfo( *it );
aResult->SetBuildFields( toBuildFields, toBuildMinMax );
aResult->SetBuildGroups( toBuildGroups );
aResult->Build( toBuildAll, toBuildAtOnce );
+ if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
+ anEntryList.append( aCResult->GetEntry().c_str() );
application()->putInfo( anInfo + tr("INF_DONE") );
}
} // if ( !toUseBuildProgress )
}
else {
UpdateObjBrowser(this);
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
}
}
return; // nothing selected
QStringList errors;
+ QStringList anEntryList;
for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
QFileInfo aFileInfo( *it );
QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
application()->putInfo( anInfo );
- CORBA::Object_var anObject =
+ SALOMEDS::SObject_var anObject =
GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
aFirstStrAsTitle);
arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
}
else {
+ anEntryList.append( anObject->GetID() );
application()->putInfo( anInfo + tr("INF_DONE") );
}
}
catch(...) {
- errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNSUPPORTED_FILE_FORMAT" ) ) );
}
}
}
}
else {
UpdateObjBrowser(this);
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
}
}
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
+ QStringList anEntryList;
SALOME_ListIteratorOfListIO It (aListIO);
QApplication::setOverrideCursor(Qt::WaitCursor);
for (; It.More(); It.Next()) {
}
}
+ VISU::Result_var aResult;
CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
if (!CORBA::is_nil(aMED.in()))
- GetVisuGen(this)->ImportMed(aSObject);
+ aResult = GetVisuGen(this)->ImportMed(aSObject);
SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
if (!CORBA::is_nil(aField.in()))
- GetVisuGen(this)->ImportMedField(aField);
+ aResult = GetVisuGen(this)->ImportMedField(aField);
} else {
SALOMEDS::SObject_var aSFather = aSObject->GetFather();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
CORBA::String_var aValue = aName->Value();
if (strcmp(aValue.in(), "MEDFIELD") == 0)
- GetVisuGen(this)->ImportMed(aSObject);
+ aResult = GetVisuGen(this)->ImportMed(aSObject);
}
+
+ if( !CORBA::is_nil( aResult ) )
+ if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
+ anEntryList.append( aCResult->GetEntry().c_str() );
}
}
UpdateObjBrowser(this, true);
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
QApplication::restoreOverrideCursor();
}
// create mesh presentation and display it in aViewWindow
VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
aViewWindow->highlight(anIO, 1);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
// create mesh presentation and display it in aViewWindow
VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
aViewWindow->highlight(anIO, 1);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
}
::OnCreateScalarMap()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
::OnCreateDeformedShape()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreateDeformedShapeAndScalarMap()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreateVectors()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreateIsoSurfaces()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreateCutPlanes()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreateCutLines()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreateCutSegment()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreateStreamLines()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreatePlot3D()
{
Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
- if (aPrs)
- emit presentationCreated(aPrs);
+ processPresentationCreated(aPrs);
}
void
::OnCreatePlot2dView()
{
CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
- GetVisuGen( this )->CreateContainer();
+ VISU::Container_var aContainer = GetVisuGen( this )->CreateContainer();
UpdateObjBrowser(this);
+
+ if( !CORBA::is_nil( aContainer.in() ) ) {
+ if( VISU::Container_i* aCContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ).in() ) ) {
+ QStringList anEntryList;
+ anEntryList.append( aCContainer->GetEntry().c_str() );
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
+ }
+ }
}
void
case VISU::TCURVE:
case VISU::TCONTAINER:
case VISU::TTABLE:
+ getViewManager(SPlot2d_Viewer::Type(), true);
displayer()->Display(anIO->getEntry());
+ aSelectionMgr->setSelectedObjects(aList);
break;
default: {
VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
break;
case VISU::WIREFRAME :
case VISU::INSIDEFRAME :
+ case VISU::FEATURE_EDGES :
anOldColor = aMesh->GetLinkColor();
break;
case VISU::SHADED :
break;
case VISU::SHADED :
case VISU::SURFACEFRAME :
+ case VISU::FEATURE_EDGES :
aMesh->SetCellColor(aNewColor);
break;
}
_PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
int aStudyId = aCStudy->StudyId();
+ QPixmap aPointSpritePixmap;
+ if( SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr() )
+ aPointSpritePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
+
bool update = false;
for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
{
if( VISU::Prs3d_i* aPrs = aPrsList[i] )
{
VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
+ aDlg->setHelpData( "VISU", "point_marker_page.html" );
aDlg->setCustomMarkerMap( aMarkerMap[ aStudyId ] );
+ aDlg->addExtraStdMarker( VTK::MT_POINT_SPRITE, aPointSpritePixmap );
+
VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
_PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
_PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
if(IsSObjectTable(aSObject)){
- VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+ VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, aTable ,GetDesktop(this));
if(aDlg->exec() == QDialog::Accepted){
if(!IsStudyLocked(aStudy)){
// if study is not locked - create new container, create curves and insert them
for( int i = 0; i < verIndices.count(); i++ ){
bool isV2 = ver2Indices.contains(verIndices[i]);
VISU::Curve_var aCurveObject =
- GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
+ GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(),
+ aDlg->idx(horIndex)+1,
+ aDlg->idx(verIndices[i])+1,
+ aDlg->idx(zIndices[i])+1, isV2 );
if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
bool isAuto;
int marker, line, lineWidth;
// check if Table SObject is selected
_PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
if(IsSObjectTable(aSObject)){
- VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+ VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, NULL, GetDesktop(this));
if(aDlg->exec() == QDialog::Accepted){
_PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
if(!IsStudyLocked(aStudy)){
}
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnCurveScale()
+{
+ if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
+ return;
+
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
+ int nbSel = aSelectionInfo.size();
+ QList<VISU::Curve_i*> curList;
+ bool isValuesEquals = true;
+ double value;
+
+ for (int i = 0; i < nbSel; i++ ) {
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(!aBase)
+ continue;
+
+ if(aBase->GetType() == VISU::TCURVE)
+ // Curve object
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
+ curList.append(aCurve);
+ if( i>0 && isValuesEquals )
+ isValuesEquals = (value == aCurve->GetScale());
+ value = aCurve->GetScale();
+ }
+ }
+
+ Plot2d_SetupCurveScaleDlg aDlg(GetDesktop( this ));
+ if( isValuesEquals )
+ aDlg.setScale(value);
+
+ if( aDlg.exec() == QDialog::Accepted )
+ for ( int i = 0; i < curList.size(); ++i )
+ curList.at(i)->SetScale( aDlg.getScale() );
+}
//----------------------------------------------------------------------------
void
VisuGUI
if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
if(aContainer && aContainer->GetNbCurves() > 0){
aContainer->Clear();
+ VISU::updateContainerVisibility(aContainer);
UpdateObjBrowser(this);
}
}
if (aDlg->exec()) {
aDlg->storeToPrsObject(aContainer);
UpdateObjBrowser(this, true);
+ delete aDlg;
+ VISU::updateContainerVisibility(aContainer);
}
- delete aDlg;
}
//----------------------------------------------------------------------------
VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
}
-//----------------------------------------------------------------------------
-void
-VisuGUI
-::OnRename()
-{
- _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
- if (CheckLock(aCStudy,GetDesktop(this)))
- return;
-
- VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
- if (aSelectionInfo.empty())
- return;
-
- VisuGUI_Selection aSel (this);
- aSel.init("", getApp()->selectionMgr());
- if (aSel.count() < 1) return;
-
- bool isAny = false; // is there any appropriate object selected
- for (int i = 0; i < aSelectionInfo.size(); i++) {
- VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
- VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
-
- _PTR(SObject) aSObject = anObjectInfo.mySObject;
- if (!aSObject)
- continue;
-
- // Check, if the selected object can be renamed
- QString aStr = aSel.parameter(i, "type" ).toString();
- if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
- aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
- aStr == "VISU::TCUTLINES" || aStr == "VISU::TCUTSEGMENT" || aStr == "VISU::TVECTORS" ||
- aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
- aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
- aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
- aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
- aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
- {
- _PTR(GenericAttribute) anAttr;
- if (aSObject->FindAttribute(anAttr, "AttributeName")) {
- isAny = true;
- _PTR(AttributeName) aName (anAttr);
- QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
- if (!Name.isEmpty()) {
- QApplication::setOverrideCursor(Qt::WaitCursor);
-
- // rename specific objects
- if (VISU::Base_i* aBase = anObjectInfo.myBase) {
- switch (aBase->GetType()) {
- case VISU::TCURVE: { // Curve object
- if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
- aCurve->SetName(Name.toLatin1().constData(), true);
- break;
- }
- case VISU::TTABLE: { // Table object
- if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
- aTable->SetName(Name.toLatin1().constData(), true);
- break;
- }
- case VISU::TPOINTMAP3D: { // Table object
- if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
- aTable3d->SetTitle(Name.toLatin1().constData());
- aTable3d->UpdateActors();
- }
- break;
- }
- case VISU::TCONTAINER: { // Container object
- if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
- aContainer->SetName(Name.toLatin1().constData(), true);
- break;
- }
- default: {
- }}
- }
-
- // rename the study object
- Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
- aName->SetValue(Name.toLatin1().constData()); // rename the SObject
- anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
-
- ViewManagerList aViewManagerList;
- getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
- SUIT_ViewManager* aViewManager;
- foreach( aViewManager, aViewManagerList ) {
- if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
- if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
- aViewer->renameAll( anIO, Name.toLatin1().constData() );
- }
- }
-
- UpdateObjBrowser(this, false);
- QApplication::restoreOverrideCursor();
- }
- }
- }
- } // for
-
- if (!isAny) {
- SUIT_MessageBox::warning(GetDesktop(this),
- QObject::tr("WRN_VISU"),
- QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
- }
-}
-
//----------------------------------------------------------------------------
void
VisuGUI
tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
this, SLOT(OnImportFromFile()));
+ createAction( VISU_IMPORT_SAUV, "", QIcon(),
+ tr("MEN_IMPORT_SAUV"), "", 0, aParent, false,
+ this, SLOT(OnImportFromSauvFile()));
+
createAction( VISU_IMPORT_TABLE, "", QIcon(),
tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
this, SLOT(OnImportTableFromFile()));
tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
this, SLOT(OnCurveProperties()));
- createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
- tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
- this, SLOT(OnRename()));
+ createAction( VISU_CURVE_SCALE, tr("MEN_CURVE_SCALE"), QIcon(),
+ tr("MEN_CURVE_SCALE"), "", 0, aParent, false,
+ this, SLOT(OnCurveScale()));
createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
this, SLOT(OnChangeWireframeColor()));
- createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
- tr("MEN_OPACITY"), "", 0, aParent, false,
+ createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(),
+ tr("MEN_TRANSPARENCY"), "", 0, aParent, false,
this, SLOT(OnChangeOpacity()));
createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
this, SLOT(OnLineQuadMode()));
+ createAction(VISU_SHOW_DEVIATION, tr("MEN_VISU_SHOW_DEVIATION"),QIcon(),
+ tr("MEN_VISU_SHOW_DEVIATION"), "",0, aParent, true,
+ this, SLOT(OnShowDeviation()));
+
}
void
int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
+ createMenu( VISU_IMPORT_SAUV, anImportId ); // import sauv file
createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
// VISU root commands
mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
+ mgr->insert( action( VISU_IMPORT_SAUV ), -1, -1, -1 ); // import SAUV file
mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
- // rename
- mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
-
// copy
mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
+ mgr->insert( action( VISU_CURVE_SCALE ), -1, -1, -1 ); // curve scale
+ //Show deviation command on curve
+ mgr->insert( action( VISU_SHOW_DEVIATION ), -1, -1, -1 ); // deviation
mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
// VISU root commands
QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
+ mgr->setRule( action( VISU_IMPORT_SAUV ), aRule );
mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
mgr->setRule( action( VISU_PLOT2D ), aRule );
QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
- QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
+ QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
" or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
- QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
+ QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
" or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
- QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
+ QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
" or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
" (type='VISU::TCURVE')))) ) or" + aComponent;
mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
- " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
+ " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}) "
"or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
- mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
+ mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1 and representation!='VISU::POINT'" );
mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
- // rename command
QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
- aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
- mgr->setRule( action( VISU_RENAME ), aRule );
-
// copy presentation command
aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
mgr->setRule( action( VISU_COPY_PRS ), aRule );
// Curve commands
aRule = "selcount=1 and type='VISU::TCURVE'";
mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
+ mgr->setRule( action( VISU_CURVE_SCALE ), "selcount > 0 and type='VISU::TCURVE'");
// Table Commands
aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
+
+ aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation";
+ mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::VisibleRule);
+ aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation and isDeviationDisplayed";
+ mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::ToggleRule);
}
void VisuGUI::createPanels()
setMenuShown( true );
setToolShown( true );
+ // import Python module that manages VISU plugins (need to be here because SalomePyQt API uses active module)
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
+ if(pluginsmanager==NULL)
+ PyErr_Print();
+ else
+ {
+ PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"visu",tr("MEN_VISUALIZATION").toStdString().c_str(),tr("VISU_PLUGINS_OTHER").toStdString().c_str());
+ if(result==NULL)
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+ PyGILState_Release(gstate);
+ // end of GEOM plugins loading
+
// Reset actions accelerator keys
QList<QKeySequence> shortcuts;
shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
- action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
-
+ GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast<SalomeApp_Study*>(theStudy)),true);
emit moduleActivated();
return aResult;
action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
- action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
bool aResult = SalomeApp_Module::deactivateModule( theStudy );
return new VisuGUI_Selection( (SalomeApp_Module*)this );
}
+void
+VisuGUI
+::processPresentationCreated( VISU::Prs3d_i* thePrs )
+{
+ if( thePrs )
+ {
+ QString anEntry = thePrs->GetEntry().c_str();
+ if( anEntry.isEmpty() )
+ if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast<VISU::ColoredPrs3d_i*>( thePrs ) )
+ anEntry = aColoredPrs->GetHolderEntry().c_str();
+
+ QStringList anEntryList( anEntry );
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
+
+ emit presentationCreated( thePrs );
+ }
+}
+
//******************************************************************
void VisuGUI::studyActivated()
{
void VisuGUI::createPreferences()
{
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
// TAB: General
int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
// Quantities with individual precision settings
// Set property for precision value for spinboxes
for ( ii = 0; ii < nbQuantities; ii++ ){
- setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -10 );
- setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 10 );
+ setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -14 );
+ setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 14 );
setPreferenceProperty( precs[ii], "precision", 2 );
}
int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
setPreferenceProperty( imposedGr, "columns", 4 );
- int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
- int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
- setPreferenceProperty( min, "step", 0.1 );
- setPreferenceProperty( max, "step", 0.1 );
+ int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" );
+ int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" );
+ setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
+ setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
// group: "Font"
int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
+ // TAB: "StreamLines"
+ int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
+
+ // group: "StreamLines preferences"
+ int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
+ setPreferenceProperty( cutLineGr, "columns", 1 );
+ int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
+ LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
+ setPreferenceProperty( usedPoints, "min", 0 );
+ setPreferenceProperty( usedPoints, "max", 1 );
+ setPreferenceProperty( usedPoints, "step", 0.1 );
+
// TAB: "Sweep, Animation, 3D Cache"
int animationTab = addPreference( tr( "Sweep, Animation" ) );
{
setPreferenceProperty( representGr, "columns", 2 );
QStringList mesh_modes;
- mesh_modes.append( "Points" );
- mesh_modes.append( "Wireframe" );
- mesh_modes.append( "Insideframe" );
- mesh_modes.append( "Surfaceframe" );
- mesh_modes.append( "Surface" );
- mesh_modes.append( "Feature edges" );
+ mesh_modes.append( tr("MEN_POINTS") );
+ mesh_modes.append( tr("MEN_WIREFRAME") );
+ mesh_modes.append( tr("MEN_INSIDEFRAME") );
+ mesh_modes.append( tr("MEN_SURFACEFRAME") );
+ mesh_modes.append( tr("MEN_SURFACE") );
+ mesh_modes.append( tr("VISU_FEATURE_EDGES") );
QList<QVariant> mesh_indices;
mesh_indices.append( 0 );
mesh_indices.append( 1 );
addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
addPreference( "", representGr, LightApp_Preferences::Space );
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
QList<QVariant> aMarkerTypeIndicesList;
aMarkerTypeIndicesList << i;
aMarkerTypeIconsList << pixmap;
}
+ aMarkerTypeIndicesList << VTK::MT_POINT_SPRITE;
+ aMarkerTypeIconsList << aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
}
}
+ else if(b == "visual_data_precision") {
+ LightApp_Preferences* pref = preferences();
+ QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true );
+ QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true );
+ if ( min )
+ setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
+ if ( max )
+ setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
+ }
if ( !aWarning.isEmpty() ){
aWarning += "The default values are applied instead.";
AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
}
- if (aPrs3d)
- emit presentationCreated(aPrs3d);
+ processPresentationCreated(aPrs3d);
}
}
application()->putInfo(QObject::tr("INF_DONE"));
void VisuGUI::OnLineQuadMode(){
ChangeQuadratic2DRepresentation(this,VISU::LINES);
}
+
+/*!
+ \brief Return \c true if object can be renamed
+*/
+bool VisuGUI::renameAllowed( const QString& entry) const {
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
+ SalomeApp_DataObject* obj = appStudy ? dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry)) : 0;
+
+ if(!app || !appStudy || !obj)
+ return false;
+
+ if(appStudy->isComponent(entry) || obj->isReference())
+ return false;
+
+
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( GetAppStudy(this), qPrintable(entry) );
+ VISU::Base_i* aBase = anObjectInfo.myBase;
+ if(aBase){
+ VISU::VISUType aType = aBase->GetType();
+ if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
+ CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
+ VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+ aType = aHolder->GetPrsType();
+ }
+ if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
+ aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
+ aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
+ aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
+ aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
+ aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
+ aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
+ aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS)
+ return true;
+ } else {
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+ bool anIsExist;
+ QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+ return anIsExist && "VIEW3D" == aVal;
+ }
+ return false;
+}
+
+void VisuGUI::OnShowDeviation() {
+
+ if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
+ return;
+
+ QAction* anAction = action(VISU_SHOW_DEVIATION);
+ if(!anAction)
+ return;
+
+ bool anIsShow = anAction->isChecked();
+
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
+
+ TSelectionInfo::iterator anIter = aSelectionInfo.begin();
+ for( ; anIter != aSelectionInfo.end(); anIter++ )
+ {
+ VISU::TSelectionItem aSelectionItem = *anIter;
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(aBase && aBase->GetType() == VISU::TCURVE) {
+ // Curve object
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
+ aCurve->ShowDeviation(anIsShow);
+ if( displayer()->IsDisplayed( anIO->getEntry() ) )
+ PlotCurve(this, aCurve, VISU::eDisplay);
+ }
+ }
+ }
+}
+
+/*!
+ Rename object by entry.
+ \param entry entry of the object
+ \param name new name of the object
+ \brief Return \c true if rename operation finished successfully, \c false otherwise.
+*/
+bool VisuGUI::renameObject( const QString& entry, const QString& name) {
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
+ SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
+
+ if(!appStudy)
+ return false;
+
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ if(!aStudy)
+ return false;
+
+ bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
+ if ( aLocked ) {
+ SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
+ return false;
+ }
+
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this) , qPrintable(entry) );
+
+ _PTR(SObject) aSObject = anObjectInfo.mySObject;
+ if (aSObject) {
+ VISU::Base_i* aBase = anObjectInfo.myBase;
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+ if(aBase){
+ VISU::VISUType aType = aBase->GetType();
+ if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
+ CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
+ VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+ aType = aHolder->GetPrsType();
+ }
+ if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
+ aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
+ aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
+ aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
+ aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
+ aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
+ aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
+ aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS) {
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ if (!name.isEmpty()) {
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ // rename specific objects
+ if (VISU::Base_i* aBase = anObjectInfo.myBase) {
+ switch (aBase->GetType()) {
+ case VISU::TCURVE: { // Curve object
+ if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
+ aCurve->SetName(qPrintable(name), true);
+ break;
+ }
+ case VISU::TTABLE: { // Table object
+ if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
+ aTable->SetName(qPrintable(name), true);
+ break;
+ }
+ case VISU::TPOINTMAP3D: { // Table object
+ if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
+ aTable3d->SetTitle(qPrintable(name));
+ aTable3d->UpdateActors();
+ }
+ break;
+ }
+ case VISU::TCONTAINER: { // Container object
+ if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
+ aContainer->SetName(qPrintable(name), true);
+ break;
+ }
+ default: {
+ }}
+ }
+
+ // rename the study object
+ aName->SetValue( qPrintable(name) ); // rename the SObject
+
+ ViewManagerList aViewManagerList;
+ getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
+ SUIT_ViewManager* aViewManager;
+ Handle(SALOME_InteractiveObject) anIO =
+ new SALOME_InteractiveObject ( qPrintable(entry), "VISU", qPrintable(name) );
+ foreach( aViewManager, aViewManagerList ) {
+ if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
+ if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
+ aViewer->renameAll( anIO, qPrintable(name) );
+ }
+ }
+ QApplication::restoreOverrideCursor();
+ return true;
+ }
+ }
+ //Rename visual params
+ }
+ } else {
+ bool anIsExist;
+ QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+ if(anIsExist && "VIEW3D" == aVal) {
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ if (!name.isEmpty()) {
+ aName->SetValue(qPrintable(name));
+ }
+ }
+ }
+ }
+ }
+ return false;
+}