Skip to content
Permalink
Browse files
fix gcc 4.6 warnings
git-svn-id: http://svn.osgeo.org/qgis/trunk@15857 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 30, 2011
1 parent 2b9c837 commit 645562821987b422fbdd328240156a52c881d145
@@ -120,9 +120,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
{
char* crsWKT = 0;
OGRSpatialReferenceH ogrSRS = OSRNewSpatialReference( NULL );
const QgsCoordinateReferenceSystem& outputCrs = rl->crs();
int epsgCode = outputCrs.epsg();
if ( epsgCode > 0 && OSRImportFromEPSG( ogrSRS, epsgCode ) == CE_None )
if ( OSRSetFromUserInput( ogrSRS, rl->crs().authid().toUtf8().constData() ) == OGRERR_NONE )
{
OSRExportToWkt( ogrSRS, &crsWKT );
GDALSetProjection( outputDataset, crsWKT );
@@ -240,12 +240,10 @@ void QgsOpenVectorLayerDialog::setConnectionTypeListPosition()
QSettings settings;

QString toSelect = settings.value( "/ogr/connections/selectedtype" ).toString();
bool set = false;
for ( int i = 0; i < cmbDatabaseTypes->count(); ++i )
if ( cmbDatabaseTypes->itemText( i ) == toSelect )
{
cmbDatabaseTypes->setCurrentIndex( i );
set = true;
break;
}
}
@@ -3877,8 +3877,6 @@ void QgisApp::mergeSelectedFeatures()
}

//make a first geometry union and notify the user straight away if the union geometry type does not match the layer one
QGis::WkbType originalType = vl->wkbType();
QGis::WkbType newType = unionGeom->wkbType();
if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() )
{
QMessageBox::critical( 0, tr( "Union operation canceled" ), tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) );
@@ -3918,8 +3916,6 @@ void QgisApp::mergeSelectedFeatures()
return;
}

originalType = vl->wkbType();
newType = unionGeom->wkbType();
if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() )
{
QMessageBox::critical( 0, "Union operation canceled", tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) );
@@ -86,7 +86,6 @@ void QgsAttributeTypeDialog::vCellChanged( int row, int column )
void QgsAttributeTypeDialog::removeSelectedButtonPushed()
{
QList<QTableWidgetItem *> list = tableWidget->selectedItems();
QList<QTableWidgetItem *>::iterator it = list.begin();
QSet<int> rowsToRemove;
int removed = 0;
int i = 0;
@@ -157,8 +157,6 @@ void QgsGraduatedSymbolDialog::adjustNumberOfClasses()
show();
return;
}

std::map < QString, int >::iterator iter = mFieldMap.find( fieldstring );
}

void QgsGraduatedSymbolDialog::apply()
@@ -55,7 +55,6 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )
return;
}
const QgsAttributeMap& attributeValues = f.attributeMap();
QgsAttributeMap::const_iterator attIt = attributeValues.constBegin();

//get layerproperties. Problem: only for pallabeling...
QgsPalLabeling* lbl = dynamic_cast<QgsPalLabeling*>( mMapRenderer->labelingEngine() );
@@ -1886,8 +1886,6 @@ void QgsRasterLayerProperties::refreshHistogram()
// and max - scaled to image height. 1 line drawn per selected band
//
const int BINCOUNT = 255;
enum GRAPH_TYPE { BAR_CHART, LINE_CHART } myGraphType;
myGraphType = BAR_CHART;
bool myIgnoreOutOfRangeFlag = true;
bool myThoroughBandScanFlag = false;
int myBandCountInt = mRasterLayer->bandCount();
@@ -958,7 +958,6 @@ bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& heigh
//assume points 1 and 3 are on the rectangle boundaries. Calculate 2 and 4.
double distM1 = sqrt(( x1 - midX ) * ( x1 - midX ) + ( y1 - midY ) * ( y1 - midY ) );
QPointF p2 = pointOnLineWithDistance( QPointF( midX, midY ), QPointF( x2, y2 ), distM1 );
QPointF p4 = pointOnLineWithDistance( QPointF( midX, midY ), QPointF( x4, y4 ), distM1 );

if ( p2.x() < width && p2.x() > 0 && p2.y() < height && p2.y() > 0 )
{
@@ -138,7 +138,6 @@ void QgsComposerScaleBar::applyDefaultSize()
if ( mComposerMap )
{
//calculate mNumUnitsPerSegment
QRectF composerItemRect = mComposerMap->rect();
QgsRectangle composerMapRect = mComposerMap->extent();

double proposedScaleBarLength = composerMapRect.width() / 4;
@@ -163,14 +163,13 @@ double nmea_distance_ellipsoid(
while (( delta_lambda > 1e-12 ) && ( remaining_steps > 0 ) )
{ /* Iterate */
/* Variables */
double tmp1, tmp2, tan_sigma, sin_alpha, cos_alpha, C, lambda_prev;
double tmp1, tmp2, sin_alpha, cos_alpha, C, lambda_prev;

/* Calculation */
tmp1 = cos_U2 * sin_lambda;
tmp2 = cos_U1 * sin_U2 - sin_U1 * cos_U2 * cos_lambda;
sin_sigma = sqrt( tmp1 * tmp1 + tmp2 * tmp2 );
cos_sigma = sin_U1 * sin_U2 + cos_U1 * cos_U2 * cos_lambda;
tan_sigma = sin_sigma / cos_sigma;
sin_alpha = cos_U1 * cos_U2 * sin_lambda / sin_sigma;
cos_alpha = cos( asin( sin_alpha ) );
sqr_cos_alpha = cos_alpha * cos_alpha;
@@ -261,7 +260,7 @@ int nmea_move_horz_ellipsoid(
/* Variables */
double f, a, b, sqr_a, sqr_b;
double phi1, tan_U1, sin_U1, cos_U1, s, alpha1, sin_alpha1, cos_alpha1;
double tan_sigma1, sigma1, sin_alpha, cos_alpha, sqr_cos_alpha, sqr_u, A, B;
double sigma1, sin_alpha, sqr_cos_alpha, sqr_u, A, B;
double sigma_initial, sigma, sigma_prev, sin_sigma, cos_sigma, cos_2_sigmam, sqr_cos_2_sigmam, delta_sigma;
int remaining_steps;
double tmp1, phi2, lambda, C, L;
@@ -293,11 +292,9 @@ int nmea_move_horz_ellipsoid(
alpha1 = azimuth;
sin_alpha1 = sin( alpha1 );
cos_alpha1 = cos( alpha1 );
tan_sigma1 = tan_U1 / cos_alpha1;
sigma1 = atan2( tan_U1, cos_alpha1 );
sin_alpha = cos_U1 * sin_alpha1;
sqr_cos_alpha = 1 - sin_alpha * sin_alpha;
cos_alpha = sqrt( sqr_cos_alpha );
sqr_u = sqr_cos_alpha * ( sqr_a - sqr_b ) / sqr_b;
A = 1 + sqr_u / 16384 * ( 4096 + sqr_u * ( -768 + sqr_u * ( 320 - 175 * sqr_u ) ) );
B = sqr_u / 1024 * ( 256 + sqr_u * ( -128 + sqr_u * ( 74 - 47 * sqr_u ) ) );
@@ -1010,7 +1010,6 @@ namespace pal
if ( shapes_final->size() > 0 )
{
LinkedList<LabelPosition*> *positions = new LinkedList<LabelPosition*> ( ptrLPosCompare );
int it;

int id = 0; // ids for candidates
double dlx, dly; // delta from label center and bottom-left corner
@@ -1037,7 +1036,6 @@ namespace pal
j++;
}

it = 0;
dx = dy = min( yrm, xrm ) / 2;

int num_try = 0;
@@ -611,7 +611,6 @@ namespace pal
double cp;
double best_cp;
double distNearestPoint;
int nearestPoint;

double area;
double width;
@@ -689,14 +688,12 @@ namespace pal
alpha_seg = (( i / 4 > 0 ? ( i / 4 ) - 1 : 3 ) ) * M_PI / 2 + alpha;

best_cp = DBL_MAX;
nearestPoint = -1;
for ( j = 0; j < nbPoints; j++ )
{
cp = cross_product( bb[i+2], bb[i+3], bb[i], bb[i+1], x[cHull[j]], y[cHull[j]] );
if ( cp < best_cp )
{
best_cp = cp;
nearestPoint = cHull[j];
}
}

@@ -2138,7 +2138,6 @@ namespace pal
double initial_cost;
double cur_cost = 0;
double best_cost = 0;
double bestChain;

int nbOverlap = 0;

@@ -2166,7 +2165,6 @@ namespace pal

int tenure = pal->tenure;

int itBest = -1;
//int deltaIt = 0;

Triple **candidates = new Triple*[probSize];
@@ -2208,10 +2206,7 @@ namespace pal

sort(( void** ) candidates, probSize, decreaseCost );

int validCandidateId = -1;

int candidateListSize;
int seedSh;
candidateListSize = int ( pal->candListSize * ( double ) probSize + 0.5 );

if ( candidateListSize > probSize )
@@ -2226,16 +2221,13 @@ namespace pal
while ( it < stop_it )
{
retainedChain = NULL;
bestChain = DBL_MAX;
validCandidateId = -1;

#ifdef _DEBUG_FULL_
std::cout << std::endl << std::endl << candidateListSize << std::endl;
#endif
for ( itC = 0; itC < candidateListSize; itC++ )
{
seed = candidates[itC]->feat_id;
seedSh = seed - borderSize;

#ifdef _DEBUG_FULL_
std::cout << "new candidates:" << std::endl;
@@ -2253,7 +2245,6 @@ namespace pal
if ( !retainedChain )
{
retainedChain = current_chain;
bestChain = current_chain->delta;
#ifdef _DEBUG_FULL_
std::cout << "New chain, delta = " << current_chain->delta << std::endl;
#endif
@@ -2262,7 +2253,6 @@ namespace pal
{
delete_chain( retainedChain );
retainedChain = current_chain;
bestChain = current_chain->delta;
#ifdef _DEBUG_FULL_
std::cout << "New best chain, delta = " << current_chain->delta << std::endl;
#endif
@@ -2355,8 +2345,6 @@ namespace pal
best_cost = cur_cost;
memcpy( best_sol, sol, sizeof( int ) *subSize );

itBest = it;

stop_it = ( it + itwimp > maxit ? maxit : it + itwimp );
}
sort(( void** ) candidates, probSize, decreaseCost );
@@ -3443,7 +3443,6 @@ QgsRectangle QgsGeometry::boundingBox()
int numLineStrings;
int idx, jdx, kdx;
unsigned char *ptr;
char lsb;
QgsPoint pt;
QGis::WkbType wkbType;
bool hasZValue = false;
@@ -3568,7 +3567,6 @@ QgsRectangle QgsGeometry::boundingBox()
for ( jdx = 0; jdx < numLineStrings; jdx++ )
{
// each of these is a wbklinestring so must handle as such
lsb = *ptr;
ptr += 5; // skip type since we know its 2
nPoints = ( int * ) ptr;
ptr += sizeof( int );
@@ -4135,7 +4133,6 @@ bool QgsGeometry::exportWkbToGeos()
int numLineStrings;
int idx, jdx, kdx;
unsigned char *ptr;
char lsb;
QgsPoint pt;
QGis::WkbType wkbtype;
bool hasZValue = false;
@@ -4226,7 +4223,6 @@ bool QgsGeometry::exportWkbToGeos()
QgsPolyline sequence;

// each of these is a wbklinestring so must handle as such
lsb = *ptr;
ptr += 5; // skip type since we know its 2
nPoints = ( int * ) ptr;
ptr += sizeof( int );
@@ -5165,7 +5161,6 @@ GEOSGeometry* QgsGeometry::reshapePolygon( const GEOSGeometry* polygon, const GE
}

GEOSGeometry** newInnerRings = new GEOSGeometry*[ringList.size()];
QList<GEOSGeometry*>::const_iterator it = ringList.constBegin();
for ( int i = 0; i < ringList.size(); ++i )
{
newInnerRings[i] = ringList.at( i );
@@ -320,13 +320,8 @@ void QgsMapRenderer::render( QPainter* painter )
}
}

bool placeOverlays = false;
QgsOverlayObjectPositionManager* overlayManager = overlayManagerFromSettings();
QList<QgsVectorOverlay*> allOverlayList; //list of all overlays, used to draw them after layers have been rendered
if ( overlayManager )
{
placeOverlays = true;
}

// render all layers in the stack, starting at the base
QListIterator<QString> li( mLayerSet );
@@ -4214,8 +4214,10 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
// used in all cases of the statement (otherwise they may get
// executed, but never used, in a bit of code where performance is
// critical).
if ( ! fet.isValid() ) { return; }
bool needToTrim = false;
if ( ! fet.isValid() )
{
return;
}

QgsGeometry* geom = fet.geometry();
if ( !geom )
@@ -4283,10 +4285,8 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
//QPointF pt( x, y );

// Work around a +/- 32768 limitation on coordinates
if ( qAbs( x ) > QgsClipper::MAX_X ||
qAbs( y ) > QgsClipper::MAX_Y )
needToTrim = true;
else
if ( qAbs( x ) <= QgsClipper::MAX_X &&
qAbs( y ) <= QgsClipper::MAX_Y )
p->drawImage( pt, *marker );
}
p->restore();
@@ -216,7 +216,6 @@ void QgsAnnotationItem::drawMarkerSymbol( QPainter* p )
return;
}

QPointF canvasPoint = toCanvasCoordinates( mMapPosition );
if ( mMarkerSymbol )
{
mMarkerSymbol->startRender( renderContext );
@@ -240,7 +240,6 @@ void QgsMapOverviewCanvas::updatePanningWidget( const QPoint& pos )
{
// if (mPanningWidget->isHidden())
// return;
QSize size = mPanningWidget->size();
mPanningWidget->move( pos.x() - mPanningCursorOffset.x(), pos.y() - mPanningCursorOffset.y() );
}

@@ -247,11 +247,6 @@ void QgsQuickPrint::printMap()
#endif
QString myFontFamily = "Arial";

// Background color for pixmaps
QColor myLegendBackgroundColor = Qt::white;
//QColor myMapBackgroundColor = "#98dbf9"; // nice blue color


//
// Draw the PageBorder
//
@@ -767,7 +767,6 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
{
if ( !labelBufferElementList.item( 0 ).toElement().isNull() )
{
double radius = 5.0;
QDomNodeList cssNodes = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "CssParameter" );
QString cssName;
QDomElement currentElement;
@@ -833,6 +832,13 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
}
}
}

//QgsMapServerLogger::instance()->printMessage("radius " + QString::number(radius));
myLabelAttributes->setBufferEnabled( true );
myLabelAttributes->setBufferColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );

#if 0
double radius = 5.0;
QDomElement radiusElement = labelBufferElementList.item( 0 ).toElement().elementsByTagName( "Radius" ).item( 0 ).toElement();
if ( !radiusElement.isNull() )
{
@@ -843,10 +849,8 @@ bool QgsSLDParser::labelSettingsFromUserStyle( const QDomElement& userStyleEleme
radius = 5.0;
}
}
//QgsMapServerLogger::instance()->printMessage("radius " + QString::number(radius));
myLabelAttributes->setBufferEnabled( true );
myLabelAttributes->setBufferColor( QColor( polyColorRed, polyColorGreen, polyColorBlue, opacity ) );
//myLabelAttributes->setBufferSize(radius, QgsLabelAttributes::PointUnits);
myLabelAttributes->setBufferSize( radius, QgsLabelAttributes::PointUnits );
#endif

// ******** BUG ************ see why setting buffersize dows not work (is a problem in QGIS vector layer rendering)

@@ -1397,13 +1401,11 @@ QgsVectorLayer* QgsSLDParser::contourLayerFromRaster( const QDomElement& userSty
/* -------------------------------------------------------------------- */
/* Invoke. */
/* -------------------------------------------------------------------- */
CPLErr eErr;

eErr = GDALContourGenerate( hBand, dfInterval, dfOffset,
nFixedLevelCount, adfFixedLevels,
bNoDataSet, dfNoData,
hLayer, 0, nElevField,
GDALTermProgress, NULL );
GDALContourGenerate( hBand, dfInterval, dfOffset,
nFixedLevelCount, adfFixedLevels,
bNoDataSet, dfNoData,
hLayer, 0, nElevField,
GDALTermProgress, NULL );

delete adfFixedLevels;

0 comments on commit 6455628

Please sign in to comment.