/usr/include/libkgeomap/kgeomap_primitives.h is in libkgeomap-dev 1.0~digikam3.5.0-0ubuntu10.
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 Primitive datatypes for KGeoMap
*
* @author Copyright (C) 2009-2010 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 KGEOMAP_PRIMITIVES_H
#define KGEOMAP_PRIMITIVES_H
// Qt includes
#include <QtCore/QPersistentModelIndex>
#include <QtCore/QString>
#include <QtCore/QVariant>
// Kde includes
#include <kdebug.h>
#include <kurl.h>
// local includes
#include "libkgeomap_export.h"
#include "geocoordinates.h"
Q_DECLARE_METATYPE(QPersistentModelIndex)
#ifdef KGEOMAP_HAVE_VALGRIND
#include <valgrind/valgrind.h>
#endif /* KGEOMAP_HAVE_VALGRIND */
#define KGEOMAP_ASSERT(cond) ((!(cond)) ? KGeoMap::KGeoMap_assert(#cond,__FILE__,__LINE__) : qt_noop())
namespace KGeoMap
{
inline void KGeoMap_assert(const char* const condition, const char* const filename, const int lineNumber)
{
const QString debugString = QString::fromLatin1( "ASSERT: %1 - %2:%3").arg(QLatin1String( condition )).arg(QLatin1String( filename )).arg(lineNumber);
#ifdef KGEOMAP_HAVE_VALGRIND
if (RUNNING_ON_VALGRIND>0)
{
// TODO: which encoding?
const QByteArray dummyArray = debugString.toUtf8();
VALGRIND_PRINTF_BACKTRACE("%s", dummyArray.constData());
}
else
{
kDebug(51006)<<debugString;
}
#else
kDebug(51006)<<debugString;
#endif /* KGEOMAP_HAVE_VALGRIND */
}
enum MouseMode
{
MouseModePan = 1,
MouseModeRegionSelection = 2,
MouseModeRegionSelectionFromIcon = 4,
MouseModeFilter = 8,
MouseModeSelectThumbnail = 16,
MouseModeZoomIntoGroup = 32,
MouseModeLast = 32
};
Q_DECLARE_FLAGS(MouseModes, MouseMode)
Q_DECLARE_OPERATORS_FOR_FLAGS(MouseModes)
enum ExtraAction
{
ExtraActionSticky = 1
};
Q_DECLARE_FLAGS(ExtraActions, ExtraAction)
Q_DECLARE_OPERATORS_FOR_FLAGS(ExtraActions)
typedef QList<int> QIntList;
typedef QPair<int, int> QIntPair;
/**
* @brief Representation of possible tile or cluster states
*
* The idea is that a group consists of more than one object.
* Thus the resulting state is that either none of the objects,
* some or all of them have a certain state. The constants for each
* state are set up such that they can be logically or'ed: If a group
* has the state ___All, and another the state ___Some, the bit
* representing ___Some is always propagated along. You only have to
* make sure that once you reach an object with ___None, and the computed
* state is ___All, to set the ___Some bit.
*
* KGeoMapSelected___: An object is selected.
* KGeoMapFilteredPositive___: An object was highlighted by a filter. This usually
* means that not-positively-filtered objects should be hidden.
* KGeoMapRegionSelected___: An object is inside a region of interest on the map.
*/
enum KGeoMapGroupStateEnum
{
KGeoMapSelectedMask = 0x03 << 0,
KGeoMapSelectedNone = 0x00 << 0,
KGeoMapSelectedSome = 0x03 << 0,
KGeoMapSelectedAll = 0x02 << 0,
KGeoMapFilteredPositiveMask = 0x03 << 2,
KGeoMapFilteredPositiveNone = 0x00 << 2,
KGeoMapFilteredPositiveSome = 0x03 << 2,
KGeoMapFilteredPositiveAll = 0x02 << 2,
KGeoMapRegionSelectedMask = 0x03 << 4,
KGeoMapRegionSelectedNone = 0x00 << 4,
KGeoMapRegionSelectedSome = 0x03 << 4,
KGeoMapRegionSelectedAll = 0x02 << 4
};
/// @todo KGeoMapGroupState -> KGeoMapGroupStates?
Q_DECLARE_FLAGS(KGeoMapGroupState, KGeoMapGroupStateEnum)
Q_DECLARE_OPERATORS_FOR_FLAGS(KGeoMapGroupState)
class KGeoMapGroupStateComputer
{
private:
KGeoMapGroupState m_state;
KGeoMapGroupState m_stateMask;
public:
/// @todo Make member functions non-inline?
KGeoMapGroupStateComputer()
: m_state(KGeoMapSelectedNone),
m_stateMask(KGeoMapSelectedNone)
{
}
KGeoMapGroupState getState() const
{
return m_state;
}
void clear()
{
m_state = KGeoMapSelectedNone;
m_stateMask = KGeoMapSelectedNone;
}
void addState(const KGeoMapGroupState state)
{
addSelectedState(state);
addFilteredPositiveState(state);
addRegionSelectedState(state);
}
void addSelectedState(const KGeoMapGroupState state)
{
if (!(m_stateMask & KGeoMapSelectedMask))
{
m_state|= state;
m_stateMask|= KGeoMapSelectedMask;
}
else
{
if ((state&KGeoMapSelectedMask)==KGeoMapSelectedAll)
{
m_state|=KGeoMapSelectedAll;
}
else if ((m_state&KGeoMapSelectedMask)==KGeoMapSelectedAll)
{
m_state|=KGeoMapSelectedSome;
}
else
{
m_state|=state;
}
}
}
void addFilteredPositiveState(const KGeoMapGroupState state)
{
if (!(m_stateMask & KGeoMapFilteredPositiveMask))
{
m_state|= state;
m_stateMask|= KGeoMapFilteredPositiveMask;
}
else
{
if ((state&KGeoMapFilteredPositiveMask)==KGeoMapFilteredPositiveAll)
{
m_state|=KGeoMapFilteredPositiveAll;
}
else if ((m_state&KGeoMapFilteredPositiveMask)==KGeoMapFilteredPositiveAll)
{
m_state|=KGeoMapFilteredPositiveSome;
}
else
{
m_state|=state;
}
}
}
void addRegionSelectedState(const KGeoMapGroupState state)
{
if (!(m_stateMask & KGeoMapRegionSelectedMask))
{
m_state|= state;
m_stateMask|= KGeoMapRegionSelectedMask;
}
else
{
if ((state&KGeoMapRegionSelectedMask)==KGeoMapRegionSelectedAll)
{
m_state|=KGeoMapRegionSelectedAll;
}
else if ((m_state&KGeoMapRegionSelectedMask)==KGeoMapRegionSelectedAll)
{
m_state|=KGeoMapRegionSelectedSome;
}
else
{
m_state|=state;
}
}
}
};
} /* namespace KGeoMap */
Q_DECLARE_METATYPE(KGeoMap::MouseModes)
#endif /* KGEOMAP_PRIMITIVES_H */
|