Skip to content

Commit

Permalink
refs #5693. Fixed color map switching.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Jul 8, 2013
1 parent 4bf72a5 commit 2dd1aae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Code/Mantid/MantidPlot/src/Spectrogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,8 @@ void Spectrogram::setGrayScale()

void Spectrogram::setDefaultColorMap()
{
//Pass the spectrogram default (__standard) string to use as colormap.
//Use the default (__standard) colormap from MantidColorMap.
mColorMap.setupDefaultMap();

setColorMap(mColorMap);
color_map_policy = Default;

Expand Down
2 changes: 0 additions & 2 deletions Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidColorMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class EXPORT_OPT_MANTIDQT_API MantidColorMap : public QwtColorMap
void setNanColor(int r, int g, int b);

void setupDefaultMap();

void buildColorMap(std::string);

QRgb rgb(const QwtDoubleInterval & interval, double value) const;

Expand Down
5 changes: 4 additions & 1 deletion Code/Mantid/MantidQt/API/src/MantidColorMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void MantidColorMap::setNanColor(int r, int g, int b)
*/
void MantidColorMap::setupDefaultMap()
{
// The __standard map distrubuted with qtiplot is the default and putting this into a string with an @ separator was the
// The __default map distrubuted with qtiplot is the default and putting this into a string with an @ separator was the
// easiest way to construct it as it doesn't have a regular pattern so a loop wouldn't work.
std::string colorstring =
"0 172 252@0 170 252@0 168 252@0 164 252@0 160 252@0 156 252@0 152 252@0 152 252@0 148 252@0 144 252@0 140 252@0 136 252"
Expand Down Expand Up @@ -210,15 +210,18 @@ void MantidColorMap::setupDefaultMap()

m_colors.clear();
m_num_colors = 256;

std::stringstream colorstream(colorstring);
float red(0.0f), green(0.0f), blue(0.0f);
std::string line;

while ( std::getline(colorstream, line, '@') )
{
std::stringstream reader(line);
reader >> red >> green >> blue;
m_colors.push_back(qRgb((unsigned char)(red), (unsigned char)green, (unsigned char)blue));
}

this->setNanColor(255,255,255);
}

Expand Down

0 comments on commit 2dd1aae

Please sign in to comment.