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 KUndo2Commandchild (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraDataextraData () 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::MergeStrategym_strategy
 

Detailed Description

Definition at line 726 of file kis_layer_utils.cpp.

Constructor & Destructor Documentation

◆ MergeMetaData()

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

Definition at line 727 of file kis_layer_utils.cpp.

728 : m_info(info),
729 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 731 of file kis_layer_utils.cpp.

731 {
732 QRect layerProjectionExtent = m_info->currLayer->projection()->extent();
733 QRect prevLayerProjectionExtent = m_info->prevLayer->projection()->extent();
734 int prevLayerArea = prevLayerProjectionExtent.width() * prevLayerProjectionExtent.height();
735 int layerArea = layerProjectionExtent.width() * layerProjectionExtent.height();
736
737 QList<double> scores;
738 double norm = qMax(prevLayerArea, layerArea);
739 scores.append(prevLayerArea / norm);
740 scores.append(layerArea / norm);
741
743 srcs.append(m_info->prevLayer->metaData());
744 srcs.append(m_info->currLayer->metaData());
745 m_strategy->merge(m_info->dstLayer()->metaData(), srcs, scores);
746 }
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 749 of file kis_layer_utils.cpp.

◆ m_strategy

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

Definition at line 750 of file kis_layer_utils.cpp.


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