#include <SUIT_ViewWindow.h>
#include <SUIT_ResourceMgr.h>
-#include <QtxAction.h>
#include <QtxWorkstack.h>
#include <QtxActionMenuMgr.h>
-//#include <QtxWorkstackAction.h>
+#include <QtxWorkstackAction.h>
-#include <QtGui/qframe.h>
-#include <QtGui/qlayout.h>
+#include <QFrame>
+#include <QVBoxLayout>
#include <stdarg.h>
/*!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 );
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;
return wnd;
}
-/*!\retval QPtrList<SUIT_ViewWindow> - return const active window list.*/
+/*!
+ \retval QPtrList<SUIT_ViewWindow> - return const active window list.
+*/
QList<SUIT_ViewWindow*> STD_TabDesktop::windows() const
{
QList<SUIT_ViewWindow*> winList;
return winList;
}
-/*! insert new widget into desktop.*/
+/*!
+ Insert new widget into desktop.
+*/
void STD_TabDesktop::addWindow( QWidget* w )
{
if ( !w || !workstack() )
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;
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<int>& opList )
{
int flags = 0;
// 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;
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;
}
#include <SUIT_Desktop.h>
-class QtxAction;
-class QPopupMenu;
-class QWorkspace;
class QtxWorkstack;
-//class QtxWorkstackAction;
+class QtxWorkstackAction;
#if defined WIN32
#pragma warning( disable: 4251 )
Q_OBJECT
public:
- enum { MenuWindowId = 6 };
- enum { VSplit, HSplit };
+ enum { SplitVertical, SplitHorizontal };
public:
STD_TabDesktop();
private:
QtxWorkstack* myWorkstack;
-// QtxWorkstackAction* myWorkstackAction;
+ QtxWorkstackAction* myWorkstackAction;
};
#if defined WIN32
#include <Style_Model.h>
#include <QtxSplash.h>
+#include <SUIT_LicenseDlg.h>
#ifdef SUIT_ENABLE_PYTHON
#include <Python.h>
#endif
#include <stdlib.h>
+#ifdef WIN32
+#include <UserEnv.h>
+#endif
+
static QString salomeVersion()
{
QString path( ::getenv( "GUI_ROOT_DIR" ) );
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" ) )
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 );
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() );
CONFIG += qt thread debug dll shared
win32:DEFINES += WNT WIN32
+DEFINES += DISABLE_TESTRECORDER
HEADERS = *.h
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";
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 );
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
}
/*!
#ifndef SUITAPP_APPLICATION_H
#define SUITAPP_APPLICATION_H
-#include <QApplication>
+#ifndef DISABLE_TESTRECORDER
+ #include <TestApplication.h>
+#else
+ #include <QApplication>
+#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
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;
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 )
#include <vtkTextProperty.h>
/*!
- * 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);
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);
// "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);
// "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);
// 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;
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;
isTitleShadow = aTitleProp->GetShadow() ? true : false;
}
- myIsNameVisible->setChecked(useName);
+ myNameGrp->setChecked(useName);
myAxisName->setText(aTitle);
myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
isLabelsShadow = aLabelsProp->GetShadow() ? true : false;
}
- myIsLabelsVisible->setChecked(useLabels);
+ myLabelsGrp->setChecked(useLabels);
myLabelNumber->setValue(nbLabels);
myLabelOffset->setValue(anOffset);
myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
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);
// Labels
- theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0);
+ theActor->SetLabelVisibility(myLabelsGrp->isChecked() ? 1 : 0);
int nbLabels = myLabelNumber->value();
theActor->SetNumberOfLabels(nbLabels);
// Tick marks
- theActor->SetTickVisibility(myIsTicksVisible->isChecked());
+ theActor->SetTickVisibility(myTicksGrp->isChecked());
int aTickLength = myTickLength->value();
theActor->SetTickLength(aTickLength);
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);
#ifndef SVTK_CubeAxesDlg_H
#define SVTK_CubeAxesDlg_H
-#include "SVTK.h"
#include "SVTK_DialogBase.h"
-#include <QFrame>
-
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,
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
SVTK_GenericRenderWindowInteractor
::GetSelector()
{
- return mySelector.GetPointer();
+ return mySelector;
}
/*!
SVTK_GenericRenderWindowInteractor();
~SVTK_GenericRenderWindowInteractor();
- vtkSmartPointer<SVTK_Selector> 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.
};
void operator=(const SVTK_ControllerOnKeyDown&); //Not implemented
};
-class vtkPicker;
class vtkPointPicker;
class SALOME_Actor;
PSelectionEvent mySelectionEvent;
- vtkSmartPointer<vtkPicker> myPicker;
-
unsigned long myCurrRotationPointType;
unsigned long myPrevRotationPointType;
#include <vtkCell.h>
#include <vtkPlane.h>
#include <vtkMath.h>
+#include <vtkCellArray.h>
+#include <vtkTriangle.h>
+#include <vtkOrderedTriangulator.h>
#ifdef _DEBUG_
static int DEBUG_TRIA_EXECUTE = 0;
typedef std::vector<TPolygon> 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,
std::vector<vtkIdType>& 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 = "<<aNumPts<<"\n";
static vtkFloatingPointType EPS = 1.0E-2;
vtkFloatingPointType aDistEps = aCellLength/3.0 * EPS;
- if(DEBUG_TRIA_EXECUTE) cout<<"\taCellLength = "<<aCellLength<<"; aDistEps = "<<aDistEps<<"\n";
+ if(DEBUG_TRIA_EXECUTE) cout<<"\taNumFaces = "<<aNumFaces<<"; aCellLength = "<<aCellLength<<"; aDistEps = "<<aDistEps<<"\n";
// To initialize set of points that belong to the cell
typedef std::set<vtkIdType> TPointIds;
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;
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();
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()
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];
-}
class vtkPoints;
class vtkIdList;
class vtkCell;
+class vtkCellArray;
+class vtkTriangle;
+class vtkOrderedTriangulator;
+
+//----------------------------------------------------------------------------
class VTKVIEWER_EXPORT VTKViewer_Triangulator
{
public:
std::vector<vtkIdType>& 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:
~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
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:
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
virtual
vtkCell*
GetFace(vtkIdType theFaceId);
-
- virtual
- void
- GetCellNeighbors(vtkIdType theCellId,
- vtkCell* theFace,
- vtkIdList* theCellIds);
-
- virtual
- vtkIdType
- GetConnectivity(vtkIdType thePntId);
};
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();
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;
{
delete [] cellVis;
}
+
+ return 1;
}
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);
}
}
#include "VTKViewer_ViewManager.h"
#include "VTKViewer_ViewModel.h"
-#include <SUIT_PreferenceMgr.h>
-#include <SUIT_ResourceMgr.h>
-
/*!Constructor.Initialize SIUT_ViewManager by \a study and \a theDesktop.
* Create new instance of VTKViewer_Viewer and set view model by it.
*/
{
/*!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<VTKViewer_Viewer*>( getViewModel() );
- if ( !aModel )
- return;
-
- aModel->setBackgroundColor( theMgr->colorValue( "VTKViewer", "background",
- aModel->backgroundColor() ) );
-}
public:
VTKViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* );
virtual ~VTKViewer_ViewManager();
-
- static int fillPreferences( SUIT_PreferenceMgr*, const int );
- void fillFrom( SUIT_ResourceMgr* );
};
#endif
(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;