From afc8ab5061a66e8b700fda6060db93f46a2747a5 Mon Sep 17 00:00:00 2001
From: Roman Tolchenov <roman.tolchenov@stfc.ac.uk>
Date: Mon, 27 Jun 2011 15:25:48 +0000
Subject: [PATCH] Made corrections to the tabs in the instrument view. re #2819

---
 .../src/Mantid/InstrumentWidget/InstrumentActor.cpp  |  6 ++++++
 .../src/Mantid/InstrumentWidget/InstrumentActor.h    |  1 +
 .../src/Mantid/InstrumentWidget/InstrumentWindow.cpp |  1 +
 .../InstrumentWidget/InstrumentWindowMaskTab.cpp     |  6 +++---
 .../InstrumentWidget/InstrumentWindowPickTab.cpp     |  1 +
 .../InstrumentWidget/InstrumentWindowRenderTab.cpp   |  4 ++++
 .../InstrumentWidget/InstrumentWindowRenderTab.h     |  1 +
 .../src/Mantid/InstrumentWidget/Projection3D.cpp     | 12 ++++++------
 8 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentActor.cpp b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentActor.cpp
index d58ff1cfa17..98e84118cb2 100644
--- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentActor.cpp
+++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentActor.cpp
@@ -141,6 +141,12 @@ void InstrumentActor::setIntegrationRange(const double& xmin,const double& xmax)
   resetColors();
 }
 
+double InstrumentActor::getIntegratedCounts(Mantid::detid_t id)const
+{
+  size_t i = (*m_id2wi_map)[id];
+  return m_specIntegrs.at(i);
+}
+
 void InstrumentActor::resetColors()
 {
   QwtDoubleInterval qwtInterval(m_DataMinValue,m_DataMaxValue);
diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentActor.h b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentActor.h
index 3b7783353c9..0889279a915 100644
--- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentActor.h
+++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentActor.h
@@ -94,6 +94,7 @@ public:
   const std::vector<Mantid::detid_t>& getAllDetIDs()const{return m_detIDs;}
   GLColor getColor(Mantid::detid_t id)const;
   size_t getWorkspaceIndex(Mantid::detid_t id)const{return (*m_id2wi_map)[id];}
+  double getIntegratedCounts(Mantid::detid_t id)const;
   void update();
   void invalidateDisplayLists()const{m_scene.invalidateDisplayList();}
   QString getCurrentColorMap()const{return m_currentColorMap;}
diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.cpp b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.cpp
index aa6d0632eee..905bd50846e 100644
--- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.cpp
+++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindow.cpp
@@ -211,6 +211,7 @@ void InstrumentWindow::setSurfaceType(int type)
     }
     m_InstrumentDisplay->setSurface(surface);
     m_InstrumentDisplay->update();
+    m_renderTab->init();
     m_maskTab->init();
 
     connect(surface,SIGNAL(singleDetectorTouched(int)),this,SLOT(singleDetectorTouched(int)));
diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp
index 90d76f1cbb2..024ae21170a 100644
--- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp
+++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp
@@ -64,13 +64,13 @@ m_userEditing(true)
   m_ring_ellipse->setCheckable(true);
   m_ring_ellipse->setAutoExclusive(true);
   m_ring_ellipse->setIcon(QIcon(":/MaskTools/selection-circle.png"));
-  m_ring_ellipse->setToolTip("Draw an ellipse");
+  m_ring_ellipse->setToolTip("Draw an elliptical ring");
 
   m_ring_rectangle = new QPushButton();
   m_ring_rectangle->setCheckable(true);
   m_ring_rectangle->setAutoExclusive(true);
   m_ring_rectangle->setIcon(QIcon(":/MaskTools/selection-box.png"));
-  m_ring_rectangle->setToolTip("Draw a rectangle");
+  m_ring_rectangle->setToolTip("Draw a rectangular ring ");
 
   QHBoxLayout* toolBox = new QHBoxLayout();
   toolBox->addWidget(m_move);
@@ -122,7 +122,7 @@ m_userEditing(true)
   QGridLayout* buttons = new QGridLayout();
   buttons->addWidget(m_apply,0,0);
   buttons->addWidget(m_clear_all,0,1);
-  buttons->addWidget(m_save_as_workspace,1,0,1,2);
+  //buttons->addWidget(m_save_as_workspace,1,0,1,2);
   
   layout->addLayout(buttons);
 }
diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp
index e772725d95d..7f166fd059e 100644
--- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp
+++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp
@@ -171,6 +171,7 @@ void InstrumentWindowPickTab::updateSelectionInfo(int detid)
     {
       text += "Parent assembly: " + QString::fromStdString(parent->getName()) + '\n';
     }
+    text += "Counts: " + QString::number(instrActor->getIntegratedCounts(detid)) + '\n';
     m_selectionInfoDisplay->setText(text);
   }
   else
diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.cpp b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.cpp
index 8ac7679e842..7bdbf202b0f 100644
--- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.cpp
+++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.cpp
@@ -116,6 +116,10 @@ QFrame * InstrumentWindowRenderTab::setupAxisFrame()
   loadSettings("Mantid/InstrumentWindow");
   return m_resetViewFrame;
 }
+void InstrumentWindowRenderTab::init()
+{
+  setAxis(QString::fromStdString(m_instrWindow->getInstrumentActor()->getInstrument()->getDefaultAxis()));
+}
 
 /**
  *
diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.h b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.h
index fc679a14e9a..03aac5d224e 100644
--- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.h
+++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.h
@@ -35,6 +35,7 @@ public:
   void setScaleType(GraphOptions::ScaleType type);
   void setAxis(const QString& axisName);
   bool areAxesOn()const;
+  void init();
 public slots:
   void showAxes(bool on);
 private slots:
diff --git a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp
index e3159b83b2f..c8f6476e833 100644
--- a/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp
+++ b/Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/Projection3D.cpp
@@ -243,27 +243,27 @@ void Projection3D::changeColorMap()
 
 void Projection3D::setViewDirection(const QString& input)
 {
-	if(input.compare("X+")==0)
+	if(input.toUpper().compare("X+")==0)
 	{
 		m_trackball->setViewToXPositive();
 	}
-	else if(input.compare("X-")==0)
+	else if(input.toUpper().compare("X-")==0)
 	{
 		m_trackball->setViewToXNegative();
 	}
-	else if(input.compare("Y+")==0)
+	else if(input.toUpper().compare("Y+")==0)
 	{
 		m_trackball->setViewToYPositive();
 	}
-	else if(input.compare("Y-")==0)
+	else if(input.toUpper().compare("Y-")==0)
 	{
 		m_trackball->setViewToYNegative();
 	}
-	else if(input.compare("Z+")==0)
+	else if(input.toUpper().compare("Z+")==0)
 	{
 		m_trackball->setViewToZPositive();
 	}
-	else if(input.compare("Z-")==0)
+	else if(input.toUpper().compare("Z-")==0)
 	{
 		m_trackball->setViewToZNegative();
 	}
-- 
GitLab