[QGIS Commit] r15346 - in trunk/qgis: python/core src/analysis/vector src/app src/core src/core/raster src/mapserver src/plugins/spatialquery

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Mar 5 17:09:02 EST 2011


Author: jef
Date: 2011-03-05 14:09:01 -0800 (Sat, 05 Mar 2011)
New Revision: 15346

Modified:
   trunk/qgis/python/core/qgsmaplayer.sip
   trunk/qgis/src/analysis/vector/qgsgeometryanalyzer.cpp
   trunk/qgis/src/analysis/vector/qgsoverlayanalyzer.cpp
   trunk/qgis/src/app/qgsmaptoolidentify.cpp
   trunk/qgis/src/core/qgsmaplayer.h
   trunk/qgis/src/core/qgsmaprenderer.cpp
   trunk/qgis/src/core/qgspallabeling.cpp
   trunk/qgis/src/core/qgsproject.cpp
   trunk/qgis/src/core/qgsvectorfilewriter.cpp
   trunk/qgis/src/core/qgsvectorlayer.h
   trunk/qgis/src/core/raster/qgsrasterlayer.cpp
   trunk/qgis/src/mapserver/qgsconfigparser.cpp
   trunk/qgis/src/mapserver/qgsprojectparser.cpp
   trunk/qgis/src/mapserver/qgssldparser.cpp
   trunk/qgis/src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp
Log:
deprecate QgsMapLayer::srs()

Modified: trunk/qgis/python/core/qgsmaplayer.sip
===================================================================
--- trunk/qgis/python/core/qgsmaplayer.sip	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/python/core/qgsmaplayer.sip	2011-03-05 22:09:01 UTC (rev 15346)
@@ -225,7 +225,7 @@
     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 */

Modified: trunk/qgis/src/analysis/vector/qgsgeometryanalyzer.cpp
===================================================================
--- trunk/qgis/src/analysis/vector/qgsgeometryanalyzer.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/analysis/vector/qgsgeometryanalyzer.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -43,7 +43,7 @@
   }
 
   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 @@
   }
 
   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 @@
   }
 
   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 @@
   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 @@
   }
 
   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 @@
   {
     outputType = QGis::WKBMultiPolygon;
   }
-  const QgsCoordinateReferenceSystem crs = layer->srs();
+  const QgsCoordinateReferenceSystem crs = layer->crs();
 
   QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
   QgsFeature currentFeature;

Modified: trunk/qgis/src/analysis/vector/qgsoverlayanalyzer.cpp
===================================================================
--- trunk/qgis/src/analysis/vector/qgsoverlayanalyzer.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/analysis/vector/qgsoverlayanalyzer.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -45,7 +45,7 @@
   }
 
   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 );

Modified: trunk/qgis/src/app/qgsmaptoolidentify.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/app/qgsmaptoolidentify.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -214,7 +214,7 @@
   QgsDistanceArea calc;
   calc.setProjectionsEnabled( mCanvas->hasCrsTransformEnabled() ); // project?
   calc.setEllipsoid( ellipsoid );
-  calc.setSourceCrs( layer->srs().srsid() );
+  calc.setSourceCrs( layer->crs().srsid() );
 
   QgsFeatureList featureList;
 

Modified: trunk/qgis/src/core/qgsmaplayer.h
===================================================================
--- trunk/qgis/src/core/qgsmaplayer.h	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/core/qgsmaplayer.h	2011-03-05 22:09:01 UTC (rev 15346)
@@ -221,10 +221,10 @@
 
     /** 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 */

Modified: trunk/qgis/src/core/qgsmaprenderer.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaprenderer.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/core/qgsmaprenderer.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -385,7 +385,7 @@
       {
         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 @@
           {
             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 @@
   {
     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 @@
   {
     try
     {
-      QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
+      QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
       extent = tr.transformBoundingBox( extent );
     }
     catch ( QgsCsException &cse )
@@ -770,7 +770,7 @@
   {
     try
     {
-      QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
+      QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
       point = tr.transform( point, QgsCoordinateTransform::ForwardTransform );
     }
     catch ( QgsCsException &cse )
@@ -792,7 +792,7 @@
   {
     try
     {
-      QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
+      QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
       point = tr.transform( point, QgsCoordinateTransform::ReverseTransform );
     }
     catch ( QgsCsException &cse )
@@ -814,7 +814,7 @@
   {
     try
     {
-      QgsCoordinateTransform tr( theLayer->srs(), *mDestCRS );
+      QgsCoordinateTransform tr( theLayer->crs(), *mDestCRS );
       rect = tr.transform( rect, QgsCoordinateTransform::ReverseTransform );
     }
     catch ( QgsCsException &cse )

Modified: trunk/qgis/src/core/qgspallabeling.cpp
===================================================================
--- trunk/qgis/src/core/qgspallabeling.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/core/qgspallabeling.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -734,7 +734,7 @@
 
   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 );

Modified: trunk/qgis/src/core/qgsproject.cpp
===================================================================
--- trunk/qgis/src/core/qgsproject.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/core/qgsproject.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -486,43 +486,44 @@
     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 @@
 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 @@
 
 
 /**
-   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()
 {

Modified: trunk/qgis/src/core/qgsvectorfilewriter.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorfilewriter.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/core/qgsvectorfilewriter.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -573,7 +573,7 @@
   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 @@
   // Create our transform
   if ( destCRS )
   {
-    ct = new QgsCoordinateTransform( layer->srs(), *destCRS );
+    ct = new QgsCoordinateTransform( layer->crs(), *destCRS );
   }
 
   // Check for failure

Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/core/qgsvectorlayer.h	2011-03-05 22:09:01 UTC (rev 15346)
@@ -155,7 +155,6 @@
 
     /** 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 @@
     /**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 );
 
 

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -4014,9 +4014,9 @@
     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
   {

Modified: trunk/qgis/src/mapserver/qgsconfigparser.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgsconfigparser.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/mapserver/qgsconfigparser.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -137,7 +137,7 @@
     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 @@
   }
   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;
 }

Modified: trunk/qgis/src/mapserver/qgsprojectparser.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgsprojectparser.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/mapserver/qgsprojectparser.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -235,7 +235,7 @@
       //Ex_GeographicBoundingBox
       if ( mapExtent.isEmpty() )
       {
-        appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->srs() );
+        appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->crs() );
       }
       else
       {

Modified: trunk/qgis/src/mapserver/qgssldparser.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgssldparser.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/mapserver/qgssldparser.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -211,7 +211,7 @@
         //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" );

Modified: trunk/qgis/src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp
===================================================================
--- trunk/qgis/src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp	2011-03-05 21:51:59 UTC (rev 15345)
+++ trunk/qgis/src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp	2011-03-05 22:09:01 UTC (rev 15346)
@@ -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 @@
 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 );
 



More information about the QGIS-commit mailing list