BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
colormapitem.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/model/mvvm/standarditems/colormapitem.cpp
6 //! @brief Implements class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
20 
21 using namespace ModelView;
22 
23 namespace {
24 const ComboProperty gradientCombo =
25  ComboProperty::createFrom({"Grayscale", "Hot", "Cold", "Night", "Candy", "Geography", "Ion",
26  "Thermal", "Polar", "Spectrum", "Jet", "Hues"},
27  "Polar");
28 }
29 
31 {
32  addProperty<LinkedItem>(P_LINK)->setDisplayName("Link");
33  addProperty<TextItem>(P_TITLE)->setDisplayName("Title");
34  addProperty(P_GRADIENT, gradientCombo)->setDisplayName("Gradient");
35  addProperty(P_INTERPOLATION, true)->setDisplayName("Interpolation");
36 }
37 
38 //! Sets link to the data item.
39 
40 void ColorMapItem::setDataItem(const Data2DItem* data_item)
41 {
42  item<LinkedItem>(P_LINK)->setLink(data_item);
43 }
44 
45 //! Returns data item linked to the given ColorMapItem.
46 
48 {
49  return item<LinkedItem>(P_LINK)->get<Data2DItem>();
50 }
static const std::string P_TITLE
Definition: colormapitem.h:31
static const std::string P_INTERPOLATION
Definition: colormapitem.h:33
static const std::string P_LINK
Definition: colormapitem.h:30
void setDataItem(const Data2DItem *item)
Sets link to the data item.
static const std::string P_GRADIENT
Definition: colormapitem.h:32
Data2DItem * dataItem() const
Returns data item linked to the given ColorMapItem.
Custom property to define list of string values with multiple selections.
Definition: comboproperty.h:27
static ComboProperty createFrom(const std::vector< std::string > &values, const std::string &current_value={})
Complex item holding mixed SessionItem types (single properties and other CompountItems).
Definition: compounditem.h:28
T * addProperty(const std::string &name)
Adds property item of given type.
Definition: compounditem.h:43
Represents two-dimensional data (axes definition and 2d array of values).
Definition: data2ditem.h:29
virtual SessionItem * setDisplayName(const std::string &name)
Sets display name (fluent interface).
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
const model_type ColorMapItemType
Definition: mvvm_types.h:46
materialitems.h Collection of materials to populate MaterialModel.
Defines class CLASS?