Locus No Pilotus
Project of four first grade MIPT DAFE/RSE students (for engineering practical work in the second semester) in Qt C++
Loading...
Searching...
No Matches
gui::TrappyLine Class Reference

Фигура линии опасного перелета More...

#include <trappy_line.h>

Inheritance diagram for gui::TrappyLine:
Collaboration diagram for gui::TrappyLine:

Public Member Functions

 TrappyLine ()=default
 
 TrappyLine (const lib::TrappyLine &data)
 
 TrappyLine (const TrappyLine &)=default
 
 TrappyLine (gui::Target *first_target, gui::Target *second_target)
 
 TrappyLine (std::pair< gui::Target *, gui::Target * > targets)
 
 TrappyLine (TrappyLine &&)=default
 
void Draw (QCustomPlot *plot) override
 Отрисовывает фигуру на полотне
 
lib::TrappyLineGetData ()
 
const lib::TrappyLineGetData () const
 
QCPGraph * GetGraphPtr () const
 Возвращает значение указателя на полотне
 
std::pair< gui::Target, gui::TargetGetTargets () const
 
std::pair< gui::Target *, gui::Target * > GetTargetsPtrs ()
 
const std::pair< gui::Target *, gui::Target * > & GetTargetsPtrs () const
 
TrappyLineoperator= (const TrappyLine &)=default
 
TrappyLineoperator= (TrappyLine &&)=default
 
bool operator== (const gui::TrappyLine &tr_line) const
 
void SetFirstTarget (gui::Target *target)
 
void SetSecondTarget (gui::Target *target)
 
void SetTargets (gui::Target *first_target, gui::Target *second_target)
 
void SetTargets (std::pair< gui::Target *, gui::Target * > targets)
 

Private Member Functions

void UpdateData (gui::Target *first_target, gui::Target *second_target)
 
void UpdateData (std::pair< gui::Target *, gui::Target * > targets)
 

Private Attributes

lib::TrappyLine data_
 
QCPGraph * graph_ {nullptr}
 
std::pair< gui::Target *, gui::Target * > targets_
 

Detailed Description

Фигура линии опасного перелета

Фигура представляет собой пунктирное красное соединение между заданными контрольными точками (причем эти точки выделяются)

Constructor & Destructor Documentation

◆ TrappyLine() [1/6]

gui::TrappyLine::TrappyLine ( )
default

◆ TrappyLine() [2/6]

gui::TrappyLine::TrappyLine ( gui::Target * first_target,
gui::Target * second_target )
inline
18 {
19 UpdateData(first_target, second_target);
20 }
void UpdateData(gui::Target *first_target, gui::Target *second_target)
Definition trappy_line.cpp:23
Here is the call graph for this function:

◆ TrappyLine() [3/6]

gui::TrappyLine::TrappyLine ( std::pair< gui::Target *, gui::Target * > targets)
inline
22 {
23 UpdateData(targets);
24 }
Here is the call graph for this function:

◆ TrappyLine() [4/6]

gui::TrappyLine::TrappyLine ( const lib::TrappyLine & data)
inline
26: data_(data) {}
lib::TrappyLine data_
Definition trappy_line.h:85

◆ TrappyLine() [5/6]

gui::TrappyLine::TrappyLine ( const TrappyLine & )
default

◆ TrappyLine() [6/6]

gui::TrappyLine::TrappyLine ( TrappyLine && )
default

Member Function Documentation

◆ Draw()

void gui::TrappyLine::Draw ( QCustomPlot * plot)
overridevirtual

Отрисовывает фигуру на полотне

Фигура представляет собой пунктирное красное соединение между заданными контрольными точками (причем эти точки выделяются)

Parameters
plotуказатель на полотно

Implements gui::Drawable.

6 {
7 graph_ = plot->addGraph(plot->xAxis, plot->yAxis);
8
9 QPen pen;
10 pen.setColor(QColor(200, 50, 50, 255));
11 pen.setStyle(Qt::DashLine);
12 graph_->setPen(pen);
13
14 graph_->setLineStyle(QCPGraph::lsLine);
15 graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 8));
16
17 auto targets = data_.GetTargets();
18
19 graph_->addData(targets.first.GetPoint().x, targets.first.GetPoint().y);
20 graph_->addData(targets.second.GetPoint().x, targets.second.GetPoint().y);
21}
QCPGraph * graph_
Definition trappy_line.h:87
std::pair< Target, Target > GetTargets() const
Definition trappy_line.cpp:27
Here is the call graph for this function:

◆ GetData() [1/2]

lib::TrappyLine & gui::TrappyLine::GetData ( )
inline
51{ return data_; }

◆ GetData() [2/2]

const lib::TrappyLine & gui::TrappyLine::GetData ( ) const
inline
50{ return data_; }
Here is the caller graph for this function:

◆ GetGraphPtr()

QCPGraph * gui::TrappyLine::GetGraphPtr ( ) const
inline

Возвращает значение указателя на полотне

Returns
QCPGraph*: указатель
65{ return graph_; }

◆ GetTargets()

std::pair< gui::Target, gui::Target > gui::TrappyLine::GetTargets ( ) const
inline
67 {
68 return std::make_pair(*targets_.first, *targets_.second);
69 }
std::pair< gui::Target *, gui::Target * > targets_
Definition trappy_line.h:91

◆ GetTargetsPtrs() [1/2]

std::pair< gui::Target *, gui::Target * > gui::TrappyLine::GetTargetsPtrs ( )
inline
71{ return targets_; }

◆ GetTargetsPtrs() [2/2]

const std::pair< gui::Target *, gui::Target * > & gui::TrappyLine::GetTargetsPtrs ( ) const
inline
73 {
74 return targets_;
75 }

◆ operator=() [1/2]

TrappyLine & gui::TrappyLine::operator= ( const TrappyLine & )
default

◆ operator=() [2/2]

TrappyLine & gui::TrappyLine::operator= ( TrappyLine && )
default

◆ operator==()

bool gui::TrappyLine::operator== ( const gui::TrappyLine & tr_line) const
inline
77 {
78 return data_ == tr_line.GetData();
79 }
const lib::TrappyLine & GetData() const
Definition trappy_line.h:50
Here is the call graph for this function:

◆ SetFirstTarget()

void gui::TrappyLine::SetFirstTarget ( gui::Target * target)
inline
34 {
35 SetTargets(target, targets_.second);
36 }
void SetTargets(gui::Target *first_target, gui::Target *second_target)
Definition trappy_line.h:42
Here is the call graph for this function:

◆ SetSecondTarget()

void gui::TrappyLine::SetSecondTarget ( gui::Target * target)
inline
38 {
39 SetTargets(targets_.first, target);
40 }
Here is the call graph for this function:

◆ SetTargets() [1/2]

void gui::TrappyLine::SetTargets ( gui::Target * first_target,
gui::Target * second_target )
inline
42 {
43 UpdateData(first_target, second_target);
44 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTargets() [2/2]

void gui::TrappyLine::SetTargets ( std::pair< gui::Target *, gui::Target * > targets)
inline
46 {
47 UpdateData(targets);
48 }
Here is the call graph for this function:

◆ UpdateData() [1/2]

void gui::TrappyLine::UpdateData ( gui::Target * first_target,
gui::Target * second_target )
private
24 {
25 data_.SetTargets(&first_target->GetData(), &second_target->GetData());
26
27 targets_.first = first_target;
28 targets_.second = second_target;
29}
lib::Target & GetData()
Definition target.h:31
void SetTargets(Target *first_target, Target *second_target)
Definition trappy_line.h:31
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateData() [2/2]

void gui::TrappyLine::UpdateData ( std::pair< gui::Target *, gui::Target * > targets)
private
31 {
32 UpdateData(targets.first, targets.second);
33}
Here is the call graph for this function:

Member Data Documentation

◆ data_

lib::TrappyLine gui::TrappyLine::data_
private

◆ graph_

QCPGraph* gui::TrappyLine::graph_ {nullptr}
private
87{nullptr};

◆ targets_

std::pair<gui::Target*, gui::Target*> gui::TrappyLine::targets_
private

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