Skip to content

Commit 155b999

Browse files
author
jef
committed
deprecate QgsMapLayer::srs()
git-svn-id: http://svn.osgeo.org/qgis/trunk@15346 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4712317 commit 155b999

15 files changed

+64
-65
lines changed

python/core/qgsmaplayer.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public:
225225
and will be deprecated in 2.0
226226
@see crs()
227227
*/
228-
const QgsCoordinateReferenceSystem& srs();
228+
const QgsCoordinateReferenceSystem& srs() /Deprecated/;
229229

230230
/** Sets layer's spatial reference system
231231
@note emitSignal added in 1.4 */

src/analysis/vector/qgsgeometryanalyzer.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bool QgsGeometryAnalyzer::simplify( QgsVectorLayer* layer, const QString& shapef
4343
}
4444

4545
QGis::WkbType outputType = dp->geometryType();
46-
const QgsCoordinateReferenceSystem crs = layer->srs();
46+
const QgsCoordinateReferenceSystem crs = layer->crs();
4747

4848
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
4949
QgsFeature currentFeature;
@@ -157,7 +157,7 @@ bool QgsGeometryAnalyzer::centroids( QgsVectorLayer* layer, const QString& shape
157157
}
158158

159159
QGis::WkbType outputType = QGis::WKBPoint;
160-
const QgsCoordinateReferenceSystem crs = layer->srs();
160+
const QgsCoordinateReferenceSystem crs = layer->crs();
161161

162162
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
163163
QgsFeature currentFeature;
@@ -271,7 +271,7 @@ bool QgsGeometryAnalyzer::extent( QgsVectorLayer* layer, const QString& shapefil
271271
}
272272

273273
QGis::WkbType outputType = QGis::WKBPolygon;
274-
const QgsCoordinateReferenceSystem crs = layer->srs();
274+
const QgsCoordinateReferenceSystem crs = layer->crs();
275275

276276
QgsFieldMap fields;
277277
fields.insert( 0 , QgsField( QString( "MINX" ), QVariant::Double ) );
@@ -404,7 +404,7 @@ bool QgsGeometryAnalyzer::convexHull( QgsVectorLayer* layer, const QString& shap
404404
fields.insert( 2 , QgsField( QString( "PERIM" ), QVariant::Double ) );
405405

406406
QGis::WkbType outputType = QGis::WKBPolygon;
407-
const QgsCoordinateReferenceSystem crs = layer->srs();
407+
const QgsCoordinateReferenceSystem crs = layer->crs();
408408

409409
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), fields, outputType, &crs );
410410
QgsFeature currentFeature;
@@ -610,7 +610,7 @@ bool QgsGeometryAnalyzer::dissolve( QgsVectorLayer* layer, const QString& shapef
610610
}
611611

612612
QGis::WkbType outputType = dp->geometryType();
613-
const QgsCoordinateReferenceSystem crs = layer->srs();
613+
const QgsCoordinateReferenceSystem crs = layer->crs();
614614

615615
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
616616
QgsFeature currentFeature;
@@ -763,7 +763,7 @@ bool QgsGeometryAnalyzer::buffer( QgsVectorLayer* layer, const QString& shapefil
763763
{
764764
outputType = QGis::WKBMultiPolygon;
765765
}
766-
const QgsCoordinateReferenceSystem crs = layer->srs();
766+
const QgsCoordinateReferenceSystem crs = layer->crs();
767767

768768
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
769769
QgsFeature currentFeature;

src/analysis/vector/qgsoverlayanalyzer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool QgsOverlayAnalyzer::intersection( QgsVectorLayer* layerA, QgsVectorLayer* l
4545
}
4646

4747
QGis::WkbType outputType = dpA->geometryType();
48-
const QgsCoordinateReferenceSystem crs = layerA->srs();
48+
const QgsCoordinateReferenceSystem crs = layerA->crs();
4949
QgsFieldMap fieldsA = dpA->fields();
5050
QgsFieldMap fieldsB = dpB->fields();
5151
combineFieldLists( fieldsA, fieldsB );

src/app/qgsmaptoolidentify.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
214214
QgsDistanceArea calc;
215215
calc.setProjectionsEnabled( mCanvas->hasCrsTransformEnabled() ); // project?
216216
calc.setEllipsoid( ellipsoid );
217-
calc.setSourceCrs( layer->srs().srsid() );
217+
calc.setSourceCrs( layer->crs().srsid() );
218218

219219
QgsFeatureList featureList;
220220

src/core/qgsmaplayer.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ class CORE_EXPORT QgsMapLayer : public QObject
221221

222222
/** Returns layer's spatial reference system
223223
@note This method is here for API compatibility
224-
and will be deprecited in 2.0
225-
@see crs()
224+
and will be deprecated in 2.0
225+
@deprecated use crs()
226226
*/
227-
const QgsCoordinateReferenceSystem& srs();
227+
QGISDEPRECATED const QgsCoordinateReferenceSystem& srs();
228228

229229
/** Sets layer's spatial reference system
230230
@note emitSignal added in 1.4 */

src/core/qgsmaprenderer.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ void QgsMapRenderer::render( QPainter* painter )
385385
{
386386
r1 = mExtent;
387387
split = splitLayersExtent( ml, r1, r2 );
388-
ct = new QgsCoordinateTransform( ml->srs(), *mDestCRS );
388+
ct = new QgsCoordinateTransform( ml->crs(), *mDestCRS );
389389
mRenderContext.setExtent( r1 );
390390
if ( !r1.isFinite() || !r2.isFinite() ) //there was a problem transforming the extent. Skip the layer
391391
{
@@ -566,7 +566,7 @@ void QgsMapRenderer::render( QPainter* painter )
566566
{
567567
QgsRectangle r1 = mExtent;
568568
split = splitLayersExtent( ml, r1, r2 );
569-
ct = new QgsCoordinateTransform( ml->srs(), *mDestCRS );
569+
ct = new QgsCoordinateTransform( ml->crs(), *mDestCRS );
570570
mRenderContext.setExtent( r1 );
571571
}
572572
else
@@ -691,7 +691,7 @@ bool QgsMapRenderer::splitLayersExtent( QgsMapLayer* layer, QgsRectangle& extent
691691
{
692692
try
693693
{
694-
QgsCoordinateTransform tr( layer->srs(), *mDestCRS );
694+
QgsCoordinateTransform tr( layer->crs(), *mDestCRS );
695695

696696
#ifdef QGISDEBUG
697697
// QgsLogger::debug<QgsRectangle>("Getting extent of canvas in layers CS. Canvas is ", extent, __FILE__, __FUNCTION__, __LINE__);
@@ -747,7 +747,7 @@ QgsRectangle QgsMapRenderer::layerExtentToOutputExtent( QgsMapLayer* theLayer, Q
747747
{
748748
try
749749
{
750-
QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
750+
QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
751751
extent = tr.transformBoundingBox( extent );
752752
}
753753
catch ( QgsCsException &cse )
@@ -770,7 +770,7 @@ QgsPoint QgsMapRenderer::layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint
770770
{
771771
try
772772
{
773-
QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
773+
QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
774774
point = tr.transform( point, QgsCoordinateTransform::ForwardTransform );
775775
}
776776
catch ( QgsCsException &cse )
@@ -792,7 +792,7 @@ QgsPoint QgsMapRenderer::mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint
792792
{
793793
try
794794
{
795-
QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
795+
QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
796796
point = tr.transform( point, QgsCoordinateTransform::ReverseTransform );
797797
}
798798
catch ( QgsCsException &cse )
@@ -814,7 +814,7 @@ QgsRectangle QgsMapRenderer::mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRe
814814
{
815815
try
816816
{
817-
QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
817+
QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
818818
rect = tr.transform( rect, QgsCoordinateTransform::ReverseTransform );
819819
}
820820
catch ( QgsCsException &cse )

src/core/qgspallabeling.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices,
734734

735735
lyr.xform = mMapRenderer->coordinateTransform();
736736
if ( mMapRenderer->hasCrsTransformEnabled() )
737-
lyr.ct = new QgsCoordinateTransform( layer->srs(), mMapRenderer->destinationSrs() );
737+
lyr.ct = new QgsCoordinateTransform( layer->crs(), mMapRenderer->destinationSrs() );
738738
else
739739
lyr.ct = NULL;
740740
lyr.ptZero = lyr.xform->toMapCoordinates( 0, 0 );

src/core/qgsproject.cpp

+31-30
Original file line numberDiff line numberDiff line change
@@ -486,43 +486,44 @@ _getProperties( QDomDocument const &doc, QgsPropertyKey & project_properties )
486486
QgsDebugMsg( "Project_properties.readXML() failed" );
487487
}
488488

489+
#if 0
489490
// DEPRECATED as functionality has been shoved down to QgsProperyKey::readXML()
491+
size_t i = 0;
492+
while ( i < scopes.count() )
493+
{
494+
QDomNode curr_scope_node = scopes.item( i );
490495

491-
// size_t i = 0;
492-
// while (i < scopes.count())
493-
// {
494-
// QDomNode curr_scope_node = scopes.item(i);
495-
496-
// qDebug("found %d property node(s) for scope %s",
497-
// curr_scope_node.childNodes().count(),
498-
// curr_scope_node.nodeName().utf8().constData());
496+
qDebug( "found %d property node(s) for scope %s",
497+
curr_scope_node.childNodes().count(),
498+
curr_scope_node.nodeName().utf8().constData() );
499499

500-
// QString key(curr_scope_node.nodeName());
500+
QString key( curr_scope_node.nodeName() );
501501

502-
// QgsPropertyKey * currentKey =
503-
// dynamic_cast<QgsPropertyKey*>(project_properties.find( key ));
502+
QgsPropertyKey * currentKey =
503+
dynamic_cast<QgsPropertyKey*>( project_properties.find( key ) );
504504

505-
// if ( ! currentKey )
506-
// {
507-
// // if the property key doesn't yet exist, create an empty instance
508-
// // of that key
505+
if ( ! currentKey )
506+
{
507+
// if the property key doesn't yet exist, create an empty instance
508+
// of that key
509509

510-
// currentKey = project_properties.addKey( key );
510+
currentKey = project_properties.addKey( key );
511511

512-
// if ( ! currentKey )
513-
// {
514-
// qDebug( "%s:%d unable to add key", __FILE__, __LINE__ );
515-
// }
516-
// }
512+
if ( ! currentKey )
513+
{
514+
qDebug( "%s:%d unable to add key", __FILE__, __LINE__ );
515+
}
516+
}
517517

518-
// if (! currentKey->readXML(curr_scope_node))
519-
// {
520-
// qDebug("%s:%d unable to read XML for property %s", __FILE__, __LINE__,
521-
// curr_scope_node.nodeName().utf8().constData());
522-
// }
518+
if ( ! currentKey->readXML( curr_scope_node ) )
519+
{
520+
qDebug( "%s:%d unable to read XML for property %s", __FILE__, __LINE__,
521+
curr_scope_node.nodeName().utf8().constData() );
522+
}
523523

524-
// ++i;
525-
// }
524+
++i;
525+
}
526+
#endif
526527
} // _getProperties
527528

528529

@@ -647,7 +648,7 @@ static QgsProjectVersion _getVersion( QDomDocument const &doc )
647648
QPair< bool, QList<QDomNode> > QgsProject::_getMapLayers( QDomDocument const &doc )
648649
{
649650
// Layer order is set by the restoring the legend settings from project file.
650-
// This is done on the 'readProject( ... ) signal
651+
// This is done on the 'readProject( ... )' signal
651652

652653
QDomNodeList nl = doc.elementsByTagName( "maplayer" );
653654

@@ -763,7 +764,7 @@ bool QgsProject::read( QFileInfo const &file )
763764

764765

765766
/**
766-
it's presumed that the caller has already reset the map canvas, map registry, and legend
767+
presuming that the caller has already reset the map canvas, map registry, and legend
767768
*/
768769
bool QgsProject::read()
769770
{

src/core/qgsvectorfilewriter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
573573
else
574574
{
575575
// This means we shouldn't transform, use source CRS as output (if defined)
576-
outputCRS = &layer->srs();
576+
outputCRS = &layer->crs();
577577
}
578578
QgsVectorFileWriter* writer =
579579
new QgsVectorFileWriter( fileName, fileEncoding, skipAttributeCreation ? QgsFieldMap() : layer->pendingFields(), layer->wkbType(), outputCRS, driverName, datasourceOptions, layerOptions );
@@ -603,7 +603,7 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
603603
// Create our transform
604604
if ( destCRS )
605605
{
606-
ct = new QgsCoordinateTransform( layer->srs(), *destCRS );
606+
ct = new QgsCoordinateTransform( layer->crs(), *destCRS );
607607
}
608608

609609
// Check for failure

src/core/qgsvectorlayer.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
155155

156156
/** Joins another vector layer to this layer
157157
@param joinInfo join object containing join layer id, target and source field
158-
@param cacheInMemory if true: caches the content of the join layer in virtual memory
159158
@note added in 1.7 */
160159
void addJoin( QgsVectorJoinInfo joinInfo );
161160

@@ -648,8 +647,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
648647
/**Returns unique values for column
649648
@param index column index for attribute
650649
@param uniqueValues out: result list
651-
@limit maximum number of values to return (-1 if unlimited)
652-
@note: this method was added in version 1.7*/
650+
@param limit maximum number of values to return (-1 if unlimited)
651+
@note this method was added in version 1.7*/
653652
void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );
654653

655654

src/core/raster/qgsrasterlayer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4014,9 +4014,9 @@ bool QgsRasterLayer::readXml( QDomNode & layer_node )
40144014
QString format = rpNode.namedItem( "wmsFormat" ).toElement().text();
40154015

40164016
// Collect CRS
4017-
QString crs = srs().authid();
4017+
QString authid = crs().authid();
40184018

4019-
setDataProvider( mProviderKey, layers, styles, format, crs );
4019+
setDataProvider( mProviderKey, layers, styles, format, authid );
40204020
}
40214021
else
40224022
{

src/mapserver/qgsconfigparser.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ QStringList QgsConfigParser::createCRSListForLayer( QgsMapLayer* theMapLayer ) c
137137
if ( myResult )
138138
{
139139
//if the database cannot be opened, add at least the epsg number of the source coordinate system
140-
crsNumbers.push_back( theMapLayer->srs().authid() );
140+
crsNumbers.push_back( theMapLayer->crs().authid() );
141141
return crsNumbers;
142142
};
143143
QString mySql = "select upper(auth_name||':'||auth_id) from tbl_srs";
@@ -154,7 +154,7 @@ QStringList QgsConfigParser::createCRSListForLayer( QgsMapLayer* theMapLayer ) c
154154
}
155155
else //rasters cannot be reprojected. Use the epsg number of the layers native CRS
156156
{
157-
crsNumbers.push_back( theMapLayer->srs().authid() );
157+
crsNumbers.push_back( theMapLayer->crs().authid() );
158158
}
159159
return crsNumbers;
160160
}

src/mapserver/qgsprojectparser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
235235
//Ex_GeographicBoundingBox
236236
if ( mapExtent.isEmpty() )
237237
{
238-
appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->srs() );
238+
appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->crs() );
239239
}
240240
else
241241
{

src/mapserver/qgssldparser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void QgsSLDParser::layersAndStylesCapabilities( QDomElement& parentElement, QDom
211211
//append geographic bbox and the CRS elements
212212
QStringList crsNumbers = createCRSListForLayer( theMapLayer );
213213
appendCRSElementsToLayer( layerElement, doc, crsNumbers );
214-
appendExGeographicBoundingBox( layerElement, doc, theMapLayer->extent(), theMapLayer->srs() );
214+
appendExGeographicBoundingBox( layerElement, doc, theMapLayer->extent(), theMapLayer->crs() );
215215

216216
//iterate over all <UserStyle> nodes within a user layer
217217
QDomNodeList userStyleList = layerNodeList.item( i ).toElement().elementsByTagName( "UserStyle" );

src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* (at your option) any later version. *
1616
* *
1717
***************************************************************************/
18-
/* $Id: qgsgeometrycoordinatetransform.cpp 13377 2010-04-25 01:07:36Z jef $ */
18+
/* $Id$ */
1919

2020
#include "qgsgeometrycoordinatetransform.h"
2121

@@ -30,9 +30,8 @@ QgsGeometryCoordinateTransform::~QgsGeometryCoordinateTransform()
3030
void QgsGeometryCoordinateTransform::setCoordinateTransform( QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference )
3131
{
3232
// Transform Forward: Target to Reference
33-
// * Use srs() to use old versions QGis - will be deprecited in 2.0 (after use crs())
34-
QgsCoordinateReferenceSystem srsTarget = lyrTarget->srs();
35-
QgsCoordinateReferenceSystem srsReference = lyrReference->srs();
33+
QgsCoordinateReferenceSystem srsTarget = lyrTarget->crs();
34+
QgsCoordinateReferenceSystem srsReference = lyrReference->crs();
3635

3736
mCoordTransform = new QgsCoordinateTransform( srsTarget, srsReference );
3837

0 commit comments

Comments
 (0)