29 #include "../raster/RasterProperty.h" 30 #include "../se/RasterSymbolizer.h" 34 #include <boost/math/special_functions/fpclassify.hpp> 43 m_currentContrastType( LINEAR_CONTRAST ),
153 std::map<RGBChannels,short>::iterator it =
m_rgbMap.begin();
187 gain =
static_cast<double>(rmax-rmin)/(vmax-vmin);
189 if(boost::math::isnan(gain) || boost::math::isinf(gain))
196 offset = -1*gain*vmin+rmin;
220 gain =
static_cast<double>(rmax - rmin) / (vmax - vmin);
222 if (boost::math::isnan(gain) || boost::math::isinf(gain))
229 offset = -1 * gain*vmin + rmin;
354 const std::vector< double >& contrastGains,
355 const std::vector< double >& contrastOffsets1,
356 const std::vector< double >& contrastOffsets2 )
377 switch( contrastType )
416 std::vector<double> vecValues;
417 vecValues.resize(3, val);
419 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
444 te::color::RGBAColor c(static_cast<int>(val), static_cast<int>(val), static_cast<int>(val), static_cast<int>(transp));
454 double valR, valG, valB;
464 std::vector<double> vecValues;
469 vecValues.push_back(valR);
474 vecValues.push_back(valG);
479 vecValues.push_back(valB);
481 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
487 double valR, valG, valB;
511 te::color::RGBAColor c(static_cast<int>(valR), static_cast<int>(valG), static_cast<int>(valB), static_cast<int>(transp));
521 double valR, valG, valB, valA;
533 std::vector<double> vecValues;
538 vecValues.push_back(valR);
543 vecValues.push_back(valG);
548 vecValues.push_back(valB);
551 vecValues.push_back(valB);
553 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
559 double valR, valG, valB, valA;
586 return te::color::RGBAColor(static_cast<int>(valR), static_cast<int>(valG), static_cast<int>(valB), static_cast<int>(valA));
606 std::vector<double> vecValues;
607 vecValues.push_back(val);
608 vecValues.push_back(0.);
609 vecValues.push_back(0.);
611 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
629 te::color::RGBAColor c(static_cast<int>(val), static_cast<int>(0.), static_cast<int>(0.), static_cast<int>(transp));
650 std::vector<double> vecValues;
651 vecValues.push_back(0.);
652 vecValues.push_back(val);
653 vecValues.push_back(0.);
655 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
673 te::color::RGBAColor c(static_cast<int>(0.), static_cast<int>(val), static_cast<int>(0.), static_cast<int>(transp));
694 std::vector<double> vecValues;
695 vecValues.push_back(0.);
696 vecValues.push_back(0.);
697 vecValues.push_back(val);
699 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
717 te::color::RGBAColor c(static_cast<int>(0.), static_cast<int>(0.), static_cast<int>(val), static_cast<int>(transp));
734 std::vector<double> vecValues;
735 vecValues.push_back(c.
getRed());
737 vecValues.push_back(c.
getBlue());
739 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
762 std::vector<double> vecValues;
763 vecValues.push_back(c.
getRed());
765 vecValues.push_back(c.
getBlue());
767 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
790 std::vector<double> vecValues;
791 vecValues.push_back(c.
getRed());
793 vecValues.push_back(c.
getBlue());
795 m_rasterOut->
setValues(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), vecValues);
816 m_rasterIn->
getValue(static_cast<unsigned int>(icol), static_cast<unsigned int>(ilin), val, t);
823 short band =
static_cast<short>(t);
826 m_rasterOut->
setValue(static_cast<unsigned int>(ocol), static_cast<unsigned int>(olin), val, t);
835 if (it !=
m_rgbMap.end() && it->second != -1)
857 if(rt.first<= value && rt.second > value)
859 int distance =
int(value - it->first.first);
865 else if(distance >= static_cast<int>(it->second.getColorBar().size()))
867 distance =
static_cast<int>(it->second.getColorBar().size() - 1);
870 return it->second.getColorBar()[
static_cast<size_t>(distance)];
887 if(rt.first<= value && rt.second > value)
virtual void setValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the attribute value in a band of a cell.
virtual void setValues(unsigned int c, unsigned int r, const std::vector< double > &values)
Sets the imaginary attribute values in all complex bands of a cell.
int getRed() const
It returns the red component color value (a value from 0 to 255).
Base exception class for plugin module.
int getBlue() const
It returns the blue component color value (a value from 0 to 255).
int getGreen() const
It returns the green component color value (a value from 0 to 255).
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
#define TE_TR(message)
It marks a string in order to get translated.
An abstract class for raster data strucutures.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.