32 const int row_sim_graph = 0;
33 const int row_reference_graph = 1;
37 auto model = item->
model();
44 auto model = item->
model();
52 template <
typename Data,
typename Graph,
typename Viewport>
53 void initViewport(
CompoundItem* item,
const std::string& data_name,
54 const std::string& viewport_name)
57 auto viewport = item->
addProperty<Viewport>(viewport_name);
58 auto graph = std::make_unique<GraphItem>();
59 graph->setDataItem(data);
60 viewport->insertItem(graph.release(), {ViewportItem::T_ITEMS, 0});
70 double range = ymax - ymin;
71 return {ymin - range / 10.0, ymax + range / 10.0};
130 const auto reference_data = reference_graph->dataItem();
147 return graphs.size() > 0 ? graphs.at(row_sim_graph) :
nullptr;
156 return graphs.size() > 1 ? graphs.at(row_reference_graph) :
nullptr;
164 return graphs.size() > 0 ? graphs.at(0) :
nullptr;
171 reference_graph->setFromGraphItem(graph);
178 create_difference_graph(
this);
214 graph->setNamedColor(
"cornflowerblue");
Complex item holding mixed SessionItem types (single properties and other CompountItems).
T * addProperty(const std::string &name)
Adds property item of given type.
Represents one-dimensional data (axis and values).
T * setAxis(Args &&... args)
Inserts axis of given type.
Item to represent fixed bin axis.
One-dimensional graph representation of Data1DItem.
void setDataItem(const Data1DItem *item)
Sets link to the data item.
2D viewport specialized for showing multiple GraphItem's.
std::pair< double, double > data_yaxis_range() const override
Returns lower, upper range on y-axis occupied by all data points of all graphs.
std::vector< GraphItem * > graphItems() const
Returns the selected graph items.
Item to represent pointwise axis.
T * insertItem(SessionItem *parent=nullptr, const TagRow &tagrow={})
Inserts item into given parent under given tagrow.
static const std::string T_ITEMS
SessionModel * model() const
Returns model of this item.
Holds a collection of GraphItem's for simultaneous plotting, as well as all information related to pl...
ModelView::GraphItem * specularGraph() const
Returns specular graph.
void setupReferenceGraphFrom(const ModelView::GraphItem *graph)
static const std::string P_SLD_VIEWPORT
void setupDifferenceGraphFrom(const ModelView::GraphItem *graph)
ModelView::Data1DItem * differenceData() const
CanvasItem * specularViewport() const
ModelView::Data1DItem * specularData() const
ModelView::GraphItem * differenceGraph() const
Returns graph representing a numeric difference between simulated and reference curve.
void removeDifferenceGraph()
Removes difference graph from specular viewport.
void setup_diff_viewport()
Setups viewport, difference graph, and its underlying data to show the difference between simulated a...
void setup_sld_viewport()
static const std::string P_SLD_DATA
ModelView::GraphViewportItem * diffViewport() const
ModelView::GraphItem * referenceGraph() const
Returns reference graph, if exists.
ModelView::Data1DItem * sldData() const
static const std::string P_DIFF_DATA
void setup_specular_viewport()
Setups a specular viewport together with a single graph in it and corresponding data item.
static const std::string P_DIFF_VIEWPORT
void updateDifferenceData()
Updates values stored in Data1DItem representing the difference between specular and reference graphs...
static const std::string P_SPECULAR_VIEWPORT
void updateReferenceGraph(const ModelView::GraphItem *graph)
Updates reference graph in specular viewport from external graph.
SLDCanvasItem * sldViewport() const
static const std::string P_SPECULAR_DATA
void removeReferenceGraph()
Removes reference graph from specular viewport.
Viewport intended for showing SLD profile.
std::pair< double, double > data_yaxis_range() const override
MVVM_MODEL_EXPORT void DeleteItemFromModel(SessionItem *item)
Removes and deletes item from its model.
materialitems.h Collection of materials to populate MaterialModel.
const std::string SLDCanvasItemType
const std::string JobItemType
DAREFLCORE_EXPORT void SetDifference(const ModelView::Data1DItem *data1, const ModelView::Data1DItem *data2, ModelView::Data1DItem *target)
Make target item represent difference of two Data1DItems. Target will get an axis as in data1.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.