From 23428300f04f650f789a6ec9f81295de4e0f3160 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 14 May 2010 13:14:54 +0000 Subject: [PATCH] Merge results of improvement 0020465: CEA 335] sort tables in visualisation mode from V5_1_main branch --- configure.ac | 2 - doc/salome/gui/VISU/images/viewtable.png | Bin 13295 -> 31447 bytes .../gui/VISU/input/table_presentations.doc | 19 + idl/VISU_Gen.idl | 51 + resources/SalomeApp.xml | 2 + src/GUITOOLS/Makefile.am | 49 - src/GUITOOLS/VisuGUITools.h | 47 - src/GUITOOLS/VisuGUI_TableDlg.cxx | 1073 -------------- src/GUITOOLS/VisuGUI_TableDlg.h | 150 -- src/Makefile.am | 2 +- src/VISUGUI/Makefile.am | 17 +- src/VISUGUI/VISU_images.ts | 32 - src/VISUGUI/VISU_msg_en.ts | 499 ++----- src/VISUGUI/VisuGUI.cxx | 50 +- src/VISUGUI/VisuGUI_CutLinesDlg.cxx | 2 +- src/VISUGUI/VisuGUI_CutPlanesDlg.cxx | 2 +- src/VISUGUI/VisuGUI_GaussPointsDlg.cxx | 13 +- src/VISUGUI/VisuGUI_GaussPointsDlg.h | 10 +- .../VisuGUI_PrimitiveBox.cxx} | 83 +- .../VisuGUI_PrimitiveBox.h} | 32 +- .../VisuGUI_SizeBox.cxx} | 98 +- .../VisuGUI_SizeBox.h} | 36 +- src/VISU_I/Makefile.am | 13 +- src/VISU_I/VISU_TableDlg.cxx | 1234 +++++++++++++++++ src/VISU_I/VISU_TableDlg.h | 184 +++ src/VISU_I/VISU_Table_i.cc | 121 ++ src/VISU_I/VISU_Table_i.hh | 17 +- src/VISU_I/VISU_ViewManager_i.cc | 158 ++- src/VISU_I/VISU_ViewManager_i.hh | 4 +- src/VISU_I/VISU_View_i.cc | 30 +- src/VISU_I/VISU_View_i.hh | 4 +- src/VVTK/Makefile.am | 65 - src/VVTK/VVTK.h | 34 - src/VVTK/VVTK_ImageWriter.cxx | 114 -- src/VVTK/VVTK_ImageWriter.h | 62 - src/VVTK/VVTK_ImageWriterMgr.cxx | 105 -- src/VVTK/VVTK_ImageWriterMgr.h | 64 - src/VVTK/VVTK_InteractorStyle.cxx | 292 ---- src/VVTK/VVTK_InteractorStyle.h | 148 -- src/VVTK/VVTK_MainWindow.cxx | 474 ------- src/VVTK/VVTK_MainWindow.h | 201 --- src/VVTK/VVTK_PickingDlg.cxx | 717 ---------- src/VVTK/VVTK_PickingDlg.h | 140 -- src/VVTK/VVTK_Recorder.cxx | 490 ------- src/VVTK/VVTK_Recorder.h | 165 --- src/VVTK/VVTK_RecorderDlg.cxx | 228 --- src/VVTK/VVTK_RecorderDlg.h | 83 -- src/VVTK/VVTK_Renderer.cxx | 437 ------ src/VVTK/VVTK_Renderer.h | 179 --- src/VVTK/VVTK_SegmentationCursorDlg.cxx | 859 ------------ src/VVTK/VVTK_SegmentationCursorDlg.h | 199 --- src/VVTK/VVTK_ViewManager.cxx | 49 - src/VVTK/VVTK_ViewManager.h | 49 - src/VVTK/VVTK_ViewModel.cxx | 124 -- src/VVTK/VVTK_ViewModel.h | 76 - src/VVTK/VVTK_ViewWindow.cxx | 324 ----- src/VVTK/VVTK_ViewWindow.h | 155 --- 57 files changed, 2031 insertions(+), 7836 deletions(-) delete mode 100644 src/GUITOOLS/Makefile.am delete mode 100755 src/GUITOOLS/VisuGUITools.h delete mode 100644 src/GUITOOLS/VisuGUI_TableDlg.cxx delete mode 100644 src/GUITOOLS/VisuGUI_TableDlg.h rename src/{VVTK/VVTK_PrimitiveBox.cxx => VISUGUI/VisuGUI_PrimitiveBox.cxx} (81%) rename src/{VVTK/VVTK_PrimitiveBox.h => VISUGUI/VisuGUI_PrimitiveBox.h} (83%) rename src/{VVTK/VVTK_SizeBox.cxx => VISUGUI/VisuGUI_SizeBox.cxx} (78%) rename src/{VVTK/VVTK_SizeBox.h => VISUGUI/VisuGUI_SizeBox.h} (80%) create mode 100644 src/VISU_I/VISU_TableDlg.cxx create mode 100644 src/VISU_I/VISU_TableDlg.h delete mode 100755 src/VVTK/Makefile.am delete mode 100755 src/VVTK/VVTK.h delete mode 100755 src/VVTK/VVTK_ImageWriter.cxx delete mode 100755 src/VVTK/VVTK_ImageWriter.h delete mode 100755 src/VVTK/VVTK_ImageWriterMgr.cxx delete mode 100755 src/VVTK/VVTK_ImageWriterMgr.h delete mode 100644 src/VVTK/VVTK_InteractorStyle.cxx delete mode 100644 src/VVTK/VVTK_InteractorStyle.h delete mode 100644 src/VVTK/VVTK_MainWindow.cxx delete mode 100644 src/VVTK/VVTK_MainWindow.h delete mode 100644 src/VVTK/VVTK_PickingDlg.cxx delete mode 100644 src/VVTK/VVTK_PickingDlg.h delete mode 100755 src/VVTK/VVTK_Recorder.cxx delete mode 100755 src/VVTK/VVTK_Recorder.h delete mode 100644 src/VVTK/VVTK_RecorderDlg.cxx delete mode 100644 src/VVTK/VVTK_RecorderDlg.h delete mode 100644 src/VVTK/VVTK_Renderer.cxx delete mode 100644 src/VVTK/VVTK_Renderer.h delete mode 100644 src/VVTK/VVTK_SegmentationCursorDlg.cxx delete mode 100644 src/VVTK/VVTK_SegmentationCursorDlg.h delete mode 100644 src/VVTK/VVTK_ViewManager.cxx delete mode 100644 src/VVTK/VVTK_ViewManager.h delete mode 100644 src/VVTK/VVTK_ViewModel.cxx delete mode 100644 src/VVTK/VVTK_ViewModel.h delete mode 100755 src/VVTK/VVTK_ViewWindow.cxx delete mode 100755 src/VVTK/VVTK_ViewWindow.h diff --git a/configure.ac b/configure.ac index 0edb7812..3ec4903b 100644 --- a/configure.ac +++ b/configure.ac @@ -385,8 +385,6 @@ AC_OUTPUT([ \ src/CONVERTOR/Makefile \ src/PIPELINE/Makefile \ src/OBJECT/Makefile \ - src/VVTK/Makefile \ - src/GUITOOLS/Makefile \ src/VISU_I/Makefile \ src/VISUGUI/Makefile \ src/VISU_SWIG/Makefile \ diff --git a/doc/salome/gui/VISU/images/viewtable.png b/doc/salome/gui/VISU/images/viewtable.png index 13a0e5da3db65786103f013789269b92899068ec..697cdd310b6321845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M-1!71x05DMUJW{G_zADO#`7Arf>9a4<;sEHQ?=MEAzzpCLdxWYDt;~~ zS={+&b95BBs9AkXS!DZoy&k=(8%eQv0YJZif}>r-if9kfS+7{|UU;U5itEWv+WBtP zX)k!xZQHR8(I9Ot*xV#4L&4t{nOb}jz;Xnx`cLlCX+;g965mZn+As*2VgaVZ{PL)s zo6O|fP1uEZW%A~1;8kZRKE~ESZbOtrQPovVF>H1g|;p*cX1My{1pPdtRu4AuMNOL@a}kM zitSkMx`4|*+PXFj7+D8_wKx$K8JV>w`@p4DN4Y9mgVg|~x diff --git a/doc/salome/gui/VISU/input/table_presentations.doc b/doc/salome/gui/VISU/input/table_presentations.doc index 82dc0c96..2e5f9b5c 100644 --- a/doc/salome/gui/VISU/input/table_presentations.doc +++ b/doc/salome/gui/VISU/input/table_presentations.doc @@ -27,6 +27,25 @@ in the context menu. \image html viewtable.png +When the Enable editing option is checked, the table contents are editable. +\note At the current moment this mode only allows to sort table data. +The sorting is performed by clicking on the header of the column, by which the data +is sorted. + +Sort policy option allows to specify how the empty cells will be processed +during the sort procedure. The following options are available: +

    +
  • Empty cells are considered as lowest values
  • +
  • Empty cells are considered as highest values
  • +
  • Empty cells are always first
  • +
  • Empty cells are always last
  • +
  • Empty cells are ignored (this means that the positions of empty cells +will not change after the sorting)
  • +
+ +Adjust Cells button allows to adjust the size of table cells according +to their contents. + It is also possible to create \subpage table_3d_page "Table 3D presentation" basing on the table data and display it in the VTK viewer. diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 8946a982..d857637b 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -78,6 +78,25 @@ module VISU { NONE /*!< Indicates undefined entity value */ }; + /*! + * Tables' sort order + */ + enum SortOrder { + AscendingOrder, /*!< The table items are sorted ascending */ + DescendingOrder /*!< The table items are sorted descending */ + }; + + /*! + * Tables' sort policy (specifies how empty cells are taken into account when sorting) + */ + enum SortPolicy { + EmptyLowest, /*!< Empty cells are considered as lowest values */ + EmptyHighest, /*!< Empty cells are considered as highest values */ + EmptyFirst, /*!< Empty cells are always first */ + EmptyLast, /*!< Empty cells are always last */ + EmptyIgnore /*!< Empty cells are ignored (stay at initial positions) */ + }; + /*! * This enumeration contains a set of elements defining the type of the %VISU object. * This enumeration is used for navigation between a set of %VISU interfaces. @@ -1260,6 +1279,38 @@ module VISU { * \return Long value corresponding to the number of columns of the table */ long GetNbColumns(); + + /*! + * Sorts the specified row of the table. + * \param theRow Index of the row to sort + * \param theSortOrder Sort order (see SortOrder enumeration) + * \param theSortPolicy Sort policy (see SortPolicy enumeration) + */ + void SortRow(in long theRow, in SortOrder theSortOrder, in SortPolicy theSortPolicy); + + /*! + * Sorts the specified column of the table. + * \param theRow Index of the column to sort + * \param theSortOrder Sort order (see SortOrder enumeration) + * \param theSortPolicy Sort policy (see SortPolicy enumeration) + */ + void SortColumn(in long theColumn, in SortOrder theSortOrder, in SortPolicy theSortPolicy); + + /*! + * Sorts the table by the specified row. + * \param theRow Index of the row, by which the table has to be sort + * \param theSortOrder Sort order (see SortOrder enumeration) + * \param theSortPolicy Sort policy (see SortPolicy enumeration) + */ + void SortByRow(in long theRow, in SortOrder theSortOrder, in SortPolicy theSortPolicy); + + /*! + * Sorts the table by the specified column. + * \param theColumn Index of the column, by which the table has to be sort + * \param theSortOrder Sort order (see SortOrder enumeration) + * \param theSortPolicy Sort policy (see SortPolicy enumeration) + */ + void SortByColumn(in long theColumn, in SortOrder theSortOrder, in SortPolicy theSortPolicy); }; //------------------------------------------------------- diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index aa37a110..590dc43a 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -63,6 +63,8 @@ + + diff --git a/src/GUITOOLS/Makefile.am b/src/GUITOOLS/Makefile.am deleted file mode 100644 index 3182f1a8..00000000 --- a/src/GUITOOLS/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# VISU VISUGUI : GUI of VISU component -# File : Makefile.in -# Author : Marc Tajchman (CEA) -# Module : VISU -# $Header$ -# -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES= libVISUGUITOOLS.la - -salomeinclude_HEADERS= \ - VisuGUI_TableDlg.h \ - VisuGUITools.h - -dist_libVISUGUITOOLS_la_SOURCES= VisuGUI_TableDlg.cxx - -MOC_FILES= VisuGUI_TableDlg_moc.cxx -nodist_libVISUGUITOOLS_la_SOURCES=$(MOC_FILES) - -# additionnal information to compil and link file -libVISUGUITOOLS_la_CPPFLAGS= -ftemplate-depth-32 \ - $(QT_INCLUDES) $(VTK_INCLUDES) @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ - $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \ - $(KERNEL_CXXFLAGS) $(GUI_CXXFLAGS) $(BOOST_CPPFLAGS) - -libVISUGUITOOLS_la_LDFLAGS= \ - $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ - $(GUI_LDFLAGS) -lCAM -lsuit -lqtx diff --git a/src/GUITOOLS/VisuGUITools.h b/src/GUITOOLS/VisuGUITools.h deleted file mode 100755 index 87537d69..00000000 --- a/src/GUITOOLS/VisuGUITools.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VisuGUITools.h -// Author : Oleg UVAROV -// Module : VISU -// -#ifndef _VisuGUITools_H_ -#define _VisuGUITools_H_ - -#ifdef WNT - #if defined VISU_GUITOOLS_EXPORTS || defined VISUGUITOOLS_EXPORTS - #if defined WIN32 - #define VISU_GUITOOLS_EXPORT __declspec( dllexport ) - #else - #define VISU_GUITOOLS_EXPORT - #endif - #else - #if defined WIN32 - #define VISU_GUITOOLS_EXPORT __declspec( dllimport ) - #else - #define VISU_GUITOOLS_EXPORT - #endif - #endif -#else - #define VISU_GUITOOLS_EXPORT -#endif - -#endif diff --git a/src/GUITOOLS/VisuGUI_TableDlg.cxx b/src/GUITOOLS/VisuGUI_TableDlg.cxx deleted file mode 100644 index cc5a8b70..00000000 --- a/src/GUITOOLS/VisuGUI_TableDlg.cxx +++ /dev/null @@ -1,1073 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VisuGUI_TableDlg.cxx -// Author : Vadim SANDLER -// Module : SALOME -// -#include "VisuGUI_TableDlg.h" - -#include "SUIT_Tools.h" -#include "SUIT_MessageBox.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" - -#include "LightApp_Application.h" - -#include "CAM_Module.h" - -#include "SALOMEDSClient_Study.hxx" -#include "SALOMEDSClient_GenericAttribute.hxx" -#include "SALOMEDSClient_AttributeTableOfInteger.hxx" -#include "SALOMEDSClient_AttributeTableOfReal.hxx" -#include "SALOMEDSClient_StudyBuilder.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "utilities.h" - -using namespace std; - -#define MARGIN_SIZE 11 -#define SPACING_SIZE 6 -#define SPACER_SIZE 5 -#define MIN_TABLE_WIDTH 200 -#define MIN_TABLE_HEIGHT 200 - -NumDelegateItem::NumDelegateItem( QObject* parent, NumValidator mode ) - : QItemDelegate( parent ), - myMode( mode ) -{ -} - -NumDelegateItem::~NumDelegateItem() -{ -} - -QWidget * NumDelegateItem::createEditor( QWidget * parent, - const QStyleOptionViewItem & option, - const QModelIndex & index ) const -{ - QLineEdit *editor = new QLineEdit(parent); - switch ( myMode ) - { - case NV_Int: - editor->setValidator( new QIntValidator( editor ) ); - break; - case NV_Real: - editor->setValidator( new QDoubleValidator( editor ) ); - break; - default: - editor->setText( "No validator!" ); - } - - return editor; -} - -void NumDelegateItem::setEditorData( QWidget * editor, - const QModelIndex & index ) const -{ - QLineEdit *aLE = qobject_cast(editor); - if ( !aLE ) - return; - - switch ( myMode ) - { - case NV_Int: - { - int value = index.model()->data(index, Qt::DisplayRole).toInt(); - aLE->setText( QString("%1").arg( value ) ); - break; - } - case NV_Real: - { - double value = index.model()->data(index, Qt::DisplayRole).toDouble(); - aLE->setText( QString("%1").arg( value ) ); - break; - } - default: - aLE->setText( "No validator!!!" ); - } -} - - - - - -/*class VisuGUI_Table : public QTableWidget { -public: - VisuGUI_Table( Orientation orient, QWidget* parent = 0 ) - : QTableWidget( parent ), myValidator( 0 ), myOrientation( orient ) {} - VisuGUI_Table( Orientation orient, int numRows, int numCols, QWidget* parent = 0 ) - : QTableWidget( numRows, numCols, parent ), myValidator( 0 ), myOrientation( orient ) {} - - void setValidator( QValidator* v = 0 ) { myValidator = v; } - bool isEditing() const { return QTable::isEditing(); } - -protected: - QWidget* createEditor ( int row, int col, bool initFromCell ) const - { - bool testUnits = ( myOrientation == Qt::Horizontal && col == 0 ) || ( myOrientation == Qt::Vertical && row == 0 ); - QWidget* wg = QTable::createEditor( row, col, initFromCell ); - if ( wg && wg->inherits("QLineEdit") && myValidator && !testUnits ) - (( QLineEdit*)wg)->setValidator( myValidator ); - return wg; - } - -protected: - QValidator* myValidator; - Orientation myOrientation; - };*/ - -/*! - Constructor -*/ -VisuGUI_TableDlg::VisuGUI_TableDlg( QWidget* parent, - _PTR(SObject) obj, - bool edit, - int which, - Qt::Orientation orient, - bool showColumnTitles ) - : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), - myIntTable( 0 ), myRealTable( 0 ) -{ - setWindowTitle( edit ? tr( "EDIT_TABLE_TLT" ) : tr( "VIEW_TABLE_TLT" ) ); - setSizeGripEnabled( true ); - - myObject = obj; - bool bHasIntTable = false; - bool bHasRealTable = false; - if ( myObject ) { - _PTR(GenericAttribute) anAttr; - bHasIntTable = myObject->FindAttribute( anAttr, "AttributeTableOfInteger"); - bHasRealTable = myObject->FindAttribute( anAttr, "AttributeTableOfReal"); - } - - QVBoxLayout* mainLayout = new QVBoxLayout( this ); - mainLayout->setMargin( MARGIN_SIZE ); - mainLayout->setSpacing( SPACING_SIZE ); - - bool bDoInt = which == ttInt || which == ttBoth || which == ttAuto && bHasIntTable; - bool bDoReal = which == ttReal || which == ttBoth || which == ttAuto && bHasRealTable; - - QWidget* top; - QVBoxLayout* tl; - if ( bDoInt && bDoReal ) { - top = new QTabWidget( this ); - //( ( QTabWidget* ) top) ->setMargin( MARGIN_SIZE ); - } - else { - top = new QWidget( this ); - tl = new QVBoxLayout( top ); tl->setMargin( 0 ); tl->setSpacing( SPACING_SIZE ); - } - - if ( bDoInt ) { - myIntTable = new VisuGUI_TableWidget( top, "myIntTable", edit, orient, showColumnTitles ); - //myIntTable->getTable()->setValidator( new QIntValidator( this ) ); - //QAbstractItemDelegate* item = myIntTable->getTable()->itemDelegate(); - myIntTable->getTable()->setItemDelegate( new NumDelegateItem( myIntTable, NumDelegateItem::NV_Int ) ); - //item->deleteLater(); - - if ( bDoInt && bDoReal ) - ( ( QTabWidget* )top )->addTab( myIntTable, tr( "TABLE_OF_INTEGER_TLT" ) ); - else - tl->addWidget( myIntTable ); - } - if ( bDoReal ) { - myRealTable = new VisuGUI_TableWidget( top, "myRealTable", edit, orient, showColumnTitles ); - //myRealTable->getTable()->setValidator( new QDoubleValidator( this ) ); - //QAbstractItemDelegate* item = myIntTable->getTable()->itemDelegate(); - myRealTable->getTable()->setItemDelegate( new NumDelegateItem( myRealTable, NumDelegateItem::NV_Real ) ); - //item->deleteLater(); - if ( bDoInt && bDoReal ) - ( ( QTabWidget* )top )->addTab( myRealTable, tr( "TABLE_OF_REAL_TLT" ) ); - else - tl->addWidget( myRealTable ); - } - if ( !bDoInt && !bDoReal ) { - QLabel *dumbLabel = new QLabel( tr( "ERR_TABLE_NOT_AVAILABLE" ), top ); - dumbLabel->setAlignment( Qt::AlignCenter ); - tl->addWidget( dumbLabel ); - } - - QHBoxLayout* btnLayout = new QHBoxLayout; - btnLayout->setMargin( 0 ); btnLayout->setSpacing( SPACING_SIZE ); - - myOKBtn = new QPushButton( tr( "BUT_OK" ), this ); - myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this ); - if ( edit ) { - myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this ); - btnLayout->addWidget( myOKBtn ); - btnLayout->addItem( new QSpacerItem( SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - btnLayout->addWidget( myCancelBtn ); - btnLayout->addWidget( myHelpBtn ); - connect( myOKBtn, SIGNAL( clicked() ), this, SLOT( onOK() ) ); - connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); - } - else { - btnLayout->addWidget( myOKBtn ); - btnLayout->addItem( new QSpacerItem( SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - btnLayout->addWidget( myHelpBtn ); - connect( myOKBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); - } - connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); - - mainLayout->addWidget( top ); - mainLayout->addLayout( btnLayout ); - - initDlg(); - resize( 500, 400 ); - SUIT_Tools::centerWidget( this, parent ); -} - -/*! - Destructor -*/ -VisuGUI_TableDlg::~VisuGUI_TableDlg() -{ -} - -/*! - button slot, saves table(s) - Called only in create/edit mode ( parameter for constructor is true ) -*/ -void VisuGUI_TableDlg::onOK() -{ - myOKBtn->setFocus(); // accept possible changes - bool done = true; - - if ( myObject ) { - _PTR(Study) study = myObject->GetStudy(); - _PTR(AttributeTableOfInteger) tblIntAttr; - _PTR(AttributeTableOfReal) tblRealAttr; - - if ( study ) { - _PTR(StudyBuilder) builder = study->NewBuilder(); - builder->NewCommand(); // start transaction !!!!!!!!!!!!!!!!!!!!!!!!!!!!! - try { - if ( myIntTable ) { - builder->RemoveAttribute( myObject, "AttributeTableOfInteger" ); - tblIntAttr = builder->FindOrCreateAttribute( myObject, "AttributeTableOfInteger" ); - - int i; - int nbRows = myIntTable->getNumRows(); - int nbCols = myIntTable->getNumCols(); - QString tlt = myIntTable->getTableTitle(); - QStringList rowTitles, colTitles, units; - myIntTable->getRowTitles( rowTitles ); - myIntTable->getColTitles( colTitles ); - myIntTable->getUnits( units ); - - if ( nbRows > 0) { - // data - int nRow = 0; - tblIntAttr->SetNbColumns( nbCols ); - for ( i = 0; i < nbRows; i++ ) { - QStringList data; - myIntTable->getRowData( i, data ); - bool bEmptyRow = true; - for ( int j = 0; j < data.count(); j++ ) { - if ( !data[ j ].isNull() ) { - tblIntAttr->PutValue( data[ j ].toInt(), nRow+1, j+1 ); - bEmptyRow = false; - } - } - if ( !bEmptyRow ) { // Skip rows with no data !!! - // set row title - tblIntAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? "" : (const char*)rowTitles[ i ].toLatin1() ); - // set row unit - tblIntAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? "" : (const char*)units[ i ].toLatin1() ); - nRow++; - } - } - if ( nRow > 0 ) { // Set columns only if table is not empty, otherwise exception is raised !!! - // column titles - for ( i = 0; i < colTitles.count(); i++ ) - tblIntAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? "" : (const char*)colTitles[ i ].toLatin1() ); - } - } - // title - tblIntAttr->SetTitle( (const char*)myIntTable->getTableTitle().toLatin1() ); - } - if ( myRealTable ) { - builder->RemoveAttribute( myObject, "AttributeTableOfReal" ); - tblRealAttr = builder->FindOrCreateAttribute( myObject, "AttributeTableOfReal" ); - - int i; - int nbRows = myRealTable->getNumRows(); - int nbCols = myRealTable->getNumCols(); - QString tlt = myRealTable->getTableTitle(); - QStringList rowTitles, colTitles, units; - myRealTable->getRowTitles( rowTitles ); - myRealTable->getColTitles( colTitles ); - myRealTable->getUnits( units ); - - if ( nbRows > 0) { - // data - int nRow = 0; - tblRealAttr->SetNbColumns( nbCols ); - for ( i = 0; i < nbRows; i++ ) { - QStringList data; - myRealTable->getRowData( i, data ); - bool bEmptyRow = true; - for ( int j = 0; j < data.count(); j++ ) { - if ( !data[ j ].isNull() ) { - tblRealAttr->PutValue( data[ j ].toDouble(), nRow+1, j+1 ); - bEmptyRow = false; - } - } - if ( !bEmptyRow ) { // Skip rows with no data !!! - // set row title - tblRealAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? "" : (const char*)rowTitles[ i ].toLatin1() ); - // set row unit - tblRealAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? "" : (const char*)units[ i ].toLatin1() ); - nRow++; - } - } - if ( nRow > 0 ) { // Set columns only if table is not empty, otherwise exception is raised !!! - // column titles - for ( i = 0; i < colTitles.count(); i++ ) - tblRealAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? "" : (const char*)colTitles[ i ].toLatin1() ); - } - } - // title - tblRealAttr->SetTitle( (const char*)myRealTable->getTableTitle().toLatin1() ); - } - if ( myIntTable || myRealTable) - builder->CommitCommand(); // commit transaction !!!!!!!!!!!!!!!!!!!!!!!!!!! - else - builder->AbortCommand(); // abort transaction !!!!!!!!!!!!!!!!!!!!!!!!!!! - } - catch( ... ) { - MESSAGE("VisuGUI_TableDlg::onOK : Exception has been caught !!!"); - builder->AbortCommand(); // abort transaction !!!!!!!!!!!!!!!!!!!!!!!!!!! - done = false; - SUIT_MessageBox::critical ( this, tr("ERR_ERROR"), tr("ERR_APP_EXCEPTION") ); - } - } - } - if ( done ) - accept(); -} - -/*! - button slot, shows corresponding help page -*/ -void VisuGUI_TableDlg::onHelp() -{ - QString aHelpFileName = "table_presentations_page.html"; - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); - else { - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) ); - } -} - -/*! - Populates table with data -*/ -void VisuGUI_TableDlg::initDlg() -{ - int i, j; - if ( myObject ) { - _PTR(GenericAttribute) anAttr; - _PTR(AttributeTableOfInteger) tblIntAttr; - _PTR(AttributeTableOfReal) tblRealAttr; - if ( myObject->FindAttribute( anAttr, "AttributeTableOfInteger") ) { - tblIntAttr = anAttr; - } - if ( myObject->FindAttribute( anAttr, "AttributeTableOfReal") ) { - tblRealAttr = anAttr; - } - // Table of integer - if ( tblIntAttr && myIntTable ) { - try { - // title - myIntTable->setTableTitle( tblIntAttr->GetTitle().c_str() ); - // nb of rows & cols - int nbRows = tblIntAttr->GetNbRows() ; - int nbCols = tblIntAttr->GetNbColumns(); - myIntTable->setNumRows( nbRows ); - myIntTable->setNumCols( nbCols ); - // rows titles - QStringList strlist; - vector rowTitles = tblIntAttr->GetRowTitles(); - for ( i = 0; i < nbRows; i++ ) { - if ( rowTitles.size() > 0 ) - strlist.append( rowTitles[i].c_str() ); - else - strlist.append( "" ); - } - myIntTable->setRowTitles( strlist ); - // columns titles - strlist.clear(); - vector colTitles = tblIntAttr->GetColumnTitles(); - for ( i = 0; i < nbCols; i++ ) { - if ( colTitles.size() > 0 ) - strlist.append( colTitles[i].c_str() ); - else - strlist.append( "" ); - } - myIntTable->setColTitles( strlist ); - // units - strlist.clear(); - vector rowUnits = tblIntAttr->GetRowUnits(); - if ( rowUnits.size() > 0 ) { - for ( i = 0; i < nbRows; i++ ) - strlist.append( rowUnits[i].c_str() ); - myIntTable->setUnits( strlist ); - } - // data - for ( i = 1; i <= nbRows; i++ ) { - strlist.clear(); - for ( j = 1; j <= nbCols; j++ ) { - if ( tblIntAttr->HasValue( i, j ) ) - strlist.append( QString::number( tblIntAttr->GetValue( i, j ) ) ); - else - strlist.append( QString::null ); - } - myIntTable->setRowData( i-1, strlist ); - } - myIntTable->adjustTable(); - } - catch( ... ) { - MESSAGE("VisuGUI_TableDlg::initDlg : Exception has been caught !!!"); - } - } - // Table of real - if ( tblRealAttr && myRealTable ) { - try { - // title - myRealTable->setTableTitle( tblRealAttr->GetTitle().c_str() ); - // nb of rows & cols - int nbRows = tblRealAttr->GetNbRows() ; - int nbCols = tblRealAttr->GetNbColumns(); - myRealTable->setNumRows( nbRows ); - myRealTable->setNumCols( nbCols ); - // rows titles - QStringList strlist; - vector rowTitles = tblRealAttr->GetRowTitles(); - for ( i = 0; i < nbRows; i++ ) { - if ( rowTitles.size() > 0 ) - strlist.append( rowTitles[i].c_str() ); - else - strlist.append( "" ); - } - myRealTable->setRowTitles( strlist ); - // columns titles - strlist.clear(); - vector colTitles = tblRealAttr->GetColumnTitles(); - for ( i = 0; i < nbCols; i++ ) { - if ( colTitles.size() > 0 ) - strlist.append( colTitles[i].c_str() ); - else - strlist.append( "" ); - } - myRealTable->setColTitles( strlist ); - // units - strlist.clear(); - vector rowUnits = tblRealAttr->GetRowUnits(); - if ( rowUnits.size() > 0 ) { - for ( i = 0; i < nbRows; i++ ) - strlist.append( rowUnits[i].c_str() ); - myRealTable->setUnits( strlist ); - } - // data - for ( i = 1; i <= nbRows; i++ ) { - strlist.clear(); - for ( j = 1; j <= nbCols; j++ ) { - if ( tblRealAttr->HasValue( i, j ) ) - strlist.append( QString::number( tblRealAttr->GetValue( i, j ) ) ); - else - strlist.append( QString::null ); - } - myRealTable->setRowData( i-1, strlist ); - } - myRealTable->adjustTable(); - } - catch( ... ) { - MESSAGE("VisuGUI_TableDlg::initDlg : Exception has been caught !!!"); - } - } - } -} - -/*! - Provides help on F1 button click -*/ -void VisuGUI_TableDlg::keyPressEvent( QKeyEvent* e ) -{ - QDialog::keyPressEvent( e ); - if ( e->isAccepted() ) - return; - - if ( e->key() == Qt::Key_F1 ) - { - e->accept(); - onHelp(); - } -} - -/*! - Constructor -*/ -VisuGUI_TableWidget::VisuGUI_TableWidget( QWidget* parent, - const char* name, - bool edit, - Qt::Orientation orient, - bool showColumnTitles ) - : QWidget( parent ), myOrientation( orient ) -{ - QGridLayout* mainLayout = new QGridLayout( this ); - mainLayout->setMargin( 0 ); - mainLayout->setSpacing( SPACING_SIZE ); - - myTitleEdit = new QLineEdit( this ); - myTitleEdit->setAlignment( Qt::AlignCenter ); - myTitleEdit->setReadOnly( !edit ); - QFont fnt = myTitleEdit->font(); - fnt.setBold( true ); - myTitleEdit->setFont( fnt ); - - //myTable = new VisuGUI_Table( orient, this ); - myTable = new QTableWidget( 5, 5, this ); - //myTable->setNumRows( 5 ); - //myTable->setNumCols( 5 ); - myTable->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); - myTable->setMinimumSize( MIN_TABLE_WIDTH, MIN_TABLE_HEIGHT ); - myTable->setSelectionMode( QAbstractItemView::SingleSelection ); - myTable->setShowGrid( true ); - myTable->horizontalHeader()->setMovable( false ); - myTable->verticalHeader()->setMovable( false ); - //myTable->setColumnMovingEnabled( false ); - //myTable->setRowMovingEnabled( false ); - myTable->setDragEnabled( false ); - //myTable->setReadOnly( !edit ); - myTable->setEditTriggers( edit ? QAbstractItemView::AllEditTriggers : QAbstractItemView::NoEditTriggers ); - - setUnitsTitle( tr( "UNITS_TLT" ) ); - - if ( !showColumnTitles ) { - if ( myOrientation == Qt::Horizontal ) { - myTable->horizontalHeader()->hide(); - //myTable->setTopMargin( 0 ); - } - else { - myTable->verticalHeader()->hide(); - //myTable->setLeftMargin( 0 ); - } - } - - mainLayout->addWidget( myTitleEdit, 0, 0 ); - mainLayout->addWidget( myTable, 1, 0 ); - - if ( edit ) { - myAddRowBtn = new QPushButton( tr( "ADD_ROW_BTN" ), this ); - myDelRowBtn = new QPushButton( tr( "REMOVE_ROW_BTN" ), this ); - myAddColBtn = new QPushButton( tr( "ADD_COLUMN_BTN" ), this ); - myDelColBtn = new QPushButton( tr( "REMOVE_COLUMN_BTN" ), this ); - myAdjustBtn = new QPushButton( tr( "ADJUST_CELLS_BTN" ), this ); - mySelectAllBtn = new QPushButton( tr( "SELECT_ALL_BTN" ), this ); - myClearBtn = new QPushButton( tr( "CLEAR_BTN"), this ); - QVBoxLayout* btnLayout = new QVBoxLayout; btnLayout->setMargin( 0 ); btnLayout->setSpacing( SPACING_SIZE ); - btnLayout->addWidget( myAddRowBtn ); - btnLayout->addWidget( myDelRowBtn ); - btnLayout->addWidget( myAddColBtn ); - btnLayout->addWidget( myDelColBtn ); - btnLayout->addStretch(); - btnLayout->addWidget( myAdjustBtn ); - btnLayout->addStretch(); - btnLayout->addWidget( mySelectAllBtn ); - btnLayout->addWidget( myClearBtn ); - mainLayout->addLayout( btnLayout, 1, 1 ); - connect( myTable, SIGNAL( selectionChanged() ), this, SLOT( updateButtonsState() ) ); - connect( myTable, SIGNAL( currentChanged( int, int) ), this, SLOT( updateButtonsState() ) ); - connect( myAddRowBtn, SIGNAL( clicked() ), this, SLOT( addRow() ) ); - connect( myAddColBtn, SIGNAL( clicked() ), this, SLOT( addCol() ) ); - connect( myDelRowBtn, SIGNAL( clicked() ), this, SLOT( delRow() ) ); - connect( myDelColBtn, SIGNAL( clicked() ), this, SLOT( delCol() ) ); - connect( myAdjustBtn, SIGNAL( clicked() ), this, SLOT( adjustTable() ) ); - connect( mySelectAllBtn, SIGNAL( clicked() ), this, SLOT( selectAll() ) ); - connect( myClearBtn, SIGNAL( clicked() ), this, SLOT( clearTable() ) ); - myTable->horizontalHeader()->installEventFilter( this ); - myTable->verticalHeader()->installEventFilter( this ); - myTable->installEventFilter( this ); - } - updateButtonsState(); -} -/*! - Destructor -*/ -VisuGUI_TableWidget::~VisuGUI_TableWidget() -{ -} -/*! - Sets table title -*/ -void VisuGUI_TableWidget::setTableTitle( const QString& title ) -{ - myTitleEdit->setText( title ); -} -/*! - Gets table title -*/ -QString VisuGUI_TableWidget::getTableTitle() -{ - return myTitleEdit->text(); -} -/*! - Sets total number of rows -*/ -void VisuGUI_TableWidget::setNumRows( const int num ) -{ - myOrientation == Qt::Horizontal ? myTable->setRowCount( num ) : myTable->setColumnCount( num ); -} -/*! - Gets total number of rows -*/ -int VisuGUI_TableWidget::getNumRows() -{ - return myOrientation == Qt::Horizontal ? myTable->rowCount() : myTable->columnCount(); -} -/*! - Sets total number of columns -*/ -void VisuGUI_TableWidget::setNumCols( const int num ) -{ - // !!! first column contains units !!! - myOrientation == Qt::Horizontal ? myTable->setColumnCount( num+1 ) : myTable->setRowCount( num+1 ); -// myOrientation == Qt::Horizontal ? myTable->setColumnReadOnly( 0, true ) : myTable->setRowReadOnly( 0, true ); -} -/*! - Gets total number of columns -*/ -int VisuGUI_TableWidget::getNumCols() -{ - // !!! first column contains units !!! - return myOrientation == Qt::Horizontal ? myTable->columnCount()-1 : myTable->rowCount()-1; -} -/*! - Sets rows titles -*/ -void VisuGUI_TableWidget::setRowTitles( QStringList& tlts ) -{ - QStringList aLabels; - for ( int i = 0; i < tlts.count(); i++ ) - tlts[i].isNull() ? aLabels.append("") : aLabels.append( tlts[i] ); - - myOrientation == Qt::Horizontal ? - myTable->setVerticalHeaderLabels( aLabels ) : - myTable->setHorizontalHeaderLabels( aLabels ); - - // myTable->verticalHeader()->setLabel( i, tlts[i] ) : - //myTable->horizontalHeader()->setLabel( i, tlts[i] ); - //} -} -/*! - Gets rows titles -*/ -void VisuGUI_TableWidget::getRowTitles( QStringList& tlts ) -{ - tlts.clear(); - if ( myOrientation == Qt::Horizontal ) { - for ( int i = 0; i < myTable->rowCount(); i++ ) { - tlts.append( myTable->verticalHeaderItem(i) ? myTable->verticalHeaderItem(i)->text() : "" ); - } - } - else { - for ( int i = 0; i < myTable->columnCount(); i++ ) { - tlts.append( myTable->horizontalHeaderItem(i) ? myTable->horizontalHeaderItem(i)->text() : "" ); - } - } -} -/*! - Sets columns titles -*/ -void VisuGUI_TableWidget::setColTitles( QStringList& tlts ) -{ - QStringList aLabels; - - // !!! first column contains units !!! - aLabels.append(""); // it'll be initialized below - in setUnitsTitle() method - - for ( int i = 0; i < tlts.count(); i++ ) - tlts[i].isNull() ? aLabels.append("") : aLabels.append( tlts[i] ); - - myOrientation == Qt::Horizontal ? - myTable->setHorizontalHeaderLabels( aLabels ) : - myTable->setVerticalHeaderLabels( aLabels ); - - setUnitsTitle( tr( "UNITS_TLT" ) ); -} -/*! - Sets columns titles -*/ -void VisuGUI_TableWidget::getColTitles( QStringList& tlts ) -{ - // !!! first column contains units !!! - tlts.clear(); - if ( myOrientation == Qt::Horizontal ) { - for ( int i = 1; i < myTable->columnCount(); i++ ) { - tlts.append( myTable->horizontalHeaderItem(i) ? myTable->horizontalHeaderItem(i)->text() : "" ); - } - } - else { - for ( int i = 1; i < myTable->rowCount(); i++ ) { - tlts.append( myTable->verticalHeaderItem(i) ? myTable->verticalHeaderItem(i)->text() : "" ); - } - } -} -/*! - Sets units title -*/ -void VisuGUI_TableWidget::setUnitsTitle( const QString& tlt ) { - // !!! first column contains units !!! - myTable->model()->setHeaderData( 0, myOrientation, QVariant(tlt.isNull() ? "" : tlt), Qt::DisplayRole ); -} -/*! - Sets units -*/ -void VisuGUI_TableWidget::setUnits( QStringList& units ) -{ - QAbstractTableModel* aModel = qobject_cast( myTable->model() ); - if ( aModel ) - { - QModelIndex anIndex; - for ( int i = 0; i < units.count(); i++ ) - { - myOrientation == Qt::Horizontal ? - anIndex = aModel->index( i, 0 ) : - anIndex = aModel->index( 0, i ); - - aModel->setData( anIndex, QVariant( units[i].isNull() ? "" : units[i] ) ); - } - } -} -/*! - Gets units -*/ -void VisuGUI_TableWidget::getUnits( QStringList& units ) -{ - units.clear(); - QAbstractTableModel* aModel = qobject_cast( myTable->model() ); - if ( aModel ) - { - if ( myOrientation == Qt::Horizontal ) - { - for ( int i = 0; i < myTable->rowCount(); i++ ) - units.append( aModel->index( i, 0 ).data().toString() ); - } - else { - for ( int i = 0; i < myTable->columnCount(); i++ ) - units.append( aModel->index( 0, i ).data().toString() ); - } - } -} -/*! - Sets row data -*/ -void VisuGUI_TableWidget::setRowData( int row, QStringList& data ) -{ - QAbstractTableModel* aModel = qobject_cast( myTable->model() ); - if ( aModel ) - { - QModelIndex anIndex; - if ( row >= 0 && row < getNumRows() ) { - for ( int i = 0; i < data.count(); i++ ) - { - myOrientation == Qt::Horizontal ? anIndex = aModel->index( row, i+1 ) : - anIndex = aModel->index( i+1, row ); - aModel->setData( anIndex, QVariant( data[i] ) ); - - } - } - } -} -/*! - Gets row data -*/ -void VisuGUI_TableWidget::getRowData( int row, QStringList& data ) -{ - data.clear(); - QAbstractTableModel* aModel = qobject_cast( myTable->model() ); - if ( aModel ) - { - if ( row >= 0 && row < getNumRows() ) - { - if ( myOrientation == Qt::Horizontal ) - { - for ( int i = 1; i < myTable->columnCount(); i++ ) - data.append( aModel->index( row, i ).data().toString() ); - } - else { - for ( int i = 1; i < myTable->rowCount(); i++ ) - data.append( aModel->index( i, row ).data().toString() ); - } - } - } -} -/*! - Adjusts table cell to see contents, button slot -*/ -void VisuGUI_TableWidget::adjustTable() -{ - myTable->resizeRowsToContents(); - myTable->resizeColumnsToContents(); -} -/*! - Called when selection changed in table -*/ -void VisuGUI_TableWidget::updateButtonsState() -{ - if ( myTable->editTriggers() == QAbstractItemView::NoEditTriggers ) - return; - bool bDR = false; // - bool bDC = false; // - bool bSA = false; // button slot -*/ -void VisuGUI_TableWidget::selectAll() -{ - /*myTable->clearSelection(); - QTableSelection ts; - ts.init( 0, 0 ); ts.expandTo( myTable->numRows()-1, myTable->numCols()-1 ); - myTable->addSelection( ts );*/ - myTable->selectAll(); - updateButtonsState(); -} -/*! - button slot -*/ -void VisuGUI_TableWidget::clearTable() -{ - /*int nbSel = myTable->numSelections(); - for ( int i = 0; i < nbSel; i++ ) { - QTableSelection ts = myTable->selection( i ); - for ( int j = ts.topRow(); j < ts.bottomRow()+1; j++) { - if ( myOrientation == Qt::Vertical && j == 0 ) { -// continue; // UNITS - } - for ( int k = ts.leftCol(); k < ts.rightCol()+1; k++) { - if ( myOrientation == Qt::Horizontal && k == 0 ) { -// continue; // UNITS - } - myTable->clearCell( j, k ); - } - } - } - if ( nbSel == 0 ) - myTable->clearCell( myTable->currentRow(), myTable->currentColumn() ); - myTable->clearSelection();*/ - myTable->clearContents(); - updateButtonsState(); -} -/*! - Event filter - handles titles editing -*/ -bool VisuGUI_TableWidget::eventFilter( QObject* o, QEvent* e ) -{ - if ( e->type() == QEvent::MouseButtonDblClick) { - //TODO - /*QMouseEvent* me = ( QMouseEvent* )e; - if ( me->button() == Qt::LeftButton && (myTable->editTriggers() != QAbstractItemView::NoEditTriggers ) ) { - if ( o == myTable->horizontalHeader() ) { - for ( int i = 0; i < myTable->horizontalHeader()->count(); i++ ) { - QRect rect = myTable->horizontalHeader()->sectionRect( i ); - rect.addCoords( 1, 1, -1, -1 ); - if ( rect.contains( myTable->horizontalHeader()->mapFromGlobal( me->globalPos() ) ) ) { - if ( myOrientation == Qt::Vertical || i != 0 ) { - bool bOk; - QString tlt = QInputDialog::getText( tr( "SET_TITLE_TLT" ), - tr( "TITLE_LBL" ), - QLineEdit::Normal, - myTable->horizontalHeader()->label( i ), - &bOk, - this ); - if ( bOk && !tlt.isNull() ) - myTable->horizontalHeader()->setLabel( i, tlt ); - break; - } - } - } - } - if ( o == myTable->verticalHeader() ) { - for ( int i = 0; i < myTable->verticalHeader()->count(); i++ ) { - QRect rect = myTable->verticalHeader()->sectionRect( i ); - rect.addCoords( 1, 1, -1, -1 ); - if ( rect.contains( myTable->verticalHeader()->mapFromGlobal( me->globalPos() ) ) ) { - if ( myOrientation == Qt::Horizontal || i != 0 ) { - bool bOk; - QString tlt = QInputDialog::getText( tr( "SET_TITLE_TLT" ), - tr( "TITLE_LBL" ), - QLineEdit::Normal, - myTable->verticalHeader()->label( i ), - &bOk, - this ); - if ( bOk && !tlt.isNull() ) - myTable->verticalHeader()->setLabel( i, tlt ); - break; - } - } - } - } - }*/ - } - else if ( e->type() == QEvent::KeyRelease && o == myTable ) { - QKeyEvent* ke = (QKeyEvent*)e; - if ( ke->key() == Qt::Key_Delete && (myTable->editTriggers() != QAbstractItemView::NoEditTriggers) ) { - clearTable(); - } - else if ( ke->key() == Qt::Key_Backspace && (myTable->editTriggers() != QAbstractItemView::NoEditTriggers) ) { - clearTable(); - int i = myTable->currentRow(); - int j = myTable->currentColumn() - 1; - if ( j < 0 ) { j = myTable->columnCount()-1; i--; } - if ( i >= 0 && j >= 0 ) - myTable->setCurrentCell( i, j ); - } - } - return QWidget::eventFilter( o, e ); -} diff --git a/src/GUITOOLS/VisuGUI_TableDlg.h b/src/GUITOOLS/VisuGUI_TableDlg.h deleted file mode 100644 index 702824af..00000000 --- a/src/GUITOOLS/VisuGUI_TableDlg.h +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VisuGUI_TableDlg.h -// Author : Vadim SANDLER -// Module : VISU -// -#ifndef VisuGUI_TABLE_DLG_H -#define VisuGUI_TABLE_DLG_H - -#include -#include -#include -#include - -class QTableWidget; -class VisuGUI_TableWidget; - -#include - -#include "VisuGUITools.h" - -class VISU_GUITOOLS_EXPORT VisuGUI_TableDlg : public QDialog -{ - Q_OBJECT - -public: - - enum { ttNone, ttInt, ttReal, ttBoth, ttAuto }; - - VisuGUI_TableDlg( QWidget* parent, - _PTR(SObject) obj, - bool edit = false, - int which = ttAuto, - Qt::Orientation orient = Qt::Horizontal, - bool showColumnTitles = true ); - ~VisuGUI_TableDlg(); - -private: - void keyPressEvent( QKeyEvent* e ); - -public slots: - void onOK(); - void onHelp(); - -private: - void initDlg(); - -private: - VisuGUI_TableWidget* myIntTable; - VisuGUI_TableWidget* myRealTable; - QPushButton* myOKBtn; - QPushButton* myCancelBtn; - QPushButton* myHelpBtn; - - _PTR(SObject) myObject; -}; - -class VISU_GUITOOLS_EXPORT VisuGUI_TableWidget : public QWidget -{ - Q_OBJECT -public: - VisuGUI_TableWidget( QWidget* parent = 0, - const char* name = 0, - bool edit = false, - Qt::Orientation orient = Qt::Horizontal, - bool showColumnTitles = true ); - ~VisuGUI_TableWidget(); - - void setTableTitle( const QString& title ); - QString getTableTitle(); - void setNumRows( const int num ); - int getNumRows(); - void setNumCols( const int num ); - int getNumCols(); - void setRowTitles( QStringList& tlts ); - void getRowTitles( QStringList& tlts ); - void setColTitles( QStringList& tlts ); - void getColTitles( QStringList& tlts ); - void setUnitsTitle( const QString& tlt ); - void setUnits( QStringList& units ); - void getUnits( QStringList& units ); - void setRowData( int row, QStringList& data ); - void getRowData( int row, QStringList& data ); - - QTableWidget* getTable() { return myTable; } - QLineEdit* getTitleEdit() { return myTitleEdit; } - - bool eventFilter( QObject* o, QEvent* e); - -public slots: - void updateButtonsState(); - void addRow(); - void addCol(); - void delRow(); - void delCol(); - void adjustTable(); - void selectAll(); - void clearTable(); - -private: - QLineEdit* myTitleEdit; - QTableWidget* myTable; - QPushButton* myAddRowBtn; - QPushButton* myAddColBtn; - QPushButton* myDelRowBtn; - QPushButton* myDelColBtn; - QPushButton* myAdjustBtn; - QPushButton* mySelectAllBtn; - QPushButton* myClearBtn; - Qt::Orientation myOrientation; -}; - -class VISU_GUITOOLS_EXPORT NumDelegateItem: public QItemDelegate -{ -public: - enum NumValidator{ NV_Int, NV_Real }; - - NumDelegateItem( QObject* parent, NumValidator mode = NV_Int ); - virtual ~NumDelegateItem(); - - virtual QWidget * createEditor( QWidget * parent, - const QStyleOptionViewItem & option, - const QModelIndex & index ) const; - virtual void setEditorData( QWidget * editor, - const QModelIndex & index ) const; -private: - int myMode; -}; - -#endif // VisuGUI_TABLE_DLG_H - diff --git a/src/Makefile.am b/src/Makefile.am index 356548cd..19cc6988 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,4 +21,4 @@ # # $Header$ # -SUBDIRS = CONVERTOR PIPELINE OBJECT VVTK GUITOOLS VISU_I VISUGUI VISU_SWIG ENGINE +SUBDIRS = CONVERTOR PIPELINE OBJECT VISU_I VISUGUI VISU_SWIG ENGINE diff --git a/src/VISUGUI/Makefile.am b/src/VISUGUI/Makefile.am index aff94dc9..731f9769 100644 --- a/src/VISUGUI/Makefile.am +++ b/src/VISUGUI/Makefile.am @@ -70,7 +70,9 @@ salomeinclude_HEADERS= \ VisuGUI_Slider.h \ VisuGUI_InputPane.h \ VisuGUI_FieldFilter.h \ - VisuGUI_ValuesLabelingDlg.h + VisuGUI_ValuesLabelingDlg.h \ + VisuGUI_PrimitiveBox.h \ + VisuGUI_SizeBox.h dist_libVISU_la_SOURCES= \ VisuGUI.cxx \ @@ -123,7 +125,9 @@ dist_libVISU_la_SOURCES= \ VisuGUI_ClippingPanel.cxx \ VisuGUI_ClippingPlaneDlg.cxx \ VisuGUI_FilterScalarsDlg.cxx \ - VisuGUI_ValuesLabelingDlg.cxx + VisuGUI_ValuesLabelingDlg.cxx \ + VisuGUI_PrimitiveBox.cxx \ + VisuGUI_SizeBox.cxx MOC_FILES= \ VisuGUI_moc.cxx \ @@ -169,7 +173,9 @@ MOC_FILES= \ VisuGUI_ClippingPanel_moc.cxx \ VisuGUI_ClippingPlaneDlg_moc.cxx \ VisuGUI_FilterScalarsDlg_moc.cxx \ - VisuGUI_ValuesLabelingDlg_moc.cxx + VisuGUI_ValuesLabelingDlg_moc.cxx \ + VisuGUI_PrimitiveBox_moc.cxx \ + VisuGUI_SizeBox_moc.cxx nodist_libVISU_la_SOURCES=$(MOC_FILES) @@ -182,7 +188,7 @@ libVISU_la_CPPFLAGS= \ $(BOOST_CPPFLAGS) \ $(GUI_CXXFLAGS) \ $(CORBA_CXXFLAGS) $(CORBA_INCLUDES) \ - -I$(srcdir)/../VVTK -I$(srcdir)/../OBJECT -I$(srcdir)/../VISU_I -I$(srcdir)/../GUITOOLS \ + -I$(srcdir)/../OBJECT -I$(srcdir)/../VISU_I \ -I$(top_builddir)/idl -I$(srcdir)/../CONVERTOR -I$(srcdir)/../PIPELINE libVISU_la_LDFLAGS= \ @@ -190,8 +196,7 @@ libVISU_la_LDFLAGS= \ $(CAS_LDFLAGS) -lTKV3d \ $(KERNEL_LDFLAGS) -lSalomeNS -lSalomeDSClient \ $(GUI_LDFLAGS) -lSVTK -lSPlot2d -lSalomePrs -lOCCViewer \ - ../VVTK/libVVTK.la ../OBJECT/libVisuObject.la ../VISU_I/libVISUEngineImpl.la \ - ../GUITOOLS/libVISUGUITOOLS.la \ + ../OBJECT/libVisuObject.la ../VISU_I/libVISUEngineImpl.la \ ../../idl/libSalomeIDLVISU.la if MED_ENABLE_MULTIPR diff --git a/src/VISUGUI/VISU_images.ts b/src/VISUGUI/VISU_images.ts index a5b74650..d7c807b7 100644 --- a/src/VISUGUI/VISU_images.ts +++ b/src/VISUGUI/VISU_images.ts @@ -327,42 +327,10 @@ ICON_VECTORS Visu_vectors.png - - ICON_VVTK_INTERACTOR_STYLE_SWITCH - Visu_vvtk_switch.png - - - ICON_VVTK_PLANE_SEGMENTATION_SWITCH - Visu_PlaneSegmentation.png - - - ICON_VVTK_RECORDING_PAUSE - Visu_recording_pause.png - - - ICON_VVTK_RECORDING_PLAY - Visu_recording_play.png - - - ICON_VVTK_RECORDING_START - Visu_recording_start.png - - - ICON_VVTK_RECORDING_STOP - Visu_recording_stop.png - ICON_SWEEP_STOP Visu_recording_stop.png - - ICON_VVTK_SELECTION_MODE_SWITCH - Visu_points.png - - - ICON_VVTK_SPHERE_SEGMENTATION_SWITCH - Visu_SphereSegmentation.png - ICON_WIREFRAME Visu_wireframe.png diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index 196b8f91..70dd065a 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -401,6 +401,42 @@ number of time stamps or number of components is not the same! VISU_SWEEPING_PREF Sweeping preferences + + VISU_TABLES + Tables + + + VISU_TABLES_EDITING_PROPS + Tables editing properties + + + VISU_TABLES_ENABLE_EDITING + Enable editing + + + VISU_TABLES_SORT_POLICY + Sort policy + + + VISU_TABLES_EMPTY_LOWEST + Empty cells are considered as lowest values + + + VISU_TABLES_EMPTY_HIGHEST + Empty cells are considered as highest values + + + VISU_TABLES_EMPTY_FIRST + Empty cells are always first + + + VISU_TABLES_EMPTY_LAST + Empty cells are always last + + + VISU_TABLES_EMPTY_IGNORE + Empty cells are ignored + VISU_TIME_STEP Time step(second) @@ -524,173 +560,7 @@ Do you want to enlarge the cache? - VVTK_MainWindow - - DSC_VVTK_RECORDING_PAUSE - Pause recording - - - DSC_VVTK_RECORDING_PLAY - Play recording - - - DSC_VVTK_RECORDING_START - Start recording - - - DSC_VVTK_RECORDING_STOP - Stop recording - - - LBL_TOOLBAR_RECORD_LABEL - Recording Operations - - - MNU_VVTK_RECORDING_PAUSE - Pause recording - - - MNU_VVTK_RECORDING_PLAY - Play recording - - - MNU_VVTK_RECORDING_START - Start recording - - - MNU_VVTK_RECORDING_STOP - Stop recording - - - MSG_NO_AVI_MAKER - Tool jpeg2yuv, necessary for AVI recording, is not available. -Please, refer to the documentation. - - - - VVTK_MainWindow1 - - DSC_VVTK_INTERACTOR_STYLE_SWITCH - Interaction Style Switch - - - DSC_VVTK_PLANE_SEGMENTATION_SWITCH - Plane Segmentation - - - DSC_VVTK_SELECTION_MODE_SWITCH - Selection Mode Switch - - - DSC_VVTK_SPHERE_SEGMENTATION_SWITCH - Sphere Segmentation - - - LBL_TOOLBAR_GAUSS_LABEL - Gauss Viewer Tools - - - MNU_VVTK_INTERACTOR_STYLE_SWITCH - Interaction Style Switch - - - MNU_VVTK_PLANE_SEGMENTATION_SWITCH - Plane Segmentation - - - MNU_VVTK_SELECTION_MODE_SWITCH - Selection Mode Switch - - - MNU_VVTK_SPHERE_SEGMENTATION_SWITCH - Sphere Segmentation - - - - VVTK_PickingDlg - - BELOW_POINT - Centered below the point - - - CAMERA_TITLE - Movement of the camera - - - CURSOR_SIZE - Size of the cursor : - - - CURSOR_TITLE - Cursor - - - DISPLAY_PARENT_MESH - Display parent mesh element - - - INFO_WINDOW_TITLE - Information window - - - PARENT_MESH_TITLE - Parent mesh element - - - PICKING_DLG_TITLE - Picking - - - POINT_TOLERANCE - Point tolerance : - - - POSITION - Position : - - - PYRAMID_HEIGHT - Height of the pyramids : - - - SELECTION_COLOR - Selection cursor color : - - - STEP_NUMBER - Number of steps between two positions : - - - TOLERANCE_TITLE - Tolerance - - - TOP_LEFT_CORNER - Top-left corner of the 3D view - - - TRANSPARENCY - Transparency : - - - ZOOM_FACTOR - Zoom at first selected point (ratio) : - - - DATA_POSITION - Position - - - PARENT_ELEMENT - Parent mesh element ID: - - - LOCAL_POINT - Local Gauss Point ID: - - - - VVTK_PrimitiveBox + VisuGUI_PrimitiveBox ALPHA_TEXTURE Alpha Channel Texture (16x16) : @@ -737,149 +607,7 @@ Please, refer to the documentation. - VVTK_RecorderDlg - - ALL_DISLPAYED_FRAMES - Recording all displayed frames - - - CLOSE - Close - - - DLG_RECORDER_TITLE - Recorder - - - FILE_NAME - Save to file : - - - FLT_ALL_FILES - All Files (*.*) - - - FLT_AVI_FILES - AVI Files (*.avi) - - - FPS - FPS : - - - PROGRESSIVE - Progressive - - - QUALITY - Quality : - - - RECORDING_MODE - Mode : - - - SETTINGS - Settings - - - SKIPPED_FRAMES - Recording at a given FPS - - - START - Start - - - - VVTK_SegmentationCursorDlg - - DEPTH - Depth of the cursor: - - - DEPTH_TITLE - Depth - - - DIRECTION_DX - DX: - - - DIRECTION_DY - DY: - - - DIRECTION_DZ - DZ: - - - DIRECTION_TITLE - Direction - - - GAUSS_POINTS_TAB - Gauss Points - - - INCREMENT - +/- Ratio : - - - INSIDE_GAUSS_POINTS - Inside Cursor Gauss Points Presentation - - - MAGNIFICATION - Magnification (%) : - - - MAGNIFICATION_TITLE - Magnification - - - ORIGIN_TITLE - Origin - - - ORIGIN_X - X: - - - ORIGIN_Y - Y: - - - ORIGIN_Z - Z: - - - OUTSIDE_GAUSS_POINTS - Outside Cursor Gauss Points Presentation - - - RADIUS - Radius of the cursor : - - - RADIUS_TITLE - Radius - - - RATIO - +/- Ratio : - - - SEGMENTATION_CURSOR_DLG_TITLE - Segmentation Cursor - - - SEGMENTATION_CURSOR_TAB - Segmentation Cursor - - - - VVTK_SizeBox + VisuGUI_SizeBox COLOR Color : @@ -921,20 +649,6 @@ Please, refer to the documentation. Uniform Color - - VVTK_ViewManager - - VTK_VIEW_TITLE - Gauss scene:%1 - viewer:%2 - - - - VVTK_ViewWindow - - LBL_TOOLBAR_LABEL - GAUSS viewer tools - - VisuGUI @@ -3357,72 +3071,6 @@ Please select another field. Time step (second): - - VisuGUI_TableDlg - - EDIT_TABLE_TLT - Edit Table - - - ERR_TABLE_NOT_AVAILABLE - Table is not available - - - TABLE_OF_INTEGER_TLT - Table of integer - - - TABLE_OF_REAL_TLT - Table of real - - - VIEW_TABLE_TLT - View Table - - - - VisuGUI_TableWidget - - ADD_COLUMN_BTN - Add Column - - - ADD_ROW_BTN - Add Row - - - ADJUST_CELLS_BTN - Adjust Cells - - - CLEAR_BTN - Clear - - - REMOVE_COLUMN_BTN - Remove Column(s) - - - REMOVE_ROW_BTN - Remove Row(s) - - - SELECT_ALL_BTN - Select All - - - SET_TITLE_TLT - Set title - - - TITLE_LBL - Title: - - - UNITS_TLT - Units - - VisuGUI_TextPrefDlg @@ -4203,4 +3851,75 @@ Please, refer to the QT documentation. Shrink Factor: + + VISU_TableDlg + + ERR_TABLE_NOT_AVAILABLE + Table is not available + + + TABLE_OF_INTEGER_TLT + Table of integer + + + TABLE_OF_REAL_TLT + Table of real + + + TABLE_UNKNOWN_TLT + Table of unknown + + + VIEW_TABLE_TLT + View Table + + + ALLOW_EDIT_CHECK + Enable editing + + + DO_UPDATE_CHECK + Immediate update + + + ADD_COLUMN_BTN + Add Column + + + ADD_ROW_BTN + Add Row + + + ADJUST_CELLS_BTN + Adjust Cells + + + CLEAR_BTN + Clear + + + REMOVE_COLUMN_BTN + Remove Column(s) + + + REMOVE_ROW_BTN + Remove Row(s) + + + SELECT_ALL_BTN + Select All + + + SET_TITLE_TLT + Set title + + + TITLE_LBL + Title: + + + UNITS_TLT + Units + + diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index ebe7f5f2..a289d376 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -150,7 +150,7 @@ #include "VISU_Vectors_i.hh" #include "VisuGUI_VectorsDlg.h" -#include "VisuGUI_TableDlg.h" +#include "VISU_TableDlg.h" #include "VisuGUI_FileInfoDlg.h" #include "SALOMEconfig.h" @@ -1429,19 +1429,19 @@ VisuGUI Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject; - if(VISU::Table_i* aTable = dynamic_cast(aBase)) + if(VISU::Table_i* aTable = dynamic_cast(aBase)) { aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() ); - - if( !IsSObjectTable( aSObject ) ) - return; - - VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ), - aSObject, - false, - //SAL2670 Orientation of show tables - VisuGUI_TableDlg::ttAuto, - Qt::Vertical ); - dlg->show(); + if( IsSObjectTable( aSObject ) ) { + VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ), + GetCStudy( GetAppStudy( this ) ), + aTable, + false, + //SAL2670 Orientation of show tables + VISU_TableDlg::ttAuto, + Qt::Vertical ); + dlg->show(); + } + } } //---------------------------------------------------------------------------- @@ -4115,6 +4115,30 @@ void VisuGUI::createPreferences() addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr, LightApp_Preferences::Bool, "VISU", "automatic_fit_all" ); + // TAB: Tables ; group: "Tables editing properties" + int tablesTab = addPreference( tr( "VISU_TABLES" ) ); + + int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab ); + setPreferenceProperty( tablesGr, "columns", 1 ); + + addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" ); + + int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" ); + QStringList policies; + policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) ); + policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) ); + policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) ); + policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) ); + policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + indices.append( 2 ); + indices.append( 3 ); + indices.append( 4 ); + setPreferenceProperty( sortPolicyPref, "strings", policies ); + setPreferenceProperty( sortPolicyPref, "indexes", indices ); + // TAB: Feature edges ; group: "Feature edges properties" int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) ); diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index 04128685..79b0f107 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -53,7 +53,7 @@ //TO DO //#include "OB_Browser.h" -#include "VisuGUI_TableDlg.h" +#include "VISU_TableDlg.h" #include #include diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index 482514dd..af066430 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -41,7 +41,7 @@ //#include "OB_Browser.h" -#include "VisuGUI_TableDlg.h" +#include "VISU_TableDlg.h" #include "SVTK_ViewWindow.h" diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 89ddfa56..ed4b94af 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -30,6 +30,8 @@ #include "VisuGUI_Tools.h" #include "VisuGUI_InputPane.h" +#include "VisuGUI_PrimitiveBox.h" +#include "VisuGUI_SizeBox.h" #include "VISU_ColoredPrs3dFactory.hh" #include "VISU_GaussPoints_i.hh" @@ -38,9 +40,6 @@ #include "VISU_OpenGLPointSpriteMapper.hxx" #include "VISU_Convertor.hxx" -#include "VVTK_PrimitiveBox.h" -#include "VVTK_SizeBox.h" - #include "LightApp_Application.h" #include "SalomeApp_Module.h" #include "LightApp_SelectionMgr.h" @@ -845,11 +844,11 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule): aVBLay->setSpacing(6); // Primitive - myPrimitiveBox = new VVTK_PrimitiveBox( aBox ); + myPrimitiveBox = new VisuGUI_PrimitiveBox( aBox ); aVBLay->addWidget( myPrimitiveBox ); // Size - mySizeBox = new VVTK_SizeBox( aBox ); + mySizeBox = new VisuGUI_SizeBox( aBox ); aVBLay->addWidget( mySizeBox ); // Deformed Shape @@ -955,7 +954,7 @@ void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, myPrimitiveBox->setResolution( myPrsCopy->GetResolution() ); myPrimitiveBox->setFaceLimit( myPrsCopy->GetFaceLimit() ); - mySizeBox->setType( isResults || isDeformed ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry ); + mySizeBox->setType( isResults || isDeformed ? VisuGUI_SizeBox::Results : VisuGUI_SizeBox::Geometry ); mySizeBox->setGeomSize( myPrsCopy->GetGeomSize() ); mySizeBox->setMinSize( myPrsCopy->GetMinSize() ); mySizeBox->setMaxSize( myPrsCopy->GetMaxSize() ); @@ -1047,7 +1046,7 @@ void VisuGUI_GaussPointsDlg::onToggleDefShape( bool on ) if( on )//myDefShapeButton->isChecked() ) { myDefShapeBox->show(); - mySizeBox->setType( VVTK_SizeBox::Results ); + mySizeBox->setType( VisuGUI_SizeBox::Results ); } else myDefShapeBox->hide(); diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index f7742c7e..0ffe82c3 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -33,8 +33,8 @@ class QtxDoubleSpinBox; class SalomeApp_Module; -class VVTK_PrimitiveBox; -class VVTK_SizeBox; +class VisuGUI_PrimitiveBox; +class VisuGUI_SizeBox; class VisuGUI_TextPrefDlg; class VisuGUI_InputPane; @@ -158,11 +158,11 @@ private: QRadioButton* myGeometryButton; QRadioButton* myDefShapeButton; - VVTK_PrimitiveBox* myPrimitiveBox; - VVTK_SizeBox* mySizeBox; + VisuGUI_PrimitiveBox* myPrimitiveBox; + VisuGUI_SizeBox* mySizeBox; QGroupBox* myDefShapeBox; - QtxDoubleSpinBox* myScaleSpinBox; + QtxDoubleSpinBox* myScaleSpinBox; SALOME::GenericObjPtr myPrsCopy; SalomeApp_Module* myModule; diff --git a/src/VVTK/VVTK_PrimitiveBox.cxx b/src/VISUGUI/VisuGUI_PrimitiveBox.cxx similarity index 81% rename from src/VVTK/VVTK_PrimitiveBox.cxx rename to src/VISUGUI/VisuGUI_PrimitiveBox.cxx index 21245b4f..50a178b3 100644 --- a/src/VVTK/VVTK_PrimitiveBox.cxx +++ b/src/VISUGUI/VisuGUI_PrimitiveBox.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,20 +16,22 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // VISU VISUGUI : GUI of VISU component -// File : VVTK_PrimitiveBox.cxx +// File : VisuGUI_PrimitiveBox.cxx // Author : Oleg UVAROV // Module : VISU // -#include "VVTK_PrimitiveBox.h" +#include "VisuGUI_PrimitiveBox.h" +#include "VisuGUI_Tools.h" -#include "VISU_OpenGLPointSpriteMapper.hxx" +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" +#include +#include -#include "QtxDoubleSpinBox.h" -#include "QtxIntSpinBox.h" +#include +#include #include #include @@ -46,7 +45,7 @@ using namespace std; -VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : +VisuGUI_PrimitiveBox::VisuGUI_PrimitiveBox( QWidget* parent ) : QGroupBox( parent ) { SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); @@ -91,7 +90,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : // Clamp ( Point Sprite & OpenGL Point ) myClampLabel = new QLabel( tr( "CLAMP" ), this ); - myClampSpinBox = new QtxDoubleSpinBox( 1.0, 512.0, 1.0, this ); + myClampSpinBox = new SalomeApp_DoubleSpinBox( this ); myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); aLayout->addWidget( myClampLabel, 1, 0 ); @@ -123,7 +122,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : // Alpha Threshold ( Point Sprite ) myAlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), this ); - myAlphaThresholdSpinBox = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, this ); + myAlphaThresholdSpinBox = new SalomeApp_DoubleSpinBox( this ); myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); aLayout->addWidget( myAlphaThresholdLabel, 4, 0 ); @@ -131,7 +130,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : // Resolution ( Geometrical Sphere ) myResolutionLabel = new QLabel( tr( "RESOLUTION" ), this ); - myResolutionSpinBox = new QtxIntSpinBox( 3, 100, 1, this ); + myResolutionSpinBox = new SalomeApp_IntSpinBox( this ); myResolutionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); connect( myResolutionSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( onResolutionChanged( int ) ) ); @@ -150,7 +149,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : // Notification ( Geometrical Sphere ) myFaceLimitLabel = new QLabel( tr( "FACE_LIMIT" ), this ); - myFaceLimitSpinBox = new QtxIntSpinBox( 10, 1000000, 10, this ); + myFaceLimitSpinBox = new SalomeApp_IntSpinBox( this ); myFaceLimitSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); aLayout->addWidget( myFaceLimitLabel, 7, 0 ); @@ -161,7 +160,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : connect( myGeomSphereButton, SIGNAL( clicked() ), this, SLOT( onToggleGeomSphere() ) ); } -void VVTK_PrimitiveBox::onTogglePointSprite() +void VisuGUI_PrimitiveBox::onTogglePointSprite() { myPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; @@ -189,7 +188,7 @@ void VVTK_PrimitiveBox::onTogglePointSprite() myFaceLimitSpinBox->hide(); } -void VVTK_PrimitiveBox::onToggleOpenGLPoint() +void VisuGUI_PrimitiveBox::onToggleOpenGLPoint() { myPrimitiveType = VISU_OpenGLPointSpriteMapper::OpenGLPoint; @@ -217,7 +216,7 @@ void VVTK_PrimitiveBox::onToggleOpenGLPoint() myFaceLimitSpinBox->hide(); } -void VVTK_PrimitiveBox::onToggleGeomSphere() +void VisuGUI_PrimitiveBox::onToggleGeomSphere() { myPrimitiveType = VISU_OpenGLPointSpriteMapper::GeomSphere; @@ -245,12 +244,12 @@ void VVTK_PrimitiveBox::onToggleGeomSphere() myFaceLimitSpinBox->show(); } -void VVTK_PrimitiveBox::onResolutionChanged( int theResolution ) +void VisuGUI_PrimitiveBox::onResolutionChanged( int theResolution ) { setFaceNumber( 2 * theResolution * ( theResolution - 2 ) ); } -void VVTK_PrimitiveBox::setPrimitiveType( int theType ) +void VisuGUI_PrimitiveBox::setPrimitiveType( int theType ) { myPrimitiveType = theType; @@ -272,82 +271,82 @@ void VVTK_PrimitiveBox::setPrimitiveType( int theType ) } } -float VVTK_PrimitiveBox::getClamp() const +float VisuGUI_PrimitiveBox::getClamp() const { return myClampSpinBox->value(); } -void VVTK_PrimitiveBox::setClamp( float theClamp ) +void VisuGUI_PrimitiveBox::setClamp( float theClamp ) { myClampSpinBox->setValue( theClamp ); } -void VVTK_PrimitiveBox::setClampMaximum( float theClampMaximum ) +void VisuGUI_PrimitiveBox::setClampMaximum( float theClampMaximum ) { myClampSpinBox->setMaximum( theClampMaximum ); } -void VVTK_PrimitiveBox::setMainTexture( const QString& theMainTexture ) +void VisuGUI_PrimitiveBox::setMainTexture( const QString& theMainTexture ) { myMainTexture = theMainTexture; myMainTextureLineEdit->setText( theMainTexture.section( '/', -1 ) ); } -void VVTK_PrimitiveBox::setAlphaTexture( const QString& theAlphaTexture ) +void VisuGUI_PrimitiveBox::setAlphaTexture( const QString& theAlphaTexture ) { myAlphaTexture = theAlphaTexture; myAlphaTextureLineEdit->setText( theAlphaTexture.section( '/', -1 ) ); } -float VVTK_PrimitiveBox::getAlphaThreshold() const +float VisuGUI_PrimitiveBox::getAlphaThreshold() const { return myAlphaThresholdSpinBox->value(); } -void VVTK_PrimitiveBox::setAlphaThreshold( float theAlphaThreshold ) +void VisuGUI_PrimitiveBox::setAlphaThreshold( float theAlphaThreshold ) { myAlphaThresholdSpinBox->setValue( theAlphaThreshold ); } -int VVTK_PrimitiveBox::getResolution() const +int VisuGUI_PrimitiveBox::getResolution() const { return myResolutionSpinBox->value(); } -void VVTK_PrimitiveBox::setResolution( int theResolution ) +void VisuGUI_PrimitiveBox::setResolution( int theResolution ) { myResolutionSpinBox->setValue( theResolution ); } -int VVTK_PrimitiveBox::getFaceNumber() const +int VisuGUI_PrimitiveBox::getFaceNumber() const { int aResolution = getResolution(); return 2 * aResolution * ( aResolution - 2 ); //return myFaceNumberLineEdit->text().toInt(); } -void VVTK_PrimitiveBox::setFaceNumber( int theFaceNumber ) +void VisuGUI_PrimitiveBox::setFaceNumber( int theFaceNumber ) { myFaceNumberLineEdit->setText( QString::number( theFaceNumber ) ); } -int VVTK_PrimitiveBox::getFaceLimit() const +int VisuGUI_PrimitiveBox::getFaceLimit() const { return myFaceLimitSpinBox->value(); } -void VVTK_PrimitiveBox::setFaceLimit( int theFaceLimit ) +void VisuGUI_PrimitiveBox::setFaceLimit( int theFaceLimit ) { myFaceLimitSpinBox->setValue( theFaceLimit ); } -void VVTK_PrimitiveBox::onBrowseMainTexture() +void VisuGUI_PrimitiveBox::onBrowseMainTexture() { QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/"; QString aFileName = QFileDialog::getOpenFileName( this, - 0, - aRootDir, - "Bitmap (*.bmp *.jpg *.png)" ); + 0, + aRootDir, + "Bitmap (*.bmp *.jpg *.png)" ); if( aFileName.isNull() ) return; @@ -356,13 +355,13 @@ void VVTK_PrimitiveBox::onBrowseMainTexture() myMainTextureLineEdit->setText( aFileName.section( '/', -1 ) ); } -void VVTK_PrimitiveBox::onBrowseAlphaTexture() +void VisuGUI_PrimitiveBox::onBrowseAlphaTexture() { QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/"; QString aFileName = QFileDialog::getOpenFileName( this, - 0, - aRootDir, - "Bitmap (*.bmp *.jpg *.png)" ); + 0, + aRootDir, + "Bitmap (*.bmp *.jpg *.png)" ); if( aFileName.isNull() ) return; diff --git a/src/VVTK/VVTK_PrimitiveBox.h b/src/VISUGUI/VisuGUI_PrimitiveBox.h similarity index 83% rename from src/VVTK/VVTK_PrimitiveBox.h rename to src/VISUGUI/VisuGUI_PrimitiveBox.h index c0ea8c4d..e2de3e21 100644 --- a/src/VVTK/VVTK_PrimitiveBox.h +++ b/src/VISUGUI/VisuGUI_PrimitiveBox.h @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,15 +16,14 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // VISU VISUGUI : GUI of VISU component -// File : VVTK_PrimitiveBox.h +// File : VisuGUI_PrimitiveBox.h // Author : Oleg UVAROV // Module : VISU // -#ifndef VVTK_PRIMITIVEBOX_H -#define VVTK_PRIMITIVEBOX_H - -#include "VVTK.h" +#ifndef VISUGUI_PRIMITIVEBOX_H +#define VISUGUI_PRIMITIVEBOX_H #include @@ -36,16 +32,16 @@ class QLineEdit; class QPushButton; class QRadioButton; -class QtxDoubleSpinBox; -class QtxIntSpinBox; +class SalomeApp_DoubleSpinBox; +class SalomeApp_IntSpinBox; -class VVTK_EXPORT VVTK_PrimitiveBox : public QGroupBox +class VisuGUI_PrimitiveBox : public QGroupBox { Q_OBJECT public: - VVTK_PrimitiveBox( QWidget* ); - ~VVTK_PrimitiveBox() {} + VisuGUI_PrimitiveBox( QWidget* ); + ~VisuGUI_PrimitiveBox() {} public: int getPrimitiveType() const { return myPrimitiveType; } @@ -94,7 +90,7 @@ private: QString myAlphaTexture; QLabel* myClampLabel; - QtxDoubleSpinBox* myClampSpinBox; + SalomeApp_DoubleSpinBox* myClampSpinBox; QLabel* myMainTextureLabel; QLineEdit* myMainTextureLineEdit; @@ -105,16 +101,16 @@ private: QPushButton* myAlphaTextureButton; QLabel* myAlphaThresholdLabel; - QtxDoubleSpinBox* myAlphaThresholdSpinBox; + SalomeApp_DoubleSpinBox* myAlphaThresholdSpinBox; QLabel* myResolutionLabel; - QtxIntSpinBox* myResolutionSpinBox; + SalomeApp_IntSpinBox* myResolutionSpinBox; QLabel* myFaceNumberLabel; QLineEdit* myFaceNumberLineEdit; QLabel* myFaceLimitLabel; - QtxIntSpinBox* myFaceLimitSpinBox; + SalomeApp_IntSpinBox* myFaceLimitSpinBox; }; diff --git a/src/VVTK/VVTK_SizeBox.cxx b/src/VISUGUI/VisuGUI_SizeBox.cxx similarity index 78% rename from src/VVTK/VVTK_SizeBox.cxx rename to src/VISUGUI/VisuGUI_SizeBox.cxx index 7d040131..a5c49a31 100644 --- a/src/VVTK/VVTK_SizeBox.cxx +++ b/src/VISUGUI/VisuGUI_SizeBox.cxx @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,18 +16,21 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // VISU VISUGUI : GUI of VISU component -// File : VVTK_SizeBox.cxx +// File : VisuGUI_SizeBox.cxx // Author : Oleg UVAROV // Module : VISU // -#include "VVTK_SizeBox.h" +#include "VisuGUI_SizeBox.h" + +#include "VisuGUI_Tools.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" +#include +#include -#include -#include +#include +#include #include #include @@ -45,7 +45,7 @@ using namespace std; -VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : +VisuGUI_SizeBox::VisuGUI_SizeBox( QWidget* parent ) : QWidget( parent ) { QVBoxLayout* aMainLayout = new QVBoxLayout( this ); @@ -65,7 +65,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Outside Size myOutsideSizeLabel = new QLabel( tr( "OUTSIDE_SIZE" ), SizeGroup ); - myOutsideSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup ); + myOutsideSizeSpinBox = new SalomeApp_IntSpinBox( SizeGroup ); myOutsideSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myOutsideSizeLabel, 0, 0 ); @@ -73,7 +73,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Geometry Size myGeomSizeLabel = new QLabel( tr( "GEOM_SIZE" ), SizeGroup ); - myGeomSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup ); + myGeomSizeSpinBox = new SalomeApp_IntSpinBox( SizeGroup ); myGeomSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myGeomSizeLabel, 0, 0 ); @@ -81,7 +81,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Min Size myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup ); - myMinSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup ); + myMinSizeSpinBox = new SalomeApp_IntSpinBox( SizeGroup ); myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 ); @@ -89,7 +89,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Max Size myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup ); - myMaxSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup ); + myMaxSizeSpinBox = new SalomeApp_IntSpinBox( SizeGroup ); myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 ); @@ -97,7 +97,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Magnification myMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup ); - myMagnificationSpinBox = new QtxIntSpinBox( 1, 10000, 10, SizeGroup ); + myMagnificationSpinBox = new SalomeApp_IntSpinBox( SizeGroup ); myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myMagnificationLabel, 2, 0 ); @@ -105,7 +105,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Increment myIncrementLabel = new QLabel( tr( "INCREMENT" ), SizeGroup ); - myIncrementSpinBox = new QtxDoubleSpinBox( 0.01, 10, 0.1, SizeGroup ); + myIncrementSpinBox = new SalomeApp_DoubleSpinBox( SizeGroup ); myIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myIncrementLabel, 2, 2 ); @@ -138,12 +138,12 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : connect( myUniformCheckBox, SIGNAL( toggled( bool ) ), myColorButton, SLOT( setEnabled( bool ) ) ); //connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) ); - setType( VVTK_SizeBox::Results ); + setType( VisuGUI_SizeBox::Results ); } -void VVTK_SizeBox::onToggleResults() +void VisuGUI_SizeBox::onToggleResults() { - myType = VVTK_SizeBox::Results; + myType = VisuGUI_SizeBox::Results; myOutsideSizeLabel->hide(); myOutsideSizeSpinBox->hide(); @@ -168,9 +168,9 @@ void VVTK_SizeBox::onToggleResults() myUniformCheckBox->hide(); } -void VVTK_SizeBox::onToggleGeometry() +void VisuGUI_SizeBox::onToggleGeometry() { - myType = VVTK_SizeBox::Geometry; + myType = VisuGUI_SizeBox::Geometry; myOutsideSizeLabel->hide(); myOutsideSizeSpinBox->hide(); @@ -195,9 +195,9 @@ void VVTK_SizeBox::onToggleGeometry() myUniformCheckBox->hide(); } -void VVTK_SizeBox::onToggleInside() +void VisuGUI_SizeBox::onToggleInside() { - myType = VVTK_SizeBox::Inside; + myType = VisuGUI_SizeBox::Inside; myOutsideSizeLabel->hide(); myOutsideSizeSpinBox->hide(); @@ -222,9 +222,9 @@ void VVTK_SizeBox::onToggleInside() myUniformCheckBox->hide(); } -void VVTK_SizeBox::onToggleOutside() +void VisuGUI_SizeBox::onToggleOutside() { - myType = VVTK_SizeBox::Outside; + myType = VisuGUI_SizeBox::Outside; myOutsideSizeLabel->show(); myOutsideSizeSpinBox->show(); @@ -249,98 +249,98 @@ void VVTK_SizeBox::onToggleOutside() myUniformCheckBox->show(); } -void VVTK_SizeBox::setType( int theType ) +void VisuGUI_SizeBox::setType( int theType ) { myType = theType; switch( myType ) { - case VVTK_SizeBox::Results : onToggleResults(); break; - case VVTK_SizeBox::Geometry : onToggleGeometry(); break; - case VVTK_SizeBox::Inside : onToggleInside(); break; - case VVTK_SizeBox::Outside : onToggleOutside(); break; + case VisuGUI_SizeBox::Results : onToggleResults(); break; + case VisuGUI_SizeBox::Geometry : onToggleGeometry(); break; + case VisuGUI_SizeBox::Inside : onToggleInside(); break; + case VisuGUI_SizeBox::Outside : onToggleOutside(); break; default : break; } } -float VVTK_SizeBox::getOutsideSize() const +float VisuGUI_SizeBox::getOutsideSize() const { return myOutsideSizeSpinBox->value() / 100.0; } -void VVTK_SizeBox::setOutsideSize( float theOutsideSize ) +void VisuGUI_SizeBox::setOutsideSize( float theOutsideSize ) { myOutsideSizeSpinBox->setValue( ( int )( theOutsideSize * 100 ) ); } -float VVTK_SizeBox::getGeomSize() const +float VisuGUI_SizeBox::getGeomSize() const { return myGeomSizeSpinBox->value() / 100.0; } -void VVTK_SizeBox::setGeomSize( float theGeomSize ) +void VisuGUI_SizeBox::setGeomSize( float theGeomSize ) { myGeomSizeSpinBox->setValue( ( int )( theGeomSize * 100 ) ); } -float VVTK_SizeBox::getMinSize() const +float VisuGUI_SizeBox::getMinSize() const { return myMinSizeSpinBox->value() / 100.0; } -void VVTK_SizeBox::setMinSize( float theMinSize ) +void VisuGUI_SizeBox::setMinSize( float theMinSize ) { myMinSizeSpinBox->setValue( ( int )( theMinSize * 100 ) ); } -float VVTK_SizeBox::getMaxSize() const +float VisuGUI_SizeBox::getMaxSize() const { return myMaxSizeSpinBox->value() / 100.0; } -void VVTK_SizeBox::setMaxSize( float theMaxSize ) +void VisuGUI_SizeBox::setMaxSize( float theMaxSize ) { myMaxSizeSpinBox->setValue( ( int )( theMaxSize * 100 ) ); } -float VVTK_SizeBox::getMagnification() const +float VisuGUI_SizeBox::getMagnification() const { return myMagnificationSpinBox->value() / 100.0; } -void VVTK_SizeBox::setMagnification( float theMagnification ) +void VisuGUI_SizeBox::setMagnification( float theMagnification ) { myMagnificationSpinBox->setValue( ( int )( theMagnification * 100 ) ); } -float VVTK_SizeBox::getIncrement() const +float VisuGUI_SizeBox::getIncrement() const { return myIncrementSpinBox->value(); } -void VVTK_SizeBox::setIncrement( float theIncrement ) +void VisuGUI_SizeBox::setIncrement( float theIncrement ) { myIncrementSpinBox->setValue( theIncrement ); } -bool VVTK_SizeBox::getUniform() const +bool VisuGUI_SizeBox::getUniform() const { return myUniformCheckBox->isChecked(); } -void VVTK_SizeBox::setUniform( bool theUniform ) +void VisuGUI_SizeBox::setUniform( bool theUniform ) { myUniformCheckBox->setChecked( theUniform ); myColorButton->setEnabled( theUniform ); } -QColor VVTK_SizeBox::getColor() const +QColor VisuGUI_SizeBox::getColor() const { return myColorButton->color();//palette().color( myColorButton->backgroundRole() ); //return myColorButton->paletteBackgroundColor(); } -void VVTK_SizeBox::setColor( const QColor& theColor ) +void VisuGUI_SizeBox::setColor( const QColor& theColor ) { if ( theColor.isValid() ) { @@ -351,7 +351,7 @@ void VVTK_SizeBox::setColor( const QColor& theColor ) //myColorButton->setPaletteBackgroundColor( theColor ); } -void VVTK_SizeBox::enableSizeControls( bool enabled ) +void VisuGUI_SizeBox::enableSizeControls( bool enabled ) { myMagnificationSpinBox->setEnabled( enabled ); myMaxSizeSpinBox->setEnabled( enabled ); @@ -360,7 +360,7 @@ void VVTK_SizeBox::enableSizeControls( bool enabled ) myGeomSizeSpinBox->setEnabled( enabled ); } -/*void VVTK_SizeBox::onColorButtonPressed() +/*void VisuGUI_SizeBox::onColorButtonPressed() { QPalette aPalette( myColorButton->palette() ); QColor aColor = QColorDialog:: diff --git a/src/VVTK/VVTK_SizeBox.h b/src/VISUGUI/VisuGUI_SizeBox.h similarity index 80% rename from src/VVTK/VVTK_SizeBox.h rename to src/VISUGUI/VisuGUI_SizeBox.h index 296ff51d..69e42ab9 100644 --- a/src/VVTK/VVTK_SizeBox.h +++ b/src/VISUGUI/VisuGUI_SizeBox.h @@ -1,7 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,15 +16,14 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // VISU VISUGUI : GUI of VISU component -// File : VVTK_SizeBox.h +// File : VisuGUI_SizeBox.h // Author : Oleg UVAROV // Module : VISU // -#ifndef VVTK_SIZEBOX_H -#define VVTK_SIZEBOX_H - -#include "VVTK.h" +#ifndef VISUGUI_SIZEBOX_H +#define VISUGUI_SIZEBOX_H #include @@ -37,11 +33,11 @@ class QPushButton; class QCheckBox; class QGroupBox; -class QtxDoubleSpinBox; -class QtxIntSpinBox; +class SalomeApp_DoubleSpinBox; +class SalomeApp_IntSpinBox; class QtxColorButton; -class VVTK_EXPORT VVTK_SizeBox : public QWidget +class VisuGUI_SizeBox : public QWidget { Q_OBJECT @@ -49,8 +45,8 @@ public: enum { Results = 0, Geometry, Inside, Outside }; public: - VVTK_SizeBox( QWidget* ); - ~VVTK_SizeBox() {} + VisuGUI_SizeBox( QWidget* ); + ~VisuGUI_SizeBox() {} public: int getType() const { return myType; } @@ -94,22 +90,22 @@ private: int myType; QLabel* myOutsideSizeLabel; - QtxIntSpinBox* myOutsideSizeSpinBox; + SalomeApp_IntSpinBox* myOutsideSizeSpinBox; QLabel* myGeomSizeLabel; - QtxIntSpinBox* myGeomSizeSpinBox; + SalomeApp_IntSpinBox* myGeomSizeSpinBox; QLabel* myMinSizeLabel; - QtxIntSpinBox* myMinSizeSpinBox; + SalomeApp_IntSpinBox* myMinSizeSpinBox; QLabel* myMaxSizeLabel; - QtxIntSpinBox* myMaxSizeSpinBox; + SalomeApp_IntSpinBox* myMaxSizeSpinBox; QLabel* myMagnificationLabel; - QtxIntSpinBox* myMagnificationSpinBox; + SalomeApp_IntSpinBox* myMagnificationSpinBox; QLabel* myIncrementLabel; - QtxDoubleSpinBox* myIncrementSpinBox; + SalomeApp_DoubleSpinBox* myIncrementSpinBox; QCheckBox* myUniformCheckBox; diff --git a/src/VISU_I/Makefile.am b/src/VISU_I/Makefile.am index 9d6c9de5..1f64c456 100644 --- a/src/VISU_I/Makefile.am +++ b/src/VISU_I/Makefile.am @@ -67,7 +67,8 @@ salomeinclude_HEADERS = \ VISU_Deformation_i.hh \ VISU_OptionalDeformation_i.hh \ SALOME_GenericObjPointer.hh \ - VISU_ClippingPlaneMgr.hxx + VISU_ClippingPlaneMgr.hxx \ + VISU_TableDlg.h libVISUEngineImpl_la_SOURCES = \ @@ -109,9 +110,13 @@ libVISUEngineImpl_la_SOURCES = \ VISU_Deformation_i.cc \ VISU_OptionalDeformation_i.cc \ SALOME_GenericObjPointer.cc \ - VISU_ClippingPlaneMgr.cxx + VISU_ClippingPlaneMgr.cxx \ + VISU_TableDlg.cxx + +MOC_FILES = \ + VISU_TimeAnimation_moc.cxx \ + VISU_TableDlg_moc.cxx -MOC_FILES = VISU_TimeAnimation_moc.cxx nodist_libVISUEngineImpl_la_SOURCES= $(MOC_FILES) # additionnal information to compil and link file @@ -131,7 +136,6 @@ libVISUEngineImpl_la_CPPFLAGS= \ -I$(srcdir)/../CONVERTOR \ -I$(srcdir)/../PIPELINE \ -I$(srcdir)/../OBJECT \ - -I$(srcdir)/../GUITOOLS \ -I$(top_builddir)/idl libVISUEngineImpl_la_LDFLAGS= \ @@ -150,7 +154,6 @@ libVISUEngineImpl_la_LIBADD= \ ../CONVERTOR/libVisuConvertor.la \ ../PIPELINE/libVisuPipeLine.la \ ../OBJECT/libVisuObject.la \ - ../GUITOOLS/libVISUGUITOOLS.la \ -lSalomeIDLKernel \ -lSalomeHDFPersist \ -lSalomeGenericObj \ diff --git a/src/VISU_I/VISU_TableDlg.cxx b/src/VISU_I/VISU_TableDlg.cxx new file mode 100644 index 00000000..46a6b993 --- /dev/null +++ b/src/VISU_I/VISU_TableDlg.cxx @@ -0,0 +1,1234 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : VISU_TableDlg.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#include "VISU_TableDlg.h" + +#include "VISU_Table_i.hh" + +#include "SUIT_Tools.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" + +#include "LightApp_Application.h" + +#include "CAM_Module.h" + +#include "SALOMEDSClient_Study.hxx" +#include "SALOMEDSClient_GenericAttribute.hxx" +#include "SALOMEDSClient_AttributeTableOfInteger.hxx" +#include "SALOMEDSClient_AttributeTableOfReal.hxx" +#include "SALOMEDSClient_StudyBuilder.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utilities.h" + +const int MARGIN_SIZE = 11; +const int SPACING_SIZE = 6; +const int MIN_TABLE_WIDTH = 200; +const int MIN_TABLE_HEIGHT = 200; + +NumDelegateItem::NumDelegateItem( QObject* parent, NumValidator mode ) + : QItemDelegate( parent ), + myMode( mode ) +{ +} + +NumDelegateItem::~NumDelegateItem() +{ +} + +QWidget* NumDelegateItem::createEditor( QWidget* parent, + const QStyleOptionViewItem& option, + const QModelIndex& index ) const +{ + QLineEdit* editor = new QLineEdit( parent ); + switch ( myMode ) + { + case NV_Int: + editor->setValidator( new QIntValidator( editor ) ); + break; + case NV_Real: + editor->setValidator( new QDoubleValidator( editor ) ); + break; + default: + break; + } + return editor; +} + +void NumDelegateItem::setEditorData( QWidget* editor, + const QModelIndex& index ) const +{ + QLineEdit* aLE = qobject_cast( editor ); + if ( !aLE ) + return; + + switch ( myMode ) + { + case NV_Int: + { + int value = index.model()->data( index, Qt::DisplayRole ).toInt(); + aLE->setText( QString("%1").arg( value ) ); + break; + } + case NV_Real: + { + double value = index.model()->data(index, Qt::DisplayRole).toDouble(); + aLE->setText( QString("%1").arg( value ) ); + break; + } + default: + aLE->setText( index.model()->data( index, Qt::DisplayRole ).toString() ); + break; + } +} + +class VISU_TableDlg::WidgetCointainer : public QWidget +{ +public: + WidgetCointainer( QWidget* parent, Qt::Orientation o, int lm, int tm, int rm, int bm, int s ) + : QWidget( parent ) + { + QLayout* l = o == Qt::Horizontal ? (QLayout*)( new QHBoxLayout( this ) ) : ( QLayout* )( new QVBoxLayout( this ) ); + l->setContentsMargins( lm, tm, rm, bm ); + l->setSpacing( s ); + setLayout( l ); + } + void addWidget( QWidget* w ) + { + if ( w ) { + QHBoxLayout* hl = qobject_cast( layout() ); + QVBoxLayout* wl = qobject_cast( layout() ); + if ( hl ) hl->addWidget( w ); + else if ( wl ) wl->addWidget( w ); + } + } + void addSpacing( int s ) + { + if ( s > 0 ) { + QHBoxLayout* hl = qobject_cast( layout() ); + QVBoxLayout* wl = qobject_cast( layout() ); + if ( hl ) hl->addSpacing( s ); + else if ( wl ) wl->addSpacing( s ); + } + } + void addStretch( int s ) + { + if ( s >= 0 ) { + QHBoxLayout* hl = qobject_cast( layout() ); + QVBoxLayout* wl = qobject_cast( layout() ); + if ( hl ) hl->addStretch( s ); + else if ( wl ) wl->addStretch( s ); + } + } +}; + +/*class VISU_Table : public QTableWidget { +public: + VISU_Table( Orientation orient, QWidget* parent = 0 ) + : QTableWidget( parent ), myValidator( 0 ), myOrientation( orient ) {} + VISU_Table( Orientation orient, int numRows, int numCols, QWidget* parent = 0 ) + : QTableWidget( numRows, numCols, parent ), myValidator( 0 ), myOrientation( orient ) {} + + void setValidator( QValidator* v = 0 ) { myValidator = v; } + bool isEditing() const { return QTable::isEditing(); } + +protected: + QWidget* createEditor ( int row, int col, bool initFromCell ) const + { + bool testUnits = ( myOrientation == Qt::Horizontal && col == 0 ) || ( myOrientation == Qt::Vertical && row == 0 ); + QWidget* wg = QTable::createEditor( row, col, initFromCell ); + if ( wg && wg->inherits("QLineEdit") && myValidator && !testUnits ) + (( QLineEdit*)wg)->setValidator( myValidator ); + return wg; + } + +protected: + QValidator* myValidator; + Orientation myOrientation; + };*/ + +QString VISU_TableDlg::tableTitle( int type ) +{ + QString tlt; + switch ( type ) { + case ttInt: tlt = tr( "TABLE_OF_INTEGER_TLT" ); break; + case ttReal: tlt = tr( "TABLE_OF_REAL_TLT" ); break; + default: tlt = tr( "TABLE_UNKNOWN_TLT" ); break; + } + return tlt; +} +/*! + Constructor +*/ +VISU_TableDlg::VISU_TableDlg( QWidget* parent, + _PTR(Study) study, + VISU::Table_i* table, + bool allowEdition, + int which, + Qt::Orientation orient, + bool showColumnTitles ) + : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), + myStudy( study ), myTable( table ), myEditCheck( 0 ), myUpdateCheck( 0 ) +{ + allowEdition = true; ////////////////////////////////// + setWindowTitle( tr( "VIEW_TABLE_TLT" ) ); + setSizeGripEnabled( true ); + + bool bHasIntTable = false; + bool bHasRealTable = false; + if ( myStudy && myTable ) { + _PTR(SObject) aSObject = myStudy->FindObjectID( myTable->GetObjectEntry() ); + if ( aSObject ) { + _PTR(GenericAttribute) anAttr; + bHasIntTable = aSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ); + bHasRealTable = aSObject->FindAttribute( anAttr, "AttributeTableOfReal" ); + } + } + + if ( allowEdition ) { + myEditCheck = new QCheckBox( tr( "ALLOW_EDIT_CHECK" ), this ); + myUpdateCheck = new QCheckBox( tr( "DO_UPDATE_CHECK" ), this ); + connect( myEditCheck, SIGNAL( toggled( bool ) ), myUpdateCheck, SLOT( setEnabled( bool ) ) ); + myUpdateCheck->setEnabled( false ); + myUpdateCheck->hide(); // the feature has been temporarily disabled + } + + QWidget* top = 0; + + if ( which == ttInt || which == ttAll || which == ttAuto && bHasIntTable ) { + myTableMap[ ttInt ] = new TableWidget( this, orient ); + myTableMap[ ttInt ]->initialize( myStudy, myTable, ttInt ); + myTableMap[ ttInt ]->setEditEnabled( false ); + myTableMap[ ttInt ]->showColumnTitles( showColumnTitles ); + if ( myEditCheck ) + connect( myEditCheck, SIGNAL( toggled( bool ) ), myTableMap[ ttInt ], SLOT( setEditEnabled( bool ) ) ); + } + if ( which == ttReal || which == ttAll || which == ttAuto && bHasRealTable ) { + myTableMap[ ttReal ] = new TableWidget( this, orient ); + myTableMap[ ttReal ]->initialize( myStudy, myTable, ttReal ); + myTableMap[ ttReal ]->setEditEnabled( false ); + myTableMap[ ttReal ]->showColumnTitles( showColumnTitles ); + if ( myEditCheck ) + connect( myEditCheck, SIGNAL( toggled( bool ) ), myTableMap[ ttReal ], SLOT( setEditEnabled( bool ) ) ); + } + + if ( myTableMap.count() > 1 ) { + QTabWidget* tw = new QTabWidget( this ); + for ( int i = ttInt; i < ttAll; i++ ) { + if ( myTableMap.contains( i ) ) { + tw->addTab( myTableMap[ i ], tableTitle( i ) ); + myTableMap[ i ]->layout()->setMargin( MARGIN_SIZE ); + } + } + top = tw; + } + else if ( myTableMap.count() == 1 ) { + top = myTableMap[myTableMap.keys().first()]; + } + else { + QLabel* dumbLabel = new QLabel( tr( "ERR_TABLE_NOT_AVAILABLE" ), this ); + dumbLabel->setAlignment( Qt::AlignCenter ); + top = dumbLabel; + } + + myOKBtn = new QPushButton( tr( "BUT_OK" ), this ); + myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this ); + + QHBoxLayout* btnLayout = new QHBoxLayout; + btnLayout->setMargin( 0 ); + btnLayout->setSpacing( SPACING_SIZE ); + + btnLayout->addWidget( myOKBtn ); + btnLayout->addStretch( 20 ); + btnLayout->addWidget( myHelpBtn ); + connect( myOKBtn, SIGNAL( clicked() ), this, SLOT( close() ) ); + connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( help() ) ); + + QVBoxLayout* mainLayout = new QVBoxLayout( this ); + mainLayout->setMargin( MARGIN_SIZE ); + mainLayout->setSpacing( SPACING_SIZE ); + + if ( myEditCheck ) { + QHBoxLayout* checkLayout = new QHBoxLayout; + checkLayout->setMargin( 0 ); + checkLayout->setSpacing( SPACING_SIZE ); + checkLayout->addWidget( myEditCheck ); + checkLayout->addWidget( myUpdateCheck ); + mainLayout->addLayout( checkLayout ); + + if ( LightApp_Application* app = ( LightApp_Application* )SUIT_Session::session()->activeApplication() ) { + int anEnableEditing = app->resourceMgr()->booleanValue( "VISU", "tables_enable_editing", false ); + myEditCheck->setChecked( anEnableEditing ); + } + } + mainLayout->addWidget( top ); + mainLayout->addLayout( btnLayout ); + + resize( 500, 400 ); + SUIT_Tools::centerWidget( this, parent ); +} + +/*! + Destructor +*/ +VISU_TableDlg::~VISU_TableDlg() +{ +} + +/*! + button slot, saves table(s) + Called only in create/edit mode ( parameter for constructor is true ) +*/ +/* +void VISU_TableDlg::onOK() +{ + myOKBtn->setFocus(); // accept possible changes + bool done = true; + + if ( myObject ) { + _PTR(Study) study = myObject->GetStudy(); + _PTR(AttributeTableOfInteger) tblIntAttr; + _PTR(AttributeTableOfReal) tblRealAttr; + + if ( study ) { + _PTR(StudyBuilder) builder = study->NewBuilder(); + builder->NewCommand(); // start transaction !!!!!!!!!!!!!!!!!!!!!!!!!!!!! + try { + if ( myTableMap.contains( ttInt ) ) { + builder->RemoveAttribute( myObject, "AttributeTableOfInteger" ); + tblIntAttr = builder->FindOrCreateAttribute( myObject, "AttributeTableOfInteger" ); + + int i; + int nbRows = myTableMap[ ttInt ]->getNumRows(); + int nbCols = myTableMap[ ttInt ]->getNumCols(); + QString tlt = myTableMap[ ttInt ]->getTableTitle(); + QStringList rowTitles, colTitles, units; + myTableMap[ ttInt ]->getRowTitles( rowTitles ); + myTableMap[ ttInt ]->getColTitles( colTitles ); + myTableMap[ ttInt ]->getUnits( units ); + + if ( nbRows > 0) { + // data + int nRow = 0; + tblIntAttr->SetNbColumns( nbCols ); + for ( i = 0; i < nbRows; i++ ) { + QStringList data; + myTableMap[ ttInt ]->getRowData( i, data ); + bool bEmptyRow = true; + for ( int j = 0; j < data.count(); j++ ) { + if ( !data[ j ].isNull() ) { + tblIntAttr->PutValue( data[ j ].toInt(), nRow+1, j+1 ); + bEmptyRow = false; + } + } + if ( !bEmptyRow ) { // Skip rows with no data !!! + // set row title + tblIntAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? "" : (const char*)rowTitles[ i ].toLatin1() ); + // set row unit + tblIntAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? "" : (const char*)units[ i ].toLatin1() ); + nRow++; + } + } + if ( nRow > 0 ) { // Set columns only if table is not empty, otherwise exception is raised !!! + // column titles + for ( i = 0; i < colTitles.count(); i++ ) + tblIntAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? "" : (const char*)colTitles[ i ].toLatin1() ); + } + } + // title + tblIntAttr->SetTitle( (const char*)myTableMap[ ttInt ]->getTableTitle().toLatin1() ); + } + if ( myTableMap.contains( ttReal ) ) { + builder->RemoveAttribute( myObject, "AttributeTableOfReal" ); + tblRealAttr = builder->FindOrCreateAttribute( myObject, "AttributeTableOfReal" ); + + int i; + int nbRows = myTableMap[ ttReal ]->getNumRows(); + int nbCols = myTableMap[ ttReal ]->getNumCols(); + QString tlt = myTableMap[ ttReal ]->getTableTitle(); + QStringList rowTitles, colTitles, units; + myTableMap[ ttReal ]->getRowTitles( rowTitles ); + myTableMap[ ttReal ]->getColTitles( colTitles ); + myTableMap[ ttReal ]->getUnits( units ); + + if ( nbRows > 0) { + // data + int nRow = 0; + tblRealAttr->SetNbColumns( nbCols ); + for ( i = 0; i < nbRows; i++ ) { + QStringList data; + myTableMap[ ttReal ]->getRowData( i, data ); + bool bEmptyRow = true; + for ( int j = 0; j < data.count(); j++ ) { + if ( !data[ j ].isNull() ) { + tblRealAttr->PutValue( data[ j ].toDouble(), nRow+1, j+1 ); + bEmptyRow = false; + } + } + if ( !bEmptyRow ) { // Skip rows with no data !!! + // set row title + tblRealAttr->SetRowTitle( nRow+1, rowTitles[ i ].isNull() ? "" : (const char*)rowTitles[ i ].toLatin1() ); + // set row unit + tblRealAttr->SetRowUnit( nRow+1, units[ i ].isNull() ? "" : (const char*)units[ i ].toLatin1() ); + nRow++; + } + } + if ( nRow > 0 ) { // Set columns only if table is not empty, otherwise exception is raised !!! + // column titles + for ( i = 0; i < colTitles.count(); i++ ) + tblRealAttr->SetColumnTitle( i+1, colTitles[ i ].isNull() ? "" : (const char*)colTitles[ i ].toLatin1() ); + } + } + // title + tblRealAttr->SetTitle( (const char*)myTableMap[ ttReal ]->getTableTitle().toLatin1() ); + } + if ( myTableMap.contains( ttInt ) || myTableMap.contains( ttReal ) ) + builder->CommitCommand(); // commit transaction !!!!!!!!!!!!!!!!!!!!!!!!!!! + else + builder->AbortCommand(); // abort transaction !!!!!!!!!!!!!!!!!!!!!!!!!!! + } + catch( ... ) { + MESSAGE("VISU_TableDlg::onOK : Exception has been caught !!!"); + builder->AbortCommand(); // abort transaction !!!!!!!!!!!!!!!!!!!!!!!!!!! + done = false; + SUIT_MessageBox::critical ( this, tr("ERR_ERROR"), tr("ERR_APP_EXCEPTION") ); + } + } + } + if ( done ) + accept(); +} +*/ + +/*! + button slot, shows corresponding help page +*/ +void VISU_TableDlg::help() +{ + QString aHelpFileName = "table_presentations_page.html"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning( this, + QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) ); + } +} + +/*! + Provides help on F1 button click +*/ +void VISU_TableDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + help(); + } +} + +/*! + Constructor +*/ +VISU_TableDlg::TableWidget::TableWidget( QWidget* parent, + Qt::Orientation orientation ) + : QWidget( parent ), myOrientation( orientation ) +{ + myTitleEdit = new QLineEdit( this ); + + myTable = new QTableWidget( 5, 5, this ); + myTable->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + myTable->setMinimumSize( MIN_TABLE_WIDTH, MIN_TABLE_HEIGHT ); + myTable->setSelectionMode( QAbstractItemView::SingleSelection ); + myTable->setShowGrid( true ); + myTable->horizontalHeader()->setMovable( false ); + myTable->verticalHeader()->setMovable( false ); + myTable->setDragEnabled( false ); + + myAdjustBtn = new QPushButton( VISU_TableDlg::tr( "ADJUST_CELLS_BTN" ), this ); + myAddRowBtn = new QPushButton( VISU_TableDlg::tr( "ADD_ROW_BTN" ), this ); + myDelRowBtn = new QPushButton( VISU_TableDlg::tr( "REMOVE_ROW_BTN" ), this ); + myAddColBtn = new QPushButton( VISU_TableDlg::tr( "ADD_COLUMN_BTN" ), this ); + myDelColBtn = new QPushButton( VISU_TableDlg::tr( "REMOVE_COLUMN_BTN" ), this ); + mySelectAllBtn = new QPushButton( VISU_TableDlg::tr( "SELECT_ALL_BTN" ), this ); + myClearBtn = new QPushButton( VISU_TableDlg::tr( "CLEAR_BTN" ), this ); + + mySortPolicyLabel = new QLabel( VISU_TableDlg::tr( "VISU_TABLES_SORT_POLICY" ), this ); + mySortPolicyCombo = new QComboBox( this ); + mySortPolicyCombo->insertItems( 0, QStringList() << + VISU_TableDlg::tr( "VISU_TABLES_EMPTY_LOWEST" ) << + VISU_TableDlg::tr( "VISU_TABLES_EMPTY_HIGHEST" ) << + VISU_TableDlg::tr( "VISU_TABLES_EMPTY_FIRST" ) << + VISU_TableDlg::tr( "VISU_TABLES_EMPTY_LAST" ) << + VISU_TableDlg::tr( "VISU_TABLES_EMPTY_IGNORE" ) ); + + if ( LightApp_Application* app = ( LightApp_Application* )SUIT_Session::session()->activeApplication() ) { + int aSortPolicy = app->resourceMgr()->integerValue( "VISU", "tables_sort_policy", 3 ); + mySortPolicyCombo->setCurrentIndex( aSortPolicy ); + } + + // the features has been temporarily disabled + myAddRowBtn->hide(); + myDelRowBtn->hide(); + myAddColBtn->hide(); + myDelColBtn->hide(); + mySelectAllBtn->hide(); + myClearBtn->hide(); + + QVBoxLayout* btnLayout = new QVBoxLayout; + btnLayout->setMargin( 0 ); + btnLayout->setSpacing( SPACING_SIZE ); + btnLayout->addWidget( myAdjustBtn ); + btnLayout->addStretch( 20 ); + btnLayout->addWidget( myAddRowBtn ); + btnLayout->addWidget( myDelRowBtn ); + btnLayout->addWidget( myAddColBtn ); + btnLayout->addWidget( myDelColBtn ); + btnLayout->addStretch( 20 ); + btnLayout->addWidget( mySelectAllBtn ); + btnLayout->addWidget( myClearBtn ); + + QHBoxLayout* sortLayout = new QHBoxLayout; + sortLayout->setMargin( 0 ); + sortLayout->setSpacing( SPACING_SIZE ); + sortLayout->addWidget( mySortPolicyLabel ); + sortLayout->addWidget( mySortPolicyCombo ); + sortLayout->addStretch( 1 ); + + QGridLayout* mainLayout = new QGridLayout( this ); + mainLayout->setMargin( 0 ); + mainLayout->setSpacing( SPACING_SIZE ); + mainLayout->addWidget( myTitleEdit, 0, 0, 1, 2 ); + mainLayout->addWidget( myTable, 1, 0 ); + mainLayout->addLayout( btnLayout, 1, 1 ); + mainLayout->addLayout( sortLayout, 2, 0, 1, 2 ); + + connect( myTable, SIGNAL( itemSelectionChanged() ), + this, SLOT( updateButtonsState() ) ); + connect( myTable, SIGNAL( currentItemChanged( QTableWidgetItem*, QTableWidgetItem* ) ), + this, SLOT( updateButtonsState() ) ); + connect( myAddRowBtn, SIGNAL( clicked() ), this, SLOT( addRow() ) ); + connect( myAddColBtn, SIGNAL( clicked() ), this, SLOT( addCol() ) ); + connect( myDelRowBtn, SIGNAL( clicked() ), this, SLOT( delRow() ) ); + connect( myDelColBtn, SIGNAL( clicked() ), this, SLOT( delCol() ) ); + connect( myAdjustBtn, SIGNAL( clicked() ), this, SLOT( adjustTable() ) ); + connect( mySelectAllBtn, SIGNAL( clicked() ), this, SLOT( selectAll() ) ); + connect( myClearBtn, SIGNAL( clicked() ), this, SLOT( clearTable() ) ); + connect( myTable->horizontalHeader(), SIGNAL( sectionClicked( int ) ), + this, SLOT( columnClicked( int ) ) ); + connect( myTable->verticalHeader(), SIGNAL( sectionClicked( int ) ), + this, SLOT( rowClicked( int ) ) ); + myTable->horizontalHeader()->installEventFilter( this ); + myTable->verticalHeader()->installEventFilter( this ); + myTable->installEventFilter( this ); + + updateButtonsState(); +} + +/*! + Destructor +*/ +VISU_TableDlg::TableWidget::~TableWidget() +{ +} + +/*! + Initialize widget +*/ +void VISU_TableDlg::TableWidget::initialize( _PTR(Study) study, VISU::Table_i* table, int type ) +{ + myStudy = study; + myTableObj = table; + myType = type; + + setUnitsTitle( VISU_TableDlg::tr( "UNITS_TLT" ) ); + setEditEnabled( false ); + showColumnTitles( false ); + + updateTableFromServant(); + updateButtonsState(); +} + +void VISU_TableDlg::TableWidget::updateTableFromServant() +{ + _PTR(SObject) aSObject = myStudy->FindObjectID( myTableObj->GetObjectEntry() ); + if ( aSObject ) { + int i, j; + switch ( myType ) { + case ttInt: + myTable->setItemDelegate( new NumDelegateItem( this, NumDelegateItem::NV_Int ) ); + if ( aSObject->FindAttribute( myAttr, "AttributeTableOfInteger" ) ) { + _PTR(AttributeTableOfInteger) intAttr = myAttr; + try { + // title + setTableTitle( intAttr->GetTitle().c_str() ); + // nb of rows & cols + int nbRows = intAttr->GetNbRows() ; + int nbCols = intAttr->GetNbColumns(); + setNumRows( nbRows ); + setNumCols( nbCols ); + // rows titles + QStringList strlist; + std::vector titles = intAttr->GetRowTitles(); + for ( i = 0; i < nbRows; i++ ) { + if ( titles.size() > 0 ) + strlist.append( titles[i].c_str() ); + else + strlist.append( "" ); + } + setRowTitles( strlist ); + // columns titles + strlist.clear(); + titles = intAttr->GetColumnTitles(); + for ( i = 0; i < nbCols; i++ ) { + if ( titles.size() > 0 ) + strlist.append( titles[i].c_str() ); + else + strlist.append( "" ); + } + setColTitles( strlist ); + // units + strlist.clear(); + titles = intAttr->GetRowUnits(); + if ( titles.size() > 0 ) { + for ( i = 0; i < nbRows; i++ ) + strlist.append( titles[i].c_str() ); + setUnits( strlist ); + } + // data + for ( i = 1; i <= nbRows; i++ ) { + strlist.clear(); + for ( j = 1; j <= nbCols; j++ ) { + if ( intAttr->HasValue( i, j ) ) + strlist.append( QString::number( intAttr->GetValue( i, j ) ) ); + else + strlist.append( QString::null ); + } + setRowData( i-1, strlist ); + } + adjustTable(); + } + catch( ... ) { + MESSAGE("VISU_TableDlg::TableWidget::initialize : Exception has been caught !!!"); + } + } + break; + case ttReal: + myTable->setItemDelegate( new NumDelegateItem( this, NumDelegateItem::NV_Real ) ); + if ( aSObject->FindAttribute( myAttr, "AttributeTableOfReal" ) ) { + _PTR(AttributeTableOfReal) realAttr = myAttr; + try { + // title + setTableTitle( realAttr->GetTitle().c_str() ); + // nb of rows & cols + int nbRows = realAttr->GetNbRows() ; + int nbCols = realAttr->GetNbColumns(); + setNumRows( nbRows ); + setNumCols( nbCols ); + // rows titles + QStringList strlist; + std::vector titles = realAttr->GetRowTitles(); + for ( i = 0; i < nbRows; i++ ) { + if ( titles.size() > 0 ) + strlist.append( titles[i].c_str() ); + else + strlist.append( "" ); + } + setRowTitles( strlist ); + // columns titles + strlist.clear(); + titles = realAttr->GetColumnTitles(); + for ( i = 0; i < nbCols; i++ ) { + if ( titles.size() > 0 ) + strlist.append( titles[i].c_str() ); + else + strlist.append( "" ); + } + setColTitles( strlist ); + // units + strlist.clear(); + titles = realAttr->GetRowUnits(); + if ( titles.size() > 0 ) { + for ( i = 0; i < nbRows; i++ ) + strlist.append( titles[i].c_str() ); + setUnits( strlist ); + } + // data + for ( i = 1; i <= nbRows; i++ ) { + strlist.clear(); + for ( j = 1; j <= nbCols; j++ ) { + if ( realAttr->HasValue( i, j ) ) + strlist.append( QString::number( realAttr->GetValue( i, j ) ) ); + else + strlist.append( QString::null ); + } + setRowData( i-1, strlist ); + } + adjustTable(); + } + catch( ... ) { + MESSAGE("VISU_TableDlg::TableWidget::initialize : Exception has been caught !!!"); + } + } + break; + default: + break; + } + } +} + +/*! + Enable / disable editing +*/ +void VISU_TableDlg::TableWidget::setEditEnabled( bool enable ) +{ + if( !enable ) { + myTable->horizontalHeader()->setSortIndicatorShown( false ); + myTable->verticalHeader()->setSortIndicatorShown( false ); + adjustTable(); + } + + mySortPolicyLabel->setEnabled( enable ); + mySortPolicyCombo->setEnabled( enable ); + + // the rest features have been temporarily disabled + enable = false; + + myTitleEdit->setReadOnly( !enable ); + myTable->setEditTriggers( enable ? + QAbstractItemView::DoubleClicked | + QAbstractItemView::SelectedClicked | + QAbstractItemView::EditKeyPressed : + QAbstractItemView::NoEditTriggers ); + myAddRowBtn->setVisible( enable ); + myDelRowBtn->setVisible( enable ); + myAddColBtn->setVisible( enable ); + myDelColBtn->setVisible( enable ); + mySelectAllBtn->setVisible( enable ); + myClearBtn->setVisible( enable ); +} + +/*! + Show / hide column titles +*/ +void VISU_TableDlg::TableWidget::showColumnTitles( bool showTitles ) +{ + if ( myOrientation == Qt::Horizontal ) + myTable->horizontalHeader()->setVisible( showTitles ); + else + myTable->verticalHeader()->setVisible( showTitles ); +} + +/*! + Sets table title +*/ +void VISU_TableDlg::TableWidget::setTableTitle( const QString& title ) +{ + myTitleEdit->setText( title ); +} + +/*! + Gets table title +*/ +QString VISU_TableDlg::TableWidget::getTableTitle() +{ + return myTitleEdit->text(); +} + +/*! + Sets total number of rows +*/ +void VISU_TableDlg::TableWidget::setNumRows( const int num ) +{ + myOrientation == Qt::Horizontal ? myTable->setRowCount( num ) : myTable->setColumnCount( num ); +} + +/*! + Gets total number of rows +*/ +int VISU_TableDlg::TableWidget::getNumRows() +{ + return myOrientation == Qt::Horizontal ? myTable->rowCount() : myTable->columnCount(); +} + +/*! + Sets total number of columns +*/ +void VISU_TableDlg::TableWidget::setNumCols( const int num ) +{ + // !!! first column contains units !!! + myOrientation == Qt::Horizontal ? myTable->setColumnCount( num+1 ) : myTable->setRowCount( num+1 ); +// myOrientation == Qt::Horizontal ? myTable->setColumnReadOnly( 0, true ) : myTable->setRowReadOnly( 0, true ); +} + +/*! + Gets total number of columns +*/ +int VISU_TableDlg::TableWidget::getNumCols() +{ + // !!! first column contains units !!! + return myOrientation == Qt::Horizontal ? myTable->columnCount()-1 : myTable->rowCount()-1; +} +/*! + Sets rows titles +*/ +void VISU_TableDlg::TableWidget::setRowTitles( QStringList& tlts ) +{ + QStringList aLabels; + for ( int i = 0; i < tlts.count(); i++ ) + tlts[i].isNull() ? aLabels.append("") : aLabels.append( tlts[i] ); + + myOrientation == Qt::Horizontal ? + myTable->setVerticalHeaderLabels( aLabels ) : + myTable->setHorizontalHeaderLabels( aLabels ); + + // myTable->verticalHeader()->setLabel( i, tlts[i] ) : + //myTable->horizontalHeader()->setLabel( i, tlts[i] ); + //} +} +/*! + Gets rows titles +*/ +void VISU_TableDlg::TableWidget::getRowTitles( QStringList& tlts ) +{ + tlts.clear(); + if ( myOrientation == Qt::Horizontal ) { + for ( int i = 0; i < myTable->rowCount(); i++ ) { + tlts.append( myTable->verticalHeaderItem(i) ? myTable->verticalHeaderItem(i)->text() : "" ); + } + } + else { + for ( int i = 0; i < myTable->columnCount(); i++ ) { + tlts.append( myTable->horizontalHeaderItem(i) ? myTable->horizontalHeaderItem(i)->text() : "" ); + } + } +} +/*! + Sets columns titles +*/ +void VISU_TableDlg::TableWidget::setColTitles( QStringList& tlts ) +{ + QStringList aLabels; + + // !!! first column contains units !!! + aLabels.append(""); // it'll be initialized below - in setUnitsTitle() method + + for ( int i = 0; i < tlts.count(); i++ ) + tlts[i].isNull() ? aLabels.append("") : aLabels.append( tlts[i] ); + + myOrientation == Qt::Horizontal ? + myTable->setHorizontalHeaderLabels( aLabels ) : + myTable->setVerticalHeaderLabels( aLabels ); + + setUnitsTitle( VISU_TableDlg::tr( "UNITS_TLT" ) ); +} +/*! + Sets columns titles +*/ +void VISU_TableDlg::TableWidget::getColTitles( QStringList& tlts ) +{ + // !!! first column contains units !!! + tlts.clear(); + if ( myOrientation == Qt::Horizontal ) { + for ( int i = 1; i < myTable->columnCount(); i++ ) { + tlts.append( myTable->horizontalHeaderItem(i) ? myTable->horizontalHeaderItem(i)->text() : "" ); + } + } + else { + for ( int i = 1; i < myTable->rowCount(); i++ ) { + tlts.append( myTable->verticalHeaderItem(i) ? myTable->verticalHeaderItem(i)->text() : "" ); + } + } +} +/*! + Sets units title +*/ +void VISU_TableDlg::TableWidget::setUnitsTitle( const QString& tlt ) { + // !!! first column contains units !!! + myTable->model()->setHeaderData( 0, myOrientation, QVariant(tlt.isNull() ? "" : tlt), Qt::DisplayRole ); +} +/*! + Sets units +*/ +void VISU_TableDlg::TableWidget::setUnits( QStringList& units ) +{ + QAbstractTableModel* aModel = qobject_cast( myTable->model() ); + if ( aModel ) + { + QModelIndex anIndex; + for ( int i = 0; i < units.count(); i++ ) + { + myOrientation == Qt::Horizontal ? + anIndex = aModel->index( i, 0 ) : + anIndex = aModel->index( 0, i ); + + aModel->setData( anIndex, QVariant( units[i].isNull() ? "" : units[i] ) ); + } + } +} +/*! + Gets units +*/ +void VISU_TableDlg::TableWidget::getUnits( QStringList& units ) +{ + units.clear(); + QAbstractTableModel* aModel = qobject_cast( myTable->model() ); + if ( aModel ) + { + if ( myOrientation == Qt::Horizontal ) + { + for ( int i = 0; i < myTable->rowCount(); i++ ) + units.append( aModel->index( i, 0 ).data().toString() ); + } + else { + for ( int i = 0; i < myTable->columnCount(); i++ ) + units.append( aModel->index( 0, i ).data().toString() ); + } + } +} +/*! + Sets row data +*/ +void VISU_TableDlg::TableWidget::setRowData( int row, QStringList& data ) +{ + QAbstractTableModel* aModel = qobject_cast( myTable->model() ); + if ( aModel ) + { + QModelIndex anIndex; + if ( row >= 0 && row < getNumRows() ) { + for ( int i = 0; i < data.count(); i++ ) + { + myOrientation == Qt::Horizontal ? anIndex = aModel->index( row, i+1 ) : + anIndex = aModel->index( i+1, row ); + aModel->setData( anIndex, QVariant( data[i] ) ); + + } + } + } +} +/*! + Gets row data +*/ +void VISU_TableDlg::TableWidget::getRowData( int row, QStringList& data ) +{ + data.clear(); + QAbstractTableModel* aModel = qobject_cast( myTable->model() ); + if ( aModel ) + { + if ( row >= 0 && row < getNumRows() ) + { + if ( myOrientation == Qt::Horizontal ) + { + for ( int i = 1; i < myTable->columnCount(); i++ ) + data.append( aModel->index( row, i ).data().toString() ); + } + else { + for ( int i = 1; i < myTable->rowCount(); i++ ) + data.append( aModel->index( i, row ).data().toString() ); + } + } + } +} +/*! + Adjusts table cell to see contents, button slot +*/ +void VISU_TableDlg::TableWidget::adjustTable() +{ + myTable->resizeRowsToContents(); + myTable->resizeColumnsToContents(); +} +/*! + Called when selection changed in table +*/ +void VISU_TableDlg::TableWidget::updateButtonsState() +{ + if ( myTable->editTriggers() == QAbstractItemView::NoEditTriggers ) + return; + bool bDR = false; // + bool bDC = false; // + bool bSA = false; // button slot +*/ +void VISU_TableDlg::TableWidget::selectAll() +{ + /*myTable->clearSelection(); + QTableSelection ts; + ts.init( 0, 0 ); ts.expandTo( myTable->numRows()-1, myTable->numCols()-1 ); + myTable->addSelection( ts );*/ + myTable->selectAll(); + updateButtonsState(); +} +/*! + button slot +*/ +void VISU_TableDlg::TableWidget::clearTable() +{ + /*int nbSel = myTable->numSelections(); + for ( int i = 0; i < nbSel; i++ ) { + QTableSelection ts = myTable->selection( i ); + for ( int j = ts.topRow(); j < ts.bottomRow()+1; j++) { + if ( myOrientation == Qt::Vertical && j == 0 ) { +// continue; // UNITS + } + for ( int k = ts.leftCol(); k < ts.rightCol()+1; k++) { + if ( myOrientation == Qt::Horizontal && k == 0 ) { +// continue; // UNITS + } + myTable->clearCell( j, k ); + } + } + } + if ( nbSel == 0 ) + myTable->clearCell( myTable->currentRow(), myTable->currentColumn() ); + myTable->clearSelection();*/ + myTable->clearContents(); + updateButtonsState(); +} +/*! + Column clicked slot +*/ +void VISU_TableDlg::TableWidget::columnClicked( int column ) +{ + if ( myTableObj && mySortPolicyCombo->isEnabled() ) { + myTableObj->SortByRow( column + 1, + ( VISU::SortOrder )myTable->horizontalHeader()->sortIndicatorOrder(), + ( VISU::SortPolicy )mySortPolicyCombo->currentIndex() ); + myTable->horizontalHeader()->setSortIndicatorShown( true ); + myTable->verticalHeader()->setSortIndicatorShown( false ); + updateTableFromServant(); + } +} +/*! + Row clicked slot +*/ +void VISU_TableDlg::TableWidget::rowClicked( int row ) +{ + /* the feature has been temporarily disabled + if ( myTableObj && mySortPolicyCombo->isEnabled() && row > 0 ) { // first row contains units + myTableObj->SortByColumn( row, + ( VISU::SortOrder )myTable->verticalHeader()->sortIndicatorOrder(), + ( VISU::SortPolicy )mySortPolicyCombo->currentIndex() ); + myTable->horizontalHeader()->setSortIndicatorShown( false ); + myTable->verticalHeader()->setSortIndicatorShown( true ); + updateTableFromServant(); + } + */ +} +/*! + Event filter - handles titles editing +*/ +bool VISU_TableDlg::TableWidget::eventFilter( QObject* o, QEvent* e ) +{ + if ( e->type() == QEvent::MouseButtonDblClick) { + //TODO + /*QMouseEvent* me = ( QMouseEvent* )e; + if ( me->button() == Qt::LeftButton && (myTable->editTriggers() != QAbstractItemView::NoEditTriggers ) ) { + if ( o == myTable->horizontalHeader() ) { + for ( int i = 0; i < myTable->horizontalHeader()->count(); i++ ) { + QRect rect = myTable->horizontalHeader()->sectionRect( i ); + rect.addCoords( 1, 1, -1, -1 ); + if ( rect.contains( myTable->horizontalHeader()->mapFromGlobal( me->globalPos() ) ) ) { + if ( myOrientation == Qt::Vertical || i != 0 ) { + bool bOk; + QString tlt = QInputDialog::getText( tr( "SET_TITLE_TLT" ), + tr( "TITLE_LBL" ), + QLineEdit::Normal, + myTable->horizontalHeader()->label( i ), + &bOk, + this ); + if ( bOk && !tlt.isNull() ) + myTable->horizontalHeader()->setLabel( i, tlt ); + break; + } + } + } + } + if ( o == myTable->verticalHeader() ) { + for ( int i = 0; i < myTable->verticalHeader()->count(); i++ ) { + QRect rect = myTable->verticalHeader()->sectionRect( i ); + rect.addCoords( 1, 1, -1, -1 ); + if ( rect.contains( myTable->verticalHeader()->mapFromGlobal( me->globalPos() ) ) ) { + if ( myOrientation == Qt::Horizontal || i != 0 ) { + bool bOk; + QString tlt = QInputDialog::getText( tr( "SET_TITLE_TLT" ), + tr( "TITLE_LBL" ), + QLineEdit::Normal, + myTable->verticalHeader()->label( i ), + &bOk, + this ); + if ( bOk && !tlt.isNull() ) + myTable->verticalHeader()->setLabel( i, tlt ); + break; + } + } + } + } + }*/ + } + else if ( e->type() == QEvent::KeyRelease && o == myTable ) { + QKeyEvent* ke = (QKeyEvent*)e; + if ( ke->key() == Qt::Key_Delete && (myTable->editTriggers() != QAbstractItemView::NoEditTriggers) ) { + clearTable(); + } + else if ( ke->key() == Qt::Key_Backspace && (myTable->editTriggers() != QAbstractItemView::NoEditTriggers) ) { + clearTable(); + int i = myTable->currentRow(); + int j = myTable->currentColumn() - 1; + if ( j < 0 ) { j = myTable->columnCount()-1; i--; } + if ( i >= 0 && j >= 0 ) + myTable->setCurrentCell( i, j ); + } + } + return QWidget::eventFilter( o, e ); +} diff --git a/src/VISU_I/VISU_TableDlg.h b/src/VISU_I/VISU_TableDlg.h new file mode 100644 index 00000000..a911a6ce --- /dev/null +++ b/src/VISU_I/VISU_TableDlg.h @@ -0,0 +1,184 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : VISU_TableDlg.h +// Author : Vadim SANDLER +// Module : VISU +// +#ifndef VISU_TABLEDLG_H +#define VISU_TABLEDLG_H + +#include "VISU_I.hxx" + +#include + +#include +#include +#include + +class QLabel; +class QLineEdit; +class QPushButton; +class QCheckBox; +class QComboBox; +class QTableWidget; + +namespace VISU +{ + class Table_i; +} + +class VISU_I_EXPORT VISU_TableDlg : public QDialog +{ + Q_OBJECT + + class TableWidget; + class WidgetCointainer; + + enum { tcTitle, tcTable, tcControls, tcButtons }; + +public: + + enum { ttNone, ttInt, ttReal, ttAll, ttAuto }; + enum { teNone = 0x00, + teAddRemove = 0x01, + teEditData = 0x02, + teRowColumn = 0x04, + teAll = teAddRemove | teEditData | teRowColumn + }; + + VISU_TableDlg( QWidget* parent, + _PTR(Study) study, + VISU::Table_i* table, + bool allowEdition = false, + int which = ttAuto, + Qt::Orientation orient = Qt::Horizontal, + bool showColumnTitles = true ); + ~VISU_TableDlg(); + +protected: + void keyPressEvent( QKeyEvent* e ); + +private slots: + void help(); + +private: + QString tableTitle( int type ); + +private: + typedef QMap TableMap; + typedef QMap ContMap; + + TableMap myTableMap; + ContMap myContMap; + QCheckBox* myEditCheck; + QCheckBox* myUpdateCheck; + QPushButton* myOKBtn; + QPushButton* myHelpBtn; + + _PTR(Study) myStudy; + VISU::Table_i* myTable; +}; + +class VISU_I_EXPORT VISU_TableDlg::TableWidget : public QWidget +{ + Q_OBJECT + +public: + TableWidget( QWidget* parent = 0, Qt::Orientation orientation = Qt::Horizontal ); + ~TableWidget(); + + void initialize( _PTR(Study) study, VISU::Table_i* table, int type ); + + void setTableTitle( const QString& title ); + QString getTableTitle(); + void setNumRows( const int num ); + int getNumRows(); + void setNumCols( const int num ); + int getNumCols(); + void setRowTitles( QStringList& tlts ); + void getRowTitles( QStringList& tlts ); + void setColTitles( QStringList& tlts ); + void getColTitles( QStringList& tlts ); + void setUnitsTitle( const QString& tlt ); + void setUnits( QStringList& units ); + void getUnits( QStringList& units ); + void setRowData( int row, QStringList& data ); + void getRowData( int row, QStringList& data ); + + bool eventFilter( QObject* o, QEvent* e); + +public slots: + void setEditEnabled( bool enable ); + void showColumnTitles( bool showTitles ); + + void updateButtonsState(); + void addRow(); + void addCol(); + void delRow(); + void delCol(); + void adjustTable(); + void selectAll(); + void clearTable(); + + void columnClicked( int ); + void rowClicked( int ); + +protected: + void updateTableFromServant(); + +private: + _PTR(Study) myStudy; + VISU::Table_i* myTableObj; + _PTR(GenericAttribute) myAttr; + int myType; + + QLineEdit* myTitleEdit; + QTableWidget* myTable; + QPushButton* myAddRowBtn; + QPushButton* myAddColBtn; + QPushButton* myDelRowBtn; + QPushButton* myDelColBtn; + QPushButton* myAdjustBtn; + QPushButton* mySelectAllBtn; + QPushButton* myClearBtn; + QLabel* mySortPolicyLabel; + QComboBox* mySortPolicyCombo; + Qt::Orientation myOrientation; +}; + +class VISU_I_EXPORT NumDelegateItem: public QItemDelegate +{ +public: + enum NumValidator{ NV_Int, NV_Real }; + + NumDelegateItem( QObject* parent, NumValidator mode = NV_Int ); + virtual ~NumDelegateItem(); + + virtual QWidget* createEditor( QWidget* parent, + const QStyleOptionViewItem& option, + const QModelIndex& index ) const; + virtual void setEditorData( QWidget* editor, + const QModelIndex& index ) const; +private: + int myMode; +}; + +#endif // VISU_TABLEDLG_H + diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 80a3a484..6165090f 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -115,6 +115,127 @@ VISU::Table_i return myOrientation; } + +//---------------------------------------------------------------------------- +void +VISU::Table_i +::SortRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy) +{ + SALOMEDS::SObject_var SO = mySObj; + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); + if ( !SO->_is_nil() ) { + SALOMEDS::GenericAttribute_var anAttr; + if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) { + SALOMEDS::AttributeTableOfInteger_var anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr ); + anInt->SortRow( theRow, (SALOMEDS::AttributeTable::SortOrder)theSortOrder, + (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy ); + } + else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) { + SALOMEDS::AttributeTableOfReal_var aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr ); + aReal->SortRow( theRow, (SALOMEDS::AttributeTable::SortOrder)theSortOrder, + (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy ); + } + UpdateCurves( std::map() ); + } +} + +//---------------------------------------------------------------------------- +void +VISU::Table_i +::SortColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy) +{ + SALOMEDS::SObject_var SO = mySObj; + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); + if ( !SO->_is_nil() ) { + SALOMEDS::GenericAttribute_var anAttr; + if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) { + SALOMEDS::AttributeTableOfInteger_var anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr ); + anInt->SortColumn( theColumn, (SALOMEDS::AttributeTable::SortOrder)theSortOrder, + (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy ); + } + else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) { + SALOMEDS::AttributeTableOfReal_var aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr ); + aReal->SortColumn( theColumn, (SALOMEDS::AttributeTable::SortOrder)theSortOrder, + (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy ); + } + UpdateCurves( std::map() ); + } +} + +//---------------------------------------------------------------------------- +void +VISU::Table_i +::SortByRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy) +{ + SALOMEDS::SObject_var SO = mySObj; + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); + if ( !SO->_is_nil() ) { + SALOMEDS::GenericAttribute_var anAttr; + if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) { + SALOMEDS::AttributeTableOfInteger_var anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr ); + anInt->SortByRow( theRow, (SALOMEDS::AttributeTable::SortOrder)theSortOrder, + (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy ); + } + else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) { + SALOMEDS::AttributeTableOfReal_var aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr ); + aReal->SortByRow( theRow, (SALOMEDS::AttributeTable::SortOrder)theSortOrder, + (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy ); + } + UpdateCurves( std::map() ); + } +} + +//---------------------------------------------------------------------------- +void +VISU::Table_i +::SortByColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy) +{ + SALOMEDS::SObject_var SO = mySObj; + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); + if ( !SO->_is_nil() ) { + SALOMEDS::LongSeq_var aRowIndices; + SALOMEDS::GenericAttribute_var anAttr; + if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) { + SALOMEDS::AttributeTableOfInteger_var anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr ); + aRowIndices = anInt->SortByColumn( theColumn, (SALOMEDS::AttributeTable::SortOrder)theSortOrder, + (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy ); + } + else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) { + SALOMEDS::AttributeTableOfReal_var aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr ); + aRowIndices = aReal->SortByColumn( theColumn, (SALOMEDS::AttributeTable::SortOrder)theSortOrder, + (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy ); + } + std::map aMixData; + for ( int i = 0, n = aRowIndices->length(); i < n; i++ ) + aMixData[ aRowIndices[i] ] = i+1; + UpdateCurves( aMixData ); + } +} + +//---------------------------------------------------------------------------- +void +VISU::Table_i +::UpdateCurves(std::map theMixData) +{ + SALOMEDS::SObject_var SO = mySObj; + SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); + SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( SO ); + for ( CI->InitEx( true ); CI->More(); CI->Next() ) { + CORBA::Object_var anObj = SObjectToObject( CI->Value() ); + VISU::Curve_var aCurve = VISU::Curve::_narrow( anObj ); + if ( !aCurve->_is_nil() ) { + if ( VISU::Curve_i* pCurve = dynamic_cast( GetServant( aCurve ).in() ) ) { + int aHRow = pCurve->GetHRow(), aVRow = pCurve->GetVRow(); + if ( theMixData.find( aHRow ) != theMixData.end() ) + pCurve->SetHRow( theMixData[ aHRow ] ); + if ( theMixData.find( aVRow ) != theMixData.end() ) + pCurve->SetVRow( theMixData[ aVRow ] ); + UpdatePlot2d( pCurve, eUpdateData ); + } + } + } +} + //---------------------------------------------------------------------------- SALOMEDS::SObject_var VISU::Table_i diff --git a/src/VISU_I/VISU_Table_i.hh b/src/VISU_I/VISU_Table_i.hh index 4303f6b6..3d876f1f 100644 --- a/src/VISU_I/VISU_Table_i.hh +++ b/src/VISU_I/VISU_Table_i.hh @@ -54,10 +54,16 @@ namespace VISU{ virtual CORBA::Long GetNbRows(); virtual CORBA::Long GetNbColumns(); + virtual void SortRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy); + virtual void SortColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy); + virtual void SortByRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy); + virtual void SortByColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy); + virtual void RemoveFromStudy(); protected: Storable* Build(int theRestoring); + void UpdateCurves(std::map theMixData); protected: VISU::Table::Orientation myOrientation; @@ -135,9 +141,14 @@ namespace VISU{ public: virtual Storable* Create(); - int GetHRow() const { return myHRow;} - int GetVRow() const { return myVRow;} - int GetZRow() const { return myZRow;} + int GetHRow() const { return myHRow; } + void SetHRow( const int theHRow ) { myHRow = theHRow; } + + int GetVRow() const { return myVRow; } + void SetVRow( const int theVRow ) { myVRow = theVRow; } + + int GetZRow() const { return myZRow; } + void SetZRow( const int theZRow ) { myZRow = theZRow; } virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO); diff --git a/src/VISU_I/VISU_ViewManager_i.cc b/src/VISU_I/VISU_ViewManager_i.cc index 0bc32345..31937462 100644 --- a/src/VISU_I/VISU_ViewManager_i.cc +++ b/src/VISU_I/VISU_ViewManager_i.cc @@ -41,9 +41,11 @@ #include "SVTK_ViewModel.h" #include "VTKViewer_Algorithm.h" #include "SPlot2d_Curve.h" +#include "SPlot2d_ViewModel.h" #include "Plot2d_ViewFrame.h" #include "Plot2d_ViewWindow.h" #include "Plot2d_ViewModel.h" +#include "Plot2d_ViewManager.h" #include "SalomeApp_Study.h" #include "SalomeApp_Application.h" @@ -330,11 +332,64 @@ namespace VISU { return anVISUActor; } - void UpdatePlot2d (Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve) + struct TUpdatePlot2dEvent: public SALOME_Event + { + Curve_i* myCurve; + int myDisplaying; + + TUpdatePlot2dEvent (Curve_i* theCurve, const int theDisplaying): + myCurve(theCurve), + myDisplaying(theDisplaying) + {} + + virtual void Execute() + { + SalomeApp_Application* anApp = NULL; + CORBA::String_var studyName = myCurve->GetStudyDocument()->Name(); + std::string aStudyName = studyName.in(); + SUIT_Session* aSession = SUIT_Session::session(); + QList anApplications = aSession->applications(); + QList::Iterator anIter = anApplications.begin(); + while (anIter != anApplications.end()) { + SUIT_Application* aSUITApp = *anIter; + if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) { + if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { + if (_PTR(Study) aCStudy = aStudy->studyDS()) { + if (aStudyName == aCStudy->Name()) { + anApp = dynamic_cast(aSUITApp); + break; + } + } + } + } + anIter++; + } + if (!anApp) + return; + + ViewManagerList aViewManagerList; + anApp->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList); + SUIT_ViewManager* aViewManager; + foreach( aViewManager, aViewManagerList ) { + if (Plot2d_ViewManager* aManager = dynamic_cast(aViewManager)) { + if (SPlot2d_Viewer* aViewer = dynamic_cast(aManager->getViewModel())) { + if (Plot2d_ViewFrame* aViewFrame = aViewer->getActiveViewFrame()) { + UpdatePlot2d(myCurve, myDisplaying, aViewFrame); + } + } + } + } + } + }; + + void UpdatePlot2d (Curve_i* theCurve, int theDisplaying, Plot2d_ViewFrame* theView) { if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = " << theDisplaying); - if (!theView) + if (!theView) { + // update all views + ProcessVoidEvent(new TUpdatePlot2dEvent(theCurve, theDisplaying)); return; + } QList clist; theView->getCurves(clist); if (theDisplaying == eEraseAll) { @@ -353,18 +408,21 @@ namespace VISU { } } } - } else if (theDisplaying == eDisplay) { + } else if (theDisplaying == eDisplay || + theDisplaying == eDisplayOnly || + theDisplaying == eUpdateData) { if (theCurve) { bool bFound = false; for (int i = 0; i < clist.count(); i++) { SPlot2d_Curve* aSPlot2dC = dynamic_cast(clist.at(i)); if (aSPlot2dC->hasIO() && !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) { - if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC); - aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() ); - aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() ); - aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() ); - aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() ); + if (theDisplaying == eUpdateData) { + if(MYDEBUG) MESSAGE("UpdatePlot2d - updating data : curve - " << aSPlot2dC); + } + else { + if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC); + } double* xList = 0; double* yList = 0; QStringList zList; @@ -372,21 +430,31 @@ namespace VISU { if (nbPoints > 0 && xList && yList) { aSPlot2dC->setData( xList, yList, nbPoints, zList ); } - if (!theCurve->IsAuto()) { - aSPlot2dC->setLine((Plot2d::LineType)theCurve->GetLine(), - theCurve->GetLineWidth()); - aSPlot2dC->setMarker((Plot2d::MarkerType)theCurve->GetMarker()); - SALOMEDS::Color color = theCurve->GetColor(); - aSPlot2dC->setColor(QColor((int)(color.R*255.), - (int)(color.G*255.), - (int)(color.B*255.))); + if (theDisplaying == eUpdateData) { + theView->updateCurve(aSPlot2dC, true); + } else { + aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() ); + aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() ); + aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() ); + aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() ); + if (!theCurve->IsAuto()) { + aSPlot2dC->setLine((Plot2d::LineType)theCurve->GetLine(), + theCurve->GetLineWidth()); + aSPlot2dC->setMarker((Plot2d::MarkerType)theCurve->GetMarker()); + SALOMEDS::Color color = theCurve->GetColor(); + aSPlot2dC->setColor(QColor((int)(color.R*255.), + (int)(color.G*255.), + (int)(color.B*255.))); + } + aSPlot2dC->setAutoAssign(theCurve->IsAuto()); + theView->displayCurve(aSPlot2dC); + bFound = true; } - aSPlot2dC->setAutoAssign(theCurve->IsAuto()); - theView->displayCurve(aSPlot2dC); - bFound = true; + } else if (theDisplaying == eDisplayOnly) { + theView->eraseCurve(aSPlot2dC); } - } - if (!bFound) { + } + if (!bFound && theDisplaying != eUpdateData) { Plot2d_Curve* crv = theCurve->CreatePresentation(); if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve (new) - "<(clist.at(i)); - if (aSPlot2dC->hasIO() && - !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) { - if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve - " << aSPlot2dC); - aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() ); - aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() ); - aSPlot2dC->setHorUnits( theCurve->GetHorUnits().c_str() ); - aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() ); - double* xList = 0; - double* yList = 0; - QStringList zList; - int nbPoints = theCurve->GetData( xList, yList, zList ); - if ( nbPoints > 0 && xList && yList ) { - aSPlot2dC->setData( xList, yList, nbPoints, zList ); - } - if ( !theCurve->IsAuto() ) { - aSPlot2dC->setLine((Plot2d::LineType)theCurve->GetLine(), theCurve->GetLineWidth()); - aSPlot2dC->setMarker((Plot2d::MarkerType)theCurve->GetMarker()); - SALOMEDS::Color color = theCurve->GetColor(); - aSPlot2dC->setColor(QColor((int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.))); - } - aSPlot2dC->setAutoAssign(theCurve->IsAuto()); - theView->displayCurve(aSPlot2dC); - bFound = true; - } else { - theView->eraseCurve(aSPlot2dC); - } - } - if (!bFound) { - Plot2d_Curve* crv = theCurve->CreatePresentation(); - if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve (new) - " << crv); - if (crv) { - theView->displayCurve(crv); - 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); - crv->setAutoAssign(theCurve->IsAuto()); - } - } - } } } diff --git a/src/VISU_I/VISU_ViewManager_i.hh b/src/VISU_I/VISU_ViewManager_i.hh index 25237ca8..5aa7fcf4 100644 --- a/src/VISU_I/VISU_ViewManager_i.hh +++ b/src/VISU_I/VISU_ViewManager_i.hh @@ -71,9 +71,9 @@ namespace VISU { void RepaintView (SUIT_ViewWindow* theViewWindow); - enum Displaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll}; + enum Displaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll, eUpdateData}; VISU_I_EXPORT VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs = NULL); - void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve); + void UpdatePlot2d (Curve_i* theCurve, int theDisplaying, Plot2d_ViewFrame* theView = NULL); VISU_I_EXPORT VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d); VISU_I_EXPORT VISU_ActorBase* FindActorBase(SVTK_ViewWindow* theViewWindow, VISU::TActorFactory* theActor); diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index b9f660ce..aaf3c9a3 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -33,7 +33,7 @@ #include "VISU_ScalarMap_i.hh" #include "VISU_ViewManager_i.hh" -#include "VisuGUI_TableDlg.h" +#include "VISU_TableDlg.h" #include "VISU_Actor.h" #include "VISU_ScalarMapAct.h" @@ -1336,7 +1336,7 @@ namespace VISU { { // is it Curve ? if (Curve_i* aCurve = dynamic_cast(VISU::GetServant(myPrsObj).in())) { - UpdatePlot2d(myView,myDisplaing,aCurve); + UpdatePlot2d(aCurve,myDisplaing,myView); } // is it Container ? if (Container_i* aContainer = dynamic_cast(VISU::GetServant(myPrsObj).in())) { @@ -1344,7 +1344,7 @@ namespace VISU { for ( int i = 1; i <= nbCurves; i++ ) { VISU::Curve_i* aCurve = aContainer->GetCurve( i ); if ( aCurve && aCurve->IsValid() ) { - UpdatePlot2d(myView,myDisplaing,aCurve); + UpdatePlot2d(aCurve,myDisplaing,myView); } } myView->Repaint(); @@ -1366,8 +1366,8 @@ namespace VISU { if (!CORBA::is_nil(childObject)) { CORBA::Object_ptr aCurve = VISU::Curve::_narrow(childObject); if (!CORBA::is_nil(aCurve)) - UpdatePlot2d(myView, myDisplaing, - dynamic_cast(VISU::GetServant(aCurve).in())); + UpdatePlot2d(dynamic_cast(VISU::GetServant(aCurve).in()), + myDisplaing, myView); } } myView->Repaint(); @@ -1471,7 +1471,7 @@ namespace VISU { SalomeApp_Application* myApplication; VISU::Table_i* myTable; - typedef VisuGUI_TableDlg* TResult; + typedef VISU_TableDlg* TResult; TResult myResult; TCreateTableViewEvent (SalomeApp_Application* theApplication, @@ -1489,15 +1489,13 @@ namespace VISU { if (SUIT_Study* aSStudy = myApplication->activeStudy()) { if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { if (_PTR(Study) aCStudy = aStudy->studyDS()) { - _PTR(SObject) aSObject = aCStudy->FindObjectID(myTable->GetObjectEntry()); - if (aSObject) { - myResult = new VisuGUI_TableDlg (myApplication->desktop(), - aSObject, - false, - VisuGUI_TableDlg::ttAuto, - Qt::Vertical); + myResult = new VISU_TableDlg (myApplication->desktop(), + aCStudy, + myTable, + false, + VISU_TableDlg::ttAuto, + Qt::Vertical); myResult->show(); - } } } } @@ -1528,8 +1526,8 @@ namespace VISU { void TableView_i::SetTitle (const char* theTitle) { - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (myView, &VisuGUI_TableDlg::setWindowTitle, QString(theTitle))); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (myView, &VISU_TableDlg::setWindowTitle, QString(theTitle))); } char* TableView_i::GetTitle() diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index 6e644af5..86e4f977 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -32,7 +32,7 @@ class QWidget; -class VisuGUI_TableDlg; +class VISU_TableDlg; class SalomeApp_Application; @@ -212,7 +212,7 @@ namespace VISU virtual void Close(); protected: - VisuGUI_TableDlg* myView; + VISU_TableDlg* myView; public: virtual Storable* Create (VISU::Table_ptr theTable); }; diff --git a/src/VVTK/Makefile.am b/src/VVTK/Makefile.am deleted file mode 100755 index ace532c0..00000000 --- a/src/VVTK/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : Alexander Solovyov(OCN) -# Module : VVTK -# $Header: -# -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES= libVVTK.la - -# header files -salomeinclude_HEADERS= \ - VVTK.h \ - VVTK_PrimitiveBox.h \ - VVTK_SizeBox.h - -dist_libVVTK_la_SOURCES= \ - VVTK_PrimitiveBox.cxx \ - VVTK_SizeBox.cxx - -MOC_FILES= \ - VVTK_PrimitiveBox_moc.cxx \ - VVTK_SizeBox_moc.cxx - -nodist_libVVTK_la_SOURCES=$(MOC_FILES) - -libVVTK_la_CPPFLAGS= \ - $(QT_INCLUDES) \ - @CAS_CXXFLAGS@ @CAS_CPPFLAGS@ \ - $(VTK_INCLUDES) \ - $(BOOST_CPPFLAGS) \ - $(KERNEL_CXXFLAGS) \ - $(GUI_CXXFLAGS) \ - $(MED_CXXFLAGS) \ - -I$(srcdir)/../OBJECT -I$(srcdir)/../PIPELINE -I$(srcdir)/../CONVERTOR - -libVVTK_la_LDFLAGS= \ - ../OBJECT/libVisuObject.la \ - ../PIPELINE/libVisuPipeLine.la \ - ../CONVERTOR/libVisuConvertor.la \ - $(KERNEL_LDFLAGS) -lOpUtil \ - $(GUI_LDFLAGS) -lsuit -lCAM -lSalomeObject -lSVTK \ - $(QT_MT_LIBS) \ - $(OCC_LIBS) \ - $(VTK_LIBS) diff --git a/src/VVTK/VVTK.h b/src/VVTK/VVTK.h deleted file mode 100755 index 9564091c..00000000 --- a/src/VVTK/VVTK.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifdef WNT -#if defined VISU_VVTK_EXPORTS || defined VVTK_EXPORTS -#define VVTK_EXPORT __declspec(dllexport) -#else -#define VVTK_EXPORT __declspec(dllimport) -#endif -#else -#define VVTK_EXPORT -#endif - -#if defined WNT -#pragma warning ( disable: 4251 ) -#endif diff --git a/src/VVTK/VVTK_ImageWriter.cxx b/src/VVTK/VVTK_ImageWriter.cxx deleted file mode 100755 index 463eba43..00000000 --- a/src/VVTK/VVTK_ImageWriter.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME VTKViewer : build VTK viewer into Salome desktop -// File : -// Author : -// Module : -// $Header$ -// -#include "VVTK_ImageWriter.h" - -#include - -#include "utilities.h" - -#include -#include -#include -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - - -//---------------------------------------------------------------------------- -VVTK_ImageWriter -::VVTK_ImageWriter(QSemaphore* theSemaphore, - vtkImageData* theImageData, - const std::string& theName, - int theProgressive, - int theQuality): - mySemaphore(theSemaphore), - myImageData(theImageData), - myName(theName), - myProgressive(theProgressive), - myQuality(theQuality), - myConstraint16Flag(true) -{} - -//---------------------------------------------------------------------------- -VVTK_ImageWriter -::~VVTK_ImageWriter() -{ - if(MYDEBUG) MESSAGE("VVTK_ImageWriter::~VVTK_ImageWriter - this = "< anImageClip; - // - if(myConstraint16Flag){ - int uExtent[6]; - myImageData->UpdateInformation(); - myImageData->GetUpdateExtent(uExtent); - unsigned int width = uExtent[1] - uExtent[0] + 1; - unsigned int height = uExtent[3] - uExtent[2] + 1; - width = (width / 16) * 16; - height= (height / 16) * 16; - uExtent[1] = uExtent[0] + width - 1; - uExtent[3] = uExtent[2] + height - 1; - // - anImageClip = vtkImageClip::New(); - anImageClip->Delete(); - - anImageClip->SetInput(myImageData); - anImageClip->SetOutputWholeExtent(uExtent); - anImageClip->ClipDataOn(); - anImageData = anImageClip->GetOutput(); - } - // - aWriter->WriteToMemoryOff(); - aWriter->SetFileName(myName.c_str()); - aWriter->SetQuality(myQuality); - aWriter->SetProgressive(myProgressive); - aWriter->SetInput(anImageData); - aWriter->Write(); - - aWriter->Delete(); - myImageData->Delete(); - - if(MYDEBUG) MESSAGE("VVTK_ImageWriter::run "<< - "- this = "< - -#include - -#include "utilities.h" - -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -//---------------------------------------------------------------------------- -VVTK_ImageWriterMgr -::VVTK_ImageWriterMgr() -{ - int aMax = std::numeric_limits::max() / 2; - mySemaphore = new QSemaphore(aMax); - mySemaphore->acquire( aMax ); - if(MYDEBUG) MESSAGE("VVTK_ImageWriterMgr::VVTK_ImageWriterMgr "<< - //"- total = "<total()<< - "; available = "<available() ); -} - - -//---------------------------------------------------------------------------- -VVTK_ImageWriterMgr -::~VVTK_ImageWriterMgr() -{ - Stop(); - delete mySemaphore; -} - - -//---------------------------------------------------------------------------- -void -VVTK_ImageWriterMgr -::StartImageWriter(vtkImageData *theImageData, - const std::string& theName, - const int theProgressive, - const int theQuality) -{ - VVTK_ImageWriter *anImageWriter = - new VVTK_ImageWriter(mySemaphore, - theImageData, - theName, - theProgressive, - theQuality); - myThreads.push_back(anImageWriter); - - anImageWriter->start(); - -} - - -//---------------------------------------------------------------------------- -void -VVTK_ImageWriterMgr -::Stop() -{ - if(MYDEBUG) MESSAGE("VVTK_ImageWriterMgr::Stop "<< - //"- total = "<total()<< - "; available = "<available() ); - if(MYDEBUG) MESSAGE("VVTK_ImageWriterMgr::Stop - *mySemaphore += "<acquire( myThreads.size() ); - - for(size_t anId = 0, anEnd = myThreads.size(); anId < anEnd; anId++){ - VVTK_ImageWriter* anImageWriter = myThreads[anId]; - anImageWriter->wait(); - delete anImageWriter; - } - myThreads.clear(); -} diff --git a/src/VVTK/VVTK_ImageWriterMgr.h b/src/VVTK/VVTK_ImageWriterMgr.h deleted file mode 100755 index f0d07812..00000000 --- a/src/VVTK/VVTK_ImageWriterMgr.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME VTKViewer : build VTK viewer into Salome desktop -// File : -// Author : -// Module : -// $Header$ -// -#ifndef _VVTK_ImageWriterMgr_Header_File_ -#define _VVTK_ImageWriterMgr_Header_File_ - -#include -#include - -class QString; -class vtkImageData; -class VVTK_ImageWriter; -class QSemaphore; - -class VVTK_ImageWriterMgr -{ - public: - VVTK_ImageWriterMgr(); - ~VVTK_ImageWriterMgr(); - - void - StartImageWriter(vtkImageData *theImageData, - const std::string& theName, - const int theProgressive, - const int theQuality); - - void - Stop(); - - typedef std::vector TWriterThreads; - - protected: - TWriterThreads myThreads; - - QSemaphore* mySemaphore; -}; - - -#endif - diff --git a/src/VVTK/VVTK_InteractorStyle.cxx b/src/VVTK/VVTK_InteractorStyle.cxx deleted file mode 100644 index 9ada2883..00000000 --- a/src/VVTK/VVTK_InteractorStyle.cxx +++ /dev/null @@ -1,292 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME VTKViewer : build VTK viewer into Salome desktop -// File : VVTK_InteractorStyle.cxx -// Author : Christophe ATTANASIO -// Module : SALOME -// $Header$ -// -#include "VVTK_InteractorStyle.h" -#include "VISU_GaussPtsSettings.h" -#include "SVTK_Selector.h" -#include "VISU_Event.h" - -#include -#include -#include -#include -#include -#include - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro(VVTK_InteractorStyle); -//---------------------------------------------------------------------------- - -VVTK_InteractorStyle -::VVTK_InteractorStyle(): - myIsMidButtonDown( false ), - myIsLeftButtonDown( false ), - mySMDecreaseMagnificationBtn(10), - mySMIncreaseMagnificationBtn(11) -{ -} - -//---------------------------------------------------------------------------- -VVTK_InteractorStyle -::~VVTK_InteractorStyle() -{ -} - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::OnLeftButtonDown(int ctrl, int shift, - int x, int y) -{ - myIsLeftButtonDown = true; - - if (this->HasObserver(vtkCommand::LeftButtonPressEvent)) { - this->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL); - return; - } - this->FindPokedRenderer(x, y); - if (this->CurrentRenderer == NULL) { - return; - } - myShiftState = shift; - // finishing current viewer operation - if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) { - onFinishOperation(); - startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); - } - myOtherPoint = myPoint = QPoint(x, y); - if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) { - startOperation(ForcedState); - } - else { - if (!(ctrl||shift)){ - if (myIsMidButtonDown){ - startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM); - } - else{ - startOperation(VTK_INTERACTOR_STYLE_CAMERA_ROTATE); - } - } - } - return; -} - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::OnMiddleButtonDown(int ctrl, - int shift, - int x, int y) -{ - myIsMidButtonDown = true; - - if (this->HasObserver(vtkCommand::MiddleButtonPressEvent)) { - this->InvokeEvent(vtkCommand::MiddleButtonPressEvent,NULL); - return; - } - this->FindPokedRenderer(x, y); - if (this->CurrentRenderer == NULL) { - return; - } - myShiftState = shift; - // finishing current viewer operation - if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) { - onFinishOperation(); - startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); - } - myOtherPoint = myPoint = QPoint(x, y); - if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) { - startOperation(ForcedState); - } - else { - if (!(ctrl||shift)){ - if ( myIsLeftButtonDown ){ - startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM); - } - else{ - startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN); - } - } - } -} - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::OnLeftButtonUp(int ctrl, int shift, int x, int y) -{ - myIsLeftButtonDown = false; - SVTK_InteractorStyle::OnLeftButtonUp( ctrl, shift, x, y ); - - if ( myIsMidButtonDown ) - OnMiddleButtonDown( ctrl, shift, x, y ); -} - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::OnMiddleButtonUp(int ctrl, int shift, int x, int y) -{ - myIsMidButtonDown = false; - SVTK_InteractorStyle::OnMiddleButtonUp( ctrl, shift, x, y ); - - if ( myIsLeftButtonDown ) - OnLeftButtonDown( ctrl, shift, x, y ); -} -//---------------------------------------------------------------------------- -void VVTK_InteractorStyle::onFinishOperation() -{ - Superclass::onFinishOperation(); -} - - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::SetInteractor( vtkRenderWindowInteractor* theInteractor ) -{ - // register EventCallbackCommand as observer of standard events (keypress, mousemove, etc) - Superclass::SetInteractor( theInteractor ); - - if(theInteractor){ - theInteractor->AddObserver( VISU::SetSMDecreaseMagnificationEvent, EventCallbackCommand, Priority ); - theInteractor->AddObserver( VISU::SetSMIncreaseMagnificationEvent, EventCallbackCommand, Priority ); - } -} - - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::ProcessEvents( vtkObject* object, - unsigned long event, - void* clientData, - void* callData ) -{ - if ( clientData ) { - vtkObject* anObject = reinterpret_cast( clientData ); - VVTK_InteractorStyle* self = dynamic_cast( anObject ); - if( self ){ - switch ( event ) { - case VISU::SetSMDecreaseMagnificationEvent: - self->mySMDecreaseMagnificationBtn = *((int*)callData); - return; - case VISU::SetSMIncreaseMagnificationEvent: - self->mySMIncreaseMagnificationBtn = *((int*)callData); - return; - } - } - } - - Superclass::ProcessEvents( object, event, clientData, callData ); -} - - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::onSpaceMouseButton( int button ) -{ - if( mySMDecreaseMagnificationBtn == button ) - DecreaseGaussPointMagnification(); - if( mySMIncreaseMagnificationBtn == button ) - IncreaseGaussPointMagnification(); - - Superclass::onSpaceMouseButton( button ); -} - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::DecreaseGaussPointMagnification() -{ - Interactor->InvokeEvent(VISU::SetSMDecreaseMagnificationEvent,NULL); -} - -//---------------------------------------------------------------------------- -void -VVTK_InteractorStyle -::IncreaseGaussPointMagnification() -{ - Interactor->InvokeEvent(VISU::SetSMIncreaseMagnificationEvent,NULL); -} -//============================================================================ -// -// Controllers -// -vtkStandardNewMacro(VVTK_ControllerIncrement); -//---------------------------------------------------------------------------- -VVTK_ControllerIncrement::VVTK_ControllerIncrement() -{ - myIncrement=10; -} -//---------------------------------------------------------------------------- -VVTK_ControllerIncrement::~VVTK_ControllerIncrement() -{ -} -//---------------------------------------------------------------------------- -int VVTK_ControllerIncrement::Increase() -{ - myIncrement*=2; - return myIncrement; -} -//---------------------------------------------------------------------------- -int VVTK_ControllerIncrement::Decrease() -{ - myIncrement/=2; - if (!myIncrement){ - myIncrement=1; - } - return myIncrement; -} -// -vtkStandardNewMacro(VVTK_ControllerOnKeyDown); -//---------------------------------------------------------------------------- -VVTK_ControllerOnKeyDown::VVTK_ControllerOnKeyDown() -{ -} -//---------------------------------------------------------------------------- -VVTK_ControllerOnKeyDown::~VVTK_ControllerOnKeyDown() -{ -} -//---------------------------------------------------------------------------- -bool VVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* theIS) -{ - SVTK_InteractorStyle *pIS=dynamic_cast(theIS); - if (pIS){ - if(pIS->GetSelector()->SelectionMode()==GaussPointSelection){ - char key = pIS->GetInteractor()->GetKeyCode(); - // - if (key == 'S') { - pIS->ActionPicking(); - return false; - } - } - } - return Superclass::OnKeyDown(theIS); -} diff --git a/src/VVTK/VVTK_InteractorStyle.h b/src/VVTK/VVTK_InteractorStyle.h deleted file mode 100644 index c8bd7ff0..00000000 --- a/src/VVTK/VVTK_InteractorStyle.h +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME VTKViewer : build VTK viewer into Salome desktop -// File : VVTK_InteractorStyle.h -// Author : Christophe ATTANASIO -// Module : SALOME -// $Header$ -// -#ifndef __VVTK_InteractorStyle_h -#define __VVTK_InteractorStyle_h - - -#include "VVTK.h" - -#include "SVTK_InteractorStyle.h" -// -//------------------------------------------- -//! Control the value of increment in new style of interaction. -/*! - This class controls of value of increment, - for pan/rotate/zoom operations in new style - of interaction -*/ -class VVTK_ControllerIncrement : public SVTK_ControllerIncrement { - public: - vtkTypeMacro(VVTK_ControllerIncrement,SVTK_ControllerIncrement); - static VVTK_ControllerIncrement* New(); - - //! Increace the increment value by multiplying on 2 - virtual int Increase(); - - //! Decreace the increment value by division on 2 - virtual int Decrease(); - - protected: - VVTK_ControllerIncrement(); - virtual ~VVTK_ControllerIncrement(); - // - private: - VVTK_ControllerIncrement(const VVTK_ControllerIncrement&); //Not implemented - void operator=(const VVTK_ControllerIncrement&); //Not implemented -}; -// -//------------------------------------------- -//! Control the behaviour of KeyDown event in new style of interaction. -/*! - This class controls of behaviour of of KeyDown event - in new style of interaction. -*/ -class VVTK_ControllerOnKeyDown : public SVTK_ControllerOnKeyDown{ - public: - vtkTypeMacro(VVTK_ControllerOnKeyDown, SVTK_ControllerOnKeyDown); - static VVTK_ControllerOnKeyDown* New(); - - //! Provides the action on event - virtual bool OnKeyDown(vtkInteractorStyle* ); - - protected: - VVTK_ControllerOnKeyDown(); - virtual ~VVTK_ControllerOnKeyDown(); - - private: - VVTK_ControllerOnKeyDown(const VVTK_ControllerOnKeyDown&);//Not implemented - void operator=(const VVTK_ControllerOnKeyDown&); //Not implemented -}; - - -//! Introduce new style of interaction (keyboard free) -class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle -{ - public: - static VVTK_InteractorStyle *New(); - vtkTypeMacro(VVTK_InteractorStyle,SVTK_InteractorStyle); - - //! Redefined from SVTK_InteractorStyle::SetInteractor in order to add an observer (callback) for custorm event (space mouse event) - virtual - void - SetInteractor( vtkRenderWindowInteractor* ); - - protected: - VVTK_InteractorStyle(); - ~VVTK_InteractorStyle(); - - VVTK_InteractorStyle(const VVTK_InteractorStyle&); // Not implemented - void operator=(const VVTK_InteractorStyle&); // Not implemented - - // Generic event bindings must be overridden in subclasses - - //! Redefine SVTK_InteractorStyle::OnLeftButtonDown - virtual void OnLeftButtonDown(int ctrl, int shift, int x, int y); - - //! Redefine SVTK_InteractorStyle::OnMiddleButtonDown - virtual void OnMiddleButtonDown(int ctrl, int shift, int x, int y); - - //! Redefine SVTK_InteractorStyle::OnLeftButtonUp - virtual void OnLeftButtonUp(int ctrl, int shift, int x, int y); - - //! Redefine SVTK_InteractorStyle::OnMiddleButtonUp - virtual void OnMiddleButtonUp(int ctrl, int shift, int x, int y); - - //! Redefine SVTK_InteractorStyle::onFinishOperation - virtual void onFinishOperation(); - - //! Main process VTK event method - static - void - ProcessEvents(vtkObject* object, - unsigned long event, - void* clientData, - void* callData ); - - //! Redefine SVTK_InteractorStyle::onSpaceMouseButton - virtual void onSpaceMouseButton( int button ); - - //! To decrease magnification of the Gauss Points - void DecreaseGaussPointMagnification(); - - //! To increase magnification of the Gauss Points - void IncreaseGaussPointMagnification(); - - //! SpaceMouse short cuts - int mySMDecreaseMagnificationBtn; - int mySMIncreaseMagnificationBtn; - - bool myIsMidButtonDown; - bool myIsLeftButtonDown; -}; - -#endif diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx deleted file mode 100644 index 65e9729e..00000000 --- a/src/VVTK/VVTK_MainWindow.cxx +++ /dev/null @@ -1,474 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers -// File : -// Author : -// Module : -// $Header$ -// -#include "VVTK_MainWindow.h" -#include "VVTK_InteractorStyle.h" -#include "VVTK_Recorder.h" -#include "VVTK_RecorderDlg.h" -#include "VISU_WidgetCtrl.hxx" -#include "VISU_GaussPtsAct.h" -#include "VISU_Event.h" - -#include "SVTK_ViewWindow.h" -#include "SVTK_RenderWindowInteractor.h" -#include "VVTK_Renderer.h" -#include "VVTK_PickingDlg.h" -#include "VVTK_SegmentationCursorDlg.h" - -#include "SUIT_Application.h" -#include "SUIT_Session.h" -#include "SUIT_Tools.h" -#include "SUIT_ViewWindow.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Accel.h" -#include "SUIT_MessageBox.h" -#include "QtxAction.h" -#include "QtxMultiAction.h" -#include "QtxActionToolMgr.h" - -#include -#include -#include -#include -#include - -//---------------------------------------------------------------------------- -VVTK_MainWindow::VVTK_MainWindow(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow): - SVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow), - myControllerIncrement(VVTK_ControllerIncrement::New()), - myControllerOnKeyDown(VVTK_ControllerOnKeyDown::New()) -{ - myToolMgr = new QtxActionToolMgr( this ); - - myControllerIncrement->Delete(); - myControllerOnKeyDown->Delete(); - - // Recording - myRecordingToolBar = new QToolBar(tr("LBL_TOOLBAR_RECORD_LABEL"), this); - addToolBar(Qt::LeftToolBarArea, myRecordingToolBar ); - myViewWindow->toolMgr()->remove( NonIsometric, myToolBar ); - - - myStartAction = new QtxAction(tr("MNU_VVTK_RECORDING_START"), - theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_START" ) ), - tr( "MNU_VVTK_RECORDING_START" ), 0, this); - myStartAction->setStatusTip(tr("DSC_VVTK_RECORDING_START")); - //myStartAction->addTo( myRecordingToolBar ); - myRecordingToolBar->addAction( myStartAction ); - connect( myStartAction, SIGNAL( triggered ( bool ) ), this, SLOT( OnStartRecording() ) ); - - myPlayAction = new QtxAction(tr("MNU_VVTK_RECORDING_PLAY"), - theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_PLAY" ) ), - tr( "MNU_VVTK_RECORDING_PLAY" ), 0, this); - myPlayAction->setStatusTip(tr("DSC_VVTK_RECORDING_PLAY")); - myPlayAction->setEnabled( false ); - //myPlayAction->addTo( myRecordingToolBar ); - myRecordingToolBar->addAction( myPlayAction ); - connect( myPlayAction, SIGNAL( triggered ( bool ) ), this, SLOT( OnPlayRecording() ) ); - - myPauseAction = new QtxAction(tr("MNU_VVTK_RECORDING_PAUSE"), - theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_PAUSE" ) ), - tr( "MNU_VVTK_RECORDING_PAUSE" ), 0, this); - myPauseAction->setStatusTip(tr("DSC_VVTK_RECORDING_PAUSE")); - myPauseAction->setEnabled( false ); - //myPauseAction->addTo( myRecordingToolBar ); - myRecordingToolBar->addAction( myPauseAction ); - connect( myPauseAction, SIGNAL( triggered ( bool ) ), this, SLOT( OnPauseRecording() ) ); - - myStopAction = new QtxAction(tr("MNU_VVTK_RECORDING_STOP"), - theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_STOP" ) ), - tr( "MNU_VVTK_RECORDING_STOP" ), 0, this); - myStopAction->setStatusTip(tr("DSC_VVTK_RECORDING_STOP")); - myStopAction->setEnabled( false ); - //myStopAction->addTo( myRecordingToolBar ); - myRecordingToolBar->addAction( myStopAction ); - connect( myStopAction, SIGNAL( triggered ( bool ) ), this, SLOT( OnStopRecording() ) ); - - myRecorder = VVTK_Recorder::New(); - //myRecorder->CheckExistAVIMaker(); - //if(myRecorder->ErrorStatus()) - // myRecordingToolBar->setEnabled(false); -} - -//---------------------------------------------------------------------------- - -QtxActionToolMgr* VVTK_MainWindow::toolMgr() const -{ - return myToolMgr; -} - -//---------------------------------------------------------------------------- -void VVTK_MainWindow::Initialize(SVTK_RenderWindowInteractor* theInteractor) -{ - vtkInteractorStyle* aStyle = theInteractor->GetInteractorStyle(); - if(SVTK_InteractorStyle *anInteractorStyle = dynamic_cast(aStyle)){ - anInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer()); - anInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer()); - } - - myRecorder->SetNbFPS(17.3); - myRecorder->SetQuality(100); - myRecorder->SetProgressiveMode(true); - myRecorder->SetUseSkippedFrames(true); - myRecorder->SetRenderWindow(theInteractor->getRenderWindow()); - - disconnect( SVTK_MainWindow::action( DumpId ), SIGNAL( activated() ), - myViewWindow, SLOT( onDumpView() ) ); - - connect( SVTK_MainWindow::action( DumpId ), SIGNAL( activated() ), - this, SLOT( onDumpView() ) ); - - SVTK_MainWindow::Initialize(theInteractor); - addToolBar( Qt::LeftToolBarArea, getToolBar() ); -} - -VVTK_MainWindow::~VVTK_MainWindow() -{ - if(myRecorder) - myRecorder->Delete(); -} - -//---------------------------------------------------------------------------- -void VVTK_MainWindow::onDumpView() -{ - QImage img = dumpView(); - if( img.isNull() ) - return; - - SUIT_Application* app = SUIT_Session::session()->activeApplication(); - QString fileName = app->getFileName( false, QString::null, - tr( "TLT_IMAGE_FILES" ), - tr( "TLT_DUMP_VIEW" ), 0 ); - if( fileName.isEmpty() ) - return; - - QString fmt = SUIT_Tools::extension( fileName ).toUpper(); - if( fmt.isEmpty() ) - fmt = QString( "BMP" ); // default format - else if( fmt == "JPG" ) - fmt = "JPEG"; - - QApplication::setOverrideCursor( Qt::WaitCursor ); - img.save( fileName, fmt.toLatin1() ); - QApplication::restoreOverrideCursor(); -} - -//---------------------------------------------------------------------------- -void VVTK_MainWindow::OnStartRecording() -{ - myRecorder->CheckExistAVIMaker(); - if (myRecorder->ErrorStatus()) { - SUIT_MessageBox::warning(this, tr("ERROR"), tr("MSG_NO_AVI_MAKER") ); - } - else { - VVTK_RecorderDlg* aRecorderDlg = new VVTK_RecorderDlg( this, myRecorder ); - - if( !aRecorderDlg->exec() ) - return; - - myStartAction->setEnabled( false ); - myPlayAction->setEnabled( false ); - myPauseAction->setEnabled( true ); - myStopAction->setEnabled( true ); - - myRecorder->Record(); - } -} - -//---------------------------------------------------------------------------- -void VVTK_MainWindow::OnPlayRecording() -{ - myStartAction->setEnabled( false ); - myPlayAction->setEnabled( false ); - myPauseAction->setEnabled( true ); - myStopAction->setEnabled( true ); - // - myRecorder->Pause(); -} - -//---------------------------------------------------------------------------- -void VVTK_MainWindow::OnPauseRecording() -{ - myStartAction->setEnabled( false ); - myPlayAction->setEnabled( true ); - myPauseAction->setEnabled( false ); - myStopAction->setEnabled( true ); - // - myRecorder->Pause(); -} - -//---------------------------------------------------------------------------- -void VVTK_MainWindow::OnStopRecording() -{ - myStartAction->setEnabled( true ); - myPlayAction->setEnabled( false ); - myPauseAction->setEnabled( false ); - myStopAction->setEnabled( false ); - // - myRecorder->Stop(); -} - -//---------------------------------------------------------------------------- -void VVTK_MainWindow::action( const int accelAction ) -{ - if ( accelAction == SUIT_Accel::ZoomFit ) - onFitAll(); - else { - int anEvent = SVTK::convertAction( accelAction ); - InvokeEvent( anEvent, 0 ); - } -} - -//---------------------------------------------------------------------------- -VVTK_MainWindow1::VVTK_MainWindow1(QSplitter* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow): - VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow), - mySplitter(theParent), - myPickingDlg(NULL) -{ - myPtsToolBar = new QToolBar( tr("LBL_TOOLBAR_GAUSS_LABEL"), this ); - addToolBar( Qt::LeftToolBarArea, myPtsToolBar ); - - QPixmap aPixmap; - QtxAction* anAction; - - aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH")); - myPickingAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), - aPixmap, - tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ), - 0, - this, - //"VVTK/SVTK SelectionSwitch", - true); - myPickingAction->setCheckable(true); - myPickingAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH")); - myPtsToolBar->addAction( myPickingAction ); - connect(myPickingAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool))); - - myPickingDlg = new VVTK_PickingDlg( myPickingAction, this, "PickingDlg" ); - - // Plane/Sphere Segmentation - aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH")); - myPlaneSegmentationAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"), - aPixmap, - tr( "MNU_VVTK_PLANE_SEGMENTATION_SWITCH" ), - 0, - this, - //"VVTK/SVTK PlaneSegmentationSwitch", - true); - myPlaneSegmentationAction->setCheckable(true); - myPlaneSegmentationAction->setStatusTip(tr("DSC_VVTK_PLANE_SEGMENTATION_SWITCH")); - //myPlaneSegmentationAction->addTo( myPtsToolBar ); - connect( myPlaneSegmentationAction, SIGNAL( triggered() ), this, SLOT( OnSegmentationSwitch() ) ); - - aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SPHERE_SEGMENTATION_SWITCH")); - mySphereSegmentationAction = new QtxAction(tr("MNU_VVTK_SPHERE_SEGMENTATION_SWITCH"), - aPixmap, - tr( "MNU_VVTK_SPHERE_SEGMENTATION_SWITCH" ), - 0, - this, - //"VVTK/SVTK SphereSegmentationSwitch", - true); - mySphereSegmentationAction->setCheckable(true); - mySphereSegmentationAction->setStatusTip(tr("DSC_VVTK_SPHERE_SEGMENTATION_SWITCH")); - //mySphereSegmentationAction->addTo( myPtsToolBar ); - connect( mySphereSegmentationAction, SIGNAL( activated() ), this, SLOT( OnSegmentationSwitch() ) ); - - mySegmentationCursorDlg = new VVTK_SegmentationCursorDlg( this, "SegmentationCursorDlg" ); - mySegmentationCursorDlg->SetPlaneAction( myPlaneSegmentationAction ); - mySegmentationCursorDlg->SetSphereAction( mySphereSegmentationAction ); - connect( mySegmentationCursorDlg, SIGNAL( scgClose() ), this, SLOT( OnSegmentationSwitch() ) ); - - //SUIT_ToolButton* aSegmentationButton = new SUIT_ToolButton( myPtsToolBar ); - QtxMultiAction* aSegmentationAction = new QtxMultiAction( this ); - aSegmentationAction->insertAction( myPlaneSegmentationAction ); - aSegmentationAction->insertAction( mySphereSegmentationAction ); - myPtsToolBar->addAction( aSegmentationAction ); -} - -void VVTK_MainWindow1::Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer1* theRenderer) -{ - myRenderer = theRenderer; - VVTK_MainWindow::Initialize(theInteractor); - - mySegmentationCursorDlg->SetWidgetCtrl( theRenderer->GetWidgetCtrl() ); - mySegmentationCursorDlg->SetInteractor( theInteractor ); - - connect( theInteractor, SIGNAL( selectionChanged() ), SLOT( OnSelectionChanged() ) ); - myPickingDlg->SetInteractor( theInteractor ); -} - -VVTK_MainWindow1::~VVTK_MainWindow1() -{} - -//---------------------------------------------------------------------------- -VVTK_MainWindow2* VVTK_MainWindow1::CreateMainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow) -{ - myMainWindow2 = new VVTK_MainWindow2(theParent, - theName, - theResourceMgr, - theViewWindow); - return myMainWindow2; -} - - -//---------------------------------------------------------------------------- -void VVTK_MainWindow1::OnSelectionModeSwitch(bool theIsSelectionOn) -{ - if ( theIsSelectionOn && !isVisible() ) - return; - - Selection_Mode aSelectionMode = SelectionMode(); - if(theIsSelectionOn && aSelectionMode != GaussPointSelection) - SetSelectionMode(GaussPointSelection); - else if(!theIsSelectionOn && aSelectionMode == GaussPointSelection) - SetSelectionMode(ActorSelection); - - if( theIsSelectionOn ) - { - myPickingDlg->Update(); - myPickingDlg->show(); - } - else - myPickingDlg->hide(); -} - -void VVTK_MainWindow1::OnSelectionChanged() -{ - Selection_Mode aSelectionMode = SelectionMode(); - if(myPickingAction->isChecked() && aSelectionMode != GaussPointSelection) - myPickingAction->setChecked(false); - else if(!myPickingAction->isChecked() && aSelectionMode == GaussPointSelection) - myPickingAction->setChecked(true); -} - - -//---------------------------------------------------------------------------- -VISU_WidgetCtrl* VVTK_MainWindow1::GetWidgetCtrl() -{ - return myRenderer->GetWidgetCtrl(); -} - -VISU_InsideCursorSettings* VVTK_MainWindow1::GetInsideCursorSettings() -{ - return mySegmentationCursorDlg->GetInsideCursorSettings(); -} - -VISU_OutsideCursorSettings* VVTK_MainWindow1::GetOutsideCursorSettings() -{ - return mySegmentationCursorDlg->GetOutsideCursorSettings(); -} - -VISU_PickingSettings* VVTK_MainWindow1::GetPickingSettings() -{ - return myPickingDlg->GetPickingSettings(); -} - -//---------------------------------------------------------------------------- -void VVTK_MainWindow1::SetPlanesSegementation(bool theIsOn) -{ - myPlaneSegmentationAction->setChecked( theIsOn ); - OnSegmentationSwitch(myPlaneSegmentationAction); -} - -void VVTK_MainWindow1::SetSphereSegementation(bool theIsOn) -{ - mySphereSegmentationAction->setChecked( theIsOn ); - OnSegmentationSwitch(mySphereSegmentationAction); -} - -void VVTK_MainWindow1::OnSegmentationSwitch(QtxAction* theAction) -{ - bool anIsSegmentationOn = myPlaneSegmentationAction->isChecked() || - mySphereSegmentationAction->isChecked(); - - if( !theAction ) - return; - - VISU_WidgetCtrl *aWidgetCtrl = myRenderer->GetWidgetCtrl(); - - if (anIsSegmentationOn) { - int anIndex = (theAction == myPlaneSegmentationAction) ? 0 : 1; - aWidgetCtrl->SetActiveIndex(anIndex); - } - aWidgetCtrl->SetEnabled(anIsSegmentationOn); - - if( theAction == myPlaneSegmentationAction && anIsSegmentationOn ) - mySphereSegmentationAction->setChecked( false ); - else if( theAction == mySphereSegmentationAction && anIsSegmentationOn ) - myPlaneSegmentationAction->setChecked( false ); - - if( anIsSegmentationOn ) - { - myMainWindow2->show(); - mySegmentationCursorDlg->SetIsPlaneSegmentation( theAction == myPlaneSegmentationAction ); - mySegmentationCursorDlg->UpdateSegmentation(); - mySegmentationCursorDlg->UpdateInsideGaussPoints(); - mySegmentationCursorDlg->UpdateOutsideGaussPoints(); - mySegmentationCursorDlg->show(); - } - else - { - myMainWindow2->hide(); - mySegmentationCursorDlg->hide(); - } -} - -void VVTK_MainWindow1::OnSegmentationSwitch() -{ - QtxAction* anAction = ( QtxAction* )sender(); - OnSegmentationSwitch(anAction); -} - - -//---------------------------------------------------------------------------- -VVTK_MainWindow2::VVTK_MainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow): - VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow) -{} - -VVTK_MainWindow2::~VVTK_MainWindow2() -{} - - -//---------------------------------------------------------------------------- -void VVTK_MainWindow2::Initialize(SVTK_RenderWindowInteractor* theInteractor) -{ - VVTK_MainWindow::Initialize(theInteractor); -} - diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h deleted file mode 100644 index d3e34e83..00000000 --- a/src/VVTK/VVTK_MainWindow.h +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef VVTK_MAINWINDOW_H -#define VVTK_MAINWINDOW_H - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -#include "VVTK.h" -#include "SVTK_MainWindow.h" - -class QSplitter; - -class VISU_WidgetCtrl; -class VVTK_SegmentationCursorDlg; -class VISU_InsideCursorSettings; -class VISU_OutsideCursorSettings; -class VISU_PickingSettings; -class VVTK_InteractorStyle; -class VVTK_ControllerIncrement; -class VVTK_ControllerOnKeyDown; -class VVTK_PickingDlg; -class VVTK_MainWindow2; -class VVTK_Renderer1; -class VVTK_Renderer2; -class VVTK_Recorder; - -//---------------------------------------------------------------------------- -//! Customize SVTK_MainWindow to provide VVTK functionality -class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow -{ - Q_OBJECT; - -public: - //! Construct instance of the class - VVTK_MainWindow(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow); - - //! Reimplement SVTK_MainWindow::Initialize - virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor); - - //! Destroy instance of the class - virtual ~VVTK_MainWindow(); - - public slots: - - virtual void onDumpView(); - - virtual void action( const int ); - - virtual void OnStartRecording(); - - virtual void OnPlayRecording(); - - virtual void OnPauseRecording(); - - virtual void OnStopRecording(); - - protected: - virtual QtxActionToolMgr* toolMgr() const; - - vtkSmartPointer myControllerIncrement; - vtkSmartPointer myControllerOnKeyDown; - - QToolBar* myRecordingToolBar; - QtxAction* myStartAction; - QtxAction* myPlayAction; - QtxAction* myPauseAction; - QtxAction* myStopAction; - - VVTK_Recorder *myRecorder; - QtxActionToolMgr* myToolMgr; -}; - - -//---------------------------------------------------------------------------- -//! Extend VVTK_MainWindow to implement functionality for base view -class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindow -{ - Q_OBJECT; - -public: - //! Construct instance of the class - VVTK_MainWindow1(QSplitter* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow); - - //! Reimplement VVTK_MainWindow::Initialize - virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer1* theRenderer); - - //! Destroy instance of the class - virtual ~VVTK_MainWindow1(); - - //! Create instance of the segmented VVTK_MainWindow - /*! - The two views (VVTK_MainWindow1 and VVTK_MainWindow2) should change its behaviour in the same time. - So, it is necessary to synhronize them through sharing some common pointers. - */ - VVTK_MainWindow2* CreateMainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow); - - VISU_WidgetCtrl* GetWidgetCtrl(); - - void SetPlanesSegementation(bool theIsOn); - - void SetSphereSegementation(bool theIsOn); - - VISU_InsideCursorSettings* GetInsideCursorSettings(); - - //! Get contained VISU_OutsideCursorSettings - VISU_OutsideCursorSettings* GetOutsideCursorSettings(); - - //! Get contained VISU_PickingSettings - VISU_PickingSettings* GetPickingSettings(); - - public slots: - //! To activate/ deactivate the segementation cursor at run-time - void OnSegmentationSwitch();//bool theIsSegmentationOn); - - void OnSegmentationSwitch(QtxAction* theAction);//bool theIsSegmentationOn); - - //! To change active selection mode at run-time - virtual void OnSelectionModeSwitch(bool theIsSelectionOn); - - //! To adjust to the current selection mode - virtual void OnSelectionChanged(); - - protected: - VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer - - VVTK_MainWindow2* myMainWindow2; //!< Refer to segmented view - - QToolBar* myPtsToolBar; //!< Additional tool bar - - //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor - QSplitter* mySplitter; - - QtxAction* myPickingAction; //!< Action for switch selection mode - QtxAction* myPlaneSegmentationAction; //!< Action for switch segmentation mode to plane - QtxAction* mySphereSegmentationAction; //!< Action for switch segmentation mode to sphere - - //! Keep reference to VVTK_SegmentationCursorDlg - VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; - VVTK_PickingDlg* myPickingDlg; //!< Keep reference to VVTK_PickingDlg -}; - - -//---------------------------------------------------------------------------- -//! Extend VVTK_MainWindow to implement functionality for segmented view -class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow -{ - Q_OBJECT; - - friend class VVTK_MainWindow1; - - //! Construct instance of the class - VVTK_MainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow); -public: - //! Destroy instance of the class - virtual ~VVTK_MainWindow2(); - - //! Reimplement SVTK_MainWindow::Initialize - virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor); - -}; - - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx deleted file mode 100644 index 4f7a33cb..00000000 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ /dev/null @@ -1,717 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VVTK_PickingDlg.cxx -// Author : Oleg Uvarov -// Module : VISU -// -#include "VVTK_PickingDlg.h" - -#include "VISU_GaussPtsAct.h" -#include "VISU_PickingSettings.h" -#include "VISU_GaussPointsPL.hxx" - -#include "SUIT_MessageBox.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" - -#include "CAM_Module.h" - -#include "SVTK_Selector.h" -#include "SVTK_MainWindow.h" -#include "SVTK_RenderWindowInteractor.h" - -#include "VTKViewer_Algorithm.h" -#include "SVTK_Functor.h" - -#include -#include -#include -#include -#include -#include - -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "QtxAction.h" -#include "QtxDoubleSpinBox.h" -#include "QtxIntSpinBox.h" -#include "QtxColorButton.h" - -#include "LightApp_Application.h" - -namespace -{ - struct SelectorHelper - { - public: - SelectorHelper( SVTK_RenderWindowInteractor* theInteractor ): - myInteractor( theInteractor ) - {} - - bool - get() - { - bool aResult = false; - myMapIndex.Clear(); - mySelector = NULL; - myPipeLine = NULL; - myActor = NULL; - - if ( !myInteractor ) - return aResult; - - mySelector = myInteractor->GetSelector(); - if ( !mySelector ) - return aResult; - - const SALOME_ListIO& aListIO = mySelector->StoredIObjects(); - if ( aListIO.Extent() != 1 ) - return aResult; - - myIO = aListIO.First(); - if ( mySelector->HasIndex( myIO ) ) - mySelector->GetIndex(myIO, myMapIndex); - - VTK::ActorCollectionCopy aCopy(myInteractor->getRenderer()->GetActors()); - myActor = SVTK::Find(aCopy.GetActors(), - SVTK::TIsSameIObject( myIO )); - if ( !myActor ) - return aResult; - - myPipeLine = myActor->GetGaussPointsPL(); - - return true; - } - - SVTK_RenderWindowInteractor* myInteractor; - TColStd_IndexedMapOfInteger myMapIndex; - Handle(SALOME_InteractiveObject) myIO; - SVTK_Selector* mySelector; - - VISU_GaussPointsPL* myPipeLine; - VISU_GaussPtsAct* myActor; - }; - - - - class GaussPtsIDValidator: public QIntValidator - { - public: - GaussPtsIDValidator( SVTK_RenderWindowInteractor* theInteractor, - QObject * theParent ): - QIntValidator( 0, VTK_LARGE_ID, theParent ), - myHelper(theInteractor) - {} - - virtual - State - validate ( QString & theInput, int & thePos ) const - { - if ( QIntValidator::validate( theInput, thePos ) == QValidator::Invalid) - return QValidator::Invalid; - - if ( !myHelper.get() ) - return QValidator::Invalid; - - return QValidator::Acceptable; - } - - protected: - mutable SelectorHelper myHelper; - }; - - - class GaussCellIDValidator: public GaussPtsIDValidator - { - public: - GaussCellIDValidator( QLineEdit* theLocalPointLabel, - SVTK_RenderWindowInteractor* theInteractor, - QObject * theParent ): - GaussPtsIDValidator( theInteractor, theParent ), - myLocalPointLineEdit( theLocalPointLabel ) - {} - - virtual - State - validate ( QString & theInput, int & thePos ) const - { - if ( GaussPtsIDValidator::validate( theInput, thePos ) == QValidator::Invalid) - return QValidator::Invalid; - - VISU::TCellID aCellID = theInput.toInt(); - VISU::TLocalPntID aLocalPntID = myLocalPointLineEdit->text().toInt(); - VISU::PGaussPtsIDMapper anIDMapper = myHelper.myPipeLine->GetGaussPtsIDMapper(); - if ( anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) ) < 0 ) - return QValidator::Intermediate; - - return QValidator::Acceptable; - } - - private: - QLineEdit* myLocalPointLineEdit; - }; - - - class GaussLocalPointIDValidator: public GaussPtsIDValidator - { - public: - GaussLocalPointIDValidator( QLineEdit* theParentElementLineEdit, - SVTK_RenderWindowInteractor* theInteractor, - QObject * theParent ): - GaussPtsIDValidator( theInteractor, theParent ), - myParentElementLineEdit( theParentElementLineEdit ) - {} - - virtual - State - validate ( QString & theInput, int & thePos ) const - { - if ( GaussPtsIDValidator::validate( theInput, thePos ) == QValidator::Invalid) - return QValidator::Invalid; - - VISU::TLocalPntID aLocalPntID = theInput.toInt(); - VISU::TCellID aCellID = myParentElementLineEdit->text().toInt(); - VISU::PGaussPtsIDMapper anIDMapper = myHelper.myPipeLine->GetGaussPtsIDMapper(); - if ( anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) ) < 0 ) - return QValidator::Intermediate; - - return QValidator::Acceptable; - } - - private: - QLineEdit* myParentElementLineEdit; - }; -} - - -VVTK_ValidatedLineEdit::VVTK_ValidatedLineEdit( QWidget* parent ): - QLineEdit( parent ) -{ - connect( this, SIGNAL( textChanged( const QString& ) ), this, SLOT( MarkValidated( const QString& ) ) ); -} - -void VVTK_ValidatedLineEdit::MarkValidated( const QString& theText ) -{ - if ( !validator() ) - return; - - int aPos; - QString aText( theText ); - QPalette pal = palette(); - switch ( validator()->validate( aText, aPos ) ) { - case QValidator::Invalid: - case QValidator::Intermediate: - pal.setColor( foregroundRole(), QColor( 255, 0, 0 )); - setPalette( pal ); - break; - case QValidator::Acceptable: - pal.setColor( foregroundRole(), QColor( 0, 0, 0 )); - setPalette( pal ); - break; - } -} - -//--------------------------------------------------------------------------------- - -VVTK_PickingDlg::VVTK_PickingDlg(QtxAction* theAction, - SVTK_MainWindow* theParent, - const char* theName): - SVTK_DialogBase(theAction, - theParent, - theName), - myEventCallbackCommand( vtkCallbackCommand::New() ), - myPickingSettings( VISU_PickingSettings::New() ) -{ - myPriority = 0.0; - myEventCallbackCommand->Delete(); - myEventCallbackCommand->SetClientData(this); - myEventCallbackCommand->SetCallback(VVTK_PickingDlg::ProcessEvents); - - setWindowTitle( tr( "PICKING_DLG_TITLE" ) ); - setSizeGripEnabled(TRUE); - - QVBoxLayout* TopLayout = new QVBoxLayout( this ); - TopLayout->setSpacing(6); - TopLayout->setMargin(11); - - QWidget* aBox = new QWidget( this ); - QVBoxLayout* BoxLayout = new QVBoxLayout( aBox ); - BoxLayout->setMargin(0); - BoxLayout->setSpacing(6); - - // Cursor - QGroupBox* CursorGroup = new QGroupBox( tr( "CURSOR_TITLE" ), aBox ); - //CursorGroup->setColumnLayout(0, Qt::Vertical ); - //CursorGroup->layout()->setSpacing( 0 ); - //CursorGroup->layout()->setMargin( 0 ); - - QGridLayout* CursorGroupLayout = new QGridLayout (CursorGroup); - CursorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - CursorGroupLayout->setSpacing(6); - CursorGroupLayout->setMargin(11); - - QLabel* CursorSizeLabel = new QLabel( tr( "CURSOR_SIZE" ), CursorGroup ); - myCursorSizeSpinBox = new QtxDoubleSpinBox( 0, 1, 0.1, CursorGroup ); - myCursorSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - QLabel* PyramidHeightLabel = new QLabel( tr( "PYRAMID_HEIGHT" ), CursorGroup ); - double aHeightMin=1.e-7; - double aHeightMax=10.; - double aHeightStep=0.1; - myPyramidHeightSpinBox = new QtxDoubleSpinBox(aHeightMin, aHeightMax, aHeightStep, CursorGroup ); - myPyramidHeightSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - QLabel* SelectionColorLabel = new QLabel( tr( "SELECTION_COLOR" ), CursorGroup ); - mySelectionColorButton = new QtxColorButton( CursorGroup ); - mySelectionColorButton->setColor( Qt::blue ); - //QPalette aPalette( mySelectionColorButton->palette() ); - //aPalette.setColor( mySelectionColorButton->backgroundRole(), Qt::blue ); - //mySelectionColorButton->setPalette( aPalette ); - //connect( mySelectionColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) ); - - CursorGroupLayout->addWidget( CursorSizeLabel, 0, 0 ); - CursorGroupLayout->addWidget( myCursorSizeSpinBox, 0, 1 ); - CursorGroupLayout->addWidget( PyramidHeightLabel, 1, 0 ); - CursorGroupLayout->addWidget( myPyramidHeightSpinBox, 1, 1 ); - CursorGroupLayout->addWidget( SelectionColorLabel, 2, 0 ); - CursorGroupLayout->addWidget( mySelectionColorButton, 2, 1 ); - - BoxLayout->addWidget( CursorGroup ); - - // Tolerance - QGroupBox* ToleranceGroup = new QGroupBox( tr( "TOLERANCE_TITLE" ), aBox ); - //ToleranceGroup->setColumnLayout(0, Qt::Vertical ); - //ToleranceGroup->layout()->setSpacing( 0 ); - //ToleranceGroup->layout()->setMargin( 0 ); - - QGridLayout* ToleranceGroupLayout = new QGridLayout (ToleranceGroup); - ToleranceGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - ToleranceGroupLayout->setSpacing(6); - ToleranceGroupLayout->setMargin(11); - - QLabel* PointToleranceLabel = new QLabel( tr( "POINT_TOLERANCE" ), ToleranceGroup ); - myPointToleranceSpinBox = new QtxDoubleSpinBox( 0.001, 10.0, 0.01, ToleranceGroup ); - myPointToleranceSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - ToleranceGroupLayout->addWidget( PointToleranceLabel, 0, 0 ); - ToleranceGroupLayout->addWidget( myPointToleranceSpinBox, 0, 1 ); - - BoxLayout->addWidget( ToleranceGroup ); - - // Information window - QGroupBox* InfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), aBox ); - //InfoWindowGroup->setColumnLayout(0, Qt::Vertical ); - //InfoWindowGroup->layout()->setSpacing( 0 ); - //InfoWindowGroup->layout()->setMargin( 0 ); - - QGridLayout* InfoWindowGroupLayout = new QGridLayout (InfoWindowGroup); - InfoWindowGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - InfoWindowGroupLayout->setSpacing(6); - InfoWindowGroupLayout->setMargin(11); - - QLabel* TransparencyLabel = new QLabel( tr( "TRANSPARENCY" ), InfoWindowGroup ); - myTransparencySpinBox = new QtxIntSpinBox( 0, 100, 10, InfoWindowGroup ); - myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 ); - InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 ); - - QLabel* PositionLabel = new QLabel( tr( "POSITION" ), InfoWindowGroup ); - myPositionComboBox = new QComboBox( InfoWindowGroup ); - myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - myPositionComboBox->addItem( tr( "BELOW_POINT" ) ); - myPositionComboBox->addItem( tr( "TOP_LEFT_CORNER" ) ); - - InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 ); - InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 ); - InfoWindowGroupLayout->addWidget( PositionLabel, 1, 0 ); - InfoWindowGroupLayout->addWidget( myPositionComboBox, 1, 1 ); - - BoxLayout->addWidget( InfoWindowGroup ); - - // Movement of the camera - QGroupBox* CameraGroup = new QGroupBox( tr( "CAMERA_TITLE" ), aBox ); - //CameraGroup->setColumnLayout(0, Qt::Vertical ); - //CameraGroup->layout()->setSpacing( 0 ); - //CameraGroup->layout()->setMargin( 0 ); - - QGridLayout* CameraGroupLayout = new QGridLayout (CameraGroup); - CameraGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - CameraGroupLayout->setSpacing(6); - CameraGroupLayout->setMargin(11); - - QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), CameraGroup ); - myZoomFactorSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1, CameraGroup ); - myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), CameraGroup ); - myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, CameraGroup ); - myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - CameraGroupLayout->addWidget( ZoomFactorLabel, 0, 0 ); - CameraGroupLayout->addWidget( myZoomFactorSpinBox, 0, 1 ); - CameraGroupLayout->addWidget( StepNumberLabel, 1, 0 ); - CameraGroupLayout->addWidget( myStepNumberSpinBox, 1, 1 ); - - BoxLayout->addWidget( CameraGroup ); - - // Display parent mesh element - QGroupBox* PositionGroup = new QGroupBox( tr( "DATA_POSITION" ), aBox ); - //PositionGroup->setColumnLayout(0, Qt::Vertical ); - //PositionGroup->layout()->setSpacing( 0 ); - //PositionGroup->layout()->setMargin( 0 ); - - QGridLayout* PositionGroupLayout = new QGridLayout (PositionGroup); - PositionGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); - PositionGroupLayout->setSpacing(6); - PositionGroupLayout->setMargin(11); - - QLabel* ParentElementLabel = new QLabel( tr( "PARENT_ELEMENT" ), PositionGroup ); - - myParentElementLineEdit = new VVTK_ValidatedLineEdit( PositionGroup ); - - QLabel* LocalPointLabel = new QLabel( tr( "LOCAL_POINT" ), PositionGroup ); - - myLocalPointLineEdit = new VVTK_ValidatedLineEdit( PositionGroup ); - - myDisplayParentMeshCheckBox = new QCheckBox( tr( "DISPLAY_PARENT_MESH" ), PositionGroup ); - - PositionGroupLayout->addWidget( ParentElementLabel, 0, 0, 1, 3 ); - PositionGroupLayout->addWidget( myParentElementLineEdit, 0, 3 ); - PositionGroupLayout->addWidget( LocalPointLabel, 1, 0, 1, 3 ); - PositionGroupLayout->addWidget( myLocalPointLineEdit, 1, 3 ); - PositionGroupLayout->addWidget( myDisplayParentMeshCheckBox, 2, 0, 1, 4 ); - - BoxLayout->addWidget( PositionGroup ); - - // Common buttons =========================================================== - QGroupBox* GroupButtons = new QGroupBox( this ); - //GroupButtons->setColumnLayout(0, Qt::Vertical ); - //GroupButtons->layout()->setSpacing( 0 ); - //GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - QPushButton* buttonApply = new QPushButton( tr( "&Apply" ), GroupButtons ); - buttonApply->setAutoDefault( TRUE ); - buttonApply->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 0 ); - GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); - - QPushButton* buttonClose = new QPushButton( tr( "&Close" ) , GroupButtons ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose, 0, 2 ); - - QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons ); - buttonHelp->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); - - TopLayout->addWidget( aBox ); - TopLayout->addWidget( GroupButtons ); - - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) ); - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( onClickClose() ) ); - connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onClickHelp() ) ); - - connect( myParentElementLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) ); - connect( myLocalPointLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) ); - -} - -VVTK_PickingDlg::~VVTK_PickingDlg() -{ -} - -void VVTK_PickingDlg::AddActor( VISU_GaussPtsAct* theActor ) -{ - //theActor->SetPickingSettings( myPickingSettings.GetPointer() ); -} - -void VVTK_PickingDlg::RemoveActor( VISU_GaussPtsAct* theActor ) -{ - //theActor->SetPickingSettings( NULL ); -} - -void VVTK_PickingDlg::Update() -{ - float aCursorSize = 0.5; - float aPyramidHeight = 10.0; - float aPointTolerance = 0.1; - QColor aColor = Qt::yellow; - int anInfoWindowTransparency = 50; - int anInfoWindowPosition = VISU_PickingSettings::BelowPoint; - float aZoomFactor = 1.5; - int aStepNumber = 10; - bool aDisplayParentMesh = false; - - //if( !myPickingSettings->GetInitial() ) - { - myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() ); - myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() ); - myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() ); - myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) ); - myPositionComboBox->setCurrentIndex( myPickingSettings->GetInfoWindowPosition() ); - myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() ); - myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); - myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() ); - - vtkFloatingPointType* aColor = myPickingSettings->GetColor(); - - //QPalette aPalette( mySelectionColorButton->palette() ); - /*aPalette.setColor( mySelectionColorButton->backgroundRole(), - QColor( ( int )( aColor[0] * 255.0 ), - ( int )( aColor[1] * 255.0 ), - ( int )( aColor[2] * 255.0 ) ) ); - mySelectionColorButton->setPalette( aPalette );*/ - mySelectionColorButton->setColor( - QColor( ( int )( aColor[0] * 255.0 ), - ( int )( aColor[1] * 255.0 ), - ( int )( aColor[2] * 255.0 ) ) ); - - return; - } - - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - - aCursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize ); - myCursorSizeSpinBox->setValue( aCursorSize ); - - aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight ); - myPyramidHeightSpinBox->setValue( aPyramidHeight ); - - aPointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance ); - myPointToleranceSpinBox->setValue( aPointTolerance ); - - aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor ); - //QPalette aPalette( mySelectionColorButton->palette() ); - //aPalette.setColor( mySelectionColorButton->backgroundRole(), aColor ); - mySelectionColorButton->setColor( aColor ); - - anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency ); - myTransparencySpinBox->setValue( anInfoWindowTransparency ); - - anInfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition ); - myPositionComboBox->setCurrentIndex( anInfoWindowPosition ); - - aZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor ); - myZoomFactorSpinBox->setValue( aZoomFactor ); - - aStepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber ); - myStepNumberSpinBox->setValue( aStepNumber ); - - aDisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh ); - myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh ); - - onClickApply(); -} - -void VVTK_PickingDlg::onSelectionValidate() -{ - myParentElementLineEdit->MarkValidated( myParentElementLineEdit->text() ); - myLocalPointLineEdit->MarkValidated( myLocalPointLineEdit->text() ); -} - -void VVTK_PickingDlg::onSelectionEvent() -{ - SelectorHelper aHelper( myInteractor ); - if ( !aHelper.get() ) - return; - - const TColStd_IndexedMapOfInteger& aMapIndex = aHelper.myMapIndex; - if ( aMapIndex.Extent() != 1 ) - return; - - int anObjId = aHelper.myMapIndex(1); - - VISU::TGaussPointID aGaussPointID = aHelper.myPipeLine->GetObjID( anObjId ); - - VISU::TCellID aCellID = aGaussPointID.first; - myParentElementLineEdit->setText( QString::number( aCellID ) ); - - VISU::TLocalPntID aLocalPntID = aGaussPointID.second; - myLocalPointLineEdit->setText( QString::number( aLocalPntID ) ); -} - -VISU_PickingSettings* -VVTK_PickingDlg -::GetPickingSettings() -{ - return myPickingSettings.GetPointer(); -} - -void VVTK_PickingDlg::SetInteractor( SVTK_RenderWindowInteractor* theInteractor ) -{ - myInteractor = theInteractor; - - theInteractor->GetDevice()->AddObserver(vtkCommand::KeyPressEvent, - myEventCallbackCommand.GetPointer(), - myPriority); - theInteractor->GetDevice()->AddObserver(vtkCommand::EndPickEvent, - myEventCallbackCommand.GetPointer(), - myPriority); - { - QValidator* aValidator = new GaussCellIDValidator( myLocalPointLineEdit, theInteractor, myParentElementLineEdit ); - myParentElementLineEdit->setValidator( aValidator ); - } - { - QValidator* aValidator = new GaussLocalPointIDValidator( myParentElementLineEdit, theInteractor, myLocalPointLineEdit ); - myLocalPointLineEdit->setValidator( aValidator ); - } -} - -void VVTK_PickingDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), - unsigned long theEvent, - void* theClientData, - void* vtkNotUsed(theCallData)) -{ - VVTK_PickingDlg* self = reinterpret_cast(theClientData); - - switch(theEvent){ - case vtkCommand::KeyPressEvent: - self->KeyPressed(); - break; - case vtkCommand::EndPickEvent: - self->onSelectionEvent(); - break; - } -} - -void VVTK_PickingDlg::KeyPressed() -{ - if( myInteractor->GetDevice()->GetKeyCode() == 'P' ) - { - bool aDisplayParentMesh = !myPickingSettings->GetDisplayParentMesh(); - myPickingSettings->SetDisplayParentMesh( aDisplayParentMesh ); - - myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh ); - - myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL); - } -} - -void VVTK_PickingDlg::onClickApply() -{ - //myPickingSettings->SetInitial( false ); - - myPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() ); - myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() ); - myPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() ); - myPickingSettings->SetInfoWindowTransparency( myTransparencySpinBox->value() / 100.0 ); - myPickingSettings->SetInfoWindowPosition( myPositionComboBox->currentIndex() ); - myPickingSettings->SetZoomFactor( myZoomFactorSpinBox->value() ); - myPickingSettings->SetStepNumber( myStepNumberSpinBox->value() ); - myPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() ); - - //QPalette aPalette( mySelectionColorButton->palette() ); - QColor aButtonColor = mySelectionColorButton->color();//aPalette.color(mySelectionColorButton->backgroundRole() ); - vtkFloatingPointType aColor[3]; - aColor[0] = aButtonColor.red() / 255.0; - aColor[1] = aButtonColor.green() / 255.0; - aColor[2] = aButtonColor.blue() / 255.0; - myPickingSettings->SetColor( aColor ); - - myPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL ); - - SelectorHelper aHelper( myInteractor ); - if ( !aHelper.get() ) - return; - - VISU::TCellID aCellID = myParentElementLineEdit->text().toInt(); - VISU::TLocalPntID aLocalPntID = myLocalPointLineEdit->text().toInt(); - VISU::PGaussPtsIDMapper anIDMapper = aHelper.myPipeLine->GetGaussPtsIDMapper(); - vtkIdType anObjId = anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) ); - if ( anObjId < 0 ) - return; - - aHelper.myMapIndex.Clear(); - aHelper.myMapIndex.Add( anObjId ); - aHelper.mySelector->AddOrRemoveIndex( aHelper.myIO, aHelper.myMapIndex, false ); - aHelper.myActor->Highlight( aHelper.myIO ); - myInteractor->GetDevice()->CreateTimer( VTKI_TIMER_FIRST ); -} - -void VVTK_PickingDlg::onClickClose() -{ - reject(); -} - -void VVTK_PickingDlg::onClickHelp() -{ - QString aHelpFileName = "picking.htm"; - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); - else { - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - SUIT_MessageBox::warning( 0, - QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), - QObject::tr("BUT_OK")); - } -} - -/*void VVTK_PickingDlg::onColorButtonPressed() -{ - QPalette aPalette( mySelectionColorButton->palette() ); - QColor aColor = QColorDialog:: - getColor( aPalette.color(mySelectionColorButton->backgroundRole() ), this ); - - if( aColor.isValid() ) - { - aPalette.setColor( mySelectionColorButton->backgroundRole(), - aColor ); - mySelectionColorButton->setPalette( aPalette ); - } -}*/ - -void VVTK_PickingDlg::keyPressEvent( QKeyEvent* e ) -{ - QDialog::keyPressEvent( e ); - if ( e->isAccepted() ) - return; - - if ( e->key() == Qt::Key_F1 ) - { - e->accept(); - onClickHelp(); - } -} diff --git a/src/VVTK/VVTK_PickingDlg.h b/src/VVTK/VVTK_PickingDlg.h deleted file mode 100644 index b01dc9ba..00000000 --- a/src/VVTK/VVTK_PickingDlg.h +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VVTK_PickingDlg.h -// Author : Oleg Uvarov -// Module : VISU -// -#ifndef VVTK_PICKINGDLG_H -#define VVTK_PICKINGDLG_H - -#include "SVTK_DialogBase.h" - -#include -#include - -#include - -class vtkActorCollection; -class vtkCallbackCommand; -class vtkImageData; - -class QLabel; -class QComboBox; -class QCheckBox; -class QPushButton; - -class QtxAction; -class QtxDoubleSpinBox; -class QtxIntSpinBox; -class QtxColorButton; - -class VISU_GaussPtsAct; -class VISU_PickingSettings; - -class SVTK_MainWindow; -class SVTK_RenderWindowInteractor; -class VVTK_ValidatedLineEdit; - -//! Picking Dialog. -/*! - * Uses for set up picking preferenses and apply - * them to all actors in the current renderer. - */ -class VVTK_PickingDlg : public SVTK_DialogBase -{ - Q_OBJECT - -public: - VVTK_PickingDlg(QtxAction* theAction, - SVTK_MainWindow* theParent, - const char* theName); - - ~VVTK_PickingDlg(); - - //! Make an actor to listen the event of Update Picking Settings event. - void AddActor( VISU_GaussPtsAct* ); - void RemoveActor( VISU_GaussPtsAct* ); - - //! Update dialog contents. - void Update(); - - VISU_PickingSettings* GetPickingSettings(); - - void SetInteractor( SVTK_RenderWindowInteractor* ); - -protected slots: - void onSelectionEvent(); - void onClickApply(); - void onClickClose(); - void onClickHelp(); - - //void onColorButtonPressed(); - void onSelectionValidate(); - -private: - static void ProcessEvents(vtkObject* theObject, - unsigned long theEvent, - void* theClientData, - void* theCallData); - - void KeyPressed(); - void keyPressEvent( QKeyEvent* e ); - -private: - QtxDoubleSpinBox* myCursorSizeSpinBox; - QtxDoubleSpinBox* myPyramidHeightSpinBox; - QtxColorButton* mySelectionColorButton; - QtxDoubleSpinBox* myPointToleranceSpinBox; - QtxIntSpinBox* myTransparencySpinBox; - QComboBox* myPositionComboBox; - QtxDoubleSpinBox* myZoomFactorSpinBox; - QtxIntSpinBox* myStepNumberSpinBox; - QCheckBox* myDisplayParentMeshCheckBox; - - QtxAction* myAction; - vtkSmartPointer - myPickingSettings; - - VVTK_ValidatedLineEdit* - myParentElementLineEdit; - VVTK_ValidatedLineEdit* - myLocalPointLineEdit; - - SVTK_RenderWindowInteractor* - myInteractor; - - float myPriority; - vtkSmartPointer - myEventCallbackCommand; -}; - -class VVTK_ValidatedLineEdit : public QLineEdit -{ - Q_OBJECT; -public: - VVTK_ValidatedLineEdit( QWidget* parent ); - -public slots: - void MarkValidated( const QString& theText ); -}; - -#endif diff --git a/src/VVTK/VVTK_Recorder.cxx b/src/VVTK/VVTK_Recorder.cxx deleted file mode 100755 index 049fc56c..00000000 --- a/src/VVTK/VVTK_Recorder.cxx +++ /dev/null @@ -1,490 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME VTKViewer : build VTK viewer into Salome desktop -// File : -// Author : -// Module : -// $Header$ -// -#include "VVTK_Recorder.h" - -#include "VVTK_ImageWriter.h" -#include "VVTK_ImageWriterMgr.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifndef WIN32 -#include -#endif - -#include -#include -#include - -#include "utilities.h" - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - - -namespace -{ - //---------------------------------------------------------------------------- - inline - void - GetNameJPEG(const std::string& thePreffix, - const int theIndex, - std::string& theName) - { - using namespace std; - ostringstream aStream; - aStream<SetClientData(this); - myCommand->SetCallback(VVTK_Recorder::ProcessEvents); -} - - -//---------------------------------------------------------------------------- -VVTK_Recorder -::~VVTK_Recorder() -{ - myCommand->Delete(); - myFilter->Delete(); - delete myWriterMgr; -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::CheckExistAVIMaker() -{ - myErrorStatus = 0; - using namespace std; - ostringstream aStream; - aStream<<"which "<& /dev/null"; - std::string anAVIMakeCheck = aStream.str(); - int iErr = system(anAVIMakeCheck.c_str()); - if(iErr != 0) - myErrorStatus = 127; -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::SetName(const char* theName) -{ - myName = theName; -} - -const char* -VVTK_Recorder::Name() const -{ - return myName.c_str(); -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::SetNbFPS(const double theNbFPS) -{ - myNbFPS = theNbFPS; -} - -double -VVTK_Recorder -::NbFPS() const -{ - return myNbFPS; -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::SetQuality(int theQuality) -{ - myQuality = theQuality; -} - -int -VVTK_Recorder -::GetQuality() const -{ - return myQuality; -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::SetRenderWindow(vtkRenderWindow* theRenderWindow) -{ - myRenderWindow = theRenderWindow; -} - -vtkRenderWindow* -VVTK_Recorder -::RenderWindow() -{ - return myRenderWindow; -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::SetProgressiveMode(bool theProgressiveMode) -{ - myProgressiveMode = theProgressiveMode; -} - -bool -VVTK_Recorder -::GetProgressiveMode() const -{ - return myProgressiveMode; -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::SetUseSkippedFrames(bool theUseSkippedFrames) -{ - myUseSkippedFrames = theUseSkippedFrames; -} - -bool -VVTK_Recorder -::UseSkippedFrames() const -{ - return myUseSkippedFrames; -} - - -//---------------------------------------------------------------------------- -int -VVTK_Recorder -::ErrorStatus() const -{ - return myErrorStatus; -} - -int -VVTK_Recorder -::State() const -{ - return myState; -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::ProcessEvents(vtkObject* vtkNotUsed(theObject), - unsigned long theEvent, - void* theClientData, - void* vtkNotUsed(theCallData)) -{ - if(vtkObject* anObj = reinterpret_cast(theClientData)){ - if(VVTK_Recorder* aSelf = dynamic_cast(anObj)){ - if(theEvent==vtkCommand::EndEvent){ - if(aSelf->State() == VVTK_Recorder::VVTK_Recorder_Record){ - aSelf->DoRecord(); - } - } - } - } -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::Record() -{ - if(myState == VVTK_Recorder_Stop){ - if(myRenderWindow){ - myState = VVTK_Recorder_Record; - myFilter->SetInput(myRenderWindow); - myFrameIndex = -1; - myNbWrittenFrames = 0; - myRenderWindow->RemoveObserver(myCommand); - myRenderWindow->AddObserver(vtkCommand::EndEvent, - myCommand, - myPriority); - myRenderWindow->Render(); - } - } -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::Stop() -{ - QApplication::setOverrideCursor( Qt::WaitCursor ); - - if(myState == VVTK_Recorder_Record){ - if(!myPaused) - DoRecord(); - - myWriterMgr->Stop(); - - if(myUseSkippedFrames) - AddSkippedFrames(); - - myFrameIndexes.clear(); - - MakeFileAVI(); - } - myState = VVTK_Recorder_Stop; - myPaused = 0; - - QApplication::restoreOverrideCursor(); -} - - -//---------------------------------------------------------------------------- -void -VVTK_Recorder -::Pause() -{ - myPaused = myPaused ? 0 : 1; - if(myPaused && !myFrameIndexes.empty()){ - myFrameIndexes.back() *= -1; - if(MYDEBUG) MESSAGE("VVTK_Recorder::Pause - myFrameIndexes.back() = "< -#include -#include - -#include - -class vtkRenderWindow; -class vtkCallbackCommand; -class vtkWindowToImageFilter; -class VVTK_ImageWriterMgr; -// -class VVTK_Recorder : public vtkObject -{ - protected: - enum State { - VVTK_Recorder_Unknown=0, - VVTK_Recorder_Record, - VVTK_Recorder_Stop - }; - - public: - static VVTK_Recorder *New(); - vtkTypeRevisionMacro(VVTK_Recorder,vtkObject); - - void - SetRenderWindow(vtkRenderWindow* theRenderWindow); - - vtkRenderWindow* - RenderWindow(); - - void - SetName(const char *theName); - - const char* - Name() const; - - void - SetNbFPS(const double theNbFPS); - - double - NbFPS() const; - - void - SetQuality(int theQuality); - - int - GetQuality() const; - - void - SetProgressiveMode(bool theProgressiveMode); - - bool - GetProgressiveMode() const; - - void - SetUseSkippedFrames(bool theUseSkippedFrames); - - bool - UseSkippedFrames() const; - - void - Record(); - - void - Pause(); - - void - Stop(); - - int - State() const; - - int - ErrorStatus() const; - - void - CheckExistAVIMaker(); - -protected : - VVTK_Recorder(); - - ~VVTK_Recorder(); - - void - DoRecord(); - - void - MakeFileAVI(); - - void - AddSkippedFrames(); - - void - PreWrite(); - - static - void - ProcessEvents(vtkObject* theObject, - unsigned long theEvent, - void* theClientData, - void* theCallData); - -protected : - int myState; - int myPaused; - int myErrorStatus; - - float myPriority; - double myTimeStart; - - int myFrameIndex; - int myNbWrittenFrames; - - double myNbFPS; - int myQuality; - bool myProgressiveMode; - - typedef std::vector TFrameIndexes; - TFrameIndexes myFrameIndexes; - bool myUseSkippedFrames; - - std::string myName; - std::string myNameAVIMaker; - - vtkCallbackCommand *myCommand; - vtkRenderWindow *myRenderWindow; - vtkWindowToImageFilter *myFilter; - VVTK_ImageWriterMgr *myWriterMgr; - - -private: - VVTK_Recorder(const VVTK_Recorder&); //Not implemented - void operator=(const VVTK_Recorder&); //Not implemented -}; -#endif diff --git a/src/VVTK/VVTK_RecorderDlg.cxx b/src/VVTK/VVTK_RecorderDlg.cxx deleted file mode 100644 index 447a562d..00000000 --- a/src/VVTK/VVTK_RecorderDlg.cxx +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// VISU VISUGUI : GUI of VISU component -// File : VVTK_RecorderDlg.cxx -// Author : Oleg UVAROV -// Module : VISU -// -#include "VVTK_RecorderDlg.h" -#include "VVTK_Recorder.h" - -#include "SUIT_FileDlg.h" -#include "SUIT_MessageBox.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" - -#include "QtxDoubleSpinBox.h" -#include "QtxIntSpinBox.h" - -#include "LightApp_Application.h" - -#include "CAM_Module.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -/*! - * Constructor - */ -VVTK_RecorderDlg::VVTK_RecorderDlg( QWidget* theParent, VVTK_Recorder* theRecorder ): - QDialog( theParent ), - myRecorder( theRecorder ) -{ - setWindowTitle( tr( "DLG_RECORDER_TITLE" ) ); - - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - - QVBoxLayout* aTopLayout = new QVBoxLayout( this ); - aTopLayout->setSpacing( 6 ); - aTopLayout->setMargin( 6 ); - //aTopLayout->setAutoAdd( true ); - - // Settings - QGroupBox* mySettingsBox = new QGroupBox( tr( "SETTINGS" ), this ); - //mySettingsBox->setColumnLayout( 0, Qt::Vertical ); - //mySettingsBox->layout()->setSpacing( 0 ); - //mySettingsBox->layout()->setMargin( 0 ); - - QGridLayout* aSettingsLayout = new QGridLayout( mySettingsBox ); - aSettingsLayout->setSpacing( 6 ); - aSettingsLayout->setMargin( 11 ); - - QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), mySettingsBox ); - myFileNameLineEdit = new QLineEdit( mySettingsBox ); - myFileNameLineEdit->setMinimumWidth( 250 ); - myFileNameLineEdit->setReadOnly( true ); - - QLabel* aRecordingModeLabel = new QLabel( tr( "RECORDING_MODE" ), mySettingsBox ); - myRecordingModeComboBox = new QComboBox( mySettingsBox ); - myRecordingModeComboBox->addItem( tr( "SKIPPED_FRAMES" ) ); - myRecordingModeComboBox->addItem( tr( "ALL_DISLPAYED_FRAMES" ) ); - myRecordingModeComboBox->setCurrentIndex( aResourceMgr->integerValue( "VISU", "recorder_mode", 1 ) ); - - QLabel* aFPSLabel = new QLabel( tr( "FPS" ), mySettingsBox ); - myFPSSpinBox = new QtxDoubleSpinBox( 0.1, 100.0, 1.0, mySettingsBox ); - myFPSSpinBox->setValue( aResourceMgr->doubleValue( "VISU", "recorder_fps", 10.0 ) ); - - QLabel* aQualityLabel = new QLabel( tr( "QUALITY" ), mySettingsBox ); - myQualitySpinBox = new QtxIntSpinBox( 1, 100, 1, mySettingsBox ); - myQualitySpinBox->setValue( aResourceMgr->integerValue( "VISU", "recorder_quality", 80 ) ); - - myProgressiveCheckBox = new QCheckBox( tr( "PROGRESSIVE" ), mySettingsBox ); - myProgressiveCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "recorder_progressive", false ) ); - - aSettingsLayout->addWidget( aFileNameLabel, 0, 0 ); - aSettingsLayout->addWidget( myFileNameLineEdit, 1, 0, 1, 2 ); - //aSettingsLayout->addWidget( aFileNameButton, 1, 2 ); - aSettingsLayout->addWidget( aRecordingModeLabel, 2, 0 ); - aSettingsLayout->addWidget( myRecordingModeComboBox, 2, 1 ); - aSettingsLayout->addWidget( aFPSLabel, 3, 0 ); - aSettingsLayout->addWidget( myFPSSpinBox, 3, 1 ); - aSettingsLayout->addWidget( aQualityLabel, 4, 0 ); - aSettingsLayout->addWidget( myQualitySpinBox, 4, 1 ); - aSettingsLayout->addWidget( myProgressiveCheckBox, 5, 0 ); - - aTopLayout->addWidget( mySettingsBox ); - - // Start / Close - QGroupBox* CommonGroup = new QGroupBox( this ); - //CommonGroup->setColumnLayout(0, Qt::Vertical ); - //CommonGroup->layout()->setSpacing( 0 ); - //CommonGroup->layout()->setMargin( 0 ); - QGridLayout* CommonGroupLayout = new QGridLayout( CommonGroup ); - CommonGroupLayout->setAlignment( Qt::AlignTop ); - CommonGroupLayout->setSpacing( 6 ); - CommonGroupLayout->setMargin( 11 ); - - QPushButton* aStartButton = new QPushButton( tr( "START" ), CommonGroup ); - aStartButton->setAutoDefault( true ); - aStartButton->setDefault( true ); - CommonGroupLayout->addWidget( aStartButton, 0, 0 ); - CommonGroupLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); - - QPushButton* aCloseButton = new QPushButton( tr( "CLOSE" ), CommonGroup ); - aCloseButton->setAutoDefault( true ); - CommonGroupLayout->addWidget( aCloseButton, 0, 2 ); - - QPushButton* aHelpButton = new QPushButton( tr( "HELP" ), CommonGroup ); - aHelpButton->setAutoDefault( true ); - CommonGroupLayout->addWidget( aHelpButton, 0, 3 ); - - aTopLayout->addWidget( CommonGroup ); - - connect( aStartButton, SIGNAL( clicked() ), this, SLOT( onStart() ) ); - connect( aCloseButton, SIGNAL( clicked() ), this, SLOT( onClose() ) ); - connect( aHelpButton, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); -} - -VVTK_RecorderDlg::~VVTK_RecorderDlg() -{ -} - -void VVTK_RecorderDlg::onStart() -{ - if( myFileName.isNull() ) - return; - - myRecorder->SetName( (const char*)myFileName.toLatin1() ); - - myRecorder->SetUseSkippedFrames( myRecordingModeComboBox->currentIndex() == 0 ); - myRecorder->SetNbFPS( myFPSSpinBox->value() ); - myRecorder->SetQuality( myQualitySpinBox->value() ); - myRecorder->SetProgressiveMode( myProgressiveCheckBox->isChecked() ); - - accept(); - -} - -void VVTK_RecorderDlg::onClose() -{ - reject(); -} - -void VVTK_RecorderDlg::onHelp() -{ - QString aHelpFileName = "animation_in_gauss_viewer.htm"; - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); - else { - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) ); - } -} - -bool VVTK_RecorderDlg::onBrowseFile() -{ - QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ); - - QStringList aFilter; - aFilter.append( tr( "FLT_AVI_FILES" ) ); - aFilter.append( tr( "FLT_ALL_FILES" ) ); - - QString aFileName = SUIT_FileDlg::getFileName( this, getenv( "HOME" ), aFilter, - tr( "FILE_NAME" ), false ); - - if( aFileName.isNull() ) - return false; - - myFileName = aFileName; - myFileNameLineEdit->setText( aFileName.section( '/', -1 ) ); - - return true; -} - -int VVTK_RecorderDlg::exec() -{ - if( !onBrowseFile() ) - { - reject(); - return 0; - } - return QDialog::exec(); -} - -void VVTK_RecorderDlg::keyPressEvent( QKeyEvent* e ) -{ - QDialog::keyPressEvent( e ); - if ( e->isAccepted() ) - return; - - if ( e->key() == Qt::Key_F1 ) - { - e->accept(); - onHelp(); - } -} diff --git a/src/VVTK/VVTK_RecorderDlg.h b/src/VVTK/VVTK_RecorderDlg.h deleted file mode 100644 index f6b8bac4..00000000 --- a/src/VVTK/VVTK_RecorderDlg.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// VISU VISUGUI : GUI of VISU component -// File : VVTK_RecorderDlg.h -// Author : Oleg UVAROV -// Module : VISU -// $Header$ -// -#ifndef VVTK_RECORDERDLG_H -#define VVTK_RECORDERDLG_H - -#include -#include - -class QCheckBox; -class QComboBox; -class QGroupBox; -class QLCDNumber; -class QLineEdit; -class QPushButton; -class QTimer; - -class QtxDoubleSpinBox; -class QtxIntSpinBox; - -class VVTK_Recorder; - -//! Recorder Dialog. -class VVTK_RecorderDlg : public QDialog -{ - Q_OBJECT - -public: - VVTK_RecorderDlg( QWidget*, VVTK_Recorder* ); - ~VVTK_RecorderDlg(); - - int exec(); - - QString fileName() const { return myFileName; } - -private: - virtual void keyPressEvent( QKeyEvent* ); - -protected slots: - void onStart(); - void onClose(); - void onHelp(); - - bool onBrowseFile(); - -private: - VVTK_Recorder* myRecorder; - QString myFileName; - - QLineEdit* myFileNameLineEdit; - - QComboBox* myRecordingModeComboBox; - QtxDoubleSpinBox* myFPSSpinBox; - QtxIntSpinBox* myQualitySpinBox; - QCheckBox* myProgressiveCheckBox; - -}; - -#endif diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx deleted file mode 100644 index a9528508..00000000 --- a/src/VVTK/VVTK_Renderer.cxx +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME VTKViewer : build VTK viewer into Salome desktop -// File : -// Author : -// Module : -// $Header$ -// -#include "VVTK_Renderer.h" - -#include "VISU_GaussPtsAct.h" -#include "VISU_GaussPointsPL.hxx" -#include "VISU_WidgetCtrl.hxx" -#include "VISU_PlanesWidget.hxx" -#include "VISU_SphereWidget.hxx" - -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "utilities.h" - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -//====================================================================== -class VISU_FPSActor : public vtkTextActor -{ -public: - vtkTypeMacro( VISU_FPSActor, vtkTextActor); - static - VISU_FPSActor* - New(); - - virtual - int - RenderOpaqueGeometry(vtkViewport *theViewport); -}; - -//====================================================================== -vtkStandardNewMacro(VISU_FPSActor); - -//====================================================================== -// function: RenderOpaqueGeometry -// purpose : -//====================================================================== -int -VISU_FPSActor -::RenderOpaqueGeometry(vtkViewport *theViewport) -{ - // It's impossible to render opaque geometry of text actor - // if the size of the viewport is less than 1.0 - int *size = theViewport->GetSize(); - if( size[0] <= 1.0 || size[1] <= 1.0 ) - return 1; - - if(vtkRenderer *aRenderer = dynamic_cast(theViewport)){ - static float aTol = 1.e-6; - float aLastRenderTimeInSeconds = aRenderer->GetLastRenderTimeInSeconds(); - if(aLastRenderTimeInSeconds > aTol){ - size_t aNumberOfCells = 0; - VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); - if(vtkActorCollection *anActorCollection = aCopy.GetActors()){ - anActorCollection->InitTraversal(); - while(vtkActor *anActor = anActorCollection->GetNextActor()){ - if(anActor->GetVisibility()){ - if(SALOME_Actor *aSActor = dynamic_cast(anActor)){ - if(vtkMapper *aMapper = aSActor->GetMapper()){ - if(vtkDataSet *aDataSet = aMapper->GetInput()){ - aNumberOfCells += aDataSet->GetNumberOfCells(); - } - } - } - } - } - } - std::ostringstream aStr; - float aFPS = 1.0 / aLastRenderTimeInSeconds; - aStr<<"FPS: "<Delete(); - - vtkTextMapper* aTextMapper = vtkTextMapper::New(); - vtkTextProperty *aTextProperty = aTextMapper->GetTextProperty(); - aTextProperty->SetJustificationToRight(); - aTextProperty->SetVerticalJustificationToTop(); - aTextProperty->SetFontSize(10); - - myFPSActor->SetPickable(false); - myFPSActor->ScaledTextOff(); - myFPSActor->SetAlignmentPoint(8); - myFPSActor->SetPosition2 (1., 1.); - myFPSActor->SetMapper(aTextMapper); - aTextMapper->Delete(); - - //GetDevice()->AddActor2D(myFPSActor.GetPointer()); - - myGaussPointPicker->Delete(); - - myGaussPreHighlightProperty->Delete(); - myGaussPreHighlightProperty->SetColor(0,1,1); - - myGaussHighlightProperty->Delete(); - myGaussHighlightProperty->SetColor(1,1,0); - -} - -VVTK_Renderer -::~VVTK_Renderer() -{ - if(MYDEBUG) INFOS("~VVTK_Renderer() - "<(theActor)){ - anActor->SetPointPicker(myGaussPointPicker.GetPointer()); - anActor->SetPreHighlightProperty(myGaussPreHighlightProperty.GetPointer()); - anActor->SetHighlightProperty(myGaussHighlightProperty.GetPointer()); - - anActor->SetInsideCursorSettings(myInsideCursorSettings); - //anActor->SetPickingSettings(myPickingSettings); - } -} - -//---------------------------------------------------------------------------- -void -VVTK_Renderer -::RemoveActor(VTKViewer_Actor* theActor) -{ - Superclass::RemoveActor(theActor); - if(VISU_GaussPtsAct* anActor = dynamic_cast(theActor)){ - anActor->SetPointPicker(NULL); - anActor->SetPreHighlightProperty(NULL); - anActor->SetHighlightProperty(NULL); - - anActor->SetInsideCursorSettings(NULL); - //anActor->SetPickingSettings(NULL); - } -} - -//---------------------------------------------------------------------------- -void -VVTK_Renderer -::SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings) -{ - myInsideCursorSettings = theInsideCursorSettings; -} - -//---------------------------------------------------------------------------- -void -VVTK_Renderer -::SetPickingSettings(VISU_PickingSettings* thePickingSettings) -{ - myPickingSettings = thePickingSettings; -} - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro(VVTK_Renderer1); - -//---------------------------------------------------------------------------- -VVTK_Renderer1::VVTK_Renderer1(): - myWidgetCtrl(VISU_WidgetCtrl::New()), - myOutsideCursorSettings(NULL) -{ - if(MYDEBUG) INFOS("VVTK_Renderer1() - "<SetPlaceFactor(1.1); - // - VISU_PlanesWidget *aPlanesWidget = myWidgetCtrl->GetPlanesWidget(); - aPlanesWidget->SetOutlineTranslation(false); - vtkProperty* aSelectedPlaneProperty = aPlanesWidget->GetSelectedPlaneProperty(); - vtkProperty* aPlaneProperty = aPlanesWidget->GetPlaneProperty(); - aPlaneProperty->SetOpacity(aSelectedPlaneProperty->GetOpacity()*1.5); - // - //myWidgetCtrl->Delete(); -} - -VVTK_Renderer1 -::~VVTK_Renderer1() -{ - if(MYDEBUG) INFOS("~VVTK_Renderer1() - "<SetInteractor(NULL); -} - -//---------------------------------------------------------------------------- -void -VVTK_Renderer1 -::AddActor(VTKViewer_Actor* theActor) -{ - Superclass::AddActor(theActor); - if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)){ - anActor->SetWidgetCtrl(GetWidgetCtrl()); - anActor->SetOutsideCursorSettings(myOutsideCursorSettings); - AdjustWidgetCtrl(); - } -} - - -//---------------------------------------------------------------------------- -void -VVTK_Renderer1 -::RemoveActor(VTKViewer_Actor* theActor) -{ - Superclass::RemoveActor(theActor); - if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)){ - anActor->SetWidgetCtrl(NULL); - anActor->SetOutsideCursorSettings(NULL); - AdjustWidgetCtrl(); - } -} - - -//---------------------------------------------------------------------------- -void -VVTK_Renderer1 -::AdjustWidgetCtrl() -{ - VISU_PlanesWidget *aPlanesWidget = myWidgetCtrl->GetPlanesWidget(); - aPlanesWidget->InitialPlaceWidget(myBndBox); - aPlanesWidget->SetOrigin(0.5*(myBndBox[1] + myBndBox[0]), - 0.5*(myBndBox[3] + myBndBox[2]), - 0.5*(myBndBox[5] + myBndBox[4])); - // - VISU_SphereWidget *aSphereWidget = myWidgetCtrl->GetSphereWidget(); - aSphereWidget->SetCenter(0.5*(myBndBox[1] + myBndBox[0]), - 0.5*(myBndBox[3] + myBndBox[2]), - 0.5*(myBndBox[5] + myBndBox[4])); - - float aMinLength = VTK_LARGE_FLOAT; - for (int i=0; i<3; ++i) { - float aLength = myBndBox[2*i+1]-myBndBox[2*i]; - aMinLength = std::min(aMinLength,aLength); - } - aSphereWidget->SetRadius(aMinLength); -} - -//---------------------------------------------------------------------------- -void -VVTK_Renderer1 -::Initialize(vtkRenderWindowInteractor* theInteractor, - SVTK_Selector* theSelector) -{ - SVTK_Renderer::Initialize(theInteractor,theSelector); - myWidgetCtrl->SetInteractor(theInteractor); -} - -//---------------------------------------------------------------------------- -void -VVTK_Renderer1 -::SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings) -{ - myOutsideCursorSettings = theOutsideCursorSettings; -} - -//---------------------------------------------------------------------------- -VISU_WidgetCtrl* -VVTK_Renderer1 -::GetWidgetCtrl() -{ - return myWidgetCtrl;//.GetPointer(); -} - -//---------------------------------------------------------------------------- -bool -VVTK_Renderer1 -::OnAdjustActors() -{ - return SVTK_Renderer::OnAdjustActors(); -} - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro(VVTK_Renderer2); - -//---------------------------------------------------------------------------- -VVTK_Renderer2 -::VVTK_Renderer2(): - myEventCallbackCommand(vtkCallbackCommand::New()) -{ - if(MYDEBUG) INFOS("VVTK_Renderer2() - "<Delete(); - - myPriority = 0.0; - myEventCallbackCommand->SetClientData(this); - myEventCallbackCommand->SetCallback(VVTK_Renderer2::ProcessEvents); -} - -VVTK_Renderer2 -::~VVTK_Renderer2() -{ - if(MYDEBUG) INFOS("~VVTK_Renderer2() - "<AddObserver(vtkCommand::EndInteractionEvent, - myEventCallbackCommand.GetPointer(), - myPriority); - theWidgetCtrl->AddObserver(vtkCommand::EnableEvent, - myEventCallbackCommand.GetPointer(), - myPriority); - theWidgetCtrl->AddObserver(vtkCommand::DisableEvent, - myEventCallbackCommand.GetPointer(), - myPriority); - myWidgetCtrl = theWidgetCtrl; -} - -void -VVTK_Renderer2 -::ProcessEvents(vtkObject* vtkNotUsed(theObject), - unsigned long theEvent, - void* theClientData, - void* vtkNotUsed(theCallData)) -{ - VVTK_Renderer2* self = reinterpret_cast(theClientData); - - switch(theEvent){ - case vtkCommand::EnableEvent: - case vtkCommand::EndInteractionEvent: - self->OnEndInteractionEvent(); - break; - } -} - -void -VVTK_Renderer2 -::OnEndInteractionEvent() -{ - AdjustActors(); - myInteractor->Render(); -} - - -//---------------------------------------------------------------------------- -void VVTK_Renderer2::AddActor(VTKViewer_Actor* theActor) -{ - if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)){ - if(VISU::TGaussPtsActorFactory* aFactory = anActor->GetGaussPtsFactory()){ - if(VISU_GaussPtsAct2* anActor2 = aFactory->CloneActor(anActor)){ - anActor2->SetWidgetCtrl(myWidgetCtrl); - Superclass::AddActor(anActor2); - } - } - } -} - -//---------------------------------------------------------------------------- -void -VVTK_Renderer2 -::RemoveActor(VTKViewer_Actor* theActor) -{ - using namespace VISU; - if(VISU_GaussPtsAct2* anActor = dynamic_cast(theActor)){ - anActor->SetWidgetCtrl(NULL); - Superclass::RemoveActor(theActor); - } -} diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h deleted file mode 100644 index 0bb4f818..00000000 --- a/src/VVTK/VVTK_Renderer.h +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME VTKViewer : build VTK viewer into Salome desktop -// File : -// Author : -// Module : SALOME -// $Header$ -// -#ifndef VVTK_Renderer_h -#define VVTK_Renderer_h - -#include "VVTK.h" - -#include "SVTK_Renderer.h" - -class VISU_WidgetCtrl; -class VISU_InsideCursorSettings; -class VISU_OutsideCursorSettings; -class VISU_PickingSettings; -class VISU_FPSActor; - -class vtkPointPicker; -class vtkImplicitFunction; - -//---------------------------------------------------------------------------- -//! To customize SVTK_Renderer according to VVTK functionality -class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer -{ - public: - vtkTypeMacro(VVTK_Renderer,SVTK_Renderer); - static VVTK_Renderer* New(); - - //! Reimplement SVTK_Renderer::AddActor - /*! - Perform an additional action - apply picking settings on the published VISU_GaussPtsAct actors - */ - virtual - void - AddActor(VTKViewer_Actor* theActor); - - //! Reimplement SVTK_Renderer::RemoveActor (remove additional settings) - virtual - void - RemoveActor(VTKViewer_Actor* theActor); - - //! To set VISU_PickingSettings to share them among all VISU_GaussPtsAct actors published into the view - void - SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings); - - void - SetPickingSettings(VISU_PickingSettings* thePickingSettings); - - protected: - VVTK_Renderer(); - ~VVTK_Renderer(); - - VISU_PickingSettings* myPickingSettings; //! Keeps reference of the VISU_PickingSettings - VISU_InsideCursorSettings* myInsideCursorSettings; //! Keeps reference of the VISU_InsideCursorSettings - vtkSmartPointer myFPSActor; //!< To show FPS of the rendering at run-time - - vtkSmartPointer myGaussPointPicker; - vtkSmartPointer myGaussPreHighlightProperty; - vtkSmartPointer myGaussHighlightProperty; -}; - - -//---------------------------------------------------------------------------- -//! To extend VVTK_Renderer to implement base view functionality -class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer -{ - public: - vtkTypeMacro(VVTK_Renderer1,VVTK_Renderer); - static VVTK_Renderer1* New(); - - //! Reimplement SVTK_Renderer::Initialize - virtual - void - Initialize(vtkRenderWindowInteractor* theInteractor, - SVTK_Selector* theSelector); - - //! Reimplement VVTK_Renderer::AddActor to apply to the actor additional settings - virtual - void - AddActor(VTKViewer_Actor* theActor); - - //! Reimplement VVTK_Renderer::RemoveActor - virtual - void - RemoveActor(VTKViewer_Actor* theActor); - - //! To set VISU_PickingSettings to share them among all VISU_GaussPtsAct1 actors published into the view - void - SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings); - - VISU_WidgetCtrl* GetWidgetCtrl(); - - protected: - VVTK_Renderer1(); - ~VVTK_Renderer1(); - - //! Reimplement VVTK_Renderer::OnAdjustActors - virtual - bool - OnAdjustActors(); - - void AdjustWidgetCtrl(); - - VISU_WidgetCtrl* myWidgetCtrl; - //vtkSmartPointer myWidgetCtrl; - VISU_OutsideCursorSettings* myOutsideCursorSettings; - vtkSmartPointer myTextActor; -}; - - -//---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer -{ - public: - vtkTypeMacro(VVTK_Renderer2,VVTK_Renderer); - static VVTK_Renderer2* New(); - - //! Reimplement VVTK_Renderer::AddActor to apply to the actor additional settings - virtual - void - AddActor(VTKViewer_Actor* theActor); - - //! Reimplement VVTK_Renderer::RemoveActor - virtual - void - RemoveActor(VTKViewer_Actor* theActor); - - void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl); - - //! To handle vtkCommand::EndInteractionEvent to redraw the view - void - OnEndInteractionEvent(); - - protected: - VVTK_Renderer2(); - ~VVTK_Renderer2(); - - //! Main process VTK event method - static - void - ProcessEvents(vtkObject* theObject, - unsigned long theEvent, - void* theClientData, - void* theCallData); - - //! Used to process VTK events - vtkSmartPointer myEventCallbackCommand; - - //! Priority at which events are processed - float myPriority; - - VISU_WidgetCtrl* myWidgetCtrl; -}; - - -#endif diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx deleted file mode 100644 index a752d1b7..00000000 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ /dev/null @@ -1,859 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VVTK_SegmentationCursorDlg.cxx -// Author : Oleg Uvarov -// Module : VISU -// -#include "VVTK_SegmentationCursorDlg.h" -#include "VVTK_PrimitiveBox.h" -#include "VVTK_SizeBox.h" - -#include "VISU_GaussPtsAct.h" -#include "VISU_GaussPtsSettings.h" - -#include "VISU_WidgetCtrl.hxx" -#include "VISU_PlanesWidget.hxx" -#include "VISU_SphereWidget.hxx" - -#include "VISU_GaussPointsPL.hxx" -#include "VISU_OpenGLPointSpriteMapper.hxx" - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//---------------------------------------------------------------- -VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const char* name ) - :QDialog( parent, - Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), - myEventCallbackCommand( vtkCallbackCommand::New() ), - myInsideCursorSettings( VISU_InsideCursorSettings::New() ), - myOutsideCursorSettings( VISU_OutsideCursorSettings::New() ), - myIsPlaneSegmentation( true ), - myWidgetCtrl(NULL), - myInteractor(NULL) -{ - setAccessibleName( name ); - - myPriority = 0.0; - myEventCallbackCommand->Delete(); - myEventCallbackCommand->SetClientData(this); - myEventCallbackCommand->SetCallback(VVTK_SegmentationCursorDlg::ProcessEvents); - - myInsideCursorSettings->AddObserver(VISU::UpdateFromSettingsEvent, - myEventCallbackCommand.GetPointer(), - myPriority); - - setWindowTitle( tr( "SEGMENTATION_CURSOR_DLG_TITLE" ) ); - setSizeGripEnabled(TRUE); - - QVBoxLayout* TopLayout = new QVBoxLayout( this ); - TopLayout->setSpacing(6); - TopLayout->setMargin(11); - - myTabBox = new QTabWidget( this ); - - // Segmentation cursor pane - mySegmentationCursorBox = new QWidget( this ); - QVBoxLayout* SCBoxLayout = new QVBoxLayout( mySegmentationCursorBox ); - SCBoxLayout->setMargin(11); - SCBoxLayout->setSpacing(6); - SCBoxLayout->setAlignment(Qt::AlignTop); - - // Origin - myOriginGroup = new QGroupBox( tr( "ORIGIN_TITLE" ), mySegmentationCursorBox ); - //myOriginGroup->setColumnLayout( 0, Qt::Vertical ); - //myOriginGroup->layout()->setSpacing( 0 ); - //myOriginGroup->layout()->setMargin( 0 ); - - QGridLayout* OriginGroupLayout = new QGridLayout( myOriginGroup ); - OriginGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - OriginGroupLayout->setSpacing(6); - OriginGroupLayout->setMargin(11); - - QLabel* XOriginLabel = new QLabel( tr( "ORIGIN_X" ), myOriginGroup ); - myXOriginSpinBox = new QtxDoubleSpinBox( -1000.0, 1000.0, 0.1, myOriginGroup ); - myXOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myXOriginSpinBox->setMinimumWidth( 100 ); - myXOriginSpinBox->setValue( 0.0 ); - - QLabel* YOriginLabel = new QLabel( tr( "ORIGIN_Y" ), myOriginGroup ); - myYOriginSpinBox = new QtxDoubleSpinBox( -1000.0, 1000.0, 0.1, myOriginGroup ); - myYOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myYOriginSpinBox->setMinimumWidth( 100 ); - myYOriginSpinBox->setValue( 0.0 ); - - QLabel* ZOriginLabel = new QLabel( tr( "ORIGIN_Z" ), myOriginGroup ); - myZOriginSpinBox = new QtxDoubleSpinBox( -1000.0, 1000.0, 0.1, myOriginGroup ); - //myZOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myZOriginSpinBox->setMinimumWidth( 100 ); - myZOriginSpinBox->setValue( 1.0 ); - - OriginGroupLayout->addWidget( XOriginLabel, 0, 0 ); - OriginGroupLayout->addWidget( myXOriginSpinBox, 0, 1 ); - OriginGroupLayout->addWidget( YOriginLabel, 0, 2 ); - OriginGroupLayout->addWidget( myYOriginSpinBox, 0, 3 ); - OriginGroupLayout->addWidget( ZOriginLabel, 0, 4 ); - OriginGroupLayout->addWidget( myZOriginSpinBox, 0, 5 ); - - SCBoxLayout->addWidget( myOriginGroup ); - - // Direction ( Plane Segmentation ) - myDirectionGroup = new QGroupBox( tr( "DIRECTION_TITLE" ), mySegmentationCursorBox ); - //myDirectionGroup->setColumnLayout( 0, Qt::Vertical ); - //myDirectionGroup->layout()->setSpacing( 0 ); - //myDirectionGroup->layout()->setMargin( 0 ); - - QGridLayout* DirectionGroupLayout = new QGridLayout( myDirectionGroup ); - DirectionGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - DirectionGroupLayout->setSpacing(6); - DirectionGroupLayout->setMargin(11); - - QLabel* DXDirectionLabel = new QLabel( tr( "DIRECTION_DX" ), myDirectionGroup ); - myDXDirectionSpinBox = new QtxDoubleSpinBox( -1.0, 1.0, 0.1, myDirectionGroup ); - myDXDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myDXDirectionSpinBox->setMinimumWidth( 100 ); - myDXDirectionSpinBox->setValue( 0.0 ); - - QLabel* DYDirectionLabel = new QLabel( tr( "DIRECTION_DY" ), myDirectionGroup ); - myDYDirectionSpinBox = new QtxDoubleSpinBox( -1.0, 1.0, 0.1, myDirectionGroup ); - myDYDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myDYDirectionSpinBox->setMinimumWidth( 100 ); - myDYDirectionSpinBox->setValue( 0.0 ); - - QLabel* DZDirectionLabel = new QLabel( tr( "DIRECTION_DZ" ), myDirectionGroup ); - myDZDirectionSpinBox = new QtxDoubleSpinBox( -1.0, 1.0, 0.1, myDirectionGroup ); - myDZDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myDZDirectionSpinBox->setMinimumWidth( 100 ); - myDZDirectionSpinBox->setValue( 1.0 ); - - DirectionGroupLayout->addWidget( DXDirectionLabel, 0, 0 ); - DirectionGroupLayout->addWidget( myDXDirectionSpinBox, 0, 1 ); - DirectionGroupLayout->addWidget( DYDirectionLabel, 0, 2 ); - DirectionGroupLayout->addWidget( myDYDirectionSpinBox, 0, 3 ); - DirectionGroupLayout->addWidget( DZDirectionLabel, 0, 4 ); - DirectionGroupLayout->addWidget( myDZDirectionSpinBox, 0, 5 ); - - SCBoxLayout->addWidget( myDirectionGroup ); - - // Depth ( Plane Segmentation ) - myDepthGroup = new QGroupBox( tr( "DEPTH_TITLE" ), mySegmentationCursorBox ); - //myDepthGroup->setColumnLayout( 0, Qt::Vertical ); - //myDepthGroup->layout()->setSpacing( 0 ); - //myDepthGroup->layout()->setMargin( 0 ); - - QGridLayout* DepthGroupLayout = new QGridLayout( myDepthGroup ); - DepthGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - DepthGroupLayout->setSpacing(6); - DepthGroupLayout->setMargin(11); - - QLabel* DepthLabel = new QLabel( tr( "DEPTH" ), myDepthGroup ); - myDepthSpinBox = new QtxDoubleSpinBox( 0.0, VTK_LARGE_FLOAT, 0.1, myDepthGroup ); - myDepthSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myDepthSpinBox->setMinimumWidth( 100 ); - myDepthSpinBox->setValue( 1.0 ); - - DepthGroupLayout->addWidget( DepthLabel, 0, 0 ); - DepthGroupLayout->addWidget( myDepthSpinBox, 0, 1 ); - - SCBoxLayout->addWidget( myDepthGroup ); - - // Radius ( Sphere Segmentation ) - myRadiusGroup = new QGroupBox( tr( "RADIUS_TITLE" ), mySegmentationCursorBox ); - //myRadiusGroup->setColumnLayout( 0, Qt::Vertical ); - //myRadiusGroup->layout()->setSpacing( 0 ); - //myRadiusGroup->layout()->setMargin( 0 ); - - QGridLayout* RadiusGroupLayout = new QGridLayout( myRadiusGroup ); - RadiusGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - RadiusGroupLayout->setSpacing(6); - RadiusGroupLayout->setMargin(11); - - QLabel* RadiusLabel = new QLabel( tr( "RADIUS" ),myRadiusGroup ); - myRadiusSpinBox = new QtxDoubleSpinBox( 0.0, 1000.0, 1.0,myRadiusGroup ); - myRadiusSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myRadiusSpinBox->setMinimumWidth( 100 ); - myRadiusSpinBox->setValue( 100.0 ); - - QLabel* RatioLabel = new QLabel( tr( "RATIO" ), myRadiusGroup ); - myRatioSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1,myRadiusGroup ); - myRatioSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myRatioSpinBox->setMinimumWidth( 100 ); - myRatioSpinBox->setValue( 2.0 ); - - RadiusGroupLayout->addWidget( RadiusLabel, 0, 0 ); - RadiusGroupLayout->addWidget( myRadiusSpinBox, 0, 1 ); - RadiusGroupLayout->addWidget( RatioLabel, 0, 2 ); - RadiusGroupLayout->addWidget( myRatioSpinBox, 0, 3 ); - - SCBoxLayout->addWidget( myRadiusGroup ); - - myTabBox->addTab( mySegmentationCursorBox, tr( "SEGMENTATION_CURSOR_TAB" ) ); - - // Gauss points pane - myGaussPointsBox = new QWidget( this ); - QVBoxLayout* GPBoxLayout = new QVBoxLayout( myGaussPointsBox ); - GPBoxLayout->setMargin(11); - GPBoxLayout->setSpacing(6); - - // Inside Gauss points - QGroupBox* anInsideGroup = new QGroupBox( tr( "INSIDE_GAUSS_POINTS" ), myGaussPointsBox ); - //anInsideGroup->setColumnLayout( 0, Qt::Vertical ); - //anInsideGroup->layout()->setSpacing( 0 ); - //anInsideGroup->layout()->setMargin( 0 ); - - QGridLayout* anInsideGroupLayout = new QGridLayout( anInsideGroup ); - anInsideGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - anInsideGroupLayout->setSpacing(6); - anInsideGroupLayout->setMargin(11); - - // Primitive - myInsidePrimitiveBox = new VVTK_PrimitiveBox( anInsideGroup ); - - // Size - myInsideSizeBox = new VVTK_SizeBox( anInsideGroup ); - myInsideSizeBox->setType( VVTK_SizeBox::Inside ); - - anInsideGroupLayout->addWidget( myInsidePrimitiveBox, 0, 0 ); - anInsideGroupLayout->addWidget( myInsideSizeBox, 1, 0 ); - - GPBoxLayout->addWidget( anInsideGroup ); - - // Outside Gauss points - QGroupBox* anOutsideGroup = new QGroupBox( tr( "OUTSIDE_GAUSS_POINTS" ), myGaussPointsBox ); - //anOutsideGroup->setColumnLayout( 0, Qt::Vertical ); - //anOutsideGroup->layout()->setSpacing( 0 ); - //anOutsideGroup->layout()->setMargin( 0 ); - - QGridLayout* anOutsideGroupLayout = new QGridLayout( anOutsideGroup ); - anOutsideGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - anOutsideGroupLayout->setSpacing(6); - anOutsideGroupLayout->setMargin(11); - - // Primitive - myOutsidePrimitiveBox = new VVTK_PrimitiveBox( anOutsideGroup ); - - // Size - myOutsideSizeBox = new VVTK_SizeBox( anOutsideGroup ); - myOutsideSizeBox->setType( VVTK_SizeBox::Outside ); - - anOutsideGroupLayout->addWidget( myOutsidePrimitiveBox, 0, 0 ); - anOutsideGroupLayout->addWidget( myOutsideSizeBox, 1, 0 ); - - GPBoxLayout->addWidget( anOutsideGroup ); - - // Magnification - QGroupBox* MagnificationGroup = new QGroupBox ( tr( "MAGNIFICATION_TITLE" ), myGaussPointsBox ); - //MagnificationGroup->setColumnLayout(0, Qt::Vertical ); - //MagnificationGroup->layout()->setSpacing( 0 ); - //MagnificationGroup->layout()->setMargin( 0 ); - - QGridLayout* MagnificationGroupLayout = new QGridLayout ( MagnificationGroup ); - MagnificationGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - MagnificationGroupLayout->setSpacing(6); - MagnificationGroupLayout->setMargin(11); - - myMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), MagnificationGroup ); - myMagnificationSpinBox = new QtxIntSpinBox( 1, 10000, 10, MagnificationGroup ); - myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - MagnificationGroupLayout->addWidget( myMagnificationLabel, 0, 0 ); - MagnificationGroupLayout->addWidget( myMagnificationSpinBox, 0, 1 ); - - // Increment - myIncrementLabel = new QLabel( tr( "INCREMENT" ), MagnificationGroup ); - myIncrementSpinBox = new QtxDoubleSpinBox( 0.01, 10, 0.1, MagnificationGroup ); - myIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - MagnificationGroupLayout->addWidget( myIncrementLabel, 0, 2 ); - MagnificationGroupLayout->addWidget( myIncrementSpinBox, 0, 3 ); - - - myTabBox->addTab( myGaussPointsBox, tr( "GAUSS_POINTS_TAB" ) ); - //myTabBox->showPage( myGaussPointsBox ); - myTabBox->setCurrentWidget( myGaussPointsBox ); - - GPBoxLayout->addWidget( MagnificationGroup ); - - - // Common buttons =========================================================== - QGroupBox* GroupButtons = new QGroupBox( this ); - //GroupButtons->setColumnLayout(0, Qt::Vertical ); - //GroupButtons->layout()->setSpacing( 0 ); - //GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - QPushButton* buttonApply = new QPushButton( tr( "&Apply" ), GroupButtons ); - buttonApply->setAutoDefault( TRUE ); - buttonApply->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 0 ); - GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); - - QPushButton* buttonClose = new QPushButton( tr( "&Close" ) , GroupButtons ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose, 0, 2 ); - - QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons ); - buttonHelp->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); - - TopLayout->addWidget( myTabBox ); - TopLayout->addWidget( GroupButtons ); - - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) ); - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( onClickClose() ) ); - connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onClickHelp() ) ); - - connect(parent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow())); - connect(parent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide())); -} - -VVTK_SegmentationCursorDlg::~VVTK_SegmentationCursorDlg() -{ - SetWidgetCtrl(NULL); -} - -float VVTK_SegmentationCursorDlg::getMagnification() const -{ - return myMagnificationSpinBox->value() / 100.0; -} - -void VVTK_SegmentationCursorDlg::setMagnification( float theMagnification ) -{ - myMagnificationSpinBox->setValue( ( int )( theMagnification * 100 ) ); -} - -float VVTK_SegmentationCursorDlg::getIncrement() const -{ - return myIncrementSpinBox->value(); -} - -void VVTK_SegmentationCursorDlg::setIncrement( float theIncrement ) -{ - myIncrementSpinBox->setValue( theIncrement ); -} - - -void VVTK_SegmentationCursorDlg::SetWidgetCtrl( VISU_WidgetCtrl* theWidgetCtrl ) -{ - if(myWidgetCtrl == theWidgetCtrl) - return; - - if(myWidgetCtrl) - myWidgetCtrl->RemoveObserver(myEventCallbackCommand.GetPointer()); - - myWidgetCtrl = theWidgetCtrl; - - if(theWidgetCtrl) - theWidgetCtrl->AddObserver(vtkCommand::EndInteractionEvent, - myEventCallbackCommand.GetPointer(), - myPriority); -} - -void VVTK_SegmentationCursorDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), - unsigned long theEvent, - void* theClientData, - void* vtkNotUsed(theCallData)) -{ - VVTK_SegmentationCursorDlg* self = reinterpret_cast(theClientData); - - switch(theEvent){ - case vtkCommand::EndInteractionEvent: - self->UpdateSegmentation(); - break; - case VISU::UpdateFromSettingsEvent: - self->GetOutsideCursorSettings()->SetMagnification( self->GetInsideCursorSettings()->GetMagnification() ); - self->GetOutsideCursorSettings()->SetIncrement( self->GetInsideCursorSettings()->GetIncrement() ); - - self->UpdateInsideGaussPoints(); - self->UpdateOutsideGaussPoints(); - - self->GetInsideCursorSettings()->InvokeEvent(VISU::UpdateInsideSettingsEvent,NULL); - self->GetOutsideCursorSettings()->InvokeEvent(VISU::UpdateOutsideSettingsEvent,NULL); - break; - } -} - -void VVTK_SegmentationCursorDlg::UpdateSegmentation() -{ - if( myIsPlaneSegmentation ) - { - myDirectionGroup->show(); - myDepthGroup->show(); - myRadiusGroup->hide(); - - VISU_PlanesWidget *pPlanesWidget=myWidgetCtrl->GetPlanesWidget(); - vtkFloatingPointType origin[3]; - pPlanesWidget->GetOrigin( origin ); - myXOriginSpinBox->setValue( origin[0] ); - myYOriginSpinBox->setValue( origin[1] ); - myZOriginSpinBox->setValue( origin[2] ); - - vtkFloatingPointType normal[3]; - pPlanesWidget->GetNormal( normal ); - myDXDirectionSpinBox->setValue( normal[0] ); - myDYDirectionSpinBox->setValue( normal[1] ); - myDZDirectionSpinBox->setValue( normal[2] ); - - myDepthSpinBox->setValue( pPlanesWidget->Distance() ); - } - else - { - myDirectionGroup->hide(); - myDepthGroup->hide(); - myRadiusGroup->show(); - - VISU_SphereWidget *pSphereWidget=myWidgetCtrl->GetSphereWidget(); - vtkFloatingPointType origin[3], aRadius; - pSphereWidget->GetCenter(origin); - myXOriginSpinBox->setValue( origin[0] ); - myYOriginSpinBox->setValue( origin[1] ); - myZOriginSpinBox->setValue( origin[2] ); - aRadius=pSphereWidget->GetRadius(); - myRadiusSpinBox->setValue(aRadius); - myRatioSpinBox->setValue(pSphereWidget->GetRatio()); - } -} - -void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints() -{ - int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; - vtkFloatingPointType aClamp = 200.0; - QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_texture.bmp"; - QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_alpha.bmp"; - vtkFloatingPointType anAlphaThreshold = 0.1; - int aResolution = 8; - int aMinSize = 3; - int aMaxSize = 33; - int aMagnification = 100; - vtkFloatingPointType anIncrement = 2.0; - - if( !myInsideCursorSettings->GetInitial() ) - { - myInsidePrimitiveBox->setPrimitiveType( myInsideCursorSettings->GetPrimitiveType() ); - myInsidePrimitiveBox->setClamp( myInsideCursorSettings->GetClamp() ); - myInsidePrimitiveBox->setMainTexture( myInsideMainTexture ); - myInsidePrimitiveBox->setAlphaTexture( myInsideAlphaTexture ); - myInsidePrimitiveBox->setAlphaThreshold( myInsideCursorSettings->GetAlphaThreshold() ); - myInsidePrimitiveBox->setResolution( myInsideCursorSettings->GetResolution() ); - - myInsideSizeBox->setMinSize( myInsideCursorSettings->GetMinSize() ); - myInsideSizeBox->setMaxSize( myInsideCursorSettings->GetMaxSize() ); - - this->setMagnification( myInsideCursorSettings->GetMagnification() ); - this->setIncrement( myInsideCursorSettings->GetIncrement() ); - - return; - } - - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - - aPrimitiveType = aResourceMgr->integerValue( "VISU", "inside_point_sprite_primitive_type", aPrimitiveType ); - myInsidePrimitiveBox->setPrimitiveType( aPrimitiveType ); - - aClamp = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_clamp", aClamp ); - myInsidePrimitiveBox->setClamp( aClamp ); - - aMainTexture = aResourceMgr->stringValue( "VISU", "inside_point_sprite_main_texture", aMainTexture ); - myInsidePrimitiveBox->setMainTexture( aMainTexture ); - - anAlphaTexture = aResourceMgr->stringValue( "VISU", "inside_point_sprite_alpha_texture", anAlphaTexture ); - myInsidePrimitiveBox->setAlphaTexture( anAlphaTexture ); - - anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_alpha_threshold", anAlphaThreshold ); - myInsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold ); - - aResolution = aResourceMgr->integerValue( "VISU", "inside_geom_sphere_resolution", aResolution ); - myInsidePrimitiveBox->setResolution( aResolution ); - - aMinSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_min_size", aMinSize ); - myInsideSizeBox->setMinSize( aMinSize / 100.0 ); - - aMaxSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_max_size", aMaxSize ); - myInsideSizeBox->setMaxSize( aMaxSize / 100.0 ); - - aMagnification = aResourceMgr->integerValue( "VISU", "inside_point_sprite_magnification", aMagnification ); - this->setMagnification( aMagnification / 100.0 ); - - anIncrement = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_increment", anIncrement ); - this->setIncrement( anIncrement ); - - myInsidePrimitiveBox->setFaceLimit( 50000 ); - - ApplyInsideGaussPoints(); -} - -void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints() -{ - vtkFloatingPointType aClamp = 256.0; - int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; - QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_texture.bmp"; - QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_alpha.bmp"; - vtkFloatingPointType anAlphaThreshold = 0.1; - int aResolution = 8; - int aSize = 25; - bool aUniform = false; - QColor aColor = Qt::blue; - - if( !myOutsideCursorSettings->GetInitial() ) - { - myOutsidePrimitiveBox->setPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() ); - myOutsidePrimitiveBox->setClamp( myOutsideCursorSettings->GetClamp() ); - myOutsidePrimitiveBox->setMainTexture( myOutsideMainTexture ); - myOutsidePrimitiveBox->setAlphaTexture( myOutsideAlphaTexture ); - myOutsidePrimitiveBox->setAlphaThreshold( myOutsideCursorSettings->GetAlphaThreshold() ); - myOutsidePrimitiveBox->setResolution( myOutsideCursorSettings->GetResolution() ); - - myOutsideSizeBox->setOutsideSize( myOutsideCursorSettings->GetSize() ); - myOutsideSizeBox->setUniform( myOutsideCursorSettings->GetUniform() ); - - vtkFloatingPointType* aColor = myOutsideCursorSettings->GetColor(); - myOutsideSizeBox->setColor( QColor( ( int )( aColor[0] * 255.0 ), - ( int )( aColor[1] * 255.0 ), - ( int )( aColor[2] * 255.0 ) ) ); - - return; - } - - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - - aPrimitiveType = aResourceMgr->integerValue( "VISU", "outside_point_sprite_primitive_type", aPrimitiveType ); - myOutsidePrimitiveBox->setPrimitiveType( aPrimitiveType ); - - aClamp = aResourceMgr->doubleValue( "VISU", "outside_point_sprite_clamp", aClamp ); - myOutsidePrimitiveBox->setClamp( aClamp ); - - aMainTexture = aResourceMgr->stringValue( "VISU", "outside_point_sprite_main_texture", aMainTexture ); - myOutsidePrimitiveBox->setMainTexture( aMainTexture ); - - anAlphaTexture = aResourceMgr->stringValue( "VISU", "outside_point_sprite_alpha_texture", anAlphaTexture ); - myOutsidePrimitiveBox->setAlphaTexture( anAlphaTexture ); - - anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "outside_point_sprite_alpha_threshold", anAlphaThreshold ); - myOutsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold ); - - aResolution = aResourceMgr->integerValue( "VISU", "outside_geom_sphere_resolution", aResolution ); - myOutsidePrimitiveBox->setResolution( aResolution ); - - aSize = aResourceMgr->integerValue( "VISU", "outside_point_sprite_size", aSize ); - myOutsideSizeBox->setOutsideSize( aSize / 100.0 ); - - aUniform = aResourceMgr->booleanValue( "VISU", "outside_point_sprite_uniform", aUniform ); - myOutsideSizeBox->setUniform( aUniform ); - - aColor = aResourceMgr->colorValue( "VISU", "outside_point_sprite_color", aColor ); - myOutsideSizeBox->setColor( aColor ); - - myOutsidePrimitiveBox->setFaceLimit( 50000 ); - - ApplyOutsideGaussPoints(); -} - -VISU_InsideCursorSettings* VVTK_SegmentationCursorDlg::GetInsideCursorSettings() -{ - return myInsideCursorSettings.GetPointer(); -} - -VISU_OutsideCursorSettings* VVTK_SegmentationCursorDlg::GetOutsideCursorSettings() -{ - return myOutsideCursorSettings.GetPointer(); -} - -VISU::TTextureValue -VVTK_SegmentationCursorDlg -::MakeImageData( bool theInside, - const QString& theMainTexture, - const QString& theAlphaTexture ) -{ - if( theInside ) - { - bool updateMainTexture = myInsideMainTexture != theMainTexture; - bool updateAlphaTexture = myInsideAlphaTexture != theAlphaTexture; - if( !updateMainTexture && !updateAlphaTexture ) - return 0; - - myInsideMainTexture = theMainTexture; - myInsideAlphaTexture = theAlphaTexture; - } - else - { - bool updateMainTexture = myOutsideMainTexture != theMainTexture; - bool updateAlphaTexture = myOutsideAlphaTexture != theAlphaTexture; - if( !updateMainTexture && !updateAlphaTexture ) - return 0; - - myOutsideMainTexture = theMainTexture; - myOutsideAlphaTexture = theAlphaTexture; - } - - return VISU::GetTexture( (const char*)theMainTexture.toLatin1(), - (const char*)theAlphaTexture.toLatin1()); -} - -void VVTK_SegmentationCursorDlg::onClickApply() -{ - if( myTabBox->currentWidget() == mySegmentationCursorBox ) - ApplySegmentationCursor(); - else - { - QString aWarning = "The number of faces needed to perform the 'Geometrical Sphere' primitive\n"; - aWarning.append( "presentation might be too important to ensure an acceptable frame rate.\n\n" ); - aWarning.append( "Can you please confirm that you want to continue anyway?" ); - bool toApply = CheckNumberOfFaces() || - SUIT_MessageBox::warning( this, tr( "Warning" ), aWarning, - tr( "&OK" ), tr( "&Cancel" ), 0, 1, 1 ) == 0; - - if( toApply ) - { - ApplyInsideGaussPoints(); - ApplyOutsideGaussPoints(); - } - } -} - -void VVTK_SegmentationCursorDlg::ApplySegmentationCursor() -{ - if( myIsPlaneSegmentation ) - { - VISU_PlanesWidget *pPlanesWidget=myWidgetCtrl->GetPlanesWidget(); - vtkFloatingPointType origin[3]; - origin[0] = myXOriginSpinBox->value(); - origin[1] = myYOriginSpinBox->value(); - origin[2] = myZOriginSpinBox->value(); - pPlanesWidget->SetOrigin( origin ); - - vtkFloatingPointType normal[3]; - normal[0] = myDXDirectionSpinBox->value(); - normal[1] = myDYDirectionSpinBox->value(); - normal[2] = myDZDirectionSpinBox->value(); - - if( normal[0] == 0.0 && normal[1] == 0.0 && normal[2] == 0.0 ) - { - normal[2] = 1.0; - myDZDirectionSpinBox->setValue( 1.0 ); - } - pPlanesWidget->SetNormal( normal ); - - pPlanesWidget->SetDistance( myDepthSpinBox->value() ); - - myWidgetCtrl->InvokeEvent(vtkCommand::EndInteractionEvent,NULL); - myWidgetCtrl->GetInteractor()->Render(); - } - else - { - VISU_SphereWidget *pSphereWidget=myWidgetCtrl->GetSphereWidget(); - vtkFloatingPointType origin[3], aRadius; - origin[0] = myXOriginSpinBox->value(); - origin[1] = myYOriginSpinBox->value(); - origin[2] = myZOriginSpinBox->value(); - pSphereWidget->SetCenter(origin); - - aRadius=myRadiusSpinBox->value(); - pSphereWidget->SetRadius(aRadius); - - pSphereWidget->SetRatio(myRatioSpinBox->value()); - - myWidgetCtrl->InvokeEvent(vtkCommand::EndInteractionEvent,NULL); - myWidgetCtrl->GetInteractor()->Render(); - } -} - -void VVTK_SegmentationCursorDlg::ApplyInsideGaussPoints() -{ - QString anInsideMainTexture = myInsidePrimitiveBox->getMainTexture(); - QString anInsideAlphaTexture = myInsidePrimitiveBox->getAlphaTexture(); - VISU::TTextureValue aTexture = MakeImageData( true, anInsideMainTexture, anInsideAlphaTexture ); - - if( aTexture.GetPointer() ) - myInsideCursorSettings->SetTexture( aTexture.GetPointer() ); - - myInsideCursorSettings->SetInitial( false ); - myInsideCursorSettings->SetPrimitiveType( myInsidePrimitiveBox->getPrimitiveType() ); - myInsideCursorSettings->SetClamp( myInsidePrimitiveBox->getClamp() ); - myInsideCursorSettings->SetAlphaThreshold( myInsidePrimitiveBox->getAlphaThreshold() ); - myInsideCursorSettings->SetResolution( myInsidePrimitiveBox->getResolution() ); - - myInsideCursorSettings->SetMinSize( myInsideSizeBox->getMinSize() ); - myInsideCursorSettings->SetMaxSize( myInsideSizeBox->getMaxSize() ); - - myInsideCursorSettings->SetMagnification( this->getMagnification() ); - myInsideCursorSettings->SetIncrement( this->getIncrement() ); - - myInsideCursorSettings->InvokeEvent(VISU::UpdateInsideSettingsEvent,NULL); -} - -void VVTK_SegmentationCursorDlg::ApplyOutsideGaussPoints() -{ - QString anOutsideMainTexture = myOutsidePrimitiveBox->getMainTexture(); - QString anOutsideAlphaTexture = myOutsidePrimitiveBox->getAlphaTexture(); - VISU::TTextureValue aTexture = MakeImageData( false, anOutsideMainTexture, anOutsideAlphaTexture ); - - if( aTexture.GetPointer() ) - myOutsideCursorSettings->SetTexture( aTexture.GetPointer() ); - - myOutsideCursorSettings->SetInitial( false ); - myOutsideCursorSettings->SetPrimitiveType( myOutsidePrimitiveBox->getPrimitiveType() ); - myOutsideCursorSettings->SetClamp( myOutsidePrimitiveBox->getClamp() ); - myOutsideCursorSettings->SetAlphaThreshold( myOutsidePrimitiveBox->getAlphaThreshold() ); - myOutsideCursorSettings->SetResolution( myOutsidePrimitiveBox->getResolution() ); - - myOutsideCursorSettings->SetSize( myOutsideSizeBox->getOutsideSize() ); - myOutsideCursorSettings->SetUniform( myOutsideSizeBox->getUniform() ); - - QColor aButtonColor = myOutsideSizeBox->getColor(); - vtkFloatingPointType aColor[3]; - aColor[0] = aButtonColor.red() / 255.0; - aColor[1] = aButtonColor.green() / 255.0; - aColor[2] = aButtonColor.blue() / 255.0; - myOutsideCursorSettings->SetColor( aColor ); - - myOutsideCursorSettings->SetMagnification( this->getMagnification() ); - myOutsideCursorSettings->SetIncrement( this->getIncrement() ); - - myOutsideCursorSettings->InvokeEvent(VISU::UpdateOutsideSettingsEvent,NULL); -} - -void VVTK_SegmentationCursorDlg::onClickClose() -{ - myPlaneAction->setChecked( false ); - mySphereAction->setChecked( false ); - - emit scgClose(); - - reject(); -} - -void VVTK_SegmentationCursorDlg::onClickHelp() -{ - QString aHelpFileName = "segmentation.htm"; - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); - else { - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - SUIT_MessageBox::warning( 0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), - QObject::tr("BUT_OK")); - } -} - -void VVTK_SegmentationCursorDlg::done( int r ) -{ - myPlaneAction->setChecked( false ); - mySphereAction->setChecked( false ); - - emit scgClose(); - - QDialog::done( r ); -} - -void VVTK_SegmentationCursorDlg::onParentShow() -{ - if(myPlaneAction->isChecked() || mySphereAction->isChecked()) - show(); - else - hide(); -} - -void VVTK_SegmentationCursorDlg::onParentHide() -{ - hide(); -} - -bool VVTK_SegmentationCursorDlg::CheckNumberOfFaces() -{ - if( !myInteractor ) - return false; - - vtkRenderer* aRenderer = myInteractor->getRenderer(); - - if( !aRenderer ) - return false; - - int aNumberOfPoints = 0; - - vtkActor* anActor; - VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); - vtkActorCollection* anActColl = aCopy.GetActors(); - for( anActColl->InitTraversal(); ( anActor = anActColl->GetNextActor() ) != NULL; ) - { - if( VISU_GaussPtsAct1* aGaussActor = VISU_GaussPtsAct1::SafeDownCast( anActor ) ) - aNumberOfPoints += aGaussActor->GetInput()->GetNumberOfCells(); - } - return !( myInsidePrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere && - aNumberOfPoints * myInsidePrimitiveBox->getFaceNumber() * 2 > myInsidePrimitiveBox->getFaceLimit() || - myOutsidePrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere && - aNumberOfPoints * myOutsidePrimitiveBox->getFaceNumber() > myOutsidePrimitiveBox->getFaceLimit() ); -} - -void VVTK_SegmentationCursorDlg::keyPressEvent( QKeyEvent* e ) -{ - QDialog::keyPressEvent( e ); - if ( e->isAccepted() ) - return; - - if ( e->key() == Qt::Key_F1 ) - { - e->accept(); - onClickHelp(); - } -} diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.h b/src/VVTK/VVTK_SegmentationCursorDlg.h deleted file mode 100644 index c2f2f504..00000000 --- a/src/VVTK/VVTK_SegmentationCursorDlg.h +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VVTK_SegmentationCursorDlg.h -// Author : Oleg Uvarov -// Module : VISU -// -#ifndef VVTK_SEGMENTATIONCURSORDLG_H -#define VVTK_SEGMENTATIONCURSORDLG_H - -#include "VVTK.h" - -#include "VISU_GaussPtsDeviceActor.h" - -#include - -#include -#include - -class vtkActorCollection; -class vtkCallbackCommand; -class vtkImageData; - -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QTabWidget; -class QGroupBox; -class QWidget; -//class QVBox; - -class QtxAction; -class QtxDoubleSpinBox; -class QtxIntSpinBox; - -class VISU_GaussPtsAct1; -class VISU_InsideCursorSettings; -class VISU_OutsideCursorSettings; -class VISU_WidgetCtrl; - -class VVTK_PrimitiveBox; -class VVTK_SizeBox; - -class SVTK_RenderWindowInteractor; - - -//! Segmentation Cursor Dialog. -/*! - * Uses for set up Segmentation and Outside Cursor Gauss Points preferenses - * and apply them to all actors in the current renderer. - */ -class VVTK_SegmentationCursorDlg : public QDialog -{ - Q_OBJECT - -public: - VVTK_SegmentationCursorDlg( QWidget* parent = 0, const char* name = 0 ); - ~VVTK_SegmentationCursorDlg(); - - void SetWidgetCtrl( VISU_WidgetCtrl* ); - void SetPlaneAction( QtxAction* theAction ) { myPlaneAction = theAction; } - void SetSphereAction( QtxAction* theAction ) { mySphereAction = theAction; } - - bool GetIsPlaneSegmentation() const { return myIsPlaneSegmentation; } - void SetIsPlaneSegmentation( bool on ) { myIsPlaneSegmentation = on; } - - //! Update contents of the Segmentation tab. - void UpdateSegmentation(); - void UpdateInsideGaussPoints(); - void UpdateOutsideGaussPoints(); - - //! Update contents of the Outside Cursor tab. - void UpdateOutsideCursor(); - - VISU_InsideCursorSettings* GetInsideCursorSettings(); - VISU_OutsideCursorSettings* GetOutsideCursorSettings(); - - vtkSmartPointer GetEventCallbackCommand() { return myEventCallbackCommand; } - - void SetInteractor( SVTK_RenderWindowInteractor* theInteractor ) { myInteractor = theInteractor; } - -public: - float getMagnification() const; - void setMagnification( float ); - - float getIncrement() const; - void setIncrement( float ); - -protected: - void ApplySegmentationCursor(); - void ApplyInsideGaussPoints(); - void ApplyOutsideGaussPoints(); - - bool CheckNumberOfFaces(); - - VISU::TTextureValue - MakeImageData( bool theInside, - const QString& theMainTexture, - const QString& theAlphaTexture ); - -private: - static void ProcessEvents(vtkObject* theObject, - unsigned long theEvent, - void* theClientData, - void* theCallData); - - void keyPressEvent( QKeyEvent* e ); - -protected slots: - virtual void done( int ); - void onParentShow(); - void onParentHide(); - - void onClickApply(); - void onClickClose(); - void onClickHelp(); - -signals: - void scgClose(); - -private: - SVTK_RenderWindowInteractor* myInteractor; - - QTabWidget* myTabBox; - - // Segmentation cursor - QWidget* mySegmentationCursorBox; - - QGroupBox* myOriginGroup; - QtxDoubleSpinBox* myXOriginSpinBox; - QtxDoubleSpinBox* myYOriginSpinBox; - QtxDoubleSpinBox* myZOriginSpinBox; - - QGroupBox* myDirectionGroup; - QtxDoubleSpinBox* myDXDirectionSpinBox; - QtxDoubleSpinBox* myDYDirectionSpinBox; - QtxDoubleSpinBox* myDZDirectionSpinBox; - - QGroupBox* myDepthGroup; - QtxDoubleSpinBox* myDepthSpinBox; - - QGroupBox* myRadiusGroup; - QtxDoubleSpinBox* myRadiusSpinBox; - QtxDoubleSpinBox* myRatioSpinBox; - - bool myIsPlaneSegmentation; - - float myPriority; - vtkSmartPointer myEventCallbackCommand; - - VISU_WidgetCtrl* myWidgetCtrl; - QtxAction* myPlaneAction; - QtxAction* mySphereAction; - - // Gauss Points - QWidget* myGaussPointsBox; - - VVTK_PrimitiveBox* myInsidePrimitiveBox; - VVTK_SizeBox* myInsideSizeBox; - - QString myInsideMainTexture; - QString myInsideAlphaTexture; - - vtkSmartPointer myInsideCursorSettings; - - VVTK_PrimitiveBox* myOutsidePrimitiveBox; - VVTK_SizeBox* myOutsideSizeBox; - - QString myOutsideMainTexture; - QString myOutsideAlphaTexture; - - vtkSmartPointer myOutsideCursorSettings; - - QLabel* myMagnificationLabel; - QtxIntSpinBox* myMagnificationSpinBox; - QLabel* myIncrementLabel; - QtxDoubleSpinBox* myIncrementSpinBox; -}; - -#endif diff --git a/src/VVTK/VVTK_ViewManager.cxx b/src/VVTK/VVTK_ViewManager.cxx deleted file mode 100644 index fedcca71..00000000 --- a/src/VVTK/VVTK_ViewManager.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "VVTK_ViewManager.h" -#include "VVTK_ViewModel.h" - -#include - -int VVTK_ViewManager::_VVTKViewMgr_Id = 0; - -//*************************************************************** -VVTK_ViewManager -::VVTK_ViewManager( SUIT_Study* study, - SUIT_Desktop* theDesktop ) -: SVTK_ViewManager( study, theDesktop ) -{ - myId = ++_VVTKViewMgr_Id; - setViewModel( new VVTK_Viewer() ); -} - -//*************************************************************** -VVTK_ViewManager::~VVTK_ViewManager() -{ -} - -//*************************************************************** -void VVTK_ViewManager::setViewName(SUIT_ViewWindow* theView) -{ - int aPos = myViews.indexOf(theView); - theView->setWindowTitle( tr( "VTK_VIEW_TITLE" ).arg( myId ).arg( aPos + 1 ) ); -} diff --git a/src/VVTK/VVTK_ViewManager.h b/src/VVTK/VVTK_ViewManager.h deleted file mode 100644 index 5bc84e43..00000000 --- a/src/VVTK/VVTK_ViewManager.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef VVTK_VIEWMANAGER_H -#define VVTK_VIEWMANAGER_H - -#include "SVTK_ViewManager.h" -#include "VVTK.h" - -class SUIT_Desktop; - -//! Extend SUIT_ViewManager to deal with VVTK_Viewer -class VVTK_EXPORT VVTK_ViewManager : public SVTK_ViewManager -{ - Q_OBJECT; -public: - //! Construct the view manager - VVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* ); - - //! Destroy the view manager - virtual ~VVTK_ViewManager(); - -protected: - void setViewName( SUIT_ViewWindow* theView ); - -private: - int myId; - static int _VVTKViewMgr_Id; -}; - -#endif diff --git a/src/VVTK/VVTK_ViewModel.cxx b/src/VVTK/VVTK_ViewModel.cxx deleted file mode 100644 index c8286570..00000000 --- a/src/VVTK/VVTK_ViewModel.cxx +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "VVTK_ViewModel.h" -#include "VISU_ActorFactory.h" -#include "VVTK_ViewWindow.h" - -#include "VTKViewer_Algorithm.h" -#include "SVTK_Functor.h" -#include "VISU_ActorBase.h" -#include "SVTK_View.h" -#include "SVTK_Prs.h" - -#include - -#include -#include - -//--------------------------------------------------------------- -VVTK_Viewer::VVTK_Viewer() -{ -} - -//--------------------------------------------------------------- -VVTK_Viewer::~VVTK_Viewer() -{ -} - -//--------------------------------------------------------------- -SUIT_ViewWindow* VVTK_Viewer::createView( SUIT_Desktop* theDesktop ) -{ - TViewWindow* aViewWindow = new TViewWindow (theDesktop); - aViewWindow->Initialize(this); - - aViewWindow->setBackgroundColor( backgroundColor() ); - aViewWindow->SetTrihedronSize( trihedronSize() ); - aViewWindow->SetProjectionMode( projectionMode() ); - aViewWindow->SetInteractionStyle( interactionStyle() ); - aViewWindow->SetIncrementalSpeed( incrementalSpeed(), incrementalSpeedMode() ); - aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) ); - - return aViewWindow; -} - -//--------------------------------------------------------------- -void VVTK_Viewer::Display(const SALOME_VTKPrs* thePrs) -{ - // try do downcast object - if(const SVTK_Prs* aPrs = dynamic_cast(thePrs)){ - if(aPrs->IsNull()) - return; - if(vtkActorCollection* aCollection = aPrs->GetObjects()){ - aCollection->InitTraversal(); - while(VISU_ActorBase* anActor = dynamic_cast(aCollection->GetNextActor())){ - if(!anActor->GetFactory()->GetActiveState()) - continue; - QVector aViews = myViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ - if(SVTK_ViewWindow* aViewWindow = dynamic_cast(aViews.at(i))){ - if(SVTK_View* aView = aViewWindow->getView()){ - aView->Display(anActor, false); - } - } - } - } - } - } -} - -//--------------------------------------------------------------- -namespace VVTK -{ - struct TIsOneActorVisibleAction - { - bool& myResult; - TIsOneActorVisibleAction(bool& theResult): - myResult(theResult) - { - myResult = false; - } - void - operator()(SALOME_Actor* theActor) - { - if(!myResult) - myResult = theActor->GetVisibility(); - } - }; -} - -//--------------------------------------------------------------- -bool VVTK_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& theIO ) -{ - QVector aViews = myViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++) - if(SVTK_ViewWindow* aViewWindow = dynamic_cast(aViews.at(i))){ - bool aResult; - VVTK::TIsOneActorVisibleAction anAction(aResult); - VTK::ActorCollectionCopy aCopy(aViewWindow->getRenderer()->GetActors()); - SVTK::ForEachIf(aCopy.GetActors(), - SVTK::TIsSameIObject(theIO), - anAction); - return anAction.myResult; - } - - return false; -} diff --git a/src/VVTK/VVTK_ViewModel.h b/src/VVTK/VVTK_ViewModel.h deleted file mode 100644 index 7cfb87c3..00000000 --- a/src/VVTK/VVTK_ViewModel.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef VVTK_VIEWMODEL_H -#define VVTK_VIEWMODEL_H - -#include - -#include "VVTK.h" -#include "SVTK_ViewModel.h" - -class VVTK_ViewWindow; - -//! VVTK View Model -class VVTK_EXPORT VVTK_Viewer : public SVTK_Viewer -{ - Q_OBJECT; - -public: - typedef VVTK_ViewWindow TViewWindow; - - static - QString - Type() - { - return "VVTK"; - } - - VVTK_Viewer(); - - virtual - ~VVTK_Viewer(); - - //! See #SUIT_ViewModel::createView - virtual - SUIT_ViewWindow* - createView(SUIT_Desktop*); - - //! See SUIT_ViewModel::getType - virtual - QString - getType() const - { - return Type(); - } - - //! See #SALOME_View::Display( const SALOME_Prs* ) - virtual - void - Display(const SALOME_VTKPrs* thePrs); - - //! See #SALOME_View::isVisible( const Handle(SALOME_InteractiveObject)& ) - virtual - bool - isVisible(const Handle(SALOME_InteractiveObject)& theIO); -}; - -#endif diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx deleted file mode 100755 index 100bf767..00000000 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME VTKViewer : build VTK viewer into Salome desktop -// File : -// Author : -// Module : SALOME -// $Header$ -// -#include "VVTK_ViewWindow.h" -#include "VVTK_ViewModel.h" -#include "VVTK_MainWindow.h" -#include "SVTK_View.h" - -#include "SUIT_Session.h" - -#include "VVTK_Renderer.h" -#include "SVTK_Selector.h" -#include "SVTK_InteractorStyle.h" -#include "SVTK_RenderWindowInteractor.h" -#include "SVTK_GenericRenderWindowInteractor.h" - -#include - -#include -#include -#include -#include - -//---------------------------------------------------------------------------- -VVTK_ViewWindow -::VVTK_ViewWindow(SUIT_Desktop* theDesktop): - SVTK_ViewWindow(theDesktop), - myMainWindow1(NULL), - myMainWindow2(NULL), - myView2(NULL), - myDumpImage(QImage()) -{} - -//---------------------------------------------------------------------------- -void VVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel) -{ - if(SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr()){ - - QSplitter* s = new QSplitter( Qt::Vertical, this ); - setCentralWidget( s ); - - VISU_WidgetCtrl* aWidgetCtrl = NULL; - VISU_InsideCursorSettings* anInsideCursorSettings = NULL; - VISU_OutsideCursorSettings* anOutsideCursorSettings = NULL; - VISU_PickingSettings* aPickingSettings = NULL; - SVTK_Selector* aSelector = SVTK_Selector::New(); - { - myMainWindow1 = new VVTK_MainWindow1(s, - "VVTK_MainWindow", - aResourceMgr, - this); - - anInsideCursorSettings = myMainWindow1->GetInsideCursorSettings(); - anOutsideCursorSettings = myMainWindow1->GetOutsideCursorSettings(); - aPickingSettings = myMainWindow1->GetPickingSettings(); - - SVTK_RenderWindowInteractor* anIteractor = - new SVTK_RenderWindowInteractor(myMainWindow1,"SVTK_RenderWindowInteractor1"); - - SVTK_GenericRenderWindowInteractor* aDevice = - SVTK_GenericRenderWindowInteractor::New(); - aDevice->SetRenderWidget(anIteractor); - aDevice->SetSelector(aSelector); - - VVTK_Renderer1* aRenderer = VVTK_Renderer1::New(); - aRenderer->Initialize(aDevice,aSelector); - - aWidgetCtrl = aRenderer->GetWidgetCtrl(); - - aRenderer->SetInsideCursorSettings(anInsideCursorSettings); - aRenderer->SetOutsideCursorSettings(anOutsideCursorSettings); - aRenderer->SetPickingSettings(aPickingSettings); - - anIteractor->Initialize(aDevice,aRenderer,aSelector); - - SVTK_InteractorStyle* aStyle = SVTK_InteractorStyle::New(); - anIteractor->PushInteractorStyle(aStyle); - aStyle->Delete(); - - aDevice->Delete(); - aRenderer->Delete(); - - myMainWindow1->Initialize(anIteractor,aRenderer); - - myView1 = new SVTK_View(myMainWindow1); - SVTK_ViewWindow::Initialize(myView1,theModel); - - anIteractor->getRenderWindow()->Render(); - myMainWindow1->onResetView(); - } - { - myMainWindow2 = myMainWindow1->CreateMainWindow2(s, - "VVTK_SegmantationWindow", - aResourceMgr, - this); - SVTK_RenderWindowInteractor* anIteractor = - new SVTK_RenderWindowInteractor(myMainWindow2,"SVTK_RenderWindowInteractor1"); - - SVTK_GenericRenderWindowInteractor* aDevice = - SVTK_GenericRenderWindowInteractor::New(); - aDevice->SetRenderWidget(anIteractor); - aDevice->SetSelector(aSelector); - - VVTK_Renderer2* aRenderer = VVTK_Renderer2::New(); - aRenderer->Initialize(aDevice,aSelector); - - aRenderer->SetWidgetCtrl(aWidgetCtrl); - - aRenderer->SetInsideCursorSettings(anInsideCursorSettings); - aRenderer->SetPickingSettings(aPickingSettings); - - anIteractor->Initialize(aDevice,aRenderer,aSelector); - - SVTK_InteractorStyle* aStyle = SVTK_InteractorStyle::New(); - anIteractor->PushInteractorStyle(aStyle); - aStyle->Delete(); - - aDevice->Delete(); - aRenderer->Delete(); - - myMainWindow2->Initialize(anIteractor); - - myView2 = new SVTK_View(myMainWindow2); - SVTK_ViewWindow::Initialize(myView2,theModel); - - anIteractor->getRenderWindow()->Render(); - myMainWindow2->onResetView(); - } - aSelector->Delete(); - - int h = height() / 2; - QList aSizes; - aSizes.append( h ); - aSizes.append( h ); - s->setSizes( aSizes ); - myMainWindow2->hide(); - - myMainWindow = myMainWindow1; - myView = myView1; - } -} - -//---------------------------------------------------------------------------- -VVTK_ViewWindow -::~VVTK_ViewWindow() -{} - - -//---------------------------------------------------------------------------- -VVTK_MainWindow1* -VVTK_ViewWindow -::getMainWindow1() -{ - return myMainWindow1; -} - -VVTK_MainWindow2* -VVTK_ViewWindow -::getMainWindow2() -{ - return myMainWindow2; -} - - -//---------------------------------------------------------------------------- -void -VVTK_ViewWindow -::AddActor(VTKViewer_Actor* theActor, - bool theIsUpdate) -{ - myMainWindow1->AddActor(theActor,theIsUpdate); - myMainWindow2->AddActor(theActor,theIsUpdate); -} - -//---------------------------------------------------------------------------- -void -VVTK_ViewWindow -::RemoveActor(VTKViewer_Actor* theActor, - bool theIsUpdate) -{ - myMainWindow1->RemoveActor(theActor,theIsUpdate); - myMainWindow2->RemoveActor(theActor,theIsUpdate); -} - -//---------------------------------------------------------------------------- -void -VVTK_ViewWindow -::Repaint(bool theUpdateTrihedron) -{ - myMainWindow1->Repaint(theUpdateTrihedron); - myMainWindow2->Repaint(theUpdateTrihedron); -} - -//---------------------------------------------------------------- -void -VVTK_ViewWindow -::unHighlightAll() -{ - myView1->unHighlightAll(); - myView2->unHighlightAll(); -} - -//---------------------------------------------------------------- -void -VVTK_ViewWindow -::highlight(const Handle(SALOME_InteractiveObject)& theIO, - bool theIsHighlight, - bool theIsUpdate ) -{ - if(GetSelector()->AddIObject(theIO)) - GetSelector()->EndPickCallback(); - myView1->highlight( theIO, theIsHighlight, theIsUpdate ); - myView2->highlight( theIO, theIsHighlight, theIsUpdate ); -} - -//---------------------------------------------------------------- -void -VVTK_ViewWindow -::onSelectionChanged() -{ - myView1->onSelectionChanged(); - myView2->onSelectionChanged(); -} - -//---------------------------------------------------------------------------- -void -VVTK_ViewWindow -::onResetView() -{ - myMainWindow1->onResetView(); - myMainWindow2->onResetView(); -} - -//---------------------------------------------------------------------------- -void -VVTK_ViewWindow -::onFitAll() -{ - myMainWindow1->onFitAll(); - myMainWindow2->onFitAll(); -} - -//---------------------------------------------------------------------------- -bool -VVTK_ViewWindow -::action( const int accelAction ) -{ - if ( myMainWindow1->hasFocus() ) - myMainWindow1->action( accelAction ); - else if ( myMainWindow2->hasFocus() ) - myMainWindow2->action( accelAction ); - else - return false; - return true; -} - -//---------------------------------------------------------------------------- -QImage -VVTK_ViewWindow -::dumpView() -{ - if( myMainWindow1->GetInteractor()->hasFocus() ) - { - if ( myMainWindow1->getToolBar()->testAttribute(Qt::WA_UnderMouse) || myDumpImage.isNull() ) - return myMainWindow1->dumpView(); - else - return myDumpImage; - } - - if( myMainWindow2->GetInteractor()->hasFocus() ) - { - if ( myMainWindow1->getToolBar()->testAttribute(Qt::WA_UnderMouse) || myDumpImage.isNull() ) - return myMainWindow2->dumpView(); - else - return myDumpImage; - } - - return QImage(); -} - -//---------------------------------------------------------------------------- -void -VVTK_ViewWindow -::setBackgroundColor( const QColor& theColor ) -{ - myMainWindow1->SetBackgroundColor( theColor ); - myMainWindow2->SetBackgroundColor( theColor ); -} - - -//---------------------------------------------------------------------------- -void -VVTK_ViewWindow -::RefreshDumpImage() -{ - if( myMainWindow1->GetInteractor()->hasFocus() ) - myDumpImage = myMainWindow1->dumpView(); - else if ( myMainWindow2->GetInteractor()->hasFocus() ) - myDumpImage = myMainWindow2->dumpView(); -} diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h deleted file mode 100755 index eb267c68..00000000 --- a/src/VVTK/VVTK_ViewWindow.h +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef VVTK_VIEWWINDOW_H -#define VVTK_VIEWWINDOW_H - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -#include "VVTK.h" -#include "SVTK_ViewWindow.h" - -#include - -#include - -class VVTK_MainWindow1; -class VVTK_MainWindow2; -class SVTK_View; - -//---------------------------------------------------------------------------- -//! Customize the SVTK_ViewWindow in order to manage two SVTK_View (base and segmented one) -class VVTK_EXPORT VVTK_ViewWindow : public SVTK_ViewWindow -{ - Q_OBJECT; - -public: - //! To construct the class - VVTK_ViewWindow(SUIT_Desktop* theDesktop); - - //! Destroy - virtual - ~VVTK_ViewWindow(); - - //! To initialize - virtual - void - Initialize(SVTK_ViewModelBase* theModel); - - //---------------------------------------------------------------------------- - //! Get access to base SVTK_MainWindow - VVTK_MainWindow1* - getMainWindow1(); - - //! Get access to segmented SVTK_MainWindow - VVTK_MainWindow2* - getMainWindow2(); - - //---------------------------------------------------------------------------- - //! Redefine SVTK_ViewWindow::AddActor method - /*! - This is an entry point for publication the presentation into the viewer. - Pointed actor published into the basic MainWindow. If the actor is - a Gauss Points one second actor is created from initial actor and - is put into segemented MainWindow. - */ - virtual - void - AddActor(VTKViewer_Actor* theActor, - bool theIsUpdate = false); - - //! Redefine SVTK_ViewWindow::RemoveActor method - virtual - void - RemoveActor(VTKViewer_Actor* theActor, - bool theIsUpdate = false); - - //! Redefine SVTK_ViewWindow::Repaint method - virtual - void - Repaint(bool theUpdateTrihedron = true); - - //---------------------------------------------------------------------------- - /* interactive object management */ - //! Redefine SVTK_ViewWindow::highlight method - virtual - void - highlight(const Handle(SALOME_InteractiveObject)& theIO, - bool theIsHighlight = true, - bool theIsUpdate = true); - - //! Redefine SVTK_ViewWindow::unHighlightAll method - virtual - void - unHighlightAll(); - - //! Redefine SVTK_ViewWindow::setBackgroundColor method - virtual - void - setBackgroundColor( const QColor& ); - - //---------------------------------------------------------------------------- - - //! Refresh dump images of the viewers - virtual - void RefreshDumpImage(); - -public slots: - //! Redefine SVTK_ViewWindow::onSelectionChanged method - virtual - void - onSelectionChanged(); - - //! Redefine SVTK_ViewWindow::onResetView method - virtual - void - onResetView(); - - //! Redefine SVTK_ViewWindow::onFitAll method - virtual - void - onFitAll(); - - //---------------------------------------------------------------------------- -protected: - virtual - bool - action( const int ); - - virtual QImage dumpView(); - - VVTK_MainWindow1* myMainWindow1; //!< The manage base view - SVTK_View* myView1; //!< The manage base view - - VVTK_MainWindow2* myMainWindow2; //!< The manage segmented view - SVTK_View* myView2; //!< The manage segmented view - -private: - QImage myDumpImage; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif -- 2.39.2