-
Notifications
You must be signed in to change notification settings - Fork 2
/
canvas_delegate.cpp
683 lines (601 loc) · 20.1 KB
/
canvas_delegate.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
/*This file is part of Circle Packings.
Circle Packings is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Circle Packings is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Circle Packings. If not, see <http://www.gnu.org/licenses/>.*/
#include <QPainter>
#include <QString>
#include <QApplication>
#include "canvas_delegate.hpp"
#include "graph.hpp"
#include "curve.hpp"
#include "point.hpp"
#include "circle.hpp"
#include "triangulation.hpp"
#include "triangle.hpp"
#include "window.hpp"
Canvas_Delegate::Canvas_Delegate()
{
}
void Canvas_Delegate::rescale(int size_in_pixels)
{
//std::cout << "Entering Canvas_Delegate::rescale" << std::endl;
size_in_pixels_ = size_in_pixels;
scale_ = zoom_*size_in_pixels/3.0;
origin_x_in_pixels_ = size_in_pixels/2.0 + shift_x_*scale_;
origin_y_in_pixels_ = size_in_pixels/2.0 + shift_y_*scale_;
return;
}
void Canvas_Delegate::common_reset()
{
//std::cout << "Entering Canvas_Delegate::common_reset" << std::endl;
scale_ = size_in_pixels_/3.0;
origin_x_in_pixels_ = int_round(size_in_pixels_/2.0);
origin_y_in_pixels_ = int_round(size_in_pixels_/2.0);
shift_x_ = 0.0;
shift_y_ = 0.0;
zoom_ = 1.0;
click_on_ = false;
is_vertex_highlighted_ = false;
is_vertex_under_mouse_ = false;
return;
}
void Canvas_Delegate::common_reset_selected_stuff()
{
is_vertex_highlighted_ = false;
is_vertex_under_mouse_ = false;
return;
}
void Canvas_Delegate::reset_selected_stuff()
{
common_reset_selected_stuff();
return;
}
void Canvas_Delegate::set_vertex_highlighted(bool is_vertex_highlighted, const unsigned int &index_vertex_highlighted)
{
is_vertex_highlighted_ = is_vertex_highlighted;
index_vertex_highlighted_ = index_vertex_highlighted;
return;
}
double Canvas_Delegate::y_min_canvas()
{
return imag(pixels_to_complex_coordinates(integer_coordinates(0, size_in_pixels_)));
}
double Canvas_Delegate::y_max_canvas()
{
return imag(pixels_to_complex_coordinates(integer_coordinates(0, 0)));
}
integer_coordinates Canvas_Delegate::complex_to_pixels_coordinates(const complex_number &z) const
{
int X = int_round(real(z)*scale_ + origin_x_in_pixels_);
int Y = int_round(-imag(z)*scale_ + origin_y_in_pixels_);
return integer_coordinates(X,Y);
}
complex_number Canvas_Delegate::pixels_to_complex_coordinates(const integer_coordinates &xy) const
{
double x = (1.0*xy.first - 1.0*origin_x_in_pixels_)*1.0/scale_;
double y = (1.0*origin_y_in_pixels_ - 1.0*xy.second)*1.0/scale_;
return complex_number(x,y);
}
void Canvas_Delegate::draw_point(const Point &point, const QColor &color)
{
int x = complex_to_pixels_coordinates(point.get_affix()).first;
int y = complex_to_pixels_coordinates(point.get_affix()).second;
pen_.setWidth(1);
pen_.setColor(color);
painter_->setPen(pen_);
painter_->drawPoint(x,y);
return;
}
void Canvas_Delegate::draw_segment(const segment &S, const QColor &color, const int &width)
{
int x_1 = complex_to_pixels_coordinates(S.first.get_affix()).first;
int y_1 = complex_to_pixels_coordinates(S.first.get_affix()).second;
int x_2 = complex_to_pixels_coordinates(S.second.get_affix()).first;
int y_2 = complex_to_pixels_coordinates(S.second.get_affix()).second;
pen_.setWidth(width);
pen_.setColor(color);
painter_->setPen(pen_);
painter_->drawLine(QPoint(x_1, y_1), QPoint(x_2, y_2));
return;
}
void Canvas_Delegate::draw_triangle(const Triangle &T, const QColor &color, bool draw_borders)
{
Point A, B, C;
T.get_ABC(A, B, C);
complex_number z_A = A.get_affix(), z_B = B.get_affix(), z_C = C.get_affix();
integer_coordinates xy_A = complex_to_pixels_coordinates(z_A);
integer_coordinates xy_B = complex_to_pixels_coordinates(z_B);
integer_coordinates xy_C = complex_to_pixels_coordinates(z_C);
brush_.setColor(color);
if (draw_borders)
{
pen_.setWidth(1);
pen_.setColor(QColor("black"));
painter_->setPen(pen_);
}
else
{
painter_->setPen(color);
}
painter_->setBrush(brush_);
QVector<QPoint> triangle;
triangle.append(QPoint(xy_A.first, xy_A.second));
triangle.append(QPoint(xy_B.first, xy_B.second));
triangle.append(QPoint(xy_C.first, xy_C.second));
painter_->drawPolygon(QPolygon(triangle));
return;
}
void Canvas_Delegate::draw_circle(const Circle &circle, QColor const& color, int height_compensation)
{
double r = circle.get_radius();
complex_number first_corner = circle.get_affix() + complex_number(-r,r);
complex_number second_corner = circle.get_affix() + complex_number(r,-r);
integer_coordinates first_corner_pixels = complex_to_pixels_coordinates(first_corner);
integer_coordinates second_corner_pixels = complex_to_pixels_coordinates(second_corner);
int width = second_corner_pixels.first - first_corner_pixels.first;
int height = second_corner_pixels.second - first_corner_pixels.second;
brush_.setColor(color);
painter_->setBrush(brush_);
painter_->drawEllipse(first_corner_pixels.first, first_corner_pixels.second, width, height +
height_compensation);
return;
}
void Canvas_Delegate::mark_circle(const Circle &circle, const QColor &color)
{
double r = circle.get_radius();
complex_number first_corner = circle.get_affix() + complex_number(-r,r);
complex_number second_corner = circle.get_affix() + complex_number(r,-r);
integer_coordinates first_corner_pixels = complex_to_pixels_coordinates(first_corner);
integer_coordinates second_corner_pixels = complex_to_pixels_coordinates(second_corner);
int width = second_corner_pixels.first - first_corner_pixels.first;
int height = second_corner_pixels.second - first_corner_pixels.second;
pen_.setColor(color);
pen_.setWidth(3);
painter_->setPen(pen_);
painter_->setBrush(Qt::NoBrush);
painter_->drawEllipse(first_corner_pixels.first, first_corner_pixels.second, width, height);
return;
}
void Canvas_Delegate::mark_triangle(const Triangle &T, const QColor &color)
{
//std::cout << "throw test in Canvas_Delegate::mark_triangle" << std::endl;
//throw(QString("ERROR in Canvas_Delegate::mark_triangle: sample error"));
Point A, B, C;
T.get_ABC(A, B, C);
complex_number z_A = A.get_affix(), z_B = B.get_affix(), z_C = C.get_affix();
integer_coordinates xy_A = complex_to_pixels_coordinates(z_A);
integer_coordinates xy_B = complex_to_pixels_coordinates(z_B);
integer_coordinates xy_C = complex_to_pixels_coordinates(z_C);
pen_.setColor(color);
pen_.setWidth(3);
painter_->setPen(pen_);
painter_->setBrush(Qt::NoBrush);
QVector<QPoint> triangle;
triangle.append(QPoint(xy_A.first, xy_A.second));
triangle.append(QPoint(xy_B.first, xy_B.second));
triangle.append(QPoint(xy_C.first, xy_C.second));
painter_->drawPolygon(QPolygon(triangle));
return;
}
void Canvas_Delegate::draw_curve(const Curve& curve)
{
QColor black("black");
unsigned int i;
for (i=0; i<curve.nb_points(); i++)
{
draw_segment(curve.get_segment(i), black, 2);
}
return;
}
void Canvas_Delegate::draw_incomplete_curve(const std::vector<Point> &nodes, const QColor &color)
{
unsigned int i;
if (nodes.size() > 1)
{
for (i=0; i<nodes.size()-1; i++)
{
draw_segment(segment(nodes[i], nodes[i+1]), color, 2);
}
}
return;
}
void Canvas_Delegate::draw_nodes(const std::vector<Point> &nodes, const double &nodes_radius, const QColor &color)
{
unsigned int i;
painter_->setPen(Qt::NoPen);
for (i=0; i<nodes.size(); i++)
{
draw_circle(Circle(nodes[i], nodes_radius), color);
}
return;
}
void Canvas_Delegate::draw_tangents(const std::vector<Point> &nodes,
const std::vector<complex_number> &tangent_factors,
const double &control_points_radius)
{
QColor color("red");
unsigned int i, N = nodes.size();
complex_number z_left, z_right;
Point T;
for (i=0; i<N; i++)
{
z_left = nodes[(N+i-1)%N].get_affix();
z_right = nodes[(i+1)%N].get_affix();
T = Point(nodes[i].get_affix() + tangent_factors[i] * (z_right - z_left));
draw_segment(segment(nodes[i], T), color);
mark_circle(Circle(T, control_points_radius), color);
}
return;
}
void Canvas_Delegate::draw_circle_packing(const Graph<Circle> &circle_packing,
bool is_circle_containing_all, unsigned int index_circle_containing_all)
{
if (draw_borders_)
{
pen_.setWidth(1);
pen_.setColor(QColor("black"));
painter_->setPen(pen_);
}
else
{
painter_->setPen(Qt::NoPen);
}
unsigned int i;
if (is_circle_containing_all)
{
painter_->setOpacity(0.5);
draw_circle(circle_packing.get_content_by_index(index_circle_containing_all),
circle_packing.get_color_by_index(index_circle_containing_all));
painter_->setOpacity(1.0);
for(i=0; i<circle_packing.nb_vertices(); i++)
{
if (i != index_circle_containing_all)
{
draw_circle(circle_packing.get_content_by_index(i), circle_packing.get_color_by_index(i));
}
}
}
else
{
for(i=0; i<circle_packing.nb_vertices(); i++)
{
draw_circle(circle_packing.get_content_by_index(i), circle_packing.get_color_by_index(i));
}
}
return;
}
void Canvas_Delegate::draw_tiling_cp(const Graph<Circle> &tiling_cp)
{
if (draw_borders_)
{
pen_.setWidth(1);
pen_.setColor(QColor("black"));
painter_->setPen(pen_);
}
else
{
painter_->setPen(Qt::NoPen);
}
complex_number centre, top_left_corner, bottom_right_corner;
double radius;
int height, height_compensation;
integer_coordinates top_left_corner_pixels, top_left_corner_pixels_below, bottom_right_corner_pixels;
unsigned int i;
for(i=0; i<tiling_cp.nb_vertices(); i++)
{
radius = tiling_cp.get_content_by_index(i).get_radius();
centre = tiling_cp.get_affix_by_index(i);
top_left_corner = centre + complex_number(-radius,radius);
bottom_right_corner = centre + complex_number(radius,-radius);
top_left_corner_pixels = complex_to_pixels_coordinates(top_left_corner);
top_left_corner_pixels_below = complex_to_pixels_coordinates(top_left_corner + complex_number(radius, -sqrt(3.0)*radius));
bottom_right_corner_pixels = complex_to_pixels_coordinates(bottom_right_corner);
height = bottom_right_corner_pixels.second - top_left_corner_pixels.second;
height_compensation = int_round(scale_*((2.0-sqrt(3.0))*radius)) -
(height - (top_left_corner_pixels_below.second - top_left_corner_pixels.second));
draw_circle(tiling_cp.get_content_by_index(i), tiling_cp.get_color_by_index(i), height_compensation);
}
return;
}
void Canvas_Delegate::draw_triangulation(const Triangulation &triangulation)
{
pen_.setWidth(1);
painter_->setPen(pen_);
Triangle T;
unsigned int i;
for (i=0; i<triangulation.nb_triangles(); i++)
{
if (triangulation.get_triangle(i, T))
{
draw_triangle(T, triangulation.get_color(i), draw_borders_);
}
}
}
void Canvas_Delegate::draw_empty_triangulation(const Triangulation &triangulation)
{
painter_->setOpacity(0.2);
QColor transparent(0, 0, 0, 0);
Triangle T;
unsigned int i;
for (i=0; i<triangulation.nb_triangles(); i++)
{
if (triangulation.get_triangle(i, T))
{
draw_triangle(T, transparent, true);
}
}
painter_->setOpacity(1.0);
}
void Canvas_Delegate::draw_planar_graph(const Graph<Point> &planar_graph, const double& graph_points_radius)
{
std::vector<vertex_label> N;
Point P_i, P_j;
unsigned int i, j;
for (i=0; i<planar_graph.nb_vertices(); i++)
{
P_i = planar_graph.get_content_by_index(i);
N = planar_graph.get_neighbors_by_index(i);
for (j=0; j<N.size(); j++)
{
if (N[j]< (int) i)
{
continue;
}
P_j = planar_graph.get_content_by_label(N[j]);
draw_segment(segment(P_i, P_j));
}
}
painter_->setPen(Qt::NoPen);
for (i=0; i<planar_graph.nb_vertices(); i++)
{
P_i = planar_graph.get_content_by_index(i);
draw_circle(Circle(P_i, graph_points_radius), planar_graph.get_color_by_index(i));
}
return;
}
void Canvas_Delegate::draw_tiling(const Graph<Circle> &tiling)
{
QColor black("black");
unsigned int i;
for (i=0; i<tiling.nb_vertices(); i++)
{
draw_point(tiling.get_content_by_index(i).get_centre(), black);
}
return;
}
bool Canvas_Delegate::draw_pixel(int x, int y, QRgb color)
{
if(x<0 || y<0 || x >= size_in_pixels_ || y >= size_in_pixels_)
{
return false;
}
*(canvas_image_data_ + y * canvas_image_width_ + x) = color;
return true;
}
void Canvas_Delegate::wheel_event(const int &delta, integer_coordinates point_coordinates_in_pixels)
{
//std::cout << "Entering Canvas_Delegate::wheel_event with delta = " << delta << std::endl;
double coeff = pow(2,0.5*delta/240.0);
zoom(coeff, point_coordinates_in_pixels, true);
return;
}
void Canvas_Delegate::shift_event()
{
complex_number delta = scale_*(point_under_mouse_.get_affix() - point_clicked_.get_affix());
double x_shift = real(delta);
double y_shift = imag(delta);
if(origin_x_in_pixels_ + x_shift> scale_*1.5)
{
origin_x_in_pixels_ = int_round(scale_*1.5);
}
else if(origin_x_in_pixels_ + x_shift < size_in_pixels_-scale_*1.5)
{
origin_x_in_pixels_ = int_round(size_in_pixels_-scale_*1.5);
}
else
{
origin_x_in_pixels_ = origin_x_in_pixels_ + x_shift;
}
if(origin_y_in_pixels_ - y_shift > scale_*1.5)
{
origin_y_in_pixels_ = int_round(scale_*1.5);
}
else if(origin_y_in_pixels_ - y_shift < size_in_pixels_-scale_*1.5)
{
origin_y_in_pixels_ = int_round(size_in_pixels_ -scale_*1.5);
}
else
{
origin_y_in_pixels_ = origin_y_in_pixels_ - y_shift;
}
shift_x_ = (origin_x_in_pixels_ - size_in_pixels_/2.0)/scale_;
shift_y_ = (origin_y_in_pixels_ - size_in_pixels_/2.0)/scale_;
return;
}
void Canvas_Delegate::zoom(const double &coeff, integer_coordinates point_coordinates_in_pixels, bool zoom_on_mouse)
{
bool update_point_under_mouse = false;
double coeff2;
int x, y;
double X, Y;
integer_coordinates last;
if (zoom_on_mouse)
{
x = point_coordinates_in_pixels.first;
y = point_coordinates_in_pixels.second;
X = real(point_under_mouse_.get_affix());
Y = imag(point_under_mouse_.get_affix());
}
else
{
x = size_in_pixels_/2;
y = size_in_pixels_/2;
complex_number Z = pixels_to_complex_coordinates(integer_coordinates(x, y));
X = real(Z);
Y = imag(Z);
last = complex_to_pixels_coordinates(point_under_mouse_.get_affix());
}
if(scale_*coeff<size_in_pixels_/3)
{
coeff2 = size_in_pixels_/(scale_*3);
zoom_ = 1;
}
else
{
coeff2 = coeff;
zoom_*=coeff;
}
scale_ *= coeff2;
if(int_round(x- scale_*X)> scale_*1.5)
{
origin_x_in_pixels_ = scale_*1.5;
update_point_under_mouse = true;
}
else if(int_round(x- scale_*X) < size_in_pixels_-scale_*1.5)
{
origin_x_in_pixels_ = size_in_pixels_-scale_*1.5;
update_point_under_mouse = true;
}
else
{
//origin_x_in_pixels_ = size_in_pixels_/2 -coeff2*(size_in_pixels_/2-origin_x_in_pixels_);
origin_x_in_pixels_ = int_round(x- scale_*X);
}
if(int_round(y+ scale_*Y) > scale_*1.5)
{
origin_y_in_pixels_ = scale_*1.5;
update_point_under_mouse = true;
}
else if(int_round(y+ scale_*Y) < size_in_pixels_-scale_*1.5)
{
origin_y_in_pixels_ = size_in_pixels_ -scale_*1.5;
update_point_under_mouse = true;
}
else
{
//origin_y_in_pixels_ = size_in_pixels_/2 - coeff2*(size_in_pixels_/2-origin_y_in_pixels_);
origin_y_in_pixels_ = int_round(y+ scale_*Y);
}
shift_x_ = (origin_x_in_pixels_ - size_in_pixels_/2.0)/scale_;
shift_y_ = (origin_y_in_pixels_ - size_in_pixels_/2.0)/scale_;
if (update_point_under_mouse && zoom_on_mouse)
{
//point_under_mouse_ = Point(pixels_to_complex_coordinates(point_coordinates_in_pixels));
set_point_under_mouse(point_coordinates_in_pixels);
mouse_move_event();
}
else if(!zoom_on_mouse)
{
set_point_under_mouse(last);
mouse_move_event();
}
return;
}
void Canvas_Delegate::shift_left()
{
integer_coordinates last = complex_to_pixels_coordinates(point_under_mouse_.get_affix());
int x_shift = 20;
if(origin_x_in_pixels_ + x_shift> scale_*1.5)
{
origin_x_in_pixels_ = scale_*1.5;
}
else if(origin_x_in_pixels_ + x_shift < size_in_pixels_-scale_*1.5)
{
origin_x_in_pixels_ = size_in_pixels_-scale_*1.5;
}
else
{
origin_x_in_pixels_ = origin_x_in_pixels_ + x_shift;
}
shift_x_ = (origin_x_in_pixels_ - size_in_pixels_/2.0)/scale_;
set_point_under_mouse(last);
mouse_move_event();
return;
}
void Canvas_Delegate::shift_right()
{
integer_coordinates last = complex_to_pixels_coordinates(point_under_mouse_.get_affix());
int x_shift = -20;
if(origin_x_in_pixels_ + x_shift> scale_*1.5)
{
origin_x_in_pixels_ = scale_*1.5;
}
else if(origin_x_in_pixels_ + x_shift < size_in_pixels_-scale_*1.5)
{
origin_x_in_pixels_ = size_in_pixels_-scale_*1.5;
}
else
{
origin_x_in_pixels_ = origin_x_in_pixels_ + x_shift;
}
shift_x_ = (origin_x_in_pixels_ - size_in_pixels_/2.0)/scale_;
set_point_under_mouse(last);
mouse_move_event();
return;
}
void Canvas_Delegate::shift_up()
{
integer_coordinates last = complex_to_pixels_coordinates(point_under_mouse_.get_affix());
int y_shift = -20;
if(origin_y_in_pixels_ - y_shift > scale_*1.5)
{
origin_y_in_pixels_ = scale_*1.5;
}
else if(origin_y_in_pixels_ - y_shift < size_in_pixels_-scale_*1.5)
{
origin_y_in_pixels_ = size_in_pixels_ -scale_*1.5;
}
else
{
origin_y_in_pixels_ = origin_y_in_pixels_ - y_shift;
}
shift_y_ = (origin_y_in_pixels_ - size_in_pixels_/2.0)/scale_;
set_point_under_mouse(last);
mouse_move_event();
return;
}
void Canvas_Delegate::shift_down()
{
integer_coordinates last = complex_to_pixels_coordinates(point_under_mouse_.get_affix());
int y_shift = 20;
if(origin_y_in_pixels_ - y_shift > scale_*1.5)
{
origin_y_in_pixels_ = scale_*1.5;
}
else if(origin_y_in_pixels_ - y_shift < size_in_pixels_-scale_*1.5)
{
origin_y_in_pixels_ = size_in_pixels_ -scale_*1.5;
}
else
{
origin_y_in_pixels_ = origin_y_in_pixels_ - y_shift;
}
shift_y_ = (origin_y_in_pixels_ - size_in_pixels_/2.0)/scale_;
set_point_under_mouse(last);
mouse_move_event();
return;
}
void Canvas_Delegate::set_point_clicked(const integer_coordinates &xy)
{
point_clicked_ = Point(pixels_to_complex_coordinates(xy));
}
void Canvas_Delegate::set_point_released(const integer_coordinates &xy)
{
point_released_ = Point(pixels_to_complex_coordinates(xy));
}
void Canvas_Delegate::set_point_under_mouse(const integer_coordinates &xy)
{
point_under_mouse_ = Point(pixels_to_complex_coordinates(xy));
}
void Canvas_Delegate::set_left(bool left)
{
left_canvas_ = left;
return;
}