removed capital letters

This commit is contained in:
ganovelli 2004-10-04 18:01:36 +00:00
parent d879a1445b
commit 51eb287cea
11 changed files with 1406 additions and 0 deletions

60
apps/tetraviewer/main.cpp Normal file
View File

@ -0,0 +1,60 @@
#include <qapplication.h>
#include "mainframe.h"
#include <wrap\io_tetramesh\import_ts.h>
#include <wrap\io_tetramesh\import_ply.h>
#include <vcg\complex\tetramesh\update\topology.h>
#include <vcg\complex\tetramesh\update\bounding.h>
#include <vcg\complex\tetramesh\update\normal.h>
//#include <tetrastats.h>
#include <myglwidget.h>
MyTetraMesh TM;
MyTetraMesh *tm;
TetraStats<MyTetraMesh> Stats;
vcg::tetra::io::ImporterTS<MyTetraMesh> ImpTS;
vcg::tetra::UpdateTetraTopology<MyTetraMesh::VertexContainer ,MyTetraMesh::TetraContainer > UT;
vcg::tetra::UpdateNormals<MyTetraMesh> UN;
vcg::tetra::UpdateBounding<MyTetraMesh> UB;
void openTetraMesh(const char* filename)
{
//opening the tetrahedral mesh
QString path=QString(filename);
QString ext =path.right(3);
TM=MyTetraMesh();
if (ext==".ts")
ImpTS.Open(TM,filename);
else
vcg::tetra::io::ImporterPLY<MyTetraMesh> ::Open(TM,filename);
UT.TTTopology(TM.vert,TM.tetra);
UT.VTTopology(TM.vert,TM.tetra);
UN.PerVertex(TM);
UB.Box(TM);
tm=&TM;
Stats.SetTetraMesh(tm);
Stats.Update();
}
int main( int argc, char ** argv )
{
tm=0;
QApplication a( argc, argv );
MainFrame w;
w.show();
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
}

View File

