1 /**********************************************************************************************
2     Copyright (C) 2014 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 CMAPVRT_H
20 #define CMAPVRT_H
21 
22 #include "map/IMap.h"
23 
24 
25 class CMapDraw;
26 class GDALDataset;
27 
28 class CMapVRT : public IMap
29 {
30     Q_OBJECT
31 public:
32     CMapVRT(const QString& filename, CMapDraw* parent);
33     virtual ~CMapVRT();
34 
35     void draw(IDrawContext::buffer_t& buf) override;
36 
37 private:
38     /**
39        @brief Test subfiles of VRT for overviews
40        @param filename The VRT filename to inspect
41        @return Return true if all subfiles have overviews.
42      */
43     bool testForOverviews(const QString& filename);
44     QString filename;
45     /// instance of GDAL dataset
46     GDALDataset* dataset;
47     /// number of color bands used by the *vrt
48     int rasterBandCount = 0;
49     /// QT representation of the vrt's color table
50     QVector<QRgb> colortable;
51 
52     /// width in number of px
53     qint32 xsize_px = 0;
54     /// height in number of px
55     qint32 ysize_px = 0;
56 
57     /// scale [px/m]
58     qreal xscale = 0;
59     /// scale [px/m]
60     qreal yscale = 0;
61 
62     qreal xrot = 0;
63     qreal yrot = 0;
64 
65     QPointF ref1;
66     QPointF ref2;
67     QPointF ref3;
68     QPointF ref4;
69 
70     QTransform trFwd;
71     QTransform trInv;
72 
73     bool hasOverviews = false;
74 };
75 
76 #endif //CMAPVRT_H
77 
78