32 return axis1->
modelType() == axis2->modelType();
42 auto colorName = QString::fromStdString(graph->
colorName());
48 std::vector<ModelView::ExternalProperty> result;
49 for (
auto graph : ModelView::Utils::FindItems<ModelView::GraphItem>(model))
57 const std::string&
id)
59 for (
const auto& prop : properties)
60 if (prop.identifier() ==
id)
67 const std::vector<double>& b)
69 size_t length = std::min(a.size(), b.size());
70 std::vector<double> result(length, 0.0);
71 for (
size_t i = 0; i < length; ++i) {
72 double denom = a[i] + b[i];
73 result[i] = denom != 0.0 ? 2 * (a[i] - b[i]) / (a[i] + b[i]) : 0.0;
81 if (!areCompatibleAxes(*data1, *data2) || !areCompatibleAxes(*data1, *target))
std::string displayName() const override
Returns display name.
Represents one-dimensional data (axis and values).
static const std::string T_AXIS
std::vector< double > binValues() const
Returns values stored in bins.
void setValues(const std::vector< double > &data)
Sets internal data buffer to given data.
std::vector< double > binCenters() const
Sets axis. Bin content will be set to zero.
Property to carry text, color and identifier.
static ExternalProperty undefined()
One-dimensional graph representation of Data1DItem.
std::string colorName() const
Returns color name in #RRGGBB format.
Item to represent pointwise axis.
std::string identifier() const
Returns unique identifier.
SessionItem * getItem(const std::string &tag, int row=0) const
Returns item at given row of given tag.
SessionItem * parent() const
Returns parent item. Will return nullptr if item doesn't have a parent.
virtual std::string displayName() const
Returns display name.
T * item(const std::string &tag) const
Returns first item under given tag casted to a specified type.
model_type modelType() const
Returns item's model type.
The model to store imported reflectometry data.
QString const & name(EShape k)
DAREFLCORE_EXPORT std::vector< double > CreateDiffVector(const std::vector< double > &a, const std::vector< double > &b)
Returns vector representing elementwise 2*(a-b)/(a+b) difference over two vectors.
DAREFLCORE_EXPORT ModelView::ExternalProperty CreateProperty(const ModelView::GraphItem *graph)
Returns property representing given graph.
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.
DAREFLCORE_EXPORT ModelView::ExternalProperty FindProperty(const std::vector< ModelView::ExternalProperty > &properties, const std::string &id)
Finds the property with the same id in given vector and returns it.
DAREFLCORE_EXPORT std::vector< ModelView::ExternalProperty > CreateGraphProperties(ExperimentalDataModel *model)
Returns vector of properties representing GraphItem content of the model.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.