@ -0,0 +1,258 @@
/****************************************************************************
** Form implementation generated from reading ui file 'MainFrame.ui'
**
** Created: Mon Oct 4 19:00:57 2004
** by: The User Interface Compiler ($Id: mainframe.cpp,v 1.1 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "mainframe.h"
#include <qvariant.h>
#include <D:/TetraView/myglwidget.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <qbuttongroup.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qaction.h>
#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
#include <qimage.h>
#include <qpixmap.h>
#include "MainFrame.ui.h"
/*
* Constructs a MainFrame as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
*/
MainFrame::MainFrame( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
(void)statusBar();
if ( !name )
setName( "MainFrame" );
setCentralWidget( new QWidget( this, "qt_central_widget" ) );
file = new QGroupBox( centralWidget(), "file" );
file->setGeometry( QRect( 70, 0, 90, 80 ) );
OpenButton = new QPushButton( file, "OpenButton" );
OpenButton->setGeometry( QRect( 10, 10, 70, 60 ) );
OpenButton->setPixmap( QPixmap::fromMimeSource( "Open64.png" ) );
buttonGroup1 = new QButtonGroup( centralWidget(), "buttonGroup1" );
buttonGroup1->setGeometry( QRect( 160, 0, 470, 80 ) );
buttonGroup1->setExclusive( TRUE );
BoxButton = new QPushButton( buttonGroup1, "BoxButton" );
BoxButton->setGeometry( QRect( 10, 30, 51, 31 ) );
BoxButton->setToggleButton( TRUE );
WireButton = new QPushButton( buttonGroup1, "WireButton" );
WireButton->setGeometry( QRect( 80, 30, 40, 30 ) );
WireButton->setToggleButton( TRUE );
HiddenButton = new QPushButton( buttonGroup1, "HiddenButton" );
HiddenButton->setGeometry( QRect( 130, 30, 60, 31 ) );
HiddenButton->setToggleButton( TRUE );
FlatWireButton = new QPushButton( buttonGroup1, "FlatWireButton" );
FlatWireButton->setGeometry( QRect( 260, 30, 61, 31 ) );
FlatWireButton->setToggleButton( TRUE );
SmoothButton = new QPushButton( buttonGroup1, "SmoothButton" );
SmoothButton->setGeometry( QRect( 330, 30, 50, 30 ) );
SmoothButton->setToggleButton( TRUE );
SmallTetraButton = new QPushButton( buttonGroup1, "SmallTetraButton" );
SmallTetraButton->setGeometry( QRect( 390, 30, 60, 30 ) );
SmallTetraButton->setToggleButton( TRUE );
FlatButton = new QPushButton( buttonGroup1, "FlatButton" );
FlatButton->setGeometry( QRect( 200, 30, 50, 30 ) );
FlatButton->setToggleButton( TRUE );
FlatButton->setOn( TRUE );
FlatButton->setAutoDefault( FALSE );
FlatButton->setDefault( FALSE );
myGLWidget = new MyGLWidget( centralWidget(), "myGLWidget" );
myGLWidget->setGeometry( QRect( 70, 80, 790, 720 ) );
buttonGroup2 = new QButtonGroup( centralWidget(), "buttonGroup2" );
buttonGroup2->setGeometry( QRect( 630, 0, 230, 80 ) );
buttonGroup2->setExclusive( TRUE );
TrackButton = new QPushButton( buttonGroup2, "TrackButton" );
TrackButton->setGeometry( QRect( 140, 20, 61, 31 ) );
TrackButton->setToggleButton( TRUE );
TrackButton->setOn( TRUE );
TrackButton->setDefault( FALSE );
SectionButton = new QPushButton( buttonGroup2, "SectionButton" );
SectionButton->setGeometry( QRect( 40, 20, 71, 31 ) );
SectionButton->setToggleButton( TRUE );
// actions
fileNewAction = new QAction( this, "fileNewAction" );
fileNewAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
fileOpenAction = new QAction( this, "fileOpenAction" );
fileOpenAction->setToggleAction( FALSE );
fileOpenAction->setOn( FALSE );
fileOpenAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
fileSaveAction = new QAction( this, "fileSaveAction" );
fileSaveAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
fileSaveAsAction = new QAction( this, "fileSaveAsAction" );
filePrintAction = new QAction( this, "filePrintAction" );
filePrintAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
fileExitAction = new QAction( this, "fileExitAction" );
helpContentsAction = new QAction( this, "helpContentsAction" );
helpIndexAction = new QAction( this, "helpIndexAction" );
helpAboutAction = new QAction( this, "helpAboutAction" );
new_menunew_itemAction = new QAction( this, "new_menunew_itemAction" );
infonew_itemAction = new QAction( this, "infonew_itemAction" );
infoSimplexAction = new QAction( this, "infoSimplexAction" );
infoSimplexAction->setToggleAction( TRUE );
infoSimplexAction->setOn( TRUE );
infoQualityAction = new QAction( this, "infoQualityAction" );
infoQualityAction->setToggleAction( TRUE );
infoPhysicsAction = new QAction( this, "infoPhysicsAction" );
infoPhysicsAction->setToggleAction( TRUE );
// toolbars
// menubar
MenuBar = new QMenuBar( this, "MenuBar" );
File = new QPopupMenu( this );
fileNewAction->addTo( File );
fileOpenAction->addTo( File );
fileSaveAction->addTo( File );
fileSaveAsAction->addTo( File );
File->insertSeparator();
filePrintAction->addTo( File );
File->insertSeparator();
fileExitAction->addTo( File );
MenuBar->insertItem( QString(""), File, 1 );
Help = new QPopupMenu( this );
helpContentsAction->addTo( Help );
helpIndexAction->addTo( Help );
Help->insertSeparator();
helpAboutAction->addTo( Help );
MenuBar->insertItem( QString(""), Help, 2 );
Info_2 = new QPopupMenu( this );
new_menunew_itemAction->addTo( Info_2 );
infoSimplexAction->addTo( Info_2 );
infoQualityAction->addTo( Info_2 );
infoPhysicsAction->addTo( Info_2 );
MenuBar->insertItem( QString(""), Info_2, 3 );
languageChange();
resize( QSize(908, 846).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
// signals and slots connections
connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) );
connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) );
connect( fileSaveAsAction, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
connect( helpContentsAction, SIGNAL( activated() ), this, SLOT( helpContents() ) );
connect( helpIndexAction, SIGNAL( activated() ), this, SLOT( helpIndex() ) );
connect( BoxButton, SIGNAL( pressed() ), myGLWidget, SLOT( setBox() ) );
connect( WireButton, SIGNAL( pressed() ), myGLWidget, SLOT( setWire() ) );
connect( HiddenButton, SIGNAL( pressed() ), myGLWidget, SLOT( setHidden() ) );
connect( FlatButton, SIGNAL( pressed() ), myGLWidget, SLOT( setFlat() ) );
connect( FlatWireButton, SIGNAL( pressed() ), myGLWidget, SLOT( setFlatWire() ) );
connect( SmoothButton, SIGNAL( pressed() ), myGLWidget, SLOT( setSmooth() ) );
connect( SmallTetraButton, SIGNAL( pressed() ), myGLWidget, SLOT( setSmallTetra() ) );
connect( OpenButton, SIGNAL( clicked() ), this, SLOT( fileOpen() ) );
connect( SectionButton, SIGNAL( pressed() ), myGLWidget, SLOT( SectionMouseModality() ) );
connect( TrackButton, SIGNAL( pressed() ), myGLWidget, SLOT( TrackMouseModality() ) );
connect( infoPhysicsAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextPhysics() ) );
connect( infoQualityAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextQuality() ) );
connect( infoSimplexAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextSimplex() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
MainFrame::~MainFrame()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void MainFrame::languageChange()
{
setCaption( tr( "TetraView" ) );
file->setTitle( QString::null );
OpenButton->setText( QString::null );
buttonGroup1->setTitle( QString::null );
BoxButton->setText( tr( "box" ) );
WireButton->setText( tr( "Wire" ) );
HiddenButton->setText( tr( "Hidden" ) );
FlatWireButton->setText( tr( "FlatWire" ) );
SmoothButton->setText( tr( "Smooth" ) );
SmallTetraButton->setText( tr( "SmallTetra" ) );
FlatButton->setText( tr( "Flat" ) );
buttonGroup2->setTitle( QString::null );
TrackButton->setText( tr( "Trackball" ) );
SectionButton->setText( tr( "Section" ) );
fileNewAction->setText( tr( "New" ) );
fileNewAction->setMenuText( tr( "&New" ) );
fileNewAction->setAccel( tr( "Ctrl+N" ) );
fileOpenAction->setText( tr( "Open" ) );
fileOpenAction->setMenuText( tr( "&Open..." ) );
fileOpenAction->setAccel( tr( "Ctrl+O" ) );
fileSaveAction->setText( tr( "Save" ) );
fileSaveAction->setMenuText( tr( "&Save" ) );
fileSaveAction->setAccel( tr( "Ctrl+S" ) );
fileSaveAsAction->setText( tr( "Save As" ) );
fileSaveAsAction->setMenuText( tr( "Save &As..." ) );
fileSaveAsAction->setAccel( QString::null );
filePrintAction->setText( tr( "Print" ) );
filePrintAction->setMenuText( tr( "&Print..." ) );
filePrintAction->setAccel( tr( "Ctrl+P" ) );
fileExitAction->setText( tr( "Exit" ) );
fileExitAction->setMenuText( tr( "E&xit" ) );
fileExitAction->setAccel( QString::null );
helpContentsAction->setText( tr( "Contents" ) );
helpContentsAction->setMenuText( tr( "&Contents..." ) );
helpContentsAction->setAccel( QString::null );
helpIndexAction->setText( tr( "Index" ) );
helpIndexAction->setMenuText( tr( "&Index..." ) );
helpIndexAction->setAccel( QString::null );
helpAboutAction->setText( tr( "About" ) );
helpAboutAction->setMenuText( tr( "&About" ) );
helpAboutAction->setAccel( QString::null );
new_menunew_itemAction->setText( QString::null );
new_menunew_itemAction->setMenuText( QString::null );
infonew_itemAction->setText( tr( "new item" ) );
infonew_itemAction->setMenuText( tr( "new item" ) );
infoSimplexAction->setText( tr( "Simplex" ) );
infoSimplexAction->setMenuText( tr( "Simplex" ) );
infoQualityAction->setText( tr( "Quality" ) );
infoQualityAction->setMenuText( tr( "Quality" ) );
infoPhysicsAction->setText( tr( "Physics" ) );
infoPhysicsAction->setMenuText( tr( "Physics" ) );
if (MenuBar->findItem(1))
MenuBar->findItem(1)->setText( tr( "&File" ) );
if (MenuBar->findItem(2))
MenuBar->findItem(2)->setText( tr( "&Help" ) );
if (MenuBar->findItem(3))
MenuBar->findItem(3)->setText( tr( "Info" ) );
}

View File

@ -0,0 +1,92 @@
/****************************************************************************
** Form interface generated from reading ui file 'MainFrame.ui'
**
** Created: Mon Oct 4 19:00:57 2004
** by: The User Interface Compiler ($Id: mainframe.h,v 1.1 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef MAINFRAME_H
#define MAINFRAME_H
#include <qvariant.h>
#include <qpixmap.h>
#include <qmainwindow.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QAction;
class QActionGroup;
class QToolBar;
class QPopupMenu;
class MyGLWidget;
class QGroupBox;
class QPushButton;
class QButtonGroup;
class MainFrame : public QMainWindow
{
Q_OBJECT
public:
MainFrame( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel );
~MainFrame();
QGroupBox* file;
QPushButton* OpenButton;
QButtonGroup* buttonGroup1;
QPushButton* BoxButton;
QPushButton* WireButton;
QPushButton* HiddenButton;
QPushButton* FlatWireButton;
QPushButton* SmoothButton;
QPushButton* SmallTetraButton;
QPushButton* FlatButton;
MyGLWidget* myGLWidget;
QButtonGroup* buttonGroup2;
QPushButton* TrackButton;
QPushButton* SectionButton;
QMenuBar *MenuBar;
QPopupMenu *File;
QPopupMenu *Help;
QPopupMenu *Info_2;
QAction* fileNewAction;
QAction* fileOpenAction;
QAction* fileSaveAction;
QAction* fileSaveAsAction;
QAction* filePrintAction;
QAction* fileExitAction;
QAction* helpContentsAction;
QAction* helpIndexAction;
QAction* helpAboutAction;
QAction* new_menunew_itemAction;
QAction* infonew_itemAction;
QAction* infoSimplexAction;
QAction* infoQualityAction;
QAction* infoPhysicsAction;
public slots:
virtual void fileNew();
virtual void fileOpen();
virtual void fileSave();
virtual void fileSaveAs();
virtual void fileExit();
virtual void helpIndex();
virtual void helpContents();
virtual void helpAbout();
void setWire();
protected:
protected slots:
virtual void languageChange();
private:
QPixmap image0;
};
#endif // MAINFRAME_H

View File

@ -0,0 +1,80 @@
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
#include <qfiledialog.h>
#include <qdir.h>
#include <qmessagebox.h>
extern void openTetraMesh(const char *);
void MainFrame::fileNew()
{
}
void MainFrame::fileOpen()
{
QString filename = QFileDialog::getOpenFileName(
"",
"Tetrahedral Meshes File (*.ts *.ply)",
this,
"open file dialog"
"Choose a TS Tetrahedral mesh file" );
const char *path=filename.ascii();
openTetraMesh(path);
}
void MainFrame::fileSave()
{
}
void MainFrame::fileSaveAs()
{
}
void MainFrame::fileExit()
{
}
void MainFrame::helpIndex()
{
}
void MainFrame::helpContents()
{
}
void MainFrame::helpAbout()
{
}
void MainFrame::setWire()
{
}

View File

@ -0,0 +1,128 @@
/****************************************************************************\
** MainFrame meta object code from reading C++ file 'mainframe.h'
**
** Created: Mon Oct 4 19:00:57 2004
** by: The Qt MOC ($Id: moc_mainframe.cpp,v 1.1 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#undef QT_NO_COMPAT
#include "mainframe.h"
#include <qmetaobject.h>
#include <qapplication.h>
#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.3.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
const char *MainFrame::className() const
{
return "MainFrame";
}
QMetaObject *MainFrame::metaObj = 0;
static QMetaObjectCleanUp cleanUp_MainFrame( "MainFrame", &MainFrame::staticMetaObject );
#ifndef QT_NO_TRANSLATION
QString MainFrame::tr( const char *s, const char *c )
{
if ( qApp )
return qApp->translate( "MainFrame", s, c, QApplication::DefaultCodec );
else
return QString::fromLatin1( s );
}
#ifndef QT_NO_TRANSLATION_UTF8
QString MainFrame::trUtf8( const char *s, const char *c )
{
if ( qApp )
return qApp->translate( "MainFrame", s, c, QApplication::UnicodeUTF8 );
else
return QString::fromUtf8( s );
}
#endif // QT_NO_TRANSLATION_UTF8
#endif // QT_NO_TRANSLATION
QMetaObject* MainFrame::staticMetaObject()
{
if ( metaObj )
return metaObj;
QMetaObject* parentObject = QMainWindow::staticMetaObject();
static const QUMethod slot_0 = {"fileNew", 0, 0 };
static const QUMethod slot_1 = {"fileOpen", 0, 0 };
static const QUMethod slot_2 = {"fileSave", 0, 0 };
static const QUMethod slot_3 = {"fileSaveAs", 0, 0 };
static const QUMethod slot_4 = {"fileExit", 0, 0 };
static const QUMethod slot_5 = {"helpIndex", 0, 0 };
static const QUMethod slot_6 = {"helpContents", 0, 0 };
static const QUMethod slot_7 = {"helpAbout", 0, 0 };
static const QUMethod slot_8 = {"setWire", 0, 0 };
static const QUMethod slot_9 = {"languageChange", 0, 0 };
static const QMetaData slot_tbl[] = {
{ "fileNew()", &slot_0, QMetaData::Public },
{ "fileOpen()", &slot_1, QMetaData::Public },
{ "fileSave()", &slot_2, QMetaData::Public },
{ "fileSaveAs()", &slot_3, QMetaData::Public },
{ "fileExit()", &slot_4, QMetaData::Public },
{ "helpIndex()", &slot_5, QMetaData::Public },
{ "helpContents()", &slot_6, QMetaData::Public },
{ "helpAbout()", &slot_7, QMetaData::Public },
{ "setWire()", &slot_8, QMetaData::Public },
{ "languageChange()", &slot_9, QMetaData::Protected }
};
metaObj = QMetaObject::new_metaobject(
"MainFrame", parentObject,
slot_tbl, 10,
0, 0,
#ifndef QT_NO_PROPERTIES
0, 0,
0, 0,
#endif // QT_NO_PROPERTIES
0, 0 );
cleanUp_MainFrame.setMetaObject( metaObj );
return metaObj;
}
void* MainFrame::qt_cast( const char* clname )
{
if ( !qstrcmp( clname, "MainFrame" ) )
return this;
return QMainWindow::qt_cast( clname );
}
bool MainFrame::qt_invoke( int _id, QUObject* _o )
{
switch ( _id - staticMetaObject()->slotOffset() ) {
case 0: fileNew(); break;
case 1: fileOpen(); break;
case 2: fileSave(); break;
case 3: fileSaveAs(); break;
case 4: fileExit(); break;
case 5: helpIndex(); break;
case 6: helpContents(); break;
case 7: helpAbout(); break;
case 8: setWire(); break;
case 9: languageChange(); break;
default:
return QMainWindow::qt_invoke( _id, _o );
}
return TRUE;
}
bool MainFrame::qt_emit( int _id, QUObject* _o )
{
return QMainWindow::qt_emit(_id,_o);
}
#ifndef QT_NO_PROPERTIES
bool MainFrame::qt_property( int id, int f, QVariant* v)
{
return QMainWindow::qt_property( id, f, v);
}
bool MainFrame::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
#endif // QT_NO_PROPERTIES

View File

@ -0,0 +1,134 @@
/****************************************************************************
** MyGLWidget meta object code from reading C++ file 'myglwidget.h'
**
** Created: Mon Oct 4 19:00:57 2004
** by: The Qt MOC ($Id: moc_myglwidget.cpp,v 1.1 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#undef QT_NO_COMPAT
#include "myglwidget.h"
#include <qmetaobject.h>
#include <qapplication.h>
#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.3.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
const char *MyGLWidget::className() const
{
return "MyGLWidget";
}
QMetaObject *MyGLWidget::metaObj = 0;
static QMetaObjectCleanUp cleanUp_MyGLWidget( "MyGLWidget", &MyGLWidget::staticMetaObject );
#ifndef QT_NO_TRANSLATION
QString MyGLWidget::tr( const char *s, const char *c )
{
if ( qApp )
return qApp->translate( "MyGLWidget", s, c, QApplication::DefaultCodec );
else
return QString::fromLatin1( s );
}
#ifndef QT_NO_TRANSLATION_UTF8
QString MyGLWidget::trUtf8( const char *s, const char *c )
{
if ( qApp )
return qApp->translate( "MyGLWidget", s, c, QApplication::UnicodeUTF8 );
else
return QString::fromUtf8( s );
}
#endif // QT_NO_TRANSLATION_UTF8
#endif // QT_NO_TRANSLATION
QMetaObject* MyGLWidget::staticMetaObject()
{
if ( metaObj )
return metaObj;
QMetaObject* parentObject = QGLWidget::staticMetaObject();
static const QUMethod slot_0 = {"setBox", 0, 0 };
static const QUMethod slot_1 = {"setWire", 0, 0 };
static const QUMethod slot_2 = {"setHidden", 0, 0 };
static const QUMethod slot_3 = {"setFlat", 0, 0 };
static const QUMethod slot_4 = {"setFlatWire", 0, 0 };
static const QUMethod slot_5 = {"setSmooth", 0, 0 };
static const QUMethod slot_6 = {"setSmallTetra", 0, 0 };
static const QUMethod slot_7 = {"TrackMouseModality", 0, 0 };
static const QUMethod slot_8 = {"SectionMouseModality", 0, 0 };
static const QUMethod slot_9 = {"SwitchTextSimplex", 0, 0 };
static const QUMethod slot_10 = {"SwitchTextPhysics", 0, 0 };
static const QUMethod slot_11 = {"SwitchTextQuality", 0, 0 };
static const QMetaData slot_tbl[] = {
{ "setBox()", &slot_0, QMetaData::Public },
{ "setWire()", &slot_1, QMetaData::Public },
{ "setHidden()", &slot_2, QMetaData::Public },
{ "setFlat()", &slot_3, QMetaData::Public },
{ "setFlatWire()", &slot_4, QMetaData::Public },
{ "setSmooth()", &slot_5, QMetaData::Public },
{ "setSmallTetra()", &slot_6, QMetaData::Public },
{ "TrackMouseModality()", &slot_7, QMetaData::Public },
{ "SectionMouseModality()", &slot_8, QMetaData::Public },
{ "SwitchTextSimplex()", &slot_9, QMetaData::Public },
{ "SwitchTextPhysics()", &slot_10, QMetaData::Public },
{ "SwitchTextQuality()", &slot_11, QMetaData::Public }
};
metaObj = QMetaObject::new_metaobject(
"MyGLWidget", parentObject,
slot_tbl, 12,
0, 0,
#ifndef QT_NO_PROPERTIES
0, 0,
0, 0,
#endif // QT_NO_PROPERTIES
0, 0 );
cleanUp_MyGLWidget.setMetaObject( metaObj );
return metaObj;
}
void* MyGLWidget::qt_cast( const char* clname )
{
if ( !qstrcmp( clname, "MyGLWidget" ) )
return this;
return QGLWidget::qt_cast( clname );
}
bool MyGLWidget::qt_invoke( int _id, QUObject* _o )
{
switch ( _id - staticMetaObject()->slotOffset() ) {
case 0: setBox(); break;
case 1: setWire(); break;
case 2: setHidden(); break;
case 3: setFlat(); break;
case 4: setFlatWire(); break;
case 5: setSmooth(); break;
case 6: setSmallTetra(); break;
case 7: TrackMouseModality(); break;
case 8: SectionMouseModality(); break;
case 9: SwitchTextSimplex(); break;
case 10: SwitchTextPhysics(); break;
case 11: SwitchTextQuality(); break;
default:
return QGLWidget::qt_invoke( _id, _o );
}
return TRUE;
}
bool MyGLWidget::qt_emit( int _id, QUObject* _o )
{
return QGLWidget::qt_emit(_id,_o);
}
#ifndef QT_NO_PROPERTIES
bool MyGLWidget::qt_property( int id, int f, QVariant* v)
{
return QGLWidget::qt_property( id, f, v);
}
bool MyGLWidget::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
#endif // QT_NO_PROPERTIES

View File

@ -0,0 +1,13 @@
#include <vcg\simplex\vertex\with\atvn.h>
#include <vcg\simplex\tetrahedron\with\atav.h>
#include <vcg\complex\tetramesh\base.h>
class MyTetrahedron;
class DUMMYEDGETYPE;
class DUMMYFACETYPE;
class MyVertex: public vcg::VertexATVNd<DUMMYEDGETYPE,DUMMYFACETYPE,MyTetrahedron>{};
class MyTetrahedron: public vcg::TetraATAV<MyVertex,MyTetrahedron>{};
typedef vcg::tetra::Tetramesh< std::vector<MyVertex> ,std::vector<MyTetrahedron> > MyTetraMesh;

View File

@ -0,0 +1,396 @@
#include <myglwidget.h>
#include <vcg\space\tetra3.h>
#include <vcg\space\point3.h>
extern MyTetraMesh *tm;
extern TetraStats<MyTetraMesh> Stats;
bool MyGLWidget::ShowTextSimplex()
{
return (_ShowBar & SIMPLEX);
}
bool MyGLWidget::ShowTextPhysics()
{
return (_ShowBar & PHYSICS);
}
bool MyGLWidget::ShowTextQuality()
{
return (_ShowBar & QUALITY);
}
MyGLWidget::MyGLWidget( QWidget * parent, const char * name, const QGLWidget * shareWidget, WFlags f ):
QGLWidget(parent, name)
{
Track.Reset();
Track.radius= 1;
WT=0;
modality=3;
mouse_modality=MMTrackball;
_ShowBar=SIMPLEX;
}
void MyGLWidget::DrawTextInfo()
{
glPushAttrib(0xffffffff);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
glEnable(GL_LIGHTING);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_CLIP_PLANE0);
glColor4d(0.7,0,0.7,0.6);
glDepthRange(0.0,0.1);
glBegin(GL_QUADS);
glVertex3d(-0.5,-0.5,0);
glVertex3d(-0.5,-0.3,0);
glVertex3d(0.5,-0.3,0);
glVertex3d(0.5,-0.5,0);
glEnd();
if (Stats.TCurrent()!=0)
{
glBegin(GL_QUADS);
glVertex3d(0.25,0.5,0);
glVertex3d(0.5,0.5,0);
glVertex3d(0.5,0.2,0);
glVertex3d(0.25,0.2,0);
glEnd();
}
renderText( (width() - 10) / 2, 15, "a" );
QFont f( "arial", 8 );
QFontMetrics fmc( f );
glColor3d(1,1,1);
QString str="";
int level=0;
glDisable( GL_LIGHTING );
glDisable( GL_TEXTURE_2D );
if (ShowTextSimplex())
{
level++;
str.sprintf( "Tetrahedrons : %i Vertex: %i ",tm->tn,tm->vn);
renderText( 20, height() - level*20, str, f );
}
if (ShowTextPhysics())
{
level++;
str.sprintf( "Volume : %03f ",Stats.volume);
renderText( 20, height() - level*20, str, f );
}
if (ShowTextQuality())
{
level++;
str.sprintf( "Aspect Ratio : %03f ",Stats.ratio);
renderText( 20, height() - level*20, str, f );
}
//at the end i draw the window for informations about a tretrahedron
if (Stats.TCurrent()!=0)
{
str="";
str.sprintf( "Volume : %03f ",Stats.TCurrent()->ComputeVolume());
renderText( width()-150, 30, str, f );
str.sprintf( "Aspect Ratio : %03f ",Stats.TCurrent()->AspectRatio());
renderText( width()-150, 50, str, f );
LoadMatrix();
glColor3d(1,0,0);
glDisable(GL_BLEND);
//write values of the tetrahedron
glLineWidth(0.5);
glColor3d(1,0,0);
for (int i=0;i<4;i++)
{
double x=Stats.TCurrent()->V(i)->P().V(0);//x value of vertex
double y=Stats.TCurrent()->V(i)->P().V(1);//y value of vertex
double z=Stats.TCurrent()->V(i)->P().V(2);//z value of vertex
str.sprintf("%i",i);
renderText(x,y,z,str,f);
}
//show the tetrahedron
glBegin(GL_LINE_LOOP);
for (int i=0;i<4;i++)
{
glVertex(Stats.TCurrent()->V(i)->P());
}
glEnd();
glBegin(GL_LINE_LOOP);
glVertex(Stats.TCurrent()->V(0)->P());
glVertex(Stats.TCurrent()->V(2)->P());
glEnd();
glBegin(GL_LINE_LOOP);
glVertex(Stats.TCurrent()->V(1)->P());
glVertex(Stats.TCurrent()->V(3)->P());
glEnd();
//end drawing
}
glPopAttrib();
}
void MyGLWidget::DrawBox()
{
glPushAttrib(0xffffffff);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHT0);
glDisable(GL_LIGHTING);
glDisable(GL_NORMALIZE);
glColor3d(1,1,1);
glBegin(GL_LINE_LOOP);
glVertex(tm->bbox.P(0));
glVertex(tm->bbox.P(1));
glVertex(tm->bbox.P(3));
glVertex(tm->bbox.P(2));
glEnd();
glBegin(GL_LINE_LOOP);
glVertex(tm->bbox.P(4));
glVertex(tm->bbox.P(5));
glVertex(tm->bbox.P(7));
glVertex(tm->bbox.P(6));
glEnd();
glBegin(GL_LINE_LOOP);
glVertex(tm->bbox.P(0));
glVertex(tm->bbox.P(1));
glVertex(tm->bbox.P(5));
glVertex(tm->bbox.P(4));
glEnd();
glBegin(GL_LINE_LOOP);
glVertex(tm->bbox.P(3));
glVertex(tm->bbox.P(2));
glVertex(tm->bbox.P(6));
glVertex(tm->bbox.P(7));
glEnd();
glPopAttrib();
}
void MyGLWidget::DrawTetraMesh()
{
switch (modality)
{
case 0:DrawBox();break;
case 1:WT->Draw<vcg::GLW::DMWire,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
case 2:WT->Draw<vcg::GLW::DMHidden,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
case 3:WT->Draw<vcg::GLW::DMFlat,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
case 4:WT->Draw<vcg::GLW::DMFlatWire,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
case 5:WT->Draw<vcg::GLW::DMFlat,vcg::GLW::NMSmooth,vcg::GLW::CMNone>();break;
case 6:WT->Draw<vcg::GLW::DMSmallTetra,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
}
}
void MyGLWidget::SaveMatrix()
{
glGetDoublev(GL_PROJECTION_MATRIX ,projection);
glGetDoublev(GL_MODELVIEW_MATRIX ,modelMatrix);
}
void MyGLWidget::LoadMatrix()
{
glMatrixMode(GL_PROJECTION);
glLoadMatrixd(projection);
glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelMatrix);
}
void MyGLWidget::glDraw(){
glClearColor(0.2,0.2,0.2,1);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,1,0.01,20);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,1,0,0,0,0,10,0);
if (tm!=0){
glPushMatrix();
glScalef(1/tm->bbox.Diag(),1/tm->bbox.Diag(),1/tm->bbox.Diag());
Track.GetView();
Track.Apply();
Track.Draw();
vcg::Point3d p=tm->bbox.Center();
glTranslate(-p);
//if not exist crete an instance of wrapper
if (WT==0)
{
WT= new vcg::GLWrapTetra<std::vector<MyTetrahedron> >(tm->tetra);
WT->SetHint(vcg::GLW::HShrinkFactor, 0.8);
}
/*glGetDoublev(GL_PROJECTION_MATRIX,proj);
glGetDoublev(GL_mode_MATRIX,mod);
glGetDoublev(GL_PROJECTION_MATRIX,);*/
SaveMatrix();
DrawTetraMesh();
glPopMatrix();
DrawTextInfo();
}
QGLWidget::glDraw();
}
void MyGLWidget::resizeGL( int w, int h )
{
// setup viewport, projection etc.:
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
float ratio=(float)w/(float)h;
gluPerspective(45,ratio,1,20);
_W=w;
_H=h;
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_MODELVIEW);
repaint();
}
void MyGLWidget::mousePressEvent ( QMouseEvent * e )
{
if (e->button()==Qt::LeftButton)
{
if (mouse_modality==MMTrackball)
{
Track.MouseDown(e->x(),_H-e->y(),vcg::Trackball::BUTTON_LEFT);
repaint();
}
else
if (mouse_modality==MMSection)
{
LoadMatrix();
MyTetraMesh::TetraIterator ti;
vcg::GLPickTetra<MyTetraMesh>::PickNearestTetra(e->x(),_H-e->y(),*tm,ti);
if (ti!=0)
{
///find exterbnal face
int face=0;
while (!ti->IsBorderF(face))
face++;
vcg::Point3d p0=ti->V(vcg::Tetra::VofF(face,0))->P();
vcg::Point3d p1=ti->V(vcg::Tetra::VofF(face,1))->P();
vcg::Point3d p2=ti->V(vcg::Tetra::VofF(face,2))->P();
MyTetraMesh::VertexType::CoordType b=(p0+p1+p2)/3.f;
WT->AddClipSection(p0,p1,p2);
TrackClip.Reset();
TrackClip.radius=1;
TrackClip.center.V(0)=(float)b.V(0);
TrackClip.center.V(1)=(float)b.V(1);
TrackClip.center.V(2)=(float)b.V(2);
mouse_modality=MMNavigateSection;
TrackClip.MouseDown(e->x(),_H-e->y(),vcg::Trackball::BUTTON_LEFT);
}
}
}
else if (e->button()==Qt::RightButton)
{
MyTetraMesh::TetraIterator ti;
LoadMatrix();
//WT->section.GlClip();
vcg::GLPickTetra<MyTetraMesh>::PickNearestTetra(e->x(),_H-e->y(),*tm,ti);
if (ti!=0)
{
Stats.TetraInfo(&*ti);
}
}
}
void MyGLWidget::mouseReleaseEvent(QMouseEvent * e )
{
Track.MouseUp(e->x(),_H-e->y(),vcg::Trackball::BUTTON_LEFT);
repaint();
}
void MyGLWidget::mouseMoveEvent ( QMouseEvent * e )
{
if (mouse_modality==MMTrackball)
{
Track.MouseMove(e->x(),_H-e->y());
repaint();
}
else
if (mouse_modality==MMNavigateSection)
{
LoadMatrix();
TrackClip.MouseMove(e->x(),_H-e->y());
TrackClip.GetView();
TrackClip.Apply();
WT->section.Transform(TrackClip.track.Matrix());
repaint();
}
}
void MyGLWidget::wheelEvent ( QWheelEvent * e ){
/*
if (mouse_modality==MMTrackball)
{
const int WHEEL_DELTA =120;
Track.MouseWheel( e->delta()/ float(WHEEL_DELTA) );
repaint();
}else*/
if (mouse_modality==MMNavigateSection)
{
const int WHEEL_DELTA =120;
float delta= e->delta()/ float(WHEEL_DELTA);
WT->section.Translate(delta/10);
///for casting from double to float
TrackClip.center.V(0)=(float)WT->section.P.V(0);
TrackClip.center.V(1)=(float)WT->section.P.V(1);
TrackClip.center.V(2)=(float)WT->section.P.V(2);
repaint();
}
}
void MyGLWidget::keyPressEvent(QKeyEvent *k)
{
mouse_modality=MMTrackball;
if ((k->key()==Qt::Key_Escape)&&((mouse_modality==MMNavigateSection)||(mouse_modality==MMSection)))
mouse_modality=MMTrackball;
}
void MyGLWidget::initializeGL(){
GLfloat f[4]={0.2,0.2,0.2,1.f};
GLfloat p[4]={3,3,5,0};
glLightfv(GL_LIGHT0, GL_AMBIENT,f);
glLightfv(GL_LIGHT1, GL_POSITION,p);
glLightfv(GL_LIGHT1, GL_DIFFUSE,f);
glLightfv(GL_LIGHT1, GL_SPECULAR,f);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glPolygonMode(GL_FRONT,GL_FILL);
glEnable(GL_BACK);
glCullFace(GL_BACK);
}

