-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendtilemodel.cpp
41 lines (34 loc) · 906 Bytes
/
endtilemodel.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
#include "endtilemodel.h"
#include <QPainter>
EndTile::EndTile(QObject *parent) :
TileModel(parent)
{
// default CornerTile
this->north = TileModel::ON;
}
EndTile::EndTile(const QVector<bool>& tile, QObject *parent):
TileModel(parent)
{
EndTile::setNodes(tile);
}
void EndTile::setNodes(const QVector<bool>& tile)
{
// set default nodes if tile is invalid.
if (tile.size() == 0 ||
!(tile[TileModel::North] || tile[TileModel::East] || tile[TileModel::South] || tile[TileModel::West])) {
this->north = TileModel::ON;
return;
}
this->clearNodes();
TileModel::setNodes(tile);
// get rotateAngle
if (this->east)
this->rotateAngle = 90;
else if (this->south)
this->rotateAngle = 180;
else if (this->west)
this->rotateAngle = 270;
else
this->rotateAngle = 0;
emit this->nodesChanged();
}