// VISU VISUGUI : GUI of VISU component
//
// Copyright (C) 2003 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 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
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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 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
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// Module : VISU
// $Header$
-using namespace std;
#include "VisuGUI.h"
-#include "VisuGUI_PhaseDlg.h"
-#include "VisuGUI_MagnitudeDlg.h"
-#include "VisuGUI_PhaseMagnitudeDlg.h"
-#include "VisuGUI_PartialScaDlg.h"
-#include "VisuGUI_CursorDlg.h"
-#include "VisuGUI_ScalarBarDlg.h"
-#include "VisuGUI_SweepPrefDlg.h"
-#include "VisuGUI_CutPlanesDlg.h"
-#include "VisuGUI_CutLinesDlg.h"
-#include "VisuGUI_VectorsDlg.h"
-#include "VisuGUI_IsoSurfacesDlg.h"
-#include "VisuGUI_StreamLinesDlg.h"
-#include "VisuGUI_TimeAnimation.h"
-#include "VisuGUI_Selection.h"
-#include "VisuGUI_VisuAsDlg.h"
-#include "VisuGUI_SelVectCompDlg.h"
-#include "VisuGUI_NonIsometricDlg.h"
+// STL Includes
+#include <exception>
+#include <typeinfo>
+#include <vector>
-#include "VISU_Gen_i.hh"
-#include "VISU_Result_i.hh"
-#include "VISU_Extractor.hxx"
-#include "VISU_Table_i.hh"
-#include "VISU_ViewManager_i.hh"
-#include "VISU_LookupTable.hxx"
-#include "VISU_ScalarBarActor.hxx"
+// QT Includes
+#include <qptrlist.h>
+#include <qptrvector.h>
+#include <qcolordialog.h>
-#include "SALOMEGUI_ImportOperation.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "utilities.h"
+// VTK Includes
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkActorCollection.h>
-#include "QAD_Config.h"
-
-#include "QAD_Settings.h"
-#include "QAD_Tools.h"
-#include "QAD_LeftFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_MessageBox.h"
-#include "QAD_ObjectBrowser.h"
-#include "QAD_ObjectBrowserItem.h"
-#include "QAD_Menus.h"
-#include "QAD_Resource.h"
-#include "QAD_ResourceMgr.h"
-#include "QAD_FileDlg.h"
-#include "QAD_WaitCursor.h"
-#include "SALOME_Selection.h"
-#include "SALOMEGUI_NameDlg.h"
-#include "SALOMEGUI_TableDlg.h"
-#include "SALOMEGUI_SetupCurveDlg.h"
-#include "SALOMEGUI_SetValueDlg.h"
-#include "Plot2d_SetupPlot2dDlg.h"
-#include "Plot2d_ViewFrame.h"
-#include "VTKViewer_ViewFrame.h"
+// SALOME Includes
+#include "SALOME_LifeCycleCORBA.hxx"
-// QT Includes
-#define INCLUDE_MENUITEM_DEF
-#include <qpopupmenu.h>
-#include <qfont.h>
-#include <qpainter.h>
-#include <qstring.h>
-#include <qapplication.h>
-#include <qinputdialog.h>
-#include <qcolordialog.h>
-#include <qlabel.h>
-#include <qspinbox.h>
-#include <qradiobutton.h>
-#include <qthread.h>
-#include <qlistbox.h>
-#include <qcombobox.h>
-
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qlistview.h>
-#endif
-//VRV: porting on Qt 3.0.5
-#include <qmessagebox.h>
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_MessageBox.h"
-#include <med.h>
-#include CORBA_CLIENT_HEADER(Med_Gen)
+#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
-#include <vtkActor.h>
-#include <vtkDataSetMapper.h>
+#include "CAM_Module.h"
-// Open CASCADE Include
-#include <TCollection_AsciiString.hxx>
+#include "SVTK_RenderWindow.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_Functor.h"
-//#define CHECKTIME
-#ifdef CHECKTIME
-static int MYCHECKTIME = 1;
-#else
-static int MYCHECKTIME = 0;
-#endif
-#include <Utils_Timer.hxx>
+#include "SPlot2d_ViewModel.h"
+#include "SPlot2d_SetupPlot2dDlg.h"
+#include "Plot2d_SetupCurveDlg.h"
-#ifdef DEBUG
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-#else
-static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
-#endif
+#include "OB_Browser.h"
-class CustomItem : public QCustomMenuItem{
-public:
- CustomItem( const QString& s, const QFont& f )
- : string( s ), font( f ){};
- ~CustomItem(){}
-
- void paint( QPainter* p, const QColorGroup& /*cg*/, bool /*act*/, bool /*enabled*/, int x, int y, int w, int h )
- {
- p->setFont ( font );
- p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string );
- }
-
- QSize sizeHint()
- {
- return QFontMetrics( font ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string );
- }
-private:
- QString string;
- QFont font;
-};
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
-static VisuGUI MYVISUGUI;
-static VisuGUI *visuGUI = &MYVISUGUI;
+#include "SalomeApp_Application.h"
+#include "SalomeApp_DataModel.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_Selection.h"
+#include "SalomeApp_Preferences.h"
-VISU::VISU_Gen_i* VisuGUI::GetVisuGen(){
- VISU::VISU_Gen_i::GetVisuGenImpl()->SetCurrentStudy(GetStudyDocument());
- return VISU::VISU_Gen_i::GetVisuGenImpl();
-}
+#include "VISUConfig.hh"
+#include "VISU_Gen_i.hh"
+#include "VISU_Mesh_i.hh"
+#include "VISU_Table_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_View_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "VISU_Plot3D_i.hh"
-QAD_Desktop* VisuGUI::GetDesktop(){
- return QAD_Application::getDesktop() ;
-}
+#include "VISU_Actor.h"
-QAD_Study* VisuGUI::GetActiveStudy(){
- return GetDesktop()->getActiveStudy() ;
-}
+#include "VisuGUI_Prs3dTools.h"
+#include "VisuGUI_Tools.h"
-vtkRenderer* VisuGUI::GetRenderer(){
- if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame())
- return aViewFrame->getRenderer();
- return NULL;
-}
+#include "VisuGUI_PopupTools.h"
+#include "VisuGUI_NameDlg.h"
+#include "VisuGUI_FileDlg.h"
+#include "VisuGUI_CursorDlg.h"
+#include "VisuGUI_Selection.h"
+#include "VisuGUI_TimeAnimation.h"
+#include "VisuGUI_EditContainerDlg.h"
+#include "VisuGUI_NonIsometricDlg.h"
+#include "VisuGUI_ClippingDlg.h"
+#include "VisuGUI_Plot3DDlg.h"
+#include "VisuGUI_CubeAxesDlg.h"
+#include "VisuGUI_OffsetDlg.h"
-VTKViewer_ViewFrame* VisuGUI::GetVtkViewFrame(){
- QAD_ViewFrame* aViewFrame = GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
-}
+#include "VISU_ScalarMap_i.hh"
+#include "VisuGUI_ScalarBarDlg.h"
-SALOMEDS::Study_var VisuGUI::GetStudyDocument(){
- return GetActiveStudy()->getStudyDocument();
-}
+#include "VISU_DeformedShape_i.hh"
+#include "VisuGUI_DeformedShapeDlg.h"
-SALOMEDS::StudyBuilder_var VisuGUI::NewBuilder(){
- return GetStudyDocument()->NewBuilder();
-}
+#include "VISU_IsoSurfaces_i.hh"
+#include "VisuGUI_IsoSurfacesDlg.h"
+#include "VISU_CutPlanes_i.hh"
+#include "VisuGUI_CutPlanesDlg.h"
-/**
- * Finds value by given key
- */
+#include "VISU_CutLines_i.hh"
+#include "VisuGUI_CutLinesDlg.h"
-VISU::Storable::TRestoringMap VisuGUI::getMapOfValue(SALOMEDS::SObject_var theSObject) {
- VISU::Storable::TRestoringMap aMap;
- if(!theSObject->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
- if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- CORBA::String_var aString = aComment->Value();
- QString strIn(aString.in());
- VISU::Storable::StrToMap(strIn,aMap);
- }
- }
- return aMap;
-}
-
-QString VisuGUI::getValue(SALOMEDS::SObject_var theSObject, QString theKey) {
- QString aStr("");
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
- if(!aMap.empty())
- aStr = VISU::Storable::FindValue(aMap, theKey.latin1());
- return aStr;
-}
-
-
-CORBA::Object_var GetSelectedObj(Handle(SALOME_InteractiveObject)* pIO = NULL, QAD_Study* theStudy = NULL,
- VISU::Storable::TRestoringMap* pMap = NULL)
-{
- if(theStudy == NULL) theStudy = VisuGUI::GetActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection(theStudy->getSelection());
- if(aSel->IObjectCount() > 0){
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- if(pIO != NULL) *pIO = anIO;
- if(anIO->hasEntry()){
- SALOMEDS::Study_var aStudy = theStudy->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
- if (pMap != NULL && aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,*pMap);
- }
- return VISU::SObjectToObject(aSObject);
- }
- }
- }
- return CORBA::Object::_nil();
-}
+#include "VISU_StreamLines_i.hh"
+#include "VisuGUI_StreamLinesDlg.h"
+#include "VISU_Vectors_i.hh"
+#include "VisuGUI_VectorsDlg.h"
-int IsTrihedronDisplayed(){
- if(VTKViewer_ViewFrame* aVTKViewFrame = VisuGUI::GetVtkViewFrame())
- return aVTKViewFrame->isTrihedronDisplayed();
- return 1;
-}
+#include "VisuGUI_TableDlg.h"
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(MED_Gen)
-void RepaintCurrentView(){
- if(VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame()) vf->Repaint();
-}
+#include "utilities.h"
-/**
- * Returns selected sclalar mode or -1 if it was cancelled
- */
-int GetScalarMode(VISU::Result_i* theResult, const char* theFieldName){
- int aScalarMode = 0;
-// const VISU::TField* aField = theResult->GetInput()->GetField(theFieldName);
-// if(aField->myNbComp > 1){
-// VisuGUI_SelVectCompDlg* SelCompDlg = new VisuGUI_SelVectCompDlg(QAD_Application::getDesktop(), 0, TRUE, 0);
-// if(SelCompDlg->exec()){
-// aScalarMode = SelCompDlg->whatIsChecked();
-// } else {
-// aScalarMode = -1;
-// }
-// delete SelCompDlg;
-// }
- return aScalarMode;
-}
+#include "VisuGUI_ActionsDef.h"
+using namespace VISU;
-VisuGUI::VisuGUI(){}
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+//////////////////////////////////////////////////
+// Class: VisuGUI
+//////////////////////////////////////////////////
-VisuGUI* VisuGUI::GetOrCreateVisuGUI( QAD_Desktop* desktop ){
- if(!visuGUI){
- static VisuGUI VISUGUI;
- visuGUI = &VISUGUI;
- }
- return visuGUI;
+VisuGUI::VisuGUI():
+ SalomeApp_Module( "VISU" )
+{
}
-/* ********************************************************************************* */
-/* Function to return VisuGUI object */
-/* ********************************************************************************* */
-VisuGUI* VisuGUI::GetVisuGUI( )
+
+VisuGUI::~VisuGUI()
{
- return VisuGUI::GetOrCreateVisuGUI(QAD_Application::getDesktop());
}
-/* ==================================================================================== */
-/* ==================================================================================== */
-/* ONGUI EVENT */
-/* ==================================================================================== */
-/* ==================================================================================== */
-static int isStudyLocked(const SALOMEDS::Study_var& theStudy){
- return theStudy->GetProperties()->IsLocked();
-}
+void
+VisuGUI::
+OnImportFromFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
+ CheckLock(GetCStudy(GetAppStudy(this)));
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ QStringList aFilter;
+ aFilter.append( tr("FLT_MED_FILES") );
+ aFilter.append( tr("FLT_ALL_FILES") );
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ "",
+ aFilter,
+ tr("MEN_IMPORT_FROM_FILE"),
+ true);
+ if(aFileInfo.exists()) {
+ application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
+
+ VISU::Result_var aResult;
+ bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
+ if (VisuGUI_FileDlg::IsBuild) {
+ aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
+ if (!CORBA::is_nil(aResult.in()))
+ if (Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())) {
+ if (!aRes->IsPossible())
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_CANT_BUILD_PRESENTATION"),
+ tr("BUT_OK"));
+ else
+ aRes->BuildAll();
+ }
+ } else {
+ aResourceMgr->setValue("VISU", "full_med_loading", false);
+ aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
+ aResourceMgr->setValue("VISU", "full_med_loading", anIsBuild);
+ }
-static int checkLock(const SALOMEDS::Study_var& theStudy) {
- if (isStudyLocked(theStudy)) {
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- return true;
+ if (CORBA::is_nil(aResult.in())) {
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_IN_THE_FILE"),
+ tr("BUT_OK"));
+ }else{
+ application()->putInfo(aFileInfo.filePath() + tr("INF_DONE"));
+ UpdateObjBrowser(this);
+ }
}
- return false;
}
+void
+VisuGUI::
+OnExploreMEDFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ CheckLock(aStudy);
+
+ SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
+
+ QStringList aFilter;
+ aFilter.append( tr("FLT_MED_FILES") );
+ aFilter.append( tr("FLT_ALL_FILES") );
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ "",
+ aFilter,
+ tr("MEN_EXPLORE_MED_FILE"),
+ true);
+ if(aFileInfo.exists()){
+ application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
+ std::string aStudyName = aStudy->Name();
+ try
+ {
+ aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
+ }
+ catch(...)
+ {
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_IN_THE_FILE"),
+ tr("BUT_OK"));
+ }
+ application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
+ getApp()->updateObjectBrowser(true); // as need to update MED tree
+ getApp()->updateActions();
+ }
+}
+
-bool VisuGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+void
+VisuGUI::
+OnImportTableFromFile()
{
- try{
- VisuGUI::GetOrCreateVisuGUI(parent);
- QString VisuInputDir = getVisuInputDir();
- QString VisuOutputDir = getVisuOutputDir();
- vtkRenderer *theRenderer = GetRenderer();
+ if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
+ CheckLock(GetCStudy(GetAppStudy(this)));
+
+ QStringList aFilter;
+ aFilter.append( tr("FLT_TABLE_FILES") );
+ aFilter.append( tr("FLT_ALL_FILES") );
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ "",
+ aFilter,
+ tr("MEN_IMPORT_TABLE"),
+ true);
+ if (aFileInfo.exists()) {
+ application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
+
+ CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
+
+ if (CORBA::is_nil(anObject.in())) {
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_IN_THE_FILE"),
+ tr("BUT_OK"));
+ } else {
+ application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
+ UpdateObjBrowser(this);
+ }
+ }
+}
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument(); //Document OCAF de l'etude active
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
+void
+VisuGUI::
+OnExportTableToFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
+
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ if (aListIO.Extent() > 0) {
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ if (anIO->hasEntry()) {
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObj) return;
+
+ // find table attribute
+ bool isTOR = true;
+ _PTR(GenericAttribute) anAttr;
+
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
+ isTOR = false;
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+ // if the current SObject is a table title
+ // we take a father contaning the table
+ aSObj = aSObj->GetFather();
+
+ if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
+ isTOR = true;
+ } else {
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+ return;
+ }
+ }
+ }
+ }
- switch (theCommandID)
- {
- /* ======================================================================================== */
- /* Define Selection Mode */
- /* ======================================================================================== */
- case 101:
- case 102:
- case 103:
- case 104:
- {
- QApplication::setOverrideCursor( Qt::waitCursor );
- int mode = theCommandID - 100; // Point, Edge, Cell, Actor
- parent->SetSelectionMode( mode );
- QApplication::restoreOverrideCursor();
+ // get table title in order to have default name of the file
+ QString aTitle;
+ if (isTOR) {
+ _PTR(AttributeTableOfReal) aTabAttr (anAttr);
+ if (!aTabAttr) return;
+ aTitle = aTabAttr->GetTitle().c_str();
+ } else {
+ _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
+ if (!aTabAttr) return;
+ aTitle = aTabAttr->GetTitle().c_str();
}
- break;
-
- /* ======================================================================================== */
- /* Import Table from file */
- /* ======================================================================================== */
-
- case 199:
- {
- if(checkLock(aStudy)) break;
- visuGUI->ImportTablesFromFile();
- break;
+ aTitle.simplifyWhiteSpace();
+ aTitle = aTitle.replace(QRegExp(" "), "_");
+
+ // get default path for the file
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
+ if (aDir.isEmpty()) {
+ aDir = aResourceMgr->stringValue("VISU","InputDir","");
+ if (aDir.isEmpty()) {
+ aDir = getenv("CSF_PATHData");
+ }
}
-
- /* ======================================================================================== */
- /* Import Mesh from MED, DAT file */
- /* ======================================================================================== */
-
- case 112:
- {
- visuGUI->ImportFromFile();
- break;
+ QString aPath = Qtx::addSlash(aDir) + aTitle;
+
+ // get name for the file
+ QStringList aFilter;
+ aFilter.append("Table Files (*.xls)");
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ aPath,
+ aFilter,
+ tr("MEN_EXPORT_TABLE"), // "Export Table To File"
+ false);
+
+ // export
+ QString aFile = aFileInfo.filePath();
+ if (!aFile.isEmpty()) {
+ application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
+ aDir = Qtx::dir(aFile, true);
+ aResourceMgr->setValue("VISU", "OutputDir", aDir);
+
+ try {
+ GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1());
+ application()->putInfo(aFile + " " + tr("INF_DONE"));
+ } catch(std::exception& ex) {
+ INFOS(ex.what());
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_DURING_EXPORT") + " " + tr(ex.what()),
+ tr("BUT_OK"));
+ } catch(...) {
+ INFOS(tr("ERR_ERROR_DURING_EXPORT"));
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_DURING_EXPORT"),
+ tr("BUT_OK") );
+ }
}
+ }
+ }
+}
- /* ======================================================================================== */
- /* Export results and mesh into a file format */
- /* ======================================================================================== */
+void
+VisuGUI::
+OnImportMedField()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
- case 122:
- {
- //visuGUI->ExportToFile();
- break;
- }
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
- /* ========================================================================== */
- /* Visualization of Results : */
- /* 4011 : Scalar Map */
- /* 4012 : Deformed Shape */
- /* 4013 : Vectors */
- /* 4014 : Iso-Surfaces */
- /* 4015 : Cut Planes */
- /* 4016 : Stream Lines */
- /* ========================================================================== */
-
- case 4011 :
- visuGUI->CreateScalarMap();
- break;
- case 4012 :
- visuGUI->CreateDeformedShape();
- break;
- case 4013 :
- visuGUI->CreateVectors();
- break;
- case 4014 :
- visuGUI->CreateIsoSurfaces();
- break;
- case 4015 :
- visuGUI->CreateCutPlanes();
- break;
- case 4018 :
- visuGUI->CreateCutLines();
- break;
- case 4016 :
- visuGUI->CreateStreamLines();
- break;
-
- /* ======================================================================================================================= */
- /* View Scalar Animation (Animation/scalar) */
- /* With Phase */
- /* ======================================================================================================================= */
-
- //case 4021 :
- //case 4022 :
- //case 4023 :
-
- /* ========================================================================================================================= */
- /* Selection - Cell by number */
- /* ========================================================================================================================= */
-
- case 4111 :
- visuGUI->SelectCell();
- break;
-
- /* ========================================================================================================================= */
- /* Selection - Cell - information attribute */
- /* ========================================================================================================================= */
-
- case 4112 :
- visuGUI->InfoOnCell();
- break;
-
- /* ========================================================================================================================= */
- /* Selection - Point - information number */
- /* ========================================================================================================================= */
-
- case 4121 :
- visuGUI->SelectPoint();
- break;
-
- /* ========================================================================================================================= */
- /* Selection - Point - information attribute */
- /* ========================================================================================================================= */
-
- case 4122 :
- visuGUI->InfoOnPoint();
- break;
-
- /* ========================================================================================================================= */
- /* Selection - Shape */
- /* ========================================================================================================================= */
-
- //case 413 :
-
- /* ========================================================================================================================= */
- /* Visualization - Wireframe */
- /* ========================================================================================================================= */
-
- case 4211 :
- ChangeViewer(1);
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Surface */
- /* ========================================================================================================================= */
-
- case 4212 :
- ChangeViewer(2);
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Points */
- /* ========================================================================================================================= */
-
- case 4213 :
- ChangeViewer(0);
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Erase */
- /* ========================================================================================================================= */
-
- case 422 :
- ChangeViewer(-1);
- break;
-
- /* ========================================================================================================================= */
- /* Visualization - Global */
- /* ========================================================================================================================= */
-
- //case 423 :
-
- /* ========================================================================================================================= */
- /* Visualization - Partial */
- /* ========================================================================================================================= */
-
- //case 424 :
-
- case 430 :
- {
- //Show dialog that allows to select scale function and corresponding scale factor
- VisuGUI_NonIsometricDlg* m_NonIsoDlg = new VisuGUI_NonIsometricDlg ( QAD_Application::getDesktop(), "m_NonIsoDlg",
- FALSE, Qt::WDestructiveClose );
- m_NonIsoDlg->show();
- break;
- }
-
- /* ============================ */
- /* POP-UP OBJECTS BROWSER */
- /* ============================ */
-
- case 900 : // Rename object
- visuGUI->Rename();
- break;
-
- // ---------------- For Popup in Viewer
- case 802 : // Erase
- case 902 : // Erase
- visuGUI->ErasePrs();
- break;
-
- case 803 : // Display only
- case 903 : // Display only
- visuGUI->DisplayOnlyPrs();
- break;
-
- case 901 : // Display
- visuGUI->DisplayPrs();
- break;
-
- case 8041 : // Object representation : Wireframe
- case 9041 : // Object representation : Wireframe
- visuGUI->ChangeRepresentation(WIREFRAME);
- break;
-
- case 8042 : // Object representation : Surface
- case 9042 : // Object representation : Surface
- visuGUI->ChangeRepresentation(SURFACE);
- break;
-
- case 8043 : // Object representation : Points
- case 9043 : // Object representation : Points
- visuGUI->ChangeRepresentation(POINTS);
- break;
-
- case 8044 : // Object representation : Shrink/Unshrink
- case 9044 : // Object representation : Shrink/Unshrink
- visuGUI->ChangeRepresentation(SHRINK);
- break;
-
- case 8051 : // Change object color
- case 9051 : // Change object color
- visuGUI->ChageColor();
- break;
-
- case 8052 : // Change object opacity
- case 9052 : // Change object opacity
- visuGUI->ChangeOpacity();
- break;
-
- case 8053 : // Change object line width
- case 9053 : // Change object line width
- visuGUI->ChangeLines();
- break;
-
- case 808 : // Sweep IsoSurfaces or Cutplanes
- case 908 : // Sweep IsoSurfaces or Cutplanes
- visuGUI->Sweep();
- break;
-
-/* ======================================================================================== */
-/* Preferences for Scalar Bar */
-/* ======================================================================================== */
- case 51:
- {
- ChangeScalarBar();
- break;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = It.Value();
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject->_is_nil()) {
+ 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);
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
+ if (!CORBA::is_nil(aField.in()))
+ GetVisuGen(this)->ImportMedField(aField);
+ } else {
+ SALOMEDS::SObject_var aSFather = aSObject->GetFather();
+ SALOMEDS::GenericAttribute_var anAttr;
+ aSFather->FindAttribute(anAttr, "AttributeName");
+ SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ CORBA::String_var aValue = aName->Value();
+ if (strcmp(aValue.in(), "MEDFIELD") == 0)
+ GetVisuGen(this)->ImportMed(aSObject);
}
+ }
+ }
+ UpdateObjBrowser(this, true);
+ QApplication::restoreOverrideCursor();
+}
-/* ======================================================================================== */
-/* Preferences for Sweeping */
-/* ======================================================================================== */
- case 52:
- {
- SetSweepingPreferences();
+void
+CreateCurves( SalomeApp_Module* theModule,
+ VISU::CutLines_i* thePrs,
+ QDialog* theDlg,
+ const bool theCreate = true )
+{
+ if ( !thePrs )
+ return;
+ VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
+ if ( !aCutDlg )
+ return;
+
+ _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
+ _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
+
+ if ( !theCreate && aSObject ) {
+ // Remove old Table
+ _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+ _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
+ for (; aIter->More(); aIter->Next()) {
+ _PTR(SObject) aTblObj = aIter->Value();
+ if ( aTblObj ) {
+ _PTR(GenericAttribute) anAttr;
+ if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
+ aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
+ break;
+ }
}
- break;
-
-
- case 113: // Load MED using MED component
- {
- if (checkLock(GetStudyDocument())) break;
-
- Engines::Component_var aMedComp = GetDesktop()->getEngine("FactoryServer", "Med");
- if (CORBA::is_nil(aMedComp)) return false;
- Engines::Med_Gen_var aMedGen = Engines::Med_Gen::_narrow(aMedComp);
- if (CORBA::is_nil(aMedGen)) return false;
-
- QStringList filtersList ;
-
- filtersList.append( tr("MED_MEN_IMPORT_MED") );
- filtersList.append( tr("MED_MEN_ALL_FILES") ) ;
- QString aFileName = QAD_FileDlg::getFileName(GetDesktop(),
- "",
- filtersList,
- tr("MED_MEN_IMPORT"),
- true);
- if (!aFileName.isEmpty()) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- aMedGen->readStructFileWithFieldType(aFileName.latin1(), GetActiveStudy()->getTitle());
- GetActiveStudy()->updateObjBrowser();
- QApplication::restoreOverrideCursor();
- }
+ }
+ }
+
+ if ( aCutDlg->isGenerateTable() ) {
+ GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
+ if ( aCutDlg->isGenerateCurves() ) {
+ if ( aSObject ) {
+ _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+ _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
+ for (; aIter->More(); aIter->Next()) {
+ _PTR(SObject) aTblObj = aIter->Value();
+ if ( aTblObj ) {
+ _PTR(GenericAttribute) anAttr;
+ if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
+ CreatePlot( theModule, aTblObj );
+ }
+ }
+ }
}
- break;
-
- default:
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("MSG_NOT_IMPLEMENTED"),
- tr ("VISU_BUT_OK") );
- break;
- }
- }catch (const SALOME::SALOME_Exception& S_ex) {
- QtCatchCorbaException(S_ex);
- return false;
+ }
}
- catch(...) {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("ERR_UNKNOWN_EXCEPTION"),
- tr("VISU_BUT_OK") );
- return false;
+
+ if (!theCreate && aSObject) {
+ UpdateObjBrowser(theModule);
}
- return true;
}
+void
+VisuGUI::
+OnCreateMesh()
+{
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aStudy))
+ return;
-/* ********************************************************************************* */
-/* Function to find Actor in Viewer */
-/* ********************************************************************************* */
+ // Get selected SObject
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (anIO.IsNull() || !anIO->hasEntry())
+ return;
+ // create a VTK view window if it does not exist
+ GetViewWindow( this, /*create=*/true );
-VISU_Actor *VisuGUI::GetActor(int* theSelectionType){
- VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d();
- if (!aPrs3d) return NULL;
+ CreateMesh(this, anIO);
+}
- VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame();
- if(!vf) return NULL;
+void
+VisuGUI::
+OnCreateManyMesh()
+{
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aStudy))
+ return;
- if(theSelectionType){
- QAD_Study *aStudy = QAD_Application::getDesktop()->getActiveStudy();
- SALOME_Selection *aSel = SALOME_Selection::Selection(aStudy->getSelection());
- *theSelectionType = aSel->SelectionMode();
- }
+ // create a VTK view window if it does not exist
+ GetViewWindow( this, /*create=*/true );
+
+ // Get selected SObject
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ SALOME_ListIteratorOfListIO anIter (aListIO);
+ for (; anIter.More(); anIter.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if (anIO.IsNull() || !anIO->hasEntry())
+ return;
- return GetActor(aPrs3d,vf);
-}
-
-/* ********************************************************************************** */
-/* Function ShowTrihedron */
-/* ********************************************************************************** */
-
-void VisuGUI::ShowTrihedron(bool ShowThd){
- bool ThdIsVisible = true;
- if( ShowThd && !ThdIsVisible)
- ((VTKViewer_ViewFrame*)visuGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTrihedron();
- if( !ShowThd && ThdIsVisible)
- ((VTKViewer_ViewFrame*)visuGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTrihedron();
-}
-
-/* ********************************************************************************** */
-/* Destructor */
-/* Clear all tmp files used in VISU */
-/* ********************************************************************************** */
-
-VisuGUI::~VisuGUI(){
- MESSAGE("VisuGUI::~VisuGUI");
-}
-
-/* ********************************************************************************** */
-/* Function ChangeViewer */
-/* Change representation of all actors */
-/* ********************************************************************************** */
-
-void VisuGUI::ChangeViewer(int theType){
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (!vf) return;
-
- vtkActor *anActor;
- vtkRenderer *aRen = vf->getRenderer();
- vtkActorCollection *anActColl = aRen->GetActors();
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
- if(anActor->IsA("VISU_Actor")){
- VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor);
- if(anVISUActor->GetVisibility() > 0)
- if(theType > 0)
- anVISUActor->SetRepresentation(theType);
- else if(theType == -1)
- anVISUActor->VisibilityOff();
- else
- anVISUActor->VisibilityOn();
- }
+ CreateMesh(this, anIO);
}
}
+void
+VisuGUI::
+OnCreateScalarMap()
+{
+ CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
+}
-// -----------------------------------------------------------------------------------------
-// EVENTS
-// -----------------------------------------------------------------------------------------
-bool VisuGUI::OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI::
+OnCreateDeformedShape()
{
- VisuGUI::GetOrCreateVisuGUI(parent);
- return true;
+ CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
}
-// ====================================================================================================================
+void
+VisuGUI::
+OnCreateVectors()
+{
+ CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
+}
-bool VisuGUI::OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI::
+OnCreateIsoSurfaces()
{
- VisuGUI::GetOrCreateVisuGUI(parent);
- return true;
+ CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
}
-// ===================================================================================================================
+void
+VisuGUI::
+OnCreateCutPlanes()
+{
+ CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
+}
-bool VisuGUI::OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI::
+OnCreateCutLines()
{
- VisuGUI::GetOrCreateVisuGUI(parent);
- if (GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK) // true = Viewer OCC
- return false;
+ CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
+}
- MESSAGE ( "VisuGUI::onKeyPress : " << pe->key() )
+void
+VisuGUI::
+OnCreateStreamLines()
+{
+ CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
+}
- switch ( pe->key() )
- {
- case Key_Escape :
- {
- MESSAGE("--> Key : Escape")
- return true;
- }
- default :
- return true;
- break;
- }
- return true;
+void
+VisuGUI::
+OnCreatePlot3D()
+{
+ CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
}
+void
+VisuGUI::
+OnCreatePlot2dView()
+{
+ CheckLock(GetCStudy(GetAppStudy(this)));
+ GetVisuGen( this )->CreateContainer();
+ UpdateObjBrowser(this);
+}
+void
+VisuGUI::
+OnDisplayPrs()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
-//=====================================================================================
-// Slot-functions for presentations creation
-//=====================================================================================
+ SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true );
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ SALOME_ListIO aList;
+ SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
+ mgr->selectedObjects(aList);
-#define CREATEPRESENTATION(FunctionName) \
- void FunctionName() { \
- if (checkLock(GetStudyDocument())) return; \
- SALOMEDS::SObject_var objVisu; \
- if (!TestObjectBrowser(objVisu)) return; \
- if(!FunctionName(objVisu)) return; \
- GetActiveStudy()->updateObjBrowser(); \
- GetDesktop()->putInfo("Ready"); \
- VTKViewer_ViewFrame* vf = GetVtkViewFrame(); \
- if (vf) { \
- /*vf->getRenderer()->ResetCameraClippingRange();*/ \
- vf->onViewFitAll(); \
- } \
- }
+ Handle(SALOME_InteractiveObject) anIO;
+ for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
+ anIO = it.Value();
+ CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
+ if ( !CORBA::is_nil( anObject ) ) {
+ // is it Prs3d object ?
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
+ if(aPrsObject){
+ if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
+ UpdateViewer( this, aPrsObject );
+ if ( vw ) {
+ vw->highlight(anIO, 1);
+ }
+ continue;
+ }
+ // is it Curve ?
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
+ if(aCurve){
+ if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
+ PlotCurve( this, aCurve, VISU::eDisplay );
+ continue;
+ }
+ // is it Container ?
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
+ if(aContainer){
+ if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
+ PlotContainer( this, aContainer, VISU::eDisplay );
+ continue;
+ }
+ // is it Table ?
+ VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
+ if(aTable){
+ if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
+ PlotTable( this, aTable, VISU::eDisplay );
+ continue;
+ }
+ }
+ }
+ if ( vw ) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+ }
+ QApplication::restoreOverrideCursor();
+}
+void
+VisuGUI::
+OnDisplayOnlyPrs()
+{
+ OnEraseAll();
+ OnDisplayPrs();
+}
-CREATEPRESENTATION(VisuGUI::CreateScalarMap);
-CREATEPRESENTATION(VisuGUI::CreateDeformedShape);
-CREATEPRESENTATION(VisuGUI::CreateVectors);
-CREATEPRESENTATION(VisuGUI::CreateIsoSurfaces);
-CREATEPRESENTATION(VisuGUI::CreateCutPlanes);
-CREATEPRESENTATION(VisuGUI::CreateCutLines);
-CREATEPRESENTATION(VisuGUI::CreateStreamLines);
+void
+VisuGUI::
+OnErasePrs()
+{
+ if(MYDEBUG) MESSAGE("OnErasePrs");
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ SVTK_ViewWindow* vw = GetViewWindow( this );
+ if (vw)
+ vw->unHighlightAll();
+ SALOME_ListIO aList;
+ SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
+ mgr->selectedObjects(aList);
-//=====================================================================================
-// function : setSettings()
-// purpose :
-//=====================================================================================
-bool VisuGUI::setSettings(QAD_Desktop* parent)
-{
- VisuGUI::GetOrCreateVisuGUI(parent);
- return true;
+ Handle(SALOME_InteractiveObject) anIO;
+ for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
+ anIO = it.Value();
+ CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
+ ErasePrs( this, anObject, false );
+ }
+
+ if (vw)
+ vw->Repaint();
+
+ QApplication::restoreOverrideCursor();
}
-//=====================================================================================
-// function : DisplayPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayPrs() {
- MESSAGE("VisuGUI::DisplayPrs");
+
+void
+VisuGUI::
+OnEditScalarMap()
+{
Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
- if(aPrsObject){
- MESSAGE("VisuGUI::DisplayPrs : Prs3d object");
- UpdateViewer(aPrsObject);
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- vf->highlight(anIO, 1);
- }
- return;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject));
- if(aCurve){
- MESSAGE("VisuGUI::DisplayPrs : Curve object");
- PlotCurve(aCurve, VISU::eDisplay );
- return;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject));
- if(aContainer){
- MESSAGE("VisuGUI::DisplayPrs : Container object");
- PlotContainer(aContainer, VISU::eDisplay );
- return;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject));
- if(aTable){
- MESSAGE("VisuGUI::DisplayPrs : Table object");
- PlotTable(aTable, VISU::eDisplay );
- return;
+ if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+ EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg,1>(this, aPrs3d);
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ aViewWindow->highlight(anIO, 1);
}
}
}
-//=====================================================================================
-// function : DisplayOnlyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayOnlyPrs() {
- MESSAGE("VisuGUI::DisplayOnlyPrs");
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- PortableServer::Servant aServant = VISU::GetServant(anObject);
- if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant)){
- MESSAGE("VisuGUI::DisplayOnlyPrs : Prs3d object");
- UpdateViewer(aPrsObject, true);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- }
- }else if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant)){
- MESSAGE("VisuGUI::DisplayOnlyPrs : Curve object");
- PlotCurve(aCurve, VISU::eDisplayOnly );
- }else if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant)){
- MESSAGE("VisuGUI::DisplayOnlyPrs : Container object");
- PlotContainer(aContainer, VISU::eDisplayOnly );
- }else if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aServant)){
- MESSAGE("VisuGUI::DisplayOnlyPrs : Table object");
- PlotTable(aTable, VISU::eDisplayOnly );
+
+void
+VisuGUI::
+OnEditDeformedShape()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+ EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg,1>(this, aPrs3d);
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ aViewWindow->highlight(anIO, 1);
}
}
}
-//=====================================================================================
-// function : ErasePrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::ErasePrs() {
- MESSAGE("VisuGUI::ErasePrs");
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
- if(aPrsObject){
- MESSAGE("VisuGUI::ErasePrs : Prs3d object");
- ErasePrs(aPrsObject);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->Repaint();
- }
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject));
- if(aCurve){
- MESSAGE("VisuGUI::ErasePrs : Curve object");
- PlotCurve(aCurve, VISU::eErase );
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject));
- if(aContainer){
- MESSAGE("VisuGUI::ErasePrs : Container object");
- PlotContainer(aContainer, VISU::eErase );
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject));
- if(aTable){
- MESSAGE("VisuGUI::ErasePrs : Table object");
- PlotTable(aTable, VISU::eErase );
+
+void
+VisuGUI::
+OnEditCutPlanes()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+ EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg,0>(this, aPrs3d);
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ aViewWindow->highlight(anIO, 1);
}
}
}
-//=====================================================================================
-// function : DisplayManyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayManyPrs()
+
+void
+VisuGUI::
+OnEditCutLines()
{
- MESSAGE("VisuGUI::DisplayManyPrs");
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject));
- if(aPrsObject){
- MESSAGE("VisuGUI::DisplayManyPrs : Prs3d object");
- UpdateViewer(aPrsObject);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- vf->highlight(anIO, 1);
- }
- continue;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject));
- if(aCurve){
- MESSAGE("VisuGUI::DisplayManyPrs: Curve object");
- PlotCurve(aCurve, VISU::eDisplay );
- continue;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject));
- if(aContainer){
- MESSAGE("VisuGUI::DisplayManyPrs : Container object");
- PlotContainer(aContainer, VISU::eDisplay );
- continue;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject));
- if(aTable){
- MESSAGE("VisuGUI::DisplayManyPrs : Table object");
- PlotTable(aTable, VISU::eDisplay );
- continue;
- }
- }
- }
+ Handle(SALOME_InteractiveObject) anIO;
+ if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+ EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg,0>(this, aPrs3d);
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ aViewWindow->highlight(anIO, 1);
}
}
}
-//=====================================================================================
-// function : EraseManyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::EraseManyPrs()
+
+void
+VisuGUI::
+OnEditIsoSurfaces()
{
- MESSAGE("VisuGUI::EraseManyPrs");
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIO LIO; LIO = Sel->StoredIObjects();
- SALOME_ListIteratorOfListIO It( LIO );
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject));
- if(aPrsObject){
- MESSAGE("VisuGUI::EraseManyPrs : Prs3d object");
- ErasePrs(aPrsObject);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->Repaint();
- }
- continue;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject));
- if(aCurve){
- MESSAGE("VisuGUI::EraseManyPrs : Curve object");
- PlotCurve(aCurve, VISU::eErase );
- continue;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject));
- if(aContainer){
- MESSAGE("VisuGUI::EraseManyPrs : Container object");
- PlotContainer(aContainer, VISU::eErase );
- continue;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject));
- if(aTable){
- MESSAGE("VisuGUI::EraseManyPrs : Table object");
- PlotTable(aTable, VISU::eErase );
- continue;
- }
- }
- }
+ Handle(SALOME_InteractiveObject) anIO;
+ if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+ EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg,1>(this, aPrs3d);
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ aViewWindow->highlight(anIO, 1);
}
}
}
-//=====================================================================================
-// function : RecreateActor()
-// purpose :
-//=====================================================================================
-void VisuGUI::RecreateActor(VISU::Prs3d_i* thePrs) {
- QApplication::setOverrideCursor(Qt::waitCursor);
- thePrs->Update();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame))
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame))
- thePrs->UpdateActor(anActor);
+
+void
+VisuGUI::
+OnEditVectors()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+ EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg,1>(this, aPrs3d);
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ aViewWindow->highlight(anIO, 1);
}
- QApplication::restoreOverrideCursor();
+ }
}
-//=====================================================================================
-// function : EditPrs()
-// purpose :
-//=====================================================================================
-#define EDITPRS(PrsName, DlgName) \
- { \
- PrsName* aPrsObject = dynamic_cast<PrsName*>(aPrs3d); \
- if (aPrsObject) { \
- DlgName* aDlg = new DlgName(); \
- aDlg->initFromPrsObject(aPrsObject); \
- if ( aDlg->exec() ) { \
- aDlg->storeToPrsObject(aPrsObject); \
- RecreateActor(aPrsObject); \
- /*RepaintCurrentView();*/ \
- VTKViewer_ViewFrame* vf = GetVtkViewFrame(); \
- if (vf) { \
- if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) { \
- vf->getRenderer()->ResetCameraClippingRange(); \
- vf->onViewFitAll(); \
- vf->Repaint(); \
- }\
- } \
- } \
- delete aDlg; \
- } \
+void
+VisuGUI::
+OnEditStreamLines()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+ EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg,1>(this, aPrs3d);
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ aViewWindow->highlight(anIO, 1);
}
+ }
+}
-void VisuGUI::EditPrs() {
- VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d();
+void
+VisuGUI::
+OnEditPlot3D()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+ EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg,0>(this, aPrs3d);
+ if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+ aViewWindow->highlight(anIO, 1);
+ }
+ }
+}
- switch (aPrs3d->GetType()) {
- case VISU::TMESH: // Mesh 13
- break;
- case VISU::TSCALARMAP: // ScalarMap 18
- EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
- break;
+void
+VisuGUI::
+OnEraseAll()
+{
+ if (SVTK_ViewWindow* vw = GetViewWindow()) {
+ vw->unHighlightAll();
+ if (vtkRenderer *aRen = vw->getRenderer()) {
+ vtkActor *anActor;
+ vtkActorCollection *anActColl = aRen->GetActors();
+ for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
+ if (anActor->GetVisibility() > 0)
+ if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
+ anVISUActor = anVISUActor->GetParent();
+ anVISUActor->VisibilityOff();
+ }
+ }
+ vw->Repaint();
+ }
+ } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
+ aPlot2d->EraseAll();
+ }
+}
- case VISU::TDEFORMEDSHAPE: // Deformed Shape 28
- EDITPRS(VISU::DeformedShape_i, VisuGUI_MagnitudeDlg);
- break;
+void
+VisuGUI::
+OnMakeSurfaceframe()
+{
+ ChangeRepresentation(this, VISU::SURFACEFRAME);
+}
- case VISU::TCUTPLANES: // Cut planes 42
- EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
- break;
+void
+VisuGUI::
+OnMakeInsideframe()
+{
+ ChangeRepresentation(this, VISU::INSIDEFRAME);
+}
- case VISU::TCUTLINES: // Cut planes 42
- EDITPRS(VISU::CutLines_i, VisuGUI_CutLinesDlg);
- break;
+void
+VisuGUI::
+OnMakeWireframe()
+{
+ ChangeRepresentation(this, VISU::WIREFRAME);
+}
- case VISU::TISOSURFACE: // Iso surfaces
- EDITPRS(VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg);
- break;
- case VISU::TVECTORS: // Vectors 64
- EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg);
- break;
+void
+VisuGUI::
+OnMakeSurface()
+{
+ ChangeRepresentation(this, VISU::SHADED);
+}
- case VISU::TSTREAMLINES:
- EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
- }
+void
+VisuGUI::
+OnMakePoints()
+{
+ ChangeRepresentation(this, VISU::POINT);
}
+void
+VisuGUI::
+OnMakeShrink()
+{
+ ChangeRepresentation(this, VISU::SHRINK);
+}
-//=====================================================================================
-// function : EditScalarBar()
-// purpose :
-//=====================================================================================
-void VisuGUI::EditScalarBar() {
- VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d();
- VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
- if (aPrsObject) {
- VisuGUI_ScalarBarDlg* aDlg = new VisuGUI_ScalarBarDlg(false);
- aDlg->initFromPrsObject(aPrsObject);
- if ( aDlg->exec() ) {
- aDlg->storeToPrsObject(aPrsObject);
- RecreateActor(aPrsObject);
-
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf)
- vf->Repaint();
-
- if (aDlg->isToSave())
- aDlg->storeToResources();
- }
- delete aDlg;
- }
-
-}
-
-
-//=====================================================================================
-// function : CreateMesh()
-// purpose :
-//=====================================================================================
-void VisuGUI::CreateMesh() {
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOMEDS::SObject_var aSObject = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
-
- if (checkLock(GetStudyDocument())) return;
-
- SALOMEDS::SObject_var aSObj = aSObject->GetFather();
- aSObj = aSObj->GetFather();
- aSObj = aSObj->GetFather();
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) {
- aSObj = aSObj->GetFather();
- anObject = VISU::SObjectToObject(aSObj);
- }
- VISU::Result_var aResult;
- if (!CORBA::is_nil(anObject)) {
- aResult = VISU::Result::_narrow(anObject);
- }
- if(CORBA::is_nil(aResult)) {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
- return;
- }
+void
+VisuGUI::
+OnChangeColor()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
- VISU::Storable::TRestoringMap aMap;
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,aMap);
- }
- bool isExist;
- string aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist).latin1();
- if(!isExist) return;
- CORBA::Object_var aMesh;
- string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").latin1();
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- if(aComment == "ENTITY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
- aMesh = GetVisuGen()->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
- }else if(aComment == "FAMILY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
- string aFamilyName = VISU::Storable::FindValue(aMap,"myName").latin1();
- aMesh = GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- }else if(aComment == "GROUP"){
- string aGroupName = VISU::Storable::FindValue(aMap,"myName").latin1();
- aMesh = GetVisuGen()->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
- }
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
- timer.Show();
-#endif
+ VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (!aPrs3d) return;
- QApplication::restoreOverrideCursor();
- VISU::Mesh_i* pPresent = NULL;
- if(!CORBA::is_nil(aMesh))
- pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
- if (pPresent == NULL) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
- return;
- }
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
- VISU_Actor *anActor = pPresent->CreateActor();
- if (! anActor ) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_CREATE_ACTOR"),
- tr ("VISU_BUT_OK") );
- return;
- }
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- vf->AddActor(anActor);
- vf->getRenderer()->ResetCameraClippingRange();
- vf->onViewFitAll();
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
- timer.Show();
-#endif
- }
- //GetActiveStudy()->updateObjBrowser(); //not necessary
- GetDesktop()->putInfo("Ready");
-}
-
-//=====================================================================================
-// function : CreateManyMesh()
-// purpose :
-//=====================================================================================
-void VisuGUI::CreateManyMesh()
-{
- if (checkLock(GetStudyDocument())) return;
-
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- SALOMEDS::SObject_var aSObject = GetActiveStudy()->getStudyDocument()->FindObjectID( It.Value()->getEntry() );
-
- SALOMEDS::SObject_var aSObj = aSObject->GetFather();
- aSObj = aSObj->GetFather();
- aSObj = aSObj->GetFather();
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) {
- aSObj = aSObj->GetFather();
- anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) return;
- }
- VISU::Result_var aResult = VISU::Result::_narrow(anObject);
- if(CORBA::is_nil(aResult)) return;
+ VISU_Actor* anActor = GetActor(aPrs3d, vw);
+ if (!anActor) return;
- VISU::Storable::TRestoringMap aMap;
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,aMap);
- }
- bool isExist;
- string aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist).latin1();
- if(!isExist) return;
- CORBA::Object_var aMesh;
- string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").latin1();
- if(aComment == "ENTITY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
- aMesh = GetVisuGen()->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
- }else if(aComment == "FAMILY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
- string aFamilyName = VISU::Storable::FindValue(aMap,"myName").latin1();
- aMesh = GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- }else if(aComment == "GROUP"){
- string aGroupName = VISU::Storable::FindValue(aMap,"myName").latin1();
- aMesh = GetVisuGen()->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
- }
- QApplication::restoreOverrideCursor();
- if(CORBA::is_nil(aMesh)) return;
-
- VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
- VISU_Actor *anActor = pPresent->CreateActor();
- if (! anActor ) return;
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
- vf->AddActor(anActor);
- vf->getRenderer()->ResetCameraClippingRange();
- vf->onViewFitAll();
- }
+ VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
+ VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
+ SALOMEDS::Color anOldColor, aNewColor;
+ int aRepresent = anActor->GetRepresentation();
+ if (aMesh) {
+ switch (aRepresent) {
+ case VISU::POINT :
+ anOldColor = aMesh->GetNodeColor();
+ break;
+ case VISU::WIREFRAME :
+ case VISU::INSIDEFRAME :
+ anOldColor = aMesh->GetLinkColor();
+ break;
+ case VISU::SHADED :
+ case VISU::SURFACEFRAME :
+ anOldColor = aMesh->GetCellColor();
+ break;
+ }
+ } else if (aDeformedShape) {
+ anOldColor = aDeformedShape->GetColor();
+ } else {
+ return;
}
- GetDesktop()->putInfo("Ready");
-}
-//=====================================================================================
-// function : ChangeRepresentation()
-// purpose :
-//=====================================================================================
-
-static void ShrinkMesh(VISU_Actor *theActor){
- if(theActor->isShrunk())
- theActor->unShrink();
- else
- theActor->setShrink(0.8);
-}
-
-void VisuGUI::ChangeRepresentation(RepresentType theType) {
- if(VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d()){
- if(VISU_Actor* anActor = GetActor(aPrsObject)){
- switch (theType) {
- case POINTS:
- case WIREFRAME:
- case SURFACE:
- anActor->SetRepresentation(theType);
- break;
- case SHRINK:
- ShrinkMesh(anActor);
- break;
+ QColor aColor (int(255*anOldColor.R),
+ int(255*anOldColor.G),
+ int(255*anOldColor.B));
+ QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
+ if (aColorNew.isValid()) {
+ aNewColor.R = aColorNew.red()/255.;
+ aNewColor.G = aColorNew.green()/255.;
+ aNewColor.B = aColorNew.blue()/255.;
+ if (aMesh) {
+ switch (aRepresent) {
+ case VISU::POINT :
+ aMesh->SetNodeColor(aNewColor);
+ break;
+ case VISU::WIREFRAME :
+ case VISU::INSIDEFRAME :
+ aMesh->SetLinkColor(aNewColor);
+ break;
+ case VISU::SHADED :
+ case VISU::SURFACEFRAME :
+ aMesh->SetCellColor(aNewColor);
+ break;
}
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame())
- vf->Repaint();
+ } else {
+ aDeformedShape->SetColor(aNewColor);
}
+ RecreateActor(this, aPrs3d);
}
}
-void VisuGUI::MakeWireframe() {
- ChangeRepresentation(WIREFRAME);
-}
+void
+VisuGUI::
+OnChangeWireframeColor()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+ VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (!aPrs3d) return;
-void VisuGUI::MakeSurface() {
- ChangeRepresentation(SURFACE);
-}
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
+ VISU_Actor* anActor = GetActor(aPrs3d, vw);
+ if (!anActor) return;
-void VisuGUI::MakePoints() {
- ChangeRepresentation(POINTS);
+ if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+ SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
+ QColor aColor (int(255*anOldColor.R),
+ int(255*anOldColor.G),
+ int(255*anOldColor.B));
+ QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
+ if (aColorNew.isValid()) {
+ aNewColor.R = aColorNew.red()/255.;
+ aNewColor.G = aColorNew.green()/255.;
+ aNewColor.B = aColorNew.blue()/255.;
+ aMesh->SetLinkColor(aNewColor);
+ RecreateActor(this, aMesh);
+ }
+ }
}
+void
+VisuGUI::
+OnChangeOpacity()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
-void VisuGUI::MakeShrink() {
- ChangeRepresentation(SHRINK);
-}
-
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (!aPrsObject) return;
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
-//=====================================================================================
-// functions : Change Propertise
-// purpose :
-//=====================================================================================
-VISU::Prs3d_i* VisuGUI::GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO) {
- CORBA::Object_var anObject = GetSelectedObj(theIO);
- if(CORBA::is_nil(anObject)) return NULL;
- return dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
-}
+ VISU_Actor* anActor = GetActor(aPrsObject, vw);
+ if (!anActor) return;
-void VisuGUI::ChageColor() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
+ VisuGUI_CursorDlg* CursorDlg =
+ new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
- VISU_Actor* anActor = GetActor(aPrsObject);
- if (!anActor) return;
- NewColor(anActor);
-}
+ CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
+ CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
+ CursorDlg->SpinBox1->setMinValue(0);
+ CursorDlg->SpinBox1->setMaxValue(100);
-void VisuGUI::ChangeOutlineColor() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
+ float oldopac = anActor->GetOpacity();
+ int intopac = int(oldopac*100. + 0.5);
+ CursorDlg->SpinBox1->setValue(intopac);
- VISUMesh_Actor* anActor = dynamic_cast<VISUMesh_Actor*>(GetActor(aPrsObject));
- if (!anActor) return;
- NewOutlineColor(anActor);
+ int ret = CursorDlg->exec();
+ if (ret == 1) {
+ intopac = CursorDlg->SpinBox1->value();
+ float newopac = intopac/100.;
+ anActor->SetOpacity(newopac);
+ }
+ delete CursorDlg;
}
+void
+VisuGUI::
+OnChangeLines()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ if (!aPrsObject) return;
-void VisuGUI::ChangeOpacity() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
- VISU_Actor* anActor = GetActor(aPrsObject);
+ VISU_Actor* anActor = GetActor(aPrsObject, vw);
if (!anActor) return;
- NewOpacity(anActor);
-}
+ VisuGUI_CursorDlg* CursorDlg =
+ new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
-void VisuGUI::ChangeLines() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
+ CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
+ CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
+ CursorDlg->SpinBox1->setMinValue(1);
+ CursorDlg->SpinBox1->setMaxValue(10);
- VISU_Actor* anActor = GetActor(aPrsObject);
- if (!anActor) return;
- NewLinewidth(anActor);
-}
-void VisuGUI::PlotTable( VISU::Table_i* table, int theDisplaying )
-{
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- if ( table && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- if ( theDisplaying == VISU::eDisplayOnly )
- aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- SALOMEDS::SObject_var TableSO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetEntry() );
- if ( !TableSO->_is_nil() ) {
- SALOMEDS::ChildIterator_var Iter = GetActiveStudy()->getStudyDocument()->NewChildIterator( TableSO );
- for ( ; Iter->More(); Iter->Next() ) {
- CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() );
- if( !CORBA::is_nil( childObject ) ) {
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
- if( !CORBA::is_nil( aCurve ) ) {
- VISU::Curve_i* theCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) );
- Plot2d_Curve* plotCurve = 0;
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- plotCurve = clist.at( i );
- break;
- }
- }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve ) {
- aPlot->eraseCurve( plotCurve, false );
- clist.remove( plotCurve );
- }
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( strdup( theCurve->GetHorTitle().c_str() ) );
- //plotCurve->setVerTitle( strdup( theCurve->GetVerTitle().c_str() ) );
- plotCurve->setVerTitle( strdup( theCurve->GetName() ) );
- plotCurve->setHorUnits( strdup( theCurve->GetHorUnits().c_str() ) );
- plotCurve->setVerUnits( strdup( theCurve->GetVerUnits().c_str() ) );
- /* - DATA NOT UPDATED */
- if ( !plotCurve->isAutoAssign() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- }
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- }
- }
- }
- }
- }
- }
- aPlot->Repaint();
- }
- }
-}
-void VisuGUI::PlotCurve( VISU::Curve_i* theCurve, int theDisplaying )
-{
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- if ( theCurve && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
-// if ( theDisplaying == VISU::eDisplayOnly )
-// aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- Plot2d_Curve* plotCurve = 0;
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- plotCurve = clist.at( i );
- }
- else if ( theDisplaying == VISU::eDisplayOnly ) {
- aPlot->eraseCurve( clist.at( i ) );
- }
- }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve )
- aPlot->eraseCurve( plotCurve, false );
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( strdup( theCurve->GetHorTitle().c_str() ) );
- //plotCurve->setVerTitle( strdup( theCurve->GetVerTitle().c_str() ) );
- plotCurve->setVerTitle( strdup( theCurve->GetName() ) );
- plotCurve->setHorUnits( strdup( theCurve->GetHorUnits().c_str() ) );
- plotCurve->setVerUnits( strdup( theCurve->GetVerUnits().c_str() ) );
- /* DATA NOT UPDATED */
- if ( !plotCurve->isAutoAssign() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- }
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- }
- }
- }
- aPlot->Repaint();
- }
-}
-void VisuGUI::PlotContainer( VISU::Container_i* container, int theDisplaying )
-{
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- if ( container && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- if ( theDisplaying == VISU::eDisplayOnly )
- aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- if ( container->GetNbCurves() > 0 ) {
- int nbCurves = container->GetNbCurves();
- for ( int k = 1; k <= nbCurves; k++ ) {
- VISU::Curve_i* theCurve = container->GetCurve( k );
- if ( theCurve && theCurve->IsValid() ) {
- Plot2d_Curve* plotCurve = aPlot->getCurveByIO( new SALOME_InteractiveObject( strdup(theCurve->GetEntry()), "", "" ) );
-// for ( int i = 0; i < clist.count(); i++ ) {
-// if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
-// plotCurve = clist.at( i );
-// break;
-// }
-// }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve ) {
- aPlot->eraseCurve( plotCurve, false );
- clist.remove( plotCurve );
- }
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( strdup( theCurve->GetHorTitle().c_str() ) );
- //plotCurve->setVerTitle( strdup( theCurve->GetVerTitle().c_str() ) );
- plotCurve->setVerTitle( strdup( theCurve->GetName() ) );
- plotCurve->setHorUnits( strdup( theCurve->GetHorUnits().c_str() ) );
- plotCurve->setVerUnits( strdup( theCurve->GetVerUnits().c_str() ) );
- /* - DATA NOT UPDATED */
- if ( !plotCurve->isAutoAssign() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- }
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- }
- }
- }
- }
- }
- }
- aPlot->Repaint();
+ float oldlwid = anActor->GetLineWidth();
+ int intlwid = int(oldlwid);
+ CursorDlg->SpinBox1->setValue(intlwid);
+
+ int ret = CursorDlg->exec();
+ if (ret == 1) {
+ intlwid = CursorDlg->SpinBox1->value();
+ float newlwid = intlwid;
+ anActor->SetLineWidth(newlwid);
}
+ delete CursorDlg;
}
-/*!
- Slot : opens Table view : for Table object or SObject with table attribute selected
-*/
-void VisuGUI::ShowTable() {
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
- return;
+void
+VisuGUI::
+OnShowTable()
+{
Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- SALOMEDS::SObject_var SO;
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
+ _PTR(SObject) SO;
if ( !CORBA::is_nil( anObject ) ) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
if( !CORBA::is_nil( aTable ) ) {
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
- if ( table ) {
- SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
- }
+ VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
+ if ( table ) {
+ SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
+ }
}
- }
+ }
} else {
// possibly this is Table SObject
- SO = GetActiveStudy()->getStudyDocument()->FindObjectID( anIO->getEntry() );
+ SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
}
- SALOMEDS::GenericAttribute_var anAttr;
- if ( SO->_is_nil() || ( !SO->FindAttribute( anAttr, "AttributeTableOfInteger" )
- && !SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) )
+
+ if( !IsSObjectTable( SO ) )
return;
- SALOMEGUI_TableDlg* dlg = new SALOMEGUI_TableDlg( QAD_Application::getDesktop(),
- SO,
- false,
- //SAL2670 Orientation of show tables
- SALOMEGUI_TableDlg::ttAuto,
- Qt::Vertical );
+
+ VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
+ SO,
+ false,
+ //SAL2670 Orientation of show tables
+ VisuGUI_TableDlg::ttAuto,
+ Qt::Vertical );
dlg->show();
}
-/*!
- Slot : opens Table view : for Table object or SObject with table attribute selected
-*/
-void VisuGUI::CreateTable() {
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( aSel->IObjectCount() !=1 )
+void
+VisuGUI::
+OnCreateTable()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
+ _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
+ _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
+ VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
+ if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
+ GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
+ UpdateObjBrowser(this);
+ }
+}
+
+void
+VisuGUI::
+OnDeleteObjects()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
return;
- Handle(SALOME_InteractiveObject) anIO = aSel->firstIObject();
- if (anIO->hasEntry()){
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()) {
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
- VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
- SALOMEDS::GenericAttribute_var anAttr;
- if(!aCutLines->_is_nil() ||
- aSObject->FindAttribute( anAttr, "AttributeTableOfInteger") ||
- aSObject->FindAttribute( anAttr, "AttributeTableOfReal" ) ){
- GetVisuGen()->CreateTable(aSObject->GetID());
- GetActiveStudy()->updateObjBrowser();
- }
+ SALOME_ListIO aList;
+ SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
+ mgr->selectedObjects(aList);
+ int i = 0, nbSelected = aList.Extent();
+ if (nbSelected < 1) return;
+
+ const char* entries [nbSelected];
+ Handle(SALOME_InteractiveObject) anIO;
+ for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
+ anIO = it.Value();
+ if (anIO->hasEntry())
+ entries[i++] = anIO->getEntry();
+ }
+ nbSelected = i;
+ if (nbSelected < 1) return;
+
+ // There is a transaction
+ _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
+ aStudyBuilder->NewCommand();
+
+ for (i = 0; i < nbSelected; i++) {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
+ if (aSObject) {
+ DeleteSObject(this, aCStudy, aSObject);
}
}
+
+ // Finish transaction
+ aStudyBuilder->CommitCommand();
+
+ //GetActiveStudy()->unHighlightAll();
+ UpdateObjBrowser(this, true);
}
-/*!
- Opens dialog box for curves creation. Acts only for selected SObject with table attribute.
-*/
-void VisuGUI::PlotData() {
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
- return;
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
+void
+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 ) );
- if ( table ) {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- QString SOName;
- SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
- if ( !SO->_is_nil() && ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
- SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) ) {
- // get name of SObject
- if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- SOName = strdup( aName->Value() );
- }
- Plot2d_SetupPlot2dDlg* dlg = new Plot2d_SetupPlot2dDlg( SO, QAD_Application::getDesktop() );
- if ( dlg->exec() == QDialog::Accepted ) {
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- // 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()->CreateContainer();
- if( !CORBA::is_nil( aContainer ) ) {
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ) );
- if ( pContainer ) {
- for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->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 ) );
- 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() );
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- PlotContainer( pContainer, VISU::eDisplay );
- }
- }
- }
- }
- else {
- // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
- Plot2d_CurveContainer container;
- dlg->getCurves( container );
- if ( !container.isEmpty() ) {
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->displayCurves( container, true );
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->setTitle( SOName );
- }
- }
- }
- delete dlg;
- }
- }
+ 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 = QString( aName->Value().c_str() );
+ }
+ 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(this);
+ 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 {
- // possibly this is Table SObject
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- QString SOName;
-
+ else if ( !anIO.IsNull() ) {
// check if Table SObject is selected
- SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( !SO->_is_nil() && ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
- SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) ) {
+ SO = aStudy->FindObjectID( anIO->getEntry() );
+ if ( IsSObjectTable(SO) ) {
// get name of SObject
if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- SOName = strdup( aName->Value() );
+ aName = anAttr;
+ SOName = QString( aName->Value().c_str() );
}
- Plot2d_SetupPlot2dDlg* dlg = new Plot2d_SetupPlot2dDlg( SO, QAD_Application::getDesktop() );
+ SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
if ( dlg->exec() == QDialog::Accepted ) {
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- // 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()->CreateTable( SO->GetID() );
- CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
- if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
- VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ) );
-
- if ( pContainer && pTable ) {
- for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->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 ) );
- 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() );
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- PlotContainer( pContainer, VISU::eDisplay );
- }
- }
- }
- }
- else {
- // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_CurveContainer container;
- dlg->getCurves( container );
- if ( !container.isEmpty() ) {
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->displayCurves( container, true );
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->setTitle( SOName );
- }
- }
- }
+ 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(this);
+ 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;
}
}
}
-/*!
- Slot : Opens "Setup curve" dialog to set curve properties : for Curve object selected
-*/
-void VisuGUI::CurveProperties() {
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
- return;
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
+
+void
+VisuGUI::
+OnCurveProperties()
+{
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ if (aListIO.Extent() != 1) return;
+
+ SalomeApp_Study* aAppStudy = GetAppStudy(this);
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
if (CORBA::is_nil( anObject )) return;
VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
// Curve object
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
if( !CORBA::is_nil( aCurve ) ) {
- VISU::Curve_i* curve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) );
- if ( curve && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- SALOMEGUI_SetupCurveDlg* dlg = new SALOMEGUI_SetupCurveDlg( QAD_Application::getDesktop() );
- dlg->setLine( (int)curve->GetLine(), curve->GetLineWidth() );
- dlg->setMarker( (int)curve->GetMarker() );
- SALOMEDS::Color color = curve->GetColor();
- dlg->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- if( dlg->exec() == QDialog::Accepted ) {
- curve->SetLine( (VISU::Curve::LineType)dlg->getLine(), dlg->getLineWidth() );
- curve->SetMarker( (VISU::Curve::MarkerType)dlg->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = dlg->getColor().red()/255.;
- newColor.G = dlg->getColor().green()/255.;
- newColor.B = dlg->getColor().blue()/255.;
- curve->SetColor( newColor );
- QList<QAD_StudyFrame> sfList = GetActiveStudy()->getStudyFrames();
- if ( sfList.count() > 0 ) {
- QListIterator<QAD_StudyFrame> it( sfList );
- for ( ; it.current(); ++it ) {
- if ( it.current()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)it.current()->getRightFrame()->getViewFrame();
- Handle(SALOME_InteractiveObject) IO = aPlot->FindIObject( curve->GetEntry() );
- if ( IO.IsNull() )
- continue;
- Plot2d_Curve* plotCurve = aPlot->getCurveByIO( IO );
- if ( plotCurve ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)dlg->getLine(), dlg->getLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)dlg->getMarker() );
- plotCurve->setColor( dlg->getColor() );
- aPlot->updateCurve( plotCurve, true );
- }
- }
- }
- }
- }
- }
+ VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
+ if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
+ Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
+
+ aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
+ aDlg.setMarker( (int)aDSCurve->GetMarker() );
+ SALOMEDS::Color aColor = aDSCurve->GetColor();
+ aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
+ if( aDlg.exec() == QDialog::Accepted ) {
+ aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
+ aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
+ SALOMEDS::Color newColor;
+ newColor.R = aDlg.getColor().red()/255.;
+ newColor.G = aDlg.getColor().green()/255.;
+ newColor.B = aDlg.getColor().blue()/255.;
+ aDSCurve->SetColor( newColor );
+ PlotCurve(this, aDSCurve, VISU::eDisplay);
+ }
+ }
}
}
}
-
-/*!
- Slot : Clears container contents : for Container object selected
-*/
-void VisuGUI::ClearContainer() {
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
+void
+VisuGUI::
+OnClearContainer()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (anIO.IsNull() || CORBA::is_nil(anObject))
return;
-
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
- if (CORBA::is_nil( anObject )) return;
VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
// Container object
- CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
- if( !CORBA::is_nil( aCnt ) ) {
- VISU::Container_i* container = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aCnt ) );
- if ( container && container->GetNbCurves() > 0 && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- container->Clear();
- GetActiveStudy()->updateObjBrowser();
+ CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
+ if (!CORBA::is_nil(aCnt)) {
+ VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
+ if (container && container->GetNbCurves() > 0) {
+ container->Clear();
+ UpdateObjBrowser(this);
}
}
}
}
+void
+VisuGUI::
+OnEditContainer()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
-void VisuGUI::DeletePrs() {
- DeletePresentation(GetSelectedPrs3d());
-}
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
+ if (!aContainer) return;
+ VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
+ aDlg->initFromPrsObject(aContainer);
+ if (aDlg->exec()) {
+ aDlg->storeToPrsObject(aContainer);
+ UpdateObjBrowser(this, true);
+ }
+ delete aDlg;
+}
-void VisuGUI::SaveViewParams()
+void
+VisuGUI::
+OnSaveViewParams()
{
- if (checkLock(GetStudyDocument())) return;
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() > 1 || GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
return;
- VISU::ViewManager_var aVM = GetVisuGen()->GetViewManager();
- if(!CORBA::is_nil(aVM.in())){
- VISU::View_var aView = aVM->GetCurrentView();
- if(!CORBA::is_nil(aView.in())){
- VISU::View3D_var aView3D = VISU::View3D::_narrow(aView);
- if(CORBA::is_nil(aView3D.in())) return;
- if ( Sel->IObjectCount() == 0 ) {
- // Save view parameters by new name
- aView3D->SaveViewParams( 0 );
- GetActiveStudy()->updateObjBrowser( true );
- }else{
- bool isExist;
- VISU::Storable::TRestoringMap aMap;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if(isExist && aType == VISU::TVIEW3D){
- aView3D->SaveViewParams( anIO->getName() );
- GetActiveStudy()->updateObjBrowser( true );
- }
- }
- }
+
+ SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
+ if (aViewMgr->getType() != SVTK_Viewer::Type())
+ return;
+
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ if (aListIO.Extent() > 1)
+ return;
+
+ if (aListIO.Extent() == 0) {
+ VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
+ } else {
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
}
+ UpdateObjBrowser(this);
}
+void
+VisuGUI::
+OnRestoreViewParams()
+{
+ SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
+ if (aViewMgr->getType() != SVTK_Viewer::Type())
+ return;
+
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ if (aListIO.Extent() != 1)
+ return;
+
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
+ VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
+}
+
+void
+VisuGUI::
+OnRename()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObj) return;
+
+ //TEST DU PARENT == VISU
+ _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
+ _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObj, "AttributeName");
+ if (anAttr) {
+ _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 (!CORBA::is_nil(anObject)) {
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ if (!CORBA::is_nil(aVisuObj)) {
+ switch (aVisuObj->GetType()) {
+ case VISU::TCURVE: // Curve object
+ {
+ CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
+ if (!CORBA::is_nil(aCurve)) {
+ VISU::Curve_i* curve =
+ dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
+ if (curve)
+ curve->SetName(Name.latin1());
+ }
+ break;
+ }
+ case VISU::TTABLE: // Table object
+ {
+ CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
+ if (!CORBA::is_nil(aTable)) {
+ VISU::Table_i* table =
+ dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
+ if (table)
+ table->SetName(Name.latin1());
+ }
+ break;
+ }
+ case VISU::TCONTAINER: // Container object
+ {
+ CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
+ if (!CORBA::is_nil(aContainer)) {
+ VISU::Container_i* container =
+ dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+ if (container)
+ container->SetName(Name.latin1());
+ }
+ break;
+ }
+ default:
+ {
+ }
+ }
+ }
+ }
+
+ // rename the study object
+ aName->SetValue(Name.latin1()); // rename the SObject
+ anIO->setName(Name.latin1()); // rename the InteractiveObject
+ UpdateObjBrowser(this, false);
-void VisuGUI::RestoreViewParams()
-{
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() > 1 || GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
- return;
- VISU::ViewManager_var aVM = GetVisuGen()->GetViewManager();
- if(!CORBA::is_nil(aVM.in())){
- VISU::View_var aView = aVM->GetCurrentView();
- if(!CORBA::is_nil(aView.in())){
- VISU::View3D_var aView3D = VISU::View3D::_narrow(aView);
- if(CORBA::is_nil(aView3D.in())) return;
- bool isExist;
- VISU::Storable::TRestoringMap aMap;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if(isExist && aType == VISU::TVIEW3D)
- aView3D->RestoreViewParams( anIO->getName() );
+ QApplication::restoreOverrideCursor();
}
}
}
-//=====================================================================================
-// function : DeleteViewParams()
-// purpose :
-//=====================================================================================
-void VisuGUI::DeleteViewParams() {
- bool isExist;
- VISU::Storable::TRestoringMap aMap;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if(isExist && aType == VISU::TVIEW3D){
- SALOMEDS::Study_var aStudy = GetStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- aStudy->NewBuilder()->RemoveObject(aSObject);
-
- SALOME_Selection* aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- aSel->RemoveIObject(anIO, 0);
-
- GetActiveStudy()->updateObjBrowser( true );
- }
+void
+VisuGUI::
+OnClippingPlanes()
+{
+ new VisuGUI_ClippingDlg (this, "", false);
}
+void
+VisuGUI::
+OnSweep()
+{
+ // GetSelectedPrs3d
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
-//=====================================================================================
-// function : Sweep()
-// purpose :
-//=====================================================================================
-void VisuGUI::Sweep() {
- VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(GetSelectedPrs3d());
+ VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
if (!aPrsObject) return;
- VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame();
- if(!vf) return;
-
- int aTemp=100000;
- QString aTempoStr = QAD_CONFIG->getSetting("Visu:SweepTempo");
- if ( !aTempoStr.isEmpty() )
- aTemp = int(1.E6*(aTempoStr.toFloat()));
-
- int aCycles=1;
- QString aCyclesStr = QAD_CONFIG->getSetting("Visu:SweepCycles");
- if ( !aCyclesStr.isEmpty() )
- aCycles = aCyclesStr.toInt();
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (!vw) return;
- int aSteps=40;
- QString aStepsStr = QAD_CONFIG->getSetting("Visu:SweepSteps");
- if ( !aStepsStr.isEmpty() )
- aSteps = aStepsStr.toInt();
-
- VISU_Actor* aActor = GetActor(aPrsObject);
+ VISU_Actor* aActor = GetActor(aPrsObject, vw);
if (!aActor) return;
-
+
if (!aActor->GetVisibility()) {
aActor->VisibilityOn();
}
- QApplication::setOverrideCursor( Qt::waitCursor );
- for (int j=0 ; j<aCycles; j++) {
- for (int i=0 ; i<=aSteps; i++) {
- float aPercents = float(i)/aSteps;
- aPrsObject->SetMapScale(aPercents);
- aPrsObject->UpdateActor(aActor);
- vf->getRW()->getRenderWindow()->Render();
- usleep(aTemp);
+ // Get sweep parameters
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+
+ double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1);
+ int aTemp = int(1.E6 * aTempoDbl);
+
+ int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1);
+ int aSteps = aResourceMgr->integerValue("VISU", "sweeping_time_step", 40);
+
+ // Sweep
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ try {
+ for (int j = 0; j < aCycles; j++) {
+ for (int i = 0; i <= aSteps; i++) {
+ float aPercents = float(i)/aSteps;
+ aPrsObject->SetMapScale(aPercents);
+ aPrsObject->UpdateActor(aActor);
+ vw->getRenderWindow()->getRenderWindow()->Render();
+ usleep(aTemp);
+ }
}
+ } catch (std::exception& exc) {
+ INFOS("Follow exception was occured :\n" << exc.what());
+ } catch (...) {
+ INFOS("Unknown exception was occured!");
}
QApplication::restoreOverrideCursor();
}
+void
+VisuGUI::
+OnTimeAnimation()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ VisuGUI_TimeAnimationDlg* aAnimationDlg =
+// new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
+ new VisuGUI_TimeAnimationDlg (this, aCStudy);
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
-void VisuGUI::TimeAnimation() {
- VisuGUI_TimeAnimationDlg* aAnimationDlg = new VisuGUI_TimeAnimationDlg(GetStudyDocument());
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
-
bool isDefined = false;
long aNbTimes = 0;
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+ SALOME_ListIteratorOfListIO It (aListIO);
for (; It.More(); It.Next()) {
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID( It.Value()->getEntry() );
- if (aSObject->_is_nil()) continue;
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
+ if (!aSObject) continue;
if (getValue(aSObject, "myComment") == QString("FIELD")) {
long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
if (aNumber > 1) {
- if (!isDefined) {
- aNbTimes = aNumber;
- aAnimationDlg->addField(aSObject);
- isDefined = true;
- } else if (aNbTimes == aNumber) {
- aAnimationDlg->addField(aSObject);
- }
+ if (!isDefined) {
+ aNbTimes = aNumber;
+ aAnimationDlg->addField(aSObject);
+ isDefined = true;
+ } else if (aNbTimes == aNumber) {
+ aAnimationDlg->addField(aSObject);
+ }
}
}
}
else delete aAnimationDlg;
}
+//************************************************************************
+void
+VisuGUI::
+OnShowAnimation()
+{
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
-void VisuGUI::ImportMedField() {
- if (checkLock(GetStudyDocument())) return;
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- QApplication::setOverrideCursor( Qt::waitCursor );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) anIO = It.Value();
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- 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()->ImportMed( aSObject );
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow( anObject );
- if(!CORBA::is_nil(aField.in()))
- GetVisuGen()->ImportMedField( aField );
- }else{
- SALOMEDS::SObject_var aSFather = aSObject->GetFather();
- SALOMEDS::GenericAttribute_var anAttr;
- aSFather->FindAttribute(anAttr, "AttributeName");
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- CORBA::String_var aValue = aName->Value();
- if(strcmp(aValue.in(),"MEDFIELD") == 0)
- GetVisuGen()->ImportMed(aSObject);
- //if(strcmp(aValue.in(),"MEDMESH") == 0)
- // VisuGUI::myComponent->ImportMed(aSObject);
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- QApplication::restoreOverrideCursor();
-}
-/*
-void VisuGUI::ImportMedMesh() {
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() != 1 )
- return;
- string aComment;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj( aComment,anIO, GetActiveStudy());
- if ( !CORBA::is_nil( anObject ) ) {
- SALOME_MED::MESH_ptr aMesh = SALOME_MED::MESH::_narrow( anObject );
- if( !CORBA::is_nil( aMesh ) ) {
- GetVisuGen->ImportMedMesh( aMesh );
- GetActiveStudy()->updateObjBrowser( true );
- }
- SALOME_MED::SUPPORT_ptr aSupport = SALOME_MED::SUPPORT::_narrow( anObject );
- if( !CORBA::is_nil( aSupport ) ) {
- GetVisuGen->ImportMedSupport( aSupport );
- GetActiveStudy()->updateObjBrowser( true );
- }
- }
-}
-*/
-//=====================================================================================
-// functions : Rename()
-// purpose :
-//=====================================================================================
-void VisuGUI::Rename() {
- if (checkLock(GetStudyDocument())) return;
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() != 1 )
+ if (aListIO.Extent() != 1)
return;
- SALOMEDS::SObject_var aSObj = GetStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if( aSObj->_is_nil() ) return;
-
- VISU::Curve_i* curve = 0;
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject )) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
- // Curve object
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
- if( !CORBA::is_nil( aCurve ) ) {
- curve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) );
- }
- }
- }
- //TEST DU PARENT == VISU
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if ( aSObj->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aName->Value() );
- if ( !Name.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- if ( curve )
- curve->SetName( Name.latin1() );
- GetActiveStudy()->renameIObject( Sel->firstIObject(), Name );
- QApplication::restoreOverrideCursor();
-
- //int TypeMode; bool InViewer;
- //VISU_Actor *ActorTmp = ActorSelected(parent,InViewer,&TypeMode);
- //ActorTmp->setName((Standard_CString)Name.latin1());
- }
- }
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObj) return;
+
+ VISU::Storable::TRestoringMap aMap;
+ _PTR(GenericAttribute) anAttr;
+ if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
+
+ _PTR(AttributeComment) aComment (anAttr);
+ string aComm = aComment->Value();
+ QString strIn (aComm.c_str());
+ VISU::Storable::StrToMap(strIn, aMap);
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+ if (aType != VISU::TANIMATION) return;
+
+ VisuGUI_TimeAnimationDlg* aAnimationDlg =
+ new VisuGUI_TimeAnimationDlg(this, aCStudy);
+ aAnimationDlg->restoreFromStudy(aSObj);
+ aAnimationDlg->show();
}
+void
+VisuGUI::
+OnCopyPresentation()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+ if (CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if (!aServant.in()) return;
-//=====================================================================================
-// function : CopyPresentation()
-// purpose :
-//=====================================================================================
-void VisuGUI::CopyPresentation(){
- if (checkLock(GetStudyDocument())) return;
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrsObject) return;
+
switch (aPrsObject->GetType()) {
case VISU::TMESH:
{
VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
aSameMesh->SameAs(aMeshPrs);
- UpdateViewer(aSameMesh);
- }
+ UpdateViewer(this, aSameMesh);
+ }
break;
- case VISU::TSCALARMAP:
+ case VISU::TSCALARMAP:
{
VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
- VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult());
+ VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
aSameScalar->SameAs(aScalarPrs);
- UpdateViewer(aSameScalar);
- }
+ UpdateViewer(this, aSameScalar);
+ }
break;
- case VISU::TDEFORMEDSHAPE:
+ case VISU::TDEFORMEDSHAPE:
{
VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
- VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult());
+ VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
aSameDeformed->SameAs(aDefPrs);
- UpdateViewer(aSameDeformed);
- }
+ UpdateViewer(this, aSameDeformed);
+ }
break;
- case VISU::TCUTPLANES:
+ case VISU::TCUTPLANES:
{
VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
- VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult());
+ VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
aSameCut->SameAs(aCutPrs);
- UpdateViewer(aSameCut);
- }
+ UpdateViewer(this, aSameCut);
+ }
break;
- case VISU::TCUTLINES:
+ case VISU::TCUTLINES:
{
VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
- VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult());
+ VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
aSameCut->SameAs(aCutPrs);
- UpdateViewer(aSameCut);
- }
+ UpdateViewer(this, aSameCut);
+ }
break;
case VISU::TISOSURFACE:
{
VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
- VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult());
+ VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
aSameIso->SameAs(aIsoPrs);
- UpdateViewer(aSameIso);
- }
+ UpdateViewer(this, aSameIso);
+ }
break;
- case VISU::TSTREAMLINES:
+ case VISU::TSTREAMLINES:
{
VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
- VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult());
+ VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
aSameLines->SameAs(aLinesPrs);
- UpdateViewer(aSameLines);
- }
+ UpdateViewer(this, aSameLines);
+ }
break;
- case VISU::TVECTORS:
+ case VISU::TVECTORS:
{
VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
- VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult());
+ VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
aSameVectors->SameAs(aVectorsPrs);
- UpdateViewer(aSameVectors);
- }
- break;
- }
- GetActiveStudy()->updateObjBrowser();
-}
-
-//=====================================================================================
-// function : InfoOnPoint() [ slot ]
-// purpose :
-//=====================================================================================
-void VisuGUI::InfoOnPoint(){
- SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- int aTypeMode = aSel->SelectionMode();
- if ( aTypeMode == SelectionPoint ){
- if(VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d()){
- vtkDataSet* aDataSet = aPrs3d->GetMapper()->GetInput();
- VisuGUI_Selection::PickingPoint( GetActiveStudy(), aDataSet);
+ UpdateViewer(this, aSameVectors);
}
- }else
- QAD_MessageBox::warn1( GetDesktop(),
- tr ("WARNING"),
- tr ("ERR_WRONG_SELECTION_MODE"),
- tr ("VISU_BUT_OK") );
-}
-
-//=====================================================================================
-// function : InfoOnCell() [ slot ]
-// purpose :
-//=====================================================================================
-void VisuGUI::InfoOnCell(){
- SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- int aTypeMode = aSel->SelectionMode();
- if( aTypeMode == SelectionCell){
- if(VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d()){
- vtkDataSet* aDataSet = aPrs3d->GetMapper()->GetInput();
- VisuGUI_Selection::PickingCell( GetActiveStudy(), aDataSet);
+ break;
+ case VISU::TPLOT3D:
+ {
+ VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
+ VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
+ aSamePlot3D->SameAs(aPlot3DPrs);
+ UpdateViewer(this, aSamePlot3D);
}
- }else
- QAD_MessageBox::warn1( GetDesktop(),
- tr ("WARNING"),
- tr ("ERR_WRONG_SELECTION_MODE"),
- tr ("VISU_BUT_OK") );
-}
-
-//=====================================================================================
-// function : SelectPoint() [ slot ]
-// purpose :
-//=====================================================================================
-void VisuGUI::SelectPoint(){
- SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- if ( aSel->SelectionMode() != SelectionPoint ) {
- QAD_MessageBox::warn1( GetDesktop(),
- tr ("WARNING"),
- tr ("ERR_WRONG_SELECTION_MODE"),
- tr ("VISU_BUT_OK") );
- return;
- }
- Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d(&anIO)){
- bool ok = FALSE;
- int anId = SALOMEGUI_SetValueDlg::getInteger( tr("Point selection"),
- tr("Point number:" ),
- 0,
- &ok,
- GetDesktop());
- vtkDataSet *aDataSet = aPrs3d->GetMapper()->GetInput();
- int aMaxId = aDataSet->GetNumberOfPoints();
- if (ok && 0 < anId && anId <= aMaxId )
- VisuGUI_Selection::Highlight( GetActiveStudy(), anIO, anId );
+ break;
}
+ UpdateObjBrowser(this);
}
-//=====================================================================================
-// function : SelectCell() [ slot ]
-// purpose :
-//=====================================================================================
-void VisuGUI::SelectCell(){
- SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- if ( aSel->SelectionMode() != SelectionCell) {
- QAD_MessageBox::warn1( GetDesktop(),
- tr ("WARNING"),
- tr ("ERR_WRONG_SELECTION_MODE"),
- tr ("VISU_BUT_OK") );
- return;
- }
- Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d(&anIO)){
- bool ok = FALSE;
- int anId = SALOMEGUI_SetValueDlg::getInteger( tr("Cell selection"),
- tr("Cell number:" ),
- 0,
- &ok,
- GetDesktop());
- vtkDataSet *aDataSet = aPrs3d->GetMapper()->GetInput();
- int aMaxId = aDataSet->GetNumberOfCells();
- if (ok && 0 < anId && anId <= aMaxId )
- VisuGUI_Selection::Highlight( GetActiveStudy(), anIO, anId );
- }
+void
+VisuGUI::
+OnSelectionInfo()
+{
+ if (GetViewWindow())
+ (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
+ else
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ACTIVATE_VIEW3D"),
+ tr("BUT_OK") );
}
-//=====================================================================================
-// function : DefinePopup()
-// purpose :
-//=====================================================================================
-void VisuGUI::DefinePopup( QString & theContext, QString & theParent, QString & theObject )
+void
+VisuGUI::
+OnScaling()
{
- VisuGUI::GetOrCreateVisuGUI(QAD_Application::getDesktop());
- theObject = "";
- theContext = "";
+ VisuGUI_NonIsometricDlg* m_NonIsoDlg =
+ new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
+ false, Qt::WDestructiveClose);
+ m_NonIsoDlg->show();
}
+void
+VisuGUI::
+OnCubeAxes()
+{
+ //Show dialog that allows to select scale function and corresponding scale factor
+ VisuGUI_CubeAxesDlg* aDlg = new VisuGUI_CubeAxesDlg (GetDesktop(this));
+ aDlg->show();
+}
-//=====================================================================================
-// function : checkHomoSelection()
-// purpose :
-//=====================================================================================
-enum { homoNone=0, homoCurves, homoPresentations, homoPresentable, homoAnimatable, homoOther };
-int VisuGUI::checkHomoSelection()
+void
+VisuGUI::
+OnMergeScalarBars()
{
- int selMode = homoNone;
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- int selNext = homoOther;
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+
+ // first find the bounds
+ double aMin, aMax; bool first = true;
+ for (; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow( aCORBAObject );
- if ( !CORBA::is_nil( aVisuObj ) ) {
- VISU::VISUType aType = aVisuObj->GetType();
- switch( aType ) {
- case VISU::TTABLE:
- case VISU::TCURVE:
- case VISU::TCONTAINER:
- selNext = homoCurves; break;
- case VISU::TMESH:
- case VISU::TSCALARMAP:
- case VISU::TISOSURFACE:
- case VISU::TDEFORMEDSHAPE:
- case VISU::TCUTPLANES:
- case VISU::TCUTLINES:
- case VISU::TVECTORS:
- case VISU::TSTREAMLINES:
- selNext = homoPresentations; break;
- case VISU::TFIELD:
- if (getValue(aSObject, "myNbTimeStamps").toLong() > 1) {
- selNext = homoAnimatable; break;
- }
- selNext = homoOther; break;
- default:
- selNext = homoOther;
- }
- }
- }
- else {
- SALOMEDS::GenericAttribute_var anAttr;
- if ( aSObject->FindAttribute( anAttr, "AttributeComment") ) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow( anAttr );
- string aComm = aComment->Value();
- QString strIn( aComm.c_str() );
- VISU::Storable::StrToMap( strIn, pMap );
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
- if( isExist ) {
- switch ( aType ) {
- case VISU::TENTITY:
- case VISU::TFAMILY:
- case VISU::TGROUP:
- selNext = homoPresentable; break;
- case VISU::TFIELD:
- if (getValue(aSObject, "myNbTimeStamps").toLong() > 1) {
- selNext = homoAnimatable; break;
- }
- selNext = homoOther; break;
- default:
- selNext = homoOther;
- }
- }
- }
- }
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if (aPrsObject) {
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ if (first) {
+ first = false;
+ aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
+ } else {
+ if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
+ if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
+ }
+ }
+ }
}
}
- if ( selMode == homoNone )
- selMode = selNext;
- else {
- if ( selMode != selNext )
- return homoNone;
+ }
+
+ // set the computed range to every selected ScalarMap
+ bool update = false;
+ for (It.Initialize(aListIO); It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if(aPrsObject){
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ aScalar->SetRange(aMin, aMax);
+ RecreateActor(this, aScalar);
+ update = true;
+ }
+ }
+ }
}
}
- return selMode;
-}
-
-//=====================================================================================
-// function : GetNbChildren() [ static ]
-// purpose : get number of children
-//=====================================================================================
-int GetNbChildren( SALOMEDS::SObject_var SO, bool refToo )
-{
- if ( SO->_is_nil() )
- return 0;
- int cnt = 0;
- SALOMEDS::ChildIterator_var Iter = SO->GetStudy()->NewChildIterator( SO );
- for ( ; Iter->More(); Iter->Next() ) {
- SALOMEDS::SObject_var refSO;
- if ( !Iter->Value()->ReferencedObject( refSO ) || refToo )
- cnt++;
+ if (update) {
+ if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
+//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+//}
+ }
}
- return cnt;
}
-//=====================================================================================
-// function : CustomPopup()
-// purpose :
-//=====================================================================================
-bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QString & theContext,
- const QString & theParent, const QString & theObject)
+void
+VisuGUI::
+OnFreeScalarBars()
{
- int isViewer = (theParent.compare("ObjectBrowser") != 0), initId = isViewer? 800: 900;
- VisuGUI::GetOrCreateVisuGUI(parent);
- QAD_ResourceMgr* rmgr = parent->createResourceManager();
-
- bool isVTKViewer = (GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK);
- thePopup->clear();
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- if ( Sel->IObjectCount() == 0 ) {
- if ( theParent == "Viewer" && isVTKViewer)
- // Available only for VTK viewer
- thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
- return false;
- }
+ SALOME_ListIteratorOfListIO It (aListIO);
- if( Sel->IObjectCount() > 1 ) {
- int selMode = checkHomoSelection();
- MESSAGE( "VisuGUI::CustomPopup: multiple selection : selMode = "<<selMode );
- if ( selMode == homoCurves ) {
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayManyPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( EraseManyPrs () ) );
- }
- }
- else if ( selMode == homoPresentations ) {
- if (isVTKViewer) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayManyPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( EraseManyPrs () ) );
+ // restore the source range for every ScalarMap
+ bool update = false;
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if (aPrsObject) {
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ aScalar->SetSourceRange();
+ RecreateActor(this, aScalar);
+ update = true;
+ }
+ }
}
}
- else if ( selMode == homoPresentable ) {
- thePopup->insertItem("Create Presentations", visuGUI, SLOT(CreateManyMesh()));
- }
- else if ( selMode == homoAnimatable ) {
- thePopup->insertItem( "Animation...", visuGUI, SLOT( TimeAnimation() ) );
- }
- return true;
}
-
- VISU::Storable::TRestoringMap aMap;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
- if (!CORBA::is_nil(anObject)) {
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj)) {
- VISU::VISUType aType = aVisuObj->GetType();
- MESSAGE("VisuGUI::CustomPopup - VISU object :: "<<aType);
- switch (aType) {
- case VISU::TVISUGEN:
- thePopup->insertItem("Import From File", visuGUI, SLOT(ImportFromFile()));
- break;
-
- case VISU::TRESULT:
- //thePopup->insertItem("Create Mesh", visuGUI, SLOT(CreateMesh()));
- //thePopup->insertItem("Export To File", visuGUI, SLOT(ExportToFile()));
- //thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
- break;
-
- case VISU::TTABLE:
- thePopup->insertItem( "Show Table", visuGUI, SLOT( ShowTable() ) );
- thePopup->insertItem( "Create Curves", visuGUI, SLOT( PlotData() ) );
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- if ( GetNbChildren( aSObject, false ) > 0 ) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- }
- break;
-
- case VISU::TCURVE:
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- thePopup->insertItem( "Properties", visuGUI, SLOT( CurveProperties() ) );
- thePopup->insertItem( "Rename...", visuGUI, SLOT(Rename()));
- }
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- if ( GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->isVisible( anIO ) )
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- else
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- break;
-
- case VISU::TCONTAINER:
- if( !CORBA::is_nil( anObject ) ) {
- CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
- if( !CORBA::is_nil( aCnt ) ) {
- VISU::Container_i* container = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aCnt ) );
- if ( container && container->GetNbCurves() > 0 ) {
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) )
- thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- }
- }
- }
- break;
-
- default: // Presentation
- {
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
- if (aPrsObject) {
- VISU_Actor* anVISUActor = visuGUI->GetActor(aPrsObject);
- if (isVTKViewer) {
- // Add Presentation menu
- if ((aType != VISU::TSTREAMLINES) && anVISUActor) {
- QPopupMenu* aPresMenu = new QPopupMenu(GetDesktop());
- int aRepresent = anVISUActor->GetRepresentation();
- switch(aRepresent){
- case 0: //POINTS
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- break;
- case 1: //WIREFRAME
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- break;
- case 2: //SURFACE
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- break;
- }
- if (anVISUActor->GetShrinkable()) {
- if (anVISUActor->isShrunk())
- aPresMenu->insertItem("Unshrink", visuGUI, SLOT(MakeShrink()));
- else
- aPresMenu->insertItem("Shrink", visuGUI, SLOT(MakeShrink()));
- }
- thePopup->insertItem("Representation", aPresMenu);
- }
-
- // Add Properties
- QPopupMenu* aPropMenu = new QPopupMenu(GetDesktop());
- if ((aType == VISU::TMESH) ||
- (aType == VISU::TDEFORMEDSHAPE) ||
- (aType == VISU::TVECTORS) ||
- (aType == VISU::TSTREAMLINES))
- aPropMenu->insertItem("Color", visuGUI, SLOT(ChageColor()));
- if (aType == VISU::TMESH)
- aPropMenu->insertItem("Outline Color", visuGUI, SLOT(ChangeOutlineColor()));
-
- if ((aType != VISU::TVECTORS) && (aType != VISU::TSTREAMLINES))
- aPropMenu->insertItem("Opacity", visuGUI, SLOT(ChangeOpacity()));
- aPropMenu->insertItem("Line width", visuGUI, SLOT(ChangeLines()));
- thePopup->insertItem("Properties", aPropMenu);
-
- thePopup->insertSeparator();
- }
- thePopup->insertItem("Rename...", visuGUI, SLOT(Rename()));
- if (aType != VISU::TMESH) {
- if (aType != VISU::TSCALARMAP)
- thePopup->insertItem("Edit...", visuGUI, SLOT(EditPrs()));
- thePopup->insertItem("Edit Scalar Bar...", visuGUI, SLOT(EditScalarBar()));
-
- if ((aType != VISU::TVECTORS) && (aType != VISU::TSTREAMLINES)
- && (aType != VISU::TCUTLINES) && isVTKViewer)
- thePopup->insertItem("Sweep", visuGUI, SLOT(Sweep()));
-
- if (aType == VISU::TCUTLINES)
- thePopup->insertItem( "Create Table", visuGUI, SLOT( CreateTable() ) );
- }
- if (isVTKViewer) {
- if ( theParent == "Viewer" &&
- ( aType == VISU::TMESH ||
- aType == VISU::TSCALARMAP ||
- aType == VISU::TDEFORMEDSHAPE ) ) {
- thePopup->insertSeparator();
- if ( Sel->SelectionMode() == SelectionPoint ) {
- thePopup->insertItem("Results at Point", visuGUI, SLOT(InfoOnPoint()));
- thePopup->insertItem("Select a Point", visuGUI, SLOT(SelectPoint()));
- }
- else if ( Sel->SelectionMode() == SelectionCell) {
- thePopup->insertItem("Results on Cell", visuGUI, SLOT(InfoOnCell()));
- thePopup->insertItem("Select a Cell", visuGUI, SLOT(SelectCell()));
- }
- }
- thePopup->insertSeparator();
- if (visuGUI->IsDisplayed(aPrsObject) )
- thePopup->insertItem("Erase", visuGUI, SLOT(ErasePrs()));
- else
- thePopup->insertItem("Display", visuGUI, SLOT(DisplayPrs()));
-
- thePopup->insertItem("Display Only", visuGUI, SLOT(DisplayOnlyPrs()));
- }
- if (aType != VISU::TMESH) {
- thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
- thePopup->insertSeparator();
- thePopup->insertItem("Same As", visuGUI, SLOT(CopyPresentation()));
- }
- }
- }
- }
- return false;
- }
- else {
- // possibly this is the MED field/mesh and suppot objects
- SALOME_MED::MED_ptr aMED = SALOME_MED::MED::_narrow( anObject );
- if(!CORBA::is_nil(aMED))
- thePopup->insertItem( "Import Structure", visuGUI, SLOT( ImportMedField() ) );
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow( anObject );
- if(!CORBA::is_nil(aField))
- thePopup->insertItem( "Import TimeStamp", visuGUI, SLOT( ImportMedField() ) );
- return false;
- }
- }else{
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if(isExist){
- switch (aType) {
- case VISU::TENTITY:
- case VISU::TFAMILY:
- case VISU::TGROUP:
- thePopup->insertItem("Create Presentation", visuGUI, SLOT(CreateMesh()));
- break;
- case VISU::TVIEW3D:
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // Available only for VTK viewer
- thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
- thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
- }
- thePopup->insertItem( "Rename...", visuGUI, SLOT( Rename() ) );
- thePopup->insertItem("Delete", visuGUI, SLOT(DeleteViewParams()));
- break;
- case VISU::TFIELD:
- if ((getValue(aSObject, "myNbTimeStamps").toLong() > 1) && isVTKViewer)
- thePopup->insertItem( "Animation...", visuGUI, SLOT( TimeAnimation() ) );
- break;
- case VISU::TTIMESTAMP: {
- int aNunComponent = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist).toInt();
- thePopup->insertItem(rmgr->loadPixmap( "VisuGUI", tr("ICON_SCALAR_MAP") ),
- "Scalar Map...", visuGUI, SLOT(CreateScalarMap()));
- thePopup->insertItem(rmgr->loadPixmap( "VisuGUI", tr("ICON_ISO_SURFACES") ),
- "Iso Surfaces...", visuGUI, SLOT(CreateIsoSurfaces()));
- thePopup->insertItem(rmgr->loadPixmap( "VisuGUI", tr("ICON_CUT_PLANES") ),
- "Cut Planes...", visuGUI, SLOT(CreateCutPlanes()));
- thePopup->insertItem(rmgr->loadPixmap( "VisuGUI", tr("ICON_CUT_LINES") ),
- "Cut Lines...", visuGUI, SLOT(CreateCutLines()));
- if(aNunComponent > 1){
- thePopup->insertItem(rmgr->loadPixmap( "VisuGUI", tr("ICON_DEFORMED_SHAPE") ),
- "Deformed Shape...", visuGUI, SLOT(CreateDeformedShape()));
- thePopup->insertItem(rmgr->loadPixmap( "VisuGUI", tr("ICON_VECTORS") ),
- "Vectors...", visuGUI, SLOT(CreateVectors()));
- thePopup->insertItem(rmgr->loadPixmap( "VisuGUI", tr("ICON_STREAM_LINES") ),
- "Stream lines...", visuGUI, SLOT(CreateStreamLines()));
- }
- break;
- }
- }
- return false;
- }else{
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
- aSObject->FindAttribute( anAttr, "AttributeTableOfReal" )){
- thePopup->insertItem( "Show Table", visuGUI, SLOT(ShowTable()));
- thePopup->insertItem( "Create Curves", visuGUI, SLOT(PlotData()));
- return false;
- }
- aSObject = aSObject->GetFather();
- aSObject->FindAttribute(anAttr, "AttributeName");
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- CORBA::String_var aValue = aName->Value();
- //if(strcmp(aValue.in(),"MEDMESH") == 0)
- // thePopup->insertItem( "Import MED", visuGUI, SLOT( ImportMedField() ) );
- if(strcmp(aValue.in(),"MEDFIELD") == 0)
- thePopup->insertItem( "Import Field", visuGUI, SLOT( ImportMedField() ) );
- return false;
- }
+ if (update) {
+ if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
+//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+//}
}
}
}
-//===========================================================================
-// BuildPresentation
-//===========================================================================
-void VisuGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
+void
+VisuGUI::
+OnTranslatePrs()
{
- BEGIN_OF("VisuGUI::BuildPresentation");
-
- if (theIO.IsNull()) {
- MESSAGE("VisuGUI::BuildPresentation(): null SALOME_InteractiveObject passed");
- return;
- }
-
- /* Create or retrieve an object VisuGUI */
-
- VisuGUI::GetOrCreateVisuGUI(QAD_Application::getDesktop());
-
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
+ VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK ) return;
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
- vtkRenderer *Renderer = GetRenderer();
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
- SALOMEDS::SObject_var aSObj = aStudy -> FindObjectID ( theIO->getEntry() );
- SCRUTE(aSObj);
- if (aSObj -> _is_nil() ) {
- MESSAGE("No SObject for interacative object is found");
- return;
- }
-
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(!CORBA::is_nil(anObject)) {
-
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
- if ( !aPrsObject ) {
- MESSAGE("The object is not VISU::Prs3d_i");
- return;
- }
- VISU_Actor *SelectedActor = visuGUI->GetActor(aPrsObject);
- if ( ! SelectedActor )
- SelectedActor = aPrsObject -> CreateActor();
- SCRUTE(SelectedActor);
- if ( SelectedActor == NULL ) {
- MESSAGE("VisuGUI::BuildPresentation(): actor doesn't exist in Render");
- return;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ if (anIO->hasEntry()) {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ if (aSObject) {
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
+ aDlg->addPresentation(aPrsObject);
+ }
+ }
+ }
}
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- vf->AddActor(SelectedActor);
}
- else {
- MESSAGE("CORBA::is_nil(anObject) = true");
- }
- END_OF("VisuGUI::BuildPresentation");
-
+ if (aDlg->getPrsCount() > 0)
+ aDlg->show();
+ else
+ delete aDlg;
}
-extern "C"
+void
+VisuGUI::
+OnArrangeActors()
{
-
- bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
- {
- //MESSAGE("VisuGUI::OnGUIEvent "<< theCommandID);
- return VisuGUI::OnGUIEvent(theCommandID, parent);
+ SVTK_ViewWindow* vw = GetViewWindow();
+ if (vw) {
+ ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
+ aDlg->exec();
+ delete aDlg;
}
+}
- bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- MESSAGE("VisuGUI::OnKeyPress ");
- return VisuGUI::OnKeyPress (pe, parent, studyFrame);
- }
- bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- //MESSAGE("VisuGUI::OnMousePress ");
- return VisuGUI::OnMousePress (pe, parent, studyFrame);
- }
+void
+VisuGUI::
+initialize( CAM_Application* theApp )
+{
+ SalomeApp_Module::initialize( theApp );
- bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
- {
- //MESSAGE("VisuGUI::OnMouseMove ");
- return VisuGUI::OnMouseMove (pe, parent, studyFrame);
- }
+ createActions();
+ createMenus();
+ createToolBars();
+ createPopupMenus();
+}
- bool SetSettings ( QAD_Desktop* parent )
- {
- return VisuGUI::setSettings( parent );
- }
+void
+VisuGUI::
+createActions()
+{
+ QPixmap aPixmap;
+ QWidget* aParent = application()->desktop();
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ // Create actions
+ createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(),
+ tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
+ this, SLOT(OnImportFromFile()));
+
+ createAction( VISU_EXPLORE_MED, "", QIconSet(),
+ tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
+ this, SLOT(OnExploreMEDFile()));
+
+ createAction( VISU_IMPORT_TABLE, "", QIconSet(),
+ tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnImportTableFromFile()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
+ createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap),
+ tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
+ this, SLOT(OnCreateScalarMap()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
+ createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap),
+ tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
+ this, SLOT(OnCreateDeformedShape()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
+ createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap),
+ tr("MEN_VECTORS"), "", 0, aParent, false,
+ this, SLOT(OnCreateVectors()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
+ createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap),
+ tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
+ this, SLOT(OnCreateIsoSurfaces()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
+ createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap),
+ tr("MEN_CUT_PLANES"), "", 0, aParent, false,
+ this, SLOT(OnCreateCutPlanes()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
+ createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap),
+ tr("MEN_STREAM_LINES"), "", 0, aParent, false,
+ this, SLOT(OnCreateStreamLines()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
+ createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap),
+ tr("MEN_CUT_LINES"), "", 0, aParent, false,
+ this, SLOT(OnCreateCutLines()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
+ createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap),
+ tr("MEN_PLOT_3D"), "", 0, aParent, false,
+ this, SLOT(OnCreatePlot3D()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
+ createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
+ tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
+ this, SLOT(OnCreatePlot2dView()));
+
+ createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
+ tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
+ this, SLOT(OnDeleteObjects()));
+
+ createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(),
+ tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnShowTable()));
+
+ createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(),
+ tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
+ this, SLOT(OnPlotData()));
+
+ createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(),
+ tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnExportTableToFile()));
+
+ createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(),
+ tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
+ this, SLOT(OnImportMedField()));
+
+ createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(),
+ tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
+ this, SLOT(OnImportMedField()));
+
+ createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(),
+ tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
+ this, SLOT(OnImportMedField()));
+
+ createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
+ tr("MEN_CREATE_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCreateMesh()));
+
+ createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(),
+ tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCreateManyMesh()));
+
+ createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(),
+ tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
+ this, SLOT(OnTranslatePrs()));
+
+ createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(),
+ tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
+ this, SLOT(OnMergeScalarBars()));
+
+ createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(),
+ tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
+ this, SLOT(OnFreeScalarBars()));
+
+ createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(),
+ tr("MEN_ERASE"), "", 0, aParent, false,
+ this, SLOT(OnErasePrs()));
+
+ createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(),
+ tr("MEN_DISPLAY"), "", 0, aParent, false,
+ this, SLOT(OnDisplayPrs()));
+
+ createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(),
+ tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
+ this, SLOT(OnDisplayOnlyPrs()));
+
+ createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(),
+ tr("MEN_COPY_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCopyPresentation()));
+
+ createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(),
+ tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
+ this, SLOT(OnCurveProperties()));
+
+ createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
+ this, SLOT(OnRename()));
+
+ createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(),
+ tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
+ this, SLOT(OnEditContainer()));
+
+ createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(),
+ tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
+ this, SLOT(OnClearContainer()));
+
+ createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
+ tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnSaveViewParams()));
+ createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
+ tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnSaveViewParams()));
+
+ createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
+ tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnRestoreViewParams()));
- bool customPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
- const QString & theParent, const QString & theObject )
- {
- return VisuGUI::CustomPopup( parent, popup, theContext, theParent, theObject );
- }
+ //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
+ // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
+ // this, SLOT(OnDeleteObjects()));
- void definePopup ( QString & theContext, QString & theParent, QString & theObject )
- {
- VisuGUI::DefinePopup( theContext, theParent, theObject );
- }
+ createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
+ tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
+ this, SLOT(OnArrangeActors()));
- bool activeStudyChanged ( QAD_Desktop* parent )
- {
- //VisuGUI::activeStudyChanged( parent );
- }
- void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO )
- {
- VisuGUI::BuildPresentation(theIO);
- }
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
+ createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap),
+ tr("MEN_POINTS"), "", 0, aParent, false,
+ this, SLOT(OnMakePoints()));
- void supportedViewType(int* buffer, int bufferSize)
- {
- if (!buffer || !bufferSize) return;
- buffer[0] = (int)VIEW_VTK;
- if (--bufferSize) buffer[1] = (int)VIEW_PLOT2D;
- }
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
+ createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap),
+ tr("MEN_WIREFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeWireframe()));
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
+ createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap),
+ tr("MEN_SURFACE"), "", 0, aParent, false,
+ this, SLOT(OnMakeSurface()));
+
+ createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(),
+ tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeInsideframe()));
+
+ createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(),
+ tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeSurfaceframe()));
+
+ createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(),
+ tr("MEN_SHRINK"), "", 0, aParent, false,
+ this, SLOT(OnMakeShrink()));
+
+ createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(),
+ tr("MEN_UNSHRINK"), "", 0, aParent, false,
+ this, SLOT(OnMakeShrink()));
+
+ createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(),
+ tr("MEN_CELL_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeColor()));
+
+ createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(),
+ tr("MEN_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeColor()));
+
+ createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(),
+ tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeWireframeColor()));
+
+ createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(),
+ tr("MEN_OPACITY"), "", 0, aParent, false,
+ this, SLOT(OnChangeOpacity()));
+
+ createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(),
+ tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
+ this, SLOT(OnChangeLines()));
+
+
+ createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditScalarMap()));
+
+ createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditDeformedShape()));
+
+ createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditCutPlanes()));
+
+ createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditCutLines()));
+
+ createAction( VISU_EDIT_ISOSURFACE, tr("MEN_EDIT_PRS"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditIsoSurfaces()));
+
+ createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditVectors()));
+
+ createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditStreamLines()));
+
+ createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIconSet(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditPlot3D()));
+
+
+ createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(),
+ tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnCreateTable()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
+ createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap),
+ tr("MEN_SWEEP"), "", 0, aParent, false,
+ this, SLOT(OnSweep()));
+
+ createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(),
+ tr("MEN_CLIPPING"), "", 0, aParent, false,
+ this, SLOT(OnClippingPlanes()));
+
+ createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
+ tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
+ this, SLOT(OnSelectionInfo()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
+ createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap),
+ tr("MEN_ANIMATION"), "", 0, aParent, false,
+ this, SLOT(OnTimeAnimation()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
+ createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
+ tr("MEN_ERASE_ALL"), "", 0, aParent, false,
+ this, SLOT(OnEraseAll()));
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR COLOR ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-///////////////// /////////////////////////////////////////////////////////////////
-// change actor color
-// In : Name of Actor
-//
-//
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
+ createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
+ tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
+ //this, SLOT(OnEraseAll()));
+ this);
-void VisuGUI::NewColor(VISU_Actor *theActor){
- if(VISU::Prs3d_i* aPrs3d = theActor->getPrs3d()){
- SALOMEDS::Color anOldColor = aPrs3d->GetColor(), aNewColor;
- QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
- QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop());
- if(aColorNew.isValid()){
- aNewColor.R = aColorNew.red()/255.;
- aNewColor.G = aColorNew.green()/255.;
- aNewColor.B = aColorNew.blue()/255.;
- aPrs3d->SetColor(aNewColor);
- aPrs3d->Update();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame))
- if(VISU_Actor* anActor = GetActor(aPrs3d,aViewFrame))
- aPrs3d->UpdateActor(anActor);
- }
- }
- }
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
+ createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
+ tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
+ //this, SLOT(OnEraseAll()));
+ this);
-void VisuGUI::NewOutlineColor(VISUMesh_Actor *theActor){
- if(VISU::Mesh_i* aPrs3d = dynamic_cast<VISU::Mesh_i*>(theActor->getPrs3d())){
- SALOMEDS::Color anOldColor = aPrs3d->GetColor(), aNewColor;
- QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
- QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop());
- if(aColorNew.isValid()){
- aNewColor.R = aColorNew.red()/255.;
- aNewColor.G = aColorNew.green()/255.;
- aNewColor.B = aColorNew.blue()/255.;
- aPrs3d->SetLinkColor(aNewColor);
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame))
- if(VISU_Actor* anActor = GetActor(aPrs3d,aViewFrame))
- aPrs3d->UpdateActor(anActor);
- }
- }
- }
-}
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING"));
+ createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
+ tr("MEN_SCALING"), "", 0, aParent, false,
+ this, SLOT(OnScaling()));
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR OPACITY ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-// change actor opacity
-// In : Name of Actor
-//
-// Use CursorDlg to select a value between 0 and 100
-//
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES"));
+ createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(aPixmap),
+ tr("MEN_CUBE_AXES"), "", 0, aParent, false,
+ this, SLOT(OnCubeAxes()));
-void VisuGUI::NewOpacity(VISU_Actor *Actor)
-{
-
- VisuGUI_CursorDlg* CursorDlg = new VisuGUI_CursorDlg(QAD_Application::getDesktop(), tr("Opacity"), TRUE );
-
- float oldopac,newopac;
- int intopac;
- CursorDlg->Comment1->setText( tr( "Set value between") );
- CursorDlg->Comment2->setText( tr( "0 (transparent) and 100 (opaque)" ) );
- oldopac=Actor->GetProperty()->GetOpacity();
- intopac=int(oldopac*100.);
- CursorDlg->SpinBox1->setMinValue(0);
- CursorDlg->SpinBox1->setMaxValue(100);
- CursorDlg->SpinBox1->setValue(intopac);
-
- int ret = CursorDlg->exec();
- if (ret == 1)
- {
- intopac = CursorDlg->SpinBox1->value() ;
- newopac = intopac/100.;
- Actor->GetProperty()->SetOpacity(newopac);
- }
- delete CursorDlg;
+ createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
+ tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
+ this, SLOT(OnShowAnimation()));
}
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR LINEWIDTH ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-// change actor linewidth
-// In : Name of Actor
-//
-// Use CursorDlg to select a value between 0 and 10
-//
-
-void VisuGUI::NewLinewidth(VISU_Actor *Actor)
+void
+VisuGUI::
+createMenus()
{
-
- VisuGUI_CursorDlg* CursorDlg = new VisuGUI_CursorDlg(QAD_Application::getDesktop(), tr("Line Width"), TRUE );
-
- float oldlwid,newlwid;
- int intlwid;
- CursorDlg->Comment1->setText("Set value between");
- CursorDlg->Comment2->setText("1 (thin) and 10 (thick)");
- oldlwid=Actor->GetLineWidth();
- intlwid=int(oldlwid);
- CursorDlg->SpinBox1->setMinValue(1);
- CursorDlg->SpinBox1->setMaxValue(10);
- CursorDlg->SpinBox1->setValue(intlwid);
-
- int ret = CursorDlg->exec();
- if (ret == 1) {
- intlwid = CursorDlg->SpinBox1->value() ;
- newlwid = intlwid;
- Actor->SetLineWidth(newlwid);
- }
- delete CursorDlg;
-}
-
-/* ======================================================================================== */
-/* Setting parameters for Scalar Bar */
-/* ======================================================================================== */
-void VisuGUI::ChangeScalarBar()
+ // Add actions to menus
+ int aMenuId;
+ aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
+ createMenu( separator(), aMenuId, -1, 10 );
+ createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
+ createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
+ createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
+
+ aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
+ createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
+ createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
+ createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
+ createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
+ createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
+ createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
+ createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
+ createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
+
+ aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
+ createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
+
+ aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
+ int parentId =
+ createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
+ createMenu( VISU_POINTS, parentId, 10 ); // points
+ createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
+ createMenu( VISU_SURFACE, parentId, 10 ); // surface
+ createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
+ createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
+ createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
+ createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
+ createMenu( VISU_CUBE_AXES, aMenuId, 10 ); // scaling
+}
+
+void
+VisuGUI::
+createToolBars()
{
- VisuGUI_ScalarBarDlg* Scbar = new VisuGUI_ScalarBarDlg(TRUE);
- Scbar->initFromResources();
- int ret = Scbar->exec();
- if ( ret ) {
- Scbar->storeToResources();
- }
- delete Scbar;
-}
+ int aToolId = createTool(tr("TOOL_VISUALISATION"));
+ createTool( VISU_SCALAR_MAP, aToolId );
+ createTool( VISU_DEFORMED_SHAPE, aToolId );
+ createTool( VISU_VECTORS, aToolId );
+ createTool( VISU_ISO_SURFACES, aToolId );
+ createTool( VISU_CUT_PLANES, aToolId );
+ createTool( VISU_CUT_LINES, aToolId );
+ createTool( VISU_STREAM_LINES, aToolId );
+ createTool( VISU_PLOT_3D, aToolId );
+
+ aToolId = createTool(tr("TOOL_REPRESENTATION"));
+ createTool( VISU_POINTS, aToolId );
+ createTool( VISU_WIREFRAME, aToolId );
+ createTool( VISU_SURFACE, aToolId );
+ createTool( VISU_ERASE_ALL, aToolId );
+ createTool( VISU_GLOBAL_SELECTION, aToolId );
+ createTool( VISU_PARTIAL_SELECTION, aToolId );
+ createTool( VISU_SCALING, aToolId );
+ createTool( VISU_CUBE_AXES, aToolId );
+}
+
+void
+VisuGUI::
+createPopupMenus()
+{
+ // Prepare popup menus
+ QtxPopupMgr* mgr = popupMgr();
-/* ======================================================================================== */
-/* Setting parameters for Sweeping */
-/* ======================================================================================== */
-void VisuGUI::SetSweepingPreferences()
+ // VISU root commands
+ mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED 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_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
+
+ // create
+ mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
+ mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
+ mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
+ mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
+ mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
+ mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
+ mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
+ mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
+
+ mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
+ mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
+
+ mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
+
+ // edit
+ mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_ISOSURFACE ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
+
+ // rename
+ mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
+
+ // copy
+ mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
+
+ // delete
+ mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
+
+ // table commands
+ //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
+ //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
+ //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
+ mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
+ mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
+
+ // "Representation" submenu
+ int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
+ mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
+ mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
+ mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
+ mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
+ mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
+ mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
+ mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
+
+ // "Properties" submenu
+ parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
+ mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
+ mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
+ mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
+ mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
+ mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ // Other presentations management
+ mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
+ mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
+
+ mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
+ mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
+
+ mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
+ mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ // view parameters commands
+ mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
+ mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
+ mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
+ //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
+
+ 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_SELECTION_INFO ), -1, -1, -1 ); // Selection info
+
+ // Rules
+
+ QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
+ "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'");
+
+ // VISU root commands
+ QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
+ mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
+ mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
+ mgr->setRule( action( VISU_PLOT2D ), aRule, true );
+
+ // timestamp commands
+ aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
+ mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
+ mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
+ mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
+ mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
+ mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
+ aRule += " and nbComponents>1";
+ mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
+ mgr->setRule( action( VISU_VECTORS ), aRule, true );
+ mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
+
+ // display/erase commands
+ QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
+ QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
+ QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
+ QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
+ QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
+ QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
+
+ QString anEraseRule = "selcount>0 and (" + aPrsVisible +
+ " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + ")))";
+
+ QString aDisplayRule = "selcount>0 and (" + aPrsInvisible +
+ " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + ")))";
+
+ QString aDOnlyRule = "selcount>0 and (($type in {'VISU::TMESH' " + aPrsAll + "})"
+ " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
+ " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))))";
+
+ mgr->setRule( action( VISU_ERASE ), anEraseRule, true );
+ mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
+ mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
+
+ aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
+ mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
+
+ aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
+ mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
+ mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
+
+ // view parameters
+ aRule = "selcount=1 and type='VISU::TVIEW3D'";
+ mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
+ mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true );
+ mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
+ //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
+
+ mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
+
+ // 3D presentations commands
+ QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
+ QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
+ QString aSurfType = " and $type in {'VISU::TMESH'}";
+ QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
+ "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D'}";
+ QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'}";
+
+ aRule = "selcount=1";
+ mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
+
+ // "Representation" submenu
+ QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
+ QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
+ QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
+ QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
+ QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
+
+ mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
+ mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
+ mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true );
+ mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
+ mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true );
+
+ mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
+ mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
+
+ // "Properties" submenu
+ mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
+ mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
+ mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
+ " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
+ "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
+ mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
+ mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
+
+ // rename command
+ QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
+
+ aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
+ mgr->setRule( action( VISU_RENAME ), aRule, true );
+
+ // copy presentation command
+ aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
+ mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
+
+ // curve commands
+ aRule = "selcount=1 and type='VISU::TCURVE'";
+ mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
+
+ // curve container commands
+ aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
+ mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
+ mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
+
+ mgr->setRule( action( VISU_EDIT_SCALARMAP ),
+ "selcount=1 and type='VISU::TSCALARMAP'", true );
+ mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
+ "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
+ mgr->setRule( action( VISU_EDIT_CUTPLANES ),
+ "selcount=1 and type='VISU::TCUTPLANES'", true );
+ mgr->setRule( action( VISU_EDIT_CUTLINES ),
+ "selcount=1 and type='VISU::TCUTLINES'", true );
+ mgr->setRule( action( VISU_EDIT_ISOSURFACE ),
+ "selcount=1 and type='VISU::TISOSURFACE'", true );
+ mgr->setRule( action( VISU_EDIT_VECTORS ),
+ "selcount=1 and type='VISU::TVECTORS'", true );
+ mgr->setRule( action( VISU_EDIT_STREAMLINES ),
+ "selcount=1 and type='VISU::TSTREAMLINES'", true );
+ mgr->setRule( action( VISU_EDIT_PLOT3D ),
+ "selcount=1 and type='VISU::TPLOT3D'", true );
+
+ aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
+ mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
+
+ aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
+ mgr->setRule( action( VISU_SWEEP ), aRule, true );
+
+ // "Selection info" popup item
+ aRule = "client='VTKViewer' and selcount=1" + aInsideType;
+ mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
+
+ aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
+ mgr->setRule( action( VISU_ANIMATION ), aRule, true );
+
+ aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
+ mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
+ mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
+
+ //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
+ //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
+}
+
+//***************************************************************************
+void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
{
- float tempo=0.2;
- int cycles=1;
- int steps=20;
+ SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
- QString Tempo = QAD_CONFIG->getSetting("Visu:SweepTempo");
- if ( !Tempo.isEmpty() )
- tempo = Tempo.toFloat();
+ OB_Browser* ob = getApp()->objectBrowser();
+ bool isOBClient = (ob && theClient == ob->popupClientType());
- QString Cycles = QAD_CONFIG->getSetting("Visu:SweepCycles");
- if ( !Cycles.isEmpty() )
- cycles = Cycles.toInt();
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
- QString Steps = QAD_CONFIG->getSetting("Visu:SweepSteps");
- if ( !Steps.isEmpty() )
- steps = Steps.toInt();
+ if (aListIO.Extent() < 1) return;
- VisuGUI_SweepPrefDlg* Sweep = new VisuGUI_SweepPrefDlg(QAD_Application::getDesktop(), 0, TRUE, 0);
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
- Sweep->setTimeStep( tempo );
- Sweep->setNbCycles( cycles );
- Sweep->setNbSteps ( steps );
+ // Check if "Merge Scalar Range" can be applied
+ int nbPrs = 0;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( Sweep->exec() )
- {
- tempo = Sweep->getTimeStep();
- cycles = Sweep->getNbCycles();
- steps = Sweep->getNbSteps();
+ if (!anIO.IsNull() && anIO->hasEntry()) {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
+ if (CORBA::is_nil(aCORBAObject)) {
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ string aComm = aComment->Value();
+ QString strIn (aComm.c_str());
+ VISU::Storable::TRestoringMap pMap;
+ VISU::Storable::StrToMap(strIn, pMap);
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
+ if (isExist && aType == VISU::TTIMESTAMP) {
+ _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
+ _PTR(SObject) aPrs;
+ for (; anIter->More(); anIter->Next()) {
+ aPrs = anIter->Value();
+ if (!aPrs) continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
+ nbPrs += aSubList.size();
+ }
+ }
+ }
+ }
+ }
+ }
- QAD_CONFIG->addSetting("Visu:SweepTempo", tempo);
- QAD_CONFIG->addSetting("Visu:SweepCycles", cycles);
- QAD_CONFIG->addSetting("Visu:SweepSteps", steps);
- }
- delete Sweep;
-}
-
-/* ======================================================================================== */
-/* Returns Visu input files directory (default is CSF_PATHData) */
-/* ======================================================================================== */
-QString VisuGUI::getVisuInputDir()
-{
- QString Tmp = QAD_CONFIG->getSetting("Visu:InputDir");
- if ( Tmp.isEmpty() )
- Tmp = QAD_Tools::addSlash(getenv("CSF_PATHData"));
- Tmp = QAD_Tools::addSlash(Tmp);
- return (Tmp);
-}
-
-/* ======================================================================================== */
-/* Returns Visu output files directory (default is InputDir) */
-/* ======================================================================================== */
-QString VisuGUI::getVisuOutputDir()
-{
- QString Tmp = QAD_CONFIG->getSetting("Visu:OutputDir");
- if ( Tmp.isEmpty() )
- {
- QString Tmp2 = QAD_CONFIG->getSetting("Visu:InputDir");
- if ( Tmp2.isEmpty() )
- Tmp = QAD_Tools::addSlash(getenv("CSF_PATHData"));
- else
- Tmp = Tmp2;
- }
- Tmp = QAD_Tools::addSlash(Tmp);
- return (Tmp);
-}
-
-
-/* ======================================================================================== */
-/* Global Method for Scalar Map */
-/* ======================================================================================== */
-VISU::Result_i* VisuGUI::CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult){
- if(MYDEBUG) MESSAGE("VisuGUI::CreatePresent");
- VisuGUI::GetOrCreateVisuGUI( QAD_Application::getDesktop() );
- SALOMEDS::SObject_var aSObj = theField->GetFather();
- if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) return NULL;
- theResult = VISU::Result::_narrow(anObject);
- VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject));
- if(pResult == NULL)
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
- return pResult;
-}
-
-#define CREATEPRS(PRSTYPE, FNAME, FCREATE) \
-PRSTYPE* FNAME(SALOMEDS::SObject_var theField, \
- const char* theMeshName, VISU::Entity theEntity, \
- const char* theFieldName, double theTimeId) {\
- VISU::Result_var aResult; \
- VISU::Result_i* pResult = CreatePresent(theField,aResult); \
- if(pResult != NULL){ \
- if(PRSTYPE::IsPossible(pResult,theMeshName,(VISU::Entity)theEntity,theFieldName,theTimeId)){ \
- QApplication::setOverrideCursor( Qt::waitCursor ); \
- CORBA::Object_var anObject = \
- GetVisuGen()->FCREATE(aResult,theMeshName,theEntity,theFieldName,theTimeId); \
- QApplication::restoreOverrideCursor(); \
- if(!CORBA::is_nil(anObject)) \
- return dynamic_cast<PRSTYPE*>(VISU::GetServant(anObject)); \
- } \
- } \
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), \
- tr ("ERR_CANT_BUILD_PRESENTATION"), \
- tr ("VISU_BUT_OK") ); \
- return NULL; \
-}
-
-CREATEPRS(VISU::ScalarMap_i, VisuGUI::CreateScalarMapPrs, ScalarMapOnField);
-CREATEPRS(VISU::DeformedShape_i, VisuGUI::CreateDeformedShapePrs, DeformedShapeOnField);
-CREATEPRS(VISU::Vectors_i, VisuGUI::CreateVectorsPrs, VectorsOnField);
-CREATEPRS(VISU::IsoSurfaces_i, VisuGUI::CreateIsoSurfacesPrs, IsoSurfacesOnField);
-CREATEPRS(VISU::CutPlanes_i, VisuGUI::CreateCutPlanesPrs, CutPlanesOnField);
-CREATEPRS(VISU::CutLines_i, VisuGUI::CreateCutLinesPrs, CutLinesOnField);
-CREATEPRS(VISU::StreamLines_i, VisuGUI::CreateStreamLinesPrs, StreamLinesOnField);
-
-
-#define BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) \
-bool FNAME(SALOMEDS::SObject_var theField) { \
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theField); \
- bool isExist; \
- QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist); \
- if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false; \
- QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1(); \
- QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1(); \
- QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); \
- QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1(); \
- Utils_Timer timer; \
- if(MYCHECKTIME) timer.Start(); \
- TYPE* pPresent = FCREATE(theField,aMeshName,(VISU::Entity)anEntity.toInt(),aFieldName,aTimeStampId.toDouble()); \
- if(MYCHECKTIME) { \
- timer.Stop(); \
- MESSAGE("BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) - CREATE PRSOBJECT"); \
- timer.Show(); \
- } \
- if (pPresent) { \
- DLGNAME* aDlg = new DLGNAME(); \
- aDlg->initFromPrsObject(pPresent); \
- if (aDlg->exec()) { \
- aDlg->storeToPrsObject(pPresent); \
- } else { \
- DeletePresentation(pPresent); \
- delete aDlg; \
- return false; \
- } \
- delete aDlg; \
- CreateActor(pPresent); \
- return true; \
- } \
- return false; \
-}
-
-BUILDPRS(VISU::ScalarMap_i, CreateScalarMapPrs, VisuGUI::CreateScalarMap, VisuGUI_ScalarBarDlg);
-BUILDPRS(VISU::DeformedShape_i, CreateDeformedShapePrs, VisuGUI::CreateDeformedShape, VisuGUI_MagnitudeDlg);
-BUILDPRS(VISU::Vectors_i, CreateVectorsPrs, VisuGUI::CreateVectors, VisuGUI_VectorsDlg);
-BUILDPRS(VISU::IsoSurfaces_i, CreateIsoSurfacesPrs, VisuGUI::CreateIsoSurfaces, VisuGUI_IsoSurfacesDlg);
-BUILDPRS(VISU::CutPlanes_i, CreateCutPlanesPrs, VisuGUI::CreateCutPlanes, VisuGUI_CutPlanesDlg);
-BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg);
-BUILDPRS(VISU::StreamLines_i, CreateStreamLinesPrs, VisuGUI::CreateStreamLines, VisuGUI_StreamLinesDlg);
-
-
-
-/* ======================================================================================== */
-/* Global Method to import tables from file */
-/* ======================================================================================== */
-void VisuGUI::ImportTablesFromFile(){
- QStringList flt;
- flt.append( "Files (*.xls *.txt *.tab)" );
- flt.append( "All Files (*.*)" );
- QString aDir = getVisuInputDir();
- QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Import From File"),true);
- if(!aFile.isEmpty()){
- QAD_Application::getDesktop()->putInfo( "Importing From File " + aFile + "..." );
- aDir = QAD_Tools::getDirFromPath(aFile);
- QAD_CONFIG->addSetting("Visu:InputDir",aDir);
- QApplication::setOverrideCursor( Qt::waitCursor );
- QAD_PyInterp* myPyInterp = GetActiveStudy()->get_PyInterp();
- myPyInterp->run("import VisuGUI");
- myPyInterp->run("reload(VisuGUI)");
- myPyInterp->run("VisuGUI.AddTablesInStudyFromFile('"+aFile+"')");
- // VISU::Result_var aResult = myComponent->ImportFile(aFile.latin1());
- // if(aResult->_is_nil())
- // QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- // tr ("There is an error in imported file"),
- // tr ("VISU_BUT_OK") );
- // else
- // QAD_Application::getDesktop()->putInfo(aFile+" imported.");
- GetActiveStudy()->updateObjBrowser(); //update Object browser
- QApplication::restoreOverrideCursor();
+ if (nbPrs > 1) {
+ theMenu->insertSeparator();
+ action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
+ action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
}
-}
-/* ======================================================================================== */
-/* Global Method to import mesh results in MED and DAT format */
-/* ======================================================================================== */
-void VisuGUI::ImportFromFile(){
- if (checkLock(GetActiveStudy()->getStudyDocument())) return;
- QStringList flt;
- //flt.append( "Exportable Files (*.med *.dat)" );
- //flt.append( "Dat Files (*.dat)" );
- flt.append( "Med Files (*.med)" );
- flt.append( "Dat Files (*.xls)" );
- QString aDir = getVisuInputDir();
- QFileInfo aFileInfo = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Import From File"),true);
- if(aFileInfo.exists()){
- QAD_Application::getDesktop()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
- aDir = QAD_Tools::getDirFromPath(aFileInfo.filePath());
- QAD_CONFIG->addSetting("Visu:InputDir",aDir);
- QAD_WaitCursor wc;
-
- CORBA::Object_var anObject;
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- if(aFileInfo.extension(false) == "med")
- anObject = GetVisuGen()->ImportFile(aFileInfo.filePath());
- else if(aFileInfo.extension(false) == "xls")
- anObject = GetVisuGen()->ImportTables(aFileInfo.filePath());
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::ImportFromFile() - IMPORT FILE");
- timer.Show();
-#endif
+ theMenu->insertSeparator();
- if(CORBA::is_nil(anObject)) {
- wc.stop();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_IN_THE_FILE"),
- tr ("VISU_BUT_OK") );
- wc.start();
- }
- else {
- QAD_Application::getDesktop()->putInfo(aFileInfo.filePath()+" imported.");
- }
- GetActiveStudy()->updateObjBrowser(); //update Object browser
+ // Check if some (nb > 0) removable objects selected
+ if (isOBClient && IsRemovableSelected(this)) {
+ action( VISU_DELETE_OBJS )->addTo(theMenu);
}
-}
-void VisuGUI::ExportToFile(){
- CORBA::Object_var anObject = GetSelectedObj();
- if(CORBA::is_nil(anObject)) return;
- VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject));
- if(aBase != NULL && aBase->GetType() == VISU::TRESULT){
- QStringList flt;
- flt.append( "Dat Files (*.dat)" );
- flt.append( "Med Files (*.med)" );
- QString aDir = getVisuOutputDir();
- QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Export To File"),false);
- if(!aFile.isEmpty()){
- QAD_Application::getDesktop()->putInfo( "Exporting To File " + aFile + "..." );
- aDir = QAD_Tools::getDirFromPath(aFile);
- QAD_CONFIG->addSetting("Visu:OutputDir",aDir);
- if(VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>(aBase)){
- try{
- //APO - aResult->GetInput()->ToFile(aFile.latin1());
- QAD_Application::getDesktop()->putInfo(aFile+" exported.");
- }catch(...){
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT"),
- tr ("VISU_BUT_OK") );
- }
+ // Check single selection
+ if (aListIO.Extent() != 1) return;
+
+ Handle(SALOME_InteractiveObject) anIO;
+ VISU::Storable::TRestoringMap aMap;
+ CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
+
+ _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+
+ if (aType == VISU::TANIMATION) {
+ action( VISU_SHOW_ANIMATION )->addTo(theMenu);
+
+ } else if (isOBClient) {
+ if (IsSObjectTable(SO)) {
+ action( VISU_SHOW_TABLE )->addTo(theMenu);
+ action( VISU_CREATE_CURVES )->addTo(theMenu);
+ action( VISU_EXPORT_TABLE )->addTo(theMenu);
+ theMenu->insertSeparator();
+ } else {
+ if (!CORBA::is_nil(anObject)) {
+ SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
+ if (!CORBA::is_nil(aMED.in())) {
+ action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
+ }
+
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
+ if (!CORBA::is_nil(aField)) {
+ action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
+ }
+ } else {
+ _PTR(SObject) aSFather = SO->GetFather();
+ if (aSFather) {
+ _PTR(GenericAttribute) anAttr;
+ aSFather->FindAttribute(anAttr, "AttributeName");
+ if (anAttr) {
+ _PTR(AttributeName) aName (anAttr);
+ std::string aValue = aName->Value();
+ if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
+ action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
+ }
+ }
+ }
}
}
- }else
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
-}
-
-/* ======================================================================================== */
-/* Test and Read Object Browser before display */
-/* ======================================================================================== */
-bool VisuGUI::TestObjectBrowser(SALOMEDS::SObject_var& objVisu ){
- if(MYDEBUG) MESSAGE("VisuGUI::TestObjectBrowser");
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if(anIO->hasEntry()){
- objVisu = GetStudyDocument()->FindObjectID(anIO->getEntry());
- QString aValue = getValue(objVisu,"myType");
- if((VISU::VISUType)aValue.toInt() == VISU::TTIMESTAMP) return true;
- }
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("WRN_NO_AVAILABLE_DATA"),
- tr("VISU_BUT_OK") );
- return false;
-}
-
-/**
- * Returns Actor of presentation if it exists
- */
-VISU_Actor* VisuGUI::GetActor(VISU::Prs3d_i* thePrs, VTKViewer_ViewFrame* theViewFrame){
- VTKViewer_ViewFrame* vf = theViewFrame? theViewFrame: GetVtkViewFrame();
- if (!vf) return NULL;
- vtkActor *anActor;
- vtkActorCollection *anActColl = vf->getRenderer()->GetActors();
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;)
- if(VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
- if(thePrs == anVISUActor->getPrs3d())
- return anVISUActor->GetParent();
- return NULL;
-}
-
-/**
- * Displays only actor of given presentation
- * Creates it if it is abcent
- */
-VISU_Actor* VisuGUI::UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly){
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (!vf) return NULL;
-
- vtkRenderer *aRen = vf->getRenderer();
- vtkActorCollection *anActColl = aRen->GetActors();
-
- vtkActor *anActor;
- VISU_Actor* anVISUActor = NULL;
- VISU_Actor* aResActor = NULL;
- VISU::Prs3d_i* aSrcAddr = thePrs;
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
- if(anActor->IsA("VISU_Actor")){
- anVISUActor = VISU_Actor::SafeDownCast(anActor);
- VISU::Prs3d_i* aPrs = anVISUActor->getPrs3d();
- if(aPrs == NULL) continue;
- if (thePrs == aPrs) {
- aResActor = anVISUActor->GetParent();
- thePrs->UpdateActor(aResActor);
- aResActor->VisibilityOn();
- } else if (theDispOnly) {
- anVISUActor->VisibilityOff();
- }
- }
- }
- if (aResActor) return aResActor;
- anVISUActor = thePrs->CreateActor();
- MESSAGE("UpdateViewer - thePrs->CreateActor() = "<<anVISUActor);
- if ( anVISUActor ) {
- vf->AddActor(anVISUActor);
- } else
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_VISUALIZE_OBJECT"),
- tr ("VISU_BUT_OK") );
- return anVISUActor;
-}
-
-
-/**
- * Returns TRUE if Presentation is displayed
- */
-bool VisuGUI::IsDisplayed(VISU::Prs3d_i* thePrs) {
- VISU_Actor* anVISUActor = GetActor(thePrs);
- return (anVISUActor)? anVISUActor->GetVisibility() : false;
-}
-
-/**
- * Erases Presentation
- */
-void VisuGUI::ErasePrs(VISU::Prs3d_i* thePrs) {
- GetActiveStudy()->unHighlightAll();
- VISU_Actor* anVISUActor = GetActor(thePrs);
- if (anVISUActor) {
- anVISUActor->VisibilityOff();
}
}
-/**
- * Deletes given presentation from Data structure
- */
-void VisuGUI::DeletePresentation(VISU::Prs3d_i* thePrs) {
- if(checkLock(GetStudyDocument()) || !thePrs) return;
- GetActiveStudy()->unHighlightAll();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame))
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)){
- aViewFrame->RemoveActor(anActor);
- anActor->Delete();
- }
- }
- thePrs->Destroy();
- GetActiveStudy()->updateObjBrowser(); //update Object browser
-}
-
-/**
- * Creates new actor of presentation
- */
-void VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) {
- if (!thePrs) return;
- QApplication::setOverrideCursor( Qt::waitCursor );
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- VISU_Actor* aActor = thePrs->CreateActor();
- if ( ! aActor ) {
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_CANT_VISUALIZE_PRS"),
- tr ("VISU_BUT_OK") );
- return;
- }
- vf->AddActor(aActor);
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) - DISPLAY ACTOR");
- timer.Show();
-#endif
- }
- QApplication::restoreOverrideCursor();
+
+//***************************************************************************
+void
+VisuGUI::
+windows( QMap<int, int>& theMap ) const
+{
+ theMap.clear();
+ theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
+ theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
+}
+
+
+void
+VisuGUI::
+viewManagers( QStringList& theList ) const
+{
+ theList.clear();
+ theList.append( SVTK_Viewer::Type() );
}
+QString
+VisuGUI::
+engineIOR() const
+{
+ CORBA::String_var anIOR = GetVisuGen(this)->GetID();
+ return QString(anIOR.in());
+}
-/* ======================================================================================== */
-/* Functions to State of VisuGUI and Dialog Box */
-/* ======================================================================================== */
-void VisuGUI::SetState(int aState )
-{
- this->myState = aState ;
- return ;
+bool
+VisuGUI::
+activateModule( SUIT_Study* theStudy )
+{
+ SalomeApp_Module::activateModule( theStudy );
+ studyActivated();
+ setMenuShown( true );
+ setToolShown( true );
+ return true;
}
-void VisuGUI::ResetState()
-{
- this->myState = -1 ;
- return ;
+bool
+VisuGUI::
+deactivateModule( SUIT_Study* theStudy )
+{
+ setMenuShown( false );
+ setToolShown( false );
+
+ SalomeApp_Module::deactivateModule( theStudy );
+ return true;
+}
+
+SalomeApp_Selection*
+VisuGUI::
+createSelection() const
+{
+ return new VisuGUI_Selection( (SalomeApp_Module*)this );
}
-void VisuGUI::EmitSignalDeactivateDialog()
+//******************************************************************
+void VisuGUI::studyActivated()
{
- emit this->SignalDeactivateActiveDialog() ;
- return ;
+ GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
}
-void VisuGUI::EmitSignalCloseAllDialogs()
+/*
+extern "C" {
+ CAM_Module*
+ createModule()
+ {
+ return new VisuGUI();
+ }
+}
+*/
+void VisuGUI::createPreferences()
+{
+ int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
+
+ int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
+ int tfont = addPreference( tr( "VISU_TITLE" ), fontGr, SalomeApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
+ addPreference( tr( "VISU_TITLE" ), fontGr, SalomeApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
+ int lfont = addPreference( tr( "VISU_LABELS" ), fontGr, SalomeApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
+ addPreference( tr( "VISU_LABELS" ), fontGr, SalomeApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
+
+ QStringList fam;
+ fam.append( tr( "VISU_FONT_ARIAL" ) );
+ fam.append( tr( "VISU_FONT_COURIER" ) );
+ fam.append( tr( "VISU_FONT_TIMES" ) );
+ int wflag = ( QtxListResourceEdit::FontItem::All & ( ~( QtxListResourceEdit::FontItem::Size | QtxListResourceEdit::FontItem::UserSize ) ) );
+
+ setPreferenceProperty( tfont, "families", fam );
+ setPreferenceProperty( tfont, "system", false );
+ setPreferenceProperty( tfont, "widget_flags", wflag );
+ setPreferenceProperty( lfont, "families", fam );
+ setPreferenceProperty( lfont, "system", false );
+ setPreferenceProperty( lfont, "widget_flags", wflag );
+
+ int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
+
+ int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
+ setPreferenceProperty( numcol, "min", 2 );
+ setPreferenceProperty( numcol, "max", 64 );
+
+ int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
+ setPreferenceProperty( numlab, "min", 2 );
+ setPreferenceProperty( numlab, "max", 65 );
+
+ int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
+ int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr, SalomeApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
+ QStringList orients;
+ orients.append( tr( "VISU_VERTICAL" ) );
+ orients.append( tr( "VISU_HORIZONTAL" ) );
+ QValueList<QVariant> indices;
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( orient, "strings", orients );
+ setPreferenceProperty( orient, "indexes", indices );
+
+ int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
+ int xv = addPreference( tr( "VISU_X" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
+ int yv = addPreference( tr( "VISU_Y" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
+ int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
+ int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
+ setPreferenceProperty( xv, "step", 0.1 );
+ setPreferenceProperty( yv, "step", 0.1 );
+ setPreferenceProperty( wv, "step", 0.1 );
+ setPreferenceProperty( hv, "step", 0.1 );
+ setPreferenceProperty( xv, "min", 0.0 );
+ setPreferenceProperty( yv, "min", 0.0 );
+ setPreferenceProperty( wv, "min", 0.0 );
+ setPreferenceProperty( hv, "min", 0.0 );
+ setPreferenceProperty( xv, "max", 1.0 );
+ setPreferenceProperty( yv, "max", 1.0 );
+ setPreferenceProperty( wv, "max", 1.0 );
+ setPreferenceProperty( hv, "max", 1.0 );
+
+ int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
+ int xh = addPreference( tr( "VISU_X" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
+ int yh = addPreference( tr( "VISU_Y" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
+ int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
+ int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
+ setPreferenceProperty( xh, "step", 0.1 );
+ setPreferenceProperty( yh, "step", 0.1 );
+ setPreferenceProperty( wh, "step", 0.1 );
+ setPreferenceProperty( hh, "step", 0.1 );
+ setPreferenceProperty( xh, "min", 0.0 );
+ setPreferenceProperty( yh, "min", 0.0 );
+ setPreferenceProperty( wh, "min", 0.0 );
+ setPreferenceProperty( hh, "min", 0.0 );
+ setPreferenceProperty( xh, "max", 1.0 );
+ setPreferenceProperty( yh, "max", 1.0 );
+ setPreferenceProperty( wh, "max", 1.0 );
+ setPreferenceProperty( hh, "max", 1.0 );
+
+ int srangeTab = addPreference( tr( "Scalar range, Sweep, MED import" ) );
+
+ int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), srangeTab );
+ setPreferenceProperty( rangeGr, "columns", 1 );
+
+ int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, SalomeApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
+ QStringList modes;
+ modes.append( tr( "VISU_MODULUS" ) );
+ modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
+ modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
+ modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ indices.append( 3 );
+ setPreferenceProperty( mode, "strings", modes );
+ setPreferenceProperty( mode, "indexes", indices );
+
+ addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, SalomeApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
+
+ int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, SalomeApp_Preferences::Selector, "VISU", "scalar_range_type" );
+ QStringList types;
+ types.append( tr( "VISU_FIELD_RANGE" ) );
+ types.append( tr( "VISU_IMPOSED_RANGE" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( rangetype, "strings", types );
+ setPreferenceProperty( rangetype, "indexes", indices );
+
+ int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), srangeTab );
+
+ int min = addPreference( tr( "VISU_MIN" ), imposedGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
+ int max = addPreference( tr( "VISU_MAX" ), imposedGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
+ setPreferenceProperty( min, "step", 0.1 );
+ setPreferenceProperty( max, "step", 0.1 );
+
+ int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
+ setPreferenceProperty( sweepGr, "columns", 1 );
+
+ int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, SalomeApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
+ int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr, SalomeApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
+ int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr, SalomeApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
+ setPreferenceProperty( timestep, "min", 0.1 );
+ setPreferenceProperty( timestep, "step", 0.1 );
+ setPreferenceProperty( timestep, "max", 1000 );
+ setPreferenceProperty( nbcycles, "max", 100 );
+ setPreferenceProperty( nbsteps, "max", 200 );
+
+ int importGr = addPreference( tr( "MED files import" ), srangeTab );
+ addPreference( tr( "Full MED loading" ), importGr, SalomeApp_Preferences::Bool, "VISU", "full_med_loading" );
+}
+
+void VisuGUI::preferencesChanged( const QString&, const QString& )
{
- emit this->SignalCloseAllDialogs() ;
- return ;
}
-QDialog* VisuGUI::GetActiveDialogBox()
+SUIT_ViewManager*
+VisuGUI
+::getViewManager(const QString& theType,
+ const bool theIsCreate)
{
- return this->myActiveDialogBox ;
+ return getApp()->getViewManager(theType,theIsCreate);
}
-void VisuGUI::SetActiveDialogBox(QDialog* aDlg)
+SalomeApp_Displayer* VisuGUI::displayer()
{
- this->myActiveDialogBox = (QDialog*)aDlg ;
- return ;
+ return 0;
}