+ logging cosmetics

This commit is contained in:
Lucio Asnaghi 2010-11-18 22:17:09 +00:00
parent bc43899990
commit 013d48f667
2 changed files with 46 additions and 34 deletions

View file

@ -49,7 +49,7 @@ inline GDALDataset *gdal_datasource::open_dataset() const
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: opening: " << dataset_name_ << "\n";
std::clog << "GDAL Plugin: opening: " << dataset_name_ << std::endl;
#endif
GDALDataset *dataset;
@ -72,7 +72,7 @@ gdal_datasource::gdal_datasource(parameters const& params, bool bind)
filter_factor_(*params_.get<double>("filter_factor",0.0))
{
#ifdef MAPNIK_DEBUG
std::clog << "\nGDAL Plugin: Initializing...\n";
std::clog << "GDAL Plugin: Initializing..." << std::endl;
#endif
GDALAllRegister();
@ -133,8 +133,8 @@ void gdal_datasource::bind() const
GDALClose(dataset);
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Raster Size=" << width_ << "," << height_ << "\n";
std::clog << "GDAL Plugin: Raster Extent=" << extent_ << "\n";
std::clog << "GDAL Plugin: Raster Size=" << width_ << "," << height_ << std::endl;
std::clog << "GDAL Plugin: Raster Extent=" << extent_ << std::endl;
#endif
is_bound_ = true;
@ -181,3 +181,4 @@ featureset_ptr gdal_datasource::features_at_point(coord2d const& pt) const
gdal_query gq = pt;
return featureset_ptr(new gdal_featureset(*open_dataset(), band_, gq, extent_, width_, height_, nbands_, dx_, dy_, filter_factor_));
}

View file

