- no need to #ifdef all the time: the compiler should optimize out the log calls when no MAPNIK_LOG is defined
- initially got rid of those ifdefs in plugins only
This commit is contained in:
parent
2df8e99af2
commit
74342e3083
35 changed files with 108 additions and 308 deletions
|
@ -23,16 +23,6 @@
|
||||||
#ifndef MAPNIK_DEBUG_HPP
|
#ifndef MAPNIK_DEBUG_HPP
|
||||||
#define MAPNIK_DEBUG_HPP
|
#define MAPNIK_DEBUG_HPP
|
||||||
|
|
||||||
#ifdef MAPNIK_DEBUG
|
|
||||||
#define MAPNIK_DEBUG_AS_BOOL true
|
|
||||||
#else
|
|
||||||
#define MAPNIK_DEBUG_AS_BOOL false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MAPNIK_LOG_FORMAT
|
|
||||||
#define MAPNIK_LOG_FORMAT "Mapnik LOG> %Y-%m-%d %H:%M:%S:"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// mapnik (should not depend on anything else)
|
// mapnik (should not depend on anything else)
|
||||||
#include <mapnik/config.hpp>
|
#include <mapnik/config.hpp>
|
||||||
|
|
||||||
|
@ -47,7 +37,6 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <ctime>
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -124,42 +113,32 @@ namespace mapnik {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define __xstr__(s) __str__(s)
|
class format
|
||||||
#define __str__(s) #s
|
|
||||||
|
|
||||||
static inline std::string format_logger()
|
|
||||||
{
|
{
|
||||||
char buf[256];
|
public:
|
||||||
const time_t tm = time(0);
|
|
||||||
strftime(buf, sizeof(buf), __xstr__(MAPNIK_LOG_FORMAT), localtime(&tm));
|
static std::string get()
|
||||||
return buf;
|
{
|
||||||
|
return format_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef __xstr__
|
static void set(const std::string& format)
|
||||||
#undef __str__
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
template<class Ch, class Tr, class A>
|
|
||||||
class no_output
|
|
||||||
{
|
{
|
||||||
private:
|
#ifdef MAPNIK_THREADSAFE
|
||||||
struct null_buffer
|
boost::mutex::scoped_lock lock(mutex_);
|
||||||
{
|
|
||||||
template<class T>
|
|
||||||
null_buffer &operator<<(const T &)
|
|
||||||
{
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef null_buffer stream_buffer;
|
|
||||||
|
|
||||||
void operator()(const stream_buffer &)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
format_ = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string str();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::string format_;
|
||||||
|
|
||||||
|
#ifdef MAPNIK_THREADSAFE
|
||||||
|
static boost::mutex mutex_;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template<class Ch, class Tr, class A>
|
template<class Ch, class Tr, class A>
|
||||||
|
@ -174,7 +153,7 @@ namespace mapnik {
|
||||||
static boost::mutex mutex;
|
static boost::mutex mutex;
|
||||||
boost::mutex::scoped_lock lock(mutex);
|
boost::mutex::scoped_lock lock(mutex);
|
||||||
#endif
|
#endif
|
||||||
std::clog << format_logger() << " " << s.str() << std::endl;
|
std::clog << format::str() << " " << s.str() << std::endl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,28 +172,35 @@ namespace mapnik {
|
||||||
|
|
||||||
base_log(const char* object_name)
|
base_log(const char* object_name)
|
||||||
{
|
{
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
if (object_name != NULL)
|
if (object_name != NULL)
|
||||||
{
|
{
|
||||||
object_name_ = object_name;
|
object_name_ = object_name;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~base_log()
|
~base_log()
|
||||||
{
|
{
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
if (check_severity())
|
if (check_severity())
|
||||||
{
|
{
|
||||||
output_policy()(streambuf_);
|
output_policy()(streambuf_);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
base_log &operator<<(const T &x)
|
base_log &operator<<(const T &x)
|
||||||
{
|
{
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
streambuf_ << x;
|
streambuf_ << x;
|
||||||
|
#endif
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef MAPNIK_LOG
|
||||||
inline bool check_severity()
|
inline bool check_severity()
|
||||||
{
|
{
|
||||||
return Severity >= severity::get_object(object_name_);
|
return Severity >= severity::get_object(object_name_);
|
||||||
|
@ -222,6 +208,7 @@ namespace mapnik {
|
||||||
|
|
||||||
typename output_policy::stream_buffer streambuf_;
|
typename output_policy::stream_buffer streambuf_;
|
||||||
std::string object_name_;
|
std::string object_name_;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,9 +221,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
{
|
{
|
||||||
sep = "\t";
|
sep = "\t";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected tab separator";
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected tab separator";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // pipes
|
else // pipes
|
||||||
|
@ -233,9 +231,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
{
|
{
|
||||||
sep = "|";
|
sep = "|";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected '|' separator";
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected '|' separator";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else // semicolons
|
else // semicolons
|
||||||
{
|
{
|
||||||
|
@ -244,9 +240,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
{
|
{
|
||||||
sep = ";";
|
sep = ";";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected ';' separator";
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: auto detected ';' separator";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,9 +257,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
std::string quo = boost::trim_copy(quote);
|
std::string quo = boost::trim_copy(quote);
|
||||||
if (quo.empty()) quo = "\"";
|
if (quo.empty()) quo = "\"";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: csv grammer: sep: '" << sep << "' quo: '" << quo << "' esc: '" << esc;
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: csv grammer: sep: '" << sep << "' quo: '" << quo << "' esc: '" << esc;
|
||||||
#endif
|
|
||||||
|
|
||||||
boost::escaped_list_separator<char> grammer;
|
boost::escaped_list_separator<char> grammer;
|
||||||
try
|
try
|
||||||
|
@ -430,9 +422,8 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
{
|
{
|
||||||
if ((row_limit_ > 0) && (line_number > row_limit_))
|
if ((row_limit_ > 0) && (line_number > row_limit_))
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: row limit hit, exiting at feature: " << feature_count;
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: row limit hit, exiting at feature: " << feature_count;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,9 +438,7 @@ void csv_datasource::parse_csv(T& stream,
|
||||||
{
|
{
|
||||||
++line_number;
|
++line_number;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: empty row encountered at line: " << line_number;
|
MAPNIK_LOG_DEBUG(csv) << "csv_datasource: empty row encountered at line: " << line_number;
|
||||||
#endif
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,9 +50,7 @@ using mapnik::datasource_exception;
|
||||||
*/
|
*/
|
||||||
inline GDALDataset* gdal_datasource::open_dataset() const
|
inline GDALDataset* gdal_datasource::open_dataset() const
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Opening " << dataset_name_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Opening " << dataset_name_;
|
||||||
#endif
|
|
||||||
|
|
||||||
GDALDataset *dataset;
|
GDALDataset *dataset;
|
||||||
#if GDAL_VERSION_NUM >= 1600
|
#if GDAL_VERSION_NUM >= 1600
|
||||||
|
@ -81,9 +79,7 @@ gdal_datasource::gdal_datasource(parameters const& params, bool bind)
|
||||||
filter_factor_(*params_.get<double>("filter_factor", 0.0)),
|
filter_factor_(*params_.get<double>("filter_factor", 0.0)),
|
||||||
nodata_value_(params_.get<double>("nodata"))
|
nodata_value_(params_.get<double>("nodata"))
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing...";
|
||||||
#endif
|
|
||||||
|
|
||||||
GDALAllRegister();
|
GDALAllRegister();
|
||||||
|
|
||||||
|
@ -128,9 +124,7 @@ void gdal_datasource::bind() const
|
||||||
boost::optional<std::string> bbox_s = params_.get<std::string>("bbox");
|
boost::optional<std::string> bbox_s = params_.get<std::string>("bbox");
|
||||||
if (bbox_s)
|
if (bbox_s)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s;
|
||||||
#endif
|
|
||||||
|
|
||||||
bbox_override = extent_.from_string(*bbox_s);
|
bbox_override = extent_.from_string(*bbox_s);
|
||||||
if (! bbox_override)
|
if (! bbox_override)
|
||||||
|
@ -153,12 +147,10 @@ void gdal_datasource::bind() const
|
||||||
dataset->GetGeoTransform(tr);
|
dataset->GetGeoTransform(tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource Geotransform="
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource Geotransform="
|
||||||
<< tr[0] << "," << tr[1] << ","
|
<< tr[0] << "," << tr[1] << ","
|
||||||
<< tr[2] << "," << tr[3] << ","
|
<< tr[2] << "," << tr[3] << ","
|
||||||
<< tr[4] << "," << tr[5];
|
<< tr[4] << "," << tr[5];
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO - We should throw for true non-north up images, but the check
|
// TODO - We should throw for true non-north up images, but the check
|
||||||
// below is clearly too restrictive.
|
// below is clearly too restrictive.
|
||||||
|
@ -193,10 +185,8 @@ void gdal_datasource::bind() const
|
||||||
|
|
||||||
GDALClose(dataset);
|
GDALClose(dataset);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Size=" << width_ << "," << height_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Size=" << width_ << "," << height_;
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Extent=" << extent_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Extent=" << extent_;
|
||||||
#endif
|
|
||||||
|
|
||||||
is_bound_ = true;
|
is_bound_ = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,7 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset,
|
||||||
|
|
||||||
gdal_featureset::~gdal_featureset()
|
gdal_featureset::~gdal_featureset()
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Closing Dataset=" << &dataset_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Closing Dataset=" << &dataset_;
|
||||||
#endif
|
|
||||||
|
|
||||||
GDALClose(&dataset_);
|
GDALClose(&dataset_);
|
||||||
}
|
}
|
||||||
|
@ -89,9 +87,7 @@ feature_ptr gdal_featureset::next()
|
||||||
{
|
{
|
||||||
first_ = false;
|
first_ = false;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Next feature in Dataset=" << &dataset_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Next feature in Dataset=" << &dataset_;
|
||||||
#endif
|
|
||||||
|
|
||||||
query *q = boost::get<query>(&gquery_);
|
query *q = boost::get<query>(&gquery_);
|
||||||
if (q)
|
if (q)
|
||||||
|
@ -122,7 +118,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
GDALRasterBand * grey = 0;
|
GDALRasterBand * grey = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_LOG
|
||||||
double tr[6];
|
double tr[6];
|
||||||
dataset_.GetGeoTransform(tr);
|
dataset_.GetGeoTransform(tr);
|
||||||
|
|
||||||
|
@ -188,12 +184,10 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
box2d<double> feature_raster_extent(x_off, y_off, x_off + width, y_off + height);
|
box2d<double> feature_raster_extent(x_off, y_off, x_off + width, y_off + height);
|
||||||
intersect = t.backward(feature_raster_extent);
|
intersect = t.backward(feature_raster_extent);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Raster extent=" << raster_extent_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Raster extent=" << raster_extent_;
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: View extent=" << intersect;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: View extent=" << intersect;
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution());
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution());
|
||||||
MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: StartX=%d StartY=%d Width=%d Height=%d") % x_off % y_off % width % height;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: StartX=" << x_off << " StartY=" << y_off << " Width=" << width << " Height=" << height;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (width > 0 && height > 0)
|
if (width > 0 && height > 0)
|
||||||
{
|
{
|
||||||
|
@ -208,9 +202,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
im_width *= filter_factor_;
|
im_width *= filter_factor_;
|
||||||
im_height *= filter_factor_;
|
im_height *= filter_factor_;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Applying layer filter_factor=" << filter_factor_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Applying layer filter_factor=" << filter_factor_;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
// otherwise respect symbolizer level factor applied to query, default of 1.0
|
// otherwise respect symbolizer level factor applied to query, default of 1.0
|
||||||
else
|
else
|
||||||
|
@ -233,10 +225,9 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
mapnik::image_data_32 image(im_width, im_height);
|
mapnik::image_data_32 image(im_width, im_height);
|
||||||
image.set(0xffffffff);
|
image.set(0xffffffff);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Image Size=(" << im_width << "," << im_height << ")";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Image Size=(" << im_width << "," << im_height << ")";
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Reading band=" << band_;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Reading band=" << band_;
|
||||||
#endif
|
|
||||||
typedef std::vector<int,int> pallete;
|
typedef std::vector<int,int> pallete;
|
||||||
|
|
||||||
if (band_ > 0) // we are querying a single band
|
if (band_ > 0) // we are querying a single band
|
||||||
|
@ -284,78 +275,74 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
{
|
{
|
||||||
case GCI_RedBand:
|
case GCI_RedBand:
|
||||||
red = band;
|
red = band;
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found red band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found red band";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case GCI_GreenBand:
|
case GCI_GreenBand:
|
||||||
green = band;
|
green = band;
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found green band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found green band";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case GCI_BlueBand:
|
case GCI_BlueBand:
|
||||||
blue = band;
|
blue = band;
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found blue band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found blue band";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case GCI_AlphaBand:
|
case GCI_AlphaBand:
|
||||||
alpha = band;
|
alpha = band;
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found alpha band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found alpha band";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case GCI_GrayIndex:
|
case GCI_GrayIndex:
|
||||||
grey = band;
|
grey = band;
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found gray band";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found gray band";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case GCI_PaletteIndex:
|
case GCI_PaletteIndex:
|
||||||
{
|
{
|
||||||
grey = band;
|
grey = band;
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found gray band, and colortable...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found gray band, and colortable...";
|
||||||
#endif
|
|
||||||
GDALColorTable *color_table = band->GetColorTable();
|
GDALColorTable *color_table = band->GetColorTable();
|
||||||
|
|
||||||
if (color_table)
|
if (color_table)
|
||||||
{
|
{
|
||||||
int count = color_table->GetColorEntryCount();
|
int count = color_table->GetColorEntryCount();
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Color Table count=" << count;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Color Table count=" << count;
|
||||||
#endif
|
|
||||||
for (int j = 0; j < count; j++)
|
for (int j = 0; j < count; j++)
|
||||||
{
|
{
|
||||||
const GDALColorEntry *ce = color_table->GetColorEntry (j);
|
const GDALColorEntry *ce = color_table->GetColorEntry (j);
|
||||||
if (! ce) continue;
|
if (! ce) continue;
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Color entry RGB=" << ce->c1 << "," <<ce->c2 << "," << ce->c3;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Color entry RGB=" << ce->c1 << "," <<ce->c2 << "," << ce->c3;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GCI_Undefined:
|
case GCI_Undefined:
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found undefined band (assumming gray band)";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Found undefined band (assumming gray band)";
|
||||||
#endif
|
|
||||||
grey = band;
|
grey = band;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(gdal) << "gdal_featureset: Band type unknown!";
|
MAPNIK_LOG_WARN(gdal) << "gdal_featureset: Band type unknown!";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (red && green && blue)
|
if (red && green && blue)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Processing rgb bands...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Processing rgb bands...";
|
||||||
#endif
|
|
||||||
int hasNoData(0);
|
int hasNoData(0);
|
||||||
double nodata(0);
|
double nodata(0);
|
||||||
if (nodata_value_)
|
if (nodata_value_)
|
||||||
|
@ -406,9 +393,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
}
|
}
|
||||||
else if (grey)
|
else if (grey)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Processing gray band...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Processing gray band...";
|
||||||
#endif
|
|
||||||
int hasNoData(0);
|
int hasNoData(0);
|
||||||
double nodata(0);
|
double nodata(0);
|
||||||
if (nodata_value_)
|
if (nodata_value_)
|
||||||
|
@ -424,9 +410,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
|
|
||||||
if (hasNoData && ! color_table)
|
if (hasNoData && ! color_table)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: No data value for layer=" << nodata;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: No data value for layer=" << nodata;
|
||||||
#endif
|
|
||||||
feature->put("NODATA",nodata);
|
feature->put("NODATA",nodata);
|
||||||
// first read the data in and create an alpha channel from the nodata values
|
// first read the data in and create an alpha channel from the nodata values
|
||||||
float* imageData = (float*)image.getBytes();
|
float* imageData = (float*)image.getBytes();
|
||||||
|
@ -458,9 +443,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
|
|
||||||
if (color_table)
|
if (color_table)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Loading colour table...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Loading colour table...";
|
||||||
#endif
|
|
||||||
unsigned nodata_value = static_cast<unsigned>(nodata);
|
unsigned nodata_value = static_cast<unsigned>(nodata);
|
||||||
if (hasNoData)
|
if (hasNoData)
|
||||||
{
|
{
|
||||||
|
@ -498,9 +482,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
|
||||||
}
|
}
|
||||||
if (alpha)
|
if (alpha)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: processing alpha band...";
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: processing alpha band...";
|
||||||
#endif
|
|
||||||
alpha->RasterIO(GF_Read, x_off, y_off, width, height, image.getBytes() + 3,
|
alpha->RasterIO(GF_Read, x_off, y_off, width, height, image.getBytes() + 3,
|
||||||
image.width(), image.height(), GDT_Byte, 4, 4 * image.width());
|
image.width(), image.height(), GDT_Byte, 4, 4 * image.width());
|
||||||
}
|
}
|
||||||
|
@ -535,10 +518,9 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
|
||||||
|
|
||||||
if (x < raster_xsize && y < raster_ysize)
|
if (x < raster_xsize && y < raster_ysize)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: pt.x=" << pt.x << " pt.y=" << pt.y;
|
||||||
MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: pt.x=%f pt.y=%f") % pt.x % pt.y;
|
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: x=" << x << " y=" << y;
|
||||||
MAPNIK_LOG_DEBUG(gdal) << boost::format("gdal_featureset: x=%f y=%f") % x % y;
|
|
||||||
#endif
|
|
||||||
GDALRasterBand* band = dataset_.GetRasterBand(band_);
|
GDALRasterBand* band = dataset_.GetRasterBand(band_);
|
||||||
int hasNoData;
|
int hasNoData;
|
||||||
double nodata = band->GetNoDataValue(&hasNoData);
|
double nodata = band->GetNoDataValue(&hasNoData);
|
||||||
|
|
|
@ -159,9 +159,7 @@ void geos_datasource::bind() const
|
||||||
mapnik::progress_timer __stats2__(std::clog, "geos_datasource::bind(initialize_extent)");
|
mapnik::progress_timer __stats2__(std::clog, "geos_datasource::bind(initialize_extent)");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Initializing extent from geometry";
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Initializing extent from geometry";
|
||||||
#endif
|
|
||||||
|
|
||||||
if (GEOSGeomTypeId(*geometry_) == GEOS_POINT)
|
if (GEOSGeomTypeId(*geometry_) == GEOS_POINT)
|
||||||
{
|
{
|
||||||
|
@ -194,9 +192,7 @@ void geos_datasource::bind() const
|
||||||
const GEOSCoordSequence* cs = GEOSGeom_getCoordSeq(exterior);
|
const GEOSCoordSequence* cs = GEOSGeom_getCoordSeq(exterior);
|
||||||
if (cs != NULL)
|
if (cs != NULL)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Iterating boundary points";
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Iterating boundary points";
|
||||||
#endif
|
|
||||||
|
|
||||||
double x, y;
|
double x, y;
|
||||||
double minx = std::numeric_limits<float>::max(),
|
double minx = std::numeric_limits<float>::max(),
|
||||||
|
@ -313,9 +309,7 @@ featureset_ptr geos_datasource::features(query const& q) const
|
||||||
<< extent.minx() << " " << extent.miny()
|
<< extent.minx() << " " << extent.miny()
|
||||||
<< "))";
|
<< "))";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using extent=" << s.str();
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using extent=" << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::make_shared<geos_featureset>(*geometry_,
|
return boost::make_shared<geos_featureset>(*geometry_,
|
||||||
GEOSGeomFromWKT(s.str().c_str()),
|
GEOSGeomFromWKT(s.str().c_str()),
|
||||||
|
@ -336,9 +330,7 @@ featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "POINT(" << pt.x << " " << pt.y << ")";
|
s << "POINT(" << pt.x << " " << pt.y << ")";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using point=" << s.str();
|
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Using point=" << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::make_shared<geos_featureset>(*geometry_,
|
return boost::make_shared<geos_featureset>(*geometry_,
|
||||||
GEOSGeomFromWKT(s.str().c_str()),
|
GEOSGeomFromWKT(s.str().c_str()),
|
||||||
|
|
|
@ -105,9 +105,7 @@ feature_ptr geos_featureset::next()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(geos) << "geos_featureset: Unknown extent geometry_type=" << type;
|
MAPNIK_LOG_DEBUG(geos) << "geos_featureset: Unknown extent geometry_type=" << type;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,9 +156,7 @@ featureset_ptr kismet_datasource::features(query const& q) const
|
||||||
{
|
{
|
||||||
if (! is_bound_) bind();
|
if (! is_bound_) bind();
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
MAPNIK_LOG_INFO(kismet) << "kismet_datasource::features()";
|
||||||
// MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features()";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO: use box2d to filter bbox before adding to featureset_ptr
|
// TODO: use box2d to filter bbox before adding to featureset_ptr
|
||||||
// mapnik::box2d<double> const& e = q.get_bbox();
|
// mapnik::box2d<double> const& e = q.get_bbox();
|
||||||
|
@ -176,18 +174,14 @@ featureset_ptr kismet_datasource::features_at_point(coord2d const& pt) const
|
||||||
{
|
{
|
||||||
if (! is_bound_) bind();
|
if (! is_bound_) bind();
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
MAPNIK_LOG_INFO(kismet) << "kismet_datasource::features_at_point()";
|
||||||
// MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features_at_point()";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return featureset_ptr();
|
return featureset_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Enter run";
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Enter run";
|
||||||
#endif
|
|
||||||
|
|
||||||
int sockfd, n;
|
int sockfd, n;
|
||||||
struct sockaddr_in sock_addr;
|
struct sockaddr_in sock_addr;
|
||||||
|
@ -252,9 +246,7 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
buffer[n] = '\0';
|
buffer[n] = '\0';
|
||||||
std::string bufferObj(buffer); // TCP data send from kismet_server as STL string
|
std::string bufferObj(buffer); // TCP data send from kismet_server as STL string
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: buffer_obj=" << bufferObj;
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: buffer_obj=" << bufferObj;
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string::size_type found = 0;
|
std::string::size_type found = 0;
|
||||||
std::string::size_type search_start = 0;
|
std::string::size_type search_start = 0;
|
||||||
|
@ -266,9 +258,7 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
{
|
{
|
||||||
kismet_line.assign(bufferObj, search_start, found - search_start);
|
kismet_line.assign(bufferObj, search_start, found - search_start);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: line=" << kismet_line;
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: line=" << kismet_line;
|
||||||
#endif
|
|
||||||
|
|
||||||
int param_number = 5; // the number of parameters to parse
|
int param_number = 5; // the number of parameters to parse
|
||||||
|
|
||||||
|
@ -281,13 +271,11 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
&bestlat,
|
&bestlat,
|
||||||
&bestlon) == param_number)
|
&bestlon) == param_number)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: ssid=" << ssid
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: ssid=" << ssid
|
||||||
<< ", bssid=" << bssid
|
<< ", bssid=" << bssid
|
||||||
<< ", crypt=" << crypt
|
<< ", crypt=" << crypt
|
||||||
<< ", bestlat=" << bestlat
|
<< ", bestlat=" << bestlat
|
||||||
<< ", bestlon=" << bestlon;
|
<< ", bestlon=" << bestlon;
|
||||||
#endif
|
|
||||||
|
|
||||||
kismet_network_data knd(ssid, bssid, bestlat, bestlon, crypt);
|
kismet_network_data knd(ssid, bssid, bestlat, bestlon, crypt);
|
||||||
|
|
||||||
|
@ -319,8 +307,6 @@ void kismet_datasource::run(const std::string& ip_host, const unsigned int port)
|
||||||
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Exit run";
|
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource: Exit run";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,9 +203,7 @@ void occi_datasource::bind() const
|
||||||
s << " AND LOWER(column_name) = LOWER('" << geometry_field_ << "')";
|
s << " AND LOWER(column_name) = LOWER('" << geometry_field_ << "')";
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -243,9 +241,7 @@ void occi_datasource::bind() const
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "SELECT " << fields_ << " FROM (" << table_name_ << ") WHERE rownum < 1";
|
s << "SELECT " << fields_ << " FROM (" << table_name_ << ") WHERE rownum < 1";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -335,17 +331,13 @@ void occi_datasource::bind() const
|
||||||
case oracle::occi::OCCI_SQLT_CLOB:
|
case oracle::occi::OCCI_SQLT_CLOB:
|
||||||
case oracle::occi::OCCI_SQLT_BLOB:
|
case oracle::occi::OCCI_SQLT_BLOB:
|
||||||
case oracle::occi::OCCI_SQLT_RSET:
|
case oracle::occi::OCCI_SQLT_RSET:
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(occi) << "occi_datasource: Unsupported datatype "
|
MAPNIK_LOG_WARN(occi) << "occi_datasource: Unsupported datatype "
|
||||||
<< occi_enums::resolve_datatype(type_oid)
|
<< occi_enums::resolve_datatype(type_oid)
|
||||||
<< " (type_oid=" << type_oid << ")";
|
<< " (type_oid=" << type_oid << ")";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(occi) << "occi_datasource: Unknown datatype "
|
MAPNIK_LOG_WARN(occi) << "occi_datasource: Unknown datatype "
|
||||||
<< "(type_oid=" << type_oid << ")";
|
<< "(type_oid=" << type_oid << ")";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,9 +383,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
s << " (SELECT SDO_AGGR_MBR(" << geometry_field_ << ") shape FROM " << table_ << ") a, ";
|
s << " (SELECT SDO_AGGR_MBR(" << geometry_field_ << ") shape FROM " << table_ << ") a, ";
|
||||||
s << " TABLE(SDO_UTIL.GETVERTICES(a.shape)) c";
|
s << " TABLE(SDO_UTIL.GETVERTICES(a.shape)) c";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -439,9 +429,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
s << METADATA_TABLE << " m, TABLE(m.diminfo) dim ";
|
s << METADATA_TABLE << " m, TABLE(m.diminfo) dim ";
|
||||||
s << " WHERE LOWER(m.table_name) = LOWER('" << table_name_ << "') AND dim.sdo_dimname = 'Y'";
|
s << " WHERE LOWER(m.table_name) = LOWER('" << table_name_ << "') AND dim.sdo_dimname = 'Y'";
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -590,9 +578,7 @@ featureset_ptr occi_datasource::features(query const& q) const
|
||||||
|
|
||||||
s << query;
|
s << query;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::make_shared<occi_featureset>(pool_,
|
return boost::make_shared<occi_featureset>(pool_,
|
||||||
conn_,
|
conn_,
|
||||||
|
@ -680,9 +666,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
|
|
||||||
s << query;
|
s << query;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(occi) << "occi_datasource: " << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::make_shared<occi_featureset>(pool_,
|
return boost::make_shared<occi_featureset>(pool_,
|
||||||
conn_,
|
conn_,
|
||||||
|
|
|
@ -205,19 +205,15 @@ feature_ptr occi_featureset::next()
|
||||||
case oracle::occi::OCCI_SQLT_BLOB:
|
case oracle::occi::OCCI_SQLT_BLOB:
|
||||||
case oracle::occi::OCCI_SQLT_RSET:
|
case oracle::occi::OCCI_SQLT_RSET:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unsupported datatype "
|
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unsupported datatype "
|
||||||
<< occi_enums::resolve_datatype(type_oid)
|
<< occi_enums::resolve_datatype(type_oid)
|
||||||
<< " (type_oid=" << type_oid << ")";
|
<< " (type_oid=" << type_oid << ")";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: // shouldn't get here
|
default: // shouldn't get here
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unknown datatype "
|
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unknown datatype "
|
||||||
<< "(type_oid=" << type_oid << ")";
|
<< "(type_oid=" << type_oid << ")";
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,11 +355,9 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
|
||||||
case SDO_GTYPE_UNKNOWN:
|
case SDO_GTYPE_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unknown oracle enum "
|
MAPNIK_LOG_WARN(occi) << "occi_featureset: Unknown oracle enum "
|
||||||
<< occi_enums::resolve_gtype(geomtype)
|
<< occi_enums::resolve_gtype(geomtype)
|
||||||
<< "(gtype=" << gtype << ")";
|
<< "(gtype=" << gtype << ")";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,7 @@ public:
|
||||||
{
|
{
|
||||||
if (env_ == 0)
|
if (env_ == 0)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(occi) << "occi_environment: constructor";
|
MAPNIK_LOG_DEBUG(occi) << "occi_environment: constructor";
|
||||||
#endif
|
|
||||||
|
|
||||||
const int mode = oracle::occi::Environment::OBJECT
|
const int mode = oracle::occi::Environment::OBJECT
|
||||||
| oracle::occi::Environment::THREADED_MUTEXED;
|
| oracle::occi::Environment::THREADED_MUTEXED;
|
||||||
|
@ -112,9 +110,7 @@ private:
|
||||||
{
|
{
|
||||||
if (env_)
|
if (env_)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(occi) << "occi_environment: destructor";
|
MAPNIK_LOG_DEBUG(occi) << "occi_environment: destructor";
|
||||||
#endif
|
|
||||||
|
|
||||||
oracle::occi::Environment::terminateEnvironment(env_);
|
oracle::occi::Environment::terminateEnvironment(env_);
|
||||||
env_ = 0;
|
env_ = 0;
|
||||||
|
|
|
@ -70,10 +70,8 @@ void ogr_converter::convert_geometry(OGRGeometry* geom, feature_ptr feature)
|
||||||
case wkbUnknown:
|
case wkbUnknown:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_converter: unknown <ogr> geometry_type="
|
MAPNIK_LOG_WARN(ogr) << "ogr_converter: unknown <ogr> geometry_type="
|
||||||
<< wkbFlatten(geom->getGeometryType());
|
<< wkbFlatten(geom->getGeometryType());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,6 @@ void ogr_datasource::bind() const
|
||||||
indexed_ = true;
|
indexed_ = true;
|
||||||
index_file.close();
|
index_file.close();
|
||||||
}
|
}
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
#if 0
|
#if 0
|
||||||
// TODO - enable this warning once the ogrindex tool is a bit more stable/mature
|
// TODO - enable this warning once the ogrindex tool is a bit more stable/mature
|
||||||
else
|
else
|
||||||
|
@ -278,7 +277,6 @@ void ogr_datasource::bind() const
|
||||||
<< ", use the 'ogrindex' program to build an index for faster rendering";
|
<< ", use the 'ogrindex' program to build an index for faster rendering";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif // MAPNIK_LOG
|
|
||||||
|
|
||||||
#ifdef MAPNIK_STATS
|
#ifdef MAPNIK_STATS
|
||||||
mapnik::progress_timer __stats2__(std::clog, "ogr_datasource::bind(get_column_description)");
|
mapnik::progress_timer __stats2__(std::clog, "ogr_datasource::bind(get_column_description)");
|
||||||
|
@ -319,18 +317,14 @@ void ogr_datasource::bind() const
|
||||||
case OFTRealList:
|
case OFTRealList:
|
||||||
case OFTStringList:
|
case OFTStringList:
|
||||||
case OFTWideStringList: // deprecated !
|
case OFTWideStringList: // deprecated !
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OFTDate:
|
case OFTDate:
|
||||||
case OFTTime:
|
case OFTTime:
|
||||||
case OFTDateTime: // unhandled !
|
case OFTDateTime: // unhandled !
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid;
|
|
||||||
#endif
|
|
||||||
desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::Object));
|
desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::Object));
|
||||||
|
MAPNIK_LOG_WARN(ogr) << "ogr_datasource: Unhandled type_oid=" << type_oid;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,12 +103,11 @@ feature_ptr ogr_featureset::next()
|
||||||
{
|
{
|
||||||
ogr_converter::convert_geometry(geom, feature);
|
ogr_converter::convert_geometry(geom, feature);
|
||||||
}
|
}
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: Feature with null geometry=" << (*feat)->GetFID();
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: Feature with null geometry=" << (*feat)->GetFID();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
++count_;
|
++count_;
|
||||||
|
|
||||||
int fld_count = layerdef_->GetFieldCount();
|
int fld_count = layerdef_->GetFieldCount();
|
||||||
|
@ -145,17 +144,13 @@ feature_ptr ogr_featureset::next()
|
||||||
case OFTStringList:
|
case OFTStringList:
|
||||||
case OFTWideStringList: // deprecated !
|
case OFTWideStringList: // deprecated !
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OFTBinary:
|
case OFTBinary:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -164,17 +159,13 @@ feature_ptr ogr_featureset::next()
|
||||||
case OFTTime:
|
case OFTTime:
|
||||||
case OFTDateTime: // unhandled !
|
case OFTDateTime: // unhandled !
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: // unknown
|
default: // unknown
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unknown type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_featureset: Unknown type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,9 +173,7 @@ feature_ptr ogr_featureset::next()
|
||||||
return feature;
|
return feature;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: " << count_ << " features";
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_featureset: " << count_ << " features";
|
||||||
#endif
|
|
||||||
|
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,7 @@ ogr_index_featureset<filterT>::ogr_index_featureset(mapnik::context_ptr const &
|
||||||
|
|
||||||
std::sort(ids_.begin(),ids_.end());
|
std::sort(ids_.begin(),ids_.end());
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Query size=" << ids_.size();
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Query size=" << ids_.size();
|
||||||
#endif
|
|
||||||
|
|
||||||
itr_ = ids_.begin();
|
itr_ = ids_.begin();
|
||||||
|
|
||||||
|
@ -110,12 +108,10 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
{
|
{
|
||||||
ogr_converter::convert_geometry (geom, feature);
|
ogr_converter::convert_geometry (geom, feature);
|
||||||
}
|
}
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Feature with null geometry=" << (*feat)->GetFID();
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_index_featureset: Feature with null geometry=" << (*feat)->GetFID();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int fld_count = layerdef_->GetFieldCount();
|
int fld_count = layerdef_->GetFieldCount();
|
||||||
for (int i = 0; i < fld_count; i++)
|
for (int i = 0; i < fld_count; i++)
|
||||||
|
@ -151,17 +147,13 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
case OFTStringList:
|
case OFTStringList:
|
||||||
case OFTWideStringList: // deprecated !
|
case OFTWideStringList: // deprecated !
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OFTBinary:
|
case OFTBinary:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
//feature->put(name,feat->GetFieldAsBinary (i, size));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -170,9 +162,7 @@ feature_ptr ogr_index_featureset<filterT>::next()
|
||||||
case OFTTime:
|
case OFTTime:
|
||||||
case OFTDateTime: // unhandled !
|
case OFTDateTime: // unhandled !
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(ogr) << "ogr_index_featureset: Unhandled type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,7 @@ public:
|
||||||
layer_ = ogr_layer;
|
layer_ = ogr_layer;
|
||||||
is_valid_ = true;
|
is_valid_ = true;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_name layer=" << layer_name_;
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_name layer=" << layer_name_;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
#ifdef MAPNIK_LOG
|
||||||
|
@ -105,9 +103,7 @@ public:
|
||||||
layer_name_ = def->GetName();
|
layer_name_ = def->GetName();
|
||||||
is_valid_ = true;
|
is_valid_ = true;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_index layer=" << layer_name_;
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_index layer=" << layer_name_;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,9 +137,7 @@ public:
|
||||||
layer_name_ = def->GetName();
|
layer_name_ = def->GetName();
|
||||||
is_valid_ = true;
|
is_valid_ = true;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_sql layer=" << layer_name_;
|
MAPNIK_LOG_DEBUG(ogr) << "ogr_layer_ptr: layer_from_sql layer=" << layer_name_;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,7 @@ osm_dataset* dataset_deliverer::load_from_url(const string& url, const string& b
|
||||||
}
|
}
|
||||||
else if (bbox != last_bbox)
|
else if (bbox != last_bbox)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(osm) << "osm_dataset_deliverer: BBoxes are different=" << last_bbox << "," << bbox;
|
MAPNIK_LOG_WARN(osm) << "osm_dataset_deliverer: BBoxes are different=" << last_bbox << "," << bbox;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Reload the dataset
|
// Reload the dataset
|
||||||
dataset->clear();
|
dataset->clear();
|
||||||
|
|
|
@ -49,9 +49,7 @@ bool osm_dataset::load_from_url(const std::string& url,
|
||||||
{
|
{
|
||||||
if (parser == "libxml2")
|
if (parser == "libxml2")
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: load_from_url url=" << url << ",bbox=" << bbox;
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: load_from_url url=" << url << ",bbox=" << bbox;
|
||||||
#endif
|
|
||||||
|
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
// use curl to grab the data
|
// use curl to grab the data
|
||||||
|
@ -59,9 +57,7 @@ bool osm_dataset::load_from_url(const std::string& url,
|
||||||
|
|
||||||
str << url << "?bbox=" << bbox;
|
str << url << "?bbox=" << bbox;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Full url=" << str.str();
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Full url=" << str.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
CURL_LOAD_DATA* resp = grab_http_response(str.str().c_str());
|
CURL_LOAD_DATA* resp = grab_http_response(str.str().c_str());
|
||||||
|
|
||||||
|
@ -71,9 +67,7 @@ bool osm_dataset::load_from_url(const std::string& url,
|
||||||
memcpy(blx, resp->data, resp->nbytes);
|
memcpy(blx, resp->data, resp->nbytes);
|
||||||
blx[resp->nbytes] = '\0';
|
blx[resp->nbytes] = '\0';
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: CURL Response=" << blx;
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: CURL Response=" << blx;
|
||||||
#endif
|
|
||||||
|
|
||||||
delete[] blx;
|
delete[] blx;
|
||||||
bool success = osmparser::parse(this, resp->data, resp->nbytes);
|
bool success = osmparser::parse(this, resp->data, resp->nbytes);
|
||||||
|
@ -90,13 +84,9 @@ osm_dataset::~osm_dataset()
|
||||||
|
|
||||||
void osm_dataset::clear()
|
void osm_dataset::clear()
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Clear";
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Clear";
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: -- Deleting ways";
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: -- Deleting ways";
|
||||||
#endif
|
|
||||||
for (unsigned int count = 0; count < ways.size(); ++count)
|
for (unsigned int count = 0; count < ways.size(); ++count)
|
||||||
{
|
{
|
||||||
delete ways[count];
|
delete ways[count];
|
||||||
|
@ -104,9 +94,7 @@ void osm_dataset::clear()
|
||||||
}
|
}
|
||||||
ways.clear();
|
ways.clear();
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: -- Deleting nodes";
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: -- Deleting nodes";
|
||||||
#endif
|
|
||||||
for (unsigned int count = 0; count < nodes.size(); ++count)
|
for (unsigned int count = 0; count < nodes.size(); ++count)
|
||||||
{
|
{
|
||||||
delete nodes[count];
|
delete nodes[count];
|
||||||
|
@ -114,9 +102,7 @@ void osm_dataset::clear()
|
||||||
}
|
}
|
||||||
nodes.clear();
|
nodes.clear();
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Clear done";
|
MAPNIK_LOG_DEBUG(osm) << "osm_dataset: Clear done";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string osm_dataset::to_string()
|
std::string osm_dataset::to_string()
|
||||||
|
|
|
@ -79,9 +79,7 @@ void osm_datasource::bind() const
|
||||||
if (url != "" && bbox != "")
|
if (url != "" && bbox != "")
|
||||||
{
|
{
|
||||||
// if we supplied a url and a bounding box, load from the url
|
// if we supplied a url and a bounding box, load from the url
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(osm) << "osm_datasource: loading_from_url url=" << url << ",bbox=" << bbox;
|
MAPNIK_LOG_DEBUG(osm) << "osm_datasource: loading_from_url url=" << url << ",bbox=" << bbox;
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((osm_data_ = dataset_deliverer::load_from_url(url, bbox, parser)) == NULL)
|
if ((osm_data_ = dataset_deliverer::load_from_url(url, bbox, parser)) == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,9 +81,8 @@ public:
|
||||||
{
|
{
|
||||||
PQfinish(conn_);
|
PQfinish(conn_);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_connection: postgresql connection closed - " << conn_;
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_connection: postgresql connection closed - " << conn_;
|
||||||
#endif
|
|
||||||
closed_ = true;
|
closed_ = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,9 +161,8 @@ public:
|
||||||
{
|
{
|
||||||
PQfinish(conn_);
|
PQfinish(conn_);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_connection: datasource closed, also closing connection - " << conn_;
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_connection: datasource closed, also closing connection - " << conn_;
|
||||||
#endif
|
|
||||||
closed_ = true;
|
closed_ = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,8 @@ public:
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "CLOSE " << cursorName_;
|
s << "CLOSE " << cursorName_;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: " << s.str();
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: " << s.str();
|
||||||
#endif
|
|
||||||
conn_->execute(s.str());
|
conn_->execute(s.str());
|
||||||
is_closed_ = true;
|
is_closed_ = true;
|
||||||
}
|
}
|
||||||
|
@ -159,15 +158,12 @@ private:
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "FETCH FORWARD " << fetch_size_ << " FROM " << cursorName_;
|
s << "FETCH FORWARD " << fetch_size_ << " FROM " << cursorName_;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: " << s.str();
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: " << s.str();
|
||||||
#endif
|
|
||||||
rs_ = conn_->executeQuery(s.str());
|
rs_ = conn_->executeQuery(s.str());
|
||||||
is_closed_ = false;
|
is_closed_ = false;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: FETCH result (" << cursorName_ << "): " << rs_->size() << " rows";
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_cursor_resultset: FETCH result (" << cursorName_ << "): " << rs_->size() << " rows";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<Connection> conn_;
|
boost::shared_ptr<Connection> conn_;
|
||||||
|
|
|
@ -265,10 +265,9 @@ void postgis_datasource::bind() const
|
||||||
if (key_field_string)
|
if (key_field_string)
|
||||||
{
|
{
|
||||||
key_field_ = std::string(key_field_string);
|
key_field_ = std::string(key_field_string);
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: auto-detected key field of '"
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: auto-detected key field of '"
|
||||||
<< key_field_ << "' on table '" << geometry_table_ << "'";
|
<< key_field_ << "' on table '" << geometry_table_ << "'";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -308,17 +307,13 @@ void postgis_datasource::bind() const
|
||||||
{
|
{
|
||||||
srid_ = -1;
|
srid_ = -1;
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Table " << table_ << " is using SRID=-1";
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Table " << table_ << " is using SRID=-1";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point the geometry_field may still not be known
|
// At this point the geometry_field may still not be known
|
||||||
// but we'll catch that where more useful...
|
// but we'll catch that where more useful...
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Using SRID=" << srid_;
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Using SRID=" << srid_;
|
||||||
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Using geometry_column=" << geometryColumn_;
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Using geometry_column=" << geometryColumn_;
|
||||||
#endif
|
|
||||||
|
|
||||||
// collect attribute desc
|
// collect attribute desc
|
||||||
#ifdef MAPNIK_STATS
|
#ifdef MAPNIK_STATS
|
||||||
|
@ -846,9 +841,7 @@ box2d<double> postgis_datasource::envelope() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
MAPNIK_LOG_DEBUG(postgis) << "postgis_datasource: Could not determine extent from query: " << s.str();
|
||||||
MAPNIK_LOG_DEBUG(postgis) << boost::format("postgis_datasource: Could not determine extent from query: %s") % s.str();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs->close();
|
rs->close();
|
||||||
|
|
|
@ -198,9 +198,8 @@ feature_ptr postgis_featureset::next()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(postgis) << "postgis_featureset: Uknown type_oid=" << oid;
|
MAPNIK_LOG_WARN(postgis) << "postgis_featureset: Uknown type_oid=" << oid;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,7 @@ raster_datasource::raster_datasource(const parameters& params, bool bind)
|
||||||
desc_(*params.get<std::string>("type"), "utf-8"),
|
desc_(*params.get<std::string>("type"), "utf-8"),
|
||||||
extent_initialized_(false)
|
extent_initialized_(false)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing...";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing...";
|
||||||
#endif
|
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
boost::optional<std::string> file = params.get<std::string>("file");
|
||||||
if (! file) throw datasource_exception("Raster Plugin: missing <file> parameter ");
|
if (! file) throw datasource_exception("Raster Plugin: missing <file> parameter ");
|
||||||
|
@ -150,9 +148,7 @@ void raster_datasource::bind() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Raster size=" << width_ << "," << height_;
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Raster size=" << width_ << "," << height_;
|
||||||
#endif
|
|
||||||
|
|
||||||
is_bound_ = true;
|
is_bound_ = true;
|
||||||
}
|
}
|
||||||
|
@ -197,15 +193,11 @@ featureset_ptr raster_datasource::features(query const& q) const
|
||||||
const int width = int(ext.maxx() + 0.5) - int(ext.minx() + 0.5);
|
const int width = int(ext.maxx() + 0.5) - int(ext.minx() + 0.5);
|
||||||
const int height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5);
|
const int height = int(ext.maxy() + 0.5) - int(ext.miny() + 0.5);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Box size=" << width << "," << height;
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Box size=" << width << "," << height;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (multi_tiles_)
|
if (multi_tiles_)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Multi-Tiled policy";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Multi-Tiled policy";
|
||||||
#endif
|
|
||||||
|
|
||||||
tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_);
|
tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_);
|
||||||
|
|
||||||
|
@ -213,9 +205,7 @@ featureset_ptr raster_datasource::features(query const& q) const
|
||||||
}
|
}
|
||||||
else if (width * height > 512*512)
|
else if (width * height > 512*512)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Tiled policy";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Tiled policy";
|
||||||
#endif
|
|
||||||
|
|
||||||
tiled_file_policy policy(filename_, format_, 256, extent_, q.get_bbox(), width_, height_);
|
tiled_file_policy policy(filename_, format_, 256, extent_, q.get_bbox(), width_, height_);
|
||||||
|
|
||||||
|
@ -223,9 +213,7 @@ featureset_ptr raster_datasource::features(query const& q) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Single file";
|
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Single file";
|
||||||
#endif
|
|
||||||
|
|
||||||
raster_info info(filename_, format_, extent_, width_, height_);
|
raster_info info(filename_, format_, extent_, width_, height_);
|
||||||
single_file_policy policy(info);
|
single_file_policy policy(info);
|
||||||
|
@ -236,9 +224,7 @@ featureset_ptr raster_datasource::features(query const& q) const
|
||||||
|
|
||||||
featureset_ptr raster_datasource::features_at_point(coord2d const&) const
|
featureset_ptr raster_datasource::features_at_point(coord2d const&) const
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported";
|
MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported";
|
||||||
#endif
|
|
||||||
|
|
||||||
return featureset_ptr();
|
return featureset_ptr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,8 @@ feature_ptr raster_featureset<LookupPolicy>::next()
|
||||||
{
|
{
|
||||||
std::auto_ptr<image_reader> reader(mapnik::get_image_reader(curIter_->file(),curIter_->format()));
|
std::auto_ptr<image_reader> reader(mapnik::get_image_reader(curIter_->file(),curIter_->format()));
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "raster_featureset: Reader=" << curIter_->format() << "," << curIter_->file()
|
MAPNIK_LOG_DEBUG(raster) << "raster_featureset: Reader=" << curIter_->format() << "," << curIter_->file()
|
||||||
<< ",size(" << curIter_->width() << "," << curIter_->height() << ")";
|
<< ",size(" << curIter_->width() << "," << curIter_->height() << ")";
|
||||||
#endif
|
|
||||||
|
|
||||||
if (reader.get())
|
if (reader.get())
|
||||||
{
|
{
|
||||||
|
|
|
@ -140,9 +140,7 @@ public:
|
||||||
double pixel_x = extent.width() / double(width);
|
double pixel_x = extent.width() / double(width);
|
||||||
double pixel_y = extent.height() / double(height);
|
double pixel_y = extent.height() / double(height);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "tiled_file_policy: Raster Plugin PIXEL SIZE("<< pixel_x << "," << pixel_y << ")";
|
MAPNIK_LOG_DEBUG(raster) << "tiled_file_policy: Raster Plugin PIXEL SIZE("<< pixel_x << "," << pixel_y << ")";
|
||||||
#endif
|
|
||||||
|
|
||||||
box2d<double> e = bbox.intersect(extent);
|
box2d<double> e = bbox.intersect(extent);
|
||||||
|
|
||||||
|
@ -164,9 +162,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "tiled_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file;
|
MAPNIK_LOG_DEBUG(raster) << "tiled_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator begin()
|
const_iterator begin()
|
||||||
|
@ -227,9 +223,7 @@ public:
|
||||||
double pixel_x = extent.width() / double(width);
|
double pixel_x = extent.width() / double(width);
|
||||||
double pixel_y = extent.height() / double(height);
|
double pixel_y = extent.height() / double(height);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "tiled_multi_file_policy: Raster Plugin PIXEL SIZE(" << pixel_x << "," << pixel_y << ")";
|
MAPNIK_LOG_DEBUG(raster) << "tiled_multi_file_policy: Raster Plugin PIXEL SIZE(" << pixel_x << "," << pixel_y << ")";
|
||||||
#endif
|
|
||||||
|
|
||||||
// intersection of query with extent => new query
|
// intersection of query with extent => new query
|
||||||
box2d<double> e = bbox.intersect(extent);
|
box2d<double> e = bbox.intersect(extent);
|
||||||
|
@ -261,9 +255,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(raster) << "tiled_multi_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file_pattern;
|
MAPNIK_LOG_DEBUG(raster) << "tiled_multi_file_policy: Raster Plugin INFO SIZE=" << infos_.size() << " " << file_pattern;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator begin()
|
const_iterator begin()
|
||||||
|
|
|
@ -75,9 +75,7 @@ rasterlite_datasource::rasterlite_datasource(parameters const& params, bool bind
|
||||||
: datasource(params),
|
: datasource(params),
|
||||||
desc_(*params.get<std::string>("type"),"utf-8")
|
desc_(*params.get<std::string>("type"),"utf-8")
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Initializing...";
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_datasource: Initializing...";
|
||||||
#endif
|
|
||||||
|
|
||||||
boost::optional<std::string> file = params.get<std::string>("file");
|
boost::optional<std::string> file = params.get<std::string>("file");
|
||||||
if (!file) throw datasource_exception("missing <file> parameter");
|
if (!file) throw datasource_exception("missing <file> parameter");
|
||||||
|
|
|
@ -55,9 +55,7 @@ rasterlite_featureset::rasterlite_featureset(void* dataset,
|
||||||
|
|
||||||
rasterlite_featureset::~rasterlite_featureset()
|
rasterlite_featureset::~rasterlite_featureset()
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Closing";
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Closing";
|
||||||
#endif
|
|
||||||
|
|
||||||
rasterliteClose(dataset_);
|
rasterliteClose(dataset_);
|
||||||
}
|
}
|
||||||
|
@ -88,9 +86,7 @@ feature_ptr rasterlite_featureset::next()
|
||||||
|
|
||||||
feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Running get_feature";
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Running get_feature";
|
||||||
#endif
|
|
||||||
|
|
||||||
feature_ptr feature(feature_factory::create(ctx_,1));
|
feature_ptr feature(feature_factory::create(ctx_,1));
|
||||||
|
|
||||||
|
@ -106,14 +102,12 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
||||||
const double pixel_size = (intersect.width() >= intersect.height()) ?
|
const double pixel_size = (intersect.width() >= intersect.height()) ?
|
||||||
(intersect.width() / (double) width) : (intersect.height() / (double) height);
|
(intersect.width() / (double) width) : (intersect.height() / (double) height);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Raster extent=" << raster_extent;
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Raster extent=" << raster_extent;
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: View extent=" << q.get_bbox();
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: View extent=" << q.get_bbox();
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Intersect extent=" << intersect;
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Intersect extent=" << intersect;
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution());
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Query resolution=" << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution());
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Size=" << width << " " << height;
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Size=" << width << " " << height;
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Pixel Size=" << pixel_size;
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Pixel Size=" << pixel_size;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (width > 0 && height > 0)
|
if (width > 0 && height > 0)
|
||||||
{
|
{
|
||||||
|
@ -146,9 +140,7 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
||||||
|
|
||||||
free (raster);
|
free (raster);
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Done";
|
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Done";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -140,12 +140,10 @@ void shape_datasource::bind() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
// I - long
|
// I - long
|
||||||
// G - ole
|
// G - ole
|
||||||
// + - autoincrement
|
// + - autoincrement
|
||||||
MAPNIK_LOG_WARN(shape) << "shape_datasource: Unknown type=" << fd.type_;
|
MAPNIK_LOG_WARN(shape) << "shape_datasource: Unknown type=" << fd.type_;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,18 +229,13 @@ void shape_datasource::init(shape_io& shape) const
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
// #ifdef MAPNIK_LOG
|
|
||||||
// MAPNIK_LOG_DEBUG(shape) << "shape_datasource: No .index file found for "
|
// MAPNIK_LOG_DEBUG(shape) << "shape_datasource: No .index file found for "
|
||||||
// << shape_name_ << ".shp, use the 'shapeindex' program to build an index for faster rendering";
|
// << shape_name_ << ".shp, use the 'shapeindex' program to build an index for faster rendering";
|
||||||
// #endif
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Extent=" << extent_;
|
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Extent=" << extent_;
|
||||||
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: File length=" << file_length_;
|
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: File length=" << file_length_;
|
||||||
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Shape type=" << shape_type_;
|
MAPNIK_LOG_DEBUG(shape) << "shape_datasource: Shape type=" << shape_type_;
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string shape_datasource::name()
|
std::string shape_datasource::name()
|
||||||
|
|
|
@ -147,9 +147,8 @@ feature_ptr shape_featureset<filterT>::next()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_;
|
MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_;
|
||||||
#endif
|
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,9 +256,8 @@ feature_ptr shape_featureset<filterT>::next()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_;
|
MAPNIK_LOG_DEBUG(shape) << "shape_featureset: Total shapes read=" << count_;
|
||||||
#endif
|
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,7 @@ shape_index_featureset<filterT>::shape_index_featureset(filterT const& filter,
|
||||||
|
|
||||||
std::sort(ids_.begin(), ids_.end());
|
std::sort(ids_.begin(), ids_.end());
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: Query size=" << ids_.size();
|
MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: Query size=" << ids_.size();
|
||||||
#endif
|
|
||||||
|
|
||||||
itr_ = ids_.begin();
|
itr_ = ids_.begin();
|
||||||
}
|
}
|
||||||
|
@ -202,10 +200,8 @@ feature_ptr shape_index_featureset<filterT>::next()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: " << count_ << " features";
|
MAPNIK_LOG_DEBUG(shape) << "shape_index_featureset: " << count_ << " features";
|
||||||
#endif
|
|
||||||
return feature_ptr();
|
return feature_ptr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,7 @@ shape_io::shape_io(const std::string& shape_name, bool open_index)
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(shape) << "shape_io: Could not open index=" << shape_name << INDEX;
|
MAPNIK_LOG_WARN(shape) << "shape_io: Could not open index=" << shape_name << INDEX;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,9 +215,8 @@ void sqlite_datasource::bind() const
|
||||||
for (std::vector<std::string>::const_iterator iter = init_statements_.begin();
|
for (std::vector<std::string>::const_iterator iter = init_statements_.begin();
|
||||||
iter != init_statements_.end(); ++iter)
|
iter != init_statements_.end(); ++iter)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: Execute init sql=" << *iter;
|
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: Execute init sql=" << *iter;
|
||||||
#endif
|
|
||||||
dataset_->execute(*iter);
|
dataset_->execute(*iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,9 +612,7 @@ featureset_ptr sqlite_datasource::features(query const& q) const
|
||||||
s << " OFFSET " << row_offset_;
|
s << " OFFSET " << row_offset_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
boost::shared_ptr<sqlite_resultset> rs(dataset_->execute_query(s.str()));
|
boost::shared_ptr<sqlite_resultset> rs(dataset_->execute_query(s.str()));
|
||||||
|
|
||||||
|
@ -697,9 +694,7 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt) const
|
||||||
s << " OFFSET " << row_offset_;
|
s << " OFFSET " << row_offset_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str();
|
MAPNIK_LOG_DEBUG(sqlite) << "sqlite_datasource: " << s.str();
|
||||||
#endif
|
|
||||||
|
|
||||||
boost::shared_ptr<sqlite_resultset> rs(dataset_->execute_query(s.str()));
|
boost::shared_ptr<sqlite_resultset> rs(dataset_->execute_query(s.str()));
|
||||||
|
|
||||||
|
|
|
@ -125,9 +125,7 @@ feature_ptr sqlite_featureset::next()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_LOG
|
|
||||||
MAPNIK_LOG_WARN(sqlite) << "sqlite_featureset: Field=" << fld_name_str << " unhandled type_oid=" << type_oid;
|
MAPNIK_LOG_WARN(sqlite) << "sqlite_featureset: Field=" << fld_name_str << " unhandled type_oid=" << type_oid;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,14 +23,46 @@
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/debug.hpp>
|
#include <mapnik/debug.hpp>
|
||||||
|
|
||||||
|
// stl
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
#ifndef MAPNIK_LOG_FORMAT
|
||||||
|
#define MAPNIK_LOG_FORMAT "Mapnik LOG> %Y-%m-%d %H:%M:%S:"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace mapnik { namespace logger {
|
namespace mapnik { namespace logger {
|
||||||
|
|
||||||
|
// severity
|
||||||
|
|
||||||
severity::type severity::severity_level_ =
|
severity::type severity::severity_level_ =
|
||||||
MAPNIK_DEBUG_AS_BOOL ? severity::debug : severity::error;
|
#ifdef MAPNIK_DEBUG
|
||||||
|
severity::debug
|
||||||
|
#else
|
||||||
|
severity::error
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
severity::severity_map severity::object_severity_level_ = severity::severity_map();
|
severity::severity_map severity::object_severity_level_ = severity::severity_map();
|
||||||
|
|
||||||
|
|
||||||
|
// format
|
||||||
|
|
||||||
|
#define __xstr__(s) __str__(s)
|
||||||
|
#define __str__(s) #s
|
||||||
|
|
||||||
|
std::string format::format_ = __xstr__(MAPNIK_LOG_FORMAT);
|
||||||
|
|
||||||
|
#undef __xstr__
|
||||||
|
#undef __str__
|
||||||
|
|
||||||
|
std::string format::str()
|
||||||
|
{
|
||||||
|
char buf[256];
|
||||||
|
const time_t tm = time(0);
|
||||||
|
strftime(buf, sizeof(buf), format::format_.c_str(), localtime(&tm));
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
// #define MAPNIK_DEBUG_WKB
|
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
struct wkb_reader : boost::noncopyable
|
struct wkb_reader : boost::noncopyable
|
||||||
|
@ -115,9 +113,7 @@ public:
|
||||||
{
|
{
|
||||||
int type = read_integer();
|
int type = read_integer();
|
||||||
|
|
||||||
#if defined(MAPNIK_LOG) && defined(MAPNIK_DEBUG_WKB)
|
MAPNIK_LOG_DEBUG(wkb_reader) << "wkb_reader: Read=" << wkb_geometry_type_string(type) << "," << type;
|
||||||
mapnik::log() << "wkb_reader: Read=" << wkb_geometry_type_string(type) << "," << type;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -405,7 +401,6 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MAPNIK_LOG) && defined(MAPNIK_DEBUG_WKB)
|
|
||||||
std::string wkb_geometry_type_string(int type)
|
std::string wkb_geometry_type_string(int type)
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
@ -431,8 +426,6 @@ private:
|
||||||
|
|
||||||
return s.str();
|
return s.str();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void geometry_utils::from_wkb (boost::ptr_vector<geometry_type>& paths,
|
void geometry_utils::from_wkb (boost::ptr_vector<geometry_type>& paths,
|
||||||
|
|
Loading…
Reference in a new issue