17 changes: 5 additions & 12 deletions src/core/composer/qgsatlascomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@ void QgsAtlasComposition::setCoverageLayer( QgsVectorLayer* layer )
{
mCoverageLayer = layer;

if ( mCoverageLayer != 0 )
{
// update the number of features
QgsVectorDataProvider* provider = mCoverageLayer->dataProvider();
QgsExpression::setSpecialColumn( "$numfeatures", QVariant(( int )provider->featureCount() ) );
}
// update the number of features
QgsExpression::setSpecialColumn( "$numfeatures", QVariant( (int)mFeatureIds.size() ) );
}

void QgsAtlasComposition::beginRender()
Expand Down Expand Up @@ -93,6 +89,7 @@ void QgsAtlasComposition::beginRender()
// We cannot use nextFeature() directly since the feature pointer is rewinded by the rendering process
// We thus store the feature ids for future extraction
QgsFeature feat;
mFeatureIds.clear();
while ( provider->nextFeature( feat ) )
{
mFeatureIds.push_back( feat.id() );
Expand All @@ -115,7 +112,7 @@ void QgsAtlasComposition::beginRender()

// special columns for expressions
QgsExpression::setSpecialColumn( "$numpages", QVariant( mComposition->numPages() ) );
QgsExpression::setSpecialColumn( "$numfeatures", QVariant(( int )provider->featureCount() ) );
QgsExpression::setSpecialColumn( "$numfeatures", QVariant(( int )mFeatureIds.size() ) );
}

void QgsAtlasComposition::endRender()
Expand Down Expand Up @@ -147,11 +144,7 @@ void QgsAtlasComposition::endRender()

size_t QgsAtlasComposition::numFeatures() const
{
if ( mCoverageLayer )
{
return mCoverageLayer->dataProvider()->featureCount();
}
return 0;
return mFeatureIds.size();
}

void QgsAtlasComposition::prepareForFeature( size_t featureI )
Expand Down
5 changes: 3 additions & 2 deletions src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ void QgsCoordinateReferenceSystem::validate()
mCustomSrsValidation( this );

if ( !mIsValidFlag )
// set the default
createFromOgcWmsCrs( GEO_EPSG_CRS_AUTHID );
{
*this = QgsCRSCache::instance()->crsByAuthId( GEO_EPSG_CRS_AUTHID );
}
}

bool QgsCoordinateReferenceSystem::createFromSrid( long id )
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgscoordinatetransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* *
***************************************************************************/
#include "qgscoordinatetransform.h"
#include "qgscrscache.h"
#include "qgsmessagelog.h"
#include "qgslogger.h"

Expand Down Expand Up @@ -148,9 +149,8 @@ void QgsCoordinateTransform::initialise()
if ( !mDestCRS.isValid() )
{
//No destination projection is set so we set the default output projection to
//be the same as input proj. This only happens on the first layer loaded
//whatever that may be...
mDestCRS.createFromOgcWmsCrs( mSourceCRS.authid() );
//be the same as input proj.
mDestCRS = QgsCRSCache::instance()->crsByAuthId( mSourceCRS.authid() );
}

// init the projections (destination and source)
Expand Down
60 changes: 41 additions & 19 deletions src/core/raster/qgspalettedrasterrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@

QgsPalettedRasterRenderer::QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber,
QColor* colorArray, int nColors ):
QgsRasterRenderer( input, "paletted" ), mBand( bandNumber ), mNColors( nColors )
{
mColors = new QRgb[nColors];
for ( int i = 0; i < nColors; ++i )
{
mColors[i] = colorArray[i].rgba();
}
delete[] colorArray;
}

QgsPalettedRasterRenderer::QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QRgb* colorArray, int nColors ):
QgsRasterRenderer( input, "paletted" ), mBand( bandNumber ), mColors( colorArray ), mNColors( nColors )
{
}
Expand All @@ -36,7 +47,7 @@ QgsPalettedRasterRenderer::~QgsPalettedRasterRenderer()

