/usr/include/qgis/qgsmaplayerlegend.h is in libqgis-dev 2.8.6+dfsg-1build1.
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 | /***************************************************************************
qgsmaplayerlegend.h
--------------------------------------
Date : July 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 QGSMAPLAYERLEGEND_H
#define QGSMAPLAYERLEGEND_H
#include <QObject>
class QgsLayerTreeLayer;
class QgsLayerTreeModelLegendNode;
class QgsPluginLayer;
class QgsRasterLayer;
class QgsVectorLayer;
/**
* The QgsMapLayerLegend class is abstract interface for implementations
* of legends for one map layer.
*
* @note added in 2.6
*/
class CORE_EXPORT QgsMapLayerLegend : public QObject
{
Q_OBJECT
public:
explicit QgsMapLayerLegend( QObject *parent = 0 );
// TODO: type, load/save settings
/**
* Return list of legend nodes to be used for a particular layer tree layer node.
* Ownership is transferred to the caller.
*/
virtual QList<QgsLayerTreeModelLegendNode*> createLayerTreeModelLegendNodes( QgsLayerTreeLayer* nodeLayer ) = 0;
// TODO: support for layer tree view delegates
//! Create new legend implementation for vector layer
static QgsMapLayerLegend* defaultVectorLegend( QgsVectorLayer* vl );
//! Create new legend implementation for raster layer
static QgsMapLayerLegend* defaultRasterLegend( QgsRasterLayer* rl );
//! Create new legend implementation for raster layer
static QgsMapLayerLegend* defaultPluginLegend( QgsPluginLayer* pl );
signals:
//! Emitted when existing items/nodes got invalid and should be replaced by new ones
void itemsChanged();
};
/**
* Miscellaneous utility functions for handling of map layer legend
*
* @note added in 2.6
*/
class CORE_EXPORT QgsMapLayerLegendUtils
{
public:
static void setLegendNodeOrder( QgsLayerTreeLayer* nodeLayer, const QList<int>& order );
static QList<int> legendNodeOrder( QgsLayerTreeLayer* nodeLayer );
static bool hasLegendNodeOrder( QgsLayerTreeLayer* nodeLayer );
static void setLegendNodeUserLabel( QgsLayerTreeLayer* nodeLayer, int originalIndex, const QString& newLabel );
static QString legendNodeUserLabel( QgsLayerTreeLayer* nodeLayer, int originalIndex );
static bool hasLegendNodeUserLabel( QgsLayerTreeLayer* nodeLayer, int originalIndex );
//! update according to layer node's custom properties (order of items, user labels for items)
static void applyLayerNodeProperties( QgsLayerTreeLayer* nodeLayer, QList<QgsLayerTreeModelLegendNode*>& nodes );
};
#include <QHash>
/** Default legend implementation for vector layers
* @note added in 2.6
*/
class CORE_EXPORT QgsDefaultVectorLayerLegend : public QgsMapLayerLegend
{
public:
explicit QgsDefaultVectorLayerLegend( QgsVectorLayer* vl );
virtual QList<QgsLayerTreeModelLegendNode*> createLayerTreeModelLegendNodes( QgsLayerTreeLayer* nodeLayer ) override;
private:
QgsVectorLayer* mLayer;
};
/** Default legend implementation for raster layers
* @note added in 2.6
*/
class CORE_EXPORT QgsDefaultRasterLayerLegend : public QgsMapLayerLegend
{
public:
explicit QgsDefaultRasterLayerLegend( QgsRasterLayer* rl );
virtual QList<QgsLayerTreeModelLegendNode*> createLayerTreeModelLegendNodes( QgsLayerTreeLayer* nodeLayer ) override;
private:
QgsRasterLayer* mLayer;
};
/** Default legend implementation for plugin layers
* @note added in 2.6
*/
class CORE_EXPORT QgsDefaultPluginLayerLegend : public QgsMapLayerLegend
{
public:
explicit QgsDefaultPluginLayerLegend( QgsPluginLayer* pl );
virtual QList<QgsLayerTreeModelLegendNode*> createLayerTreeModelLegendNodes( QgsLayerTreeLayer* nodeLayer ) override;
private:
QgsPluginLayer* mLayer;
};
#endif // QGSMAPLAYERLEGEND_H
|