Stellarium  26.3
Public Member Functions
scm::ScmConstellationArtwork Class Reference

Class that represents a constellation artwork. More...

#include <ScmConstellationArtwork.hpp>

Public Member Functions

 ScmConstellationArtwork (const std::array< Anchor, 3 > &anchors, const QImage &artwork)
 
void setupArt ()
 Setups the artwork in the frame based on the anchors.
 
void setAnchor (int index, const Anchor &anchor)
 Sets an anchor value at the selected index. More...
 
const std::array< Anchor, 3 > & getAnchors () const
 Gets the anchors of the artwork. More...
 
void setArtwork (const QImage &artwork)
 Sets the size of the artwork in pixels. More...
 
const QImage & getArtwork () const
 Gets the artwork. More...
 
void setSourceImageFileName (const QString &fileName)
 Sets the original file name (with extension) the artwork was loaded from. More...
 
const QString & getSourceImageFileName () const
 Gets the original file name the artwork was loaded from, or an empty string.
 
bool getHasArt () const
 Get the indicator if the artwork contains art. More...
 
void draw (StelCore *core) const
 Draws the artwork. More...
 
void draw (StelCore *core, StelPainter &painter) const
 Draws the artwork. More...
 
QJsonObject toJson (const QString &relativePath) const
 Converts the artwork into stalleriums json format. More...
 
bool save (const QString &filepath) const
 Writes the image of the artwork to the disk. More...
 
void reset ()
 Resets the artwork state.
 

Detailed Description

Class that represents a constellation artwork.

Due to the lambda capture of 'this' in QObject::connect, the address of a ScmConstellationArtwork instance must not change during its lifetime!

Member Function Documentation

◆ draw() [1/2]

void scm::ScmConstellationArtwork::draw ( StelCore *  core) const

Draws the artwork.

Parameters
coreThe core to use to draw the artwork.

◆ draw() [2/2]

void scm::ScmConstellationArtwork::draw ( StelCore *  core,
StelPainter &  painter 
) const

Draws the artwork.

Parameters
coreThe core to use to draw the artwork.

◆ getAnchors()

const std::array<Anchor, 3>& scm::ScmConstellationArtwork::getAnchors ( ) const

Gets the anchors of the artwork.

Returns
const std::array<Anchor, 3>& The artwork anchors.

◆ getArtwork()

const QImage& scm::ScmConstellationArtwork::getArtwork ( ) const

Gets the artwork.

Returns
const QPixmap& The artwork.

◆ getHasArt()

bool scm::ScmConstellationArtwork::getHasArt ( ) const

Get the indicator if the artwork contains art.

Returns
true Contains art.
false Does not contain art.

◆ save()

bool scm::ScmConstellationArtwork::save ( const QString &  filepath) const

Writes the image of the artwork to the disk.

Parameters
filepathThe filepath to write the artwork to.
Returns
true Successful saved.
false Failed to save.

◆ setAnchor()

void scm::ScmConstellationArtwork::setAnchor ( int  index,
const Anchor &  anchor 
)

Sets an anchor value at the selected index.

Parameters
indexThe index to set the anchor.
anchorThe anchor to be set.

◆ setArtwork()

void scm::ScmConstellationArtwork::setArtwork ( const QImage &  artwork)

Sets the size of the artwork in pixels.

Parameters
ArtworkThe size of the artwork.

◆ setSourceImageFileName()

void scm::ScmConstellationArtwork::setSourceImageFileName ( const QString &  fileName)

Sets the original file name (with extension) the artwork was loaded from.

When set, this name is reused on export so an existing illustration keeps its original file name instead of being renamed after the constellation id.

◆ toJson()

QJsonObject scm::ScmConstellationArtwork::toJson ( const QString &  relativePath) const

Converts the artwork into stalleriums json format.

Parameters
relativePathThe relative path to the artwork on disk.
Returns
QJsonObject The json format.