digiKam
Loading...
Searching...
No Matches
tileindex.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2009-12-01
7 * Description : Tile index used in the tiling classes
8 *
9 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2009-2011 by Michael G. Hansen <mike at mghansen dot de>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QBitArray>
21#include <QObject>
22#include <QPoint>
23#include <QDebug>
24
25// Local includes
26
27#include "geocoordinates.h"
28#include "geoifacetypes.h"
29#include "digikam_export.h"
30
31namespace Digikam
32{
33
34class DIGIKAM_EXPORT TileIndex
35{
36public:
37
39 {
40 MaxLevel = 9,
41 MaxIndexCount = MaxLevel+1,
42 Tiling = 10,
43 MaxLinearIndex = Tiling*Tiling
44 };
45
47 {
48 CornerNW = 1,
49 CornerSW = 2,
50 CornerNE = 3,
51 CornerSE = 4
52 };
53
54public:
55
56 TileIndex() = default;
57 ~TileIndex() = default;
58
59 int indexCount() const;
60 int level() const;
61 int linearIndex(const int getLevel) const;
62 int at(const int getLevel) const;
63 int lastIndex() const;
64 int indexLat(const int getLevel) const;
65 int indexLon(const int getLevel) const;
66
67 void clear();
68 void appendLinearIndex(const int newIndex);
69
70 QPoint latLonIndex(const int getLevel) const;
71
72 void latLonIndex(const int getLevel, int* const latIndex, int* const lonIndex) const;
73 void appendLatLonIndex(const int latIndex, const int lonIndex);
74
75 QIntList toIntList() const;
76
77 GeoCoordinates toCoordinates() const;
78 GeoCoordinates toCoordinates(const CornerPosition ofCorner) const;
79
80 TileIndex mid(const int first, const int len) const;
81 void oneUp();
82
83 static TileIndex fromCoordinates(const Digikam::GeoCoordinates& coordinate,
84 const int getLevel);
85 static TileIndex fromIntList(const QIntList& intList);
86 static bool indicesEqual(const TileIndex& a,
87 const TileIndex& b,
88 const int upToLevel);
89 static QList<QIntList> listToIntListList(const QList<TileIndex>& tileIndexList);
90
91public:
92
93 typedef QList<TileIndex> List;
94
95private:
96
97 int m_indicesCount = 0;
98 int m_indices[MaxIndexCount] = { 0 };
99};
100
101} // namespace Digikam
102
103DIGIKAM_EXPORT QDebug operator<<(QDebug debugOut, const Digikam::TileIndex& tileIndex);
104
Definition geocoordinates.h:44
Definition tileindex.h:35
~TileIndex()=default
QList< TileIndex > List
Definition tileindex.h:93
Constants
Definition tileindex.h:39
CornerPosition
Definition tileindex.h:47
Definition datefolderview.cpp:34
QList< int > QIntList
Definition geoifacetypes.h:48
Q_DECLARE_TYPEINFO(Digikam::TileIndex, Q_MOVABLE_TYPE)
DIGIKAM_EXPORT QDebug operator<<(QDebug debugOut, const Digikam::TileIndex &tileIndex)
Definition tileindex.cpp:279