From: nds Date: Tue, 7 Oct 2008 08:26:33 +0000 (+0000) Subject: Merging GUI_SRC module with the BR_HDF_dev_merged branch, which has been merged with... X-Git-Tag: TG_mergeto_BR_V5_DEV_finished~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=af3f65f16d35ad3c2733e44ee923d55321bd0254;p=modules%2Fgui.git Merging GUI_SRC module with the BR_HDF_dev_merged branch, which has been merged with the BR_V5_DEV branch. --- diff --git a/src/STD/STD_TabDesktop.cxx b/src/STD/STD_TabDesktop.cxx index 8b6c41b08..ab9d92e40 100644 --- a/src/STD/STD_TabDesktop.cxx +++ b/src/STD/STD_TabDesktop.cxx @@ -22,21 +22,20 @@ #include #include -#include #include #include -//#include +#include -#include -#include +#include +#include #include /*!Constructor.Create new instances of QVBox and QtxWorkstack.*/ STD_TabDesktop::STD_TabDesktop() : SUIT_Desktop(), -myWorkstack( 0 )//, -//myWorkstackAction( 0 ) +myWorkstack( 0 ), +myWorkstackAction( 0 ) { QFrame* base = new QFrame( this ); base->setFrameStyle( QFrame::Panel | QFrame::Sunken ); @@ -57,18 +56,32 @@ myWorkstack( 0 )//, myWorkstack->setAccel( QtxWorkstack::SplitHorizontal, Qt::SHIFT + Qt::Key_H ); myWorkstack->setAccel( QtxWorkstack::Close, Qt::SHIFT + Qt::Key_C ); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if ( resMgr ) { + myWorkstack->setIcon( QtxWorkstack::SplitVertical, + resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VSPLIT" ) ) ); + myWorkstack->setIcon( QtxWorkstack::SplitHorizontal, + resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HSPLIT" ) ) ); + myWorkstack->setIcon( QtxWorkstack::Close, + resMgr->loadPixmap( "STD", tr( "ICON_FILE_CLOSE" ) )); + } + connect( myWorkstack, SIGNAL( windowActivated( QWidget* ) ), this, SLOT( onWindowActivated( QWidget* ) ) ); createActions(); } -/*!Destructor.*/ +/*! + Destructor. +*/ STD_TabDesktop::~STD_TabDesktop() { } -/*!\retval SUIT_ViewWindow - return const active window.*/ +/*! + \retval SUIT_ViewWindow - return const active window. +*/ SUIT_ViewWindow* STD_TabDesktop::activeWindow() const { SUIT_ViewWindow* wnd = 0; @@ -80,7 +93,9 @@ SUIT_ViewWindow* STD_TabDesktop::activeWindow() const return wnd; } -/*!\retval QPtrList - return const active window list.*/ +/*! + \retval QPtrList - return const active window list. +*/ QList STD_TabDesktop::windows() const { QList winList; @@ -95,7 +110,9 @@ QList STD_TabDesktop::windows() const return winList; } -/*! insert new widget into desktop.*/ +/*! + Insert new widget into desktop. +*/ void STD_TabDesktop::addWindow( QWidget* w ) { if ( !w || !workstack() ) @@ -104,13 +121,17 @@ void STD_TabDesktop::addWindow( QWidget* w ) workstack()->addWindow( w ); } -/*!Call method perform for operation \a type.*/ +/*! + Call method perform for operation \a type. +*/ void STD_TabDesktop::windowOperation( const int type ) { -// myWorkstackAction->perform( operationFlag( type ) ); + myWorkstackAction->perform( operationFlag( type ) ); } -/*!Sets window operations by \a first ... parameters.*/ +/*! + Sets window operations by \a first ... parameters. +*/ void STD_TabDesktop::setWindowOperations( const int first, ... ) { va_list ints; @@ -128,7 +149,9 @@ void STD_TabDesktop::setWindowOperations( const int first, ... ) setWindowOperations( typeList ); } -/*!Sets window operations by variable \a opList - operation list.*/ +/*! + Sets window operations by variable \a opList - operation list. +*/ void STD_TabDesktop::setWindowOperations( const QList& opList ) { int flags = 0; @@ -139,23 +162,28 @@ void STD_TabDesktop::setWindowOperations( const QList& opList ) // myWorkstackAction->setItems( flags ); } -/*!\retval QtxWorkstack pointer - QT work stack.*/ +/*! + \retval QtxWorkstack pointer - Qt work stack. +*/ QtxWorkstack* STD_TabDesktop::workstack() const { return myWorkstack; } -/*!Emit window activated.*/ +/*! + Emit window activated. +*/ void STD_TabDesktop::onWindowActivated( QWidget* w ) { if ( w && w->inherits( "SUIT_ViewWindow" ) ) emit windowActivated( (SUIT_ViewWindow*)w ); } -/*!Create actions for window.*/ +/*! + Create actions for window. +*/ void STD_TabDesktop::createActions() { -/* if ( myWorkstackAction ) return; @@ -165,44 +193,46 @@ void STD_TabDesktop::createActions() myWorkstackAction = new QtxWorkstackAction( workstack(), this ); - myWorkstackAction->setItems( QtxWorkstackAction::Split | QtxWorkstackAction::Windows ); + myWorkstackAction->setMenuActions( QtxWorkstackAction::Split | QtxWorkstackAction::Windows ); // Split Horizontal - myWorkstackAction->setIconSet( QtxWorkstackAction::HSplit, - resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HSPLIT" ) ) ); - myWorkstackAction->setMenuText( QtxWorkstackAction::HSplit, tr( "MEN_DESK_WINDOW_HSPLIT" ) ); - myWorkstackAction->setStatusTip( QtxWorkstackAction::HSplit, tr( "PRP_DESK_WINDOW_HSPLIT" ) ); + myWorkstackAction->setIcon( QtxWorkstackAction::SplitHorizontal, + resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HSPLIT" ) ) ); + myWorkstackAction->setText( QtxWorkstackAction::SplitHorizontal, tr( "MEN_DESK_WINDOW_HSPLIT" ) ); + myWorkstackAction->setStatusTip( QtxWorkstackAction::SplitHorizontal, tr( "PRP_DESK_WINDOW_HSPLIT" ) ); + myWorkstackAction->setAccel( QtxWorkstackAction::SplitHorizontal, Qt::SHIFT + Qt::Key_H ); // Split Vertical - myWorkstackAction->setIconSet( QtxWorkstackAction::VSplit, - resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VSPLIT" ) ) ); - myWorkstackAction->setMenuText( QtxWorkstackAction::VSplit, tr( "MEN_DESK_WINDOW_VSPLIT" ) ); - myWorkstackAction->setStatusTip( QtxWorkstackAction::VSplit, tr( "PRP_DESK_WINDOW_VSPLIT" ) ); + myWorkstackAction->setIcon( QtxWorkstackAction::SplitVertical, + resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VSPLIT" ) ) ); + myWorkstackAction->setText( QtxWorkstackAction::SplitVertical, tr( "MEN_DESK_WINDOW_VSPLIT" ) ); + myWorkstackAction->setStatusTip( QtxWorkstackAction::SplitVertical, tr( "PRP_DESK_WINDOW_VSPLIT" ) ); + myWorkstackAction->setAccel( QtxWorkstackAction::SplitVertical, Qt::SHIFT + Qt::Key_V ); QtxActionMenuMgr* mMgr = menuMgr(); if ( !mMgr ) return; - int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId ); + int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 ); mMgr->insert( myWorkstackAction, winMenuId, -1 ); mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 ); -*/ } -/*!Convert STD_TabDesktop enumerations to QtxWorkstackAction*/ +/*! + Convert STD_TabDesktop enumerations to QtxWorkstackAction +*/ int STD_TabDesktop::operationFlag( const int type ) const { int res = 0; -/* switch ( type ) { - case VSplit: - res = QtxWorkstackAction::VSplit; + case SplitVertical: + res = QtxWorkstackAction::SplitVertical; break; - case HSplit: - res = QtxWorkstackAction::HSplit; + case SplitHorizontal: + res = QtxWorkstackAction::SplitHorizontal; break; } -*/ + return res; } diff --git a/src/STD/STD_TabDesktop.h b/src/STD/STD_TabDesktop.h index 1d5c2ecb8..35d09cd29 100644 --- a/src/STD/STD_TabDesktop.h +++ b/src/STD/STD_TabDesktop.h @@ -23,11 +23,8 @@ #include -class QtxAction; -class QPopupMenu; -class QWorkspace; class QtxWorkstack; -//class QtxWorkstackAction; +class QtxWorkstackAction; #if defined WIN32 #pragma warning( disable: 4251 ) @@ -38,8 +35,7 @@ class STD_EXPORT STD_TabDesktop: public SUIT_Desktop Q_OBJECT public: - enum { MenuWindowId = 6 }; - enum { VSplit, HSplit }; + enum { SplitVertical, SplitHorizontal }; public: STD_TabDesktop(); @@ -67,7 +63,7 @@ private: private: QtxWorkstack* myWorkstack; -// QtxWorkstackAction* myWorkstackAction; + QtxWorkstackAction* myWorkstackAction; }; #if defined WIN32 diff --git a/src/STD/resources/cascade.png b/src/STD/resources/cascade.png new file mode 100644 index 000000000..3111e55c2 Binary files /dev/null and b/src/STD/resources/cascade.png differ diff --git a/src/STD/resources/close.png b/src/STD/resources/close.png index b7126e002..4364ce7fe 100755 Binary files a/src/STD/resources/close.png and b/src/STD/resources/close.png differ diff --git a/src/STD/resources/copy.png b/src/STD/resources/copy.png index 1e43a09c2..a26b64198 100755 Binary files a/src/STD/resources/copy.png and b/src/STD/resources/copy.png differ diff --git a/src/STD/resources/cut.png b/src/STD/resources/cut.png index b35200830..055c27ea6 100755 Binary files a/src/STD/resources/cut.png and b/src/STD/resources/cut.png differ diff --git a/src/STD/resources/delete.png b/src/STD/resources/delete.png new file mode 100644 index 000000000..93d166354 Binary files /dev/null and b/src/STD/resources/delete.png differ diff --git a/src/STD/resources/help.png b/src/STD/resources/help.png index 452b45f62..c8dd11c14 100755 Binary files a/src/STD/resources/help.png and b/src/STD/resources/help.png differ diff --git a/src/STD/resources/htile.png b/src/STD/resources/htile.png new file mode 100644 index 000000000..42af00c0a Binary files /dev/null and b/src/STD/resources/htile.png differ diff --git a/src/STD/resources/new.png b/src/STD/resources/new.png index 953757a62..68555d221 100755 Binary files a/src/STD/resources/new.png and b/src/STD/resources/new.png differ diff --git a/src/STD/resources/open.png b/src/STD/resources/open.png index d9953b6a7..8ed143ebd 100755 Binary files a/src/STD/resources/open.png and b/src/STD/resources/open.png differ diff --git a/src/STD/resources/paste.png b/src/STD/resources/paste.png index c74462595..b2b5c95ac 100755 Binary files a/src/STD/resources/paste.png and b/src/STD/resources/paste.png differ diff --git a/src/STD/resources/print.png b/src/STD/resources/print.png index 37ca7c24d..69bae957d 100755 Binary files a/src/STD/resources/print.png and b/src/STD/resources/print.png differ diff --git a/src/STD/resources/redo.png b/src/STD/resources/redo.png index ac72e5c27..3753bb923 100755 Binary files a/src/STD/resources/redo.png and b/src/STD/resources/redo.png differ diff --git a/src/STD/resources/reset.png b/src/STD/resources/reset.png index ccda81cb1..761af7368 100755 Binary files a/src/STD/resources/reset.png and b/src/STD/resources/reset.png differ diff --git a/src/STD/resources/save.png b/src/STD/resources/save.png index 330493fa2..be10e0cf8 100755 Binary files a/src/STD/resources/save.png and b/src/STD/resources/save.png differ diff --git a/src/STD/resources/undo.png b/src/STD/resources/undo.png index 61b19777e..9b60fbd5d 100755 Binary files a/src/STD/resources/undo.png and b/src/STD/resources/undo.png differ diff --git a/src/STD/resources/vtile.png b/src/STD/resources/vtile.png new file mode 100644 index 000000000..9ad8814d7 Binary files /dev/null and b/src/STD/resources/vtile.png differ diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index 81bab394b..bbac91a30 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -32,6 +32,7 @@ #include #include +#include #ifdef SUIT_ENABLE_PYTHON #include #endif @@ -44,6 +45,10 @@ #include +#ifdef WIN32 +#include +#endif + static QString salomeVersion() { QString path( ::getenv( "GUI_ROOT_DIR" ) ); @@ -161,12 +166,13 @@ int main( int args, char* argv[] ) PySys_SetArgv( args, argv ); #endif - qInstallMsgHandler( MessageOutput ); + //qInstallMsgHandler( MessageOutput ); QStringList argList; bool noExceptHandling = false; bool iniFormat = false; bool noSplash = false; + bool useLicense = false; for ( int i = 1; i < args /*&& !noExceptHandling*/; i++ ) { if ( !strcmp( argv[i], "--noexcepthandling" ) ) @@ -175,23 +181,51 @@ int main( int args, char* argv[] ) iniFormat = true; else if ( !strcmp( argv[i], "--nosplash") ) noSplash = true; - else + else if ( !strcmp( argv[i], "--uselicense" ) ) + useLicense = true; + else argList.append( QString( argv[i] ) ); } SUITApp_Application app( args, argv ); int result = -1; + + if ( useLicense ) { + QString env; + +#ifdef WIN32 + DWORD aLen=1024; + char aStr[1024]; + HANDLE aToken=0; + HANDLE hProcess = GetCurrentProcess(); + OpenProcessToken(hProcess,TOKEN_QUERY,&aToken); + if( GetUserProfileDirectory( aToken, aStr, &aLen ) ) + env = aStr; + +#else + if ( ::getenv( "HOME" ) ) + env = ::getenv( "HOME" ); +#endif + + QFile file( env + "/ReadLicense.log" ); // Read the text from a file + if( !file.exists() ) { + SUIT_LicenseDlg aLicense; + if ( aLicense.exec() != QDialog::Accepted ) + return result; + } + } + if ( !argList.isEmpty() ) { SUITApp_Session* aSession = new SUITApp_Session( iniFormat ); QtxSplash* splash = 0; + SUIT_ResourceMgr* resMgr = aSession->createResourceMgr( argList.first() ); if ( !noSplash ) { - SUIT_ResourceMgr* resMgr = aSession->createResourceMgr( argList.first() ); if ( resMgr ) { - resMgr->loadLanguage(); + resMgr->loadLanguage( false ); splash = QtxSplash::splash( QPixmap() ); splash->readSettings( resMgr ); @@ -222,9 +256,12 @@ int main( int args, char* argv[] ) SUIT_Application* theApp = aSession->startApplication( argList.first() ); if ( theApp ) { - Style_Salome* aStyle = new Style_Salome(); - aStyle->getModel()->initFromResource( theApp->resourceMgr() ); - app.setStyle( aStyle ); + if ( resMgr && resMgr->booleanValue( "Style", "use_salome_style", true ) ) + { + Style_Salome* aStyle = new Style_Salome(); + aStyle->getModel()->initFromResource( theApp->resourceMgr() ); + app.setStyle( aStyle ); + } if ( !noExceptHandling ) app.setHandler( aSession->handler() ); diff --git a/src/SUITApp/SUITApp.pro b/src/SUITApp/SUITApp.pro index e5edddab5..def2d4011 100644 --- a/src/SUITApp/SUITApp.pro +++ b/src/SUITApp/SUITApp.pro @@ -18,6 +18,7 @@ CONFIG -= debug release debug_and_release CONFIG += qt thread debug dll shared win32:DEFINES += WNT WIN32 +DEFINES += DISABLE_TESTRECORDER HEADERS = *.h diff --git a/src/SUITApp/SUITApp_Application.cxx b/src/SUITApp/SUITApp_Application.cxx index 7027184df..df551d580 100644 --- a/src/SUITApp/SUITApp_Application.cxx +++ b/src/SUITApp/SUITApp_Application.cxx @@ -35,7 +35,11 @@ Constructor */ SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* hand ) -: QApplication( argc, argv ), +#ifndef DISABLE_TESTRECORDER + : TestApplication( argc, argv ), +#else + : QApplication( argc, argv ), +#endif myExceptHandler( hand ) { QString path = SUIT_Tools::dir( argv[0] ) + QDir::separator() + "../../resources"; @@ -52,7 +56,11 @@ myExceptHandler( hand ) Constructor */ SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand ) -: QApplication( argc, argv, type ), +#ifndef DISABLE_TESTRECORDER + : TestApplication( argc, argv ), +#else + : QApplication( argc, argv, type ), +#endif myExceptHandler( hand ) { QTranslator* strTbl = new QTranslator( 0 ); @@ -69,7 +77,11 @@ myExceptHandler( hand ) bool SUITApp_Application::notify( QObject* receiver, QEvent* e ) { return myExceptHandler ? myExceptHandler->handle( receiver, e ) : +#ifndef DISABLE_TESTRECORDER + TestApplication::notify( receiver, e ); +#else QApplication::notify( receiver, e ); +#endif } /*! diff --git a/src/SUITApp/SUITApp_Application.h b/src/SUITApp/SUITApp_Application.h index 808e464cc..bb27322b5 100644 --- a/src/SUITApp/SUITApp_Application.h +++ b/src/SUITApp/SUITApp_Application.h @@ -19,11 +19,19 @@ #ifndef SUITAPP_APPLICATION_H #define SUITAPP_APPLICATION_H -#include +#ifndef DISABLE_TESTRECORDER + #include +#else + #include +#endif class SUIT_ExceptionHandler; -class SUITApp_Application : public QApplication +#ifndef DISABLE_TESTRECORDER + class SUITApp_Application : public TestApplication +#else + class SUITApp_Application : public QApplication +#endif { Q_OBJECT diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 7f17c2708..678d9de95 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -509,7 +509,7 @@ SALOME_Actor if(myIsPreselected){ const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex(); int anExtent = aMapIndex.Extent(); - anIsChanged |= (anExtent == 0); + anIsChanged |= (anExtent == 0 || anExtent == 1); anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2))); if(anIsChanged){ TColStd_IndexedMapOfInteger aMapIndex; diff --git a/src/SVTK/SALOME_Actor.h b/src/SVTK/SALOME_Actor.h index db4e2e56e..ffa0bdca7 100644 --- a/src/SVTK/SALOME_Actor.h +++ b/src/SVTK/SALOME_Actor.h @@ -54,8 +54,12 @@ class SVTK_Actor; class SVTK_RectPicker; class SVTK_InteractorStyle; -extern int SALOME_POINT_SIZE; -extern int SALOME_LINE_WIDTH; +SVTK_EXPORT extern int SALOME_POINT_SIZE; +SVTK_EXPORT extern int SALOME_LINE_WIDTH; + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif #ifdef WIN32 #pragma warning ( disable:4251 ) diff --git a/src/SVTK/SVTK_CubeAxesDlg.cxx b/src/SVTK/SVTK_CubeAxesDlg.cxx index 1258e98ed..92c3f2847 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.cxx +++ b/src/SVTK/SVTK_CubeAxesDlg.cxx @@ -48,29 +48,60 @@ #include /*! - * Class : AxisWg - * Description : Tab of dialog - */ + \class SVTK_CubeAxesDlg::AxisWidget + \brief Axis tab widget of the "Graduated axis" dialog box + \internal +*/ + +class SVTK_CubeAxesDlg::AxisWidget : public QFrame +{ +public: + AxisWidget( QWidget* ); + ~AxisWidget(); + + void UseName( const bool ); + void SetName( const QString& ); + void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); + bool ReadData( vtkAxisActor2D* ); + bool Apply( vtkAxisActor2D* ); + +private: + // name + QGroupBox* myNameGrp; + QLineEdit* myAxisName; + SVTK_FontWidget* myNameFont; + + // labels + QGroupBox* myLabelsGrp; + QtxIntSpinBox* myLabelNumber; + QtxIntSpinBox* myLabelOffset; + SVTK_FontWidget* myLabelsFont; + + // tick marks + QGroupBox* myTicksGrp; + QtxIntSpinBox* myTickLength; + + friend class SVTK_CubeAxesDlg; +}; /*! Constructor */ -SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) +SVTK_CubeAxesDlg::AxisWidget::AxisWidget (QWidget* theParent) : QFrame(theParent) { QList< QLabel* > aLabels; // "Name" grp - myNameGrp = new QGroupBox(tr("AXIS_NAME"), this); + myNameGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("AXIS_NAME"), this); + myNameGrp->setCheckable( true ); + QVBoxLayout* aVBox = new QVBoxLayout; - myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp); - aVBox->addWidget(myIsNameVisible); - QHBoxLayout* aHBox = new QHBoxLayout; aHBox->setSpacing(5); - QLabel* aLabel = new QLabel(tr("NAME")); + QLabel* aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NAME")); aHBox->addWidget(aLabel); myAxisName = new QLineEdit; aHBox->addWidget(myAxisName); @@ -79,7 +110,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT")); aHBox->addWidget(aLabel); myNameFont = new SVTK_FontWidget(myNameGrp); aHBox->addWidget(myNameFont); @@ -90,35 +121,32 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) // "Labels" grp - myLabelsGrp = new QGroupBox(tr("LABELS"), this); - aVBox = new QVBoxLayout; + myLabelsGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("LABELS"), this); + myLabelsGrp->setCheckable( true ); - myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp); - aVBox->addWidget(myIsLabelsVisible); + aVBox = new QVBoxLayout; aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("NUMBER")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NUMBER")); aHBox->addWidget(aLabel); myLabelNumber = new QtxIntSpinBox(0,25,1,myLabelsGrp); - myLabelNumber->setObjectName("SpinBoxLabelNumber"); aHBox->addWidget(myLabelNumber); aLabels.append(aLabel); aVBox->addLayout(aHBox); aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("OFFSET")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("OFFSET")); aHBox->addWidget(aLabel); myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp); - myLabelOffset->setObjectName("SpinBoxLabellOffset"); aHBox->addWidget(myLabelOffset); aLabels.append(aLabel); aVBox->addLayout(aHBox); aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT")); aHBox->addWidget(aLabel); myLabelsFont = new SVTK_FontWidget(myLabelsGrp); aHBox->addWidget(myLabelsFont); @@ -129,18 +157,16 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) // "Tick marks" grp - myTicksGrp = new QGroupBox(tr("TICK_MARKS"), this); - aVBox = new QVBoxLayout; + myTicksGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("TICK_MARKS"), this); + myTicksGrp->setCheckable( true ); - myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp); - aVBox->addWidget(myIsTicksVisible); + aVBox = new QVBoxLayout; aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("LENGTH")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("LENGTH")); aHBox->addWidget(aLabel); myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp); - myTickLength->setObjectName("SpinBoxTickLength"); aHBox->addWidget(myTickLength); aLabels.append(aLabel); aVBox->addLayout(aHBox); @@ -150,17 +176,16 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) // Layout QVBoxLayout* aLay = new QVBoxLayout(this); - aLay->setMargin(0); + aLay->setMargin(5); aLay->setSpacing(5); aLay->addWidget(myNameGrp); aLay->addWidget(myLabelsGrp); aLay->addWidget(myTicksGrp); // init - myIsNameVisible->setChecked(true); - myIsLabelsVisible->setChecked(true); - myIsTicksVisible->setChecked(true); - updateControlState(); + myNameGrp->setChecked( true ); + myLabelsGrp->setChecked( true ); + myTicksGrp->setChecked( true ); // Adjust label widths QList< QLabel* >::iterator anIter; @@ -169,74 +194,35 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width()); for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) (*anIter)->setFixedWidth(aMaxWidth); - - // connect signals and slots - connect(myIsNameVisible, SIGNAL(stateChanged(int)), SLOT(onNameChecked())); - connect(myIsLabelsVisible, SIGNAL(stateChanged(int)), SLOT(onLabelsChecked())); - connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked())); } /*! Destructor */ -SVTK_AxisWidget::~SVTK_AxisWidget() -{ -} - -void SVTK_AxisWidget::updateControlState() +SVTK_CubeAxesDlg::AxisWidget::~AxisWidget() { - onNameChecked(); - onLabelsChecked(); - onTicksChecked(); } -void SVTK_AxisWidget::setEnabled(QGroupBox* theGrp, const bool theState) +void SVTK_CubeAxesDlg::AxisWidget::UseName(const bool toUse) { - QObjectList aChildren(theGrp->children()); - QObject* anObj; - for(int i = 0; i < aChildren.size(); i++) - { - anObj = aChildren.at(i); - if (anObj !=0 && anObj->inherits("QHBoxLayout")) - ((QHBoxLayout*)anObj)->setEnabled(theState); - } -} - -void SVTK_AxisWidget::onLabelsChecked() -{ - setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked()); -} - -void SVTK_AxisWidget::onTicksChecked() -{ - setEnabled(myTicksGrp, myIsTicksVisible->isChecked()); + myNameGrp->setChecked(toUse); } -void SVTK_AxisWidget::onNameChecked() -{ - setEnabled(myNameGrp, myIsNameVisible->isChecked()); -} - -void SVTK_AxisWidget::UseName(const bool toUse) -{ - myIsNameVisible->setChecked(toUse); -} - -void SVTK_AxisWidget::SetName(const QString& theName) +void SVTK_CubeAxesDlg::AxisWidget::SetName(const QString& theName) { myAxisName->setText(theName); } -void SVTK_AxisWidget::SetNameFont(const QColor& theColor, - const int theFont, - const bool theIsBold, - const bool theIsItalic, - const bool theIsShadow) +void SVTK_CubeAxesDlg::AxisWidget::SetNameFont(const QColor& theColor, + const int theFont, + const bool theIsBold, + const bool theIsItalic, + const bool theIsShadow) { myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow); } -bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) +bool SVTK_CubeAxesDlg::AxisWidget::ReadData(vtkAxisActor2D* theActor) { if (theActor == 0) return false; @@ -264,7 +250,7 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) isTitleShadow = aTitleProp->GetShadow() ? true : false; } - myIsNameVisible->setChecked(useName); + myNameGrp->setChecked(useName); myAxisName->setText(aTitle); myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow); @@ -292,7 +278,7 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) isLabelsShadow = aLabelsProp->GetShadow() ? true : false; } - myIsLabelsVisible->setChecked(useLabels); + myLabelsGrp->setChecked(useLabels); myLabelNumber->setValue(nbLabels); myLabelOffset->setValue(anOffset); myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow); @@ -301,20 +287,20 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) bool useTickMarks = theActor->GetTickVisibility(); int aTickLength = theActor->GetTickLength(); - myIsTicksVisible->setChecked(useTickMarks); + myTicksGrp->setChecked(useTickMarks); myTickLength->setValue(aTickLength); return true; } -bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) +bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor) { if (theActor == 0) return false; // Name - theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0); + theActor->SetTitleVisibility(myNameGrp->isChecked() ? 1 : 0); theActor->SetTitle(myAxisName->text().toLatin1()); QColor aTitleColor(255, 255, 255); @@ -341,7 +327,7 @@ bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) // Labels - theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0); + theActor->SetLabelVisibility(myLabelsGrp->isChecked() ? 1 : 0); int nbLabels = myLabelNumber->value(); theActor->SetNumberOfLabels(nbLabels); @@ -374,7 +360,7 @@ bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) // Tick marks - theActor->SetTickVisibility(myIsTicksVisible->isChecked()); + theActor->SetTickVisibility(myTicksGrp->isChecked()); int aTickLength = myTickLength->value(); theActor->SetTickLength(aTickLength); @@ -418,16 +404,14 @@ QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent) myTabWg = new QTabWidget(aFrame); - myAxes[ 0 ] = new SVTK_AxisWidget(myTabWg); - myAxes[ 1 ] = new SVTK_AxisWidget(myTabWg); - myAxes[ 2 ] = new SVTK_AxisWidget(myTabWg); + myAxes[ 0 ] = new AxisWidget(myTabWg); + myAxes[ 1 ] = new AxisWidget(myTabWg); + myAxes[ 2 ] = new AxisWidget(myTabWg); myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS")); myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS")); myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS")); - myTabWg->setContentsMargins(5,5,5,5); - myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame); QVBoxLayout* aLay = new QVBoxLayout(aFrame); diff --git a/src/SVTK/SVTK_CubeAxesDlg.h b/src/SVTK/SVTK_CubeAxesDlg.h index f573f94b1..d4f90568a 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.h +++ b/src/SVTK/SVTK_CubeAxesDlg.h @@ -27,36 +27,27 @@ #ifndef SVTK_CubeAxesDlg_H #define SVTK_CubeAxesDlg_H -#include "SVTK.h" #include "SVTK_DialogBase.h" -#include - class QWidget; class QPushButton; class QTabWidget; class QCheckBox; -class QLineEdit; -class QGroupBox; class QtxAction; -class QtxIntSpinBox; - -class vtkAxisActor2D; class SVTK_CubeAxesActor2D; - -class SVTK_FontWidget; -class SVTK_AxisWidget; class SVTK_MainWindow; /*! * Class : SVTK_CubeAxesDlg * Description : Dialog for specifynig cube axes properties */ -class SVTK_EXPORT SVTK_CubeAxesDlg : public SVTK_DialogBase +class SVTK_CubeAxesDlg : public SVTK_DialogBase { Q_OBJECT + class AxisWidget; + public: SVTK_CubeAxesDlg(QtxAction* theAction, SVTK_MainWindow* theParent, @@ -85,56 +76,7 @@ private: QPushButton* myOkBtn; QPushButton* myApplyBtn; QPushButton* myCloseBtn; - SVTK_AxisWidget* myAxes[ 3 ]; -}; - -/*! - * Class : SVTK_AxisWidget - * Description : Tab of dialog - */ -class SVTK_EXPORT SVTK_AxisWidget : public QFrame -{ - Q_OBJECT - -public: - SVTK_AxisWidget( QWidget* ); - ~SVTK_AxisWidget(); - - void UseName( const bool ); - void SetName( const QString& ); - void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); - bool ReadData( vtkAxisActor2D* ); - bool Apply( vtkAxisActor2D* ); - -private slots: - void onNameChecked(); - void onLabelsChecked(); - void onTicksChecked(); - -private: - void updateControlState(); - void setEnabled( QGroupBox*, const bool ); - -private: - // name - QGroupBox* myNameGrp; - QCheckBox* myIsNameVisible; - QLineEdit* myAxisName; - SVTK_FontWidget* myNameFont; - - // labels - QGroupBox* myLabelsGrp; - QCheckBox* myIsLabelsVisible; - QtxIntSpinBox* myLabelNumber; - QtxIntSpinBox* myLabelOffset; - SVTK_FontWidget* myLabelsFont; - - // tick marks - QGroupBox* myTicksGrp; - QCheckBox* myIsTicksVisible; - QtxIntSpinBox* myTickLength; - - friend class SVTK_CubeAxesDlg; + AxisWidget* myAxes[ 3 ]; }; #endif diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx index 3dffbae50..fa4943202 100644 --- a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx @@ -134,7 +134,7 @@ SVTK_Selector* SVTK_GenericRenderWindowInteractor ::GetSelector() { - return mySelector.GetPointer(); + return mySelector; } /*! diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.h b/src/SVTK/SVTK_GenericRenderWindowInteractor.h index 9bb7cbfcd..06c0241e8 100644 --- a/src/SVTK/SVTK_GenericRenderWindowInteractor.h +++ b/src/SVTK/SVTK_GenericRenderWindowInteractor.h @@ -122,7 +122,7 @@ class SVTK_EXPORT SVTK_GenericRenderWindowInteractor: public QVTK_GenericRenderW SVTK_GenericRenderWindowInteractor(); ~SVTK_GenericRenderWindowInteractor(); - vtkSmartPointer mySelector; //!< Keeps a pointer to SVTK_Selector + SVTK_Selector* mySelector; //!< Keeps a pointer to SVTK_Selector QWidget* myRenderWidget; //!< Keeps a pointer to QWidget, where vtkRenderWindow maps to. }; diff --git a/src/SVTK/SVTK_InteractorStyle.h b/src/SVTK/SVTK_InteractorStyle.h index 60dbf4fe6..b02941bfb 100644 --- a/src/SVTK/SVTK_InteractorStyle.h +++ b/src/SVTK/SVTK_InteractorStyle.h @@ -102,7 +102,6 @@ class SVTK_EXPORT SVTK_ControllerOnKeyDown : public vtkObject{ void operator=(const SVTK_ControllerOnKeyDown&); //Not implemented }; -class vtkPicker; class vtkPointPicker; class SALOME_Actor; @@ -334,8 +333,6 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle PSelectionEvent mySelectionEvent; - vtkSmartPointer myPicker; - unsigned long myCurrRotationPointType; unsigned long myPrevRotationPointType; diff --git a/src/SVTK/resources/vtk_view_graduated_axes.png b/src/SVTK/resources/vtk_view_graduated_axes.png new file mode 100755 index 000000000..2b44c06fe Binary files /dev/null and b/src/SVTK/resources/vtk_view_graduated_axes.png differ diff --git a/src/SVTK/resources/vtk_view_rotation_point.png b/src/SVTK/resources/vtk_view_rotation_point.png new file mode 100755 index 000000000..fc303e3ea Binary files /dev/null and b/src/SVTK/resources/vtk_view_rotation_point.png differ diff --git a/src/SVTK/resources/vtk_view_scaling.png b/src/SVTK/resources/vtk_view_scaling.png new file mode 100644 index 000000000..fa8cbbc71 Binary files /dev/null and b/src/SVTK/resources/vtk_view_scaling.png differ diff --git a/src/SVTK/resources/vtk_view_update_rate.png b/src/SVTK/resources/vtk_view_update_rate.png new file mode 100755 index 000000000..3d01ad184 Binary files /dev/null and b/src/SVTK/resources/vtk_view_update_rate.png differ diff --git a/src/Style/images/critical.png b/src/Style/images/critical.png new file mode 100644 index 000000000..3cf8e5b53 Binary files /dev/null and b/src/Style/images/critical.png differ diff --git a/src/Style/images/information.png b/src/Style/images/information.png new file mode 100644 index 000000000..3cd976403 Binary files /dev/null and b/src/Style/images/information.png differ diff --git a/src/Style/images/question.png b/src/Style/images/question.png new file mode 100644 index 000000000..b42fc1c7f Binary files /dev/null and b/src/Style/images/question.png differ diff --git a/src/Style/images/warning.png b/src/Style/images/warning.png new file mode 100644 index 000000000..471ec5888 Binary files /dev/null and b/src/Style/images/warning.png differ diff --git a/src/VTKViewer/VTKViewer_ConvexTool.cxx b/src/VTKViewer/VTKViewer_ConvexTool.cxx index 9dfa3b47f..0689ab67a 100644 --- a/src/VTKViewer/VTKViewer_ConvexTool.cxx +++ b/src/VTKViewer/VTKViewer_ConvexTool.cxx @@ -47,6 +47,9 @@ #include #include #include +#include +#include +#include #ifdef _DEBUG_ static int DEBUG_TRIA_EXECUTE = 0; @@ -81,31 +84,117 @@ namespace typedef std::vector TPolygons; } -/*! - Constructor -*/ + +//---------------------------------------------------------------------------- VTKViewer_Triangulator ::VTKViewer_Triangulator(): - myInput(NULL), - myCellId(-1), - myShowInside(-1), - myAllVisible(-1), - myCellsVisibility(NULL), - myCellIds(vtkIdList::New()) + myCellIds(vtkIdList::New()), + myFaceIds(vtkIdList::New()), + myPoints(vtkPoints::New()), + myPointIds(NULL) {} -/*! - Destructor -*/ +//---------------------------------------------------------------------------- VTKViewer_Triangulator ::~VTKViewer_Triangulator() { myCellIds->Delete(); + myFaceIds->Delete(); + myPoints->Delete(); +} + + +//---------------------------------------------------------------------------- +vtkPoints* +VTKViewer_Triangulator +::InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId) +{ + myPoints->Reset(); + myPoints->Modified(); // the VTK bug + + vtkIdType aNumPts; + theInput->GetCellPoints(theCellId, aNumPts, myPointIds); + if ( aNumPts > 0 ) { + vtkFloatingPointType anAbsoluteCoord[3]; + myPoints->SetNumberOfPoints(aNumPts); + vtkPoints *anInputPoints = theInput->GetPoints(); + for (int aPntId = 0; aPntId < aNumPts; aPntId++) { + anInputPoints->GetPoint(myPointIds[aPntId], anAbsoluteCoord); + myPoints->SetPoint(aPntId, anAbsoluteCoord); + } + } + + return myPoints; +} + + +//---------------------------------------------------------------------------- +vtkIdType +VTKViewer_Triangulator +::GetNbOfPoints() +{ + return myPoints->GetNumberOfPoints(); } +//---------------------------------------------------------------------------- +vtkIdType +VTKViewer_Triangulator +::GetPointId(vtkIdType thePointId) +{ + return thePointId; +} + +//---------------------------------------------------------------------------- +vtkFloatingPointType +VTKViewer_Triangulator +::GetCellLength() +{ + vtkFloatingPointType aBounds[6]; + myPoints->GetBounds(aBounds); + + vtkFloatingPointType aCoordDiff[3]; + aCoordDiff[0] = (aBounds[1] - aBounds[0]); + aCoordDiff[1] = (aBounds[3] - aBounds[2]); + aCoordDiff[2] = (aBounds[5] - aBounds[4]); + + return sqrt(aCoordDiff[0]*aCoordDiff[0] + + aCoordDiff[1]*aCoordDiff[1] + + aCoordDiff[2]*aCoordDiff[2]); +} + + +//---------------------------------------------------------------------------- +void +VTKViewer_Triangulator +::GetCellNeighbors(vtkUnstructuredGrid *theInput, + vtkIdType theCellId, + vtkCell* theFace, + vtkIdList* theCellIds) +{ + myFaceIds->Reset(); + vtkIdList *anIdList = theFace->PointIds; + myFaceIds->InsertNextId(myPointIds[anIdList->GetId(0)]); + myFaceIds->InsertNextId(myPointIds[anIdList->GetId(1)]); + myFaceIds->InsertNextId(myPointIds[anIdList->GetId(2)]); + + theInput->GetCellNeighbors(theCellId, myFaceIds, theCellIds); +} + + +//---------------------------------------------------------------------------- +vtkIdType +VTKViewer_Triangulator +::GetConnectivity(vtkIdType thePntId) +{ + return myPointIds[thePntId]; +} + + +//---------------------------------------------------------------------------- bool VTKViewer_Triangulator ::Execute(vtkUnstructuredGrid *theInput, @@ -120,13 +209,7 @@ VTKViewer_Triangulator std::vector& theVTK2ObjIds, bool theIsCheckConvex) { - myInput = theInput; - myCellId = theCellId; - myShowInside = theShowInside; - myAllVisible = theAllVisible; - myCellsVisibility = theCellsVisibility; - - vtkPoints *aPoints = InitPoints(); + vtkPoints *aPoints = InitPoints(theInput, theCellId); vtkIdType aNumPts = GetNbOfPoints(); if(DEBUG_TRIA_EXECUTE) cout<<"Triangulator - aNumPts = "< TPointIds; @@ -172,9 +255,9 @@ VTKViewer_Triangulator for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) { vtkCell* aFace = GetFace(aFaceId); - GetCellNeighbors(theCellId, aFace, myCellIds); - if((!myAllVisible && !myCellsVisibility[myCellIds->GetId(0)]) || - myCellIds->GetNumberOfIds() <= 0 || myShowInside) + GetCellNeighbors(theInput, theCellId, aFace, myCellIds); + if((!theAllVisible && !theCellsVisibility[myCellIds->GetId(0)]) || + myCellIds->GetNumberOfIds() <= 0 || theShowInside) { TPointIds aPointIds; vtkIdList *anIdList = aFace->PointIds; @@ -320,9 +403,9 @@ VTKViewer_Triangulator aCenter[0] += aPntCoord[0]; aCenter[1] += aPntCoord[1]; aCenter[2] += aPntCoord[2]; - if(DEBUG_TRIA_EXECUTE) cout << "Added = TRUE" << endl; + if(DEBUG_TRIA_EXECUTE) cout << "; Added = TRUE" << endl; } else { - if(DEBUG_TRIA_EXECUTE) cout << "Added = FALSE" << endl; + if(DEBUG_TRIA_EXECUTE) cout << "; Added = FALSE" << endl; } } int aNbPoints = aPointIds.size(); @@ -512,171 +595,144 @@ VTKViewer_Triangulator return true; } -/*! - Constructor -*/ + +//---------------------------------------------------------------------------- VTKViewer_OrderedTriangulator ::VTKViewer_OrderedTriangulator(): - myCell(vtkGenericCell::New()) -{} + myTriangulator(vtkOrderedTriangulator::New()), + myBoundaryTris(vtkCellArray::New()), + myTriangle(vtkTriangle::New()) +{ + myBoundaryTris->Allocate(VTK_CELL_SIZE); + myTriangulator->PreSortedOff(); +} -/*! - Destructor -*/ + +//---------------------------------------------------------------------------- VTKViewer_OrderedTriangulator ::~VTKViewer_OrderedTriangulator() { - myCell->Delete(); + myTriangle->Delete(); + myBoundaryTris->Delete(); + myTriangulator->Delete(); } + +//---------------------------------------------------------------------------- vtkPoints* VTKViewer_OrderedTriangulator -::InitPoints() +::InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId) { - myInput->GetCell(myCellId,myCell); - return myInput->GetPoints(); -} + myBoundaryTris->Reset(); -vtkIdType -VTKViewer_OrderedTriangulator -::GetNbOfPoints() -{ - return myCell->GetNumberOfPoints(); -} + vtkPoints* aPoints = VTKViewer_Triangulator::InitPoints(theInput, theCellId); + vtkIdType aNumPts = myPoints->GetNumberOfPoints(); + if ( aNumPts > 0 ) { + myTriangulator->InitTriangulation(0.0, 1.0, 0.0, 1.0, 0.0, 1.0, aNumPts); -vtkIdType -VTKViewer_OrderedTriangulator -::GetPointId(vtkIdType thePointId) -{ - return myCell->GetPointId(thePointId); -} + vtkFloatingPointType aBounds[6]; + myPoints->GetBounds(aBounds); -vtkFloatingPointType -VTKViewer_OrderedTriangulator -::GetCellLength() -{ - return sqrt(myCell->GetLength2()); + vtkFloatingPointType anAbsoluteCoord[3]; + vtkFloatingPointType aParamentrucCoord[3]; + for (int aPntId = 0; aPntId < aNumPts; aPntId++) { + myPoints->GetPoint(aPntId, anAbsoluteCoord); + aParamentrucCoord[0] = (anAbsoluteCoord[0] - aBounds[0]) / (aBounds[1] - aBounds[0]); + aParamentrucCoord[1] = (anAbsoluteCoord[1] - aBounds[2]) / (aBounds[3] - aBounds[2]); + aParamentrucCoord[2] = (anAbsoluteCoord[2] - aBounds[4]) / (aBounds[5] - aBounds[4]); + myTriangulator->InsertPoint(aPntId, anAbsoluteCoord, aParamentrucCoord, 0); + } + + myTriangulator->Triangulate(); + myTriangulator->AddTriangles(myBoundaryTris); + } + + return aPoints; } + +//---------------------------------------------------------------------------- vtkIdType VTKViewer_OrderedTriangulator ::GetNumFaces() { - return myCell->GetNumberOfFaces(); + return myBoundaryTris->GetNumberOfCells(); } + +//---------------------------------------------------------------------------- vtkCell* VTKViewer_OrderedTriangulator ::GetFace(vtkIdType theFaceId) { - return myCell->GetFace(theFaceId); -} + vtkIdType aNumCells = myBoundaryTris->GetNumberOfCells(); + if ( theFaceId < 0 || theFaceId >= aNumCells ) + return NULL; -void -VTKViewer_OrderedTriangulator -::GetCellNeighbors(vtkIdType theCellId, - vtkCell* theFace, - vtkIdList* theCellIds) -{ - vtkIdList *anIdList = theFace->PointIds; - myInput->GetCellNeighbors(theCellId, anIdList, theCellIds); -} + vtkIdType *aCells = myBoundaryTris->GetPointer(); -vtkIdType -VTKViewer_OrderedTriangulator -::GetConnectivity(vtkIdType thePntId) -{ - return thePntId; + // Each triangle has three points plus number of points + vtkIdType *aCellPtr = aCells + 4*theFaceId; + + myTriangle->PointIds->SetId(0, aCellPtr[1]); + myTriangle->Points->SetPoint(0, myPoints->GetPoint(aCellPtr[1])); + + myTriangle->PointIds->SetId(1, aCellPtr[2]); + myTriangle->Points->SetPoint(1, myPoints->GetPoint(aCellPtr[2])); + + myTriangle->PointIds->SetId(2, aCellPtr[3]); + myTriangle->Points->SetPoint(2, myPoints->GetPoint(aCellPtr[3])); + + return myTriangle; } -/*! - Constructor -*/ + +//---------------------------------------------------------------------------- VTKViewer_DelaunayTriangulator ::VTKViewer_DelaunayTriangulator(): myUnstructuredGrid(vtkUnstructuredGrid::New()), myGeometryFilter(vtkGeometryFilter::New()), myDelaunay3D(vtkDelaunay3D::New()), - myFaceIds(vtkIdList::New()), - myPoints(vtkPoints::New()), - myPolyData(NULL), - myPointIds(NULL) + myPolyData(NULL) { + myUnstructuredGrid->Initialize(); + myUnstructuredGrid->Allocate(); + myUnstructuredGrid->SetPoints(myPoints); + myDelaunay3D->SetInput(myUnstructuredGrid); myGeometryFilter->SetInput(myDelaunay3D->GetOutput()); + myPolyData = myGeometryFilter->GetOutput(); } - -/*! - Destructor -*/ +//---------------------------------------------------------------------------- VTKViewer_DelaunayTriangulator ::~VTKViewer_DelaunayTriangulator() { myUnstructuredGrid->Delete(); myGeometryFilter->Delete(); myDelaunay3D->Delete(); - myFaceIds->Delete(); - myPoints->Delete(); } +//---------------------------------------------------------------------------- vtkPoints* VTKViewer_DelaunayTriangulator -::InitPoints() +::InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId) { - myPoints->Reset(); - myUnstructuredGrid->Initialize(); - myUnstructuredGrid->Allocate(); - myUnstructuredGrid->SetPoints(myPoints); - - vtkIdType aNumPts; - myInput->GetCellPoints(myCellId,aNumPts,myPointIds); - - if ( aNumPts < myPoints->GetNumberOfPoints() ) - myPoints->Reset(); - - { - vtkFloatingPointType aPntCoord[3]; - myPoints->SetNumberOfPoints(aNumPts); - vtkPoints *anInputPoints = myInput->GetPoints(); - for (int aPntId = 0; aPntId < aNumPts; aPntId++) { - anInputPoints->GetPoint(myPointIds[aPntId],aPntCoord); - myPoints->SetPoint(aPntId,aPntCoord); - } - } + vtkPoints* aPoints = VTKViewer_Triangulator::InitPoints(theInput, theCellId); myPoints->Modified(); myUnstructuredGrid->Modified(); - myGeometryFilter->Update(); - myPolyData = myGeometryFilter->GetOutput(); - return myPoints; -} - -vtkIdType -VTKViewer_DelaunayTriangulator -::GetNbOfPoints() -{ - return myPoints->GetNumberOfPoints(); + return aPoints; } -vtkIdType -VTKViewer_DelaunayTriangulator -::GetPointId(vtkIdType thePointId) -{ - return thePointId; -} - -vtkFloatingPointType -VTKViewer_DelaunayTriangulator -::GetCellLength() -{ - return myPolyData->GetLength(); -} +//---------------------------------------------------------------------------- vtkIdType VTKViewer_DelaunayTriangulator ::GetNumFaces() @@ -684,32 +740,11 @@ VTKViewer_DelaunayTriangulator return myPolyData->GetNumberOfCells(); } + +//---------------------------------------------------------------------------- vtkCell* VTKViewer_DelaunayTriangulator ::GetFace(vtkIdType theFaceId) { return myPolyData->GetCell(theFaceId); } - -void -VTKViewer_DelaunayTriangulator -::GetCellNeighbors(vtkIdType theCellId, - vtkCell* theFace, - vtkIdList* theCellIds) -{ - myFaceIds->Reset(); - vtkIdList *anIdList = theFace->PointIds; - myFaceIds->InsertNextId(myPointIds[anIdList->GetId(0)]); - myFaceIds->InsertNextId(myPointIds[anIdList->GetId(1)]); - myFaceIds->InsertNextId(myPointIds[anIdList->GetId(2)]); - - myInput->GetCellNeighbors(theCellId, myFaceIds, theCellIds); -} - - -vtkIdType -VTKViewer_DelaunayTriangulator -::GetConnectivity(vtkIdType thePntId) -{ - return myPointIds[thePntId]; -} diff --git a/src/VTKViewer/VTKViewer_ConvexTool.h b/src/VTKViewer/VTKViewer_ConvexTool.h index 2bf024d5e..5e391d976 100644 --- a/src/VTKViewer/VTKViewer_ConvexTool.h +++ b/src/VTKViewer/VTKViewer_ConvexTool.h @@ -36,7 +36,12 @@ class vtkCellData; class vtkPoints; class vtkIdList; class vtkCell; +class vtkCellArray; +class vtkTriangle; +class vtkOrderedTriangulator; + +//---------------------------------------------------------------------------- class VTKVIEWER_EXPORT VTKViewer_Triangulator { public: @@ -57,51 +62,48 @@ class VTKVIEWER_EXPORT VTKViewer_Triangulator std::vector& theVTK2ObjIds, bool theIsCheckConvex); - protected: + private: vtkIdList* myCellIds; - vtkUnstructuredGrid *myInput; - vtkIdType myCellId; - int myShowInside; - int myAllVisible; - const char* myCellsVisibility; + protected: + vtkIdType *myPointIds; + vtkIdList* myFaceIds; + vtkPoints* myPoints; virtual vtkPoints* - InitPoints() = 0; + InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId); virtual vtkIdType - GetNbOfPoints() = 0; + GetNumFaces() = 0; virtual - vtkIdType - GetPointId(vtkIdType thePointId) = 0; + vtkCell* + GetFace(vtkIdType theFaceId) = 0; - virtual - vtkFloatingPointType - GetCellLength() = 0; + vtkIdType + GetNbOfPoints(); - virtual vtkIdType - GetNumFaces() = 0; + GetPointId(vtkIdType thePointId); - virtual - vtkCell* - GetFace(vtkIdType theFaceId) = 0; + vtkFloatingPointType + GetCellLength(); - virtual void - GetCellNeighbors(vtkIdType theCellId, + GetCellNeighbors(vtkUnstructuredGrid *theInput, + vtkIdType theCellId, vtkCell* theFace, - vtkIdList* theCellIds) = 0; + vtkIdList* theCellIds); - virtual vtkIdType - GetConnectivity(vtkIdType thePntId) = 0; + GetConnectivity(vtkIdType thePntId); }; +//---------------------------------------------------------------------------- class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangulator { public: @@ -111,22 +113,14 @@ class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangul ~VTKViewer_OrderedTriangulator(); protected: - vtkGenericCell *myCell; + vtkOrderedTriangulator *myTriangulator; + vtkCellArray *myBoundaryTris; + vtkTriangle *myTriangle; virtual vtkPoints* - InitPoints(); - - virtual - vtkIdType - GetNbOfPoints(); - - vtkIdType - GetPointId(vtkIdType thePointId); - - virtual - vtkFloatingPointType - GetCellLength(); + InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId); virtual vtkIdType @@ -135,19 +129,10 @@ class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangul virtual vtkCell* GetFace(vtkIdType theFaceId); - - virtual - void - GetCellNeighbors(vtkIdType theCellId, - vtkCell* theFace, - vtkIdList* theCellIds); - - virtual - vtkIdType - GetConnectivity(vtkIdType thePntId); }; +//---------------------------------------------------------------------------- class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangulator { public: @@ -161,24 +146,11 @@ class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangu vtkGeometryFilter* myGeometryFilter; vtkDelaunay3D* myDelaunay3D; vtkPolyData* myPolyData; - vtkIdType *myPointIds; - vtkIdList* myFaceIds; - vtkPoints* myPoints; virtual vtkPoints* - InitPoints(); - - virtual - vtkIdType - GetNbOfPoints(); - - vtkIdType - GetPointId(vtkIdType thePointId); - - virtual - vtkFloatingPointType - GetCellLength(); + InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId); virtual vtkIdType @@ -187,16 +159,6 @@ class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangu virtual vtkCell* GetFace(vtkIdType theFaceId); - - virtual - void - GetCellNeighbors(vtkIdType theCellId, - vtkCell* theFace, - vtkIdList* theCellIds); - - virtual - vtkIdType - GetConnectivity(vtkIdType thePntId); }; diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx index 50cade3f1..3d6182e96 100755 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -474,6 +474,7 @@ VTKViewer_GeometryFilter case VTK_QUADRATIC_QUAD: case VTK_QUADRATIC_TETRA: case VTK_QUADRATIC_HEXAHEDRON: + case VTK_QUADRATIC_WEDGE: if(!myIsWireframeMode){ input->GetCell(cellId,cell); vtkIdList *pts = vtkIdList::New(); @@ -650,6 +651,82 @@ VTKViewer_GeometryFilter break; } + case VTK_QUADRATIC_WEDGE: { + aCellType = VTK_POLYGON; + numFacePts = 6; + //--------------------------------------------------------------- + //Face 1 + aNewPts[0] = pts[0]; + aNewPts[1] = pts[6]; + aNewPts[2] = pts[1]; + aNewPts[3] = pts[7]; + aNewPts[4] = pts[2]; + aNewPts[5] = pts[8]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + //Face 2 + aNewPts[0] = pts[3]; + aNewPts[1] = pts[9]; + aNewPts[2] = pts[4]; + aNewPts[3] = pts[10]; + aNewPts[4] = pts[5]; + aNewPts[5] = pts[11]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + //Face 3 + numFacePts = 8; + aNewPts[0] = pts[0]; + aNewPts[1] = pts[8]; + aNewPts[2] = pts[2]; + aNewPts[3] = pts[14]; + aNewPts[4] = pts[5]; + aNewPts[5] = pts[11]; + aNewPts[6] = pts[3]; + aNewPts[7] = pts[12]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + //Face 4 + aNewPts[0] = pts[1]; + aNewPts[1] = pts[13]; + aNewPts[2] = pts[4]; + aNewPts[3] = pts[10]; + aNewPts[4] = pts[5]; + aNewPts[5] = pts[14]; + aNewPts[6] = pts[2]; + aNewPts[7] = pts[7]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + //Face 5 + aNewPts[0] = pts[0]; + aNewPts[1] = pts[12]; + aNewPts[2] = pts[3]; + aNewPts[3] = pts[9]; + aNewPts[4] = pts[4]; + aNewPts[5] = pts[13]; + aNewPts[6] = pts[1]; + aNewPts[7] = pts[6]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + break; + } case VTK_QUADRATIC_HEXAHEDRON: { aCellType = VTK_POLYGON; numFacePts = 8; @@ -771,6 +848,8 @@ VTKViewer_GeometryFilter { delete [] cellVis; } + + return 1; } diff --git a/src/VTKViewer/VTKViewer_Trihedron.cxx b/src/VTKViewer/VTKViewer_Trihedron.cxx index f50d67b30..7781f1b57 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.cxx +++ b/src/VTKViewer/VTKViewer_Trihedron.cxx @@ -80,8 +80,12 @@ void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer) vtkFloatingPointType aLength = aDataSet->GetLength(); vtkFloatingPointType aPrecision = 1.0E-3; vtkFloatingPointType anOldScale = GetScale()[0]; - vtkFloatingPointType aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1])); - if(fabs(aScale - anOldScale)/aScale > aPrecision){ + vtkFloatingPointType aScale; + if (aSize[1] > aSize[0]) + aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1])); + else + aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[1])/vtkFloatingPointType(aSize[0])); + if(aScale != 0.0&& fabs(aScale - anOldScale)/aScale > aPrecision){ SetScale(aScale); } } diff --git a/src/VTKViewer/VTKViewer_ViewManager.cxx b/src/VTKViewer/VTKViewer_ViewManager.cxx index 0e3f32bb7..a206be6ee 100755 --- a/src/VTKViewer/VTKViewer_ViewManager.cxx +++ b/src/VTKViewer/VTKViewer_ViewManager.cxx @@ -19,9 +19,6 @@ #include "VTKViewer_ViewManager.h" #include "VTKViewer_ViewModel.h" -#include -#include - /*!Constructor.Initialize SIUT_ViewManager by \a study and \a theDesktop. * Create new instance of VTKViewer_Viewer and set view model by it. */ @@ -36,37 +33,3 @@ VTKViewer_ViewManager::~VTKViewer_ViewManager() { /*!Do nothing.*/ } - -/*! - Fills preference manager for viewer -*/ -int VTKViewer_ViewManager::fillPreferences( SUIT_PreferenceMgr* thePrefMgr, const int theId ) -{ - int aGrpId = thePrefMgr->addItem( tr( "PREF_GROUP_VTKVIEWER" ), theId, - SUIT_PreferenceMgr::GroupBox ); - - int vtkTS = thePrefMgr->addItem( tr( "PREF_TRIHEDRON_SIZE" ), aGrpId, - SUIT_PreferenceMgr::DblSpin, "VTKViewer", "trihedron_size" ); - thePrefMgr->addItem( tr( "PREF_RELATIVE_SIZE" ), aGrpId, SUIT_PreferenceMgr::Bool, - "VTKViewer", "relative_size" ); - thePrefMgr->addItem( tr( "PREF_VIEWER_BACKGROUND" ), aGrpId, - SUIT_PreferenceMgr::Color, "VTKViewer", "background" ); - - thePrefMgr->setItemProperty( "min", 1.0E-06, vtkTS ); - thePrefMgr->setItemProperty( "max", 150, vtkTS ); - - return aGrpId; -} - -/** - * Fills values from resources - */ -void VTKViewer_ViewManager::fillFrom( SUIT_ResourceMgr* theMgr ) -{ - VTKViewer_Viewer* aModel = dynamic_cast( getViewModel() ); - if ( !aModel ) - return; - - aModel->setBackgroundColor( theMgr->colorValue( "VTKViewer", "background", - aModel->backgroundColor() ) ); -} diff --git a/src/VTKViewer/VTKViewer_ViewManager.h b/src/VTKViewer/VTKViewer_ViewManager.h index c8e200817..debd7987e 100755 --- a/src/VTKViewer/VTKViewer_ViewManager.h +++ b/src/VTKViewer/VTKViewer_ViewManager.h @@ -35,9 +35,6 @@ class VTKVIEWER_EXPORT VTKViewer_ViewManager : public SUIT_ViewManager public: VTKViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* ); virtual ~VTKViewer_ViewManager(); - - static int fillPreferences( SUIT_PreferenceMgr*, const int ); - void fillFrom( SUIT_ResourceMgr* ); }; #endif diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx index ead79fd57..6f462e3e2 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.cxx +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -456,8 +456,8 @@ void VTKViewer_ViewWindow::onAdjustTrihedron(){ (bnd[5]-bnd[4])*(bnd[5]-bnd[4])); }else{ aLength = bnd[1]-bnd[0]; - aLength = max((bnd[3]-bnd[2]),aLength); - aLength = max((bnd[5]-bnd[4]),aLength); + aLength = qMax((bnd[3]-bnd[2]),aLength); + aLength = qMax((bnd[5]-bnd[4]),aLength); } static vtkFloatingPointType aSizeInPercents = 105; diff --git a/src/VTKViewer/resources/vtk_view_back.png b/src/VTKViewer/resources/vtk_view_back.png new file mode 100755 index 000000000..51beb0c73 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_back.png differ diff --git a/src/VTKViewer/resources/vtk_view_bottom.png b/src/VTKViewer/resources/vtk_view_bottom.png new file mode 100755 index 000000000..fa558e20e Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_bottom.png differ diff --git a/src/VTKViewer/resources/vtk_view_camera_dump.png b/src/VTKViewer/resources/vtk_view_camera_dump.png new file mode 100755 index 000000000..b02616f29 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_camera_dump.png differ diff --git a/src/VTKViewer/resources/vtk_view_fitall.png b/src/VTKViewer/resources/vtk_view_fitall.png new file mode 100755 index 000000000..87e001dd8 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_fitall.png differ diff --git a/src/VTKViewer/resources/vtk_view_fitarea.png b/src/VTKViewer/resources/vtk_view_fitarea.png new file mode 100755 index 000000000..450dc56c6 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_fitarea.png differ diff --git a/src/VTKViewer/resources/vtk_view_front.png b/src/VTKViewer/resources/vtk_view_front.png new file mode 100755 index 000000000..d91796086 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_front.png differ diff --git a/src/VTKViewer/resources/vtk_view_glpan.png b/src/VTKViewer/resources/vtk_view_glpan.png new file mode 100644 index 000000000..28ab547ea Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_glpan.png differ diff --git a/src/VTKViewer/resources/vtk_view_left.png b/src/VTKViewer/resources/vtk_view_left.png new file mode 100755 index 000000000..1b787b043 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_left.png differ diff --git a/src/VTKViewer/resources/vtk_view_pan.png b/src/VTKViewer/resources/vtk_view_pan.png new file mode 100755 index 000000000..ec56cacc7 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_pan.png differ diff --git a/src/VTKViewer/resources/vtk_view_reset.png b/src/VTKViewer/resources/vtk_view_reset.png new file mode 100755 index 000000000..66f81e604 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_reset.png differ diff --git a/src/VTKViewer/resources/vtk_view_right.png b/src/VTKViewer/resources/vtk_view_right.png new file mode 100755 index 000000000..5c6e161a0 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_right.png differ diff --git a/src/VTKViewer/resources/vtk_view_rotate.png b/src/VTKViewer/resources/vtk_view_rotate.png new file mode 100755 index 000000000..28ec89f03 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_rotate.png differ diff --git a/src/VTKViewer/resources/vtk_view_top.png b/src/VTKViewer/resources/vtk_view_top.png new file mode 100755 index 000000000..cef95040a Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_top.png differ diff --git a/src/VTKViewer/resources/vtk_view_triedre.png b/src/VTKViewer/resources/vtk_view_triedre.png new file mode 100755 index 000000000..bc5894dc3 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_triedre.png differ diff --git a/src/VTKViewer/resources/vtk_view_zoom.png b/src/VTKViewer/resources/vtk_view_zoom.png new file mode 100755 index 000000000..386c966d1 Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_zoom.png differ