|
From: <le...@us...> - 2007-01-07 21:00:58
|
Revision: 118
http://svn.sourceforge.net/qcell/?rev=118&view=rev
Author: lessm
Date: 2007-01-07 13:00:56 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
- new view add
Modified Paths:
--------------
trunk/qcell/baseheaders/Renderer.h
trunk/qcell/baseheaders/simulationwindow.h
trunk/qcell/baseheaders/simulationwindow.ui
trunk/qcell/basesources/Renderer.cpp
trunk/qcell/basesources/simulationwindow.cpp
Modified: trunk/qcell/baseheaders/Renderer.h
===================================================================
--- trunk/qcell/baseheaders/Renderer.h 2007-01-07 20:55:11 UTC (rev 117)
+++ trunk/qcell/baseheaders/Renderer.h 2007-01-07 21:00:56 UTC (rev 118)
@@ -10,7 +10,7 @@
#include <QImage>
#include <QPainter>
#include <QObject>
-#include <QtOpenGL>
+#include <QtOpengl>
#include <QPixmap>
#include <QChar>
@@ -34,6 +34,7 @@
QImage *imageBuffer;
QPainter painter;
bool discretValues;
+ bool corectPerspective;
QVector<GLuint> primitives;
QVector<double> rotation, translation;
@@ -90,6 +91,9 @@
CalculationData * getStorage(void);
+ void setOrtoPerspective(void);
+ void setRealPerspective(void);
+
protected slots:
void resizeDataEvent(void);
};
Modified: trunk/qcell/baseheaders/simulationwindow.h
===================================================================
--- trunk/qcell/baseheaders/simulationwindow.h 2007-01-07 20:55:11 UTC (rev 117)
+++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-07 21:00:56 UTC (rev 118)
@@ -60,8 +60,8 @@
simulationWindow(QWidget *parent = 0);
~simulationWindow();
- Renderer *getRenderer();
- CalculationData *getStorage();
+ Renderer *getRenderer();
+ CalculationData *getStorage();
protected slots:
void zPlaneChange(int i);
@@ -77,6 +77,9 @@
void addSymbol(void);
void removeSymbol(void);
+ void corectPerspectve(void);
+ void orthoPerspective(void);
+
signals:
void progressUpdate(int val);
Modified: trunk/qcell/baseheaders/simulationwindow.ui
===================================================================
--- trunk/qcell/baseheaders/simulationwindow.ui 2007-01-07 20:55:11 UTC (rev 117)
+++ trunk/qcell/baseheaders/simulationwindow.ui 2007-01-07 21:00:56 UTC (rev 118)
@@ -1,22 +1,6 @@
<ui version="4.0" >
<class>simulationWindowClass</class>
<widget class="QWidget" name="simulationWindowClass" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>100</width>
- <height>30</height>
- </rect>
- </property>
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
<property name="windowTitle" >
<string>simulationWindow</string>
</property>
@@ -36,12 +20,41 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex" >
- <number>1</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="view3D" >
<attribute name="title" >
<string>3D View</string>
</attribute>
+ <widget class="QRadioButton" name="perspectiveView" >
+ <property name="geometry" >
+ <rect>
+ <x>20</x>
+ <y>10</y>
+ <width>83</width>
+ <height>18</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Perspective</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="ortho2DView" >
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>10</y>
+ <width>83</width>
+ <height>18</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Ortho2D</string>
+ </property>
+ </widget>
</widget>
<widget class="QWidget" name="view2D" >
<attribute name="title" >
Modified: trunk/qcell/basesources/Renderer.cpp
===================================================================
--- trunk/qcell/basesources/Renderer.cpp 2007-01-07 20:55:11 UTC (rev 117)
+++ trunk/qcell/basesources/Renderer.cpp 2007-01-07 21:00:56 UTC (rev 118)
@@ -206,10 +206,12 @@
{
glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(75.0f, (GLdouble)width / (GLdouble)height, 0.1f, 1000.0f);
- glMatrixMode(GL_MODELVIEW);
+ if(corectPerspective)
+ setRealPerspective();
+ else
+ setOrtoPerspective();
+
+
}
Renderer::Renderer(QWidget *parent) : QGLWidget(parent)
@@ -235,7 +237,7 @@
rotation.resize(3);
greed = 0;
-
+ corectPerspective = 1;
connect(&storage, SIGNAL(dataResized()), SLOT(resizeDataEvent()));
}
@@ -569,8 +571,29 @@
void Renderer::resizeDataEvent(void)
{
-
if(greed>0)
glDeleteLists(greed, 1);
greed = 0;
-}
\ No newline at end of file
+
+ if(!corectPerspective)
+ setOrtoPerspective();
+}
+
+void Renderer::setOrtoPerspective(void)
+{
+ float aspect = (float)width()/(float)height();
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho((-(double)storage.getSizeX() - 10.0) * aspect, ((double)storage.getSizeX() + 10.0) * aspect, -(double)storage.getSizeY() -10.0 , (double)storage.getSizeY() + 10.0, 0.0, 500.0);
+ glMatrixMode(GL_MODELVIEW);
+ corectPerspective = 0;
+}
+
+void Renderer::setRealPerspective(void)
+{
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(75.0f, (GLdouble)width() / (GLdouble)height(), 0.1f, 500.0f);
+ glMatrixMode(GL_MODELVIEW);
+ corectPerspective = 1;
+}
Modified: trunk/qcell/basesources/simulationwindow.cpp
===================================================================
--- trunk/qcell/basesources/simulationwindow.cpp 2007-01-07 20:55:11 UTC (rev 117)
+++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-07 21:00:56 UTC (rev 118)
@@ -80,7 +80,9 @@
ui.view2DGraph->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20);
ui.symbolConfig->resize(ui.tabWidget->width(), ui.tabWidget->height() - 20);
- renderer->resize(ui.view3D->width() - 7, ui.view3D->height() - 7);
+ renderer->move(0, 35);
+ renderer->resize(ui.view3D->width() - 7, ui.view3D->height() - 42);
+
table2D->move(0, 35);
table2D->resize(ui.view2D->width() - 7 , ui.view2D->height() - 42);
graphicsView2D->resize(ui.view2DGraph->width() - 7, ui.view2DGraph->height() - 7);
@@ -434,6 +436,9 @@
connect(ui.addSymbol, SIGNAL(clicked(bool)), SLOT(addSymbol()));
connect(ui.removeSymbol, SIGNAL(clicked(bool)), SLOT(removeSymbol()));
+ connect(ui.perspectiveView, SIGNAL(clicked(bool)), SLOT(corectPerspectve()));
+ connect(ui.ortho2DView, SIGNAL(clicked(bool)), SLOT(orthoPerspective()));
+
table2DUpdateRequest = 0;
table1DUpdateRequest = 0;
}
@@ -594,3 +599,15 @@
renderer->removeSymbol();
updateSymbolTable();
}
+
+void simulationWindow::corectPerspectve(void)
+{
+ renderer->setRealPerspective();
+ renderer->repaint();
+}
+
+void simulationWindow::orthoPerspective(void)
+{
+ renderer->setOrtoPerspective();
+ renderer->repaint();
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|