cleanup of my mess

This commit is contained in:
Andreas Fabri 2010-09-03 16:59:29 +00:00
parent 4f47f8e307
commit 50617cdbeb
5 changed files with 0 additions and 479 deletions

3
.gitattributes vendored
View File

@ -1417,10 +1417,7 @@ GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.ui -text
GraphicsView/demo/Alpha_shapes_2/about_Alpha_shapes_2.html svneol=native#text/html GraphicsView/demo/Alpha_shapes_2/about_Alpha_shapes_2.html svneol=native#text/html
GraphicsView/demo/Apollonius_graph_2/Apollonius_graph_2.qrc -text GraphicsView/demo/Apollonius_graph_2/Apollonius_graph_2.qrc -text
GraphicsView/demo/Apollonius_graph_2/Apollonius_graph_2.ui -text GraphicsView/demo/Apollonius_graph_2/Apollonius_graph_2.ui -text
GraphicsView/demo/Apollonius_graph_2/Stream_lines_2.qrc -text
GraphicsView/demo/Apollonius_graph_2/Stream_lines_2.ui -text
GraphicsView/demo/Apollonius_graph_2/about_Apollonius_graph_2.html svneol=native#text/html GraphicsView/demo/Apollonius_graph_2/about_Apollonius_graph_2.html svneol=native#text/html
GraphicsView/demo/Apollonius_graph_2/about_Stream_lines_2.html svneol=native#text/html
GraphicsView/demo/Bounding_volumes/Bounding_volumes.qrc -text GraphicsView/demo/Bounding_volumes/Bounding_volumes.qrc -text
GraphicsView/demo/Bounding_volumes/Bounding_volumes.ui -text GraphicsView/demo/Bounding_volumes/Bounding_volumes.ui -text
GraphicsView/demo/Bounding_volumes/about_Bounding_volumes.html svneol=native#text/html GraphicsView/demo/Bounding_volumes/about_Bounding_volumes.html svneol=native#text/html

View File

@ -1,246 +0,0 @@
#include <fstream>
// CGAL headers
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Stream_lines_2.h>
#include <CGAL/Runge_kutta_integrator_2.h>
#include <CGAL/Regular_grid_2.h>
// Qt headers
#include <QtGui>
#include <QString>
#include <QActionGroup>
#include <QFileDialog>
#include <QInputDialog>
// GraphicsView items and event filters (input classes)
#include <CGAL/Qt/StreamLinesGraphicsItem.h>
// for viewportsBbox
#include <CGAL/Qt/utility.h>
// the two base classes
#include "ui_Stream_lines_2.h"
#include <CGAL/Qt/DemosMainWindow.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Regular_grid_2<K> Regular_grid;
typedef CGAL::Runge_kutta_integrator_2<Regular_grid> Runge_kutta_integrator;
typedef CGAL::Stream_lines_2<Regular_grid, Runge_kutta_integrator> Stream_lines;
typedef CGAL::Stream_lines_2<Regular_grid, Runge_kutta_integrator>::Stream_line_iterator_2 Stream_line_iterator;
typedef CGAL::Stream_lines_2<Regular_grid, Runge_kutta_integrator>::Point_iterator_2 Point_iterator;
typedef CGAL::Stream_lines_2<Regular_grid, Runge_kutta_integrator>::Point_2 Point_2;
typedef CGAL::Stream_lines_2<Regular_grid, Runge_kutta_integrator>::Vector_2 Vector;
typedef K::Iso_rectangle_2 Iso_rectangle_2;
class MainWindow :
public CGAL::Qt::DemosMainWindow,
public Ui::Stream_lines_2
{
Q_OBJECT
private:
Stream_lines * stream_lines;
Runge_kutta_integrator * runge_kutta_integrator;
Regular_grid * regular_grid;
double density;
double ratio;
double integrating;
int sampling;
QGraphicsScene scene;
CGAL::Qt::StreamLinesGraphicsItem<Stream_lines,K> * sli;
public:
MainWindow();
public slots:
void on_actionLoadPoints_triggered();
void on_actionClear_triggered();
void on_actionSavePoints_triggered();
void on_actionGenerate_triggered();
void on_actionRecenter_triggered();
virtual void open(QString fileName);
signals:
void changed();
};
MainWindow::MainWindow()
: DemosMainWindow(), density(12.0), ratio(1.6), integrating(1.0), sampling(1)
{
setupUi(this);
this->graphicsView->setAcceptDrops(false);
// Manual handling of actions
//
QObject::connect(this->actionQuit, SIGNAL(triggered()),
this, SLOT(close()));
//
// Setup the scene and the view
//
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
scene.setSceneRect(-100, -100, 100, 100);
this->graphicsView->setScene(&scene);
// Turn the vertical axis upside down
this->graphicsView->matrix().scale(1, -1);
// The navigation adds zooming and translation functionality to the
// QGraphicsView
this->addNavigation(this->graphicsView);
this->setupStatusBar();
this->setupOptionsMenu();
this->addAboutDemo(":/cgal/help/about_Stream_lines_2.html");
this->addAboutCGAL();
this->addRecentFiles(this->menuFile, this->actionQuit);
connect(this, SIGNAL(openRecentFile(QString)),
this, SLOT(open(QString)));
}
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
*/
void
MainWindow::on_actionClear_triggered()
{
emit(changed());
}
void
MainWindow::on_actionGenerate_triggered()
{
stream_lines = new Stream_lines(*regular_grid, *runge_kutta_integrator, density, ratio, sampling);
sli = new CGAL::Qt::StreamLinesGraphicsItem<Stream_lines, K>(stream_lines);
QObject::connect(this, SIGNAL(changed()),
sli, SLOT(modelChanged()));
//sli->setVerticesPen(QPen(Qt::red, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
sli->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
scene.addItem(sli);
emit(changed());
}
void
MainWindow::on_actionLoadPoints_triggered()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open grid file"),
".");
if(! fileName.isEmpty()){
open(fileName);
}
}
void
MainWindow::open(QString fileName)
{
// wait cursor
QApplication::setOverrideCursor(Qt::WaitCursor);
std::ifstream ifs(qPrintable(fileName));
runge_kutta_integrator = new Runge_kutta_integrator(integrating);
double iXSize, iYSize;
iXSize = iYSize = 512;
unsigned int x_samples, y_samples;
ifs >> x_samples;
ifs >> y_samples;
regular_grid = new Regular_grid(x_samples, y_samples, iXSize, iYSize);
std::cerr << "fill grid" << std::endl;
/*fill the grid with the appropreate values*/
for (unsigned int i=0;i<x_samples;i++)
for (unsigned int j=0;j<y_samples;j++)
{
double xval, yval;
ifs >> xval;
ifs >> yval;
regular_grid->set_field(i, j, Vector(xval, yval));
}
ifs.close();
std::cerr << "close the stream" << std::endl;
// default cursor
QApplication::restoreOverrideCursor();
this->addToRecentFiles(fileName);
// actionRecenter->trigger();
on_actionGenerate_triggered();
emit(changed());
}
void
MainWindow::on_actionSavePoints_triggered()
{
/*
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save points"),
".");
if(! fileName.isEmpty()){
std::ofstream ofs(qPrintable(fileName));
}
*/
}
void
MainWindow::on_actionRecenter_triggered()
{
this->graphicsView->setSceneRect(sli->boundingRect());
this->graphicsView->fitInView(sli->boundingRect(), Qt::KeepAspectRatio);
}
#include "Stream_lines_2.moc"
int main(int argc, char **argv)
{
QApplication app(argc, argv);
app.setOrganizationDomain("geometryfactory.com");
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Stream_lines_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
Q_INIT_RESOURCE(File);
Q_INIT_RESOURCE(Stream_lines_2);
Q_INIT_RESOURCE(Input);
Q_INIT_RESOURCE(CGAL);
MainWindow mainWindow;
mainWindow.show();
return app.exec();
}

View File

@ -1,8 +0,0 @@
<RCC>
<qresource prefix="/cgal/Actions" >
</qresource>
<qresource prefix="/cgal/help" >
<file alias="about_CGAL.html" >../resources/about_CGAL.html</file>
<file>about_Stream_lines_2.html</file>
</qresource>
</RCC>

View File

@ -1,213 +0,0 @@
<ui version="4.0" >
<author>GeometryFactory</author>
<class>Stream_lines_2</class>
<widget class="QMainWindow" name="Stream_lines_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle" >
<string>CGAL Streamlines</string>
</property>
<property name="windowIcon" >
<iconset resource="../resources/CGAL.qrc" >
<normaloff>:/cgal/logos/cgal_icon</normaloff>:/cgal/logos/cgal_icon</iconset>
</property>
<widget class="QWidget" name="centralwidget" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QGraphicsView" name="graphicsView" >
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
<property name="verticalScrollBarPolicy" >
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy" >
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="transformationAnchor" >
<enum>QGraphicsView::NoAnchor</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar" />
<widget class="QToolBar" name="fileToolBar" >
<property name="windowTitle" >
<string>File Tools</string>
</property>
<attribute name="toolBarArea" >
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<bool>false</bool>
</attribute>
<addaction name="actionClear" />
<addaction name="actionLoadPoints" />
<addaction name="actionSavePoints" />
</widget>
<widget class="QToolBar" name="toolBar" >
<property name="windowTitle" >
<string>Visualization Tools</string>
</property>
<attribute name="toolBarArea" >
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<bool>false</bool>
</attribute>
<addaction name="actionInsertPoint" />
<addaction name="actionRecenter" />
</widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="menuFile" >
<property name="title" >
<string>&amp;File</string>
</property>
<addaction name="separator" />
<addaction name="actionClear" />
<addaction name="actionLoadPoints" />
<addaction name="actionSavePoints" />
<addaction name="separator" />
<addaction name="actionQuit" />
</widget>
<widget class="QMenu" name="menuEdit" >
<property name="title" >
<string>&amp;Edit</string>
</property>
<addaction name="actionInsertRandomPoints" />
</widget>
<widget class="QMenu" name="menuTools" >
<property name="title" >
<string>&amp;Tools</string>
</property>
<addaction name="actionInsertPoint" />
<addaction name="separator" />
<addaction name="actionRecenter" />
</widget>
<addaction name="menuFile" />
<addaction name="menuEdit" />
<addaction name="menuTools" />
</widget>
<action name="actionAbout" >
<property name="text" >
<string>&amp;About</string>
</property>
</action>
<action name="actionAboutCGAL" >
<property name="text" >
<string>About &amp;CGAL</string>
</property>
</action>
<action name="actionQuit" >
<property name="text" >
<string>&amp;Quit</string>
</property>
<property name="shortcut" >
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionInsertRandomPoints" >
<property name="text" >
<string>&amp;Insert random points</string>
</property>
<property name="shortcut" >
<string>Ctrl+I</string>
</property>
</action>
<action name="actionInsertPoint" >
<property name="checkable" >
<bool>true</bool>
</property>
<property name="checked" >
<bool>false</bool>
</property>
<property name="icon" >
<iconset resource="../icons/Input.qrc" >
<normaloff>:/cgal/Input/inputPoint.png</normaloff>:/cgal/Input/inputPoint.png</iconset>
</property>
<property name="text" >
<string>&amp;Insert Point</string>
</property>
<property name="toolTip" >
<string>Insert Point</string>
</property>
<property name="statusTip" >
<string>Left: Insert vtx</string>
</property>
</action>
<action name="actionClear" >
<property name="icon" >
<iconset resource="../icons/File.qrc" >
<normaloff>:/cgal/fileToolbar/fileNew.png</normaloff>:/cgal/fileToolbar/fileNew.png</iconset>
</property>
<property name="text" >
<string>&amp;Clear</string>
</property>
<property name="shortcut" >
<string>Ctrl+C</string>
</property>
</action>
<action name="actionLoadPoints" >
<property name="icon" >
<iconset resource="../icons/File.qrc" >
<normaloff>:/cgal/fileToolbar/fileOpen.png</normaloff>:/cgal/fileToolbar/fileOpen.png</iconset>
</property>
<property name="text" >
<string>&amp;Load Points...</string>
</property>
<property name="shortcut" >
<string>Ctrl+L</string>
</property>
</action>
<action name="actionSavePoints" >
<property name="icon" >
<iconset resource="../icons/File.qrc" >
<normaloff>:/cgal/fileToolbar/fileSave.png</normaloff>:/cgal/fileToolbar/fileSave.png</iconset>
</property>
<property name="text" >
<string>&amp;Save Points...</string>
</property>
<property name="shortcut" >
<string>Ctrl+S</string>
</property>
</action>
<action name="actionRecenter" >
<property name="icon" >
<iconset resource="../icons/Input.qrc" >
<normaloff>:/cgal/Input/zoom-best-fit</normaloff>:/cgal/Input/zoom-best-fit</iconset>
</property>
<property name="text" >
<string>Re&amp;center the viewport</string>
</property>
<property name="shortcut" >
<string>Ctrl+R</string>
</property>
</action>
</widget>
<resources>
<include location="Stream_lines_2.qrc" />
<include location="../icons/File.qrc" />
<include location="../resources/CGAL.qrc" />
<include location="../icons/Input.qrc" />
</resources>
<connections/>
</ui>

View File

@ -1,9 +0,0 @@
<html>
<body>
<h2>Apollonius Graph</h2>
<p>Copyright &copy; 2010 GeometryFactory</p>
<p>This application illustrates the 2D Apollonius graph.</p>
<p>See also <a href="http://www.cgal.org/Pkg/ApolloniusGraph2">the online
manual</a>.</p>
</body>
</html>