[QGIS Commit] r12879 - in trunk/qgis/src/core: . raster
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Feb 4 16:23:13 EST 2010
Author: rblazek
Date: 2010-02-04 16:23:12 -0500 (Thu, 04 Feb 2010)
New Revision: 12879
Modified:
trunk/qgis/src/core/qgsrasterdataprovider.cpp
trunk/qgis/src/core/qgsrasterdataprovider.h
trunk/qgis/src/core/raster/qgsrasterlayer.cpp
Log:
prepare for GRASS raster provider
Modified: trunk/qgis/src/core/qgsrasterdataprovider.cpp
===================================================================
--- trunk/qgis/src/core/qgsrasterdataprovider.cpp 2010-02-04 21:08:33 UTC (rev 12878)
+++ trunk/qgis/src/core/qgsrasterdataprovider.cpp 2010-02-04 21:23:12 UTC (rev 12879)
@@ -19,6 +19,8 @@
#include "qgsrasterdataprovider.h"
#include "qgslogger.h"
+#include <QMap>
+
QgsRasterDataProvider::QgsRasterDataProvider(): mDpi( -1 )
{
}
@@ -45,5 +47,10 @@
return abilitiesList.join( ", " );
}
+bool QgsRasterDataProvider::identify( const QgsPoint& thePoint, QMap<QString, QString>& theResults )
+{
+ theResults.clear();
+ return false;
+}
// ENDS
Modified: trunk/qgis/src/core/qgsrasterdataprovider.h
===================================================================
--- trunk/qgis/src/core/qgsrasterdataprovider.h 2010-02-04 21:08:33 UTC (rev 12878)
+++ trunk/qgis/src/core/qgsrasterdataprovider.h 2010-02-04 21:23:12 UTC (rev 12879)
@@ -115,6 +115,9 @@
*/
virtual QString metadata() = 0;
+ /** \brief Identify raster value(s) found on the point position */
+ virtual bool identify( const QgsPoint & point, QMap<QString, QString>& results );
+
/**
* \brief Identify details from a server (e.g. WMS) from the last screen update
*
Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp 2010-02-04 21:08:33 UTC (rev 12878)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp 2010-02-04 21:23:12 UTC (rev 12879)
@@ -490,58 +490,6 @@
t = fi.lastModified();
- // Check also color table for GRASS
- if ( name.contains( "cellhd" ) > 0 )
- { // most probably GRASS
- QString dir = fi.path();
- QString map = fi.fileName();
- fi.setFile( dir + "/../colr/" + map );
-
- if ( fi.exists() )
- {
- if ( fi.lastModified() > t ) t = fi.lastModified();
- }
- }
-
- // Check GRASS group members (bands)
- if ( name.contains( "group" ) > 0 )
- { // probably GRASS group
- fi.setFile( name + "/REF" );
-
- if ( fi.exists() )
- { // most probably GRASS group
- QFile f( name + "/REF" );
- if ( f.open( QIODevice::ReadOnly ) )
- {
- QString dir = fi.path() + "/../../../";
-
- char buf[101];
- while ( f.readLine( buf, 100 ) != -1 )
- {
- QString ln = QString( buf );
- QStringList sl = ln.trimmed().split( ' ', QString::SkipEmptyParts );
- QString map = sl.first();
- sl.pop_front();
- QString mapset = sl.first();
-
- // header
- fi.setFile( dir + mapset + "/cellhd/" + map );
- if ( fi.exists() )
- {
- if ( fi.lastModified() > t ) t = fi.lastModified();
- }
-
- // color
- fi.setFile( dir + mapset + "/colr/" + map );
- if ( fi.exists() )
- {
- if ( fi.lastModified() > t ) t = fi.lastModified();
- }
- }
- }
- }
- }
-
QgsDebugMsg( "last modified = " + t.toString() );
return t;
@@ -1170,6 +1118,9 @@
int myWidth = mWidth;
int myHeight = mHeight;
int myDivisor = 2;
+
+ if ( mDataProvider ) return mPyramidList;
+
GDALRasterBandH myGDALBand = GDALGetRasterBand( mGdalDataset, 1 ); //just use the first band
mPyramidList.clear();
@@ -1928,6 +1879,12 @@
QgsDebugMsg( thePoint.toString() );
+ if ( !mProviderKey.isEmpty() )
+ {
+ QgsDebugMsg( "identify provider : " + mProviderKey ) ;
+ return ( mDataProvider->identify( thePoint, theResults ) );
+ }
+
if ( !mLayerExtent.contains( thePoint ) )
{
// Outside the raster
@@ -3270,8 +3227,15 @@
mDrawingStyle = MultiBandColor; //sensible default
// Setup source CRS
- *mCRS = QgsCoordinateReferenceSystem();
- mCRS->createFromOgcWmsCrs( crs );
+ if ( mProviderKey == "wms" )
+ {
+ *mCRS = QgsCoordinateReferenceSystem();
+ mCRS->createFromOgcWmsCrs( crs );
+ }
+ else
+ {
+ *mCRS = QgsCoordinateReferenceSystem( mDataProvider->crs() );
+ }
}
}
else
@@ -5453,9 +5417,11 @@
if ( mLastModified < QgsRasterLayer::lastModified( source() ) )
{
- QgsDebugMsg( "Outdated -> reload" );
- closeDataset();
- return readFile( source() );
+ if ( !usesProvider() ) {
+ QgsDebugMsg( "Outdated -> reload" );
+ closeDataset();
+ return readFile( source() );
+ }
}
return true;
}
More information about the QGIS-commit
mailing list