Skip to content

Commit

Permalink
Ref #2720. Show masked detectors in grey rather the zero color
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Nov 1, 2011
1 parent 8085466 commit c0af1f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <QSettings>
#include <QMessageBox>

#include <numeric>

using namespace Mantid::Kernel::Exception;
using namespace Mantid::Geometry;
using namespace Mantid::API;
Expand All @@ -24,9 +26,10 @@ double InstrumentActor::m_tolerance = 0.00001;
* Constructor
* @param workspace :: Workspace
*/
InstrumentActor::InstrumentActor(const QString wsName)
: m_workspace(boost::dynamic_pointer_cast<MatrixWorkspace>(AnalysisDataService::Instance().retrieve(wsName.toStdString()))),
m_sampleActor(NULL)
InstrumentActor::InstrumentActor(const QString wsName):
m_workspace(boost::dynamic_pointer_cast<MatrixWorkspace>(AnalysisDataService::Instance().retrieve(wsName.toStdString()))),
m_maskedColor(100,100,100),
m_sampleActor(NULL)
{
if (!m_workspace)
throw std::logic_error("InstrumentActor passed a workspace that isn't a MatrixWorkspace");
Expand Down Expand Up @@ -232,8 +235,18 @@ void InstrumentActor::resetColors()
m_colors.resize(m_specIntegrs.size());
for (size_t wi=0; wi < m_specIntegrs.size(); wi++)
{
unsigned char ci = m_colorMap.colorIndex(qwtInterval,m_specIntegrs[wi]);
m_colors[wi] = m_colorMap.getColor(ci);
double integratedValue = m_specIntegrs[wi];
Mantid::Geometry::IDetector_const_sptr det = m_workspace->getDetector(wi);
boost::shared_ptr<Mantid::Geometry::Parameter> masked = m_workspace->instrumentParameters().get(det.get(),"masked");
if (masked)
{
m_colors[wi] = m_maskedColor;
}
else
{
unsigned char ci = m_colorMap.colorIndex(qwtInterval,integratedValue);
m_colors[wi] = m_colorMap.getColor(ci);
}
}
if (m_scene.getNumberOfActors() > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class InstrumentActor: public QObject, public GLActor
mutable std::vector<Mantid::detid_t> m_detIDs; ///< all det ids in the instrument in order of pickIDs, populated by Obj..Actor constructors
mutable std::vector<GLColor> m_colors; ///< colors in order of workspace indexes
QString m_currentColorMap;
GLColor m_maskedColor;

GLActorCollection m_scene;
SampleActor* m_sampleActor;
Expand Down

0 comments on commit c0af1f9

Please sign in to comment.