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

Простая линяя, сост. из двух точек More...

#include <Shapes.h>

Inheritance diagram for Graph_lib::Line:
Collaboration diagram for Graph_lib::Line:

Public Member Functions

 Line (Point point_1, Point point_2)
 
Color color () const
 
void draw () const
 
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)
 
virtual void draw_lines () const
 
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

◆ Line()

Graph_lib::Line::Line ( Point point_1,
Point point_2 )
inline
225 {
226 add(point_1);
227 add(point_2);
228 }
void add(Point p)
Definition Shapes.h:176
Here is the call graph for this function:

Member Function Documentation

◆ add()

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:

◆ 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::Shape::draw_lines ( ) const
protectedvirtualinherited

Reimplemented in Graph_lib::Open_polyline, Graph_lib::Closed_polyline, Graph_lib::Lines, Graph_lib::Text, Graph_lib::Marked_polyline, Graph_lib::Image, Graphix_calc::Axis, and Graphix_calc::Segmented_graphix.

20 {
21 // (точек должно быть больше одной)
22 if (color().visibility() && 1 < points.size())
23 for (unsigned int i = 1; i < points.size(); ++i)
24 fl_line(int(points[i - 1].x), int(points[i - 1].y), int(points[i].x),
25 int(points[i].y));
26}
Color color() const
Definition Shapes.h:191
Here is the call graph for this function:
Here is the caller 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 file: