Changed name of setlayerName function to setLayerName

Added internalName to store the name of the datasource used at load time. This allows mangling of the display name without affecting the name needed to access the layer via its datasource.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@615 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2004-01-28 02:09:10 +00:00
parent 1d2043e9fd
commit e05e6157a0
2 changed files with 19 additions and 6 deletions

View File

@ -24,13 +24,14 @@
#include "qgsmaplayer.h"
QgsMapLayer::QgsMapLayer(int type, QString lyrname, QString source)
:layerName(lyrname), layerType(type), dataSource(source), m_legendItem(0)
:internalName(lyrname), layerType(type), dataSource(source), m_legendItem(0)
{
// assume the layer is valid (data source exists and can be used)
// until we learn otherwise
valid = true;
m_visible = true;
// create a default symbol
// Set the display name = internal name
layerName = internalName;
// Generate the unique ID of this layer
QDateTime dt = QDateTime::currentDateTime();
@ -52,7 +53,7 @@ QString QgsMapLayer::getLayerID()
}
/** Write property of QString layerName. */
void QgsMapLayer::setlayerName(const QString & _newVal)
void QgsMapLayer::setLayerName(const QString & _newVal)
{
layerName = _newVal;
}
@ -67,6 +68,10 @@ QString QgsMapLayer::source()
{
return dataSource;
}
QString QgsMapLayer::sourceName()
{
return internalName;
}
const QgsRect QgsMapLayer::extent()
{
return layerExtent;

View File

@ -53,14 +53,19 @@ class QgsMapLayer:public QObject
const int type();
/*! Get this layer's unique ID */
QString getLayerID();
/*! Set the name of the layer
/*! Set the display name of the layer
# @param name New name for the layer
*/
void setlayerName(const QString & name);
/*! Get the name of the layer
void setLayerName(const QString & name);
/*! Get the display name of the layer
* @return the layer name
*/
const QString name();
/*! Get the internal name of the layer. This is the name used to created the
* layer from the data source
* @return internal datasource name of the layer
*/
QString sourceName();
/*! Virtual function to calculate the extent of the current layer.
* This function must be overridden in all child classes and implemented
* based on the layer type
@ -130,6 +135,7 @@ class QgsMapLayer:public QObject
QgsRect layerExtent;
//! Indicates if the layer is valid and can be drawn
bool valid;
//! data source description string, varies by layer type
QString dataSource;
//! Geometry type as defined in enum WKBTYPE (qgis.h)
int geometryType;
@ -139,6 +145,8 @@ class QgsMapLayer:public QObject
QPixmap m_legendPixmap;
/** Name of the layer - used for display */
QString layerName;
/** Internal name of the layer. Derived from the datasource */
QString internalName;
//! context menu
QPopupMenu *popMenu;
private: // Private attributes