Setting axes range and enabling/disabling zooming functionalities successfull

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@10 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-06-15 12:10:54 +00:00
parent 2b02f94fe3
commit 8246154032
14 changed files with 907 additions and 613 deletions

View File

@ -200,10 +200,26 @@
<font>
<family>Sans Serif</family>
<pointsize>11</pointsize>
<weight>75</weight>
<bold>true</bold>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
&lt;tr&gt;
&lt;td style=&quot;border: none;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#00007f;&quot;&gt;Left Click :zoom in&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#00007f;&quot;&gt;Righ&lt;/span&gt;&lt;span style=&quot; color:#00007f;&quot;&gt;t Click &lt;/span&gt;&lt;span style=&quot; color:#00007f;&quot;&gt;: zoom out by 1&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#00007f;&quot;&gt;Middle Click : panning&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#00007f;&quot;&gt;Ctrl+Right Click : zoom out to full size&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
@ -275,8 +291,8 @@
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
</widget>

View File

@ -229,7 +229,7 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Starts Acquisition</string>
<string>Starts or Stops Acquisition</string>
</property>
<property name="text">
<string>Start</string>

View File

@ -37,7 +37,7 @@
<x>10</x>
<y>135</y>
<width>751</width>
<height>141</height>
<height>136</height>
</rect>
</property>
<property name="title">
@ -62,44 +62,284 @@
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item row="1" column="0">
<widget class="QCheckBox" name="chkXAxis">
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="chkTitle">
<property name="text">
<string>X Axis:</string>
<string>Title:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="dispXAxis">
<item row="0" column="1" colspan="7">
<widget class="QLineEdit" name="dispTitle"/>
</item>
<item row="3" column="7">
<widget class="QLineEdit" name="dispZMax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>2</horstretch>
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QCheckBox" name="chkZMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Z Max:</string>
</property>
</widget>
</item>
<item row="2" column="7">
<widget class="QLineEdit" name="dispYMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="2" column="6">
<widget class="QCheckBox" name="chkYMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y Max:</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QCheckBox" name="chkXMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X Max:</string>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="QLineEdit" name="dispXMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3">
<widget class="QCheckBox" name="chkZMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Z Min:</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QLineEdit" name="dispZMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QCheckBox" name="chkXMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X min:</string>
<string>X Min:</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLineEdit" name="dispXMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QCheckBox" name="chkYMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y Min:</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLineEdit" name="dispYMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkXAxis">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X Axis:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="dispXAxis">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chkYAxis">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y Axis:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="dispYAxis">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
@ -111,113 +351,23 @@
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QCheckBox" name="chkXMax">
<property name="text">
<string>X max:</string>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="QLineEdit" name="dispXMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chkYAxis">
<property name="text">
<string>Y Axis:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="dispYAxis">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QCheckBox" name="chkYMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y min:</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLineEdit" name="dispYMin">
<item row="3" column="0">
<widget class="QCheckBox" name="chkZAxis">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="2" column="6">
<widget class="QCheckBox" name="chkYMax">
<property name="text">
<string>Y max:</string>
</property>
</widget>
</item>
<item row="2" column="7">
<widget class="QLineEdit" name="dispYMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkZAxis">
<property name="text">
<string>Z Axis:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="dispZAxis"/>
</item>
<item row="3" column="3">
<widget class="QCheckBox" name="chkZMin">
<item row="3" column="1">
<widget class="QLineEdit" name="dispZAxis">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Z min:</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QLineEdit" name="dispZMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -228,64 +378,18 @@
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QCheckBox" name="chkZMax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Z max:</string>
<property name="inputMethodHints">
<set>Qt::ImhDigitsOnly</set>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QLineEdit" name="dispZMax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="chkTitle">
<property name="text">
<string>Title:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="7">
<widget class="QLineEdit" name="dispTitle"/>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="box2D">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>150</x>
@ -308,7 +412,7 @@
<rect>
<x>10</x>
<y>20</y>
<width>451</width>
<width>496</width>
<height>22</height>
</rect>
</property>
@ -380,124 +484,6 @@
<height>46</height>
</rect>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>183</red>
<green>183</green>
<blue>183</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>171</red>
<green>171</green>
<blue>171</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>179</red>
<green>179</green>
<blue>179</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>154</red>
<green>154</green>
<blue>154</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="title">
<string>1D Plot Options</string>
</property>
@ -512,74 +498,23 @@
<rect>
<x>10</x>
<y>20</y>
<width>371</width>
<height>21</height>
<width>254</width>
<height>23</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="chktest1D">
<widget class="QCheckBox" name="chkSuperimpose">
<property name="text">
<string>Superimpose</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="btnClear">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="spinBox">
<property name="enabled">
<property name="tristate">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label">
<widget class="QLabel" name="lblPersistency">
<property name="enabled">
<bool>false</bool>
</property>
@ -604,24 +539,74 @@
</property>
</spacer>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="3">
<widget class="QSpinBox" name="spinPersistency">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<property name="maximumSize">
<size>
<width>10</width>
<height>10</height>
<width>60</width>
<height>16777215</height>
</size>
</property>
</spacer>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btnClear">
<property name="geometry">
<rect>
<x>420</x>
<y>12</y>
<width>40</width>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
<zorder>gridLayoutWidget_3</zorder>
<zorder>btnClear</zorder>
<zorder>btnClear</zorder>
<zorder>btnClear</zorder>
</widget>
<widget class="QGroupBox" name="boxSave">
<property name="geometry">
@ -671,51 +656,21 @@
<property name="frame">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>.gif</string>
</property>
</item>
<item>
<property name="text">
<string>.pdf</string>
</property>
</item>
<item>
<property name="text">
<string>.png</string>
</property>
</item>
<item>
<property name="text">
<string>.gif+</string>
</property>
</item>
<item>
<property name="text">
<string>.jpg</string>
</property>
</item>
<item>
<property name="text">
<string>.ps</string>
</property>
</item>
<item>
<property name="text">
<string>.eps</string>
</property>
</item>
<item>
<property name="text">
<string>.xpm</string>
</property>
</item>
<item>
<property name="text">
<string>.C</string>
</property>
</item>
</widget>
</item>
</layout>
@ -762,7 +717,7 @@
<x>655</x>
<y>10</y>
<width>106</width>
<height>101</height>
<height>106</height>
</rect>
</property>
<property name="title">
@ -779,8 +734,8 @@
<rect>
<x>5</x>
<y>19</y>
<width>101</width>
<height>76</height>
<width>96</width>
<height>81</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@ -810,6 +765,9 @@
<property name="text">
<string>Create</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
@ -840,7 +798,7 @@
<x>10</x>
<y>10</y>
<width>106</width>
<height>101</height>
<height>106</height>
</rect>
</property>
<property name="title">
@ -856,14 +814,14 @@
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>91</width>
<height>44</height>
<y>14</y>
<width>93</width>
<height>96</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QCheckBox" name="chktest1D_2">
<widget class="QCheckBox" name="chkNoPlot">
<property name="text">
<string>None</string>
</property>
@ -876,6 +834,13 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chktest1D_4">
<property name="text">
<string>Histogram</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -77,6 +77,7 @@ private:
enum {Measurement, Settings, DataOutput, Plot, Actions, Advanced, Debugging, Developer, NumberOfTabs };
QColor defaultTabColor;
QString zoomToolTip;
/* Scroll Area for the tabs**/
QScrollArea *scroll[NumberOfTabs];
@ -173,10 +174,12 @@ void About();
*/
void ResizeMainWindow(bool b);
/** Enables/disables tabs depending on if acquisition is currently in progress
*/
/** Enables/disables tabs depending on if acquisition is currently in progress */
void EnableTabs();
/** Set the tool tip of mouse controlled zooming depening on if its enabled/disabled*/
void SetZoomToolTip(bool disable);
protected:
void resizeEvent(QResizeEvent* event);

