20 #include "qcustomplot.h"
24 using gradient_map_t = std::map<std::string, QCPColorGradient::GradientPreset>;
29 result[
"Grayscale"] = QCPColorGradient::gpGrayscale;
30 result[
"Hot"] = QCPColorGradient::gpHot;
31 result[
"Cold"] = QCPColorGradient::gpCold;
32 result[
"Night"] = QCPColorGradient::gpNight;
33 result[
"Candy"] = QCPColorGradient::gpCandy;
34 result[
"Geography"] = QCPColorGradient::gpGeography;
35 result[
"Ion"] = QCPColorGradient::gpIon;
36 result[
"Thermal"] = QCPColorGradient::gpThermal;
37 result[
"Polar"] = QCPColorGradient::gpPolar;
38 result[
"Spectrum"] = QCPColorGradient::gpSpectrum;
39 result[
"Jet"] = QCPColorGradient::gpJet;
40 result[
"Hues"] = QCPColorGradient::gpHues;
45 QCPColorGradient
getGradient(
const std::string& gradientName)
48 auto it = gradient_map.find(gradientName);
49 return it != gradient_map.end() ? QCPColorGradient(it->second) : QCPColorGradient::gpSpectrum;
63 QCPColorScale* color_scale)
92 color_map->setInterpolate(is_interpolated);
109 auto on_property_change = [
this](
SessionItem*, std::string property_name) {
111 p_impl->update_interpolation();
114 p_impl->update_gradient();
117 p_impl->update_data_controller();
119 p_impl->custom_plot->replot();
123 p_impl->update_colormap();
128 p_impl->data_controller->setItem(
nullptr);
QMap< QString, QCPColorGradient::GradientPreset > gradient_map_t
Two-dimensional color map representation of Data2DItem.
static const std::string P_INTERPOLATION
static const std::string P_LINK
static const std::string P_GRADIENT
Establish communication between QCPColorMap and ColorMapItem.
~ColorMapPlotController() override
std::unique_ptr< ColorMapPlotControllerImpl > p_impl
ColorMapPlotController(QCustomPlot *plot, QCPColorScale *color_scale=nullptr)
void subscribe() override
void unsubscribe() override
For necessary manipulations on new item.
Custom property to define list of string values with multiple selections.
void setOnPropertyChange(Callbacks::item_str_t f)
Sets callback to be notified on item's property change.
The main object representing an editable/displayable/serializable entity.
T property(const std::string &tag) const
Returns data stored in property item.
QCPColorGradient getGradient(const QString &gradientName)
materialitems.h Collection of materials to populate MaterialModel.
QCustomPlot * custom_plot
ColorMapPlotControllerImpl(ColorMapPlotController *master, QCustomPlot *plot, QCPColorScale *color_scale)
void update_interpolation()
Updates QCPColorMap's interpolation when corresponding property of ColorMapItem changed.
void update_data_controller()
ColorMapItem * colormap_item()
~ColorMapPlotControllerImpl()
ColorMapPlotController * master
std::unique_ptr< Data2DPlotController > data_controller