Root/abstractlayer.cpp

1/*
2 * Copyright 2010-2011 Niels Kummerfeldt <niels.kummerfeldt@tu-harburg.de>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
18 */
19
20#include "abstractlayer.h"
21
22#include "mapwidget.h"
23
24AbstractLayer::AbstractLayer(MapWidget *map) :
25    QObject(map),
26    m_map(map),
27    m_visible(true)
28{
29}
30
31void AbstractLayer::load(const QString &filename)
32{
33    Q_UNUSED(filename)
34}
35
36void AbstractLayer::zoom(int level)
37{
38    Q_UNUSED(level)
39}
40
41void AbstractLayer::pan(const QPoint &move)
42{
43    Q_UNUSED(move)
44}
45
46void AbstractLayer::keyPressed(QKeyEvent *event)
47{
48    Q_UNUSED(event)
49}
50
51void AbstractLayer::paintLayer(QPainter *painter)
52{
53    if (m_visible) {
54        painter->save();
55        paint(painter);
56        painter->restore();
57    }
58}
59
60MapWidget *AbstractLayer::map() const
61{
62    return m_map;
63}
64
65bool AbstractLayer::isVisible() const
66{
67    return m_visible;
68}
69
70void AbstractLayer::setVisible(bool visible)
71{
72    m_visible = visible;
73    emit visibilityChanged(m_visible);
74}
75
76void AbstractLayer::toggleVisibility()
77{
78    m_visible = !m_visible;
79    emit visibilityChanged(m_visible);
80}
81
82

Archive Download this file

Branches:
master



interactive