Skip to content
Permalink
Browse files

deprecate QgsMapLayer::srs()

git-svn-id: http://svn.osgeo.org/qgis/trunk@15346 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 5, 2011
1 parent 4712317 commit 155b9996d1acba7fe52698536e6cbdb00a7ef5d5
@@ -225,7 +225,7 @@ public:
and will be deprecated in 2.0
@see crs()
*/
const QgsCoordinateReferenceSystem& srs();
const QgsCoordinateReferenceSystem& srs() /Deprecated/;

/** Sets layer's spatial reference system
@note emitSignal added in 1.4 */
@@ -43,7 +43,7 @@ bool QgsGeometryAnalyzer::simplify( QgsVectorLayer* layer, const QString& shapef
}

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

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

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

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

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

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

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

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

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

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

QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
QgsFeature currentFeature;
@@ -45,7 +45,7 @@ bool QgsOverlayAnalyzer::intersection( QgsVectorLayer* layerA, QgsVectorLayer* l
}

QGis::WkbType outputType = dpA->geometryType();
const QgsCoordinateReferenceSystem crs = layerA->srs();
const QgsCoordinateReferenceSystem crs = layerA->crs();
QgsFieldMap fieldsA = dpA->fields();
QgsFieldMap fieldsB = dpB->fields();
combineFieldLists( fieldsA, fieldsB );
@@ -214,7 +214,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
QgsDistanceArea calc;
calc.setProjectionsEnabled( mCanvas->hasCrsTransformEnabled() ); // project?
calc.setEllipsoid( ellipsoid );
calc.setSourceCrs( layer->srs().srsid() );
calc.setSourceCrs( layer->crs().srsid() );

QgsFeatureList featureList;

@@ -221,10 +221,10 @@ class CORE_EXPORT QgsMapLayer : public QObject

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

/** Sets layer's spatial reference system
@note emitSignal added in 1.4 */
@@ -385,7 +385,7 @@ void QgsMapRenderer::render( QPainter* painter )
{
r1 = mExtent;
split = splitLayersExtent( ml, r1, r2 );
ct = new QgsCoordinateTransform( ml->srs(), *mDestCRS );
ct = new QgsCoordinateTransform( ml->crs(), *mDestCRS );
mRenderContext.setExtent( r1 );
if ( !r1.isFinite() || !r2.isFinite() ) //there was a problem transforming the extent. Skip the layer
{
@@ -566,7 +566,7 @@ void QgsMapRenderer::render( QPainter* painter )
{
QgsRectangle r1 = mExtent;
split = splitLayersExtent( ml, r1, r2 );
ct = new QgsCoordinateTransform( ml->srs(), *mDestCRS );
ct = new QgsCoordinateTransform( ml->crs(), *mDestCRS );
mRenderContext.setExtent( r1 );
}
else
@@ -691,7 +691,7 @@ bool QgsMapRenderer::splitLayersExtent( QgsMapLayer* layer, QgsRectangle& extent
{
try
{
QgsCoordinateTransform tr( layer->srs(), *mDestCRS );
QgsCoordinateTransform tr( layer->crs(), *mDestCRS );

#ifdef QGISDEBUG
// 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
{
try
{
QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
extent = tr.transformBoundingBox( extent );
}
catch ( QgsCsException &cse )
@@ -770,7 +770,7 @@ QgsPoint QgsMapRenderer::layerToMapCoordinates( QgsMapLayer* theLayer, QgsPoint
{
try
{
QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
point = tr.transform( point, QgsCoordinateTransform::ForwardTransform );
}
catch ( QgsCsException &cse )
@@ -792,7 +792,7 @@ QgsPoint QgsMapRenderer::mapToLayerCoordinates( QgsMapLayer* theLayer, QgsPoint
{
try
{
QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
point = tr.transform( point, QgsCoordinateTransform::ReverseTransform );
}
catch ( QgsCsException &cse )
@@ -814,7 +814,7 @@ QgsRectangle QgsMapRenderer::mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRe
{
try
{
QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
rect = tr.transform( rect, QgsCoordinateTransform::ReverseTransform );
}
catch ( QgsCsException &cse )
@@ -734,7 +734,7 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices,

lyr.xform = mMapRenderer->coordinateTransform();
if ( mMapRenderer->hasCrsTransformEnabled() )
lyr.ct = new QgsCoordinateTransform( layer->srs(), mMapRenderer->destinationSrs() );
lyr.ct = new QgsCoordinateTransform( layer->crs(), mMapRenderer->destinationSrs() );
else
lyr.ct = NULL;
lyr.ptZero = lyr.xform->toMapCoordinates( 0, 0 );
@@ -486,43 +486,44 @@ _getProperties( QDomDocument const &doc, QgsPropertyKey & project_properties )
QgsDebugMsg( "Project_properties.readXML() failed" );
}

#if 0
// DEPRECATED as functionality has been shoved down to QgsProperyKey::readXML()
size_t i = 0;
while ( i < scopes.count() )
{
QDomNode curr_scope_node = scopes.item( i );

// size_t i = 0;
// while (i < scopes.count())
// {
// QDomNode curr_scope_node = scopes.item(i);

// qDebug("found %d property node(s) for scope %s",
// curr_scope_node.childNodes().count(),
// curr_scope_node.nodeName().utf8().constData());
qDebug( "found %d property node(s) for scope %s",
curr_scope_node.childNodes().count(),
curr_scope_node.nodeName().utf8().constData() );

// QString key(curr_scope_node.nodeName());
QString key( curr_scope_node.nodeName() );

// QgsPropertyKey * currentKey =
// dynamic_cast<QgsPropertyKey*>(project_properties.find( key ));
QgsPropertyKey * currentKey =
dynamic_cast<QgsPropertyKey*>( project_properties.find( key ) );

// if ( ! currentKey )
// {
// // if the property key doesn't yet exist, create an empty instance
// // of that key
if ( ! currentKey )
{
// if the property key doesn't yet exist, create an empty instance
// of that key

// currentKey = project_properties.addKey( key );
currentKey = project_properties.addKey( key );

// if ( ! currentKey )
// {
// qDebug( "%s:%d unable to add key", __FILE__, __LINE__ );
// }
// }
if ( ! currentKey )
{
qDebug( "%s:%d unable to add key", __FILE__, __LINE__ );
}
}

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

// ++i;
// }
++i;
}
#endif
} // _getProperties


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

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

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


/**
it's presumed that the caller has already reset the map canvas, map registry, and legend
presuming that the caller has already reset the map canvas, map registry, and legend
*/
bool QgsProject::read()
{
@@ -573,7 +573,7 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
else
{
// This means we shouldn't transform, use source CRS as output (if defined)
outputCRS = &layer->srs();
outputCRS = &layer->crs();
}
QgsVectorFileWriter* writer =
new QgsVectorFileWriter( fileName, fileEncoding, skipAttributeCreation ? QgsFieldMap() : layer->pendingFields(), layer->wkbType(), outputCRS, driverName, datasourceOptions, layerOptions );
@@ -603,7 +603,7 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer,
// Create our transform
if ( destCRS )
{
ct = new QgsCoordinateTransform( layer->srs(), *destCRS );
ct = new QgsCoordinateTransform( layer->crs(), *destCRS );
}

// Check for failure
@@ -155,7 +155,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

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

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


@@ -4014,9 +4014,9 @@ bool QgsRasterLayer::readXml( QDomNode & layer_node )
QString format = rpNode.namedItem( "wmsFormat" ).toElement().text();

// Collect CRS
QString crs = srs().authid();
QString authid = crs().authid();

setDataProvider( mProviderKey, layers, styles, format, crs );
setDataProvider( mProviderKey, layers, styles, format, authid );
}
else
{
@@ -137,7 +137,7 @@ QStringList QgsConfigParser::createCRSListForLayer( QgsMapLayer* theMapLayer ) c
if ( myResult )
{
//if the database cannot be opened, add at least the epsg number of the source coordinate system
crsNumbers.push_back( theMapLayer->srs().authid() );
crsNumbers.push_back( theMapLayer->crs().authid() );
return crsNumbers;
};
QString mySql = "select upper(auth_name||':'||auth_id) from tbl_srs";
@@ -154,7 +154,7 @@ QStringList QgsConfigParser::createCRSListForLayer( QgsMapLayer* theMapLayer ) c
}
else //rasters cannot be reprojected. Use the epsg number of the layers native CRS
{
crsNumbers.push_back( theMapLayer->srs().authid() );
crsNumbers.push_back( theMapLayer->crs().authid() );
}
return crsNumbers;
}
@@ -235,7 +235,7 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
//Ex_GeographicBoundingBox
if ( mapExtent.isEmpty() )
{
appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->srs() );
appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->crs() );
}
else
{
@@ -211,7 +211,7 @@ void QgsSLDParser::layersAndStylesCapabilities( QDomElement& parentElement, QDom
//append geographic bbox and the CRS elements
QStringList crsNumbers = createCRSListForLayer( theMapLayer );
appendCRSElementsToLayer( layerElement, doc, crsNumbers );
appendExGeographicBoundingBox( layerElement, doc, theMapLayer->extent(), theMapLayer->srs() );
appendExGeographicBoundingBox( layerElement, doc, theMapLayer->extent(), theMapLayer->crs() );

//iterate over all <UserStyle> nodes within a user layer
QDomNodeList userStyleList = layerNodeList.item( i ).toElement().elementsByTagName( "UserStyle" );
@@ -15,7 +15,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id: qgsgeometrycoordinatetransform.cpp 13377 2010-04-25 01:07:36Z jef $ */
/* $Id$ */

#include "qgsgeometrycoordinatetransform.h"

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

mCoordTransform = new QgsCoordinateTransform( srsTarget, srsReference );

0 comments on commit 155b999

Please sign in to comment.
You can’t perform that action at this time.