View File

@ -10,8 +10,9 @@
/** Project Class Headers */
class slsDetectorUtils;
#include "detectorData.h"
/** Qt Project Class Headers */
class SlsQtH1D;
#include "SlsQt1DPlot.h"
class SlsQt1DPlot;
class SlsQt2DPlotLayout;
class qCloneWidget;
@ -60,19 +61,27 @@ public:
/** sets 2D Z Axis Title */
void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;}
void SetHistXAxisScale(double min,double max){plot1D->SetXAxisScale(min,max);};
void SetHistYAxisScale(double min,double max){plot1D->SetYAxisScale(min,max);};
int GetPixelsX(){return nPixelsX;};
int GetPixelsY(){return nPixelsY;};
void Unzoom1D(){plot1D->UnZoom();};
double GetHistXAxisLowerBound(){return plot1D->GetXAxisLowerBound();};
double GetHistXAxisUpperBound(){return plot1D->GetXAxisUpperBound();};
double GetHistYAxisLowerBound(){return plot1D->GetYAxisLowerBound();};
double GetHistYAxisUpperBound(){return plot1D->GetYAxisUpperBound();};
/** Disables zoom if any of the axes range are checked and fixed with a value */
void DisableZoom(bool disable);
/** gets the progress of acquisition to the measurement tab*/
int GetProgress(){return progress;};
private:
/** The sls detector object */
slsDetectorUtils *myDet;
/** Number of Measurements */
int numberOfMeasurements;
/** Number of Exposures */
int number_of_exposures;
/** Duration between Exposures */
double framePeriod;
/** Acquisition Time */
double acquisitionTime;
/** Widgets needed to plot the clone */
/** Max Number of Clone Windows */
@ -97,17 +106,26 @@ private:
QVector<SlsQtH1D*> plot1D_hists;
/** Number of Measurements */
int numberOfMeasurements;
/** currentFrame */
static int currentFrame;
/** Number of Exposures */
static int number_of_exposures;
/** Duration between Exposures */
double framePeriod;
/** Acquisition Time */
double acquisitionTime;
/**variables for threads */
/** */
volatile bool stop_signal;
/** */
pthread_mutex_t last_image_complete_mutex;
static pthread_mutex_t last_image_complete_mutex;
/**variables for histograms */
/** 1D or 2D */
unsigned int plot_in_scope;
/** Current Image Number */
unsigned int lastImageNumber;
/** Title in 2D */
std::string imageTitle;
/** X Axis Title in 2D */
@ -116,26 +134,40 @@ private:
QString imageYAxisTitle;
/** Z Axis Title in 2D */
QString imageZAxisTitle;
/** Number of Pixels in X Axis */
unsigned int nPixelsX;
/** Number of Pixels in Y Axis */
unsigned int nPixelsY;
/** Current Image Values in 1D */
double* lastImageArray;
/** Number of graphs in 1D */
unsigned int nHists;
/** Title for all the graphs in 1D */
std::string histTitle[MAX_1DPLOTS];
static std::string histTitle[MAX_1DPLOTS];
/** X Axis Title in 1D */
QString histXAxisTitle;
/** Y Axis Title in 1D */
QString histYAxisTitle;
/** 1D or 2D */
static unsigned int plot_in_scope;
/** Number of Pixels in X Axis */
static unsigned int nPixelsX;
/** Number of Pixels in Y Axis */
static unsigned int nPixelsY;
/** Current Image Number */
static unsigned int lastImageNumber;
/** Number of graphs in 1D */
static unsigned int nHists;
/** Total Number of X axis values/channels in 1D */
int histNBins;
static int histNBins;
/** X Axis value in 1D */
double* histXAxis;
static double* histXAxis;
/** Y Axis value in 1D */
double* histYAxis[MAX_1DPLOTS];
static double* histYAxis[MAX_1DPLOTS];
/** Current Image Values in 2D */
static double* lastImageArray;
/** temporary Y Axis value in 1D */
static double* yvalues[MAX_1DPLOTS];
/** temporary Image Values in 2D */
static double* image_data;
static bool gui_acquisition_thread_running;
static int persistency;
static int currentPersistency;
static int progress;
static bool plotEnable;
/** */
@ -168,10 +200,12 @@ private:
/**acquisition thread stuff */
/** */
bool StartOrStopThread(bool start);
/** */
static void* DataAcquisionThread(void *this_pointer);
static void* DataStartAcquireThread(void *this_pointer);
/** */
void* AcquireImages();
static int GetDataCallBack(detectorData *data);
public slots:
@ -210,6 +244,14 @@ void CloseClones();
* */
void SavePlot(QString FName);
/** Sets persistency from plot tab */
void SetPersistency(int val);
/** Enables plot */
void EnablePlot(bool enable);
private slots:
/** To update plot
*/
@ -228,6 +270,8 @@ void StartDaq(bool start);
* @param id is the id of the clone
*/
void CloneCloseEvent(int id);
signals:
void UpdatingPlotFinished();
@ -236,6 +280,7 @@ void ContourSignal(bool);
void LogzSignal(bool);
};

