diff --git a/qgis/src/qgsmapcanvas.cpp b/qgis/src/qgsmapcanvas.cpp index d459cfdadb2..e559e8e6539 100644 --- a/qgis/src/qgsmapcanvas.cpp +++ b/qgis/src/qgsmapcanvas.cpp @@ -122,33 +122,23 @@ void QgsMapCanvas::addLayer(QgsMapLayer * lyr) } updateFullExtent(lyr->extent()); - // increment zpos for all layers in the map - incrementZpos(); - lyr->setZ(layers.size() - 1); - updateZpos(); zOrder.push_back(lyr->getLayerID()); connect(lyr, SIGNAL(visibilityChanged()), this, SLOT(layerStateChange())); dirty = true; - //lyr->zpos = 0; } -void QgsMapCanvas::incrementZpos() -{ -} -void QgsMapCanvas::updateZpos() -{ -} QgsMapLayer *QgsMapCanvas::getZpos(int idx) { -// iterate over the layers and return the layer at postion idx -std::map::iterator mi = layers.begin(); -while (mi != layers.end()) { - QgsMapLayer *ml = (*mi).second; - if (ml->z() == idx) - return ml; - mi++; -} - return 0; + // iterate over the zOrder and return the layer at postion idx + std::list::iterator zi = zOrder.begin(); + for (int i = 0; i < idx; i++) { + if (i < zOrder.size()) { + zi++; + } + } + + QgsMapLayer *ml = layers[*zi]; + return ml; } void QgsMapCanvas::setZOrderFromLegend(QgsLegendView *lv) diff --git a/qgis/src/qgsmapcanvas.h b/qgis/src/qgsmapcanvas.h index 149364fa23f..e407b4e434a 100644 --- a/qgis/src/qgsmapcanvas.h +++ b/qgis/src/qgsmapcanvas.h @@ -136,8 +136,6 @@ public slots: /** Flag to indicate a map canvas drag operation is taking place */ bool dragging; std::vector initialColor; - void incrementZpos(); - void updateZpos(); //! Flag indicating a map refresh is in progress bool drawing; bool frozen; diff --git a/qgis/src/qgsmaplayer.cpp b/qgis/src/qgsmaplayer.cpp index 7cb7bec306a..8dff91f27a9 100644 --- a/qgis/src/qgsmaplayer.cpp +++ b/qgis/src/qgsmaplayer.cpp @@ -115,18 +115,6 @@ void QgsMapLayer::setlabelField(const QString & _newVal) m_labelField = _newVal; } -/** No descriptions */ -int QgsMapLayer::z() -{ - return zpos; -} - -/** No descriptions */ -void QgsMapLayer::setZ(int zorder) -{ - zpos = zorder; -} - bool QgsMapLayer::isValid() { return valid; diff --git a/qgis/src/qgsmaplayer.h b/qgis/src/qgsmaplayer.h index 274b8785ac4..90908533e79 100644 --- a/qgis/src/qgsmaplayer.h +++ b/qgis/src/qgsmaplayer.h @@ -89,10 +89,6 @@ class QgsMapLayer:public QObject virtual void setlabelField(const QString & _newVal); /** Read property of QString labelField. */ virtual const QString & labelField(); - /** No descriptions */ - void setZ(int zorder); - /** No descriptions */ - int z(); //! Visibility of the layer bool visible(); //! set visibility @@ -116,8 +112,6 @@ class QgsMapLayer:public QObject protected: //! Extent of the layer QgsRect layerExtent; - //! Position in the map stack - int zpos; //! Indicates if the layer is valid and can be drawn bool valid; QString dataSource;