Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #7419 from slarosa/fix_clang_build
fix build on osx
  • Loading branch information
slarosa committed Jul 16, 2018
2 parents 0c62abe + 5a36a33 commit 55e340a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
36 changes: 18 additions & 18 deletions external/mdal/frmts/mdal_gdal.cpp
Expand Up @@ -29,15 +29,15 @@ void MDAL::GdalDataset::init( const std::string &dsName )

void MDAL::GdalDataset::parseParameters()
{
mNBands = static_cast<uint>( GDALGetRasterCount( mHDataset ) );
mNBands = static_cast<unsigned int>( GDALGetRasterCount( mHDataset ) );
if ( mNBands == 0 ) throw MDAL_Status::Err_InvalidData;

GDALGetGeoTransform( mHDataset, mGT ); // in case of error it returns Identid

mXSize = static_cast<uint>( GDALGetRasterXSize( mHDataset ) ); //raster width in pixels
mXSize = static_cast<unsigned int>( GDALGetRasterXSize( mHDataset ) ); //raster width in pixels
if ( mXSize == 0 ) throw MDAL_Status::Err_InvalidData;

mYSize = static_cast<uint>( GDALGetRasterYSize( mHDataset ) ); //raster height in pixels
mYSize = static_cast<unsigned int>( GDALGetRasterYSize( mHDataset ) ); //raster height in pixels
if ( mYSize == 0 ) throw MDAL_Status::Err_InvalidData;

mNPoints = mXSize * mYSize;
Expand Down Expand Up @@ -72,13 +72,13 @@ bool MDAL::LoaderGdal::meshes_equals( const MDAL::GdalDataset *ds1, const MDAL::
bool MDAL::LoaderGdal::initVertices( Vertices &vertices )
{
Vertex *VertexsPtr = vertices.data();
uint mXSize = meshGDALDataset()->mXSize;
uint mYSize = meshGDALDataset()->mYSize;
unsigned int mXSize = meshGDALDataset()->mXSize;
unsigned int mYSize = meshGDALDataset()->mYSize;
const double *mGT = meshGDALDataset()->mGT;

for ( uint y = 0; y < mYSize; ++y )
for ( unsigned int y = 0; y < mYSize; ++y )
{
for ( uint x = 0; x < mXSize; ++x, ++VertexsPtr )
for ( unsigned int x = 0; x < mXSize; ++x, ++VertexsPtr )
{
// VertexsPtr->setId(x + mXSize*y);
VertexsPtr->x = mGT[0] + ( x + 0.5 ) * mGT[1] + ( y + 0.5 ) * mGT[2];
Expand Down Expand Up @@ -111,14 +111,14 @@ bool MDAL::LoaderGdal::initVertices( Vertices &vertices )
void MDAL::LoaderGdal::initFaces( Vertices &Vertexs, Faces &Faces, bool is_longitude_shifted )
{
int reconnected = 0;
uint mXSize = meshGDALDataset()->mXSize;
uint mYSize = meshGDALDataset()->mYSize;
unsigned int mXSize = meshGDALDataset()->mXSize;
unsigned int mYSize = meshGDALDataset()->mYSize;

size_t i = 0;

for ( uint y = 0; y < mYSize - 1; ++y )
for ( unsigned int y = 0; y < mYSize - 1; ++y )
{
for ( uint x = 0; x < mXSize - 1; ++x )
for ( unsigned int x = 0; x < mXSize - 1; ++x )
{
if ( is_longitude_shifted &&
( Vertexs[x + mXSize * y].x > 0.0 ) &&
Expand Down Expand Up @@ -195,7 +195,7 @@ MDAL::LoaderGdal::metadata_hash MDAL::LoaderGdal::parseMetadata( GDALMajorObject

void MDAL::LoaderGdal::parseRasterBands( const MDAL::GdalDataset *cfGDALDataset )
{
for ( uint i = 1; i <= cfGDALDataset->mNBands; ++i ) // starts with 1 .... ehm....
for ( unsigned int i = 1; i <= cfGDALDataset->mNBands; ++i ) // starts with 1 .... ehm....
{
// Get Band
GDALRasterBandH gdalBand = GDALGetRasterBand( cfGDALDataset->mHDataset, static_cast<int>( i ) );
Expand Down Expand Up @@ -262,10 +262,10 @@ void MDAL::LoaderGdal::addDataToOutput( GDALRasterBandH raster_band, std::shared
assert( raster_band );

double nodata = GDALGetRasterNoDataValue( raster_band, nullptr );
uint mXSize = meshGDALDataset()->mXSize;
uint mYSize = meshGDALDataset()->mYSize;
unsigned int mXSize = meshGDALDataset()->mXSize;
unsigned int mYSize = meshGDALDataset()->mYSize;

for ( uint y = 0; y < mYSize; ++y )
for ( unsigned int y = 0; y < mYSize; ++y )
{
// buffering per-line
CPLErr err = GDALRasterIO(
Expand All @@ -287,9 +287,9 @@ void MDAL::LoaderGdal::addDataToOutput( GDALRasterBandH raster_band, std::shared
throw MDAL_Status::Err_InvalidData;
}

for ( uint x = 0; x < mXSize; ++x )
for ( unsigned int x = 0; x < mXSize; ++x )
{
uint idx = x + mXSize * y;
unsigned int idx = x + mXSize * y;
double val = mPafScanline[x];
bool noData = false;
if ( MDAL::equals( val, nodata ) )
Expand Down Expand Up @@ -324,7 +324,7 @@ void MDAL::LoaderGdal::addDataToOutput( GDALRasterBandH raster_band, std::shared
void MDAL::LoaderGdal::activateFaces( std::shared_ptr<Dataset> tos )
{
// Activate only Faces that do all Vertex's outputs with some data
for ( uint idx = 0; idx < meshGDALDataset()->mNVolumes; ++idx )
for ( unsigned int idx = 0; idx < meshGDALDataset()->mNVolumes; ++idx )
{
Face elem = mMesh->faces.at( idx );

Expand Down
10 changes: 5 additions & 5 deletions external/mdal/frmts/mdal_gdal.hpp
Expand Up @@ -35,11 +35,11 @@ namespace MDAL
std::string mProj;
GDALDatasetH mHDataset;

uint mNBands; /* number of bands */
uint mXSize; /* number of x pixels */
uint mYSize; /* number of y pixels */
uint mNPoints; /* nodes count */
uint mNVolumes; /* Faces count */
unsigned int mNBands; /* number of bands */
unsigned int mXSize; /* number of x pixels */
unsigned int mYSize; /* number of y pixels */
unsigned int mNPoints; /* nodes count */
unsigned int mNVolumes; /* Faces count */
double mGT[6]; /* affine transform matrix */

private:
Expand Down

0 comments on commit 55e340a

Please sign in to comment.