Stellarium  HEAD
Public Slots | Public Member Functions | Static Public Attributes
scm::ScmDraw Class Reference

Public Slots

void setSearchMode (bool b)
 Is called when the search dialog is opend and closed.
 
void setMoveToAnotherStart ()
 Is called when the the user is moved to another star.
 

Public Member Functions

void drawLine (StelCore *core) const
 Draws the line between the start and the current end point. More...
 
void handleMouseClicks (QMouseEvent *)
 Handle mouse clicks. More...
 
bool handleMouseMoves (int x, int y, Qt::MouseButtons b)
 Handle mouse moves. More...
 
void handleKeys (QKeyEvent *e)
 Handle key events. More...
 
std::optional< SkyPointfindNearestPoint (int x, int y, StelProjectorP prj) const
 Finds the nearest sky point to the given position. More...
 
void undoLastLine ()
 Undo the last drawn line.
 
std::vector< StarLinegetStars () const
 Get the drawn stick figures as stars if available. More...
 
std::vector< CoordinateLinegetCoordinates () const
 Get the drawn stick figures as coordinates. More...
 
void loadLines (const std::vector< CoordinateLine > &coordinates, const std::vector< StarLine > &stars)
 Loads lines into the buffer from a tuple of coordinates and stars.
 
void setTool (DrawTools tool)
 Set the active draw tool. More...
 
void setDrawingMode (DrawingMode mode)
 Sets the drawing mode. More...
 
void resetDrawing ()
 Resets the currently drawn lines.
 

Static Public Attributes

static const StelCore::FrameType drawFrame = StelCore::FrameJ2000
 The frame that is used for calculation and is drawn on.
 

Member Function Documentation

◆ drawLine()

void scm::ScmDraw::drawLine ( StelCore core) const

Draws the line between the start and the current end point.

Parameters
coreThe core used for drawing the line.

◆ findNearestPoint()

std::optional<SkyPoint> scm::ScmDraw::findNearestPoint ( int  x,
int  y,
StelProjectorP  prj 
) const

Finds the nearest sky point to the given position.

Parameters
xThe x viewport coordinate of the mouse.
yThe y viewport coordinate of the mouse.
prjThe projector to use for the calculation.
Returns
std::optional<SkyPoint> A point in the sky or std::nullopt if no point was found.

◆ getCoordinates()

std::vector<CoordinateLine> scm::ScmDraw::getCoordinates ( ) const

Get the drawn stick figures as coordinates.

Returns
std::vector<CoordinateLine> The drawn coordinates.

◆ getStars()

std::vector<StarLine> scm::ScmDraw::getStars ( ) const

Get the drawn stick figures as stars if available.

Returns
std::vector<StarLine> The optional filled vector of stars matching the coordinates.

◆ handleKeys()

void scm::ScmDraw::handleKeys ( QKeyEvent *  e)

Handle key events.

Please note that most of the interactions will be done through the GUI module.

Parameters
ethe Key event
Returns
set the event as accepted if it was intercepted

◆ handleMouseClicks()

void scm::ScmDraw::handleMouseClicks ( QMouseEvent *  )

Handle mouse clicks.

Please note that most of the interactions will be done through the GUI module.

Returns
set the event as accepted if it was intercepted

◆ handleMouseMoves()

bool scm::ScmDraw::handleMouseMoves ( int  x,
int  y,
Qt::MouseButtons  b 
)

Handle mouse moves.

Please note that most of the interactions will be done through the GUI module.

Returns
true if the event was intercepted

◆ setDrawingMode()

void scm::ScmDraw::setDrawingMode ( DrawingMode  mode)
inline

Sets the drawing mode.

Parameters
modeThe drawing mode to use.

◆ setTool()

void scm::ScmDraw::setTool ( DrawTools  tool)

Set the active draw tool.

Parameters
toolThe tool to be used.