Skip to content
Permalink
Browse files

fix build error and a few warnings

  • Loading branch information
jef-n committed Aug 28, 2012
1 parent a28c965 commit f006b234e7ef76f0b924efbeda1f467167e8f1de
@@ -152,9 +152,9 @@ class QgsVectorLayer : QgsMapLayer
/** Get the label object associated with this layer */
QgsLabel *label();

const QgsLabel *label() const;
// const QgsLabel *label() const;

QgsAttributeAction *actions();
QgsAttributeAction *actions();

/** The number of features that are selected in this layer */
int selectedFeatureCount();
@@ -380,8 +380,8 @@ class QgsVectorLayer : QgsMapLayer
* @param splitLine line that splits the layer features
* @param topologicalEditing true if topological editing is enabled
* @return
* 0 in case of success,
* 4 if there is a selection but no feature split
* 0 in case of success,
* 4 if there is a selection but no feature split
*/
int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );

@@ -419,7 +419,7 @@ class QgsVectorLayer : QgsMapLayer
void enableLabels( bool on );

/** Label is on */
bool hasLabelsEnabled( void ) const;
bool hasLabelsEnabled() const;

/** Returns true if the provider is in editing mode */
virtual bool isEditable() const;
@@ -492,7 +492,7 @@ class QgsVectorLayer : QgsMapLayer
@note added in version 1.2 */
bool changeGeometry( qint64 fid, QgsGeometry* geom );

/** changed an attribute value (but does not commit it */
/** changed an attribute value (but does not commit it) */
bool changeAttributeValue( qint64 fid, int field, QVariant value, bool emitSignal = true );

/** add an attribute field (but does not commit it)
@@ -556,19 +556,16 @@ class QgsVectorLayer : QgsMapLayer
/** set string representing 'true' for a checkbox (added in 1.4) */
void setCheckedState( int idx, QString checked, QString notChecked );

/** return string representing 'true' for a checkbox (added in 1.4) */
/** return string representing 'true' for a checkbox (added in 1.4)
* @note not available in python bindings
* FIXME: need SIP binding for QPair<QString, QString>
*/
// QPair<QString, QString> checkedState( int idx );

/** get edit form
@note added in 1.4
*/
/** get edit form (added in 1.4) */
QString editForm();

/** set edit form
@note added in 1.4
*/
/** set edit form (added in 1.4) */
void setEditForm( QString ui );

/** get annotation form (added in 1.5)*/
@@ -667,7 +664,7 @@ class QgsVectorLayer : QgsMapLayer
@param index column index for attribute
@param uniqueValues out: result list
@param limit maximum number of values to return (-1 if unlimited)
@note this method was added in version 1.7*/
@note this method was added in version 1.7 */
void uniqueValues( int index, QList<QVariant> &uniqueValues /Out/, int limit = -1 );

/**Returns minimum value for an attribute column or invalid variant in case of error
@@ -434,8 +434,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
* @param splitLine line that splits the layer features
* @param topologicalEditing true if topological editing is enabled
* @return
* 0 in case of success,
* 4 if there is a selection but no feature split
* 0 in case of success,
* 4 if there is a selection but no feature split
*/
int splitFeatures( const QList<QgsPoint>& splitLine, bool topologicalEditing = false );

@@ -473,7 +473,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
void enableLabels( bool on );

/** Label is on */
bool hasLabelsEnabled( void ) const;
bool hasLabelsEnabled() const;

/** Returns true if the provider is in editing mode */
virtual bool isEditable() const;
@@ -717,7 +717,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
@param index column index for attribute
@param uniqueValues out: result list
@param limit maximum number of values to return (-1 if unlimited)
@note this method was added in version 1.7*/
@note this method was added in version 1.7 */
void uniqueValues( int index, QList<QVariant> &uniqueValues, int limit = -1 );

/**Returns minimum value for an attribute column or invalid variant in case of error
@@ -172,89 +172,88 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs
}
#if 0
else if ( )
{
// TODO: see if nuller has user defined aditional values, in that case use one as no data value

}
#endif
else
{
// Verify if we realy need no data value, i.e.
QgsRectangle srcExtent = outputExtent;
QgsRasterProjector *projector = pipe->projector();
if ( projector && projector->destCrs() != projector->srcCrs() )
{
QgsCoordinateTransform ct( projector->destCrs(), projector->srcCrs() );
srcExtent = ct.transformBoundingBox( outputExtent );
}
if ( !srcProvider->extent().contains( srcExtent ) )
else
{
// Destination extent is larger than source extent, we need destination no data values
// Get src sample statistics (estimation from sample)
QgsRasterBandStats stats = srcProvider->bandStatistics( bandNo, QgsRasterBandStats::Min | QgsRasterBandStats::Max, srcExtent, 250000 );

// Test if we have free (not used) values
double typeMinValue = QgsContrastEnhancement::maximumValuePossible(( QgsContrastEnhancement::QgsRasterDataType )srcProvider->srcDataType( bandNo ) );
double typeMaxValue = QgsContrastEnhancement::maximumValuePossible(( QgsContrastEnhancement::QgsRasterDataType )srcProvider->srcDataType( bandNo ) );
if ( stats.minimumValue > typeMinValue )
{
destNoDataValue = typeMinValue;
}
else if ( stats.maximumValue < typeMaxValue )
// Verify if we realy need no data value, i.e.
QgsRectangle srcExtent = outputExtent;
QgsRasterProjector *projector = pipe->projector();
if ( projector && projector->destCrs() != projector->srcCrs() )
{
destNoDataValue = typeMaxValue;
QgsCoordinateTransform ct( projector->destCrs(), projector->srcCrs() );
srcExtent = ct.transformBoundingBox( outputExtent );
}
else
if ( !srcProvider->extent().contains( srcExtent ) )
{
// We have to use wider type
destDataType = QgsRasterInterface::typeWithNoDataValue( destDataType, &destNoDataValue );
// Destination extent is larger than source extent, we need destination no data values
// Get src sample statistics (estimation from sample)
QgsRasterBandStats stats = srcProvider->bandStatistics( bandNo, QgsRasterBandStats::Min | QgsRasterBandStats::Max, srcExtent, 250000 );

// Test if we have free (not used) values
double typeMinValue = QgsContrastEnhancement::maximumValuePossible(( QgsContrastEnhancement::QgsRasterDataType )srcProvider->srcDataType( bandNo ) );
double typeMaxValue = QgsContrastEnhancement::maximumValuePossible(( QgsContrastEnhancement::QgsRasterDataType )srcProvider->srcDataType( bandNo ) );
if ( stats.minimumValue > typeMinValue )
{
destNoDataValue = typeMinValue;
}
else if ( stats.maximumValue < typeMaxValue )
{
destNoDataValue = typeMaxValue;
}
else
{
// We have to use wider type
destDataType = QgsRasterInterface::typeWithNoDataValue( destDataType, &destNoDataValue );
}
destHasNoDataValue = true;
}
destHasNoDataValue = true;
}
QgsDebugMsg( QString( "bandNo = %1 destDataType = %2 destHasNoDataValue = %3 destNoDataValue = %4" ).arg( bandNo ).arg( destDataType ).arg( destHasNoDataValue ).arg( destNoDataValue ) );
destDataTypeList.append( destDataType );
destHasNoDataValueList.append( destHasNoDataValue );
destNoDataValueList.append( destNoDataValue );
}
QgsDebugMsg( QString( "bandNo = %1 destDataType = %2 destHasNoDataValue = %3 destNoDataValue = %4" ).arg( bandNo ).arg( destDataType ).arg( destHasNoDataValue ).arg( destNoDataValue ) );
destDataTypeList.append( destDataType );
destHasNoDataValueList.append( destHasNoDataValue );
destNoDataValueList.append( destNoDataValue );
}

// TODO - what is this code doing here in the middle of the file, outside of a function???

QgsRasterInterface::DataType destDataType = destDataTypeList.value( 0 );
// Currently write API supports one output type for dataset only -> find the widest
for ( int i = 1; i < nBands; i++ )
{
if ( destDataTypeList.value( i ) > destDataType )
QgsRasterInterface::DataType destDataType = destDataTypeList.value( 0 );
// Currently write API supports one output type for dataset only -> find the widest
for ( int i = 1; i < nBands; i++ )
{
destDataType = destDataTypeList.value( i );
// no data value may be left per band (for future)
if ( destDataTypeList.value( i ) > destDataType )
{
destDataType = destDataTypeList.value( i );
// no data value may be left per band (for future)
}
}
}

destProvider = initOutput( nCols, nRows, crs, geoTransform, nBands, destDataType );

WriterError error = writeDataRaster( pipe, iter, nCols, nRows, outputExtent, crs, destDataType, destHasNoDataValueList, destNoDataValueList, destProvider, progressDialog );
destProvider = initOutput( nCols, nRows, crs, geoTransform, nBands, destDataType );

if ( error == NoDataConflict )
{
// The value used for no data was found in source data, we must use wider data type
destProvider->remove();
delete destProvider;
WriterError error = writeDataRaster( pipe, iter, nCols, nRows, outputExtent, crs, destDataType, destHasNoDataValueList, destNoDataValueList, destProvider, progressDialog );

// But we don't know which band -> wider all
for ( int i = 0; i < nBands; i++ )
if ( error == NoDataConflict )
{
double destNoDataValue;
QgsRasterInterface::DataType destDataType = QgsRasterInterface::typeWithNoDataValue( destDataTypeList.value( i ), &destNoDataValue );
destDataTypeList.replace( i, destDataType );
destNoDataValueList.replace( i, destNoDataValue );
}
// The value used for no data was found in source data, we must use wider data type
destProvider->remove();
delete destProvider;

// Try again
destProvider = initOutput( nCols, nRows, crs, geoTransform, nBands, destDataType );
error = writeDataRaster( pipe, iter, nCols, nRows, outputExtent, crs, destDataType, destHasNoDataValueList, destNoDataValueList, destProvider, progressDialog );
}
// But we don't know which band -> wider all
for ( int i = 0; i < nBands; i++ )
{
double destNoDataValue;
QgsRasterInterface::DataType destDataType = QgsRasterInterface::typeWithNoDataValue( destDataTypeList.value( i ), &destNoDataValue );
destDataTypeList.replace( i, destDataType );
destNoDataValueList.replace( i, destNoDataValue );
}

// Try again
destProvider = initOutput( nCols, nRows, crs, geoTransform, nBands, destDataType );
error = writeDataRaster( pipe, iter, nCols, nRows, outputExtent, crs, destDataType, destHasNoDataValueList, destNoDataValueList, destProvider, progressDialog );
}

return error;
return error;
}

QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster(
@@ -596,7 +596,7 @@
<attribute name="title">
<string>Display</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_19">
<item row="0" column="0">
<widget class="QLabel" name="textLabel3">
<property name="text">
@@ -61,7 +61,7 @@ void TestQgsComposerHtml::table()
{
QgsComposerHtml* htmlItem = new QgsComposerHtml( mComposition, false );
QgsComposerFrame* htmlFrame = new QgsComposerFrame( mComposition, htmlItem, 0, 0, 100, 200 );
htmlFrame->setFrame( true );
htmlFrame->setFrameEnabled( true );
htmlItem->addFrame( htmlFrame );
htmlItem->setUrl( QUrl( QString( "file:///%1" ).arg( QString( TEST_DATA_DIR ) + QDir::separator() + "html_table.html" ) ) );
QgsCompositionChecker checker( "Composer html table", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
@@ -81,7 +81,7 @@ void TestQgsComposerHtml::tableMultiFrame()
int nFrames = htmlItem->nFrames();
for ( int i = 0; i < nFrames; ++i )
{
htmlItem->frame( i )->setFrame( true );
htmlItem->frame( i )->setFrameEnabled( true );
}

bool result = true;
@@ -67,7 +67,7 @@ void TestQgsComposerMap::initTestCase()
mComposition = new QgsComposition( mMapRenderer );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 );
mComposerMap->setFrame( true );
mComposerMap->setFrameEnabled( true );
mComposition->addComposerMap( mComposerMap );
}

@@ -122,7 +122,7 @@ void TestQgsComposerMap::grid()
void TestQgsComposerMap::overviewMap()
{
QgsComposerMap* overviewMap = new QgsComposerMap( mComposition, 20, 130, 70, 70 );
overviewMap->setFrame( true );
overviewMap->setFrameEnabled( true );
mComposition->addComposerMap( overviewMap );
mComposerMap->setNewExtent( QgsRectangle( 785462.375, 3341423.125, 789262.375, 3343323.125 ) ); //zoom in
overviewMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3350923.125 ) );

0 comments on commit f006b23

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