28 , mPendingCanvasUpdate( false )
29 , mHasCustomLayerOrder( false )
30 , mAutoSetupOnFirstLayer( true )
31 , mAutoEnableCrsTransform( true )
32 , mLastLayerCount( !root->findLayers().isEmpty() )
89 qSort( sortedNewOrder );
91 if ( defOrder.
size() < sortedNewOrder.
size() )
96 for (
int i = 0; i < sortedNewOrder.
size(); i++ )
98 if ( !ids.contains( sortedNewOrder[i] ) )
106 if ( defOrder != sortedNewOrder )
133 int currentLayerCount = layerNodes.
count();
143 if ( !layerNode->
layer() )
191 mLastLayerCount = currentLayerCount;
192 if ( currentLayerCount == 0 )
216 if ( !customOrderElem.
isNull() )
220 while ( !itemElem.
isNull() )
276 for (
int i = indexFrom; i <= indexTo; ++i )
290 Q_FOREACH (
const QString& layerId, layerIds )
313 for (
int i = toRemove.
count() - 1; i >= 0; --i )
328 if ( key ==
"overview" )
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
static bool readOldLegendLayerOrder(const QDomElement &legendElem, bool &hasCustomOrder, QStringList &order)
Try to load custom layer order from.
Layer tree group node serves as a container for layers and further groups.
void hasCustomLayerOrderChanged(bool)
void setCustomLayerOrder(const QStringList &order)
virtual bool isSpatial() const
Returns true if the layer is considered a spatial layer, ie it has some form of geometry associated w...
QgsLayerTreeGroup * mRoot
bool mHasCustomLayerOrder
QDomNode appendChild(const QDomNode &newChild)
QString attribute(const QString &name, const QString &defValue) const
void nodeCustomPropertyChanged(QgsLayerTreeNode *node, const QString &key)
const T & at(int i) const
const QgsCoordinateReferenceSystem & crs() const
Returns layer's spatial reference system.
const QObjectList & children() const
Qt::CheckState isVisible() const
QgsLayerTreeMapCanvasBridge(QgsLayerTreeGroup *root, QgsMapCanvas *canvas, QObject *parent=nullptr)
Constructor: does not take ownership of the layer tree nor canvas.
A class that stores visibility and presence in overview flags together with pointer to the layer...
bool contains(const QString &str, Qt::CaseSensitivity cs) const
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
QDomElement nextSiblingElement(const QString &tagName) const
void setHasCustomLayerOrder(bool state)
QDomElement documentElement() const
void setCanvasLayers()
force update of canvas layers from the layer tree. Normally this should not be needed to be called...
Map canvas is a class for displaying all GIS data types on a canvas.
QgsLayerTreeGroup * toGroup(QgsLayerTreeNode *node)
Cast node to a group. No type checking is done - use isGroup() to find out whether this operation is ...
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
sets destination coordinate reference system
void setCrsTransformEnabled(bool enabled)
sets whether to use projections for this layer set
int count(const T &value) const
void append(const T &value)
int toInt(bool *ok) const
bool mAutoEnableCrsTransform
void setAttribute(const QString &name, const QString &value)
void setLayerSet(QList< QgsMapCanvasLayer > &layers)
int toInt(bool *ok, int base) const
int removeAll(const T &value)
QGis::UnitType mapUnits() const
Returns the units for the projection used by the CRS.
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
void nodeAddedChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
This class is a base class for nodes in a layer tree.
void nodeVisibilityChanged()
QList< QgsLayerTreeNode * > children()
Get list of children of the node. Children are owned by the parent.
bool isLayer(QgsLayerTreeNode *node)
Check whether the node is a valid layer node.
void readProject(const QDomDocument &doc)
QStringList defaultLayerOrder() const
QDomText createTextNode(const QString &value)
QgsLayerTreeLayer * findLayer(const QString &layerId) const
Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tr...
QgsMapLayer * layer() const
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
void deferredSetCanvasLayers()
void nodeRemovedChildren()
QgsLayerTreeLayer * toLayer(QgsLayerTreeNode *node)
Cast node to a layer. No type checking is done - use isLayer() to find out whether this operation is ...
bool mPendingCanvasUpdate
QStringList mCustomLayerOrder
bool mAutoSetupOnFirstLayer
QDomElement firstChildElement(const QString &tagName) const
void zoomToFullExtent()
Zoom to the full extent of all layers.
Class for storing a coordinate reference system (CRS)
void writeProject(QDomDocument &doc)
void customLayerOrderChanged(const QStringList &order)
void setMapUnits(QGis::UnitType mapUnits)
Set map units (needed by project properties dialog)
QList< QgsLayerTreeLayer * > findLayers() const
Find all layer nodes. Searches recursively the whole sub-tree.
QDomElement createElement(const QString &tagName)
QgsCoordinateReferenceSystem mFirstCRS
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool isGroup(QgsLayerTreeNode *node)
Check whether the node is a valid group node.
Layer tree node points to a map layer.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.