Krita Source Code Documentation
Loading...
Searching...
No Matches
KisLayerUtils::MergeMetaData Struct Reference
+ Inheritance diagram for KisLayerUtils::MergeMetaData:

Public Member Functions

 MergeMetaData (MergeDownInfoSP info, const KisMetaData::MergeStrategy *strategy)
 
void redo () override
 
- Public Member Functions inherited from KUndo2Command
QString actionText () const
 
virtual bool canAnnihilateWith (const KUndo2Command *other) const
 
const KUndo2Command * child (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraData * extraData () const
 
bool hasParent () const
 
virtual int id () const
 
virtual bool isMerged () const
 
 KUndo2Command (const KUndo2MagicString &text, KUndo2Command *parent=0)
 
 KUndo2Command (KUndo2Command *parent=0)
 
virtual QVector< KUndo2Command * > mergeCommandsVector () const
 
virtual bool mergeWith (const KUndo2Command *other)
 
virtual void redoMergedCommands ()
 
void setEndTime ()
 
virtual void setEndTime (const QTime &time)
 
void setExtraData (KUndo2CommandExtraData *data)
 
void setText (const KUndo2MagicString &text)
 
void setTime ()
 
virtual void setTime (const QTime &time)
 
virtual void setTimedID (int timedID)
 
KUndo2MagicString text () const
 
virtual QTime time () const
 
virtual int timedId () const
 
virtual bool timedMergeWith (KUndo2Command *other)
 
virtual void undo ()
 
virtual void undoMergedCommands ()
 
virtual ~KUndo2Command ()
 

Private Attributes

MergeDownInfoSP m_info
 
const KisMetaData::MergeStrategy * m_strategy
 

Detailed Description

Definition at line 757 of file kis_layer_utils.cpp.

Constructor & Destructor Documentation

◆ MergeMetaData()

KisLayerUtils::MergeMetaData::MergeMetaData ( MergeDownInfoSP info,
const KisMetaData::MergeStrategy * strategy )
inline

Definition at line 758 of file kis_layer_utils.cpp.

759 : m_info(info),
760 m_strategy(strategy) {}
const KisMetaData::MergeStrategy * m_strategy

Member Function Documentation

◆ redo()

void KisLayerUtils::MergeMetaData::redo ( )
inlineoverridevirtual

Applies a change to the document. This function must be implemented in the derived class. Calling KUndo2QStack::push(), KUndo2QStack::undo() or KUndo2QStack::redo() from this function leads to undefined behavior.

The default implementation calls redo() on all child commands.

See also
undo()

Reimplemented from KUndo2Command.

Definition at line 762 of file kis_layer_utils.cpp.

762 {
763 QRect layerProjectionExtent = m_info->currLayer->projection()->extent();
764 QRect prevLayerProjectionExtent = m_info->prevLayer->projection()->extent();
765 int prevLayerArea = prevLayerProjectionExtent.width() * prevLayerProjectionExtent.height();
766 int layerArea = layerProjectionExtent.width() * layerProjectionExtent.height();
767
768 QList<double> scores;
769 double norm = qMax(prevLayerArea, layerArea);
770 scores.append(prevLayerArea / norm);
771 scores.append(layerArea / norm);
772
774 srcs.append(m_info->prevLayer->metaData());
775 srcs.append(m_info->currLayer->metaData());
776 m_strategy->merge(m_info->dstLayer()->metaData(), srcs, scores);
777 }
virtual void merge(Store *dst, QList< const Store * > srcs, QList< double > scores) const =0
qreal norm(const T &a)

References m_info, m_strategy, and KisMetaData::MergeStrategy::merge().

Member Data Documentation

◆ m_info

MergeDownInfoSP KisLayerUtils::MergeMetaData::m_info
private

Definition at line 780 of file kis_layer_utils.cpp.

◆ m_strategy

const KisMetaData::MergeStrategy* KisLayerUtils::MergeMetaData::m_strategy
private

Definition at line 781 of file kis_layer_utils.cpp.


The documentation for this struct was generated from the following file: