|
From: <le...@us...> - 2007-01-15 19:26:05
|
Revision: 177
http://svn.sourceforge.net/qcell/?rev=177&view=rev
Author: lessm
Date: 2007-01-15 11:26:00 -0800 (Mon, 15 Jan 2007)
Log Message:
-----------
- edit Tools start to work
Modified Paths:
--------------
trunk/qcell/baseheaders/simulationwindow.h
trunk/qcell/basesources/simulationwindow.cpp
Modified: trunk/qcell/baseheaders/simulationwindow.h
===================================================================
--- trunk/qcell/baseheaders/simulationwindow.h 2007-01-15 17:49:58 UTC (rev 176)
+++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-15 19:26:00 UTC (rev 177)
@@ -69,6 +69,8 @@
CalculationData localView;
bool localViewFlag;
+ QList< QVector<int> > dataToCopy;
+
virtual void mouseMoveEvent(QMouseEvent * event);
virtual void mousePressEvent(QMouseEvent * event);
virtual void wheelEvent(QWheelEvent * event);
@@ -121,11 +123,12 @@
void view3DselectedObject(int x, int y, int z);
-//signals:
-// void progressUpdate(int val);
+
+public:
+ void storeSelectedData(void);
+ void pasteStoredData(void);
-
};
#endif // SIMULATIONWINDOW_H
Modified: trunk/qcell/basesources/simulationwindow.cpp
===================================================================
--- trunk/qcell/basesources/simulationwindow.cpp 2007-01-15 17:49:58 UTC (rev 176)
+++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-15 19:26:00 UTC (rev 177)
@@ -1114,8 +1114,11 @@
switch(cmd)
{
case 0:
+ storeSelectedData();
break;
case 1:
+ if(!dataToCopy.isEmpty())
+ pasteStoredData();
break;
case 2:
if(workMode==0)
@@ -1157,3 +1160,118 @@
}
}
+void simulationWindow::storeSelectedData(void)
+{
+ int xofset=0, yofset=0, zofset=0;
+ bool test = 0;
+ QTableWidgetItem *item;
+ QVector<int> coords;
+ coords.resize(4);
+ dataToCopy.clear();
+ if(ui.view1D->isVisible())
+ {
+ coords[1] = coords[2] = 0;
+ for(int x=0;x<getStorage()->getSizeX();++x)
+ {
+ item = table1D->item(0, x);
+ if(item->isSelected())
+ {
+ if(!test)
+ {
+ xofset = x;
+ test=1;
+ }
+ coords[0] = x - xofset;
+ coords[3] = getStorage()->getValueAt_i(x);
+ dataToCopy<<coords;
+ }
+ }
+ }
+
+ if(ui.view2D->isVisible())
+ {
+ for(int y=0;y<getStorage()->getSizeY();++y)
+ {
+ for(int x=0;x<getStorage()->getSizeX();++x)
+ {
+ item = table2D->item(y, x);
+ if(item->isSelected())
+ {
+ if(!test)
+ {
+ xofset = x;
+ yofset = y;
+ test=1;
+ }
+ coords[0] = x - xofset;
+ coords[1] = y - yofset;
+ coords[3] = getStorage()->getValueAt_i(x, y, z_plane);
+ dataToCopy<<coords;
+ }
+ }
+ }
+ }
+
+ if(ui.view3D->isVisible())
+ {
+
+ }
+}
+
+void simulationWindow::pasteStoredData(void)
+{
+ QVector<int> temp;
+ QVector<int> offset;
+ temp.resize(4);
+ if(ui.view1D->isVisible())
+ {
+ for(int x=0;x<getStorage()->getSizeX();++x)
+ {
+ if(table1D->item(0, x)->isSelected())
+ {
+ offset.resize(3);
+ offset[0] = x;
+ offset[1] = 0;
+ offset[2] = 0;
+ break;
+ }
+ }
+ }
+
+ if(ui.view2D->isVisible())
+ {
+ for(int y=0;y<getStorage()->getSizeY();++y)
+ {
+ for(int x=0;x<getStorage()->getSizeX();++x)
+ {
+ if(table2D->item(y, x)->isSelected())
+ {
+ offset.resize(3);
+ offset[0] = x;
+ offset[1] = y;
+ offset[2] = z_plane;
+ break;
+ }
+ }
+ if(!offset.isEmpty())
+ break;
+ }
+ }
+
+ if(ui.view3D->isVisible())
+ {
+ offset = renderer->getSelectedCoord();
+ }
+
+ if(!offset.isEmpty())
+ {
+ foreach(temp, dataToCopy)
+ {
+ if((offset[0] + temp[0])<getStorage()->getSizeX() && (offset[1] + temp[1])<getStorage()->getSizeY() && (offset[2] + temp[2])<getStorage()->getSizeZ())
+ getStorage()->setValueAt(temp[3], offset[0] + temp[0], offset[1] + temp[1], offset[2] + temp[2]);
+ }
+ table2DUpdateRequest = table1DUpdateRequest = graph2DUpdateRequest = 1;
+ renderer->repaint();
+ 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.
|