mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Store layer order correctly in project files. Don't store z position in
QgsMapLayer anymore. Just use zOrder list in QgsMapCanvas. git-svn-id: http://svn.osgeo.org/qgis/trunk@446 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
8b7cc83e8d
commit
590d4f3841
@ -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<QString,QgsMapLayer *>::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<QString>::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)
|
||||
|
@ -136,8 +136,6 @@ public slots:
|
||||
/** Flag to indicate a map canvas drag operation is taking place */
|
||||
bool dragging;
|
||||
std::vector<QColor> initialColor;
|
||||
void incrementZpos();
|
||||
void updateZpos();
|
||||
//! Flag indicating a map refresh is in progress
|
||||
bool drawing;
|
||||
bool frozen;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user