Graphic Calculator: FIDocalcus
Проект трёх первокурсников (по инженерному практикуму в первом семестре) по созданию графического калькулятора на FLTK C++
Loading...
Searching...
No Matches
Graph_lib::Lines Class Reference

Независимые линии More...

#include <Shapes.h>

Inheritance diagram for Graph_lib::Lines:
Collaboration diagram for Graph_lib::Lines:

Public Member Functions

 Lines ()=default
 
 Lines (std::initializer_list< Point > _points)
 
void add (Point point_1, Point point_2)
 
Color color () const
 
void draw () const
 
void draw_lines () const override
 
Color fill_color () const
 
Line_style get_style () const
 
virtual void move (int dx, int dy)
 
size_t number_of_points () const
 
Point point (int i) const
 
void set_color (Color _color)
 
void set_fill_color (Color _color)
 
void set_style (Line_style sty)
 

Protected Member Functions

void add (Point p)
 
void set_point (int i, Point p)
 

Private Attributes

Color c {static_cast<Color>(fl_color())}
 
Color f_c {Color::invisible}
 
Line_style ls {0}
 
std::vector< Pointpoints
 

Detailed Description

Независимые линии

Constructor & Destructor Documentation

◆ Lines() [1/2]

Graph_lib::Lines::Lines ( )
inlinedefault

◆ Lines() [2/2]

Graph_lib::Lines::Lines ( std::initializer_list< Point > _points)
inline
268 : Shape{_points} {
269 if (_points.size() % 2)
270 throw std::invalid_argument("odd number of points for Lines");
271 }

Member Function Documentation

◆ add() [1/2]

void Graph_lib::Shape::add ( Point p)
inlineprotectedinherited
176{ points.push_back(p); }
std::vector< Point > points
Definition Shapes.h:212
Here is the caller graph for this function:

◆ add() [2/2]

void Graph_lib::Lines::add ( Point point_1,
Point point_2 )
inline
277 {
278 Shape::add(point_1);
279 Shape::add(point_2);
280 }
void add(Point p)
Definition Shapes.h:176
Here is the call graph for this function:
Here is the caller graph for this function:

◆ color()

Color Graph_lib::Shape::color ( ) const
inlineinherited
191{ return c; }
Color c
Definition Shapes.h:213
Here is the caller graph for this function:

◆ draw()

void Graph_lib::Shape::draw ( ) const
inherited
10 {
11 Fl_Color prev_color = fl_color(); // не существует хорошего портативного
12 // способа получения текущего стиля
15 draw_lines();
16 fl_color(prev_color); // reset color (к предыдущему) and style (к дефолтному)
18}
Line_style ls
Definition Shapes.h:214
virtual void draw_lines() const
Definition Shapes.cpp:20
W & reference_to(void *ptr_wid)
Definition Widgets.h:16
unsigned int as_uint() const
Definition Shapes.h:57
pix_amount w() const
Definition Shapes.h:94
unsigned int style() const
Definition Shapes.h:96
Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_lines()

void Graph_lib::Lines::draw_lines ( ) const
overridevirtual

Reimplemented from Graph_lib::Shape.

63 {
64 if (color().visibility())
65 for (size_t i = 1; i < number_of_points(); i += 2)
66 fl_line(point(i - 1).x, point(i - 1).y, point(i).x, point(i).y);
67}
size_t number_of_points() const
Definition Shapes.h:203
Color color() const
Definition Shapes.h:191
Point point(int i) const
Definition Shapes.h:201
pix_amount y
Definition Point.h:30
pix_amount x
Definition Point.h:30
Here is the call graph for this function:

◆ fill_color()

Color Graph_lib::Shape::fill_color ( ) const
inlineinherited
199{ return f_c; }
Color f_c
Definition Shapes.h:215
Here is the caller graph for this function:

◆ get_style()

Line_style Graph_lib::Shape::get_style ( ) const
inlineinherited
195{ return ls; }

◆ move()

void Graph_lib::Shape::move ( int dx,
int dy )
virtualinherited

Reimplemented in Graph_lib::Image.

28 {
29 for (unsigned int i = 0; i < points.size(); ++i) {
30 points[i].x += dx;
31 points[i].y += dy;
32 }
33}
Here is the caller graph for this function:

◆ number_of_points()

size_t Graph_lib::Shape::number_of_points ( ) const
inlineinherited
203{ return points.size(); }
Here is the caller graph for this function:

◆ point()

Point Graph_lib::Shape::point ( int i) const
inlineinherited
201{ return points[i]; }
Here is the caller graph for this function:

◆ set_color()

void Graph_lib::Shape::set_color ( Color _color)
inlineinherited
189{ c = _color; }
Here is the caller graph for this function:

◆ set_fill_color()

void Graph_lib::Shape::set_fill_color ( Color _color)
inlineinherited
197{ f_c = _color; }

◆ set_point()

void Graph_lib::Shape::set_point ( int i,
Point p )
inlineprotectedinherited
178{ points[i] = p; }

◆ set_style()

void Graph_lib::Shape::set_style ( Line_style sty)
inlineinherited
193{ ls = sty; }

Member Data Documentation

◆ c

Color Graph_lib::Shape::c {static_cast<Color>(fl_color())}
privateinherited
213{static_cast<Color>(fl_color())};

◆ f_c

Color Graph_lib::Shape::f_c {Color::invisible}
privateinherited
@ invisible
Definition Shapes.h:41

◆ ls

Line_style Graph_lib::Shape::ls {0}
privateinherited
214{0};

◆ points

std::vector<Point> Graph_lib::Shape::points
privateinherited

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