Krita Source Code Documentation
Loading...
Searching...
No Matches
KisMetaData::OnlyIdenticalMergeStrategy Class Reference

#include <kis_meta_data_merge_strategy_p.h>

+ Inheritance diagram for KisMetaData::OnlyIdenticalMergeStrategy:

Public Member Functions

QString description () const override
 
QString id () const override
 
void merge (Store *dst, QList< const Store * > srcs, QList< double > score) const override
 
QString name () const override
 
 OnlyIdenticalMergeStrategy ()
 
 ~OnlyIdenticalMergeStrategy () override
 

Detailed Description

Definition at line 40 of file kis_meta_data_merge_strategy_p.h.

Constructor & Destructor Documentation

◆ OnlyIdenticalMergeStrategy()

OnlyIdenticalMergeStrategy::OnlyIdenticalMergeStrategy ( )

Definition at line 98 of file kis_meta_data_merge_strategy_p.cc.

99{
100}

◆ ~OnlyIdenticalMergeStrategy()

OnlyIdenticalMergeStrategy::~OnlyIdenticalMergeStrategy ( )
override

Definition at line 102 of file kis_meta_data_merge_strategy_p.cc.

103{
104}

Member Function Documentation

◆ description()

QString OnlyIdenticalMergeStrategy::description ( ) const
overridevirtual
Returns
a description of this merge strategy

Implements KisMetaData::MergeStrategy.

Definition at line 115 of file kis_meta_data_merge_strategy_p.cc.

116{
117 return i18n("Keep only meta data that are identical");
118}

◆ id()

QString OnlyIdenticalMergeStrategy::id ( ) const
overridevirtual
Returns
the id of this merge strategy

Implements KisMetaData::MergeStrategy.

Definition at line 106 of file kis_meta_data_merge_strategy_p.cc.

107{
108 return "OnlyIdentical";
109}

◆ merge()

void OnlyIdenticalMergeStrategy::merge ( Store * dst,
QList< const Store * > srcs,
QList< double > scores ) const
overridevirtual

Call this function to merge a list of meta data stores in one.

Parameters
dstthe destination store
srcsthe list of source meta data store
scoresa list of score which defines the importance of each store compared to the other the sum of score is expected to be equal to 1.0. One way to attribute a score is to compute the area of each layer and then to give a higher score to the biggest layer. srcs and scores list must have the same size.

Implements KisMetaData::MergeStrategy.

Definition at line 120 of file kis_meta_data_merge_strategy_p.cc.

121{
122 Q_UNUSED(score);
123 dbgMetaData << "OnlyIdenticalMergeStrategy";
124 dbgMetaData << "Priority to first meta data";
125
126 Q_ASSERT(srcs.size() > 0);
127 QList<QString> keys = srcs[0]->keys();
128 Q_FOREACH (const QString & key, keys) {
129 bool keep = true;
130 const Entry& e = srcs[0]->getEntry(key);
131 const Value& v = e.value();
132 Q_FOREACH (const Store* store, srcs) {
133 if (!(store->containsEntry(key) && e.value() == v)) {
134 keep = false;
135 break;
136 }
137 }
138 if (keep) {
139 dst->addEntry(e);
140 }
141 }
142}
qreal v
#define dbgMetaData
Definition kis_debug.h:61

References KisMetaData::Store::addEntry(), KisMetaData::Store::containsEntry(), dbgMetaData, v, and KisMetaData::Entry::value().

◆ name()

QString OnlyIdenticalMergeStrategy::name ( ) const
overridevirtual
Returns
the name of this merge strategy

Implements KisMetaData::MergeStrategy.

Definition at line 110 of file kis_meta_data_merge_strategy_p.cc.

111{
112 return i18n("Only identical");
113}

The documentation for this class was generated from the following files: