Skip to content

Commit eabd5c3

Browse files
committed
Remove a bunch of disabled code
1 parent ac17d30 commit eabd5c3

File tree

3 files changed

+1
-254
lines changed

3 files changed

+1
-254
lines changed

src/app/qgsdiagramproperties.cpp

-49
Original file line numberDiff line numberDiff line change
@@ -723,55 +723,6 @@ void QgsDiagramProperties::apply()
723723
Qgis::Warning );
724724
}
725725

726-
#if 0
727-
bool scaleAttributeValueOk = false;
728-
// Check if a (usable) scale attribute value is inserted
729-
mValueLineEdit->text().toDouble( &scaleAttributeValueOk );
730-
731-
if ( !mFixedSizeRadio->isChecked() && !scaleAttributeValueOk )
732-
{
733-
double maxVal = DBL_MIN;
734-
QgsVectorDataProvider *provider = mLayer->dataProvider();
735-
736-
if ( provider )
737-
{
738-
if ( diagramType == DIAGRAM_NAME_HISTOGRAM )
739-
{
740-
// Find maximum value
741-
for ( int i = 0; i < mDiagramAttributesTreeWidget->topLevelItemCount(); ++i )
742-
{
743-
QString fldName = mDiagramAttributesTreeWidget->topLevelItem( i )->data( 0, Qt::UserRole ).toString();
744-
if ( fldName.count() >= 2 && fldName.at( 0 ) == '"' && fldName.at( fldName.count() - 1 ) == '"' )
745-
fldName = fldName.mid( 1, fldName.count() - 2 ); // remove enclosing double quotes
746-
int fld = provider->fieldNameIndex( fldName );
747-
if ( fld != -1 )
748-
{
749-
bool ok = false;
750-
double val = provider->maximumValue( fld ).toDouble( &ok );
751-
if ( ok )
752-
maxVal = std::max( maxVal, val );
753-
}
754-
}
755-
}
756-
else
757-
{
758-
maxVal = provider->maximumValue( mSizeAttributeComboBox->currentData().toInt() ).toDouble();
759-
}
760-
}
761-
762-
if ( diagramsEnabled && maxVal != DBL_MIN )
763-
{
764-
QgisApp::instance()->messageBar()->pushMessage(
765-
tr( "Interpolation value" ),
766-
tr( "You did not specify an interpolation value. A default value of %1 has been set." ).arg( QString::number( maxVal ) ),
767-
Qgis::Info,
768-
5 );
769-
770-
mMaxValueSpinBox->setValue( maxVal );
771-
}
772-
}
773-
#endif
774-
775726
if ( mDiagramType == DIAGRAM_NAME_TEXT )
776727
{
777728
diagram = new QgsTextDiagram();

src/core/symbology/qgsgraduatedsymbolrenderer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ double QgsGraduatedSymbolRenderer::minSymbolSize() const
12451245

12461246
double QgsGraduatedSymbolRenderer::maxSymbolSize() const
12471247
{
1248-
double max = DBL_MIN;
1248+
double max = std::numeric_limits<double>::min();
12491249
for ( int i = 0; i < mRanges.count(); i++ )
12501250
{
12511251
double sz = 0;

src/providers/gdal/qgsgdalprovider.cpp

-204
Original file line numberDiff line numberDiff line change
@@ -885,210 +885,6 @@ void QgsGdalProvider::readBlock( int bandNo, QgsRectangle const &extent, int pi
885885
qgsFree( tmpBlock );
886886
}
887887

888-
//void * QgsGdalProvider::readBlock( int bandNo, QgsRectangle const & extent, int width, int height )
889-
//{
890-
// return 0;
891-
//}
892-
893-
// this is old version which was using GDALWarpOperation, unfortunately
894-
// it may be very slow on large datasets
895-
#if 0
896-
void QgsGdalProvider::readBlock( int bandNo, QgsRectangle const &extent, int pixelWidth, int pixelHeight, void *block )
897-
{
898-
QgsDebugMsg( "thePixelWidth = " + QString::number( pixelWidth ) );
899-
QgsDebugMsg( "thePixelHeight = " + QString::number( pixelHeight ) );
900-
QgsDebugMsg( "theExtent: " + extent.toString() );
901-
902-
QString myMemDsn;
903-
myMemDsn.sprintf( "DATAPOINTER = %p", block );
904-
QgsDebugMsg( myMemDsn );
905-
906-
//myMemDsn.sprintf( "MEM:::DATAPOINTER=%lu,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE=%s,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=0", ( long )block, pixelWidth, pixelHeight, GDALGetDataTypeName(( GDALDataType )mGdalDataType[bandNo-1] ) );
907-
char szPointer[64];
908-
memset( szPointer, 0, sizeof( szPointer ) );
909-
CPLPrintPointer( szPointer, block, sizeof( szPointer ) );
910-
911-
myMemDsn.sprintf( "MEM:::DATAPOINTER=%s,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE=%s,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=0", szPointer, pixelWidth, pixelHeight, GDALGetDataTypeName( ( GDALDataType )mGdalDataType[bandNo - 1] ) );
912-
913-
QgsDebugMsg( "Open GDAL MEM : " + myMemDsn );
914-
915-
CPLErrorReset();
916-
GDALDatasetH myGdalMemDataset = GDALOpen( TO8F( myMemDsn ), GA_Update );
917-
918-
if ( !myGdalMemDataset )
919-
{
920-
QMessageBox::warning( 0, QObject::tr( "Warning" ),
921-
QObject::tr( "Cannot open GDAL MEM dataset %1: %2" ).arg( myMemDsn ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
922-
return;
923-
}
924-
925-
//GDALSetProjection( myGdalMemDataset, destCRS.toWkt().toLatin1().constData() );
926-
927-
double myMemGeoTransform[6];
928-
myMemGeoTransform[0] = extent.xMinimum(); // top left x
929-
myMemGeoTransform[1] = extent.width() / pixelWidth; // w-e pixel resolution
930-
myMemGeoTransform[2] = 0; // rotation, 0 if image is "north up"
931-
myMemGeoTransform[3] = extent.yMaximum(); // top left y
932-
myMemGeoTransform[4] = 0; // rotation, 0 if image is "north up"
933-
myMemGeoTransform[5] = -1. * extent.height() / pixelHeight; // n-s pixel resolution
934-
935-
double myGeoTransform[6];
936-
GDALGetGeoTransform( mGdalDataset, myGeoTransform );
937-
// TODO:
938-
// Attention: GDALCreateGenImgProjTransformer failes if source data source
939-
// is not georeferenced, e.g. matrix 0,1,0,0,0,1/-1
940-
// as a workaround in such case we have to set some different value - really ugly
941-
myGeoTransform[0] = DBL_MIN;
942-
GDALSetGeoTransform( mGdalDataset, myGeoTransform );
943-
944-
GDALSetGeoTransform( myGdalMemDataset, myMemGeoTransform );
945-
946-
for ( int i = 0; i < 6; i++ )
947-
{
948-
QgsDebugMsg( QString( "transform : %1 %2" ).arg( myGeoTransform[i] ).arg( myMemGeoTransform[i] ) );
949-
}
950-
951-
GDALWarpOptions *myWarpOptions = GDALCreateWarpOptions();
952-
953-
myWarpOptions->hSrcDS = mGdalDataset;
954-
myWarpOptions->hDstDS = myGdalMemDataset;
955-
956-
myWarpOptions->nBandCount = 1;
957-
myWarpOptions->panSrcBands =
958-
( int * ) qgsMalloc( sizeof( int ) * myWarpOptions->nBandCount );
959-
myWarpOptions->panSrcBands[0] = bandNo;
960-
myWarpOptions->panDstBands =
961-
( int * ) qgsMalloc( sizeof( int ) * myWarpOptions->nBandCount );
962-
myWarpOptions->panDstBands[0] = 1;
963-
964-
// TODO move here progressCallback and use it
965-
myWarpOptions->pfnProgress = GDALTermProgress;
966-
967-
QgsDebugMsg( "src wkt: " + QString( GDALGetProjectionRef( mGdalDataset ) ) );
968-
QgsDebugMsg( "dst wkt: " + QString( GDALGetProjectionRef( myGdalMemDataset ) ) );
969-
myWarpOptions->pTransformerArg =
970-
GDALCreateGenImgProjTransformer(
971-
mGdalDataset,
972-
nullptr,
973-
myGdalMemDataset,
974-
nullptr,
975-
false, 0.0, 1
976-
);
977-
#if 0
978-
myWarpOptions->pTransformerArg =
979-
GDALCreateGenImgProjTransformer2(
980-
mGdalDataset,
981-
myGdalMemDataset,
982-
nullptr
983-
);
984-
#endif
985-
if ( !myWarpOptions->pTransformerArg )
986-
{
987-
QMessageBox::warning( 0, QObject::tr( "Warning" ),
988-
QObject::tr( "Cannot GDALCreateGenImgProjTransformer: %1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ); // missing word?
989-
return;
990-
991-
}
992-
993-
//CPLAssert( myWarpOptions->pTransformerArg );
994-
myWarpOptions->pfnTransformer = GDALGenImgProjTransform;
995-
996-
myWarpOptions->padfDstNoDataReal = ( double * ) qgsMalloc( myWarpOptions->nBandCount * sizeof( double ) );
997-
myWarpOptions->padfDstNoDataImag = ( double * ) qgsMalloc( myWarpOptions->nBandCount * sizeof( double ) );
998-
999-
myWarpOptions->padfDstNoDataReal[0] = mNoDataValue[bandNo - 1];
1000-
myWarpOptions->padfDstNoDataImag[0] = 0.0;
1001-
1002-
GDALSetRasterNoDataValue( GDALGetRasterBand( myGdalMemDataset,
1003-
myWarpOptions->panDstBands[0] ),
1004-
myWarpOptions->padfDstNoDataReal[0] );
1005-
1006-
// TODO optimize somehow to avoid no data init if not necessary
1007-
// i.e. no projection, but there is also the problem with margine
1008-
myWarpOptions->papszWarpOptions =
1009-
CSLSetNameValue( myWarpOptions->papszWarpOptions, "INIT_DEST", "NO_DATA" );
1010-
1011-
myWarpOptions->eResampleAlg = GRA_NearestNeighbour;
1012-
1013-
GDALWarpOperation myOperation;
1014-
1015-
if ( myOperation.Initialize( myWarpOptions ) != CE_None )
1016-
{
1017-
QMessageBox::warning( 0, QObject::tr( "Warning" ),
1018-
QObject::tr( "Cannot initialize GDAL Warp operation : %1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) );
1019-
return;
1020-
1021-
}
1022-
CPLErrorReset();
1023-
CPLErr myErr;
1024-
myErr = myOperation.ChunkAndWarpImage( 0, 0, pixelWidth, pixelHeight );
1025-
if ( myErr != CPLE_None )
1026-
{
1027-
QMessageBox::warning( 0, QObject::tr( "Warning" ),
1028-
QObject::tr( "Cannot chunk and warp image: %1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
1029-
return;
1030-
}
1031-
1032-
GDALDestroyGenImgProjTransformer( myWarpOptions->pTransformerArg );
1033-
GDALDestroyWarpOptions( myWarpOptions );
1034-
1035-
// flush should not be necessary
1036-
//GDALFlushCache ( myGdalMemDataset );
1037-
// this was causing crash ???
1038-
// The MEM driver does not free() the memory passed as DATAPOINTER so we can closee the dataset
1039-
GDALClose( myGdalMemDataset );
1040-
1041-
}
1042-
#endif
1043-
1044-
#if 0
1045-
bool QgsGdalProvider::srcHasNoDataValue( int bandNo ) const
1046-
{
1047-
if ( mGdalDataset )
1048-
{
1049-
GDALRasterBandH myGdalBand = GDALGetRasterBand( mGdalDataset, bandNo );
1050-
if ( myGdalBand )
1051-
{
1052-
int ok;
1053-
GDALGetRasterNoDataValue( myGdalBand, &ok );
1054-
return ok;
1055-
}
1056-
}
1057-
return false;
1058-
}
1059-
1060-
double QgsGdalProvider::noDataValue() const
1061-
{
1062-
if ( !mNoDataValue.isEmpty() )
1063-
{
1064-
return mNoDataValue[0];
1065-
}
1066-
return std::numeric_limits<int>::max(); // should not happen or be used
1067-
}
1068-
#endif
1069-
1070-
#if 0
1071-
void QgsGdalProvider::computeMinMax( int bandNo ) const
1072-
{
1073-
QgsDebugMsg( QString( "theBandNo = %1 mMinMaxComputed = %2" ).arg( bandNo ).arg( mMinMaxComputed[bandNo - 1] ) );
1074-
if ( mMinMaxComputed[bandNo - 1] )
1075-
{
1076-
return;
1077-
}
1078-
GDALRasterBandH myGdalBand = GDALGetRasterBand( mGdalDataset, bandNo );
1079-
int bGotMin, bGotMax;
1080-
double adfMinMax[2];
1081-
adfMinMax[0] = GDALGetRasterMinimum( myGdalBand, &bGotMin );
1082-
adfMinMax[1] = GDALGetRasterMaximum( myGdalBand, &bGotMax );
1083-
if ( !( bGotMin && bGotMax ) )
1084-
{
1085-
GDALComputeRasterMinMax( myGdalBand, true, adfMinMax );
1086-
}
1087-
mMinimum[bandNo - 1] = adfMinMax[0];
1088-
mMaximum[bandNo - 1] = adfMinMax[1];
1089-
}
1090-
#endif
1091-
1092888
/**
1093889
* \param bandNumber the number of the band for which you want a color table
1094890
* \param list a pointer the object that will hold the color table

0 commit comments

Comments
 (0)