View File

@ -46,7 +46,7 @@ private:
enum{None, Auto, Gated, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated_Start, Trigger_Window, NumTimingModes};
QTimer *progressTimer;
/** methods */
/** Sets up the widget
@ -132,6 +132,9 @@ void setNumGates(int val);
*/
void setNumProbes(int val);
/** Update progress*/
void UpdateProgress();
signals:
void StartSignal();

View File

@ -49,7 +49,6 @@ private:
static QString defaultImageYAxisTitle;
static QString defaultImageZAxisTitle;
/** methods */
/** Sets up the widget
*/
@ -65,6 +64,8 @@ private:
public slots:
@ -77,20 +78,24 @@ private slots:
*/
void Select1DPlot(bool b);
/**Sets the titles in plot axis
*/
/**Enables Persistency depending on Superimpose checkbox */
void EnablePersistency(bool enable);
/**Sets the titles in plot axis */
void SetTitles();
/** Enables/Sets Titles to default
*/
/** Enables/Sets default Titles to default */
void EnableTitles();
/** Enables range of the axes */
void EnableRange();
/** Sets the range of the axes */
void SetAxesRange();
/** Save Plot
*/
/** Save Plot */
void SavePlot();
signals:
signals:
void DisableZoomSignal(bool);
};

View File

@ -10,7 +10,7 @@
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_marker.h>
#include <qwt_scale_div.h>
#include "SlsQt1DZoomer.h"
class QPen;
@ -104,6 +104,15 @@ class SlsQt1DPlot:public QwtPlot{
void InsertVLine(double v);
void RemoveVLine();
void DisableZoom(bool disableZoom);
void SetXAxisScale(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
void SetYAxisScale(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
double GetXAxisLowerBound(){return axisScaleDiv(QwtPlot::xBottom)->lowerBound();};
double GetXAxisUpperBound(){return axisScaleDiv(QwtPlot::xBottom)->upperBound();};
double GetYAxisLowerBound(){return axisScaleDiv(QwtPlot::yLeft)->lowerBound();};
double GetYAxisUpperBound(){return axisScaleDiv(QwtPlot::yLeft)->upperBound(); };
void SetZoom(double xmin,double ymin,double x_width,double y_width);
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}

View File

@ -52,9 +52,22 @@ int SlsQtH1D::SetLineColor(int c){
static int last_color = 1;
if(c<0) c=(last_color+1)%3;
if(c==0) pen_ptr->setColor(Qt::black);
switch(c){
case 0: pen_ptr->setColor(Qt::black); break;
case 1: pen_ptr->setColor(Qt::red); break;
case 2: pen_ptr->setColor(Qt::blue); break;
case 3: pen_ptr->setColor(Qt::green); break;
case 4: pen_ptr->setColor(Qt::magenta); break;
case 5: pen_ptr->setColor(Qt::cyan); break;
case 6: pen_ptr->setColor(Qt::darkYellow); break;
case 7: pen_ptr->setColor(Qt::gray); break;
case 8: pen_ptr->setColor(Qt::darkBlue); break;
case 9: pen_ptr->setColor(Qt::darkGreen); break;
case 10: pen_ptr->setColor(Qt::darkMagenta); break;
}
/* if(c==0) pen_ptr->setColor(Qt::black);
else if(c==1) pen_ptr->setColor(Qt::red);
else pen_ptr->setColor(Qt::blue);
else pen_ptr->setColor(Qt::blue);*/
setPen(*pen_ptr);
@ -281,7 +294,8 @@ void SlsQt1DPlot::CalculateNResetZoomBase(){
void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D* h){
hist_list->Add(h);
CalculateNResetZoomBase();
if(!hist_list->Next()) UnZoom();
//commented out by dhanya to take off zooming every hist in 1d plots
//if(!hist_list->Next()) UnZoom();
Update();
}
@ -300,10 +314,14 @@ void SlsQt1DPlot::SetTitle(const char* title){
}
void SlsQt1DPlot::SetXTitle(const char* title){
setAxisTitle(QwtPlot::xBottom,title);
QwtText t(title);
t.setFont(QFont("Sans Serif",11,QFont::Normal));
setAxisTitle(QwtPlot::xBottom,t);
}
void SlsQt1DPlot::SetYTitle(const char* title){
setAxisTitle(QwtPlot::yLeft,title);
QwtText t(title);
t.setFont(QFont("Sans Serif",11,QFont::Normal));
setAxisTitle(QwtPlot::yLeft,t);
}
void SlsQt1DPlot::SetLogX(bool yes){ SetLog(QwtPlot::xBottom,yes);}
@ -438,3 +456,37 @@ void SlsQt1DPlot::UnknownStuff(){
#endif
}
void SlsQt1DPlot::DisableZoom(bool disableZoom){
#ifdef VERBOSE
if(disableZoom) cout<<"Disabling zoom"<<endl;
else cout<<"Enabling zoom"<<endl;
#endif
if(disableZoom){
if(zoomer){
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::NoButton);
#if QT_VERSION < 0x040000
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlButton);
#else
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlModifier);
#endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::NoButton);
}
if(panner) panner->setMouseButton(Qt::NoButton);
}else {
if(zoomer){
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::LeftButton);
#if QT_VERSION < 0x040000
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton);
#else
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
#endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
}
if(panner) panner->setMouseButton(Qt::MidButton);
}
}

