Stellarium  HEAD
Public Member Functions | Protected Member Functions
ScmConstellationImageAnchor Class Reference

Public Member Functions

 ScmConstellationImageAnchor (QPointF position, qreal diameter)
 
void setDiameter (qreal diameter)
 Set the diameter of this anchor. More...
 
void setPosDiameter (qreal x, qreal y, qreal diameter)
 Set the position and diameter of this anchor. More...
 
void setSelectionReference (ScmConstellationImageAnchor *&anchor)
 Set the reference to the selected anchor. More...
 
void select ()
 Selects this anchor.
 
void deselect ()
 Deselects this anchor.
 
void setSelectionChangedCallback (std::function< void()> func)
 Set the selection changed callback function.
 
void setPositionChangedCallback (std::function< void()> func)
 Set the position changed callback function.
 
void setMovementBounds (const QRectF &bounds)
 Set the bounds in which the anchors can be moved. More...
 
void setStarHip (StarId hip)
 set the bound star ID of this anchor.
 
bool trySetStarHip (const QString &id)
 Tries to extract the hip from the star id. More...
 
const StarId & getStarHip () const
 Get the star hip id. More...
 
void updateColor ()
 Updates the color of the anchor based on its current state.
 
Vec2i getPosition () const
 Get the position of the anchor in the parent image. More...
 
void setPosition (const Vec2i &position)
 Set the position of the anchor in the parent image. More...
 

Protected Member Functions

void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 

Member Function Documentation

◆ getPosition()

Vec2i ScmConstellationImageAnchor::getPosition ( ) const

Get the position of the anchor in the parent image.

Returns
Vec2i The position of the anchor.

◆ getStarHip()

const StarId& ScmConstellationImageAnchor::getStarHip ( ) const

Get the star hip id.

Returns
const QString&

◆ setDiameter()

void ScmConstellationImageAnchor::setDiameter ( qreal  diameter)

Set the diameter of this anchor.

Parameters
diameterThe diameter of this round anchor.

◆ setMovementBounds()

void ScmConstellationImageAnchor::setMovementBounds ( const QRectF &  bounds)

Set the bounds in which the anchors can be moved.

Parameters
boundsThe bound the anchor can be moved in.

◆ setPosDiameter()

void ScmConstellationImageAnchor::setPosDiameter ( qreal  x,
qreal  y,
qreal  diameter 
)

Set the position and diameter of this anchor.

Parameters
xThe x position in the scene.
yThe y position in the scene.
diameterThe diameter of this anchor.

◆ setPosition()

void ScmConstellationImageAnchor::setPosition ( const Vec2i position)

Set the position of the anchor in the parent image.

Parameters
positionThe position of the anchor.

◆ setSelectionReference()

void ScmConstellationImageAnchor::setSelectionReference ( ScmConstellationImageAnchor *&  anchor)

Set the reference to the selected anchor.

Parameters
anchorThe pointer to the selection anchor.

◆ trySetStarHip()

bool ScmConstellationImageAnchor::trySetStarHip ( const QString &  id)

Tries to extract the hip from the star id.

Parameters
idThe id to extract the hip from.
Returns
true Success.
false Failed.