View File

@ -0,0 +1,151 @@
#include <GL\glew.h>
#include <qgl.h>
#include <wrap\gl\glwraptetra.h>
#include <wrap\gl\pick.h>
#include <wrap\gui\trackball.h>
#include <myclasses.h>
#include <tetrastats.h>
class MyGLWidget: public QGLWidget{
Q_OBJECT
private :
int _H;
int _W;
vcg::Trackball Track;
vcg::GLWrapTetra<MyTetraMesh::TetraContainer > *WT;
GLdouble projection[16];
GLdouble modelMatrix[16];
GLint viewport[4];
int modality;//rendering modality
enum mousemod {MMTrackball, MMSection,MMNavigateSection};//modality of using mouse
mousemod mouse_modality;
vcg::Trackball TrackClip;
/// This are the flags pf info of the mesh that we want to show
int _ShowBar;
enum {
SIMPLEX = 0x00000001, // show vertex number and tetrahedrons number
PHYSICS = 0x00000002, // show also physical information about the mesh
QUALITY = 0x00000004, // show informations about aspect ratio
};
public:
MyGLWidget( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 );
virtual void glDraw();
void resizeGL( int w, int h );
virtual void mousePressEvent ( QMouseEvent * e );
virtual void mouseReleaseEvent(QMouseEvent * e );
virtual void mouseMoveEvent ( QMouseEvent * e );
virtual void wheelEvent ( QWheelEvent * e );
virtual void keyPressEvent(QKeyEvent *k);
virtual void initializeGL();
virtual void SaveMatrix();
void DrawTetraMesh();
void DrawBox();
bool ShowTextSimplex();
bool ShowTextPhysics();
bool ShowTextQuality();
void DrawTextInfo();
void LoadMatrix();
public slots:
///bounding box visualization modality
void setBox(){
modality=0;
repaint();
};
///wireframe modality
void setWire(){
modality=1;
repaint();
};
///hiddenlines modality
void setHidden(){
modality=2;
repaint();
};
///alternate wire visualization
void setFlat(){
modality=3;
repaint();
};
///alternate wire visualization
void setFlatWire(){
modality=4;
repaint();
};
///alternate wire visualization
void setSmooth(){
modality=5;
repaint();
};
///alternate wire visualization
void setSmallTetra()
{
modality=6;
repaint();
};
//set trackball modality
void TrackMouseModality()
{
mouse_modality=MMTrackball;
};
//set trackball modality
void SectionMouseModality()
{
mouse_modality=MMSection;
};
///switching to modality of viewing txt info on simplex
void SwitchTextSimplex()
{
if (ShowTextSimplex())
_ShowBar&=~SIMPLEX;
else
_ShowBar|=SIMPLEX;
repaint();
};
///switching to modality of viewing txt info on physics
void SwitchTextPhysics()
{
if (ShowTextPhysics())
_ShowBar&=~PHYSICS;
else
_ShowBar|=PHYSICS;
repaint();
};
///switching to modality of viewing txt info on quality
void SwitchTextQuality()
{
if (ShowTextQuality())
_ShowBar&=~QUALITY;
else
_ShowBar|=QUALITY;
repaint();
};
};