QgsRasterInterface * QgsPalettedRasterRenderer::clone() const
{
QgsPalettedRasterRenderer * renderer = new QgsPalettedRasterRenderer( 0, mBand, colors(), mNColors );
QgsPalettedRasterRenderer * renderer = new QgsPalettedRasterRenderer( 0, mBand, rgbArray(), mNColors );
renderer->setOpacity( mOpacity );
renderer->setAlphaBand( mAlphaBand );
renderer->setRasterTransparency( mRasterTransparency );
Expand All @@ -52,14 +63,14 @@ QgsRasterRenderer* QgsPalettedRasterRenderer::create( const QDomElement& elem, Q

int bandNumber = elem.attribute( "band", "-1" ).toInt();
int nColors = 0;
QColor* colors = 0;
QRgb* colors = 0;

QDomElement paletteElem = elem.firstChildElement( "colorPalette" );
if ( !paletteElem.isNull() )
{
QDomNodeList paletteEntries = paletteElem.elementsByTagName( "paletteEntry" );
nColors = paletteEntries.size();
colors = new QColor[ nColors ];
colors = new QRgb[ nColors ];

int value = 0;
QDomElement entryElem;
Expand All @@ -68,7 +79,7 @@ QgsRasterRenderer* QgsPalettedRasterRenderer::create( const QDomElement& elem, Q
entryElem = paletteEntries.at( i ).toElement();
value = entryElem.attribute( "value", "0" ).toInt();
QgsDebugMsg( entryElem.attribute( "color", "#000000" ) );
colors[value] = QColor( entryElem.attribute( "color", "#000000" ) );
colors[value] = QColor( entryElem.attribute( "color", "#000000" ) ).rgba();
}
}
QgsRasterRenderer* r = new QgsPalettedRasterRenderer( input, bandNumber, colors, nColors );
Expand All @@ -85,11 +96,25 @@ QColor* QgsPalettedRasterRenderer::colors() const
QColor* colorArray = new QColor[ mNColors ];
for ( int i = 0; i < mNColors; ++i )
{
colorArray[i] = mColors[i];
colorArray[i] = QColor( mColors[i] );
}
return colorArray;
}

QRgb* QgsPalettedRasterRenderer::rgbArray() const
{
if ( mNColors < 1 )
{
return 0;
}
QRgb* rgbValues = new QRgb[mNColors];
for ( int i = 0; i < mNColors; ++i )
{
rgbValues[i] = mColors[i];
}
return rgbValues;
}

QgsRasterBlock * QgsPalettedRasterRenderer::block( int bandNo, QgsRectangle const & extent, int width, int height )
{
QgsRasterBlock *outputBlock = new QgsRasterBlock();
Expand Down Expand Up @@ -146,7 +171,12 @@ QgsRasterBlock * QgsPalettedRasterRenderer::block( int bandNo, QgsRectangle con
return outputBlock;
}

for ( size_t i = 0; i < ( size_t )width*height; i++ )
//use direct data access instead of QgsRasterBlock::setValue
//because of performance
unsigned int* outputData = ( unsigned int* )( outputBlock->data() );

size_t rasterSize = ( size_t )width * height;
for ( size_t i = 0; i < rasterSize; ++i )
{
int val = ( int ) inputBlock->value( i );
if ( inputBlock->isNoDataValue( val ) )
Expand All @@ -156,14 +186,7 @@ QgsRasterBlock * QgsPalettedRasterRenderer::block( int bandNo, QgsRectangle con
}
if ( !hasTransparency )
{
if ( val < 0 || val > mNColors )
{
outputBlock->setColor( i, myDefaultColor );
}
else
{
outputBlock->setColor( i, mColors[ val ].rgba() );
}
outputData[i] = mColors[ val ];
}
else
{
Expand All @@ -176,9 +199,8 @@ QgsRasterBlock * QgsPalettedRasterRenderer::block( int bandNo, QgsRectangle con
{
currentOpacity *= alphaBlock->value( i ) / 255.0;
}
QColor& currentColor = mColors[val];

outputBlock->setColor( i, qRgba( currentOpacity * currentColor.red(), currentOpacity * currentColor.green(), currentOpacity * currentColor.blue(), currentOpacity * 255 ) );
QColor currentColor = QColor( mColors[val] );
outputData[i] = qRgba( currentOpacity * currentColor.red(), currentOpacity * currentColor.green(), currentOpacity * currentColor.blue(), currentOpacity * 255 );
}
}

Expand Down Expand Up @@ -207,7 +229,7 @@ void QgsPalettedRasterRenderer::writeXML( QDomDocument& doc, QDomElement& parent
{
QDomElement colorElem = doc.createElement( "paletteEntry" );
colorElem.setAttribute( "value", i );
colorElem.setAttribute( "color", mColors[i].name() );
colorElem.setAttribute( "color", QColor( mColors[i] ).name() );
colorPaletteElem.appendChild( colorElem );
}
rasterRendererElem.appendChild( colorPaletteElem );
Expand All @@ -219,7 +241,7 @@ void QgsPalettedRasterRenderer::legendSymbologyItems( QList< QPair< QString, QCo
{
for ( int i = 0; i < mNColors; ++i )
{
symbolItems.push_back( qMakePair( QString::number( i ), mColors[i] ) );
symbolItems.push_back( qMakePair( QString::number( i ), QColor( mColors[i] ) ) );
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/core/raster/qgspalettedrasterrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CORE_EXPORT QgsPalettedRasterRenderer: public QgsRasterRenderer
public:
/**Renderer owns color array*/
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QColor* colorArray, int nColors );
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QRgb* colorArray, int nColors );
~QgsPalettedRasterRenderer();
QgsRasterInterface * clone() const;
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input );
Expand All @@ -43,6 +44,8 @@ class CORE_EXPORT QgsPalettedRasterRenderer: public QgsRasterRenderer
int nColors() const { return mNColors; }
/**Returns copy of color array (caller takes ownership)*/
QColor* colors() const;
/**Returns copy of rgb array (caller takes ownership)*/
QRgb* rgbArray() const;

void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;

Expand All @@ -53,7 +56,7 @@ class CORE_EXPORT QgsPalettedRasterRenderer: public QgsRasterRenderer
private:
int mBand;
/**Color array*/
QColor* mColors;
QRgb* mColors;
/**Number of colors*/
int mNColors;
};
Expand Down
22 changes: 0 additions & 22 deletions src/core/raster/qgsrasterblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,28 +239,6 @@ bool QgsRasterBlock::isNoDataValue( double value, double noDataValue )
return false;
}

bool QgsRasterBlock::isNoDataValue( double value ) const
{
// More precise would be qIsNaN(value) && qIsNaN(noDataValue(bandNo)), but probably
// not important and slower
if ( qIsNaN( value ) ||
doubleNear( value, mNoDataValue ) )
{
return true;
}
return false;
}

double QgsRasterBlock::value( size_t index ) const
{
if ( index >= ( size_t )mWidth*mHeight )
{
QgsDebugMsg( QString( "Index %1 out of range (%2 x %3)" ).arg( index ).arg( mWidth ).arg( mHeight ) );
return mNoDataValue;
}
return readValue( mData, mDataType, index );
}

double QgsRasterBlock::value( int row, int column ) const
{
return value(( size_t )row*mWidth + column );
Expand Down
22 changes: 22 additions & 0 deletions src/core/raster/qgsrasterblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,28 @@ inline bool QgsRasterBlock::valueInRange( double value, const QList<QgsRasterBlo
return false;
}

inline double QgsRasterBlock::value( size_t index ) const
{
/*if ( index >= ( size_t )mWidth*mHeight )
{
QgsDebugMsg( QString( "Index %1 out of range (%2 x %3)" ).arg( index ).arg( mWidth ).arg( mHeight ) );
return mNoDataValue;
}*/
return readValue( mData, mDataType, index );
}

inline bool QgsRasterBlock::isNoDataValue( double value ) const
{
// More precise would be qIsNaN(value) && qIsNaN(noDataValue(bandNo)), but probably
// not important and slower
if ( qIsNaN( value ) ||
doubleNear( value, mNoDataValue ) )
{
return true;
}
return false;
}

#endif


2 changes: 2 additions & 0 deletions src/mapserver/qgis_map_serv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ map service syntax for SOAP/HTTP POST
#include "qgswfsserver.h"
#include "qgsmaprenderer.h"
#include "qgsmapserviceexception.h"
#include "qgspallabeling.h"
#include "qgsprojectparser.h"
#include "qgssldparser.h"
#include <QDomDocument>
Expand Down Expand Up @@ -198,6 +199,7 @@ int main( int argc, char * argv[] )

//creating QgsMapRenderer is expensive (access to srs.db), so we do it here before the fcgi loop
QgsMapRenderer* theMapRenderer = new QgsMapRenderer();
theMapRenderer->setLabelingEngine( new QgsPalLabeling() );

while ( fcgi_accept() >= 0 )
{
Expand Down
2 changes: 0 additions & 2 deletions src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "qgsmaplayerregistry.h"
#include "qgsmaprenderer.h"
#include "qgsmaptopixel.h"
#include "qgspallabeling.h"
#include "qgsproject.h"
#include "qgsrasterlayer.h"
#include "qgsscalecalculator.h"
Expand Down Expand Up @@ -941,7 +940,6 @@ QImage* QgsWMSServer::initializeRendering( QStringList& layersList, QStringList&
delete theImage;
return 0;
}
mMapRenderer->setLabelingEngine( new QgsPalLabeling() );

//find out the current scale denominater and set it to the SLD parser
QgsScaleCalculator scaleCalc(( theImage->logicalDpiX() + theImage->logicalDpiY() ) / 2 , mMapRenderer->destinationCrs().mapUnits() );
Expand Down
14 changes: 14 additions & 0 deletions src/plugins/grass/qtermwidget/ColorTables.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/***************************************************************************
ColorTables.h
---------------------
begin : April 2009
copyright : (C) 2009 by Paolo Cavallini
email : cavallini at faunalia dot it
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _COLOR_TABLE_H
#define _COLOR_TABLE_H

Expand Down
14 changes: 14 additions & 0 deletions src/plugins/grass/qtermwidget/DefaultTranslatorText.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
/***************************************************************************
DefaultTranslatorText.h
---------------------
begin : April 2009
copyright : (C) 2009 by Paolo Cavallini
email : cavallini at faunalia dot it
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"keyboard \"Fallback Key Translator\"\n"
"key Tab : \"\\t\" \0"
14 changes: 14 additions & 0 deletions src/plugins/grass/qtermwidget/ExtendedDefaultTranslator.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/***************************************************************************
ExtendedDefaultTranslator.h
---------------------
begin : April 2009
copyright : (C) 2009 by Paolo Cavallini
email : cavallini at faunalia dot it
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"keyboard \"Default (XFree 4)\""
"key Escape : \"\\E\""
"key Tab -Shift : \"\\t\"\n"
Expand Down
1 change: 1 addition & 0 deletions src/plugins/grass/qtermwidget/konsole_wcwidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* <http://www.UNIX-systems.org/online.html>
*
* Markus Kuhn -- 2001-01-12 -- public domain
* this file is in the public domain
*/

#include "konsole_wcwidth.h"
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/grass/qtermwidget/konsole_wcwidth.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/* Adaptions for KDE by Waldo Bastian <bastian@kde.org> */
/*
Rewritten for QT4 by e_k <e_k at users.sourceforge.net>
* This file is in the public domain
*/


Expand Down
36 changes: 22 additions & 14 deletions src/providers/gdal/qgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,17 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,

int dataSize = dataTypeSize( theBandNo );

// fill with null values
QByteArray ba = QgsRasterBlock::valueBytes( dataType( theBandNo ), noDataValue( theBandNo ) );
char *nodata = ba.data();
char *block = ( char * ) theBlock;
for ( int i = 0; i < thePixelWidth * thePixelHeight; i++ )
if ( !mExtent.contains( theExtent ) )
{
memcpy( block, nodata, dataSize );
block += dataSize;
// fill with null values
QByteArray ba = QgsRasterBlock::valueBytes( dataType( theBandNo ), noDataValue( theBandNo ) );
char *nodata = ba.data();
char *block = ( char * ) theBlock;
for ( int i = 0; i < thePixelWidth * thePixelHeight; i++ )
{
memcpy( block, nodata, dataSize );
block += dataSize;
}
}

QgsRectangle myRasterExtent = theExtent.intersect( &mExtent );
Expand Down Expand Up @@ -561,23 +564,28 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
double tmpXRes = srcWidth * srcXRes / tmpWidth;
double tmpYRes = srcHeight * srcYRes / tmpHeight; // negative

double y = myRasterExtent.yMaximum() - 0.5 * yRes;
for ( int row = 0; row < height; row++ )
{
double y = myRasterExtent.yMaximum() - ( row + 0.5 ) * yRes;
int tmpRow = static_cast<int>( floor( -1. * ( tmpYMax - y ) / tmpYRes ) );

char *srcRowBlock = tmpBlock + dataSize * tmpRow * tmpWidth;
char *dstRowBlock = ( char * )theBlock + dataSize * ( top + row ) * thePixelWidth;
for ( int col = 0; col < width; col++ )

double x = myRasterExtent.xMinimum() + 0.5 * xRes; // cell center
char* dst = dstRowBlock + dataSize * left;
char* src = 0;
int tmpCol = 0;
for ( int col = 0; col < width; ++col )
{
// cell center
double x = myRasterExtent.xMinimum() + ( col + 0.5 ) * xRes;
// floor() is quite slow! Use just cast to int.
int tmpCol = static_cast<int>(( x - tmpXMin ) / tmpXRes ) ;
char *src = srcRowBlock + dataSize * tmpCol;
char *dst = dstRowBlock + dataSize * ( left + col );
tmpCol = static_cast<int>(( x - tmpXMin ) / tmpXRes ) ;
src = srcRowBlock + dataSize * tmpCol;
memcpy( dst, src, dataSize );
dst += dataSize;
x += xRes;
}
y -= yRes;
}

QgsFree( tmpBlock );
Expand Down
116 changes: 72 additions & 44 deletions src/providers/grass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,17 @@ ENDIF (APPLE)
# Create list of functions to be mapped
SET ( FUNCTIONS
"G_add_color_rule"
"G_add_c_raster_color_rule"
"G_add_d_raster_color_rule"
"G_add_f_raster_color_rule"
"G_add_raster_color_rule"
"G_adjust_Cell_head"
"G_align_window"
"G_allocate_cell_buf"
"G_allocate_c_raster_buf"
"G_allocate_d_raster_buf"
"G_allocate_f_raster_buf"
"G_allocate_null_buf"
"G_allocate_raster_buf"
"G__calloc"
"G_col_to_easting"
Expand All @@ -71,17 +79,17 @@ SET ( FUNCTIONS
"G_define_standard_option"
"G_free"
"G_free_raster_cats"
"G__getenv"
"G_get_fp_range_min_max"
"G_get_range_min_max"
"G_get_window"
"G_get_set_window"
"G__init_null_patterns"
"G_gettext"
"G_get_window"
"G_incr_void_ptr"
"G_init_colors"
"G_init_fp_range"
"G_init_raster_cats"
"G__init_null_patterns"
"G_init_range"
"G_init_raster_cats"
"G_is_c_null_value"
"G_is_d_null_value"
"G_is_f_null_value"
Expand All @@ -93,19 +101,20 @@ SET ( FUNCTIONS
"G_quant_free"
"G_quant_get_limits"
"G_quant_init"
"G__realloc"
"G_raster_size"
"G__realloc"
"G_row_to_northing"
"G_set_c_null_value"
"G_set_d_null_value"
"G_set_f_null_value"
"G_set_d_raster_cat"
"G_setenv"
"G_set_f_null_value"
"G_set_gisrc_mode"
"G_set_null_value"
"G_set_raster_cat"
"G_set_raster_cats_title"
"G_set_raster_value_d"
"G_set_window"
"G_setenv"
"G_strip"
"G_suppress_masking"
"G_trim_decimal"
Expand All @@ -116,60 +125,79 @@ SET ( FUNCTIONS
"G_zero"
)

# If a function, say G_1 called in true GRASS gis lib (loaded by QLibrary)
# calls another function G_2 which does not have to be reimplemented in gis fake lib:
# - on Linux: G_2 is resolved in original GRASS true gis lib and it is not necessary
# to add it to functions mapped in fake lib
# - on Windows: it seems that dynamic linker is searching for G_2 in the first loaded
# module of the same name, i.e. in our fake library, not in the original
# true GRASS gis lib, so we have to add all functions called in true lib
# also to mapped functions in fake lib

IF(MSVC)
SET ( FUNCTIONS
${FUNCTIONS}
"G__getenv"
)
ENDIF(MSVC)

# List of functions which are implemented in qgsgrassgislib.cpp and
# thus we only need prototype
SET ( FUNCTION_PROTOTYPES
"G__gisinit"
"G_parser"
"G_set_error_routine"
"G_warning"
"G_fatal_error"
"G_done_msg"
"*G_find_cell2"
"*G_find_cell"
"G_open_cell_old"
"G_asprintf"
"G_begin_distance_calculations"
"G_check_input_output_name"
"G_close_cell"
"G_open_raster_new"
"G_open_cell_new"
"G_raster_map_is_fp"
"G_read_fp_range"
"G_read_range"
"G_command_history"
"G_database_units_to_meters_factor"
"G_debug"
"G_message"
"G_verbose_message"
"G_set_quant_rules"
"G_get_raster_row"
"G_get_raster_row_nomask"
"G_distance"
"G_done_msg"
"G_fatal_error"
"G_find_cell"
"G_find_cell2"
"G_get_cellhd"
"G_get_c_raster_row"
"G_get_c_raster_row_nomask"
"G_get_f_raster_row"
"G_get_f_raster_row_nomask"
"G_get_d_raster_row"
"G_get_d_raster_row_nomask"
"G_get_f_raster_row"
"G_get_f_raster_row_nomask"
"G_get_map_row"
"G_get_map_row_nomask"
"G_put_raster_row"
"G_check_input_output_name"
"G_get_cellhd"
"G_database_units_to_meters_factor"
"G_begin_distance_calculations"
"G_distance"
"G_get_raster_map_type"
"G_get_raster_row"
"G_get_raster_row_nomask"
"G__gisinit"
"G_legal_filename"
"G_tempfile"
"G_mapset"
"G_location"
"G_write_colors"
"G_make_aspect_fp_colors"
"G_mapset"
"G_maskfd"
"G_message"
"G_open_cell_new"
"G_open_cell_old"
"G_open_raster_new"
"G_parser"
"G_put_raster_row"
"G_quantize_fp_map_range"
"G_raster_map_is_fp"
"G_read_colors"
"G_read_fp_range"
"G_read_history"
"G_read_range"
"G_read_raster_cats"
"G_write_raster_cats"
"G_set_cats_title"
"G_set_error_routine"
"G_set_quant_rules"
"G_short_history"
"G_tempfile"
"G_vasprintf"
"G_verbose_message"
"G_warning"
"G_write_colors"
"G_write_history"
"G_maskfd"
"G_command_history"
"G_set_cats_title"
"G_read_history"
"G_read_colors"
"G_make_aspect_fp_colors"
"G_write_raster_cats"
)

SET ( FUNCTIONS_ALL
Expand Down
24 changes: 21 additions & 3 deletions src/providers/grass/qgsgrassgislib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <stdarg.h>
#include <QtGlobal>

// If qgsgrassgislibfunctions.h is included on Linux, symbols defined here
// cannot be found (undefined symbol error) even if they are present in
// the library (in code section) - why?
// If qgsgrassgislibfunctions.h is included on Linux, symbols defined here
// cannot be found (undefined symbol error) even if they are present in
// the library (in code section) - why?
#ifdef Q_OS_WIN
#include "qgsgrassgislibfunctions.h"
#endif
Expand Down Expand Up @@ -975,6 +975,24 @@ RASTER_MAP_TYPE QgsGrassGisLib::grassRasterType( QgsRasterBlock::DataType qgisTy
}
}

typedef int G_vasprintf_type( char **, const char *, va_list );
int G_vasprintf( char **out, const char *fmt, va_list ap )
{
G_vasprintf_type* fn = ( G_vasprintf_type* ) cast_to_fptr( QgsGrassGisLib::instance()->resolve( "G_vasprintf_type" ) );
return fn( out, fmt, ap );
}

typedef int G_asprintf_type( char **, const char *, ... );
int G_asprintf( char **out, const char *fmt, ... )
{
G_asprintf_type* fn = ( G_asprintf_type* ) cast_to_fptr( QgsGrassGisLib::instance()->resolve( "G_asprintf_type" ) );
va_list ap;
va_start( ap, fmt );
int ret = fn( out, fmt, ap );
va_end( ap );
return ret;
}

char GRASS_LIB_EXPORT *G_tempfile( void )
{
QTemporaryFile file( "qgis-grass-temp.XXXXXX" );
Expand Down
5 changes: 5 additions & 0 deletions tests/qt_modeltest/dynamictreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
**
** This file is part of the test suite of the Qt Toolkit.
**
** This file is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
Expand Down
5 changes: 5 additions & 0 deletions tests/qt_modeltest/dynamictreemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
**
** This file is part of the test suite of the Qt Toolkit.
**
** This file is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
Expand Down
5 changes: 5 additions & 0 deletions tests/qt_modeltest/modeltest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
**
** This file is part of the test suite of the Qt Toolkit.
**
** This file is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
Expand Down
5 changes: 5 additions & 0 deletions tests/qt_modeltest/modeltest.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
**
** This file is part of the test suite of the Qt Toolkit.
**
** This file is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
Expand Down
5 changes: 5 additions & 0 deletions tests/qt_modeltest/tst_modeltest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
**
** This file is part of the test suite of the Qt Toolkit.
**
** This file is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
Expand Down