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:
stevehalasz 2004-01-09 21:17:21 +00:00
parent 8b7cc83e8d
commit 590d4f3841
4 changed files with 10 additions and 40 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;