Skip to content

Commit

Permalink
fix API QgsMapLayer::getLayerID() to id()), some warnings and use dox…
Browse files Browse the repository at this point in the history
…ygen deprecation tag.

git-svn-id: http://svn.osgeo.org/qgis/trunk@15168 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Feb 13, 2011
1 parent 61baa8b commit 132088f
Show file tree
Hide file tree
Showing 55 changed files with 221 additions and 200 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsapplication.sip
Expand Up @@ -159,7 +159,7 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
static const QStringList svgPaths();

//! Returns the path to the applications svg paths
//! @note deprecated
//! @deprecated
static const QString svgPath();

//! Returns the path to the application prefix directory.
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgscomposermap.sip
Expand Up @@ -47,7 +47,7 @@ class QgsComposerMap : QgsComposerItem
BoundaryDirection
};

/**This function is deprecated*/
/**@deprecated*/
void draw( QPainter *painter, const QgsRectangle& extent, const QSize& size, int dpi );

/** \brief Draw to paint device
Expand Down
5 changes: 2 additions & 3 deletions python/core/qgslabel.sip
Expand Up @@ -49,7 +49,7 @@ public:


/** \brief render label
\note deprecated
\deprecated
*/
void renderLabel ( QPainter* painter, QgsRectangle& viewExtent,
QgsCoordinateTransform* coordinateTransform,
Expand Down Expand Up @@ -83,8 +83,7 @@ public:
QMap<int, QgsField> & fields ( );

/** Pointer to default attributes.
* @note this will be deprecated in version 2 as it is
* badly named. Rather use attributes.
* @deprecated in version 2 badly named. Rather use attributes.
* @see labelAttributes method rather */
QgsLabelAttributes *layerAttributes( );

Expand Down
11 changes: 9 additions & 2 deletions python/core/qgsmaplayer.sip
Expand Up @@ -57,7 +57,14 @@ public:
*/
QgsMapLayer::LayerType type() const;

/** Get this layer's unique ID, this ID is used to access this layer from map layer registry */
/** Get this layer's unique ID, this ID is used to access this layer from map layer registry
* @note added in 1.7
*/
QString id() const;

/** Get this layer's unique ID, this ID is used to access this layer from map layer registry
* @deprecated in 1.7
*/
QString getLayerID() const;

/** Set the display name of the layer
Expand Down Expand Up @@ -215,7 +222,7 @@ public:

/** Returns layer's spatial reference system
@note This method is here for API compatibility
and will be deprecited in 2.0
and will be deprecated in 2.0
@see crs()
*/
const QgsCoordinateReferenceSystem& srs();
Expand Down
5 changes: 3 additions & 2 deletions python/core/qgsoverlayobject.sip
Expand Up @@ -14,9 +14,10 @@ class QgsOverlayObject
//this function fill not be wrapped to not depend on geos python bindings
/**Returns the feature geometry in geos format. The calling function does _not_ take
ownership of the generated object. The geometry is in map coordinates
@note: this function is deprecated. Please use geometry() and QgsGeometry::asGeos instead*/
@deprecated Please use geometry() and QgsGeometry::asGeos instead*/
//GEOSGeometry* getGeosGeometry();
/**Feature geometry is released when object is destructed so this function is empty. This function is deprecated and does nothing*/
/**Feature geometry is released when object is destructed so this function is empty.
@deprecated nop */
//void releaseGeosGeometry( GEOSGeometry *the_geom )

//getters
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsrenderer.sip
Expand Up @@ -40,7 +40,7 @@ class QgsRenderer
@param widthScale scale factor
@param rasterScaleFactor scale factor for rasters

deprecated */
@deprecated */
void renderFeature(QPainter* p, QgsFeature& f,QImage* pic, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0);

/**A vector layer passes features to a renderer object to change the brush ans pen of the qpainter
Expand Down
6 changes: 3 additions & 3 deletions python/core/qgssearchtreenode.sip
Expand Up @@ -104,7 +104,7 @@ class QgsSearchTreeNode
//! @note attributes and optional geom parameter replace with feature in 1.6
bool checkAgainst( const QMap<int,QgsField>& fields, QgsFeature &f );

//! @note deprecated
//! @deprecated
bool checkAgainst( const QMap<int,QgsField>& fields, const QMap<int, QVariant>& attributes, QgsGeometry* geom = 0 );

//! checks if there were errors during evaluation
Expand All @@ -119,7 +119,7 @@ class QgsSearchTreeNode
bool getValue( QgsSearchTreeValue& value /Out/, QgsSearchTreeNode* node,
const QMap<int,QgsField>& fields, QgsFeature &f );

//! @note deprecated
//! @deprecated
bool getValue( QgsSearchTreeValue& value /Out/, QgsSearchTreeNode* node,
const QMap<int,QgsField>& fields, const QMap<int,QVariant>& attributes, QgsGeometry* geom = 0 );

Expand Down Expand Up @@ -149,7 +149,7 @@ class QgsSearchTreeNode
//! @note attribute/geom replaced by feature in 1.6
QgsSearchTreeValue valueAgainst( const QMap<int,QgsField>& fields, QgsFeature &f );

//! @note deprecated
//! @deprecated
QgsSearchTreeValue valueAgainst( const QMap<int,QgsField>& fields, const QMap<int,QVariant>& attributes, QgsGeometry* geom = 0 );

//! strips mText when node is of string type
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsvectordataprovider.sip
Expand Up @@ -196,7 +196,7 @@ class QgsVectorDataProvider : QgsDataProvider
* Adds new attributes
* @param attributes map with attribute name as key and type as value
* @return true in case of success and false in case of failure
* @note deprecated
* @deprecated
*/
virtual bool addAttributes(const QMap<QString, QString> &attributes);

Expand Down Expand Up @@ -283,7 +283,7 @@ class QgsVectorDataProvider : QgsDataProvider
const QList< QgsVectorDataProvider::NativeType > &nativeTypes() const;

/**Returns the names of the numerical types
@note deprecated */
@deprecated */
const QMap<QString,QVariant::Type> &supportedNativeTypes() const;

/**
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsvectorlayer.sip
Expand Up @@ -390,7 +390,7 @@ public:

/** add an attribute field (but does not commit it)
returns true in case of success
@note deprecated
@deprecated
*/
bool addAttribute( QString name, QString type );

Expand Down
12 changes: 6 additions & 6 deletions python/plugins/osm/OsmDatabaseManager.py
Expand Up @@ -143,21 +143,21 @@ def layerRemoved(self,layerID):
key=dbFileName.toLatin1().data()

# remove map layers that belong to dbFileName database
if key in self.lineLayers.keys() and layer.getLayerID()==self.lineLayers[key].getLayerID():
if key in self.lineLayers.keys() and layer.id()==self.lineLayers[key].getLayerID():
del self.lineLayers[key]

elif key in self.pointLayers.keys() and layer.getLayerID()==self.pointLayers[key].getLayerID():
elif key in self.pointLayers.keys() and layer.id()==self.pointLayers[key].id():
del self.pointLayers[key]
if key in self.lineLayers.keys():
if self.lineLayers[key]:
lineLayID=self.lineLayers[key].getLayerID()
lineLayID=self.lineLayers[key].id()
self.mapReg.removeMapLayer(lineLayID,True)

elif key in self.polygonLayers.keys() and layer.getLayerID()==self.polygonLayers[key].getLayerID():
elif key in self.polygonLayers.keys() and layer.id()==self.polygonLayers[key].id():
del self.polygonLayers[key]
if key in self.pointLayers.keys():
if self.pointLayers[key]:
pointLayID=self.pointLayers[key].getLayerID()
pointLayID=self.pointLayers[key].id()
self.mapReg.removeMapLayer(pointLayID,True)

if key in self.dbConns.keys():
Expand All @@ -177,7 +177,7 @@ def removeAllOsmLayers(self):
continue

if layer.type()==QgsMapLayer.VectorLayer and layer.dataProvider().name()=="osm":
QgsMapLayerRegistry.instance().removeMapLayer(layer.getLayerID(),True)
QgsMapLayerRegistry.instance().removeMapLayer(layer.id(),True)

self.dbConns={} # map dbFileName->sqlite3ConnectionObject
self.pointLayers={}
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/osm/OsmLoadDlg.py
Expand Up @@ -131,7 +131,7 @@ def onOK(self):

if replacing:
# remove layers of current data first
QgsMapLayerRegistry.instance().removeMapLayer(self.canvas.currentLayer().getLayerID(),True)
QgsMapLayerRegistry.instance().removeMapLayer(self.canvas.currentLayer().id(),True)

if self.chkCustomRenderer.isChecked():
styleFile=self.styleFiles[self.styleCombo.currentIndex()]
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgsapplegendinterface.cpp
Expand Up @@ -134,5 +134,5 @@ QList< QgsMapLayer * > QgsAppLegendInterface::layers() const

void QgsAppLegendInterface::refreshLayerSymbology( QgsMapLayer *ml )
{
mLegend->refreshLayerSymbology( ml->getLayerID() );
mLegend->refreshLayerSymbology( ml->id() );
}
2 changes: 1 addition & 1 deletion src/app/legend/qgslegend.cpp
Expand Up @@ -230,7 +230,7 @@ void QgsLegend::removeLayer( QString layerId )
// save legend layer (parent of a legend layer file we're going to delete)
QgsLegendLayer* ll = qobject_cast<QgsLegendLayer *>( li );

if ( ll && ll->layer() && ll->layer()->getLayerID() == layerId )
if ( ll && ll->layer() && ll->layer()->id() == layerId )
{
removeItem( ll );
delete ll;
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegendlayer.cpp
Expand Up @@ -540,7 +540,7 @@ void QgsLegendLayer::updateAfterLayerModification( bool onlyGeomChanged )
{
widthScale = canvas->map()->paintDevice().logicalDpiX() / 25.4;
}
refreshSymbology( mLyr.layer()->getLayerID(), widthScale );
refreshSymbology( mLyr.layer()->id(), widthScale );
}

void QgsLegendLayer::updateItemListCountV2( SymbologyList& itemList, QgsVectorLayer* layer )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -4920,7 +4920,7 @@ void QgisApp::layerSubsetString()
mMapCanvas->refresh();
if ( mMapLegend )
{
mMapLegend->refreshLayerSymbology( vlayer->getLayerID(), false );
mMapLegend->refreshLayerSymbology( vlayer->id(), false );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisappinterface.cpp
Expand Up @@ -220,7 +220,7 @@ void QgisAppInterface::refreshLegend( QgsMapLayer *l )
{
if ( l && qgis && qgis->legend() )
{
qgis->legend()->refreshLayerSymbology( l->getLayerID() );
qgis->legend()->refreshLayerSymbology( l->id() );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsaddjoindialog.cpp
Expand Up @@ -44,7 +44,7 @@ QgsAddJoinDialog::QgsAddJoinDialog( QgsVectorLayer* layer, QWidget * parent, Qt:
if ( currentVectorLayer && currentVectorLayer != mLayer )
{
if ( currentVectorLayer->dataProvider() && currentVectorLayer->dataProvider()->supportsSubsetString() )
mJoinLayerComboBox->addItem( currentLayer->name(), QVariant( currentLayer->getLayerID() ) );
mJoinLayerComboBox->addItem( currentLayer->name(), QVariant( currentLayer->id() ) );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsattributedialog.cpp
Expand Up @@ -288,7 +288,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
mFormNr = smFormCounter++;
QgisApp::instance()->runPythonString( QString( "_qgis_featureform_%1 = wrapinstance( %2, QtGui.QDialog )" ).arg( mFormNr ).arg(( unsigned long ) mDialog ) );

QString expr = QString( "%1(_qgis_featureform_%2,'%3',%4)" ).arg( vl->editFormInit() ).arg( mFormNr ).arg( vl->getLayerID() ).arg( mFeature->id() );
QString expr = QString( "%1(_qgis_featureform_%2,'%3',%4)" ).arg( vl->editFormInit() ).arg( mFormNr ).arg( vl->id() ).arg( mFeature->id() );
QgsDebugMsg( QString( "running featureForm init: %1" ).arg( expr ) );
QgisApp::instance()->runPythonString( expr );
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolidentify.cpp
Expand Up @@ -120,7 +120,7 @@ void QgsMapToolIdentify::canvasReleaseEvent( QMouseEvent * e )
emit identifyProgress( i, mCanvas->layerCount() );
emit identifyMessage( tr( "Identifying on %1..." ).arg( layer->name() ) );

if ( noIdentifyLayerIdList.contains( layer->getLayerID() ) )
if ( noIdentifyLayerIdList.contains( layer->id() ) )
continue;

if ( identifyLayer( layer, e->x(), e->y() ) )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsprojectproperties.cpp
Expand Up @@ -159,7 +159,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
twIdentifyLayers->setItem( i, 1, twi );

QCheckBox *cb = new QCheckBox();
cb->setChecked( !noIdentifyLayerIdList.contains( currentLayer->getLayerID() ) );
cb->setChecked( !noIdentifyLayerIdList.contains( currentLayer->id() ) );
twIdentifyLayers->setCellWidget( i, 2, cb );
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -1393,7 +1393,7 @@ void QgsRasterLayerProperties::apply()
pixmapThumbnail->setPixmap( myQPixmap );

// update symbology
emit refreshLegend( mRasterLayer->getLayerID(), false );
emit refreshLegend( mRasterLayer->id(), false );

//no need to delete the old one, maplayer will do it if needed
mRasterLayer->setCacheImage( 0 );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgssnappingdialog.cpp
Expand Up @@ -157,7 +157,7 @@ void QgsSnappingDialog::update()

QCheckBox *cbxEnable = new QCheckBox( mLayerTreeWidget );
mLayerTreeWidget->setItemWidget( item, 0, cbxEnable );
item->setData( 0, Qt::UserRole, currentVectorLayer->getLayerID() );
item->setData( 0, Qt::UserRole, currentVectorLayer->id() );

item->setText( 1, currentVectorLayer->name() );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -683,7 +683,7 @@ void QgsVectorLayerProperties::apply()
}

// update symbology
emit refreshLegend( layer->getLayerID(), false );
emit refreshLegend( layer->id(), false );

//no need to delete the old one, maplayer will do it if needed
layer->setCacheImage( 0 );
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerattributetable.cpp
Expand Up @@ -193,7 +193,7 @@ void QgsComposerAttributeTable::removeLayer( QString layerId )
{
if ( mVectorLayer )
{
if ( layerId == mVectorLayer->getLayerID() )
if ( layerId == mVectorLayer->id() )
{
mVectorLayer = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgslegendmodel.cpp
Expand Up @@ -210,7 +210,7 @@ int QgsLegendModel::addVectorLayerItems( QStandardItem* layerItem, QgsVectorLaye
continue;
}

QStandardItem* currentSymbolItem = itemFromSymbol( *symbolIt, opacity, vlayer->getLayerID() );
QStandardItem* currentSymbolItem = itemFromSymbol( *symbolIt, opacity, vlayer->id() );
if ( !currentSymbolItem )
{
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsapplication.h
Expand Up @@ -110,7 +110,7 @@ class CORE_EXPORT QgsApplication: public QApplication
static const QStringList svgPaths();

//! Returns the paths to svg applications svg directory.
//! @note deprecated since 1.4
//! @deprecated since 1.4
static const QString svgPath();

//! Returns the path to the application prefix directory.
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgslabel.h
Expand Up @@ -146,8 +146,7 @@ class CORE_EXPORT QgsLabel
QgsFieldMap & fields( void );

/** Pointer to default attributes.
* @note this will be deprecated in version 2 as it is
* badly named. Rather use attributes.
* @deprecated in version 2 as it is badly named. Rather use attributes.
* @see labelAttributes method rather */
QgsLabelAttributes *layerAttributes( void );

Expand Down
10 changes: 5 additions & 5 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -95,7 +95,7 @@ QgsMapLayer::LayerType QgsMapLayer::type() const
}

/** Get this layer's unique ID */
QString QgsMapLayer::getLayerID() const
QString QgsMapLayer::id() const
{
return mID;
}
Expand Down Expand Up @@ -282,11 +282,11 @@ bool QgsMapLayer::writeXML( QDomNode & layer_node, QDomDocument & document )
maplayer.setAttribute( "maximumScale", maximumScale() );

// ID
QDomElement id = document.createElement( "id" );
QDomText idText = document.createTextNode( getLayerID() );
id.appendChild( idText );
QDomElement layerId = document.createElement( "id" );
QDomText layerIdText = document.createTextNode( id() );
layerId.appendChild( layerIdText );

maplayer.appendChild( id );
maplayer.appendChild( layerId );

// data source
QDomElement dataSource = document.createElement( "datasource" );
Expand Down
11 changes: 9 additions & 2 deletions src/core/qgsmaplayer.h
Expand Up @@ -67,8 +67,15 @@ class CORE_EXPORT QgsMapLayer : public QObject
*/
QgsMapLayer::LayerType type() const;

/** Get this layer's unique ID, this ID is used to access this layer from map layer registry */
QString getLayerID() const;
/** Get this layer's unique ID, this ID is used to access this layer from map layer registry
* @note added in 1.7
**/
QString id() const;

/** Get this layer's unique ID, this ID is used to access this layer from map layer registry
* @deprecated use id()
**/
QString getLayerID() const { return id(); }

/** Set the display name of the layer
* @param name New name for the layer
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsmaplayerregistry.cpp
Expand Up @@ -72,16 +72,16 @@ QgsMapLayerRegistry::addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal
}

//check the layer is not already registered!
QMap<QString, QgsMapLayer*>::iterator myIterator = mMapLayers.find( theMapLayer->getLayerID() );
QMap<QString, QgsMapLayer*>::iterator myIterator = mMapLayers.find( theMapLayer->id() );
//if myIterator returns mMapLayers.end() then it does not exist in registry and its safe to add it
if ( myIterator == mMapLayers.end() )
{
mMapLayers[theMapLayer->getLayerID()] = theMapLayer;
mMapLayers[theMapLayer->id()] = theMapLayer;

if ( theEmitSignal )
emit layerWasAdded( theMapLayer );

return mMapLayers[theMapLayer->getLayerID()];
return mMapLayers[theMapLayer->id()];
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprenderer.h
Expand Up @@ -134,7 +134,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
void updateScale();

//! Return the measuring object
//! @note deprecated.
//! @deprecated
QgsDistanceArea* distanceArea() { return mDistArea; }
QGis::UnitType mapUnits() const;
void setMapUnits( QGis::UnitType u );
Expand Down

0 comments on commit 132088f

Please sign in to comment.