digiKam
Digikam::TagRegion Class Reference

Public Types

enum  Type { Invalid , Rect }
 

Public Member Functions

bool intersects (const TagRegion &other, double fraction=0)
 
bool isValid () const
 
bool operator!= (const TagRegion &other) const
 
bool operator== (const TagRegion &other) const
 
 TagRegion ()
 
 TagRegion (const QRect &rect)
 
 TagRegion (const QString &descriptor)
 
QRect toRect () const
 
QVariant toVariant () const
 
QString toXml () const
 
Type type () const
 

Static Public Member Functions

static QRectF absoluteToRelative (const QRect &region, const QSize &fullSize)
 
static QSize adjustToOrientation (QRect &region, int orientation, const QSize &fullSize)
 
static TagRegion fromVariant (const QVariant &var)
 
static QRect mapFromOriginalSize (const DImg &reducedSizeImage, const QRect &fullSizeDetail)
 
static QRect mapFromOriginalSize (const QSize &fullImageSize, const QSize &reducedImageSize, const QRect &fullSizeDetail)
 
static QRect mapToOriginalSize (const DImg &reducedSizeImage, const QRect &reducedSizeDetail)
 
static QRect mapToOriginalSize (const QSize &fullImageSize, const QSize &reducedImageSize, const QRect &reducedSizeDetail)
 
static QRect relativeToAbsolute (const QRectF &region, const DImg &reducedSizeImage)
 
static QRect relativeToAbsolute (const QRectF &region, const QSize &fullSize)
 
static void reverseToOrientation (QRect &region, int orientation, const QSize &fullSize)
 

Protected Attributes

Type m_type
 
QVariant m_value
 

Member Enumeration Documentation

◆ Type

Enumerator
Invalid 
Rect 

Constructor & Destructor Documentation

◆ TagRegion() [1/3]

Digikam::TagRegion::TagRegion ( )

Use this small class to convert between the formatted textual representation of a tag region in the database and the corresponding object. Construct an invalid region.

Referenced by fromVariant().

◆ TagRegion() [2/3]

Digikam::TagRegion::TagRegion ( const QString &  descriptor)
explicit

Construct with the textual descriptor.

References m_type, m_value, and Rect.

◆ TagRegion() [3/3]

Digikam::TagRegion::TagRegion ( const QRect &  rect)
explicit

Construct with the region.

Member Function Documentation

◆ absoluteToRelative()

QRectF Digikam::TagRegion::absoluteToRelative ( const QRect &  region,
const QSize &  fullSize 
)
static

Takes absolute region and full size to return the original relative region. Used to write back rectangles into image's XMP. see MetadataHub::write.

Referenced by Digikam::MetadataHub::loadFaceTags(), Digikam::MetadataHub::setFaceTags(), and Digikam::FocusPointGroup::slotAddItemFinished().

◆ adjustToOrientation()

◆ fromVariant()

TagRegion Digikam::TagRegion::fromVariant ( const QVariant &  var)
static

◆ intersects()

bool Digikam::TagRegion::intersects ( const TagRegion other,
double  fraction = 0 
)

Returns true if this and the other region intersect. fraction describes the relative overlap area needed to return true: If fraction is 0, returns true if the regions intersect at all. If fraction is 1, returns true only if other is completely contained in this region. If fraction is x, 0 < x < 1, returns true if the area of this region covered by the other is greater than x. Invalid areas never intersect.

References Invalid, m_type, Rect, and toRect().

Referenced by Digikam::DetectionBenchmarker::process(), and Digikam::FaceUtils::writeUnconfirmedResults().

◆ isValid()

bool Digikam::TagRegion::isValid ( ) const

◆ mapFromOriginalSize() [1/2]

QRect Digikam::TagRegion::mapFromOriginalSize ( const DImg reducedSizeImage,
const QRect &  fullSizeDetail 
)
static

◆ mapFromOriginalSize() [2/2]

QRect Digikam::TagRegion::mapFromOriginalSize ( const QSize &  fullImageSize,
const QSize &  reducedImageSize,
const QRect &  fullSizeDetail 
)
static

◆ mapToOriginalSize() [1/2]

QRect Digikam::TagRegion::mapToOriginalSize ( const DImg reducedSizeImage,
const QRect &  reducedSizeDetail 
)
static

Takes the original and reduced size from the DImg.

References mapToOriginalSize(), Digikam::DImg::originalRatioSize(), and Digikam::DImg::size().

◆ mapToOriginalSize() [2/2]

QRect Digikam::TagRegion::mapToOriginalSize ( const QSize &  fullImageSize,
const QSize &  reducedImageSize,
const QRect &  reducedSizeDetail 
)
static

Converts detail rectangles taken from a reduced size image to the original size, and vice versa.

Referenced by mapToOriginalSize().

◆ operator!=()

bool Digikam::TagRegion::operator!= ( const TagRegion other) const

◆ operator==()

bool Digikam::TagRegion::operator== ( const TagRegion other) const

References m_type, and m_value.

◆ relativeToAbsolute() [1/2]

QRect Digikam::TagRegion::relativeToAbsolute ( const QRectF &  region,
const DImg reducedSizeImage 
)
static

Takes the original and reduced size from the DImg, maps to original size.

References Digikam::DImg::originalRatioSize(), and relativeToAbsolute().

◆ relativeToAbsolute() [2/2]

QRect Digikam::TagRegion::relativeToAbsolute ( const QRectF &  region,
const QSize &  fullSize 
)
static

Takes a relative region and a full size and returns the absolute region.

Referenced by Digikam::ItemScanner::commitFaces(), and relativeToAbsolute().

◆ reverseToOrientation()

◆ toRect()

◆ toVariant()

QVariant Digikam::TagRegion::toVariant ( ) const

Stores in / loads from a variant. Will only use native QVariant types.

References m_value.

Referenced by Digikam::operator<<(), and Digikam::FaceTagsIface::toVariant().

◆ toXml()

◆ type()

TagRegion::Type Digikam::TagRegion::type ( ) const

References m_type.

Member Data Documentation

◆ m_type

Type Digikam::TagRegion::m_type
protected

◆ m_value

QVariant Digikam::TagRegion::m_value
protected

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