/usr/include/qgis/qgsmaphittest.h is in libqgis-dev 2.18.17+dfsg-1.
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 | /***************************************************************************
qgsmaphittest.h
---------------------
begin : September 2014
copyright : (C) 2014 by Martin Dobias
email : wonder dot sk at gmail dot com
***************************************************************************
* *
* 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 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSMAPHITTEST_H
#define QGSMAPHITTEST_H
#include "qgsmapsettings.h"
#include "qgsgeometry.h"
#include <QSet>
class QgsRenderContext;
class QgsSymbolV2;
class QgsVectorLayer;
class QgsExpression;
/** \ingroup core
* Class that runs a hit test with given map settings. Based on the hit test it returns which symbols
* will be visible on the map - this is useful for content based legend.
*
* @note added in 2.6
*/
class CORE_EXPORT QgsMapHitTest
{
public:
//! Maps an expression string to a layer id
typedef QMap<QString, QString> LayerFilterExpression;
//! @param settings Map settings used to evaluate symbols
//! @param polygon Polygon geometry to refine the hit test
//! @param layerFilterExpression Expression string for each layer id to evaluate in order to refine the symbol selection
QgsMapHitTest( const QgsMapSettings& settings, const QgsGeometry& polygon = QgsGeometry(), const LayerFilterExpression& layerFilterExpression = LayerFilterExpression() );
//! Constructor version used with only expressions to filter symbols (no extent or polygon intersection)
QgsMapHitTest( const QgsMapSettings& settings, const LayerFilterExpression& layerFilterExpression );
//! Runs the map hit test
void run();
/** Tests whether a symbol is visible for a specified layer.
* @param symbol symbol to find
* @param layer vector layer
* @note added in QGIS 2.12
* @see legendKeyVisible()
*/
bool symbolVisible( QgsSymbolV2* symbol, QgsVectorLayer* layer ) const;
/** Tests whether a given legend key is visible for a specified layer.
* @param ruleKey legend rule key
* @param layer vector layer
* @note added in QGIS 2.14
* @see symbolVisible()
*/
bool legendKeyVisible( const QString& ruleKey, QgsVectorLayer* layer ) const;
protected:
//! @note not available in Python bindings
typedef QSet<QString> SymbolV2Set;
//! @note not available in Python bindings
typedef QMap<QgsVectorLayer*, SymbolV2Set> HitTest;
/** Runs test for visible symbols within a layer
* @param vl vector layer
* @param usedSymbols set for storage of visible symbols
* @param usedSymbolsRuleKey set of storage of visible legend rule keys
* @param context render context
* @note added in QGIS 2.12
* @note not available in Python bindings
*/
void runHitTestLayer( QgsVectorLayer* vl, SymbolV2Set& usedSymbols, SymbolV2Set& usedSymbolsRuleKey, QgsRenderContext& context );
//! The initial map settings
QgsMapSettings mSettings;
//! The hit test
HitTest mHitTest;
//! The hit test, using legend rule keys
HitTest mHitTestRuleKey;
//! List of expression filter for each layer
LayerFilterExpression mLayerFilterExpression;
//! Polygon used for filtering items. May be empty
QgsGeometry mPolygon;
//! Whether to use only expressions during the filtering
bool mOnlyExpressions;
};
#endif // QGSMAPHITTEST_H
|