1 /**********************************************************************************************
2     Copyright (C) 2018 Oliver Eichler <oliver.eichler@gmx.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 3 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, see <http://www.gnu.org/licenses/>.
16 
17 **********************************************************************************************/
18 
19 #ifndef CITEMMAPLAYER_H
20 #define CITEMMAPLAYER_H
21 
22 #include "items/IItem.h"
23 
24 #include <QCoreApplication>
25 #include <QTemporaryFile>
26 #include <QTreeWidgetItem>
27 
28 class CItemMap;
29 class CDrawContextProj;
30 
31 class CItemMapLayer : public IItem, public QTreeWidgetItem
32 {
33     Q_OBJECT
34 public:
35     CItemMapLayer(QTreeWidget* parent);
36     virtual ~CItemMapLayer() = default;
37 
38     bool addMap(CItemMap* map);
39 
40     bool drawFx(QPainter& p, CCanvas::redraw_e needsRedraw) override;
41 
42     void drawBoundingBoxes(QPainter& p, IDrawContext* dc);
43 
setupChanged()44     void setupChanged() override {}
45 
46     QString getProjection() const;
47 
48 protected:
49     friend bool sortByScale(QTreeWidgetItem* item1, QTreeWidgetItem* item2);
50 
51     void updateLayer();
52 
53     QTemporaryFile vrt;
54 };
55 
56 #endif //CITEMMAPLAYER_H
57 
58