Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
305 KeyOz 1
/*
2
*
3
* This file is part of QMapControl,
4
* an open-source cross-platform map widget
5
*
6
* Copyright (C) 2007 - 2008 Kai Winter
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
* GNU Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with QMapControl. If not, see <http://www.gnu.org/licenses/>.
20
*
21
* Contact e-mail: kaiwinter@gmx.de
22
* Program URL   : http://qmapcontrol.sourceforge.net/
23
*
24
*/
25
 
26
#include "circlepoint.h"
27
namespace qmapcontrol
28
{
29
    CirclePoint::CirclePoint(qreal x, qreal y, int radius, QString name, Alignment alignment, QPen* pen)
30
        : Point(x, y, name, alignment)
31
    {
32
        size = QSize(radius, radius);
33
        mypixmap = new QPixmap(radius+1, radius+1);
34
        mypixmap->fill(Qt::transparent);
35
        QPainter painter(mypixmap);
36
        if (pen != 0)
37
        {
38
            painter.setPen(*pen);
39
        }
40
        painter.drawEllipse(0,0,radius, radius);
41
    }
42
 
43
    CirclePoint::CirclePoint(qreal x, qreal y, QString name, Alignment alignment, QPen* pen)
44
        : Point(x, y, name, alignment)
45
    {
46
        int radius = 10;
47
        size = QSize(radius, radius);
48
        mypixmap = new QPixmap(radius+1, radius+1);
49
        mypixmap->fill(Qt::transparent);
50
        QPainter painter(mypixmap);
51
        if (pen != 0)
52
        {
53
            painter.setPen(*pen);
54
        }
55
        painter.drawEllipse(0,0,radius, radius);
56
    }
57
 
58
    CirclePoint::~CirclePoint()
59
    {
60
        delete mypixmap;
61
    }
62
 
63
    void CirclePoint::setPen(QPen* pen)
64
    {
65
        mypen = pen;
66
        mypixmap = new QPixmap(size.width()+1, size.height()+1);
67
        mypixmap->fill(Qt::transparent);
68
        QPainter painter(mypixmap);
69
        painter.setPen(*pen);
70
        painter.drawEllipse(0,0, size.width(), size.height());
71
    }
72
}