Merge branch 'master' of github.com:mapnik/mapnik
This commit is contained in:
commit
95264a2dcb
39 changed files with 283 additions and 881 deletions
|
@ -45,7 +45,7 @@ using mapnik::from_wkt;
|
||||||
|
|
||||||
void feature_add_geometries_from_wkb(Feature &feature, std::string wkb)
|
void feature_add_geometries_from_wkb(Feature &feature, std::string wkb)
|
||||||
{
|
{
|
||||||
geometry_utils::from_wkb(feature.paths(), wkb.c_str(), wkb.size(), true);
|
geometry_utils::from_wkb(feature.paths(), wkb.c_str(), wkb.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void feature_add_geometries_from_wkt(Feature &feature, std::string wkt)
|
void feature_add_geometries_from_wkt(Feature &feature, std::string wkt)
|
||||||
|
|
|
@ -62,7 +62,7 @@ void add_wkt_impl(path_type& p, std::string const& wkt)
|
||||||
|
|
||||||
void add_wkb_impl(path_type& p, std::string const& wkb)
|
void add_wkb_impl(path_type& p, std::string const& wkb)
|
||||||
{
|
{
|
||||||
mapnik::geometry_utils::from_wkb(p, wkb.c_str(), wkb.size(), true);
|
mapnik::geometry_utils::from_wkb(p, wkb.c_str(), wkb.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<path_type> from_wkt_impl(std::string const& wkt)
|
boost::shared_ptr<path_type> from_wkt_impl(std::string const& wkt)
|
||||||
|
@ -76,7 +76,7 @@ boost::shared_ptr<path_type> from_wkt_impl(std::string const& wkt)
|
||||||
boost::shared_ptr<path_type> from_wkb_impl(std::string const& wkb)
|
boost::shared_ptr<path_type> from_wkb_impl(std::string const& wkb)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<path_type> paths = boost::make_shared<path_type>();
|
boost::shared_ptr<path_type> paths = boost::make_shared<path_type>();
|
||||||
mapnik::geometry_utils::from_wkb(*paths, wkb.c_str(), wkb.size(), true);
|
mapnik::geometry_utils::from_wkb(*paths, wkb.c_str(), wkb.size());
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,24 @@ std::string to_wkt( geometry_type const& geom)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string to_wkt2( path_type const& geom)
|
||||||
|
{
|
||||||
|
#if BOOST_VERSION >= 104700
|
||||||
|
std::string wkt; // Use Python String directly ?
|
||||||
|
bool result = mapnik::util::to_wkt(wkt,geom);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Generate WKT failed");
|
||||||
|
}
|
||||||
|
return wkt;
|
||||||
|
#else
|
||||||
|
std::ostringstream s;
|
||||||
|
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||||
|
throw std::runtime_error("mapnik::to_wkt() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void export_geometry()
|
void export_geometry()
|
||||||
{
|
{
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
|
@ -125,11 +143,8 @@ void export_geometry()
|
||||||
.value("Point",mapnik::Point)
|
.value("Point",mapnik::Point)
|
||||||
.value("LineString",mapnik::LineString)
|
.value("LineString",mapnik::LineString)
|
||||||
.value("Polygon",mapnik::Polygon)
|
.value("Polygon",mapnik::Polygon)
|
||||||
.value("MultiPoint",mapnik::MultiPoint)
|
|
||||||
.value("MultiLineString",mapnik::MultiLineString)
|
|
||||||
.value("MultiPolygon",mapnik::MultiPolygon)
|
|
||||||
;
|
;
|
||||||
|
|
||||||
using mapnik::geometry_type;
|
using mapnik::geometry_type;
|
||||||
class_<geometry_type, std::auto_ptr<geometry_type>, boost::noncopyable>("Geometry2d",no_init)
|
class_<geometry_type, std::auto_ptr<geometry_type>, boost::noncopyable>("Geometry2d",no_init)
|
||||||
.def("envelope",&geometry_type::envelope)
|
.def("envelope",&geometry_type::envelope)
|
||||||
|
@ -145,6 +160,7 @@ void export_geometry()
|
||||||
.def("__len__", &path_type::size)
|
.def("__len__", &path_type::size)
|
||||||
.def("add_wkt",add_wkt_impl)
|
.def("add_wkt",add_wkt_impl)
|
||||||
.def("add_wkb",add_wkb_impl)
|
.def("add_wkb",add_wkb_impl)
|
||||||
|
.def("to_wkt",&to_wkt2)
|
||||||
.def("from_wkt",from_wkt_impl)
|
.def("from_wkt",from_wkt_impl)
|
||||||
.def("from_wkb",from_wkb_impl)
|
.def("from_wkb",from_wkb_impl)
|
||||||
.staticmethod("from_wkt")
|
.staticmethod("from_wkt")
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct layer_pickle_suite : boost::python::pickle_suite
|
||||||
{
|
{
|
||||||
s.append(style_names[i]);
|
s.append(style_names[i]);
|
||||||
}
|
}
|
||||||
return boost::python::make_tuple(l.abstract(),l.title(),l.clear_label_cache(),l.getMinZoom(),l.getMaxZoom(),l.isQueryable(),l.datasource()->params(),l.cache_features(),s);
|
return boost::python::make_tuple(l.clear_label_cache(),l.getMinZoom(),l.getMaxZoom(),l.isQueryable(),l.datasource()->params(),l.cache_features(),s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -70,28 +70,24 @@ struct layer_pickle_suite : boost::python::pickle_suite
|
||||||
throw_error_already_set();
|
throw_error_already_set();
|
||||||
}
|
}
|
||||||
|
|
||||||
l.set_abstract(extract<std::string>(state[0]));
|
l.set_clear_label_cache(extract<bool>(state[0]));
|
||||||
|
|
||||||
l.set_title(extract<std::string>(state[1]));
|
l.setMinZoom(extract<double>(state[1]));
|
||||||
|
|
||||||
l.set_clear_label_cache(extract<bool>(state[2]));
|
l.setMaxZoom(extract<double>(state[2]));
|
||||||
|
|
||||||
l.setMinZoom(extract<double>(state[3]));
|
l.setQueryable(extract<bool>(state[3]));
|
||||||
|
|
||||||
l.setMaxZoom(extract<double>(state[4]));
|
mapnik::parameters params = extract<parameters>(state[4]);
|
||||||
|
|
||||||
l.setQueryable(extract<bool>(state[5]));
|
|
||||||
|
|
||||||
mapnik::parameters params = extract<parameters>(state[6]);
|
|
||||||
l.set_datasource(datasource_cache::instance()->create(params));
|
l.set_datasource(datasource_cache::instance()->create(params));
|
||||||
|
|
||||||
boost::python::list s = extract<boost::python::list>(state[7]);
|
boost::python::list s = extract<boost::python::list>(state[5]);
|
||||||
for (int i=0;i<len(s);++i)
|
for (int i=0;i<len(s);++i)
|
||||||
{
|
{
|
||||||
l.add_style(extract<std::string>(s[i]));
|
l.add_style(extract<std::string>(s[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
l.set_cache_features(extract<bool>(state[8]));
|
l.set_cache_features(extract<bool>(state[6]));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,21 +148,6 @@ void export_layer()
|
||||||
"False\n"
|
"False\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
.add_property("abstract",
|
|
||||||
make_function(&layer::abstract,return_value_policy<copy_const_reference>()),
|
|
||||||
&layer::set_abstract,
|
|
||||||
"Get/Set the abstract of the layer.\n"
|
|
||||||
"\n"
|
|
||||||
"Usage:\n"
|
|
||||||
">>> from mapnik import Layer\n"
|
|
||||||
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
|
||||||
">>> lyr.abstract\n"
|
|
||||||
"'' # default is en empty string\n"
|
|
||||||
">>> lyr.abstract = 'My Shapefile rendered with Mapnik'\n"
|
|
||||||
">>> lyr.abstract\n"
|
|
||||||
"'My Shapefile rendered with Mapnik'\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
.add_property("active",
|
.add_property("active",
|
||||||
&layer::isActive,
|
&layer::isActive,
|
||||||
&layer::setActive,
|
&layer::setActive,
|
||||||
|
@ -310,20 +291,5 @@ void export_layer()
|
||||||
"'My Style'\n"
|
"'My Style'\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
.add_property("title",
|
|
||||||
make_function(&layer::title, return_value_policy<copy_const_reference>()),
|
|
||||||
&layer::set_title,
|
|
||||||
"Get/Set the title of the layer.\n"
|
|
||||||
"\n"
|
|
||||||
"Usage:\n"
|
|
||||||
">>> from mapnik import layer\n"
|
|
||||||
">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
|
|
||||||
">>> lyr.title\n"
|
|
||||||
"''\n"
|
|
||||||
">>> lyr.title = 'My first layer'\n"
|
|
||||||
">>> lyr.title\n"
|
|
||||||
"'My first layer'\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct rule_pickle_suite : boost::python::pickle_suite
|
||||||
static boost::python::tuple
|
static boost::python::tuple
|
||||||
getinitargs(const rule& r)
|
getinitargs(const rule& r)
|
||||||
{
|
{
|
||||||
return boost::python::make_tuple(r.get_name(),r.get_title(),r.get_min_scale(),r.get_max_scale());
|
return boost::python::make_tuple(r.get_name(),r.get_min_scale(),r.get_max_scale());
|
||||||
}
|
}
|
||||||
|
|
||||||
static boost::python::tuple
|
static boost::python::tuple
|
||||||
|
@ -102,7 +102,7 @@ struct rule_pickle_suite : boost::python::pickle_suite
|
||||||
// We serialize filter expressions AST as strings
|
// We serialize filter expressions AST as strings
|
||||||
std::string filter_expr = to_expression_string(*r.get_filter());
|
std::string filter_expr = to_expression_string(*r.get_filter());
|
||||||
|
|
||||||
return boost::python::make_tuple(r.get_abstract(),filter_expr,r.has_else_filter(),r.has_also_filter(),syms);
|
return boost::python::make_tuple(filter_expr,r.has_else_filter(),r.has_also_filter(),syms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -119,11 +119,6 @@ struct rule_pickle_suite : boost::python::pickle_suite
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state[0])
|
if (state[0])
|
||||||
{
|
|
||||||
r.set_title(extract<std::string>(state[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state[1])
|
|
||||||
{
|
{
|
||||||
rule dfl;
|
rule dfl;
|
||||||
std::string filter = extract<std::string>(state[1]);
|
std::string filter = extract<std::string>(state[1]);
|
||||||
|
@ -134,12 +129,12 @@ struct rule_pickle_suite : boost::python::pickle_suite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state[2])
|
if (state[1])
|
||||||
{
|
{
|
||||||
r.set_else(true);
|
r.set_else(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state[3])
|
if (state[2])
|
||||||
{
|
{
|
||||||
r.set_also(true);
|
r.set_also(true);
|
||||||
}
|
}
|
||||||
|
@ -176,18 +171,12 @@ void export_rule()
|
||||||
|
|
||||||
class_<rule>("Rule",init<>("default constructor"))
|
class_<rule>("Rule",init<>("default constructor"))
|
||||||
.def(init<std::string const&,
|
.def(init<std::string const&,
|
||||||
boost::python::optional<std::string const&,double,double> >())
|
boost::python::optional<double,double> >())
|
||||||
.def_pickle(rule_pickle_suite())
|
.def_pickle(rule_pickle_suite())
|
||||||
.add_property("name",make_function
|
.add_property("name",make_function
|
||||||
(&rule::get_name,
|
(&rule::get_name,
|
||||||
return_value_policy<copy_const_reference>()),
|
return_value_policy<copy_const_reference>()),
|
||||||
&rule::set_name)
|
&rule::set_name)
|
||||||
.add_property("title",make_function
|
|
||||||
(&rule::get_title,return_value_policy<copy_const_reference>()),
|
|
||||||
&rule::set_title)
|
|
||||||
.add_property("abstract",make_function
|
|
||||||
(&rule::get_abstract,return_value_policy<copy_const_reference>()),
|
|
||||||
&rule::set_abstract)
|
|
||||||
.add_property("filter",make_function
|
.add_property("filter",make_function
|
||||||
(&rule::get_filter,return_value_policy<copy_const_reference>()),
|
(&rule::get_filter,return_value_policy<copy_const_reference>()),
|
||||||
&rule::set_filter)
|
&rule::set_filter)
|
||||||
|
|
|
@ -36,29 +36,24 @@ namespace mapnik {
|
||||||
|
|
||||||
enum eGeomType {
|
enum eGeomType {
|
||||||
Point = 1,
|
Point = 1,
|
||||||
LineString,
|
LineString = 2,
|
||||||
Polygon,
|
Polygon = 3
|
||||||
MultiPoint,
|
|
||||||
MultiLineString,
|
|
||||||
MultiPolygon
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename T, template <typename> class Container=vertex_vector>
|
template <typename T, template <typename> class Container=vertex_vector>
|
||||||
class geometry
|
class geometry : private::boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef T coord_type;
|
typedef T coord_type;
|
||||||
typedef Container<coord_type> container_type;
|
typedef Container<coord_type> container_type;
|
||||||
typedef typename container_type::value_type value_type;
|
typedef typename container_type::value_type value_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
container_type cont_;
|
container_type cont_;
|
||||||
eGeomType type_;
|
eGeomType type_;
|
||||||
mutable unsigned itr_;
|
mutable unsigned itr_;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
geometry(eGeomType type)
|
explicit geometry(eGeomType type)
|
||||||
: type_(type),
|
: type_(type),
|
||||||
itr_(0)
|
itr_(0)
|
||||||
{}
|
{}
|
||||||
|
@ -168,12 +163,12 @@ public:
|
||||||
*/
|
*/
|
||||||
void label_position(double *x, double *y) const
|
void label_position(double *x, double *y) const
|
||||||
{
|
{
|
||||||
if (type_ == LineString || type_ == MultiLineString)
|
if (type_ == LineString)
|
||||||
{
|
{
|
||||||
middle_point(x,y);
|
middle_point(x,y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned size = cont_.size();
|
unsigned size = cont_.size();
|
||||||
if (size < 3)
|
if (size < 3)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +227,7 @@ public:
|
||||||
/* summarized distance centroid */
|
/* summarized distance centroid */
|
||||||
void label_position3(double *x, double *y) const
|
void label_position3(double *x, double *y) const
|
||||||
{
|
{
|
||||||
if (type_ == LineString || type_ == MultiLineString)
|
if (type_ == LineString)
|
||||||
{
|
{
|
||||||
middle_point(x,y);
|
middle_point(x,y);
|
||||||
return;
|
return;
|
||||||
|
@ -392,7 +387,7 @@ public:
|
||||||
|
|
||||||
typedef geometry<double,vertex_vector> geometry_type;
|
typedef geometry<double,vertex_vector> geometry_type;
|
||||||
typedef boost::shared_ptr<geometry_type> geometry_ptr;
|
typedef boost::shared_ptr<geometry_type> geometry_ptr;
|
||||||
typedef boost::ptr_vector<geometry_type> geometry_containter;
|
typedef boost::ptr_vector<geometry_type> geometry_container;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,32 +52,13 @@ public:
|
||||||
* @brief Set the name of the layer.
|
* @brief Set the name of the layer.
|
||||||
*/
|
*/
|
||||||
void set_name(std::string const& name);
|
void set_name(std::string const& name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @return the name of the layer.
|
* @return the name of the layer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const std::string& name() const;
|
const std::string& name() const;
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Set the title of the layer.
|
|
||||||
*/
|
|
||||||
void set_title(std::string const& title);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @return the title of the layer.
|
|
||||||
*/
|
|
||||||
const std::string& title() const;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Set the abstract of the layer.
|
|
||||||
*/
|
|
||||||
void set_abstract(std::string const& abstract);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @return the abstract of the layer.
|
|
||||||
*/
|
|
||||||
const std::string& abstract() const;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Set the SRS of the layer.
|
* @brief Set the SRS of the layer.
|
||||||
*/
|
*/
|
||||||
|
@ -212,10 +193,8 @@ private:
|
||||||
void swap(const layer& other);
|
void swap(const layer& other);
|
||||||
|
|
||||||
std::string name_;
|
std::string name_;
|
||||||
std::string title_;
|
|
||||||
std::string abstract_;
|
|
||||||
std::string srs_;
|
std::string srs_;
|
||||||
|
|
||||||
double minZoom_;
|
double minZoom_;
|
||||||
double maxZoom_;
|
double maxZoom_;
|
||||||
bool active_;
|
bool active_;
|
||||||
|
|
|
@ -132,8 +132,6 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string name_;
|
std::string name_;
|
||||||
std::string title_;
|
|
||||||
std::string abstract_;
|
|
||||||
double min_scale_;
|
double min_scale_;
|
||||||
double max_scale_;
|
double max_scale_;
|
||||||
symbolizers syms_;
|
symbolizers syms_;
|
||||||
|
@ -143,8 +141,6 @@ private:
|
||||||
public:
|
public:
|
||||||
rule()
|
rule()
|
||||||
: name_(),
|
: name_(),
|
||||||
title_(),
|
|
||||||
abstract_(),
|
|
||||||
min_scale_(0),
|
min_scale_(0),
|
||||||
max_scale_(std::numeric_limits<double>::infinity()),
|
max_scale_(std::numeric_limits<double>::infinity()),
|
||||||
syms_(),
|
syms_(),
|
||||||
|
@ -153,11 +149,9 @@ public:
|
||||||
also_filter_(false) {}
|
also_filter_(false) {}
|
||||||
|
|
||||||
rule(const std::string& name,
|
rule(const std::string& name,
|
||||||
const std::string& title="",
|
|
||||||
double min_scale_denominator=0,
|
double min_scale_denominator=0,
|
||||||
double max_scale_denominator=std::numeric_limits<double>::infinity())
|
double max_scale_denominator=std::numeric_limits<double>::infinity())
|
||||||
: name_(name),
|
: name_(name),
|
||||||
title_(title),
|
|
||||||
min_scale_(min_scale_denominator),
|
min_scale_(min_scale_denominator),
|
||||||
max_scale_(max_scale_denominator),
|
max_scale_(max_scale_denominator),
|
||||||
syms_(),
|
syms_(),
|
||||||
|
@ -167,8 +161,6 @@ public:
|
||||||
|
|
||||||
rule(const rule& rhs, bool deep_copy = false)
|
rule(const rule& rhs, bool deep_copy = false)
|
||||||
: name_(rhs.name_),
|
: name_(rhs.name_),
|
||||||
title_(rhs.title_),
|
|
||||||
abstract_(rhs.abstract_),
|
|
||||||
min_scale_(rhs.min_scale_),
|
min_scale_(rhs.min_scale_),
|
||||||
max_scale_(rhs.max_scale_),
|
max_scale_(rhs.max_scale_),
|
||||||
syms_(rhs.syms_),
|
syms_(rhs.syms_),
|
||||||
|
@ -263,27 +255,7 @@ public:
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& get_title() const
|
|
||||||
{
|
|
||||||
return title_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_title(std::string const& title)
|
|
||||||
{
|
|
||||||
title_=title;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_abstract(std::string const& abstract)
|
|
||||||
{
|
|
||||||
abstract_=abstract;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string const& get_abstract() const
|
|
||||||
{
|
|
||||||
return abstract_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void append(const symbolizer& sym)
|
void append(const symbolizer& sym)
|
||||||
{
|
{
|
||||||
syms_.push_back(sym);
|
syms_.push_back(sym);
|
||||||
|
@ -362,8 +334,6 @@ private:
|
||||||
void swap(rule& rhs) throw()
|
void swap(rule& rhs) throw()
|
||||||
{
|
{
|
||||||
name_=rhs.name_;
|
name_=rhs.name_;
|
||||||
title_=rhs.title_;
|
|
||||||
abstract_=rhs.abstract_;
|
|
||||||
min_scale_=rhs.min_scale_;
|
min_scale_=rhs.min_scale_;
|
||||||
max_scale_=rhs.max_scale_;
|
max_scale_=rhs.max_scale_;
|
||||||
syms_=rhs.syms_;
|
syms_=rhs.syms_;
|
||||||
|
|
|
@ -219,10 +219,6 @@ wkb_buffer_ptr to_wkb(geometry_type const& g, wkbByteOrder byte_order )
|
||||||
case mapnik::Polygon:
|
case mapnik::Polygon:
|
||||||
wkb = to_polygon_wkb(g, byte_order);
|
wkb = to_polygon_wkb(g, byte_order);
|
||||||
break;
|
break;
|
||||||
case mapnik::MultiPoint:
|
|
||||||
case mapnik::MultiLineString:
|
|
||||||
case mapnik::MultiPolygon:
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,16 @@ bool to_wkt(std::string & wkt, mapnik::geometry_type const& geom)
|
||||||
{
|
{
|
||||||
typedef std::back_insert_iterator<std::string> sink_type;
|
typedef std::back_insert_iterator<std::string> sink_type;
|
||||||
sink_type sink(wkt);
|
sink_type sink(wkt);
|
||||||
wkt_generator<sink_type> generator;
|
wkt_generator<sink_type> generator(true);
|
||||||
|
bool result = karma::generate(sink, generator, geom);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool to_wkt(std::string & wkt, mapnik::geometry_container const& geom)
|
||||||
|
{
|
||||||
|
typedef std::back_insert_iterator<std::string> sink_type;
|
||||||
|
sink_type sink(wkt);
|
||||||
|
wkt_multi_generator<sink_type> generator;
|
||||||
bool result = karma::generate(sink, generator, geom);
|
bool result = karma::generate(sink, generator, geom);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <mapnik/geometry.hpp>
|
#include <mapnik/geometry.hpp>
|
||||||
#include <mapnik/util/vertex_iterator.hpp>
|
#include <mapnik/util/vertex_iterator.hpp>
|
||||||
#include <mapnik/util/container_adapter.hpp>
|
#include <mapnik/util/container_adapter.hpp>
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/spirit/include/karma.hpp>
|
#include <boost/spirit/include/karma.hpp>
|
||||||
|
@ -49,6 +48,8 @@ namespace mapnik { namespace util {
|
||||||
namespace karma = boost::spirit::karma;
|
namespace karma = boost::spirit::karma;
|
||||||
namespace phoenix = boost::phoenix;
|
namespace phoenix = boost::phoenix;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
struct get_type
|
struct get_type
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -73,21 +74,61 @@ struct get_first
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct multi_geometry_
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
struct result { typedef bool type; };
|
||||||
|
|
||||||
|
bool operator() (geometry_container const& geom) const
|
||||||
|
{
|
||||||
|
return geom.size() > 1 ? true : false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct multi_geometry_type
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
struct result { typedef boost::tuple<unsigned,bool> type; };
|
||||||
|
|
||||||
|
boost::tuple<unsigned,bool> operator() (geometry_container const& geom) const
|
||||||
|
{
|
||||||
|
unsigned type = 0u;
|
||||||
|
bool collection = false;
|
||||||
|
|
||||||
|
geometry_container::const_iterator itr = geom.begin();
|
||||||
|
geometry_container::const_iterator end = geom.end();
|
||||||
|
|
||||||
|
for ( ; itr != end; ++itr)
|
||||||
|
{
|
||||||
|
if (type != 0 && itr->type() != type)
|
||||||
|
{
|
||||||
|
collection = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
type = itr->type();
|
||||||
|
}
|
||||||
|
return boost::tuple<unsigned,bool>(type, collection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct coordinate_policy : karma::real_policies<T>
|
struct wkt_coordinate_policy : karma::real_policies<T>
|
||||||
{
|
{
|
||||||
typedef boost::spirit::karma::real_policies<T> base_type;
|
typedef boost::spirit::karma::real_policies<T> base_type;
|
||||||
static int floatfield(T n) { return base_type::fmtflags::fixed; }
|
static int floatfield(T n) { return base_type::fmtflags::fixed; }
|
||||||
static unsigned precision(T n) { return 6u ;}
|
static unsigned precision(T n) { return 6 ;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
template <typename OutputIterator>
|
template <typename OutputIterator>
|
||||||
struct wkt_generator :
|
struct wkt_generator :
|
||||||
karma::grammar<OutputIterator, geometry_type const& ()>
|
karma::grammar<OutputIterator, geometry_type const& ()>
|
||||||
{
|
{
|
||||||
|
|
||||||
wkt_generator()
|
wkt_generator(bool single = false)
|
||||||
: wkt_generator::base_type(wkt)
|
: wkt_generator::base_type(wkt)
|
||||||
{
|
{
|
||||||
using boost::spirit::karma::uint_;
|
using boost::spirit::karma::uint_;
|
||||||
|
@ -97,22 +138,27 @@ struct wkt_generator :
|
||||||
using boost::spirit::karma::_a;
|
using boost::spirit::karma::_a;
|
||||||
using boost::spirit::karma::_r1;
|
using boost::spirit::karma::_r1;
|
||||||
using boost::spirit::karma::eps;
|
using boost::spirit::karma::eps;
|
||||||
|
using boost::spirit::karma::string;
|
||||||
|
|
||||||
wkt = point | linestring | polygon
|
wkt = point | linestring | polygon
|
||||||
;
|
;
|
||||||
|
|
||||||
point = &uint_(mapnik::Point)[_1 = _type(_val)]
|
point = &uint_(mapnik::Point)[_1 = _type(_val)]
|
||||||
<< lit("Point(") << point_coord [_1 = _first(_val)] << lit(')')
|
<< string[ phoenix::if_ (single) [_1 = "Point("]
|
||||||
|
.else_[_1 = "("]]
|
||||||
|
<< point_coord [_1 = _first(_val)] << lit(')')
|
||||||
;
|
;
|
||||||
|
|
||||||
linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
|
linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
|
||||||
<< lit("LineString(")
|
<< string[ phoenix::if_ (single) [_1 = "LineString("]
|
||||||
|
.else_[_1 = "("]]
|
||||||
<< coords
|
<< coords
|
||||||
<< lit(')')
|
<< lit(')')
|
||||||
;
|
;
|
||||||
|
|
||||||
polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
|
polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
|
||||||
<< lit("Polygon(")
|
<< string[ phoenix::if_ (single) [_1 = "Polygon("]
|
||||||
|
.else_[_1 = "("]]
|
||||||
<< coords2
|
<< coords2
|
||||||
<< lit("))")
|
<< lit("))")
|
||||||
;
|
;
|
||||||
|
@ -121,8 +167,8 @@ struct wkt_generator :
|
||||||
;
|
;
|
||||||
|
|
||||||
polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1]
|
polygon_coord %= ( &uint_(mapnik::SEG_MOVETO) << eps[_r1 += 1]
|
||||||
<< karma::string[ if_ (_r1 > 1) [_1 = "),("]
|
<< string[ if_ (_r1 > 1) [_1 = "),("]
|
||||||
.else_[_1 = "("] ] | &uint_ << ",")
|
.else_[_1 = "("] ] | &uint_ << ",")
|
||||||
<< coord_type
|
<< coord_type
|
||||||
<< lit(' ')
|
<< lit(' ')
|
||||||
<< coord_type
|
<< coord_type
|
||||||
|
@ -144,16 +190,69 @@ struct wkt_generator :
|
||||||
karma::rule<OutputIterator, geometry_type const& ()> coords;
|
karma::rule<OutputIterator, geometry_type const& ()> coords;
|
||||||
karma::rule<OutputIterator, karma::locals<unsigned>, geometry_type const& ()> coords2;
|
karma::rule<OutputIterator, karma::locals<unsigned>, geometry_type const& ()> coords2;
|
||||||
karma::rule<OutputIterator, geometry_type::value_type ()> point_coord;
|
karma::rule<OutputIterator, geometry_type::value_type ()> point_coord;
|
||||||
karma::rule<OutputIterator, geometry_type::value_type const& (unsigned& )> polygon_coord;
|
karma::rule<OutputIterator, geometry_type::value_type (unsigned& )> polygon_coord;
|
||||||
|
|
||||||
// phoenix functions
|
// phoenix functions
|
||||||
phoenix::function<get_type > _type;
|
phoenix::function<get_type > _type;
|
||||||
phoenix::function<get_first> _first;
|
phoenix::function<get_first> _first;
|
||||||
//
|
//
|
||||||
karma::real_generator<double, coordinate_policy<double> > coord_type;
|
karma::real_generator<double, wkt_coordinate_policy<double> > coord_type;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template <typename OutputIterator>
|
||||||
|
struct wkt_multi_generator :
|
||||||
|
karma::grammar<OutputIterator, karma::locals< boost::tuple<unsigned,bool> >, geometry_container const& ()>
|
||||||
|
{
|
||||||
|
|
||||||
|
wkt_multi_generator()
|
||||||
|
: wkt_multi_generator::base_type(wkt)
|
||||||
|
{
|
||||||
|
using boost::spirit::karma::lit;
|
||||||
|
using boost::spirit::karma::eps;
|
||||||
|
using boost::spirit::karma::_val;
|
||||||
|
using boost::spirit::karma::_1;
|
||||||
|
using boost::spirit::karma::_a;
|
||||||
|
|
||||||
|
geometry_types.add
|
||||||
|
(mapnik::Point,"Point")
|
||||||
|
(mapnik::LineString,"LineString")
|
||||||
|
(mapnik::Polygon,"Polygon")
|
||||||
|
;
|
||||||
|
|
||||||
|
wkt = eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)]
|
||||||
|
<< lit("GeometryCollection(") << geometry << lit(")")
|
||||||
|
| eps(is_multi(_val)) << lit("Multi") << geometry_types[_1 = phoenix::at_c<0>(_a)]
|
||||||
|
<< "(" << multi_geometry << ")"
|
||||||
|
| geometry
|
||||||
|
;
|
||||||
|
|
||||||
|
geometry = -(single_geometry % lit(','))
|
||||||
|
;
|
||||||
|
|
||||||
|
single_geometry = geometry_types[_1 = _type(_val)] << path
|
||||||
|
;
|
||||||
|
|
||||||
|
multi_geometry = -(path % lit(','))
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
// rules
|
||||||
|
karma::rule<OutputIterator, karma::locals<boost::tuple<unsigned,bool> >, geometry_container const& ()> wkt;
|
||||||
|
karma::rule<OutputIterator, geometry_container const& ()> geometry;
|
||||||
|
karma::rule<OutputIterator, geometry_type const& ()> single_geometry;
|
||||||
|
karma::rule<OutputIterator, geometry_container const& ()> multi_geometry;
|
||||||
|
wkt_generator<OutputIterator> path;
|
||||||
|
// phoenix
|
||||||
|
phoenix::function<multi_geometry_> is_multi;
|
||||||
|
phoenix::function<multi_geometry_type> _multi_type;
|
||||||
|
phoenix::function<get_type > _type;
|
||||||
|
//
|
||||||
|
karma::symbols<unsigned, char const*> geometry_types;
|
||||||
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <mapnik/geometry.hpp>
|
#include <mapnik/geometry.hpp>
|
||||||
#include <mapnik/ctrans.hpp>
|
#include <mapnik/ctrans.hpp>
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
|
// boost
|
||||||
|
#include <boost/utility.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -49,19 +51,14 @@ enum wkbFormat
|
||||||
wkbSpatiaLite=3
|
wkbSpatiaLite=3
|
||||||
};
|
};
|
||||||
|
|
||||||
class MAPNIK_DECL geometry_utils
|
class MAPNIK_DECL geometry_utils : private boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void from_wkb (boost::ptr_vector<geometry_type>& paths,
|
static void from_wkb (boost::ptr_vector<geometry_type>& paths,
|
||||||
const char* wkb,
|
const char* wkb,
|
||||||
unsigned size,
|
unsigned size,
|
||||||
bool multiple_geometries = false,
|
|
||||||
wkbFormat format = wkbGeneric);
|
wkbFormat format = wkbGeneric);
|
||||||
private:
|
|
||||||
geometry_utils();
|
|
||||||
geometry_utils(geometry_utils const&);
|
|
||||||
geometry_utils& operator=(const geometry_utils&);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,9 +97,7 @@ geos_datasource::geos_datasource(parameters const& params, bool bind)
|
||||||
boost::optional<std::string> geometry = params.get<std::string>("wkt");
|
boost::optional<std::string> geometry = params.get<std::string>("wkt");
|
||||||
if (! geometry) throw datasource_exception("missing <wkt> parameter");
|
if (! geometry) throw datasource_exception("missing <wkt> parameter");
|
||||||
geometry_string_ = *geometry;
|
geometry_string_ = *geometry;
|
||||||
|
|
||||||
multiple_geometries_ = *params_.get<mapnik::boolean>("multiple_geometries",false);
|
|
||||||
|
|
||||||
boost::optional<std::string> ext = params_.get<std::string>("extent");
|
boost::optional<std::string> ext = params_.get<std::string>("extent");
|
||||||
if (ext) extent_initialized_ = extent_.from_string(*ext);
|
if (ext) extent_initialized_ = extent_.from_string(*ext);
|
||||||
|
|
||||||
|
@ -270,8 +268,7 @@ featureset_ptr geos_datasource::features(query const& q) const
|
||||||
geometry_id_,
|
geometry_id_,
|
||||||
geometry_data_,
|
geometry_data_,
|
||||||
geometry_data_name_,
|
geometry_data_name_,
|
||||||
desc_.get_encoding(),
|
desc_.get_encoding());
|
||||||
multiple_geometries_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const
|
featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const
|
||||||
|
@ -290,6 +287,5 @@ featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const
|
||||||
geometry_id_,
|
geometry_id_,
|
||||||
geometry_data_,
|
geometry_data_,
|
||||||
geometry_data_name_,
|
geometry_data_name_,
|
||||||
desc_.get_encoding(),
|
desc_.get_encoding());
|
||||||
multiple_geometries_);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ private:
|
||||||
mutable std::string geometry_data_name_;
|
mutable std::string geometry_data_name_;
|
||||||
mutable int geometry_id_;
|
mutable int geometry_id_;
|
||||||
std::string geometry_string_;
|
std::string geometry_string_;
|
||||||
bool multiple_geometries_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GEOS_DATASOURCE_HPP
|
#endif // GEOS_DATASOURCE_HPP
|
||||||
|
|
|
@ -53,15 +53,13 @@ geos_featureset::geos_featureset(GEOSGeometry* geometry,
|
||||||
int identifier,
|
int identifier,
|
||||||
const std::string& field,
|
const std::string& field,
|
||||||
const std::string& field_name,
|
const std::string& field_name,
|
||||||
const std::string& encoding,
|
const std::string& encoding)
|
||||||
bool multiple_geometries)
|
|
||||||
: geometry_(geometry),
|
: geometry_(geometry),
|
||||||
tr_(new transcoder(encoding)),
|
tr_(new transcoder(encoding)),
|
||||||
extent_(extent),
|
extent_(extent),
|
||||||
identifier_(identifier),
|
identifier_(identifier),
|
||||||
field_(field),
|
field_(field),
|
||||||
field_name_(field_name),
|
field_name_(field_name),
|
||||||
multiple_geometries_(multiple_geometries),
|
|
||||||
already_rendered_(false)
|
already_rendered_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -120,14 +118,12 @@ feature_ptr geos_featureset::next()
|
||||||
|
|
||||||
geometry_utils::from_wkb(feature->paths(),
|
geometry_utils::from_wkb(feature->paths(),
|
||||||
wkb.data(),
|
wkb.data(),
|
||||||
wkb.size(),
|
wkb.size());
|
||||||
multiple_geometries_);
|
|
||||||
|
|
||||||
if (field_ != "")
|
if (field_ != "")
|
||||||
{
|
{
|
||||||
boost::put(*feature, field_name_, tr_->transcode(field_.c_str()));
|
boost::put(*feature, field_name_, tr_->transcode(field_.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return feature;
|
return feature;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,7 @@ public:
|
||||||
int identifier,
|
int identifier,
|
||||||
const std::string& field,
|
const std::string& field,
|
||||||
const std::string& field_name,
|
const std::string& field_name,
|
||||||
const std::string& encoding,
|
const std::string& encoding);
|
||||||
bool multiple_geometries);
|
|
||||||
virtual ~geos_featureset();
|
virtual ~geos_featureset();
|
||||||
mapnik::feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ private:
|
||||||
const std::list<kismet_network_data>& knd_list_;
|
const std::list<kismet_network_data>& knd_list_;
|
||||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||||
mapnik::wkbFormat format_;
|
mapnik::wkbFormat format_;
|
||||||
bool multiple_geometries_;
|
|
||||||
int feature_id_;
|
int feature_id_;
|
||||||
std::list<kismet_network_data>::const_iterator knd_list_it;
|
std::list<kismet_network_data>::const_iterator knd_list_it;
|
||||||
mapnik::projection source_;
|
mapnik::projection source_;
|
||||||
|
|
|
@ -94,7 +94,6 @@ occi_datasource::occi_datasource(parameters const& params, bool bind)
|
||||||
table_ = *table;
|
table_ = *table;
|
||||||
}
|
}
|
||||||
|
|
||||||
multiple_geometries_ = *params_.get<mapnik::boolean>("multiple_geometries",false);
|
|
||||||
use_spatial_index_ = *params_.get<mapnik::boolean>("use_spatial_index",true);
|
use_spatial_index_ = *params_.get<mapnik::boolean>("use_spatial_index",true);
|
||||||
use_connection_pool_ = *params_.get<mapnik::boolean>("use_connection_pool",true);
|
use_connection_pool_ = *params_.get<mapnik::boolean>("use_connection_pool",true);
|
||||||
|
|
||||||
|
@ -559,8 +558,7 @@ featureset_ptr occi_datasource::features(query const& q) const
|
||||||
return boost::make_shared<occi_featureset>(pool_,
|
return boost::make_shared<occi_featureset>(pool_,
|
||||||
conn_,
|
conn_,
|
||||||
s.str(),
|
s.str(),
|
||||||
desc_.get_encoding(),
|
desc_.get_encoding(),
|
||||||
multiple_geometries_,
|
|
||||||
use_connection_pool_,
|
use_connection_pool_,
|
||||||
row_prefetch_,
|
row_prefetch_,
|
||||||
props.size());
|
props.size());
|
||||||
|
@ -642,7 +640,6 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
conn_,
|
conn_,
|
||||||
s.str(),
|
s.str(),
|
||||||
desc_.get_encoding(),
|
desc_.get_encoding(),
|
||||||
multiple_geometries_,
|
|
||||||
use_connection_pool_,
|
use_connection_pool_,
|
||||||
row_prefetch_,
|
row_prefetch_,
|
||||||
size);
|
size);
|
||||||
|
|
|
@ -64,7 +64,6 @@ private:
|
||||||
mutable oracle::occi::StatelessConnectionPool* pool_;
|
mutable oracle::occi::StatelessConnectionPool* pool_;
|
||||||
mutable oracle::occi::Connection* conn_;
|
mutable oracle::occi::Connection* conn_;
|
||||||
bool use_connection_pool_;
|
bool use_connection_pool_;
|
||||||
bool multiple_geometries_;
|
|
||||||
bool use_spatial_index_;
|
bool use_spatial_index_;
|
||||||
static const std::string METADATA_TABLE;
|
static const std::string METADATA_TABLE;
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,12 +59,10 @@ occi_featureset::occi_featureset(StatelessConnectionPool* pool,
|
||||||
Connection* conn,
|
Connection* conn,
|
||||||
std::string const& sqlstring,
|
std::string const& sqlstring,
|
||||||
std::string const& encoding,
|
std::string const& encoding,
|
||||||
bool multiple_geometries,
|
|
||||||
bool use_connection_pool,
|
bool use_connection_pool,
|
||||||
unsigned prefetch_rows,
|
unsigned prefetch_rows,
|
||||||
unsigned num_attrs)
|
unsigned num_attrs)
|
||||||
: tr_(new transcoder(encoding)),
|
: tr_(new transcoder(encoding)),
|
||||||
multiple_geometries_(multiple_geometries),
|
|
||||||
num_attrs_(num_attrs),
|
num_attrs_(num_attrs),
|
||||||
feature_id_(1)
|
feature_id_(1)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +99,7 @@ feature_ptr occi_featureset::next()
|
||||||
boost::scoped_ptr<SDOGeometry> geom(dynamic_cast<SDOGeometry*>(rs_->getObject(1)));
|
boost::scoped_ptr<SDOGeometry> geom(dynamic_cast<SDOGeometry*>(rs_->getObject(1)));
|
||||||
if (geom.get())
|
if (geom.get())
|
||||||
{
|
{
|
||||||
convert_geometry(geom.get(), feature, multiple_geometries_);
|
convert_geometry(geom.get(), feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<MetaData> listOfColumns = rs_->getColumnListMetaData();
|
std::vector<MetaData> listOfColumns = rs_->getColumnListMetaData();
|
||||||
|
@ -204,7 +202,7 @@ feature_ptr occi_featureset::next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature, bool multiple_geometries)
|
void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
|
||||||
{
|
{
|
||||||
int gtype = (int)geom->getSdo_gtype();
|
int gtype = (int)geom->getSdo_gtype();
|
||||||
int dimensions = gtype / 1000;
|
int dimensions = gtype / 1000;
|
||||||
|
@ -248,16 +246,13 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature, b
|
||||||
{
|
{
|
||||||
const bool is_single_geom = true;
|
const bool is_single_geom = true;
|
||||||
const bool is_point_type = false;
|
const bool is_point_type = false;
|
||||||
const bool multiple_geoms = false;
|
|
||||||
|
|
||||||
convert_ordinates(feature,
|
convert_ordinates(feature,
|
||||||
mapnik::LineString,
|
mapnik::LineString,
|
||||||
elem_info,
|
elem_info,
|
||||||
ordinates,
|
ordinates,
|
||||||
dimensions,
|
dimensions,
|
||||||
is_single_geom,
|
is_single_geom,
|
||||||
is_point_type,
|
is_point_type);
|
||||||
multiple_geoms);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -267,16 +262,13 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature, b
|
||||||
{
|
{
|
||||||
const bool is_single_geom = true;
|
const bool is_single_geom = true;
|
||||||
const bool is_point_type = false;
|
const bool is_point_type = false;
|
||||||
const bool multiple_geoms = false;
|
|
||||||
|
|
||||||
convert_ordinates(feature,
|
convert_ordinates(feature,
|
||||||
mapnik::Polygon,
|
mapnik::Polygon,
|
||||||
elem_info,
|
elem_info,
|
||||||
ordinates,
|
ordinates,
|
||||||
dimensions,
|
dimensions,
|
||||||
is_single_geom,
|
is_single_geom,
|
||||||
is_point_type,
|
is_point_type);
|
||||||
multiple_geoms);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -286,19 +278,15 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature, b
|
||||||
{
|
{
|
||||||
const bool is_single_geom = false;
|
const bool is_single_geom = false;
|
||||||
const bool is_point_type = true;
|
const bool is_point_type = true;
|
||||||
const bool multiple_geoms = true;
|
|
||||||
|
|
||||||
// Todo - force using true as multiple_geometries until we have proper multipoint handling
|
|
||||||
// http://trac.mapnik.org/ticket/458
|
|
||||||
|
|
||||||
|
// FIXME :http://trac.mapnik.org/ticket/458
|
||||||
convert_ordinates(feature,
|
convert_ordinates(feature,
|
||||||
mapnik::Point,
|
mapnik::Point,
|
||||||
elem_info,
|
elem_info,
|
||||||
ordinates,
|
ordinates,
|
||||||
dimensions,
|
dimensions,
|
||||||
is_single_geom,
|
is_single_geom,
|
||||||
is_point_type,
|
is_point_type);
|
||||||
multiple_geoms);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -315,8 +303,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature, b
|
||||||
ordinates,
|
ordinates,
|
||||||
dimensions,
|
dimensions,
|
||||||
is_single_geom,
|
is_single_geom,
|
||||||
is_point_type,
|
is_point_type);
|
||||||
multiple_geometries);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -333,8 +320,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature, b
|
||||||
ordinates,
|
ordinates,
|
||||||
dimensions,
|
dimensions,
|
||||||
is_single_geom,
|
is_single_geom,
|
||||||
is_point_type,
|
is_point_type);
|
||||||
multiple_geometries);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -352,8 +338,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature, b
|
||||||
ordinates,
|
ordinates,
|
||||||
dimensions,
|
dimensions,
|
||||||
is_single_geom,
|
is_single_geom,
|
||||||
is_point_type,
|
is_point_type);
|
||||||
multiple_geometries);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -374,8 +359,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
|
||||||
const std::vector<Number>& ordinates,
|
const std::vector<Number>& ordinates,
|
||||||
const int dimensions,
|
const int dimensions,
|
||||||
const bool is_single_geom,
|
const bool is_single_geom,
|
||||||
const bool is_point_geom,
|
const bool is_point_geom)
|
||||||
const bool multiple_geometries)
|
|
||||||
{
|
{
|
||||||
const int elem_size = elem_info.size();
|
const int elem_size = elem_info.size();
|
||||||
const int ord_size = ordinates.size();
|
const int ord_size = ordinates.size();
|
||||||
|
@ -388,7 +372,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
|
||||||
|
|
||||||
if (! is_single_geom && elem_size > SDO_ELEM_INFO_SIZE)
|
if (! is_single_geom && elem_size > SDO_ELEM_INFO_SIZE)
|
||||||
{
|
{
|
||||||
geometry_type* geom = multiple_geometries ? 0 : new geometry_type(geom_type);
|
geometry_type* geom = new geometry_type(geom_type);
|
||||||
if (geom) geom->set_capacity(ord_size);
|
if (geom) geom->set_capacity(ord_size);
|
||||||
|
|
||||||
for (int i = SDO_ELEM_INFO_SIZE; i < elem_size; i+=3)
|
for (int i = SDO_ELEM_INFO_SIZE; i < elem_size; i+=3)
|
||||||
|
@ -444,16 +428,13 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
|
||||||
|
|
||||||
if (is_linear_element)
|
if (is_linear_element)
|
||||||
{
|
{
|
||||||
if (multiple_geometries)
|
if (geom)
|
||||||
{
|
{
|
||||||
if (geom)
|
feature->add_geometry(geom);
|
||||||
{
|
|
||||||
feature->add_geometry(geom);
|
|
||||||
}
|
|
||||||
|
|
||||||
geom = new geometry_type(gtype);
|
|
||||||
geom->set_capacity((next_offset - 1) - (offset - 1 - dimensions));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
geom = new geometry_type(gtype);
|
||||||
|
geom->set_capacity((next_offset - 1) - (offset - 1 - dimensions));
|
||||||
|
|
||||||
fill_geometry_type(geom,
|
fill_geometry_type(geom,
|
||||||
offset - 1,
|
offset - 1,
|
||||||
|
|
|
@ -42,7 +42,6 @@ public:
|
||||||
oracle::occi::Connection* conn,
|
oracle::occi::Connection* conn,
|
||||||
std::string const& sqlstring,
|
std::string const& sqlstring,
|
||||||
std::string const& encoding,
|
std::string const& encoding,
|
||||||
bool multiple_geometries,
|
|
||||||
bool use_connection_pool,
|
bool use_connection_pool,
|
||||||
unsigned prefetch_rows,
|
unsigned prefetch_rows,
|
||||||
unsigned num_attrs);
|
unsigned num_attrs);
|
||||||
|
@ -50,15 +49,14 @@ public:
|
||||||
mapnik::feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void convert_geometry (SDOGeometry* geom, mapnik::feature_ptr feature, bool multiple_geometries);
|
void convert_geometry (SDOGeometry* geom, mapnik::feature_ptr feature);
|
||||||
void convert_ordinates (mapnik::feature_ptr feature,
|
void convert_ordinates (mapnik::feature_ptr feature,
|
||||||
const mapnik::eGeomType& geom_type,
|
const mapnik::eGeomType& geom_type,
|
||||||
const std::vector<oracle::occi::Number>& elem_info,
|
const std::vector<oracle::occi::Number>& elem_info,
|
||||||
const std::vector<oracle::occi::Number>& ordinates,
|
const std::vector<oracle::occi::Number>& ordinates,
|
||||||
const int dimensions,
|
const int dimensions,
|
||||||
const bool is_single_geom,
|
const bool is_single_geom,
|
||||||
const bool is_point_geom,
|
const bool is_point_geom);
|
||||||
const bool multiple_geometries);
|
|
||||||
void fill_geometry_type (mapnik::geometry_type* geom,
|
void fill_geometry_type (mapnik::geometry_type* geom,
|
||||||
const int real_offset,
|
const int real_offset,
|
||||||
const int next_offset,
|
const int next_offset,
|
||||||
|
@ -70,7 +68,6 @@ private:
|
||||||
oracle::occi::ResultSet* rs_;
|
oracle::occi::ResultSet* rs_;
|
||||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||||
const char* fidcolumn_;
|
const char* fidcolumn_;
|
||||||
bool multiple_geometries_;
|
|
||||||
unsigned num_attrs_;
|
unsigned num_attrs_;
|
||||||
mutable int feature_id_;
|
mutable int feature_id_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,8 +87,6 @@ postgis_datasource::postgis_datasource(parameters const& params, bool bind)
|
||||||
{
|
{
|
||||||
if (table_.empty()) throw mapnik::datasource_exception("Postgis Plugin: missing <table> parameter");
|
if (table_.empty()) throw mapnik::datasource_exception("Postgis Plugin: missing <table> parameter");
|
||||||
|
|
||||||
multiple_geometries_ = *params_.get<mapnik::boolean>("multiple_geometries",false);
|
|
||||||
|
|
||||||
boost::optional<std::string> ext = params_.get<std::string>("extent");
|
boost::optional<std::string> ext = params_.get<std::string>("extent");
|
||||||
if (ext) extent_initialized_ = extent_.from_string(*ext);
|
if (ext) extent_initialized_ = extent_.from_string(*ext);
|
||||||
|
|
||||||
|
@ -517,7 +515,7 @@ featureset_ptr postgis_datasource::features(const query& q) const
|
||||||
unsigned num_attr = props.size();
|
unsigned num_attr = props.size();
|
||||||
if (!key_field_.empty())
|
if (!key_field_.empty())
|
||||||
++num_attr;
|
++num_attr;
|
||||||
return boost::make_shared<postgis_featureset>(rs,desc_.get_encoding(),multiple_geometries_,!key_field_.empty(),num_attr);
|
return boost::make_shared<postgis_featureset>(rs,desc_.get_encoding(), !key_field_.empty(),num_attr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -585,7 +583,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt) const
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<IResultSet> rs = get_resultset(conn, s.str());
|
boost::shared_ptr<IResultSet> rs = get_resultset(conn, s.str());
|
||||||
return boost::make_shared<postgis_featureset>(rs,desc_.get_encoding(),multiple_geometries_,!key_field_.empty(),size);
|
return boost::make_shared<postgis_featureset>(rs,desc_.get_encoding(), !key_field_.empty(),size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return featureset_ptr();
|
return featureset_ptr();
|
||||||
|
|
|
@ -69,7 +69,6 @@ class postgis_datasource : public datasource
|
||||||
mutable mapnik::box2d<double> extent_;
|
mutable mapnik::box2d<double> extent_;
|
||||||
mutable layer_descriptor desc_;
|
mutable layer_descriptor desc_;
|
||||||
ConnectionCreator<Connection> creator_;
|
ConnectionCreator<Connection> creator_;
|
||||||
bool multiple_geometries_;
|
|
||||||
const std::string bbox_token_;
|
const std::string bbox_token_;
|
||||||
const std::string scale_denom_token_;
|
const std::string scale_denom_token_;
|
||||||
bool persist_connection_;
|
bool persist_connection_;
|
||||||
|
|
|
@ -49,11 +49,9 @@ using mapnik::feature_factory;
|
||||||
|
|
||||||
postgis_featureset::postgis_featureset(boost::shared_ptr<IResultSet> const& rs,
|
postgis_featureset::postgis_featureset(boost::shared_ptr<IResultSet> const& rs,
|
||||||
std::string const& encoding,
|
std::string const& encoding,
|
||||||
bool multiple_geometries,
|
|
||||||
bool key_field=false,
|
bool key_field=false,
|
||||||
unsigned num_attrs=0)
|
unsigned num_attrs=0)
|
||||||
: rs_(rs),
|
: rs_(rs),
|
||||||
multiple_geometries_(multiple_geometries),
|
|
||||||
num_attrs_(num_attrs),
|
num_attrs_(num_attrs),
|
||||||
tr_(new transcoder(encoding)),
|
tr_(new transcoder(encoding)),
|
||||||
totalGeomSize_(0),
|
totalGeomSize_(0),
|
||||||
|
@ -103,7 +101,7 @@ feature_ptr postgis_featureset::next()
|
||||||
// parse geometry
|
// parse geometry
|
||||||
int size = rs_->getFieldLength(0);
|
int size = rs_->getFieldLength(0);
|
||||||
const char *data = rs_->getValue(0);
|
const char *data = rs_->getValue(0);
|
||||||
geometry_utils::from_wkb(feature->paths(),data,size,multiple_geometries_);
|
geometry_utils::from_wkb(feature->paths(), data, size);
|
||||||
totalGeomSize_+=size;
|
totalGeomSize_+=size;
|
||||||
|
|
||||||
for ( ;pos<num_attrs_+1;++pos)
|
for ( ;pos<num_attrs_+1;++pos)
|
||||||
|
|
|
@ -44,7 +44,6 @@ class postgis_featureset : public mapnik::Featureset
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<IResultSet> rs_;
|
boost::shared_ptr<IResultSet> rs_;
|
||||||
bool multiple_geometries_;
|
|
||||||
unsigned num_attrs_;
|
unsigned num_attrs_;
|
||||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||||
int totalGeomSize_;
|
int totalGeomSize_;
|
||||||
|
@ -53,7 +52,6 @@ private:
|
||||||
public:
|
public:
|
||||||
postgis_featureset(boost::shared_ptr<IResultSet> const& rs,
|
postgis_featureset(boost::shared_ptr<IResultSet> const& rs,
|
||||||
std::string const& encoding,
|
std::string const& encoding,
|
||||||
bool multiple_geometries,
|
|
||||||
bool key_field,
|
bool key_field,
|
||||||
unsigned num_attrs);
|
unsigned num_attrs);
|
||||||
mapnik::feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
|
|
|
@ -248,55 +248,25 @@ feature_ptr shape_featureset<filterT>::next()
|
||||||
}
|
}
|
||||||
|
|
||||||
case shape_io::shape_polyline:
|
case shape_io::shape_polyline:
|
||||||
{
|
|
||||||
geometry_type* line = shape_.read_polyline();
|
|
||||||
feature->add_geometry(line);
|
|
||||||
++count_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case shape_io::shape_polylinem:
|
case shape_io::shape_polylinem:
|
||||||
{
|
|
||||||
geometry_type* line = shape_.read_polylinem();
|
|
||||||
feature->add_geometry(line);
|
|
||||||
++count_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case shape_io::shape_polylinez:
|
case shape_io::shape_polylinez:
|
||||||
{
|
{
|
||||||
geometry_type* line = shape_.read_polylinez();
|
shape_.read_polyline(feature->paths());
|
||||||
feature->add_geometry(line);
|
|
||||||
++count_;
|
++count_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case shape_io::shape_polygon:
|
case shape_io::shape_polygon:
|
||||||
{
|
|
||||||
geometry_type* poly = shape_.read_polygon();
|
|
||||||
feature->add_geometry(poly);
|
|
||||||
++count_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case shape_io::shape_polygonm:
|
case shape_io::shape_polygonm:
|
||||||
{
|
|
||||||
geometry_type* poly = shape_.read_polygonm();
|
|
||||||
feature->add_geometry(poly);
|
|
||||||
++count_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case shape_io::shape_polygonz:
|
case shape_io::shape_polygonz:
|
||||||
{
|
{
|
||||||
geometry_type* poly = shape_.read_polygonz();
|
shape_.read_polygon(feature->paths());
|
||||||
feature->add_geometry(poly);
|
|
||||||
++count_;
|
++count_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
feature->set_id(shape_.id_);
|
feature->set_id(shape_.id_);
|
||||||
if (attr_ids_.size())
|
if (attr_ids_.size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,49 +193,18 @@ feature_ptr shape_index_featureset<filterT>::next()
|
||||||
}
|
}
|
||||||
|
|
||||||
case shape_io::shape_polyline:
|
case shape_io::shape_polyline:
|
||||||
{
|
|
||||||
geometry_type* line = shape_.read_polyline();
|
|
||||||
feature->add_geometry(line);
|
|
||||||
++count_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case shape_io::shape_polylinem:
|
case shape_io::shape_polylinem:
|
||||||
{
|
|
||||||
geometry_type* line = shape_.read_polylinem();
|
|
||||||
feature->add_geometry(line);
|
|
||||||
++count_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case shape_io::shape_polylinez:
|
case shape_io::shape_polylinez:
|
||||||
{
|
{
|
||||||
geometry_type* line = shape_.read_polylinez();
|
shape_.read_polyline(feature->paths());
|
||||||
feature->add_geometry(line);
|
|
||||||
++count_;
|
++count_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case shape_io::shape_polygon:
|
case shape_io::shape_polygon:
|
||||||
{
|
|
||||||
geometry_type* poly = shape_.read_polygon();
|
|
||||||
feature->add_geometry(poly);
|
|
||||||
++count_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case shape_io::shape_polygonm:
|
case shape_io::shape_polygonm:
|
||||||
{
|
|
||||||
geometry_type* poly = shape_.read_polygonm();
|
|
||||||
feature->add_geometry(poly);
|
|
||||||
++count_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case shape_io::shape_polygonz:
|
case shape_io::shape_polygonz:
|
||||||
{
|
{
|
||||||
geometry_type* poly = shape_.read_polygonz();
|
shape_.read_polygon(feature->paths());
|
||||||
feature->add_geometry(poly);
|
|
||||||
++count_;
|
++count_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,18 +106,16 @@ dbf_file& shape_io::dbf()
|
||||||
return dbf_;
|
return dbf_;
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry_type* shape_io::read_polyline()
|
void shape_io::read_polyline(mapnik::geometry_container & geom)
|
||||||
{
|
{
|
||||||
shape_file::record_type record(reclength_ * 2 - 36);
|
shape_file::record_type record(reclength_ * 2 - 36);
|
||||||
shp_.read_record(record);
|
shp_.read_record(record);
|
||||||
|
|
||||||
int num_parts = record.read_ndr_integer();
|
int num_parts = record.read_ndr_integer();
|
||||||
int num_points = record.read_ndr_integer();
|
int num_points = record.read_ndr_integer();
|
||||||
geometry_type* line = new geometry_type(mapnik::LineString);
|
|
||||||
line->set_capacity(num_points + num_parts);
|
|
||||||
if (num_parts == 1)
|
if (num_parts == 1)
|
||||||
{
|
{
|
||||||
line->set_capacity(num_points + 1);
|
geometry_type* line = new geometry_type(mapnik::LineString);
|
||||||
record.skip(4);
|
record.skip(4);
|
||||||
double x = record.read_double();
|
double x = record.read_double();
|
||||||
double y = record.read_double();
|
double y = record.read_double();
|
||||||
|
@ -128,6 +126,7 @@ geometry_type* shape_io::read_polyline()
|
||||||
y = record.read_double();
|
y = record.read_double();
|
||||||
line->line_to(x, y);
|
line->line_to(x, y);
|
||||||
}
|
}
|
||||||
|
geom.push_back(line);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -140,6 +139,7 @@ geometry_type* shape_io::read_polyline()
|
||||||
int start, end;
|
int start, end;
|
||||||
for (int k = 0; k < num_parts; ++k)
|
for (int k = 0; k < num_parts; ++k)
|
||||||
{
|
{
|
||||||
|
geometry_type* line = new geometry_type(mapnik::LineString);
|
||||||
start = parts[k];
|
start = parts[k];
|
||||||
if (k == num_parts - 1)
|
if (k == num_parts - 1)
|
||||||
{
|
{
|
||||||
|
@ -160,135 +160,9 @@ geometry_type* shape_io::read_polyline()
|
||||||
y = record.read_double();
|
y = record.read_double();
|
||||||
line->line_to(x, y);
|
line->line_to(x, y);
|
||||||
}
|
}
|
||||||
|
geom.push_back(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
geometry_type* shape_io::read_polylinem()
|
|
||||||
{
|
|
||||||
shape_file::record_type record(reclength_ * 2 - 36);
|
|
||||||
shp_.read_record(record);
|
|
||||||
|
|
||||||
int num_parts = record.read_ndr_integer();
|
|
||||||
int num_points = record.read_ndr_integer();
|
|
||||||
geometry_type* line = new geometry_type(mapnik::LineString);
|
|
||||||
line->set_capacity(num_points + num_parts);
|
|
||||||
if (num_parts == 1)
|
|
||||||
{
|
|
||||||
record.skip(4);
|
|
||||||
double x = record.read_double();
|
|
||||||
double y = record.read_double();
|
|
||||||
line->move_to(x, y);
|
|
||||||
for (int i = 1; i < num_points; ++i)
|
|
||||||
{
|
|
||||||
x = record.read_double();
|
|
||||||
y = record.read_double();
|
|
||||||
line->line_to(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::vector<int> parts(num_parts);
|
|
||||||
for (int i = 0; i < num_parts; ++i)
|
|
||||||
{
|
|
||||||
parts[i] = record.read_ndr_integer();
|
|
||||||
}
|
|
||||||
|
|
||||||
int start, end;
|
|
||||||
for (int k = 0; k < num_parts; ++k)
|
|
||||||
{
|
|
||||||
start = parts[k];
|
|
||||||
if (k == num_parts - 1)
|
|
||||||
{
|
|
||||||
end = num_points;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
end = parts[k + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
double x = record.read_double();
|
|
||||||
double y = record.read_double();
|
|
||||||
line->move_to(x, y);
|
|
||||||
|
|
||||||
for (int j = start + 1; j < end; ++j)
|
|
||||||
{
|
|
||||||
x = record.read_double();
|
|
||||||
y = record.read_double();
|
|
||||||
line->line_to(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// m-range
|
|
||||||
//double m0=record.read_double();
|
|
||||||
//double m1=record.read_double();
|
|
||||||
|
|
||||||
//for (int i=0;i<num_points;++i)
|
|
||||||
//{
|
|
||||||
// double m=record.read_double();
|
|
||||||
//}
|
|
||||||
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
geometry_type* shape_io::read_polylinez()
|
|
||||||
{
|
|
||||||
shape_file::record_type record(reclength_ * 2 - 36);
|
|
||||||
shp_.read_record(record);
|
|
||||||
|
|
||||||
int num_parts = record.read_ndr_integer();
|
|
||||||
int num_points = record.read_ndr_integer();
|
|
||||||
geometry_type* line = new geometry_type(mapnik::LineString);
|
|
||||||
line->set_capacity(num_points + num_parts);
|
|
||||||
if (num_parts == 1)
|
|
||||||
{
|
|
||||||
record.skip(4);
|
|
||||||
double x = record.read_double();
|
|
||||||
double y = record.read_double();
|
|
||||||
line->move_to(x, y);
|
|
||||||
for (int i = 1; i < num_points; ++i)
|
|
||||||
{
|
|
||||||
x = record.read_double();
|
|
||||||
y = record.read_double();
|
|
||||||
line->line_to(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::vector<int> parts(num_parts);
|
|
||||||
for (int i = 0; i < num_parts; ++i)
|
|
||||||
{
|
|
||||||
parts[i] = record.read_ndr_integer();
|
|
||||||
}
|
|
||||||
|
|
||||||
int start, end;
|
|
||||||
for (int k = 0; k < num_parts; ++k)
|
|
||||||
{
|
|
||||||
start = parts[k];
|
|
||||||
if (k == num_parts - 1)
|
|
||||||
{
|
|
||||||
end = num_points;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
end = parts[k + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
double x = record.read_double();
|
|
||||||
double y = record.read_double();
|
|
||||||
line->move_to(x, y);
|
|
||||||
|
|
||||||
for (int j = start + 1; j < end; ++j)
|
|
||||||
{
|
|
||||||
x = record.read_double();
|
|
||||||
y = record.read_double();
|
|
||||||
line->line_to(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// z-range
|
// z-range
|
||||||
//double z0=record.read_double();
|
//double z0=record.read_double();
|
||||||
//double z1=record.read_double();
|
//double z1=record.read_double();
|
||||||
|
@ -306,19 +180,17 @@ geometry_type* shape_io::read_polylinez()
|
||||||
// double m=record.read_double();
|
// double m=record.read_double();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return line;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry_type* shape_io::read_polygon()
|
void shape_io::read_polygon(mapnik::geometry_container & geom)
|
||||||
{
|
{
|
||||||
shape_file::record_type record(reclength_ * 2 - 36);
|
shape_file::record_type record(reclength_ * 2 - 36);
|
||||||
shp_.read_record(record);
|
shp_.read_record(record);
|
||||||
|
|
||||||
int num_parts = record.read_ndr_integer();
|
int num_parts = record.read_ndr_integer();
|
||||||
int num_points = record.read_ndr_integer();
|
int num_points = record.read_ndr_integer();
|
||||||
std::vector<int> parts(num_parts);
|
std::vector<int> parts(num_parts);
|
||||||
geometry_type* poly = new geometry_type(mapnik::Polygon);
|
|
||||||
poly->set_capacity(num_points + num_parts);
|
|
||||||
for (int i = 0; i < num_parts; ++i)
|
for (int i = 0; i < num_parts; ++i)
|
||||||
{
|
{
|
||||||
parts[i] = record.read_ndr_integer();
|
parts[i] = record.read_ndr_integer();
|
||||||
|
@ -326,6 +198,7 @@ geometry_type* shape_io::read_polygon()
|
||||||
|
|
||||||
for (int k = 0; k < num_parts; k++)
|
for (int k = 0; k < num_parts; k++)
|
||||||
{
|
{
|
||||||
|
geometry_type* poly = new geometry_type(mapnik::Polygon);
|
||||||
int start = parts[k];
|
int start = parts[k];
|
||||||
int end;
|
int end;
|
||||||
if (k == num_parts - 1)
|
if (k == num_parts - 1)
|
||||||
|
@ -347,101 +220,8 @@ geometry_type* shape_io::read_polygon()
|
||||||
y = record.read_double();
|
y = record.read_double();
|
||||||
poly->line_to(x, y);
|
poly->line_to(x, y);
|
||||||
}
|
}
|
||||||
|
geom.push_back(poly);
|
||||||
}
|
}
|
||||||
return poly;
|
|
||||||
}
|
|
||||||
|
|
||||||
geometry_type* shape_io::read_polygonm()
|
|
||||||
{
|
|
||||||
shape_file::record_type record(reclength_ * 2 - 36);
|
|
||||||
shp_.read_record(record);
|
|
||||||
|
|
||||||
int num_parts = record.read_ndr_integer();
|
|
||||||
int num_points = record.read_ndr_integer();
|
|
||||||
std::vector<int> parts(num_parts);
|
|
||||||
geometry_type* poly = new geometry_type(mapnik::Polygon);
|
|
||||||
poly->set_capacity(num_points + num_parts);
|
|
||||||
for (int i = 0; i < num_parts; ++i)
|
|
||||||
{
|
|
||||||
parts[i] = record.read_ndr_integer();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int k = 0; k < num_parts; k++)
|
|
||||||
{
|
|
||||||
int start = parts[k];
|
|
||||||
int end;
|
|
||||||
if (k == num_parts - 1)
|
|
||||||
{
|
|
||||||
end = num_points;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
end = parts[k + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
double x = record.read_double();
|
|
||||||
double y = record.read_double();
|
|
||||||
poly->move_to(x, y);
|
|
||||||
|
|
||||||
for (int j = start + 1; j < end; j++)
|
|
||||||
{
|
|
||||||
x = record.read_double();
|
|
||||||
y = record.read_double();
|
|
||||||
poly->line_to(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// m-range
|
|
||||||
//double m0=record.read_double();
|
|
||||||
//double m1=record.read_double();
|
|
||||||
|
|
||||||
//for (int i=0;i<num_points;++i)
|
|
||||||
//{
|
|
||||||
// double m=record.read_double();
|
|
||||||
//}
|
|
||||||
return poly;
|
|
||||||
}
|
|
||||||
|
|
||||||
geometry_type* shape_io::read_polygonz()
|
|
||||||
{
|
|
||||||
shape_file::record_type record(reclength_ * 2 - 36);
|
|
||||||
shp_.read_record(record);
|
|
||||||
|
|
||||||
int num_parts = record.read_ndr_integer();
|
|
||||||
int num_points = record.read_ndr_integer();
|
|
||||||
std::vector<int> parts(num_parts);
|
|
||||||
geometry_type* poly = new geometry_type(mapnik::Polygon);
|
|
||||||
poly->set_capacity(num_points + num_parts);
|
|
||||||
for (int i = 0; i < num_parts; ++i)
|
|
||||||
{
|
|
||||||
parts[i] = record.read_ndr_integer();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int k = 0; k < num_parts; k++)
|
|
||||||
{
|
|
||||||
int start = parts[k];
|
|
||||||
int end;
|
|
||||||
if (k == num_parts - 1)
|
|
||||||
{
|
|
||||||
end = num_points;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
end = parts[k + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
double x = record.read_double();
|
|
||||||
double y = record.read_double();
|
|
||||||
poly->move_to(x, y);
|
|
||||||
|
|
||||||
for (int j = start + 1; j < end; j++)
|
|
||||||
{
|
|
||||||
x = record.read_double();
|
|
||||||
y = record.read_double();
|
|
||||||
poly->line_to(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// z-range
|
// z-range
|
||||||
//double z0=record.read_double();
|
//double z0=record.read_double();
|
||||||
//double z1=record.read_double();
|
//double z1=record.read_double();
|
||||||
|
@ -458,6 +238,6 @@ geometry_type* shape_io::read_polygonz()
|
||||||
//{
|
//{
|
||||||
// double m=record.read_double();
|
// double m=record.read_double();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return poly;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#ifndef SHAPE_IO_HPP
|
#ifndef SHAPE_IO_HPP
|
||||||
#define SHAPE_IO_HPP
|
#define SHAPE_IO_HPP
|
||||||
|
|
||||||
|
// mapnik
|
||||||
|
#include <mapnik/geometry.hpp>
|
||||||
// boost
|
// boost
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
@ -56,9 +58,8 @@ public:
|
||||||
~shape_io();
|
~shape_io();
|
||||||
|
|
||||||
shape_file& shp();
|
shape_file& shp();
|
||||||
//shape_file& shx();
|
|
||||||
dbf_file& dbf();
|
dbf_file& dbf();
|
||||||
|
|
||||||
inline boost::shared_ptr<shape_file>& index()
|
inline boost::shared_ptr<shape_file>& index()
|
||||||
{
|
{
|
||||||
return index_;
|
return index_;
|
||||||
|
@ -72,16 +73,10 @@ public:
|
||||||
void move_to(int id);
|
void move_to(int id);
|
||||||
int type() const;
|
int type() const;
|
||||||
const box2d<double>& current_extent() const;
|
const box2d<double>& current_extent() const;
|
||||||
mapnik::geometry_type* read_polyline();
|
void read_polyline(mapnik::geometry_container & geom);
|
||||||
mapnik::geometry_type* read_polylinem();
|
void read_polygon(mapnik::geometry_container & geom);
|
||||||
mapnik::geometry_type* read_polylinez();
|
|
||||||
mapnik::geometry_type* read_polygon();
|
|
||||||
mapnik::geometry_type* read_polygonm();
|
|
||||||
mapnik::geometry_type* read_polygonz();
|
|
||||||
|
|
||||||
unsigned type_;
|
unsigned type_;
|
||||||
shape_file shp_;
|
shape_file shp_;
|
||||||
//shape_file shx_;
|
|
||||||
dbf_file dbf_;
|
dbf_file dbf_;
|
||||||
boost::shared_ptr<shape_file> index_;
|
boost::shared_ptr<shape_file> index_;
|
||||||
unsigned reclength_;
|
unsigned reclength_;
|
||||||
|
@ -89,7 +84,6 @@ public:
|
||||||
box2d<double> cur_extent_;
|
box2d<double> cur_extent_;
|
||||||
|
|
||||||
static const std::string SHP;
|
static const std::string SHP;
|
||||||
//static const std::string SHX;
|
|
||||||
static const std::string DBF;
|
static const std::string DBF;
|
||||||
static const std::string INDEX;
|
static const std::string INDEX;
|
||||||
};
|
};
|
||||||
|
|
|
@ -102,7 +102,6 @@ void sqlite_datasource::bind() const
|
||||||
throw datasource_exception("Sqlite Plugin: " + dataset_name_ + " does not exist");
|
throw datasource_exception("Sqlite Plugin: " + dataset_name_ + " does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
multiple_geometries_ = *params_.get<mapnik::boolean>("multiple_geometries", false);
|
|
||||||
use_spatial_index_ = *params_.get<mapnik::boolean>("use_spatial_index", true);
|
use_spatial_index_ = *params_.get<mapnik::boolean>("use_spatial_index", true);
|
||||||
|
|
||||||
// TODO - remove this option once all datasources have an indexing api
|
// TODO - remove this option once all datasources have an indexing api
|
||||||
|
@ -502,7 +501,6 @@ featureset_ptr sqlite_datasource::features(query const& q) const
|
||||||
return boost::make_shared<sqlite_featureset>(rs,
|
return boost::make_shared<sqlite_featureset>(rs,
|
||||||
desc_.get_encoding(),
|
desc_.get_encoding(),
|
||||||
format_,
|
format_,
|
||||||
multiple_geometries_,
|
|
||||||
using_subquery_);
|
using_subquery_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,9 +575,8 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt) const
|
||||||
return boost::make_shared<sqlite_featureset>(rs,
|
return boost::make_shared<sqlite_featureset>(rs,
|
||||||
desc_.get_encoding(),
|
desc_.get_encoding(),
|
||||||
format_,
|
format_,
|
||||||
multiple_geometries_,
|
|
||||||
using_subquery_);
|
using_subquery_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return featureset_ptr();
|
return featureset_ptr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,11 @@ public:
|
||||||
void bind() const;
|
void bind() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
// FIXME: remove mutable qualifier from data members
|
||||||
|
// by factoring out bind() logic out from
|
||||||
|
// datasource impl !!!
|
||||||
|
|
||||||
mutable mapnik::box2d<double> extent_;
|
mutable mapnik::box2d<double> extent_;
|
||||||
mutable bool extent_initialized_;
|
mutable bool extent_initialized_;
|
||||||
int type_;
|
int type_;
|
||||||
|
@ -67,7 +72,6 @@ private:
|
||||||
mutable int row_limit_;
|
mutable int row_limit_;
|
||||||
mutable mapnik::layer_descriptor desc_;
|
mutable mapnik::layer_descriptor desc_;
|
||||||
mutable mapnik::wkbFormat format_;
|
mutable mapnik::wkbFormat format_;
|
||||||
mutable bool multiple_geometries_;
|
|
||||||
mutable bool use_spatial_index_;
|
mutable bool use_spatial_index_;
|
||||||
mutable bool has_spatial_index_;
|
mutable bool has_spatial_index_;
|
||||||
mutable bool using_subquery_;
|
mutable bool using_subquery_;
|
||||||
|
|
|
@ -47,12 +47,10 @@ using mapnik::feature_factory;
|
||||||
sqlite_featureset::sqlite_featureset(boost::shared_ptr<sqlite_resultset> rs,
|
sqlite_featureset::sqlite_featureset(boost::shared_ptr<sqlite_resultset> rs,
|
||||||
std::string const& encoding,
|
std::string const& encoding,
|
||||||
mapnik::wkbFormat format,
|
mapnik::wkbFormat format,
|
||||||
bool multiple_geometries,
|
|
||||||
bool using_subquery)
|
bool using_subquery)
|
||||||
: rs_(rs),
|
: rs_(rs),
|
||||||
tr_(new transcoder(encoding)),
|
tr_(new transcoder(encoding)),
|
||||||
format_(format),
|
format_(format),
|
||||||
multiple_geometries_(multiple_geometries),
|
|
||||||
using_subquery_(using_subquery)
|
using_subquery_(using_subquery)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -75,8 +73,8 @@ feature_ptr sqlite_featureset::next()
|
||||||
int feature_id = rs_->column_integer(1);
|
int feature_id = rs_->column_integer(1);
|
||||||
|
|
||||||
feature_ptr feature(feature_factory::create(feature_id));
|
feature_ptr feature(feature_factory::create(feature_id));
|
||||||
geometry_utils::from_wkb(feature->paths(), data, size, multiple_geometries_, format_);
|
geometry_utils::from_wkb(feature->paths(), data, size, format_);
|
||||||
|
|
||||||
for (int i = 2; i < rs_->column_count(); ++i)
|
for (int i = 2; i < rs_->column_count(); ++i)
|
||||||
{
|
{
|
||||||
const int type_oid = rs_->column_type(i);
|
const int type_oid = rs_->column_type(i);
|
||||||
|
|
|
@ -42,7 +42,6 @@ public:
|
||||||
sqlite_featureset(boost::shared_ptr<sqlite_resultset> rs,
|
sqlite_featureset(boost::shared_ptr<sqlite_resultset> rs,
|
||||||
std::string const& encoding,
|
std::string const& encoding,
|
||||||
mapnik::wkbFormat format,
|
mapnik::wkbFormat format,
|
||||||
bool multiple_geometries,
|
|
||||||
bool using_subquery);
|
bool using_subquery);
|
||||||
virtual ~sqlite_featureset();
|
virtual ~sqlite_featureset();
|
||||||
mapnik::feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
|
@ -51,7 +50,6 @@ private:
|
||||||
boost::shared_ptr<sqlite_resultset> rs_;
|
boost::shared_ptr<sqlite_resultset> rs_;
|
||||||
boost::scoped_ptr<mapnik::transcoder> tr_;
|
boost::scoped_ptr<mapnik::transcoder> tr_;
|
||||||
mapnik::wkbFormat format_;
|
mapnik::wkbFormat format_;
|
||||||
bool multiple_geometries_;
|
|
||||||
bool using_subquery_;
|
bool using_subquery_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -151,11 +151,11 @@ public:
|
||||||
while (rs->is_valid() && rs->step_next())
|
while (rs->is_valid() && rs->step_next())
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
const char* data = (const char*) rs->column_blob(0, size);
|
const char* data = static_cast<const char*>(rs->column_blob(0, size));
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
boost::ptr_vector<mapnik::geometry_type> paths;
|
boost::ptr_vector<mapnik::geometry_type> paths;
|
||||||
mapnik::geometry_utils::from_wkb(paths, data, size, false, mapnik::wkbAuto);
|
mapnik::geometry_utils::from_wkb(paths, data, size, mapnik::wkbAuto);
|
||||||
for (unsigned i=0; i<paths.size(); ++i)
|
for (unsigned i=0; i<paths.size(); ++i)
|
||||||
{
|
{
|
||||||
mapnik::box2d<double> const& bbox = paths[i].envelope();
|
mapnik::box2d<double> const& bbox = paths[i].envelope();
|
||||||
|
@ -241,41 +241,47 @@ public:
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
boost::ptr_vector<mapnik::geometry_type> paths;
|
boost::ptr_vector<mapnik::geometry_type> paths;
|
||||||
// TODO - contraint fails if multiple_geometries = true
|
mapnik::geometry_utils::from_wkb(paths, data, size, mapnik::wkbAuto);
|
||||||
bool multiple_geometries = false;
|
mapnik::box2d<double> bbox;
|
||||||
mapnik::geometry_utils::from_wkb(paths, data, size, multiple_geometries, mapnik::wkbAuto);
|
|
||||||
for (unsigned i=0; i<paths.size(); ++i)
|
for (unsigned i=0; i<paths.size(); ++i)
|
||||||
{
|
{
|
||||||
mapnik::box2d<double> const& bbox = paths[i].envelope();
|
if (i==0)
|
||||||
if (bbox.valid())
|
|
||||||
{
|
{
|
||||||
|
bbox = paths[i].envelope();
|
||||||
ps.bind(bbox);
|
|
||||||
|
|
||||||
const int type_oid = rs->column_type(1);
|
|
||||||
if (type_oid != SQLITE_INTEGER)
|
|
||||||
{
|
|
||||||
std::ostringstream error_msg;
|
|
||||||
error_msg << "Sqlite Plugin: invalid type for key field '"
|
|
||||||
<< rs->column_name(1) << "' when creating index '" << index_table
|
|
||||||
<< "' type was: " << type_oid << "";
|
|
||||||
throw mapnik::datasource_exception(error_msg.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
const sqlite_int64 pkid = rs->column_integer64(1);
|
|
||||||
ps.bind(pkid);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
bbox.expand_to_include(paths[i].envelope());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bbox.valid())
|
||||||
|
{
|
||||||
|
|
||||||
|
ps.bind(bbox);
|
||||||
|
|
||||||
|
const int type_oid = rs->column_type(1);
|
||||||
|
if (type_oid != SQLITE_INTEGER)
|
||||||
{
|
{
|
||||||
std::ostringstream error_msg;
|
std::ostringstream error_msg;
|
||||||
error_msg << "SQLite Plugin: encountered invalid bbox at '"
|
error_msg << "Sqlite Plugin: invalid type for key field '"
|
||||||
<< rs->column_name(1) << "' == " << rs->column_integer64(1);
|
<< rs->column_name(1) << "' when creating index '" << index_table
|
||||||
|
<< "' type was: " << type_oid << "";
|
||||||
throw mapnik::datasource_exception(error_msg.str());
|
throw mapnik::datasource_exception(error_msg.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
ps.step_next();
|
const sqlite_int64 pkid = rs->column_integer64(1);
|
||||||
one_success = true;
|
ps.bind(pkid);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::ostringstream error_msg;
|
||||||
|
error_msg << "SQLite Plugin: encountered invalid bbox at '"
|
||||||
|
<< rs->column_name(1) << "' == " << rs->column_integer64(1);
|
||||||
|
throw mapnik::datasource_exception(error_msg.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.step_next();
|
||||||
|
one_success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,13 +326,11 @@ public:
|
||||||
while (rs->is_valid() && rs->step_next())
|
while (rs->is_valid() && rs->step_next())
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
const char* data = (const char*) rs->column_blob(0, size);
|
const char* data = static_cast<const char*>(rs->column_blob(0, size));
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
boost::ptr_vector<mapnik::geometry_type> paths;
|
boost::ptr_vector<mapnik::geometry_type> paths;
|
||||||
// TODO - contraint fails if multiple_geometries = true
|
mapnik::geometry_utils::from_wkb(paths, data, size, mapnik::wkbAuto);
|
||||||
bool multiple_geometries = false;
|
|
||||||
mapnik::geometry_utils::from_wkb(paths, data, size, multiple_geometries, mapnik::wkbAuto);
|
|
||||||
for (unsigned i=0; i<paths.size(); ++i)
|
for (unsigned i=0; i<paths.size(); ++i)
|
||||||
{
|
{
|
||||||
mapnik::box2d<double> const& bbox = paths[i].envelope();
|
mapnik::box2d<double> const& bbox = paths[i].envelope();
|
||||||
|
|
|
@ -44,7 +44,7 @@ void agg_renderer<T>::process(text_symbolizer const& sym,
|
||||||
|
|
||||||
if (geom.num_points() == 0) continue; // don't bother with empty geometries
|
if (geom.num_points() == 0) continue; // don't bother with empty geometries
|
||||||
|
|
||||||
if ((geom.type() == Polygon || geom.type() == MultiPolygon) && sym.get_minimum_path_length() > 0)
|
if ((geom.type() == Polygon) && sym.get_minimum_path_length() > 0)
|
||||||
{
|
{
|
||||||
// TODO - find less costly method than fetching full envelope
|
// TODO - find less costly method than fetching full envelope
|
||||||
box2d<double> gbox = t_.forward(geom.envelope(),prj_trans);
|
box2d<double> gbox = t_.forward(geom.envelope(),prj_trans);
|
||||||
|
|
|
@ -37,8 +37,6 @@ namespace mapnik
|
||||||
{
|
{
|
||||||
layer::layer(std::string const& name, std::string const& srs)
|
layer::layer(std::string const& name, std::string const& srs)
|
||||||
: name_(name),
|
: name_(name),
|
||||||
title_(""),
|
|
||||||
abstract_(""),
|
|
||||||
srs_(srs),
|
srs_(srs),
|
||||||
minZoom_(0),
|
minZoom_(0),
|
||||||
maxZoom_(std::numeric_limits<double>::max()),
|
maxZoom_(std::numeric_limits<double>::max()),
|
||||||
|
@ -51,8 +49,6 @@ layer::layer(std::string const& name, std::string const& srs)
|
||||||
|
|
||||||
layer::layer(const layer& rhs)
|
layer::layer(const layer& rhs)
|
||||||
: name_(rhs.name_),
|
: name_(rhs.name_),
|
||||||
title_(rhs.title_),
|
|
||||||
abstract_(rhs.abstract_),
|
|
||||||
srs_(rhs.srs_),
|
srs_(rhs.srs_),
|
||||||
minZoom_(rhs.minZoom_),
|
minZoom_(rhs.minZoom_),
|
||||||
maxZoom_(rhs.maxZoom_),
|
maxZoom_(rhs.maxZoom_),
|
||||||
|
@ -79,8 +75,6 @@ bool layer::operator==(layer const& other) const
|
||||||
void layer::swap(const layer& rhs)
|
void layer::swap(const layer& rhs)
|
||||||
{
|
{
|
||||||
name_=rhs.name_;
|
name_=rhs.name_;
|
||||||
title_=rhs.title_;
|
|
||||||
abstract_=rhs.abstract_;
|
|
||||||
srs_ = rhs.srs_;
|
srs_ = rhs.srs_;
|
||||||
minZoom_=rhs.minZoom_;
|
minZoom_=rhs.minZoom_;
|
||||||
maxZoom_=rhs.maxZoom_;
|
maxZoom_=rhs.maxZoom_;
|
||||||
|
@ -105,26 +99,6 @@ std::string const& layer::name() const
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void layer::set_title( std::string const& title)
|
|
||||||
{
|
|
||||||
title_ = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string const& layer::title() const
|
|
||||||
{
|
|
||||||
return title_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void layer::set_abstract( std::string const& abstract)
|
|
||||||
{
|
|
||||||
abstract_ = abstract;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string const& layer::abstract() const
|
|
||||||
{
|
|
||||||
return abstract_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void layer::set_srs(std::string const& srs)
|
void layer::set_srs(std::string const& srs)
|
||||||
{
|
{
|
||||||
srs_ = srs;
|
srs_ = srs;
|
||||||
|
|
|
@ -577,8 +577,6 @@ void map_parser::parse_layer( Map & map, ptree const & lay )
|
||||||
s << "name,"
|
s << "name,"
|
||||||
<< "srs,"
|
<< "srs,"
|
||||||
<< "status,"
|
<< "status,"
|
||||||
<< "title,"
|
|
||||||
<< "abstract,"
|
|
||||||
<< "minzoom,"
|
<< "minzoom,"
|
||||||
<< "maxzoom,"
|
<< "maxzoom,"
|
||||||
<< "queryable,"
|
<< "queryable,"
|
||||||
|
@ -600,19 +598,7 @@ void map_parser::parse_layer( Map & map, ptree const & lay )
|
||||||
{
|
{
|
||||||
lyr.setActive( * status );
|
lyr.setActive( * status );
|
||||||
}
|
}
|
||||||
|
|
||||||
optional<std::string> title = get_opt_attr<std::string>(lay, "title");
|
|
||||||
if (title)
|
|
||||||
{
|
|
||||||
lyr.set_title( * title );
|
|
||||||
}
|
|
||||||
|
|
||||||
optional<std::string> abstract = get_opt_attr<std::string>(lay, "abstract");
|
|
||||||
if (abstract)
|
|
||||||
{
|
|
||||||
lyr.set_abstract( * abstract );
|
|
||||||
}
|
|
||||||
|
|
||||||
optional<double> minZoom = get_opt_attr<double>(lay, "minzoom");
|
optional<double> minZoom = get_opt_attr<double>(lay, "minzoom");
|
||||||
if (minZoom)
|
if (minZoom)
|
||||||
{
|
{
|
||||||
|
@ -765,14 +751,12 @@ void map_parser::parse_layer( Map & map, ptree const & lay )
|
||||||
|
|
||||||
void map_parser::parse_rule( feature_type_style & style, ptree const & r )
|
void map_parser::parse_rule( feature_type_style & style, ptree const & r )
|
||||||
{
|
{
|
||||||
ensure_attrs(r, "Rule", "name,title");
|
ensure_attrs(r, "Rule", "name");
|
||||||
std::string name;
|
std::string name;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
name = get_attr( r, "name", std::string());
|
name = get_attr( r, "name", std::string());
|
||||||
std::string title = get_attr( r, "title", std::string());
|
rule rule(name);
|
||||||
|
|
||||||
rule rule(name,title);
|
|
||||||
|
|
||||||
optional<std::string> filter_expr =
|
optional<std::string> filter_expr =
|
||||||
get_opt_child<std::string>( r, "Filter");
|
get_opt_child<std::string>( r, "Filter");
|
||||||
|
|
|
@ -646,11 +646,7 @@ void serialize_rule( ptree & style_node, const rule & r, bool explicit_defaults)
|
||||||
{
|
{
|
||||||
set_attr(rule_node, "name", r.get_name());
|
set_attr(rule_node, "name", r.get_name());
|
||||||
}
|
}
|
||||||
if ( r.get_title() != dfl.get_title() )
|
|
||||||
{
|
|
||||||
set_attr(rule_node, "title", r.get_title());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( r.has_else_filter() )
|
if ( r.has_else_filter() )
|
||||||
{
|
{
|
||||||
rule_node.push_back( ptree::value_type(
|
rule_node.push_back( ptree::value_type(
|
||||||
|
@ -814,21 +810,12 @@ void serialize_layer( ptree & map_node, const layer & layer, bool explicit_defau
|
||||||
{
|
{
|
||||||
ptree & layer_node = map_node.push_back(
|
ptree & layer_node = map_node.push_back(
|
||||||
ptree::value_type("Layer", ptree()))->second;
|
ptree::value_type("Layer", ptree()))->second;
|
||||||
|
|
||||||
if ( layer.name() != "" )
|
if ( layer.name() != "" )
|
||||||
{
|
{
|
||||||
set_attr( layer_node, "name", layer.name() );
|
set_attr( layer_node, "name", layer.name() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( layer.abstract() != "" )
|
|
||||||
{
|
|
||||||
set_attr( layer_node, "abstract", layer.abstract() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( layer.title() != "" )
|
|
||||||
{
|
|
||||||
set_attr( layer_node, "title", layer.title() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( layer.srs() != "" )
|
if ( layer.srs() != "" )
|
||||||
{
|
{
|
||||||
set_attr( layer_node, "srs", layer.srs() );
|
set_attr( layer_node, "srs", layer.srs() );
|
||||||
|
|
222
src/wkb.cpp
222
src/wkb.cpp
|
@ -114,16 +114,13 @@ public:
|
||||||
needSwap_ = byteOrder_ ? wkbNDR : wkbXDR;
|
needSwap_ = byteOrder_ ? wkbNDR : wkbXDR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~wkb_reader() {}
|
void read(boost::ptr_vector<geometry_type> & paths)
|
||||||
|
|
||||||
void read_multi(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
{
|
||||||
int type = read_integer();
|
int type = read_integer();
|
||||||
|
|
||||||
#ifdef MAPNIK_DEBUG_WKB
|
#ifdef MAPNIK_DEBUG_WKB
|
||||||
std::clog << "wkb_reader: read_multi "
|
std::clog << "wkb_reader: read " << wkb_geometry_type_string(type) << " " << type << std::endl;
|
||||||
<< wkb_geometry_type_string(type) << " " << type << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -174,63 +171,6 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
|
||||||
int type = read_integer();
|
|
||||||
|
|
||||||
#ifdef MAPNIK_DEBUG_WKB
|
|
||||||
std::clog << "wkb_reader: read " << wkb_geometry_type_string(type) << " " << type << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case wkbPoint:
|
|
||||||
read_point(paths);
|
|
||||||
break;
|
|
||||||
case wkbLineString:
|
|
||||||
read_linestring(paths);
|
|
||||||
break;
|
|
||||||
case wkbPolygon:
|
|
||||||
read_polygon(paths);
|
|
||||||
break;
|
|
||||||
case wkbMultiPoint:
|
|
||||||
read_multipoint_2(paths);
|
|
||||||
break;
|
|
||||||
case wkbMultiLineString:
|
|
||||||
read_multilinestring_2(paths);
|
|
||||||
break;
|
|
||||||
case wkbMultiPolygon:
|
|
||||||
read_multipolygon_2(paths);
|
|
||||||
break;
|
|
||||||
case wkbGeometryCollection:
|
|
||||||
read_collection_2(paths);
|
|
||||||
break;
|
|
||||||
case wkbPointZ:
|
|
||||||
read_point_xyz(paths);
|
|
||||||
break;
|
|
||||||
case wkbLineStringZ:
|
|
||||||
read_linestring_xyz(paths);
|
|
||||||
break;
|
|
||||||
case wkbPolygonZ:
|
|
||||||
read_polygon_xyz(paths);
|
|
||||||
break;
|
|
||||||
case wkbMultiPointZ:
|
|
||||||
read_multipoint_xyz_2(paths);
|
|
||||||
break;
|
|
||||||
case wkbMultiLineStringZ:
|
|
||||||
read_multilinestring_xyz_2(paths);
|
|
||||||
break;
|
|
||||||
case wkbMultiPolygonZ:
|
|
||||||
read_multipolygon_xyz_2(paths);
|
|
||||||
break;
|
|
||||||
case wkbGeometryCollectionZ:
|
|
||||||
read_collection_2(paths);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -329,21 +269,7 @@ private:
|
||||||
read_point(paths);
|
read_point(paths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_multipoint_2(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
|
||||||
geometry_type* pt = new geometry_type(MultiPoint);
|
|
||||||
int num_points = read_integer();
|
|
||||||
for (int i = 0; i < num_points; ++i)
|
|
||||||
{
|
|
||||||
pos_ += 5;
|
|
||||||
double x = read_double();
|
|
||||||
double y = read_double();
|
|
||||||
pt->move_to(x, y);
|
|
||||||
}
|
|
||||||
paths.push_back(pt);
|
|
||||||
}
|
|
||||||
|
|
||||||
void read_point_xyz(boost::ptr_vector<geometry_type> & paths)
|
void read_point_xyz(boost::ptr_vector<geometry_type> & paths)
|
||||||
{
|
{
|
||||||
geometry_type* pt = new geometry_type(Point);
|
geometry_type* pt = new geometry_type(Point);
|
||||||
|
@ -364,22 +290,6 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_multipoint_xyz_2(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
|
||||||
geometry_type* pt = new geometry_type(MultiPoint);
|
|
||||||
int num_points = read_integer();
|
|
||||||
for (int i = 0; i < num_points; ++i)
|
|
||||||
{
|
|
||||||
pos_ += 5;
|
|
||||||
double x = read_double();
|
|
||||||
double y = read_double();
|
|
||||||
pos_ += 8; // double z = read_double();
|
|
||||||
pt->move_to(x, y);
|
|
||||||
}
|
|
||||||
paths.push_back(pt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void read_linestring(boost::ptr_vector<geometry_type> & paths)
|
void read_linestring(boost::ptr_vector<geometry_type> & paths)
|
||||||
{
|
{
|
||||||
geometry_type* line = new geometry_type(LineString);
|
geometry_type* line = new geometry_type(LineString);
|
||||||
|
@ -404,29 +314,7 @@ private:
|
||||||
read_linestring(paths);
|
read_linestring(paths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_multilinestring_2(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
|
||||||
geometry_type* line = new geometry_type(MultiLineString);
|
|
||||||
int num_lines = read_integer();
|
|
||||||
unsigned capacity = 0;
|
|
||||||
for (int i = 0; i < num_lines; ++i)
|
|
||||||
{
|
|
||||||
pos_ += 5;
|
|
||||||
int num_points = read_integer();
|
|
||||||
capacity += num_points;
|
|
||||||
CoordinateArray ar(num_points);
|
|
||||||
read_coords(ar);
|
|
||||||
line->set_capacity(capacity);
|
|
||||||
line->move_to(ar[0].x, ar[0].y);
|
|
||||||
for (int j = 1; j < num_points; ++j)
|
|
||||||
{
|
|
||||||
line->line_to(ar[j].x, ar[j].y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
paths.push_back(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void read_linestring_xyz(boost::ptr_vector<geometry_type> & paths)
|
void read_linestring_xyz(boost::ptr_vector<geometry_type> & paths)
|
||||||
{
|
{
|
||||||
geometry_type* line = new geometry_type(LineString);
|
geometry_type* line = new geometry_type(LineString);
|
||||||
|
@ -452,29 +340,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_multilinestring_xyz_2(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
|
||||||
geometry_type* line = new geometry_type(MultiLineString);
|
|
||||||
int num_lines = read_integer();
|
|
||||||
unsigned capacity = 0;
|
|
||||||
for (int i = 0; i < num_lines; ++i)
|
|
||||||
{
|
|
||||||
pos_ += 5;
|
|
||||||
int num_points = read_integer();
|
|
||||||
capacity += num_points;
|
|
||||||
CoordinateArray ar(num_points);
|
|
||||||
read_coords_xyz(ar);
|
|
||||||
line->set_capacity(capacity);
|
|
||||||
line->move_to(ar[0].x, ar[0].y);
|
|
||||||
for (int j = 1; j < num_points; ++j)
|
|
||||||
{
|
|
||||||
line->line_to(ar[j].x, ar[j].y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
paths.push_back(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void read_polygon(boost::ptr_vector<geometry_type> & paths)
|
void read_polygon(boost::ptr_vector<geometry_type> & paths)
|
||||||
{
|
{
|
||||||
geometry_type* poly = new geometry_type(Polygon);
|
geometry_type* poly = new geometry_type(Polygon);
|
||||||
|
@ -506,33 +372,6 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_multipolygon_2(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
|
||||||
geometry_type* poly = new geometry_type(MultiPolygon);
|
|
||||||
int num_polys = read_integer();
|
|
||||||
unsigned capacity = 0;
|
|
||||||
for (int i = 0; i < num_polys; ++i)
|
|
||||||
{
|
|
||||||
pos_ += 5;
|
|
||||||
int num_rings = read_integer();
|
|
||||||
for (int r = 0; r < num_rings; ++r)
|
|
||||||
{
|
|
||||||
int num_points = read_integer();
|
|
||||||
capacity += num_points;
|
|
||||||
CoordinateArray ar(num_points);
|
|
||||||
read_coords(ar);
|
|
||||||
poly->set_capacity(capacity);
|
|
||||||
poly->move_to(ar[0].x, ar[0].y);
|
|
||||||
for (int j = 1; j < num_points; ++j)
|
|
||||||
{
|
|
||||||
poly->line_to(ar[j].x, ar[j].y);
|
|
||||||
}
|
|
||||||
poly->line_to(ar[0].x, ar[0].y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
paths.push_back(poly);
|
|
||||||
}
|
|
||||||
|
|
||||||
void read_polygon_xyz(boost::ptr_vector<geometry_type> & paths)
|
void read_polygon_xyz(boost::ptr_vector<geometry_type> & paths)
|
||||||
{
|
{
|
||||||
geometry_type* poly = new geometry_type(Polygon);
|
geometry_type* poly = new geometry_type(Polygon);
|
||||||
|
@ -564,34 +403,6 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_multipolygon_xyz_2(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
|
||||||
geometry_type* poly = new geometry_type(MultiPolygon);
|
|
||||||
int num_polys = read_integer();
|
|
||||||
unsigned capacity = 0;
|
|
||||||
for (int i = 0; i < num_polys; ++i)
|
|
||||||
{
|
|
||||||
pos_ += 5;
|
|
||||||
int num_rings = read_integer();
|
|
||||||
for (int r = 0; r < num_rings; ++r)
|
|
||||||
{
|
|
||||||
int num_points = read_integer();
|
|
||||||
capacity += num_points;
|
|
||||||
CoordinateArray ar(num_points);
|
|
||||||
read_coords_xyz(ar);
|
|
||||||
poly->set_capacity(capacity);
|
|
||||||
poly->move_to(ar[0].x, ar[0].y);
|
|
||||||
for (int j = 1; j < num_points; ++j)
|
|
||||||
{
|
|
||||||
poly->line_to(ar[j].x, ar[j].y);
|
|
||||||
}
|
|
||||||
poly->line_to(ar[0].x, ar[0].y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
paths.push_back(poly);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void read_collection(boost::ptr_vector<geometry_type> & paths)
|
void read_collection(boost::ptr_vector<geometry_type> & paths)
|
||||||
{
|
{
|
||||||
int num_geometries = read_integer();
|
int num_geometries = read_integer();
|
||||||
|
@ -602,16 +413,6 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_collection_2(boost::ptr_vector<geometry_type> & paths)
|
|
||||||
{
|
|
||||||
int num_geometries = read_integer();
|
|
||||||
for (int i = 0; i < num_geometries; ++i)
|
|
||||||
{
|
|
||||||
pos_ += 1; // skip byte order
|
|
||||||
read_multi(paths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MAPNIK_DEBUG_WKB
|
#ifdef MAPNIK_DEBUG_WKB
|
||||||
std::string wkb_geometry_type_string(int type)
|
std::string wkb_geometry_type_string(int type)
|
||||||
{
|
{
|
||||||
|
@ -645,17 +446,10 @@ private:
|
||||||
void geometry_utils::from_wkb (boost::ptr_vector<geometry_type>& paths,
|
void geometry_utils::from_wkb (boost::ptr_vector<geometry_type>& paths,
|
||||||
const char* wkb,
|
const char* wkb,
|
||||||
unsigned size,
|
unsigned size,
|
||||||
bool multiple_geometries,
|
|
||||||
wkbFormat format)
|
wkbFormat format)
|
||||||
{
|
{
|
||||||
wkb_reader reader(wkb, size, format);
|
wkb_reader reader(wkb, size, format);
|
||||||
if (multiple_geometries)
|
return reader.read(paths);
|
||||||
{
|
|
||||||
return reader.read_multi(paths);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return reader.read(paths);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,27 +47,6 @@
|
||||||
|
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
/*
|
|
||||||
struct blob_to_hex
|
|
||||||
{
|
|
||||||
std::string operator() (const char* blob, unsigned size)
|
|
||||||
{
|
|
||||||
std::string buf;
|
|
||||||
buf.reserve(size*2);
|
|
||||||
std::ostringstream s(buf);
|
|
||||||
s.seekp(0);
|
|
||||||
char hex[3];
|
|
||||||
std::memset(hex,0,3);
|
|
||||||
for ( unsigned pos=0; pos < size; ++pos)
|
|
||||||
{
|
|
||||||
std::sprintf (hex, "%02X", int(blob[pos]) & 0xff);
|
|
||||||
s << hex;
|
|
||||||
}
|
|
||||||
return s.str();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <typename Connection>
|
template <typename Connection>
|
||||||
void pgsql2sqlite(Connection conn,
|
void pgsql2sqlite(Connection conn,
|
||||||
std::string const& query,
|
std::string const& query,
|
||||||
|
@ -297,7 +276,7 @@ void pgsql2sqlite(Connection conn,
|
||||||
if (oid == geometry_oid)
|
if (oid == geometry_oid)
|
||||||
{
|
{
|
||||||
mapnik::Feature feat(pkid);
|
mapnik::Feature feat(pkid);
|
||||||
geometry_utils::from_wkb(feat.paths(),buf,size,false,wkbGeneric);
|
geometry_utils::from_wkb(feat.paths(),buf,size,wkbGeneric);
|
||||||
if (feat.num_geometries() > 0)
|
if (feat.num_geometries() > 0)
|
||||||
{
|
{
|
||||||
geometry_type const& geom=feat.get_geometry(0);
|
geometry_type const& geom=feat.get_geometry(0);
|
||||||
|
@ -316,8 +295,6 @@ void pgsql2sqlite(Connection conn,
|
||||||
empty_geom = false;
|
empty_geom = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//output_rec.push_back(sqlite::value_type("X'" + hex(buf,size) + "'"));
|
|
||||||
output_rec.push_back(sqlite::blob(buf,size));
|
output_rec.push_back(sqlite::blob(buf,size));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue