summaryrefslogtreecommitdiff
path: root/tikzit/src/data/node.cpp
blob: f94a3dfef29f5eb37fca2f187a668f8d559dacac (plain)
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
#include "node.h"
#include "tikzit.h"

#include <QDebug>

Node::Node(QObject *parent) : QObject(parent)
{
    _data = new GraphElementData();
    _style = noneStyle;
    _styleName = "none";
}

Node::~Node()
{
    delete _data;
}

QPointF Node::point() const
{
    return _point;
}

void Node::setPoint(const QPointF &point)
{
    _point = point;
}

QString Node::name() const
{
    return _name;
}

void Node::setName(const QString &name)
{
    _name = name;
}

QString Node::label() const
{
    return _label;
}

void Node::setLabel(const QString &label)
{
    _label = label;
}

GraphElementData *Node::data() const
{
    return _data;
}

void Node::setData(GraphElementData *data)
{
    delete _data;
    _data = data;
    if (_data->property("style") != 0) _styleName = _data->property("style");
}

QString Node::styleName() const
{
    return _styleName;
}

void Node::setStyleName(const QString &styleName)
{
    _styleName = styleName;
}

void Node::attachStyle()
{
    if (_styleName == "none") _style = noneStyle;
    else _style = tikzit->nodeStyle(_styleName);
}

NodeStyle *Node::style() const
{
    return _style;
}