arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

SlicerInfo.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     6-20-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 
00019 ///SlicerInfo.cpp
00020 ///  simianUI
00021 
00022 #include "SlicerInfo.h"
00023 #include <qlayout.h>
00024 #include <fields/FieldProperties.h>
00025 #include <fields/FieldVecProps.h>
00026 #include <fields/FieldVecProbes.h>
00027 #include <qlineedit.h>
00028 #include <qvbox.h>
00029 #include <qlabel.h>
00030 #include <iostream>
00031 
00032 using namespace std;
00033 
00034 //////////////////////////////////////////////////////////////////////////
00035 /// construction
00036 //////////////////////////////////////////////////////////////////////////
00037 
00038 SlicerInfo::SlicerInfo(QWidget *parent, const char *name, WFlags wf)
00039 : QWidget(parent, name, wf), _tabs(new QTabWidget(this, "info tabs"))
00040 {
00041    conf();
00042 }
00043 
00044 SlicerInfo::~SlicerInfo()
00045 {
00046 
00047 }
00048 
00049 //////////////////////////////////////////////////////////////////////////
00050 //////////////////////////////////////////////////////////////////////////
00051 /// public slots
00052 //////////////////////////////////////////////////////////////////////////
00053 //////////////////////////////////////////////////////////////////////////
00054 
00055 //////////////////////////////////////////////////////////////////////////
00056 /// set volume
00057 //////////////////////////////////////////////////////////////////////////
00058 void SlicerInfo::setVolume(VolumeSP vol)
00059 {
00060    _vol = vol;
00061    if(_vol.isNull())
00062    {
00063       cerr << "null volume" << endl;
00064       return;
00065    }
00066 
00067    if(_vol->fields.getField(0).isNull())
00068    {
00069       cerr << "null field" << endl;
00070       return;
00071    }
00072    
00073    cerr << " hi trying to add a tab" << endl;
00074 
00075    int idxc = _tabs->currentPageIndex();
00076 
00077    /// replace the field info
00078    QWidget *fdel = _tabs->page(FIELD_INFO);
00079    _tabs->removePage(fdel);
00080    if(fdel && dynamic_cast<FieldVecProps*>(fdel))
00081    {
00082       delete fdel;
00083    }
00084    else cerr << " BANG BANG didn't get FieldVecProps " << endl;
00085    _tabs->insertTab(new FieldVecProps(vol,_tabs,"a real field info page"),
00086                     QString("Field info"), FIELD_INFO);
00087 
00088    /// replace the field probes
00089    FieldVecProbes *pdel = (FieldVecProbes*) _tabs->page(FIELD_PROBE);
00090    _tabs->removePage(pdel);
00091    if(pdel) delete pdel;
00092    FieldVecProbes *pnew = new FieldVecProbes(vol,_tabs,"a real field probes page");
00093    pnew->connect(this, SIGNAL(probePosChanged(int,int,int)), SLOT(setProbePos(int,int,int)));
00094    _tabs->insertTab(pnew, QString("Probe"), FIELD_PROBE);
00095 
00096    _tabs->setCurrentPage(idxc);
00097    _tabs->update();
00098    update();
00099 }
00100 
00101 
00102 //////////////////////////////////////////////////////////////////////////
00103 /// set probe pos
00104 //////////////////////////////////////////////////////////////////////////
00105 void SlicerInfo::setProbePos(int xp, int yp, int zp)
00106 {
00107    probePosChanged(xp,yp,zp);
00108 }
00109 
00110 //////////////////////////////////////////////////////////////////////////
00111 //////////////////////////////////////////////////////////////////////////
00112 /// Protected Members
00113 //////////////////////////////////////////////////////////////////////////
00114 //////////////////////////////////////////////////////////////////////////
00115 
00116 //////////////////////////////////////////////////////////////////////////
00117 /// configure
00118 //////////////////////////////////////////////////////////////////////////
00119 void SlicerInfo::conf()
00120 {
00121    // Create a layout to position the widgets
00122    QHBoxLayout *topLayout = new QHBoxLayout( this, 1 );
00123    
00124    ///setCentralWidget(_tabs);
00125    
00126    topLayout->addWidget(_tabs);
00127 
00128    _tabs->addTab(new QLabel("Simian Slicer 1.0 \n by Joe Kniss",_tabs), QString("About"));
00129 
00130    _tabs->insertTab(new FieldVecProps(VolumeSP(),_tabs,"dummy field vec"),
00131                     QString("Field info"), FIELD_INFO);
00132 
00133    _tabs->insertTab(new FieldVecProbes(VolumeSP(),_tabs,"dummy probes vec"),
00134                     QString("Probe"), FIELD_PROBE);
00135 
00136    //QVBox *_test = new QVBox(_tabs, "tester");
00137    //new QLineEdit(" some stuff", _test, "some crap");
00138    //_tabs->addTab(_test, QString("hi"));
00139 
00140 }
00141 
00142 

Send questions, comments, and bug reports to:
jmk