View File

@ -0,0 +1,27 @@
/****************************************************************************
** Image collection for project 'TetraView'.
**
** Generated from reading image files:
** images/editcopy
** images/editcut
** images/editpaste
** images/filenew
** images/fileopen
** images/filesave
** images/print
** images/redo
** images/searchfind
** images/undo
** images/Open64.png
**
** Created: Mon Oct 4 19:00:57 2004
** by: The User Interface Compiler ($Id: qmake_image_collection.cpp,v 1.3 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include <qimage.h>
#include <qdict.h>
#include <qmime.h>
#include <qdragobject.h>

View File

@ -0,0 +1,67 @@
template<class TETRA_MESH_TYPE>
class TetraStats
{
typedef typename TETRA_MESH_TYPE::TetraType TetraType;
TETRA_MESH_TYPE * Tetra;
TetraType* T;
public:
double volume;
double ratio;
TetraStats(){}
~TetraStats(){}
static double ComputeVolume(TETRA_MESH_TYPE *tm)
{
double total=0.f;
TETRA_MESH_TYPE::TetraIterator ti;
for (ti=tm->tetra.begin();ti<tm->tetra.end();ti++)
{
if (!ti->IsD())
total+=ti->ComputeVolume();
}
return total;
}
static double ComputeRatioMedia(TETRA_MESH_TYPE *tm)
{
double total=0.f;
TETRA_MESH_TYPE::TetraIterator ti;
int i=0;
for (ti=tm->tetra.begin();ti<tm->tetra.end();ti++)
{
if (!ti->IsD())
{
total+=ti->AspectRatio();
i++;
}
}
return (total/i);
}
void SetTetraMesh(TETRA_MESH_TYPE* T)
{
Tetra=T;
}
void Update()
{
ratio=ComputeRatioMedia(Tetra);
volume=ComputeVolume(Tetra);
}
void TetraInfo(TetraType *Te)
{
T=Te;
}
TetraType * TCurrent()
{
return T;
}
};