[QGIS Commit] r15724 - trunk/qgis/src/mapserver

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Apr 16 08:18:33 EDT 2011


Author: mhugent
Date: 2011-04-16 05:18:32 -0700 (Sat, 16 Apr 2011)
New Revision: 15724

Modified:
   trunk/qgis/src/mapserver/qgsconfigparser.cpp
   trunk/qgis/src/mapserver/qgswmsserver.cpp
Log:
Raster reprojection in QGIS server

Modified: trunk/qgis/src/mapserver/qgsconfigparser.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgsconfigparser.cpp	2011-04-16 11:44:42 UTC (rev 15723)
+++ trunk/qgis/src/mapserver/qgsconfigparser.cpp	2011-04-16 12:18:32 UTC (rev 15724)
@@ -122,41 +122,31 @@
 QStringList QgsConfigParser::createCRSListForLayer( QgsMapLayer* theMapLayer ) const
 {
   QStringList crsNumbers;
-  QgsVectorLayer* theVectorLayer = dynamic_cast<QgsVectorLayer*>( theMapLayer );
+  QString myDatabaseFileName = QgsApplication::srsDbFilePath();
+  sqlite3      *myDatabase;
+  const char   *myTail;
+  sqlite3_stmt *myPreparedStatement;
+  int           myResult;
 
-  if ( theVectorLayer ) //append the source SRS. In future, all systems supported by proj4 should be appended
+  //check the db is available
+  myResult = sqlite3_open( myDatabaseFileName.toLocal8Bit().data(), &myDatabase );
+  if ( myResult )
   {
-    QString myDatabaseFileName = QgsApplication::srsDbFilePath();
-    sqlite3      *myDatabase;
-    const char   *myTail;
-    sqlite3_stmt *myPreparedStatement;
-    int           myResult;
-
-    //check the db is available
-    myResult = sqlite3_open( myDatabaseFileName.toLocal8Bit().data(), &myDatabase );
-    if ( myResult )
+    //if the database cannot be opened, add at least the epsg number of the source coordinate system
+    crsNumbers.push_back( theMapLayer->crs().authid() );
+    return crsNumbers;
+  };
+  QString mySql = "select upper(auth_name||':'||auth_id) from tbl_srs";
+  myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail );
+  if ( myResult == SQLITE_OK )
+  {
+    while ( sqlite3_step( myPreparedStatement ) == SQLITE_ROW )
     {
-      //if the database cannot be opened, add at least the epsg number of the source coordinate system
-      crsNumbers.push_back( theMapLayer->crs().authid() );
-      return crsNumbers;
-    };
-    QString mySql = "select upper(auth_name||':'||auth_id) from tbl_srs";
-    myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail );
-    if ( myResult == SQLITE_OK )
-    {
-      while ( sqlite3_step( myPreparedStatement ) == SQLITE_ROW )
-      {
-        crsNumbers.push_back( QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) ) );
-      }
+      crsNumbers.push_back( QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) ) );
     }
-    sqlite3_finalize( myPreparedStatement );
-    sqlite3_close( myDatabase );
   }
-  else //rasters cannot be reprojected. Use the epsg number of the layers native CRS
-  {
-    crsNumbers.push_back( theMapLayer->crs().authid() );
-  }
-  return crsNumbers;
+  sqlite3_finalize( myPreparedStatement );
+  sqlite3_close( myDatabase );
 }
 
 bool QgsConfigParser::exGeographicBoundingBox( const QDomElement& layerElement, QgsRectangle& rect ) const

Modified: trunk/qgis/src/mapserver/qgswmsserver.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgswmsserver.cpp	2011-04-16 11:44:42 UTC (rev 15723)
+++ trunk/qgis/src/mapserver/qgswmsserver.cpp	2011-04-16 12:18:32 UTC (rev 15724)
@@ -1179,11 +1179,6 @@
       theMapLayer = layerList.at( listIndex );
       if ( theMapLayer )
       {
-        if ( theMapLayer->type() == QgsMapLayer::RasterLayer )
-        {
-          //set the sourceSRS to the same as the destSRS
-          theMapLayer->setCrs( destCRS );
-        }
         layerKeys.push_front( theMapLayer->id() );
         QgsMapLayerRegistry::instance()->addMapLayer( theMapLayer, false );
       }



More information about the QGIS-commit mailing list