<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>HippoDraw Class Library</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="hippoApp.ico"> </head><body> <!-- Generated by Doxygen 1.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_28fb57ed95c79fe5ed14c4f71fb4c2a2.html">qt</a> </div> </div> <div class="contents"> <h1>PlotTable.cxx</h1><a href="PlotTable_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00012"></a>00012 <span class="preprocessor">#include "<a class="code" href="PlotTable_8h.html" title="hippodraw::PlotTable class interface">PlotTable.h</a>"</span> <a name="l00013"></a>00013 <a name="l00014"></a>00014 <span class="preprocessor">#include "<a class="code" href="CanvasView_8h.html" title="hippodraw::CanvasView class interface">CanvasView.h</a>"</span> <a name="l00015"></a>00015 <span class="preprocessor">#include "<a class="code" href="PlotTableEvent_8h.html" title="PlotTableEvent class interface.">PlotTableEvent.h</a>"</span> <a name="l00016"></a>00016 <span class="preprocessor">#include "<a class="code" href="QtView_8h.html" title="hippodraw::QtView class interface">QtView.h</a>"</span> <a name="l00017"></a>00017 <a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="DataRep_8h.html" title="hippodraw::DataRep class interface.">datareps/DataRep.h</a>"</span> <a name="l00019"></a>00019 <span class="preprocessor">#include "<a class="code" href="ViewBase_8h.html" title="hippodraw::ViewBase class interface">graphics/ViewBase.h</a>"</span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="PlotterBase_8h.html" title="hippodraw::PlotterBase class interface.">plotters/PlotterBase.h</a>"</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#include <qapplication.h></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <qpushbutton.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#if QT_VERSION < 0x040000</span> <a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#include <qlistview.h></span> <a name="l00026"></a>00026 <span class="preprocessor">#else</span> <a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#include <q3listview.h></span> <a name="l00028"></a>00028 <span class="preprocessor">#endif</span> <a name="l00029"></a>00029 <span class="preprocessor"></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <qstring.h></span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="preprocessor">#include <vector></span> <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="keyword">using</span> std::string; <a name="l00035"></a>00035 <span class="keyword">using</span> std::vector; <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="keyword">using namespace </span>hippodraw; <a name="l00038"></a>00038 <a name="l00039"></a>00039 PlotTable:: <a name="l00040"></a><a class="code" href="classhippodraw_1_1PlotTable.html#a23d6abfa873e969a5038fae65754d52b">00040</a> PlotTable () <a name="l00041"></a>00041 : <a class="code" href="classPlotTableBase.html" title="The base class for the PlotTable class.">PlotTableBase</a> (), <a name="l00042"></a>00042 m_observer ( 0 ), <a name="l00043"></a>00043 m_browser_mode ( false ) <a name="l00044"></a>00044 { <a name="l00045"></a>00045 } <a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="keywordtype">void</span> <a name="l00048"></a>00048 <a class="code" href="classhippodraw_1_1PlotTable.html#a0b2de321e53be52b47bd66232372aeb4" title="Sets the canvas to be used by the table.">PlotTable::</a> <a name="l00049"></a><a class="code" href="classhippodraw_1_1PlotTable.html#a0b2de321e53be52b47bd66232372aeb4">00049</a> <a class="code" href="classhippodraw_1_1PlotTable.html#a0b2de321e53be52b47bd66232372aeb4" title="Sets the canvas to be used by the table.">setCanvas</a> ( <a class="code" href="classhippodraw_1_1CanvasView.html" title="This class implements additional FigureEditor functionality particular to QtView...">CanvasView</a> * canvas ) <a name="l00050"></a>00050 { <a name="l00051"></a>00051 <a class="code" href="classhippodraw_1_1PlotTable.html#ad6e6c8077e603e04ca6db53b58fb0900" title="The canvas that is currently being used.">m_canvas_view</a> = canvas; <a name="l00052"></a>00052 <a class="code" href="classhippodraw_1_1PlotTable.html#a25a40b6614565f755233080a384c35f1" title="Initialized the table.">initialize</a> (); <a name="l00053"></a>00053 } <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="keywordtype">void</span> <a name="l00056"></a>00056 <a class="code" href="classhippodraw_1_1PlotTable.html#a25a40b6614565f755233080a384c35f1" title="Initialized the table.">PlotTable::</a> <a name="l00057"></a><a class="code" href="classhippodraw_1_1PlotTable.html#a25a40b6614565f755233080a384c35f1">00057</a> <a class="code" href="classhippodraw_1_1PlotTable.html#a25a40b6614565f755233080a384c35f1" title="Initialized the table.">initialize</a> () <a name="l00058"></a>00058 { <a name="l00059"></a>00059 <a class="code" href="classPlotTableBase.html#a4e21bd8af0c37d2968e92a8b62989996">m_plot_table</a>-><a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qlistview.html#clear">clear</a>(); <a name="l00060"></a>00060 <a name="l00061"></a>00061 <span class="keyword">const</span> vector < const ViewBase * > & views = <a class="code" href="classhippodraw_1_1PlotTable.html#ad6e6c8077e603e04ca6db53b58fb0900" title="The canvas that is currently being used.">m_canvas_view</a>-><a class="code" href="classhippodraw_1_1CanvasView.html#a1ded918fda8c42bd2a74d847d8052c9c" title="Returns temporary list of all QtView objects on the canvas.">views</a> (); <a name="l00062"></a>00062 vector < const ViewBase * > :: const_iterator first = views.begin (); <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="keywordflow">while</span> ( first != views.end () ) { <a name="l00065"></a>00065 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1ViewBase.html" title="The abstract base class for views.">ViewBase</a> * view = *first++; <a name="l00066"></a>00066 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1PlotterBase.html" title="The base class for the PlotterBase hierarchy.">PlotterBase</a> * plotter = view-><a class="code" href="classhippodraw_1_1ViewBase.html#a78aa09930b4007dfa886e1ecb2dbf57b" title="Returns the plotter used by this view.">getPlotter</a> (); <a name="l00067"></a>00067 <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qstring.html">QString</a> title ( plotter-><a class="code" href="classhippodraw_1_1PlotterBase.html#a5c6c10f52e919ac9799a63f799c44760" title="Gets the title to be displayed.">getTitle</a> ().c_str() ); <a name="l00068"></a>00068 <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qstring.html">QString</a> x_axis ( plotter-><a class="code" href="classhippodraw_1_1PlotterBase.html#aa4e1c99a43c56d2b631cea4f039c8f91" title="Returns the label for the specified axis.">getLabel</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a58833a3110c570fb05130d40c365d1e4" title="X axis.">Axes::X</a> ).c_str() ); <a name="l00069"></a>00069 <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qstring.html">QString</a> y_axis ( plotter-><a class="code" href="classhippodraw_1_1PlotterBase.html#aa4e1c99a43c56d2b631cea4f039c8f91" title="Returns the label for the specified axis.">getLabel</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7a5596231eabd6cf29050967d5ac83ad84" title="Y axis.">Axes::Y</a> ).c_str() ); <a name="l00070"></a>00070 <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qstring.html">QString</a> z_axis ( QString::null ); <a name="l00071"></a>00071 <span class="keywordflow">if</span> ( plotter-><a class="code" href="classhippodraw_1_1PlotterBase.html#a0d9e4bd8bdbab8f6b817cb804da4db7a" title="Returns true if the plotter has an axis of specified type.">hasAxis</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7aa70478ce277ffc322f8e1e3418e07355" title="Z axis.">Axes::Z</a> ) ) { <a name="l00072"></a>00072 <span class="keyword">const</span> <span class="keywordtype">string</span> & z = plotter-><a class="code" href="classhippodraw_1_1PlotterBase.html#aa4e1c99a43c56d2b631cea4f039c8f91" title="Returns the label for the specified axis.">getLabel</a> ( <a class="code" href="namespacehippodraw_1_1Axes.html#a1d1cfd8ffb84e947f82999c682b666a7aa70478ce277ffc322f8e1e3418e07355" title="Z axis.">Axes::Z</a> ); <a name="l00073"></a>00073 z_axis = z.c_str(); <a name="l00074"></a>00074 } <a name="l00075"></a>00075 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1DataRep.html" title="The base class for data representations.">DataRep</a> * rep = plotter-><a class="code" href="classhippodraw_1_1PlotterBase.html#a4b915f5fbccdb544a5de6b3e72dbec84" title="Returns the specified DataRep or null pointer if it doesn&#39;t exits.">getDataRep</a> ( 0 ); <a name="l00076"></a>00076 <span class="keyword">const</span> <span class="keywordtype">string</span> & t = rep-><a class="code" href="classhippodraw_1_1DataRep.html#a11c23a386abb9eb8a42f0c2c2835d640" title="Returns the name of the display.">name</a> (); <a name="l00077"></a>00077 <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qstring.html">QString</a> <a class="code" href="namespacenum__util.html#af7e893a8c6a5f6a426480fc85cda4fa1">type</a> ( t.c_str() ); <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="preprocessor">#if QT_VERSION < 0x040000</span> <a name="l00080"></a>00080 <span class="preprocessor"></span> <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qlistviewitem.html">QListViewItem</a> * item <a name="l00081"></a>00081 = <span class="keyword">new</span> <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qlistviewitem.html">QListViewItem</a> ( <a class="code" href="classPlotTableBase.html#a4e21bd8af0c37d2968e92a8b62989996">m_plot_table</a>, <a name="l00082"></a>00082 title, <a class="code" href="namespacenum__util.html#af7e893a8c6a5f6a426480fc85cda4fa1">type</a>, <a name="l00083"></a>00083 x_axis, y_axis, z_axis ); <a name="l00084"></a>00084 <a class="code" href="classhippodraw_1_1PlotTable.html#a3f796f523f3772cd16a051e6a03dd169" title="A map to associate a QListViewItem with its ViewBase.">m_view_map</a> [ item ] = view; <a name="l00085"></a>00085 <span class="preprocessor">#else</span> <a name="l00086"></a>00086 <span class="preprocessor"></span> Q3ListViewItem * item <a name="l00087"></a>00087 = <span class="keyword">new</span> Q3ListViewItem ( <a class="code" href="classPlotTableBase.html#a4e21bd8af0c37d2968e92a8b62989996">m_plot_table</a>, <a name="l00088"></a>00088 title, <a class="code" href="namespacenum__util.html#af7e893a8c6a5f6a426480fc85cda4fa1">type</a>, <a name="l00089"></a>00089 x_axis, y_axis, z_axis ); <a name="l00090"></a>00090 <a class="code" href="classhippodraw_1_1PlotTable.html#a3f796f523f3772cd16a051e6a03dd169" title="A map to associate a QListViewItem with its ViewBase.">m_view_map</a> [ item ] = view; <a name="l00091"></a>00091 <span class="preprocessor">#endif</span> <a name="l00092"></a>00092 <span class="preprocessor"></span> } <a name="l00093"></a>00093 } <a name="l00094"></a>00094 <a name="l00095"></a>00095 <span class="keywordtype">void</span> <a name="l00096"></a>00096 <a class="code" href="classhippodraw_1_1PlotTable.html" title="A derived class of PlotTableBase class which is generated by the Qt designer.">PlotTable</a>:: <a name="l00097"></a>00097 <span class="preprocessor">#if QT_VERSION < 0x040000</span> <a name="l00098"></a><a class="code" href="classhippodraw_1_1PlotTable.html#adc8f7bdb177a9010355a049d882cc726">00098</a> <span class="preprocessor"></span>selectionChanged ( <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qlistviewitem.html">QListViewItem</a> * item ) <a name="l00099"></a>00099 <span class="preprocessor">#else</span> <a name="l00100"></a>00100 <span class="preprocessor"></span>selectionChanged ( Q3ListViewItem * item ) <a name="l00101"></a>00101 <span class="preprocessor">#endif</span> <a name="l00102"></a>00102 <span class="preprocessor"></span>{ <a name="l00103"></a>00103 <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1ViewBase.html" title="The abstract base class for views.">ViewBase</a> * view = m_view_map [ item ]; <a name="l00104"></a>00104 <a class="code" href="classhippodraw_1_1ViewBase.html" title="The abstract base class for views.">ViewBase</a> * v = const_cast < <a class="code" href="classhippodraw_1_1ViewBase.html" title="The abstract base class for views.">ViewBase</a> * > ( view ); <a name="l00105"></a>00105 <a class="code" href="classhippodraw_1_1QtView.html" title="The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas...">QtView</a> * vv = dynamic_cast < <a class="code" href="classhippodraw_1_1QtView.html" title="The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas...">QtView</a> * > ( v ); <a name="l00106"></a>00106 <a name="l00107"></a>00107 m_canvas_view -> setSelectedItem ( vv ); <a name="l00108"></a>00108 m_canvas_view -> ensureVisible ( vv ); <a name="l00109"></a>00109 <span class="keywordflow">if</span> ( m_browser_mode ) { <a name="l00110"></a>00110 copyButton -> setEnabled ( <span class="keyword">true</span> ); <a name="l00111"></a>00111 } <a name="l00112"></a>00112 } <a name="l00113"></a>00113 <a name="l00114"></a>00114 <span class="keywordtype">void</span> <a name="l00115"></a>00115 <a class="code" href="classhippodraw_1_1PlotTable.html#a400d529c3a2184cf9c7bafcce9d21b34" title="Sets the mode of the plot table.">PlotTable::</a> <a name="l00116"></a><a class="code" href="classhippodraw_1_1PlotTable.html#a400d529c3a2184cf9c7bafcce9d21b34">00116</a> <a class="code" href="classhippodraw_1_1PlotTable.html#a400d529c3a2184cf9c7bafcce9d21b34" title="Sets the mode of the plot table.">setBrowserMode</a> ( <span class="keywordtype">bool</span> yes, <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qwidget.html">QWidget</a> * observer ) <a name="l00117"></a>00117 { <a name="l00118"></a>00118 <a class="code" href="classhippodraw_1_1PlotTable.html#ada987e7b9313b7840454ea14032139a4" title="The mode of the plot table.">m_browser_mode</a> = yes; <a name="l00119"></a>00119 <a class="code" href="classhippodraw_1_1PlotTable.html#a25c7f594d46777f8be4475e4c17e9b9a" title="The Window that initiated the browsing, if any.">m_observer</a> = observer; <a name="l00120"></a>00120 <span class="keywordflow">if</span> ( yes == <span class="keyword">false</span> ) <a class="code" href="classPlotTableBase.html#acc2eecab2e63e8d722744871c443e6f7">copyButton</a> -> setEnabled ( yes ); <a name="l00121"></a>00121 } <a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="keywordtype">void</span> <a name="l00124"></a>00124 <a class="code" href="classhippodraw_1_1PlotTable.html#a39eb52a4c32b90c857a42b2ad9cbba95" title="Responds to click on copy button.">PlotTable::</a> <a name="l00125"></a><a class="code" href="classhippodraw_1_1PlotTable.html#a39eb52a4c32b90c857a42b2ad9cbba95">00125</a> <a class="code" href="classhippodraw_1_1PlotTable.html#a39eb52a4c32b90c857a42b2ad9cbba95" title="Responds to click on copy button.">copyButton_clicked</a> () <a name="l00126"></a>00126 { <a name="l00127"></a>00127 <a class="code" href="classhippodraw_1_1PlotTable.html#ad6e6c8077e603e04ca6db53b58fb0900" title="The canvas that is currently being used.">m_canvas_view</a> -> copySelectedToPasteboard (); <a name="l00128"></a>00128 <a name="l00129"></a>00129 <a class="code" href="classhippodraw_1_1PlotTableEvent.html" title="A derived class of QCustomEvent PlotTable events.">PlotTableEvent</a> * <span class="keyword">event</span> = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1PlotTableEvent.html" title="A derived class of QCustomEvent PlotTable events.">PlotTableEvent</a> ( <a class="code" href="classhippodraw_1_1PlotTableEvent.html#a1d1cfd8ffb84e947f82999c682b666a7aad81934e8f3b9399beea932f0b0e57d8">PlotTableEvent::Copy</a> ); <a name="l00130"></a>00130 <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qapplication.html#postEvent">QApplication::postEvent</a> ( <a class="code" href="classhippodraw_1_1PlotTable.html#a25c7f594d46777f8be4475e4c17e9b9a" title="The Window that initiated the browsing, if any.">m_observer</a>, event ); <a name="l00131"></a>00131 } <a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="keywordtype">void</span> <a name="l00134"></a>00134 <a class="code" href="classhippodraw_1_1PlotTable.html#af9e7d042c8ba30ebe94d1c8f07ab7b24" title="Response to click on close button.">PlotTable::</a> <a name="l00135"></a><a class="code" href="classhippodraw_1_1PlotTable.html#af9e7d042c8ba30ebe94d1c8f07ab7b24">00135</a> <a class="code" href="classhippodraw_1_1PlotTable.html#af9e7d042c8ba30ebe94d1c8f07ab7b24" title="Response to click on close button.">closeButton_clicked</a> () <a name="l00136"></a>00136 { <a name="l00137"></a>00137 <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1PlotTable.html#ada987e7b9313b7840454ea14032139a4" title="The mode of the plot table.">m_browser_mode</a> ) { <a name="l00138"></a>00138 <a class="code" href="classhippodraw_1_1PlotTableEvent.html" title="A derived class of QCustomEvent PlotTable events.">PlotTableEvent</a> * <span class="keyword">event</span> = <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1PlotTableEvent.html" title="A derived class of QCustomEvent PlotTable events.">PlotTableEvent</a> ( <a class="code" href="classhippodraw_1_1PlotTableEvent.html#a1d1cfd8ffb84e947f82999c682b666a7ab0d2fc8a61cc30fce240ad6df88447d4">PlotTableEvent::Close</a> ); <a name="l00139"></a>00139 <a class="codeRef" doxygen="qt.tag:http://doc.trolltech.com/3.3/" href="http://doc.trolltech.com/3.3/qapplication.html#postEvent">QApplication::postEvent</a> ( <a class="code" href="classhippodraw_1_1PlotTable.html#a25c7f594d46777f8be4475e4c17e9b9a" title="The Window that initiated the browsing, if any.">m_observer</a>, event ); <a name="l00140"></a>00140 } <a name="l00141"></a>00141 <a class="code" href="classhippodraw_1_1PlotTable.html#ada987e7b9313b7840454ea14032139a4" title="The mode of the plot table.">m_browser_mode</a> = <span class="keyword">false</span>; <a name="l00142"></a>00142 } </pre></div></div> <hr size="1"><address style="align: right;"><small> Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0> </a> </small></address> </body> </html>