@ -57,7 +57,7 @@ gdal_featureset::gdal_featureset(GDALDataset & dataset, int band, gdal_query q,
gdal_featureset::~gdal_featureset()
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: closing dataset = " << &dataset_ << "\n";
std::clog << "GDAL Plugin: closing dataset = " << &dataset_ << std::endl;
#endif
GDALClose(&dataset_);
}
@ -68,7 +68,7 @@ feature_ptr gdal_featureset::next()
{
first_ = false;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: featureset, dataset = " << &dataset_ << "\n";
std::clog << "GDAL Plugin: featureset, dataset = " << &dataset_ << std::endl;
#endif
query *q = boost::get<query>(&gquery_);
@ -141,10 +141,10 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
intersect = t.backward(feature_raster_extent);
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Raster extent=" << raster_extent_ << "\n";
std::clog << "GDAL Plugin: View extent=" << intersect << "\n";
std::clog << "GDAL Plugin: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution()) << "\n";
std::clog << boost::format("GDAL Plugin: StartX=%d StartY=%d Width=%d Height=%d \n") % x_off % y_off % width % height;
std::clog << "GDAL Plugin: Raster extent=" << raster_extent_ << std::endl;
std::clog << "GDAL Plugin: View extent=" << intersect << std::endl;
std::clog << "GDAL Plugin: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution()) << std::endl;
std::clog << boost::format("GDAL Plugin: StartX=%d StartY=%d Width=%d Height=%d") % x_off % y_off % width % height << std::endl;
#endif
if (width > 0 && height > 0)
@ -182,8 +182,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
image.set(0xffffffff);
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Image Size=(" << im_width << "," << im_height << ")\n";
std::clog << "GDAL Plugin: Reading band " << band_ << "\n";
std::clog << "GDAL Plugin: Image Size=(" << im_width << "," << im_height << ")" << std::endl;
std::clog << "GDAL Plugin: Reading band " << band_ << std::endl;
#endif
typedef std::vector<int,int> pallete;
@ -216,38 +216,38 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
case GCI_RedBand:
red = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found red band" << "\n";
std::clog << "GDAL Plugin: Found red band" << std::endl;
#endif
break;
case GCI_GreenBand:
green = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found green band" << "\n";
std::clog << "GDAL Plugin: Found green band" << std::endl;
#endif
break;
case GCI_BlueBand:
blue = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found blue band" << "\n";
std::clog << "GDAL Plugin: Found blue band" << std::endl;
#endif
break;
case GCI_AlphaBand:
alpha = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found alpha band" << "\n";
std::clog << "GDAL Plugin: Found alpha band" << std::endl;
#endif
break;
case GCI_GrayIndex:
grey = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found gray band" << "\n";
std::clog << "GDAL Plugin: Found gray band" << std::endl;
#endif
break;
case GCI_PaletteIndex:
{
grey = band;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found gray band, and colortable..." << "\n";
std::clog << "GDAL Plugin: Found gray band, and colortable..." << std::endl;
#endif
GDALColorTable *color_table = band->GetColorTable();
@ -255,14 +255,14 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
{
int count = color_table->GetColorEntryCount();
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Color Table count = " << count << "\n";
std::clog << "GDAL Plugin: Color Table count = " << count << std::endl;
#endif
for (int j = 0; j < count; j++)
{
const GDALColorEntry *ce = color_table->GetColorEntry (j);
if (! ce) continue;
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Color entry RGB (" << ce->c1 << "," <<ce->c2 << "," << ce->c3 << ")\n";
std::clog << "GDAL Plugin: Color entry RGB (" << ce->c1 << "," <<ce->c2 << "," << ce->c3 << ")" << std::endl;
#endif
}
}
@ -270,13 +270,13 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
}
case GCI_Undefined:
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: Found undefined band (assumming gray band)" << "\n";
std::clog << "GDAL Plugin: Found undefined band (assumming gray band)" << std::endl;
#endif
grey = band;
break;
default:
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: band type unknown!" << "\n";
std::clog << "GDAL Plugin: band type unknown!" << std::endl;
#endif
break;
}
@ -285,7 +285,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
if (red && green && blue)
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: processing rgb bands..." << "\n";
std::clog << "GDAL Plugin: processing rgb bands..." << std::endl;
#endif
red->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 0,
image.width(),image.height(),GDT_Byte,4,4*image.width());
@ -297,7 +297,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
else if (grey)
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: processing gray band..." << "\n";
std::clog << "GDAL Plugin: processing gray band..." << std::endl;
#endif
// TODO : apply colormap if present
@ -312,7 +312,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
if (alpha)
{
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: processing alpha band..." << "\n";
std::clog << "GDAL Plugin: processing alpha band..." << std::endl;
#endif
alpha->RasterIO(GF_Read,x_off,y_off,width,height,image.getBytes() + 3,
image.width(),image.height(),GDT_Byte,4,4*image.width());
@ -348,9 +348,9 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
if (x < raster_xsize && y < raster_ysize)
{
#ifdef MAPNIK_DEBUG
std::clog << boost::format("GDAL Plugin: pt.x=%f pt.y=%f\n") % pt.x % pt.y;
std::clog << boost::format("GDAL Plugin: x=%f y=%f\n") % x % y;
#ifdef MAPNIK_DEBUG
std::clog << boost::format("GDAL Plugin: pt.x=%f pt.y=%f") % pt.x % pt.y << std::endl;
std::clog << boost::format("GDAL Plugin: x=%f y=%f") % x % y << std::endl;
#endif
GDALRasterBand * band = dataset_.GetRasterBand(band_);
int hasNoData;
@ -378,24 +378,35 @@ void gdal_featureset::get_overview_meta(GDALRasterBand * band)
int band_overviews = band->GetOverviewCount();
if (band_overviews > 0)
{
std::clog << "GDAL Plugin: "<< band_overviews << " overviews found!" << "\n";
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: "<< band_overviews << " overviews found!" << std::endl;
#endif
for (int b = 0; b < band_overviews; b++)
{
GDALRasterBand * overview = band->GetOverview (b);
std::clog << boost::format("GDAL Plugin: Overview=%d Width=%d Height=%d \n")
% b % overview->GetXSize() % overview->GetYSize();
#ifdef MAPNIK_DEBUG
std::clog << boost::format("GDAL Plugin: Overview=%d Width=%d Height=%d")
% b % overview->GetXSize() % overview->GetYSize() << std::endl;
#endif
}
}
else
{
std::clog << "GDAL Plugin: No overviews found!" << "\n";
#ifdef MAPNIK_DEBUG
std::clog << "GDAL Plugin: No overviews found!" << std::endl;
#endif
}
int bsx,bsy;
double scale;
band->GetBlockSize(&bsx,&bsy);
scale = band->GetScale();
std::clog << boost::format("GDAL Plugin: Block=%dx%d Scale=%f Type=%s Color=%s \n") % bsx % bsy % scale
#ifdef MAPNIK_DEBUG
std::clog << boost::format("GDAL Plugin: Block=%dx%d Scale=%f Type=%s Color=%s") % bsx % bsy % scale
% GDALGetDataTypeName(band->GetRasterDataType())
% GDALGetColorInterpretationName(band->GetColorInterpretation());
% GDALGetColorInterpretationName(band->GetColorInterpretation()) << std::endl;
#endif
}