/usr/include/libkgeomap/abstractmarkertiler.h is in libkgeomap-dev 1.0~digikam2.5.0-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | /** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2009-12-01
* @brief An abstract base class for tiling of markers
*
* @author Copyright (C) 2009-2011 by Michael G. Hansen
* <a href="mailto:mike at mghansen dot de">mike at mghansen dot de</a>
* @author Copyright (C) 2010 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef ABSTRACTMARKERTILER_H
#define ABSTRACTMARKERTILER_H
// Qt includes
#include <QtCore/QBitArray>
#include <QtCore/QObject>
#include <QtCore/QPoint>
// local includes
#include "tileindex.h"
#include "kgeomap_primitives.h"
#include "libkgeomap_export.h"
namespace KGeoMap
{
class KGEOMAP_EXPORT AbstractMarkerTiler : public QObject
{
Q_OBJECT
public:
enum Flag
{
FlagNull = 0,
FlagMovable = 1
};
Q_DECLARE_FLAGS(Flags, Flag)
class ClickInfo
{
public:
TileIndex::List tileIndicesList;
QVariant representativeIndex;
KGeoMapGroupState groupSelectionState;
MouseModes currentMouseMode;
};
public:
class Tile
{
public:
Tile()
: children()
{
}
~Tile()
{
}
static int maxChildCount()
{
return TileIndex::Tiling * TileIndex::Tiling;
}
Tile* getChild(const int linearIndex)
{
if (children.isEmpty())
{
return 0;
}
return children.at(linearIndex);
}
void addChild(const int linearIndex, Tile* const tilePointer)
{
if ( (tilePointer==0) && children.isEmpty() )
{
return;
}
prepareForChildren();
children[linearIndex] = tilePointer;
}
/**
* @brief Sets the pointer to a child tile to zero, but you have to delete the tile by yourself!
*/
void clearChild(const int linearIndex)
{
if (children.isEmpty())
{
return;
}
children[linearIndex] = 0;
}
int indexOfChildTile(Tile* const tile)
{
return children.indexOf(tile);
}
bool childrenEmpty() const
{
return children.isEmpty();
}
/**
* @brief Take away the list of children, only to be used for deleting them.
*
* @todo Make this function protected.
*
*/
QVector<Tile*> takeChildren()
{
QVector<Tile*> childrenCopy = children;
children.clear();
return childrenCopy;
}
private:
void prepareForChildren()
{
if (!children.isEmpty())
{
return;
}
children = QVector<Tile*>(maxChildCount(), 0);
}
private:
QVector<Tile*> children;
};
public:
class NonEmptyIterator
{
public:
NonEmptyIterator(AbstractMarkerTiler* const model, const int level);
NonEmptyIterator(AbstractMarkerTiler* const model, const int level, const TileIndex& startIndex, const TileIndex& endIndex);
NonEmptyIterator(AbstractMarkerTiler* const model, const int level, const GeoCoordinates::PairList& normalizedMapBounds);
~NonEmptyIterator();
bool atEnd() const;
TileIndex nextIndex();
TileIndex currentIndex() const;
AbstractMarkerTiler* model() const;
private:
bool initializeNextBounds();
private:
class AbstractMarkerTilerNonEmptyIteratorPrivate;
AbstractMarkerTilerNonEmptyIteratorPrivate* const d;
};
public:
AbstractMarkerTiler(QObject* const parent = 0);
virtual ~AbstractMarkerTiler();
void tileDeleteChildren(Tile* const tile);
void tileDelete(Tile* const tile);
void tileDeleteChild(Tile* const parentTile, Tile* const childTile, const int knownLinearIndex = -1);
// these have to be implemented
virtual Flags tilerFlags() const;
virtual Tile* tileNew();
virtual void tileDeleteInternal(Tile* const tile);
virtual void prepareTiles(const GeoCoordinates& upperLeft, const GeoCoordinates& lowerRight, int level) = 0;
virtual void regenerateTiles() = 0;
virtual Tile* getTile(const TileIndex& tileIndex, const bool stopIfEmpty = false) = 0;
virtual int getTileMarkerCount(const TileIndex& tileIndex) = 0;
virtual int getTileSelectedCount(const TileIndex& tileIndex) = 0;
// these should be implemented for thumbnail handling
virtual QVariant getTileRepresentativeMarker(const TileIndex& tileIndex, const int sortKey) = 0;
virtual QVariant bestRepresentativeIndexFromList(const QList<QVariant>& indices, const int sortKey) = 0;
virtual QPixmap pixmapFromRepresentativeIndex(const QVariant& index, const QSize& size) = 0;
virtual bool indicesEqual(const QVariant& a, const QVariant& b) const = 0;
virtual KGeoMapGroupState getTileGroupState(const TileIndex& tileIndex) = 0;
virtual KGeoMapGroupState getGlobalGroupState() = 0;
// these can be implemented if you want to react to actions in kgeomap
virtual void onIndicesClicked(const ClickInfo& clickInfo);
virtual void onIndicesMoved(const TileIndex::List& tileIndicesList, const GeoCoordinates& targetCoordinates,
const QPersistentModelIndex& targetSnapIndex);
virtual void setActive(const bool state) = 0;
Tile* rootTile();
bool indicesEqual(const QIntList& a, const QIntList& b, const int upToLevel) const;
bool isDirty() const;
void setDirty(const bool state = true);
Tile* resetRootTile();
Q_SIGNALS:
void signalTilesOrSelectionChanged();
void signalThumbnailAvailableForIndex(const QVariant& index, const QPixmap& pixmap);
protected:
/**
* @brief Only used to safely delete all tiles in the desctructor
*/
void clear();
private:
class AbstractMarkerTilerPrivate;
AbstractMarkerTilerPrivate* const d;
};
} /* namespace KGeoMap */
Q_DECLARE_OPERATORS_FOR_FLAGS(KGeoMap::AbstractMarkerTiler::Flags)
#endif /* ABSTRACTMARKERTILER_H */
|