Go to the documentation of this file.
13 #include <boost/shared_ptr.hpp>
14 #include <boost/weak_ptr.hpp>
31 using Ptr = boost::shared_ptr<Colormap>;
32 using ConstPtr = boost::shared_ptr<const Colormap>;
33 using WeakPtr = boost::weak_ptr<Colormap>;
54 result->name =
"Default";
55 result->colors.reserve(n);
56 result->colors.clear();
57 const double max = n - 1;
58 for(
int i = 0; i < n; i++)
60 result->colors.emplace_back(i / max);
70 result->name =
"0 is white";
71 result->colors.reserve(n);
72 result->colors.clear();
73 const double max = n - 1;
74 for(
int i = 0; i < n; i++)
76 result->colors.emplace_back((max - i) / max);
95 result->setAlpha(alpha);
116 using Ptr = boost::shared_ptr<Colormappable>;
117 using WeakPtr = boost::weak_ptr<Colormappable>;
149 using Ptr = boost::shared_ptr<ColormapProvider>;
160 using Ptr = boost::shared_ptr<ColormapHelperBase>;
168 virtual std::map<std::string, std::string>
getProperties() = 0;
ColormapHelperBase(Colormap::Ptr const &colormap)
Definition: colormap-helpers.cc:18
static Colormap::Ptr createDefault(int n)
Definition: colormappable.hh:51
Colormap::Ptr getOriginalColormap() override
Definition: colormap-helpers.cc:28
Color blackish
Definition: colormappable.hh:235
std::map< std::string, std::string > getProperties() override
Definition: colormap-helpers.cc:67
void disableTransparentBackground() override
Definition: colormap-helpers.cc:141
virtual Color getMonochromeColor()=0
Colormap::Ptr originalColormap
Definition: colormappable.hh:164
static Ptr create(int numberOfColors)
Definition: colormap-helpers.cc:72
static void OperationNotSupported()
Definition: colormap-helpers.cc:48
void setMonochromeColor(const Color &c) override
Definition: colormap-helpers.cc:34
Color whitish
Definition: colormappable.hh:236
Definition: colormappable.hh:155
const std::string MONOCHROME_COLORMAPPABLE_PROPERTY_NAME
Definition: colormappable.hh:22
virtual Colormap::Ptr getColormap()=0
virtual int getNumberOfColors()=0
virtual Colormap::Ptr getOriginalColormap()=0
Ptr setAlpha(double alpha) const
Definition: colormappable.hh:92
static Colormap::Ptr create()
Definition: colormappable.hh:48
std::vector< Color > colors
Definition: colormappable.hh:37
std::string name
Definition: colormappable.hh:36
Ptr clone() const
Definition: colormappable.hh:82
virtual std::map< std::string, std::string > getProperties()=0
Colormap::Ptr getColormap() override
Definition: colormap-helpers.cc:46
static Colormap::Ptr generateInitialColormap(int numberOfColors, bool inverted)
Definition: colormap-helpers.cc:130
boost::shared_ptr< ColormapProvider > Ptr
Definition: colormappable.hh:149
bool inverted
Definition: colormappable.hh:234
Definition: colormappable.hh:146
bool transparentBackground
Definition: colormappable.hh:237
static Ptr createInverted(int numberOfColors)
Definition: colormap-helpers.cc:77
ColormapHelper(Colormap::Ptr const &colormap)
Definition: colormap-helpers.cc:62
Colormap::Ptr colormap
Definition: colormappable.hh:163
Definition: colormappable.hh:113
virtual void setOriginalColormap(Colormap::Ptr colormap)
Definition: colormap-helpers.cc:26
void setAlpha(double alpha)
Definition: colormappable.hh:84
virtual bool getTransparentBackground()=0
int getNumberOfColors() override
Definition: colormap-helpers.cc:30
Colormap()
Definition: colormappable.hh:41
boost::shared_ptr< Colormap > Ptr
Definition: colormappable.hh:31
const std::string COLORMAPPABLE_PROPERTY_NAME
Definition: colormappable.hh:21
const Colormap::Ptr colormap
Definition: colormaphelpers_test.cc:54
boost::weak_ptr< Colormap > WeakPtr
Definition: colormappable.hh:33
static Colormap::Ptr createDefaultInverted(int n)
Definition: colormappable.hh:67
void setMonochromeColor(const Color &c) override
Definition: colormap-helpers.cc:92
int numberOfColors
Definition: colormappable.hh:233
virtual void setMonochromeColor(const Color &c)=0
Color getMonochromeColor() override
Definition: colormap-helpers.cc:32
virtual void setColormap(Colormap::Ptr colormap)=0
void setTransparentBackground() override
Definition: colormap-helpers.cc:135
Definition: interface.hh:10
boost::shared_ptr< Colormappable > Ptr
Definition: colormappable.hh:116
static Ptr create(int numberOfColors)
Definition: colormap-helpers.cc:55
void setColormap(Colormap::Ptr colormap) override
Definition: colormap-helpers.cc:24
Definition: colormappable.hh:196
void regenerateColormap()
Definition: colormap-helpers.cc:108
void setTransparentBackground() override
Definition: colormap-helpers.cc:40
void disableTransparentBackground() override
Definition: colormap-helpers.cc:42
std::map< std::string, std::string > getProperties() override
Definition: colormap-helpers.cc:149
virtual void setTransparentBackground()=0
virtual void disableTransparentBackground()=0
bool getTransparentBackground() override
Definition: colormap-helpers.cc:147
MonochromeColormapHelper(int numberOfColors, bool inverted)
Definition: colormap-helpers.cc:82
static Ptr createInverted(int numberOfColors)
Definition: colormap-helpers.cc:57
const std::string TRANSPARENT_BACKGROUND_PROPERTY_NAME
Definition: colormappable.hh:23
Definition: colormappable.hh:209
Definition: colormappable.hh:28
boost::weak_ptr< Colormappable > WeakPtr
Definition: colormappable.hh:117
boost::shared_ptr< const Colormap > ConstPtr
Definition: colormappable.hh:32
bool getTransparentBackground() override
Definition: colormap-helpers.cc:44
Color getMonochromeColor() override
Definition: colormap-helpers.cc:106