View File

@ -141,7 +141,7 @@ for(int hist_num=0;hist_num<nHists;hist_num++){
k->setTitle(histTitle[hist_num].c_str());
k->Attach(cloneplot1D);
}
cloneplot1D->UnZoom();
//cloneplot1D->UnZoom();
}

View File

@ -169,7 +169,7 @@ void qDetectorMain::Initialization(){
connect(tabs,SIGNAL(currentChanged(int)),this, SLOT(refresh(int)));//( QWidget*)));
/** Measurement tab*/
/** Plot tab */
connect(tab_plot,SIGNAL(DisableZoomSignal(bool)),this, SLOT(SetZoomToolTip(bool)));
/** Plotting */
/** When the acquisition is finished, must update the meas tab */
@ -202,6 +202,7 @@ void qDetectorMain::Initialization(){
heightCentralWidget = centralwidget->size().height();
defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput);
zoomToolTip = dockWidgetPlot->toolTip();
}
@ -364,8 +365,11 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){
void qDetectorMain::EnableTabs(){
#ifdef VERBOSE
cout<<"Entering EnableTabs function"<<endl;
#endif
bool enable;
enable=(tabs->isTabEnabled(DataOutput)?false:true);
enable=!(tabs->isTabEnabled(DataOutput));
// or use the Enable/Disable button
/** normal tabs*/
@ -389,3 +393,12 @@ void qDetectorMain::EnableTabs(){
tabs->setTabEnabled(Developer,enable);
}
}
void qDetectorMain::SetZoomToolTip(bool disable){
if(disable)
dockWidgetPlot->setToolTip("<span style=\" color:#00007f;\">To Enable mouse-controlled zooming capabilities,\ndisable min and max for all axes.<span> ");
else
dockWidgetPlot->setToolTip(zoomToolTip);
}

View File

@ -7,11 +7,11 @@
/** Qt Project Class Headers */
#include "qDrawPlot.h"
#include "qCloneWidget.h"
#include "SlsQt1DPlot.h"
#include "SlsQt2DPlotLayout.h"
/** Project Class Headers */
#include "slsDetector.h"
#include "multiSlsDetector.h"
#include "postProcessing.h"
/** Qt Include Headers */
#include <QFont>
#include <QImage>
@ -19,12 +19,41 @@
/** C++ Include Headers */
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#define Detector_Index 0
//int numberOfMeasurements;
int qDrawPlot::currentFrame;
int qDrawPlot::number_of_exposures;
//double framePeriod;
//double acquisitionTime;
pthread_mutex_t qDrawPlot::last_image_complete_mutex;
//std::string imageTitle;
std::string qDrawPlot::histTitle[MAX_1DPLOTS];
unsigned int qDrawPlot::plot_in_scope;
unsigned int qDrawPlot::nPixelsX;
unsigned int qDrawPlot::nPixelsY;
unsigned int qDrawPlot::lastImageNumber;
unsigned int qDrawPlot::nHists;
int qDrawPlot::histNBins;
double* qDrawPlot::histXAxis;
double* qDrawPlot::histYAxis[MAX_1DPLOTS];
double* qDrawPlot::lastImageArray;
double* qDrawPlot::yvalues[MAX_1DPLOTS];
double* qDrawPlot::image_data;
bool qDrawPlot::gui_acquisition_thread_running;
int qDrawPlot::persistency;
int qDrawPlot::currentPersistency;
int qDrawPlot::progress;
bool qDrawPlot::plotEnable;
qDrawPlot::qDrawPlot(QWidget *parent,slsDetectorUtils*& detector):QWidget(parent),myDet(detector),numberOfMeasurements(1){
if(myDet) {
SetupWidgetWindow();
@ -52,40 +81,52 @@ void qDrawPlot::SetupWidgetWindow(){
#endif
stop_signal = 0;
pthread_mutex_init(&last_image_complete_mutex,NULL);
gui_acquisition_thread_running = 0;
/** Default Plotting*/
plot_in_scope = 0;
/**2d*/
lastImageNumber = 0;
nPixelsX = 0;
nPixelsY = 0;
lastImageArray = 0;
nPixelsX = 1280; nPixelsY = 100;
lastImageArray = 0;
image_data = 0;
/**1d*/
nHists = 0;
histNBins = 0;
histXAxis = 0;
for(int i=0;i<MAX_1DPLOTS;i++) histYAxis[i]=0;
persistency = 0;
currentPersistency = 0;
progress = 0;
plotEnable=true;
for(int i=0;i<MAX_1DPLOTS;i++) {histYAxis[i]=0;yvalues[i]=0; }
/*clone*/
for(int i=0;i<MAXCloneWindows;i++) winClone[i]=0;
/** Setting up window*/
setFont(QFont("Sans Serif",9));
layout = new QGridLayout;
this->setLayout(layout);
this->setLayout(layout);
boxPlot = new QGroupBox("Measurement");
layout->addWidget(boxPlot,1,1);
boxPlot->setAlignment(Qt::AlignHCenter);
boxPlot->setFont(QFont("Sans Serif",11,QFont::Bold));
layout->addWidget(boxPlot,1,1);
boxPlot->setAlignment(Qt::AlignHCenter);
boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal));
plot_update_timer = new QTimer(this);
connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot()));
/** Defaults - only for the initial picture*/
/** Default titles- only for the initial picture*/
histXAxisTitle="Channel Number";
histYAxisTitle="Counts";
for(int i=0;i<MAX_1DPLOTS;i++)
histTitle[i].assign("curve"+i);
char temp_title[2000];
for(int i=0;i<MAX_1DPLOTS;i++){
sprintf(temp_title,"Frame -%d",i);
histTitle[i] = temp_title;
}
imageTitle.assign("Start Image");
imageXAxisTitle="Pixel";
imageYAxisTitle="Pixel";
@ -93,30 +134,26 @@ void qDrawPlot::SetupWidgetWindow(){
/** setting default plot titles and settings*/
plot1D = new SlsQt1DPlot(boxPlot);
plot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
plot1D->hide();
plot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
plot1D->hide();
plot2D = new SlsQt2DPlotLayout(boxPlot);
plot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);
plot2D->SetYTitle(imageYAxisTitle);
plot2D->SetZTitle(imageZAxisTitle);
plot2D->setAlignment(Qt::AlignLeft);
plot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);
plot2D->SetYTitle(imageYAxisTitle);
plot2D->SetZTitle(imageZAxisTitle);
plot2D->setAlignment(Qt::AlignLeft);
boxPlot->setFlat(true);
//QSizePolicy sizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
//boxPlot->setSizePolicy(sizePolicy);
boxPlot->setContentsMargins(0,15,0,0);
plotLayout = new QGridLayout(boxPlot);
plotLayout->addWidget(plot1D,1,1,1,1);
plotLayout->addWidget(plot2D,1,1,1,1);
boxPlot->setContentsMargins(0,15,0,0);
plotLayout->addWidget(plot1D,1,1,1,1);
plotLayout->addWidget(plot2D,1,1,1,1);
}
@ -188,8 +225,8 @@ int qDrawPlot::ResetDaqForGui(){
bool qDrawPlot::StartOrStopThread(bool start){
static bool gui_acquisition_thread_running = 0;
static pthread_t gui_acquisition_thread;
static pthread_t gui_start_acquire_thread;
static pthread_mutex_t gui_acquisition_start_stop_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&gui_acquisition_start_stop_mutex);
@ -197,129 +234,112 @@ bool qDrawPlot::StartOrStopThread(bool start){
if(gui_acquisition_thread_running){
cout<<"Stopping current acquisition thread ...."<<endl;
stop_signal = 1;
pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits
myDet->stopAcquisition();
//pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits
gui_acquisition_thread_running = 0;
}
//start part
if(start){
/** Defaults */
currentFrame = 0;
stop_signal = 0;
histNBins = nPixelsX;
if(!image_data) image_data = new double[nPixelsX*nPixelsY];
if(!lastImageArray) lastImageArray = new double[nPixelsX*nPixelsY];
if(!histXAxis) histXAxis = new double [nPixelsX];
for(unsigned int px=0;px<nPixelsX;px++) histXAxis[px] = px+10;
if(!yvalues[0]) yvalues[0] = new double [nPixelsX];
if(!histYAxis[0]) histYAxis[0] = new double [nPixelsX];
Clear1DPlot();
cout<<"Starting new acquisition thread ...."<<endl;
gui_acquisition_thread_running = !pthread_create(&gui_acquisition_thread, NULL,qDrawPlot::DataAcquisionThread, (void*) this);
cout<<"created"<<endl;
//myDet->acquire(1);//acquiring
/** Setting the callback function to get data from software client*/
myDet->registerDataCallback(&(GetDataCallBack));
/** Start acquiring data from server */
pthread_create(&gui_start_acquire_thread, NULL,DataStartAcquireThread, (void*) this);
gui_acquisition_thread_running=1;
cout<<"Started acquiring"<<endl;
}
pthread_mutex_unlock(&gui_acquisition_start_stop_mutex);
return gui_acquisition_thread_running;
}
void* qDrawPlot::DataAcquisionThread(void *this_pointer){
((qDrawPlot*)this_pointer)->AcquireImages();
void* qDrawPlot::DataStartAcquireThread(void *this_pointer){
((qDrawPlot*)this_pointer)->myDet->acquire(1);
return this_pointer;
}
int qDrawPlot::GetDataCallBack(detectorData *data){
#ifdef VERYVERBOSE
cout<<"Entering GetDataCallBack function"<<endl;
#endif
progress=(int)data->progressIndex;
void* qDrawPlot::AcquireImages(){
//send data to detector
static unsigned int nx=1280,ny=100;
static double* image_data = new double[nx*ny];
if(!lastImageArray) lastImageArray = new double[nx*ny];
static double* xvalues = new double [nx];
static double* yvalues0 = new double [nx];
static double* yvalues1 = new double [nx];
if(!histXAxis) histXAxis = new double [nx];
if(!histYAxis[0]) histYAxis[0] = new double [nx];
if(!histYAxis[1]) histYAxis[1] = new double [nx];
// char cIndex[200];
//string filePath = myDet->getFilePath()+'/'+myDet->getFileName()+'_';
//cout<<"filePath:"<<filePath<<endl;
//string fileName;
//numberOfMeasurements
for(int i=0;i<number_of_exposures;i++){
/////
//fileName.assign(filePath);
//sprintf(cIndex,"%d",i);
//fileName.append(cIndex);
//fileName.append(".raw");
//cout<<"filename:"<<fileName<<endl;
//short int arg[1280];
//while(myDet->readDataFile(fileName,arg)==-1);
/////////
//readout detector
//fill and write data here
for(unsigned int px=0;px<nx;px++)
for(unsigned int py=0;py<ny;py++)
image_data[py*nx+px] = sqrt(pow(i+1,2)*pow(double(px)-nx/2,2)/pow(nx/2,2)/pow(number_of_exposures+1,2) + pow(double(py)-ny/2,2)/pow(ny/2,2))/sqrt(2);
for(unsigned int px=0;px<nx;px++){
/*
xvalues[px] = px;//+10;
yvalues0[px] = (double)arg[px];//i + pow(1 - 2*fabs(double(px)-nx/2)/nx,2);
yvalues1[px] = 0;//i + pow(1 - 2*fabs(double(px)-nx/2)/nx,4);
*/
xvalues[px] = px+10;
yvalues0[px] = i + pow(1 - 2*fabs(double(px)-nx/2)/nx,2);
yvalues1[px] = i + pow(1 - 2*fabs(double(px)-nx/2)/nx,4);
}
/* if(framePeriod<acquisitionTime) usleep((int)acquisitionTime*1e6);
else usleep((int)framePeriod*1e6);*/
//cout<<"Reading in image: "<<i<<endl;
//usleep(1000000);
if(stop_signal) break; //stop_signal should also go to readout function
if(!pthread_mutex_trylock(&last_image_complete_mutex)){
//plot_in_scope = 1;//i%2 + 1;
//plot_in_scope = 2;
//cout<<"value:"<<image_data[6]<<endl;
lastImageNumber = i+1;
char temp_title[2000];
//1d image stuff
nHists = 2;
sprintf(temp_title,"curve one %d",i); histTitle[0] = temp_title;
sprintf(temp_title,"curve two %d",i); histTitle[1] = temp_title;
histNBins = nx;
memcpy(histXAxis, xvalues,nx*sizeof(double));
memcpy(histYAxis[0],yvalues0,nx*sizeof(double));
memcpy(histYAxis[1],yvalues1,nx*sizeof(double));
//2d image stuff
sprintf(temp_title,"Image number %d",i); imageTitle=temp_title;
nPixelsX = nx;
nPixelsY = ny;
memcpy(lastImageArray,image_data,nx*ny*sizeof(double));
pthread_mutex_unlock(&last_image_complete_mutex);
}
if(!plotEnable) {
lastImageNumber= currentFrame+1;
currentFrame++;
return 0;
}
return this;
/** Persistency */
if(currentPersistency < persistency)currentPersistency++;
else currentPersistency=persistency;
for(int i=currentPersistency;i>0;i--)
memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double));
nHists = currentPersistency+1;
/** Get data from client */
memcpy(yvalues[0],data->values,nPixelsX*sizeof(double));
/**1d*/
// if(plot_in_scope==1){
if((currentFrame)<(number_of_exposures)){
#ifdef VERYVERBOSE
cout<<"Reading in image: "<<currentFrame+1<<endl;
#endif
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
/** only if you got the lock, do u need to remember lastimagenumber to plot*/
lastImageNumber= currentFrame+1;
/** Titles*/
stringstream s;
s<<"Frame "<<currentFrame;
histTitle[0]=s.str();
/** copy data*/
//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double));
for(int i=currentPersistency;i>0;i--)
memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double));
pthread_mutex_unlock(&(last_image_complete_mutex));
}
currentFrame++;
}
//}
///**2d*/
//else{
// ;
//}
#ifdef VERYVERBOSE
cout<<"Exiting GetDataCallBack function"<<endl;
#endif
return 0;
}
void qDrawPlot::SetPersistency(int val){
for(int i=0;i<=val;i++){
if(!yvalues[i]) yvalues[i] = new double [nPixelsX];
if(!histYAxis[i]) histYAxis[i] = new double [nPixelsX];
}
persistency = val;
}
void qDrawPlot::setNumMeasurements(int num){
@ -361,50 +381,61 @@ void qDrawPlot::Clear1DPlot(){
void qDrawPlot::UpdatePlot(){
//emit UpdatingPlot();
static int last_plot_number = 0;
plot_update_timer->stop();
if(plotEnable){
LockLastImageArray();
//1-d plot stuff
if(lastImageNumber){
if(histNBins){
#ifdef VERYVERBOSE
cout<<"Last Image Number: "<<lastImageNumber<<endl;
#endif
Clear1DPlot();
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
for(int hist_num=0;hist_num<nHists;hist_num++){
SlsQtH1D* h;
if(hist_num+1>plot1D_hists.size()){
plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num)));
h->SetLineColor(hist_num+1);
}else{
h=plot1D_hists.at(hist_num);
h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
}
h->setTitle(GetHistTitle(hist_num));
h->Attach(plot1D);
}
//plot1D->UnZoom();
//if(first){plot1D->UnZoom();first = !first;}
//plot1D->SetZoom(double xmin,double ymin,double x_width,double y_width);
LockLastImageArray();
//1-d plot stuff
if(histNBins){
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
for(int hist_num=0;hist_num<nHists;hist_num++){
SlsQtH1D* h;
if(hist_num+1>plot1D_hists.size()){
plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num)));
h->SetLineColor(hist_num+1);
}else{
h=plot1D_hists.at(hist_num);
h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
}
h->setTitle(GetHistTitle(hist_num));
h->Attach(plot1D);
}
plot1D->UnZoom();
}
//2-d plot stuff
static int last_plot_number = 0;
if(lastImageArray){
if(lastImageNumber&&last_plot_number!=lastImageNumber && //there is a new plot
nPixelsX>0&&nPixelsY>0){
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
//as it inherits a widget
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);
plot2D->SetYTitle(imageYAxisTitle);
plot2D->SetZTitle(imageZAxisTitle);
plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update();
//2-d plot stuff
if(lastImageArray){
if(lastImageNumber&&last_plot_number!=lastImageNumber && //there is a new plot
nPixelsX>0&&nPixelsY>0){
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
//as it inherits a widget
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);
plot2D->SetYTitle(imageYAxisTitle);
plot2D->SetZTitle(imageZAxisTitle);
plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update();
}
}
}
last_plot_number=lastImageNumber;
UnlockLastImageArray();
/* if(plot_in_scope==1) SelectPlot(1);
if(plotEnable) UnlockLastImageArray();
/* if(plot_in_scope==1) SelectPlot(1);
else if(plot_in_scope==2) SelectPlot(2);*/
if(number_of_exposures==last_plot_number){
gui_acquisition_thread_running=0;
StartStopDaqToggle(1);
emit UpdatingPlotFinished();
}else{
@ -498,3 +529,24 @@ void qDrawPlot::SavePlot(QString FName){
render(&painter);
img.save(FName);
}
void qDrawPlot::EnablePlot(bool enable){
#ifdef VERBOSE
cout<<"Plotting set to:"<<enable<<endl;
#endif
plotEnable = !enable;
Clear1DPlot();
}
void qDrawPlot::DisableZoom(bool disable){
if(plot_in_scope==1)
plot1D->DisableZoom(disable);
///disable zoom
}

View File

@ -48,6 +48,8 @@ qTabMeasurement::~qTabMeasurement(){
void qTabMeasurement::SetupWidgetWindow(){
progressTimer = new QTimer(this);
//btnStartStop->setStyleSheet("color:green");
/** Exp Time **/
float time = (float)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9));
spinExpTime->setValue(time);
@ -106,7 +108,7 @@ void qTabMeasurement::SetupWidgetWindow(){
}
}
progressBar->setValue(0);
//get timing mode from client
@ -127,6 +129,8 @@ void qTabMeasurement::Initialization(int timingChange){
connect(btnStartStop,SIGNAL(clicked()), this, SLOT(startStopAcquisition()));
/** Timing Mode **/
connect(comboTimingMode,SIGNAL(currentIndexChanged(int)), this, SLOT(setTimingMode(int)));//
connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
}
/** Number of Frames**/
connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
@ -189,15 +193,17 @@ void qTabMeasurement::Enable(bool enable){
void qTabMeasurement::UpdateFinished(){
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
btnStartStop->setText("Start");
//btnStartStop->setStyleSheet("color:green");
//btnStartStop->setStyleSheet("background:rgb(239,239,239)");
Enable(1);
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
UpdateProgress();
progressTimer->stop();
}
void qTabMeasurement::setFileName(const QString& fName){
// emit fileNameChanged(fName);
// thred-->fileName=s;myDet->setFileName(fName.ascii());
myDet->setFileName(fName.toAscii().data());
#ifdef VERBOSE
cout<<"Setting File name to " << myDet->getFileName()<<endl;
@ -209,6 +215,7 @@ void qTabMeasurement::setFileName(const QString& fName){
void qTabMeasurement::setRunIndex(int index){
myDet->setFileIndex(index);
lblProgressIndex->setText(QString::number(index));
#ifdef VERBOSE
cout<<"Setting File Index to " << myDet->getFileIndex()<<endl;
#endif
@ -221,13 +228,20 @@ void qTabMeasurement::startStopAcquisition(){
#ifdef VERBOSE
cout<<endl<<endl<<"Starting Acquisition"<<endl;
#endif
//btnStartStop->setStyleSheet("color:red");
btnStartStop->setText("Stop");
Enable(0);
progressBar->setValue(0);
progressTimer->start(200);
emit StartSignal();
}else{
#ifdef VERBOSE
cout<<"Stopping Acquisition"<<endl;
#endif
//btnStartStop->setStyleSheet("color:green");
//btnStartStop->setStyleSheet("background:rgb(239,239,239)");
progressTimer->stop();
btnStartStop->setText("Start");
Enable(1);
emit StopSignal();
@ -270,8 +284,6 @@ void qTabMeasurement::setExposureTime(){
lblPeriod->setText("Acquisition Period");
}
}
//float t=exptimeNS;
//emit acquisitionTimeChanged(t/(100E+6)); ??????????????????????
}
@ -297,10 +309,6 @@ void qTabMeasurement::setAcquisitionPeriod(){
lblPeriod->setPalette(lblNumFrames->palette());
lblPeriod->setText("Acquisition Period");
}
//float t=exptimeNS;
//emit acquisitionTimeChanged(t/(100E+6)); ??????????????????????
}
@ -348,6 +356,12 @@ void qTabMeasurement::setNumProbes(int val){
}
void qTabMeasurement::UpdateProgress(){
progressBar->setValue(myPlot->GetProgress());
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
}
void qTabMeasurement::setTimingMode(int mode){

View File

@ -36,6 +36,7 @@ qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot
//This also selects the text if unchecked
//includes setupwidgetwindow
//SelectPlot(1);
//switch(myDet->detectorytype)
Select1DPlot(true);
Initialization();
}
@ -66,9 +67,12 @@ void qTabPlot::SetupWidgetWindow(){
dispXMax->setEnabled(false);
dispYMax->setEnabled(false);
dispZMax->setEnabled(false);
//dispFName->setText(QString(myDet->getFilePath().c_str())+'/');
/* dispXMin->setValidator(new QDoubleValidator(dispXMin));
dispYMin->setValidator(new QDoubleValidator(dispYMin));
dispZMin->setValidator(new QDoubleValidator(dispZMin));
dispXMax->setValidator(new QDoubleValidator(dispXMax));
dispYMax->setValidator(new QDoubleValidator(dispYMax));
dispZMax->setValidator(new QDoubleValidator(dispZMax));*/
}
@ -103,9 +107,14 @@ void qTabPlot::Select1DPlot(bool b){
void qTabPlot::Initialization(){
/** Plot box*/
/** Plot arguments box*/
connect(chkNoPlot, SIGNAL(toggled(bool)),myPlot, SLOT(EnablePlot(bool)));
/** Snapshot box*/
connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot()));
connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones()));
/** 1D Plot box*/
connect(chkSuperimpose, SIGNAL(toggled(bool)),this, SLOT(EnablePersistency(bool)));
connect(spinPersistency,SIGNAL(valueChanged(int)),myPlot,SLOT(SetPersistency(int)));
/** 2D Plot box*/
connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool)));
connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool)));
@ -119,13 +128,26 @@ void qTabPlot::Initialization(){
connect(dispXAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles()));
connect(dispYAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles()));
connect(dispZAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles()));
connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
connect(dispXMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
connect(dispXMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
connect(dispYMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
/** Common Buttons*/
connect(btnClear, SIGNAL(clicked()), myPlot, SLOT(Clear1DPlot()));
/** Save */
connect(btnSave, SIGNAL(clicked()), this, SLOT(SavePlot()));
/** test for 1D*/
connect(chktest1D, SIGNAL(toggled(bool)), this, SLOT(Select1DPlot(bool)));
}
@ -138,6 +160,16 @@ void qTabPlot::Enable(bool enable){
boxPlotAxis->setEnabled(enable);
}
void qTabPlot::EnablePersistency(bool enable){
lblPersistency->setEnabled(enable);
spinPersistency->setEnabled(enable);
if(enable) myPlot->SetPersistency(spinPersistency->value());
else myPlot->SetPersistency(0);
}
void qTabPlot::SetTitles(){
int oneD = box1D->isEnabled();
/** Plot Title*/
@ -159,6 +191,7 @@ void qTabPlot::SetTitles(){
}
void qTabPlot::EnableTitles(){
int oneD = box1D->isEnabled();
/** Plot Title*/
@ -199,7 +232,91 @@ void qTabPlot::EnableTitles(){
}
void qTabPlot::EnableRange(){
bool disableZoom = false;
if(!chkXMin->isChecked()) {dispXMin->setText(""); dispXMin->setEnabled(false);}
else {disableZoom = true; dispXMin->setEnabled(true); }
if(!chkXMax->isChecked()) {dispXMax->setText(""); dispXMax->setEnabled(false);}
else {disableZoom = true; dispXMax->setEnabled(true); }
if(!chkYMin->isChecked()) {dispYMin->setText(""); dispYMin->setEnabled(false);}
else {disableZoom = true; dispYMin->setEnabled(true); }
if(!chkYMax->isChecked()) {dispYMax->setText(""); dispYMax->setEnabled(false);}
else {disableZoom = true; dispYMax->setEnabled(true); }
if(!chkZMin->isChecked()) {dispZMin->setText(""); dispZMin->setEnabled(false);}
else {disableZoom = true; dispZMin->setEnabled(true); }
if(!chkZMax->isChecked()) {dispZMax->setText(""); dispZMax->setEnabled(false);}
else {disableZoom = true; dispZMax->setEnabled(true); }
myPlot->DisableZoom(disableZoom);
emit DisableZoomSignal(disableZoom);
}
void qTabPlot::SetAxesRange(){
double xmin,xmax,ymin,ymax,zmin,zmax;
int oneD = box1D->isEnabled();
//should be filled for 2d as well
if(!dispXMin->text().isEmpty()) xmin = dispXMin->text().toDouble();
else { if(oneD) xmin = myPlot->GetHistXAxisLowerBound();}
if(!dispXMax->text().isEmpty()) xmax = dispXMax->text().toDouble();
else { if(oneD) xmax = myPlot->GetHistXAxisUpperBound();}
if(!dispYMin->text().isEmpty()) ymin = dispYMin->text().toDouble();
else { if(oneD) ymin = myPlot->GetHistYAxisLowerBound();}
if(!dispYMax->text().isEmpty()) ymax = dispYMax->text().toDouble();
else { if(oneD) ymax = myPlot->GetHistYAxisUpperBound();}
if(!dispZMin->text().isEmpty()) zmin = dispZMin->text().toDouble();
if(!dispZMax->text().isEmpty()) zmax = dispZMax->text().toDouble();
//should be filled for 2d as well
if(oneD){
myPlot->SetHistXAxisScale(xmin,xmax);
myPlot->SetHistYAxisScale(ymin,ymax);
}
}
void qTabPlot::SavePlot(){
QString fullFileName = QString(myDet->getFilePath().c_str())+'/'+dispFName->text()+comboFormat->currentText();
myPlot->SavePlot(fullFileName);
}
//dispzmin... when unchecked, unzoom and get lower and upper bound... when checked just set lower and upper bound
/*
#include "SlsQtValidators.h"
class QDoubleValidator;
SlsQtDoubleValidator* validator_double[2];
validator_double = new SlsQtDoubleValidator(num_field);
num_field->setValidator(validator_double);
//default settings
validator_double->setDecimals(3);
double v= num_field->text().toDouble(ok););
is ok 1? for correct conversion
QString s = QString::number(v);
validator_double->fixup(s);
num_field->setText(s);
num_field[i]->setAlignment(Qt::AlignRight);
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(FirstValueEntered()));
*/