|
From: <le...@us...> - 2007-01-17 11:59:52
|
Revision: 180
http://svn.sourceforge.net/qcell/?rev=180&view=rev
Author: lessm
Date: 2007-01-17 03:59:50 -0800 (Wed, 17 Jan 2007)
Log Message:
-----------
- mask tools add in 3D view
Modified Paths:
--------------
trunk/qcell/baseheaders/Renderer.h
trunk/qcell/baseheaders/simulationwindow.h
trunk/qcell/baseheaders/view3dtools.h
trunk/qcell/baseheaders/view3dtools.ui
trunk/qcell/basesources/Renderer.cpp
trunk/qcell/basesources/simulationwindow.cpp
trunk/qcell/basesources/view3dtools.cpp
Modified: trunk/qcell/baseheaders/Renderer.h
===================================================================
--- trunk/qcell/baseheaders/Renderer.h 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/baseheaders/Renderer.h 2007-01-17 11:59:50 UTC (rev 180)
@@ -70,6 +70,8 @@
QVector<int> localObserverCoords;
+ QVector<int> maskValue;
+
protected:
void initializeGL();
void paintGL();
@@ -139,9 +141,11 @@
void setObserverPosition(int x, int y, int z);
QList< QVector<int> > getSelectData(void);
+ void maskSet(int x, int y, int z);
protected slots:
void resizeDataEvent(void);
+
signals:
void objectSelected(int x, int y, int z);
Modified: trunk/qcell/baseheaders/simulationwindow.h
===================================================================
--- trunk/qcell/baseheaders/simulationwindow.h 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-17 11:59:50 UTC (rev 180)
@@ -123,7 +123,7 @@
void view3DselectedObject(int x, int y, int z);
-
+ void maskChange(int x, int y, int z);
public:
void storeSelectedData(void);
Modified: trunk/qcell/baseheaders/view3dtools.h
===================================================================
--- trunk/qcell/baseheaders/view3dtools.h 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/baseheaders/view3dtools.h 2007-01-17 11:59:50 UTC (rev 180)
@@ -11,17 +11,26 @@
public:
View3DTools(QWidget *parent = 0);
~View3DTools();
+ void setRange(int x, int y, int z);
private:
Ui::View3DToolsClass ui;
int viewMode;
+ int mx, my, mz;
protected slots:
void ViewChangePerspective(void);
void ViewChangeOrtho(void);
+ void xyPress(void);
+ void zyPress(void);
+ void xzPress(void);
+ void EnablePress(void);
+ void maskValueSet(int value);
+
signals:
void ViewModeUpdated(int mode);
+ void maskSet(int x, int y, int z);
};
#endif // VIEW3DTOOLS_H
Modified: trunk/qcell/baseheaders/view3dtools.ui
===================================================================
--- trunk/qcell/baseheaders/view3dtools.ui 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/baseheaders/view3dtools.ui 2007-01-17 11:59:50 UTC (rev 180)
@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>102</width>
- <height>76</height>
+ <height>205</height>
</rect>
</property>
<property name="windowTitle" >
@@ -60,6 +60,96 @@
</property>
</widget>
</widget>
+ <widget class="QGroupBox" name="SectionGroup" >
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>70</y>
+ <width>100</width>
+ <height>131</height>
+ </rect>
+ </property>
+ <property name="title" >
+ <string>Section</string>
+ </property>
+ <widget class="QSpinBox" name="maskValue" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>100</y>
+ <width>81</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QToolButton" name="EnableButton" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Enable</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QToolButton" name="xyButton" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>40</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>xy</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QToolButton" name="zyButton" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>zy</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QToolButton" name="xzButton" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>80</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>xz</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
</widget>
<layoutdefault spacing="6" margin="11" />
<resources/>
Modified: trunk/qcell/basesources/Renderer.cpp
===================================================================
--- trunk/qcell/basesources/Renderer.cpp 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/basesources/Renderer.cpp 2007-01-17 11:59:50 UTC (rev 180)
@@ -451,6 +451,9 @@
editValue = 0;
localObserverCoords.resize(3);
showLocalObserver = 0;
+
+ maskValue.resize(3);
+ maskValue[0] = maskValue[1] = maskValue[2] = -1;
}
Renderer::~Renderer()
@@ -685,11 +688,28 @@
for(int z=0;z<storage.getSizeZ();++z)
{
+ if(maskValue[2]>-1)
+ if(maskValue[2]!=z)
+ {
+ counter += storage.getSizeY() * storage.getSizeX();
+ continue;
+ }
for(int y=storage.getSizeY();y>0;--y)
{
+ if(maskValue[1]>-1)
+ if(maskValue[1]!=storage.getSizeY()- y - 1)
+ {
+ counter += storage.getSizeY();
+ continue;
+ }
for(int x=0;x<storage.getSizeX();++x)
{
-
+ if(maskValue[0]>-1)
+ if(maskValue[0]!=x)
+ {
+ ++counter;
+ continue;
+ }
index = storage.getValueAt_i(counter);
if(index>=symbolsMap.size())
index = symbolsMap.size() - 1;
@@ -957,6 +977,13 @@
setOrtoPerspective();
}
+void Renderer::maskSet(int x, int y, int z)
+{
+ maskValue[0] = x;
+ maskValue[1] = y;
+ maskValue[2] = z;
+}
+
void Renderer::setOrtoPerspective(bool noClear)
{
float aspect = (float)width()/(float)height();
Modified: trunk/qcell/basesources/simulationwindow.cpp
===================================================================
--- trunk/qcell/basesources/simulationwindow.cpp 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-17 11:59:50 UTC (rev 180)
@@ -658,6 +658,9 @@
connect(renderer, SIGNAL(objectSelected(int, int, int)), SLOT(view3DselectedObject(int, int, int)));
storeCurentTable = NULL;
+
+ connect(view3DTools, SIGNAL(maskSet(int, int, int)), SLOT(maskChange(int, int, int)));
+
}
simulationWindow::~simulationWindow()
@@ -819,6 +822,9 @@
storeCurentTable = getStorage()->getDataPointer();
getStorage()->setForeignDataPointer(localView.getDataPointer(), 1);
}
+
+ view3DTools->setRange(getStorage()->getSizeX(), getStorage()->getSizeY(), getStorage()->getSizeZ());
+
//****************************************************
repaint();
}
@@ -1160,6 +1166,12 @@
}
}
+void simulationWindow::maskChange(int x, int y, int z)
+{
+ renderer->maskSet(x, y, z);
+ renderer->repaint();
+}
+
void simulationWindow::storeSelectedData(void)
{
int xofset=0, yofset=0, zofset=0;
Modified: trunk/qcell/basesources/view3dtools.cpp
===================================================================
--- trunk/qcell/basesources/view3dtools.cpp 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/basesources/view3dtools.cpp 2007-01-17 11:59:50 UTC (rev 180)
@@ -8,12 +8,45 @@
connect(ui.PerspectiveButton, SIGNAL(clicked(bool)), SLOT(ViewChangePerspective()));
connect(ui.OrthoButton, SIGNAL(clicked(bool)), SLOT(ViewChangeOrtho()));
+
+ connect(ui.xyButton, SIGNAL(clicked(bool)), SLOT(xyPress()));
+ connect(ui.zyButton, SIGNAL(clicked(bool)), SLOT(zyPress()));
+ connect(ui.xzButton, SIGNAL(clicked(bool)), SLOT(xzPress()));
+
+ connect(ui.EnableButton, SIGNAL(clicked(bool)), SLOT(EnablePress()));
+
+ connect(ui.maskValue, SIGNAL(valueChanged(int)), SLOT(maskValueSet(int)));
+ mx = my = mz = 0;
}
View3DTools::~View3DTools()
{
}
+void View3DTools::setRange(int x, int y, int z)
+{
+ mx = x;
+ my = y;
+ mz = z;
+
+ if(ui.xyButton->isChecked())
+ {
+ ui.maskValue->setMaximum(mz);
+ }
+
+ if(ui.zyButton->isChecked())
+ {
+ ui.maskValue->setMaximum(mx);
+ }
+
+ if(ui.xzButton->isChecked())
+ {
+ ui.maskValue->setMaximum(my);
+ }
+
+ maskValueSet(ui.maskValue->value());
+}
+
void View3DTools::ViewChangePerspective(void)
{
ui.PerspectiveButton->setChecked(1);
@@ -34,4 +67,64 @@
viewMode = 1;
emit ViewModeUpdated(1);
}
+}
+
+void View3DTools::xyPress(void)
+{
+ ui.xyButton->setChecked(1);
+ ui.zyButton->setChecked(0);
+ ui.xzButton->setChecked(0);
+ ui.maskValue->setMaximum(mz);
+ maskValueSet(ui.maskValue->value());
+}
+
+void View3DTools::zyPress(void)
+{
+ ui.xyButton->setChecked(0);
+ ui.zyButton->setChecked(1);
+ ui.xzButton->setChecked(0);
+ ui.maskValue->setMaximum(mx);
+ maskValueSet(ui.maskValue->value());
+}
+
+void View3DTools::xzPress(void)
+{
+ ui.xyButton->setChecked(0);
+ ui.zyButton->setChecked(0);
+ ui.xzButton->setChecked(1);
+ ui.maskValue->setMaximum(my);
+ maskValueSet(ui.maskValue->value());
+}
+
+void View3DTools::EnablePress(void)
+{
+ if(ui.EnableButton->isChecked())
+ {
+ maskValueSet(ui.maskValue->value());
+ }
+ else
+ {
+ emit maskSet(-1, -1, -1);
+ }
+}
+
+void View3DTools::maskValueSet(int value)
+{
+ if(ui.EnableButton->isChecked())
+ {
+ if(ui.xyButton->isChecked())
+ {
+ emit maskSet(-1, -1, value);
+ }
+
+ if(ui.zyButton->isChecked())
+ {
+ emit maskSet(value, -1, -1);
+ }
+
+ if(ui.xzButton->isChecked())
+ {
+ emit maskSet(-1, value, -1);
+ }
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|