-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.cpp
More file actions
33 lines (30 loc) · 786 Bytes
/
map.cpp
File metadata and controls
33 lines (30 loc) · 786 Bytes
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
#include "stdafx.h"
#include "map.h"
void Map::paintEvent(QPaintEvent* event)
{
QPalette Pal(palette()); //Creating background
Pal.setColor(QPalette::Background, Qt::white);
this->setAutoFillBackground(true);
this->setPalette(Pal);
QPainter painter(this);
painter.setPen(QPen(Qt::black,1,Qt::SolidLine));
painter.setWindow(-250, -250, 500, 500); //Setting window
painter.drawPoint(0, 0);
Draw(painter, array);
}
void Map::Draw(QPainter& p, std::list<std::pair<float, float>> arr) //If array is not empty drawing all scanned points
{
QPen pen(Qt::red, 3);
p.setPen(pen);
if(arr.size())
{
for(auto x : arr)
{
p.drawPoint(x.first, x.second);
}
}
}
void Map::setData(std::list<std::pair<float, float>> arr) //Copying array
{
array = arr;
}