+ improved and cleaned up occi plugin
This commit is contained in:
parent
6713df5937
commit
1d7acffadb
5 changed files with 286 additions and 342 deletions
|
@ -40,10 +40,6 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
using std::clog;
|
|
||||||
using std::endl;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
using boost::lexical_cast;
|
using boost::lexical_cast;
|
||||||
using boost::bad_lexical_cast;
|
using boost::bad_lexical_cast;
|
||||||
|
|
||||||
|
@ -66,13 +62,14 @@ using oracle::occi::SQLException;
|
||||||
using oracle::occi::Type;
|
using oracle::occi::Type;
|
||||||
using oracle::occi::StatelessConnectionPool;
|
using oracle::occi::StatelessConnectionPool;
|
||||||
|
|
||||||
|
const std::string occi_datasource::METADATA_TABLE="USER_SDO_GEOM_METADATA";
|
||||||
|
|
||||||
DATASOURCE_PLUGIN(occi_datasource)
|
DATASOURCE_PLUGIN(occi_datasource)
|
||||||
|
|
||||||
|
|
||||||
occi_datasource::occi_datasource(parameters const& params, bool bind)
|
occi_datasource::occi_datasource(parameters const& params, bool bind)
|
||||||
: datasource (params),
|
: datasource (params),
|
||||||
type_(datasource::Vector),
|
type_(datasource::Vector),
|
||||||
table_(*params_.get<std::string>("table","")),
|
|
||||||
fields_(*params_.get<std::string>("fields","*")),
|
fields_(*params_.get<std::string>("fields","*")),
|
||||||
geometry_field_(*params_.get<std::string>("geometry_field","")),
|
geometry_field_(*params_.get<std::string>("geometry_field","")),
|
||||||
srid_initialized_(false),
|
srid_initialized_(false),
|
||||||
|
@ -80,13 +77,23 @@ occi_datasource::occi_datasource(parameters const& params, bool bind)
|
||||||
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding","utf-8")),
|
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding","utf-8")),
|
||||||
row_limit_(*params_.get<int>("row_limit",0)),
|
row_limit_(*params_.get<int>("row_limit",0)),
|
||||||
row_prefetch_(*params_.get<int>("row_prefetch",100)),
|
row_prefetch_(*params_.get<int>("row_prefetch",100)),
|
||||||
pool_(NULL),
|
pool_(0),
|
||||||
conn_(NULL)
|
conn_(0)
|
||||||
{
|
{
|
||||||
if (! params_.get<std::string>("user")) throw datasource_exception("No <user> specified");
|
if (! params_.get<std::string>("user")) throw datasource_exception("OCCI Plugin: no <user> specified");
|
||||||
if (! params_.get<std::string>("password")) throw datasource_exception("No <password> specified");
|
if (! params_.get<std::string>("password")) throw datasource_exception("OCCI Plugin: no <password> specified");
|
||||||
if (! params_.get<std::string>("host")) throw datasource_exception("No <host> string specified");
|
if (! params_.get<std::string>("host")) throw datasource_exception("OCCI Plugin: no <host> string specified");
|
||||||
|
|
||||||
|
boost::optional<std::string> table = params_.get<std::string>("table");
|
||||||
|
if (!table)
|
||||||
|
{
|
||||||
|
throw datasource_exception("OCCI Plugin: no <table> parameter specified");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
table_ = *table;
|
||||||
|
}
|
||||||
|
|
||||||
multiple_geometries_ = *params_.get<mapnik::boolean>("multiple_geometries",false);
|
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);
|
||||||
|
@ -115,12 +122,12 @@ occi_datasource::~occi_datasource()
|
||||||
|
|
||||||
if (use_connection_pool_)
|
if (use_connection_pool_)
|
||||||
{
|
{
|
||||||
if (pool_ != NULL)
|
if (pool_ != 0)
|
||||||
env->terminateStatelessConnectionPool (pool_);
|
env->terminateStatelessConnectionPool (pool_, StatelessConnectionPool::SPD_FORCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (conn_ != NULL)
|
if (conn_ != 0)
|
||||||
env->terminateConnection(conn_);
|
env->terminateConnection(conn_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +155,7 @@ void occi_datasource::bind() const
|
||||||
}
|
}
|
||||||
catch (SQLException &ex)
|
catch (SQLException &ex)
|
||||||
{
|
{
|
||||||
throw datasource_exception(ex.getMessage());
|
throw datasource_exception("OCCI Plugin: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -164,7 +171,7 @@ void occi_datasource::bind() const
|
||||||
}
|
}
|
||||||
catch (SQLException &ex)
|
catch (SQLException &ex)
|
||||||
{
|
{
|
||||||
throw datasource_exception(ex.getMessage());
|
throw datasource_exception("OCCI Plugin: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,12 +181,16 @@ void occi_datasource::bind() const
|
||||||
if (! srid_initialized_ || geometry_field_ == "")
|
if (! srid_initialized_ || geometry_field_ == "")
|
||||||
{
|
{
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "SELECT srid, column_name FROM " << SDO_GEOMETRY_METADATA_TABLE << " WHERE";
|
s << "SELECT srid, column_name FROM " << METADATA_TABLE << " WHERE";
|
||||||
s << " LOWER(table_name) = LOWER('" << table_name << "')";
|
s << " LOWER(table_name) = LOWER('" << table_name << "')";
|
||||||
|
|
||||||
if (geometry_field_ != "")
|
if (geometry_field_ != "")
|
||||||
s << " AND LOWER(column_name) = LOWER('" << geometry_field_ << "')";
|
s << " AND LOWER(column_name) = LOWER('" << geometry_field_ << "')";
|
||||||
|
|
||||||
|
#ifdef MAPNIK_DEBUG
|
||||||
|
std::clog << "OCCI Plugin: " << s.str() << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
occi_connection_ptr conn;
|
occi_connection_ptr conn;
|
||||||
|
@ -203,7 +214,7 @@ void occi_datasource::bind() const
|
||||||
}
|
}
|
||||||
catch (SQLException &ex)
|
catch (SQLException &ex)
|
||||||
{
|
{
|
||||||
throw datasource_exception(ex.getMessage());
|
throw datasource_exception("OCCI Plugin: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +223,10 @@ void occi_datasource::bind() const
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "SELECT " << fields_ << " FROM (" << table_name << ") WHERE rownum < 1";
|
s << "SELECT " << fields_ << " FROM (" << table_name << ") WHERE rownum < 1";
|
||||||
|
|
||||||
|
#ifdef MAPNIK_DEBUG
|
||||||
|
std::clog << "OCCI Plugin: " << s.str() << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
occi_connection_ptr conn;
|
occi_connection_ptr conn;
|
||||||
|
@ -230,14 +245,14 @@ void occi_datasource::bind() const
|
||||||
std::string fld_name = columnObj.getString(MetaData::ATTR_NAME);
|
std::string fld_name = columnObj.getString(MetaData::ATTR_NAME);
|
||||||
int type_oid = columnObj.getInt(MetaData::ATTR_DATA_TYPE);
|
int type_oid = columnObj.getInt(MetaData::ATTR_DATA_TYPE);
|
||||||
|
|
||||||
#if 0
|
/*
|
||||||
int type_code = columnObj.getInt(MetaData::ATTR_TYPECODE);
|
int type_code = columnObj.getInt(MetaData::ATTR_TYPECODE);
|
||||||
if (type_code == OCCI_TYPECODE_OBJECT)
|
if (type_code == OCCI_TYPECODE_OBJECT)
|
||||||
{
|
{
|
||||||
desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Object));
|
desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Object));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
*/
|
||||||
|
|
||||||
switch (type_oid)
|
switch (type_oid)
|
||||||
{
|
{
|
||||||
|
@ -301,14 +316,13 @@ void occi_datasource::bind() const
|
||||||
case oracle::occi::OCCI_SQLT_BLOB:
|
case oracle::occi::OCCI_SQLT_BLOB:
|
||||||
case oracle::occi::OCCI_SQLT_RSET:
|
case oracle::occi::OCCI_SQLT_RSET:
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "unsupported datatype " << occi_enums::resolve_datatype(type_oid)
|
std::clog << "OCCI Plugin: unsupported datatype " << occi_enums::resolve_datatype(type_oid)
|
||||||
<< " (type_oid=" << type_oid << ")" << endl;
|
<< " (type_oid=" << type_oid << ")" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "unknown datatype " << occi_enums::resolve_datatype(type_oid)
|
std::clog << "OCCI Plugin: unknown datatype (type_oid=" << type_oid << ")" << std::endl;
|
||||||
<< " (type_oid=" << type_oid << ")" << endl;
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -351,7 +365,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
s << " TABLE(SDO_UTIL.GETVERTICES(a.shape)) c";
|
s << " TABLE(SDO_UTIL.GETVERTICES(a.shape)) c";
|
||||||
|
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << s.str() << endl;
|
std::clog << "OCCI Plugin: " << s.str() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -374,13 +388,13 @@ box2d<double> occi_datasource::envelope() const
|
||||||
}
|
}
|
||||||
catch (bad_lexical_cast &ex)
|
catch (bad_lexical_cast &ex)
|
||||||
{
|
{
|
||||||
clog << ex.what() << endl;
|
std::clog << "OCCI Plugin: " << ex.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException &ex)
|
catch (SQLException &ex)
|
||||||
{
|
{
|
||||||
throw datasource_exception(ex.getMessage());
|
throw datasource_exception("OCCI Plugin: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (use_spatial_index_)
|
else if (use_spatial_index_)
|
||||||
|
@ -389,15 +403,15 @@ box2d<double> occi_datasource::envelope() const
|
||||||
|
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "SELECT dim.sdo_lb, dim.sdo_ub FROM ";
|
s << "SELECT dim.sdo_lb, dim.sdo_ub FROM ";
|
||||||
s << SDO_GEOMETRY_METADATA_TABLE << " m, TABLE(m.diminfo) dim ";
|
s << METADATA_TABLE << " m, TABLE(m.diminfo) dim ";
|
||||||
s << " WHERE LOWER(m.table_name) = LOWER('" << table_name << "') AND dim.sdo_dimname = 'X'";
|
s << " WHERE LOWER(m.table_name) = LOWER('" << table_name << "') AND dim.sdo_dimname = 'X'";
|
||||||
s << " UNION ";
|
s << " UNION ";
|
||||||
s << "SELECT dim.sdo_lb, dim.sdo_ub FROM ";
|
s << "SELECT dim.sdo_lb, dim.sdo_ub FROM ";
|
||||||
s << SDO_GEOMETRY_METADATA_TABLE << " m, TABLE(m.diminfo) dim ";
|
s << METADATA_TABLE << " m, TABLE(m.diminfo) dim ";
|
||||||
s << " WHERE LOWER(m.table_name) = LOWER('" << table_name << "') AND dim.sdo_dimname = 'Y'";
|
s << " WHERE LOWER(m.table_name) = LOWER('" << table_name << "') AND dim.sdo_dimname = 'Y'";
|
||||||
|
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << s.str() << endl;
|
std::clog << "OCCI Plugin: " << s.str() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -418,7 +432,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
}
|
}
|
||||||
catch (bad_lexical_cast &ex)
|
catch (bad_lexical_cast &ex)
|
||||||
{
|
{
|
||||||
clog << ex.what() << endl;
|
std::clog << "OCCI Plugin: " << ex.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +445,7 @@ box2d<double> occi_datasource::envelope() const
|
||||||
}
|
}
|
||||||
catch (bad_lexical_cast &ex)
|
catch (bad_lexical_cast &ex)
|
||||||
{
|
{
|
||||||
clog << ex.what() << endl;
|
std::clog << "OCCI Plugin: " << ex.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,12 +455,12 @@ box2d<double> occi_datasource::envelope() const
|
||||||
}
|
}
|
||||||
catch (SQLException &ex)
|
catch (SQLException &ex)
|
||||||
{
|
{
|
||||||
throw datasource_exception(ex.getMessage());
|
throw datasource_exception("OCCI Plugin: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! extent_initialized_)
|
if (! extent_initialized_)
|
||||||
throw datasource_exception("Unable to determine the extent of a <occi> table");
|
throw datasource_exception("OCCI Plugin: unable to determine the extent of a <occi> table");
|
||||||
|
|
||||||
return extent_;
|
return extent_;
|
||||||
}
|
}
|
||||||
|
@ -465,13 +479,13 @@ featureset_ptr occi_datasource::features(query const& q) const
|
||||||
box2d<double> const& box=q.get_bbox();
|
box2d<double> const& box=q.get_bbox();
|
||||||
|
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "SELECT " << geometry_field_ << " AS geom";
|
s << "SELECT " << geometry_field_;
|
||||||
std::set<std::string> const& props = q.property_names();
|
std::set<std::string> const& props = q.property_names();
|
||||||
std::set<std::string>::const_iterator pos = props.begin();
|
std::set<std::string>::const_iterator pos = props.begin();
|
||||||
std::set<std::string>::const_iterator end = props.end();
|
std::set<std::string>::const_iterator end = props.end();
|
||||||
while (pos != end)
|
while (pos != end)
|
||||||
{
|
{
|
||||||
s << ",\"" << *pos << "\"";
|
s << ", " << *pos;
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +516,7 @@ featureset_ptr occi_datasource::features(query const& q) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "Cannot determine where to add the spatial filter declaration" << endl;
|
std::clog << "OCCI Plugin: cannot determine where to add the spatial filter declaration" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,7 +536,7 @@ featureset_ptr occi_datasource::features(query const& q) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "Cannot determine where to add the row limit declaration" << endl;
|
std::clog << "OCCI Plugin: cannot determine where to add the row limit declaration" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,7 +544,7 @@ featureset_ptr occi_datasource::features(query const& q) const
|
||||||
s << query;
|
s << query;
|
||||||
|
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << s.str() << endl;
|
std::clog << "OCCI Plugin: " << s.str() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return featureset_ptr (new occi_featureset (pool_,
|
return featureset_ptr (new occi_featureset (pool_,
|
||||||
|
@ -548,13 +562,13 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
if (!is_bound_) bind();
|
if (!is_bound_) bind();
|
||||||
|
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s << "SELECT " << geometry_field_ << " AS geom";
|
s << "SELECT " << geometry_field_;
|
||||||
std::vector<attribute_descriptor>::const_iterator itr = desc_.get_descriptors().begin();
|
std::vector<attribute_descriptor>::const_iterator itr = desc_.get_descriptors().begin();
|
||||||
std::vector<attribute_descriptor>::const_iterator end = desc_.get_descriptors().end();
|
std::vector<attribute_descriptor>::const_iterator end = desc_.get_descriptors().end();
|
||||||
unsigned size=0;
|
unsigned size=0;
|
||||||
while (itr != end)
|
while (itr != end)
|
||||||
{
|
{
|
||||||
s << ",\"" << itr->get_name() << "\"";
|
s << ", " << itr->get_name();
|
||||||
++itr;
|
++itr;
|
||||||
++size;
|
++size;
|
||||||
}
|
}
|
||||||
|
@ -585,7 +599,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "Cannot determine where to add the spatial filter declaration" << endl;
|
std::clog << "OCCI Plugin: cannot determine where to add the spatial filter declaration" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -605,7 +619,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "Cannot determine where to add the row limit declaration" << endl;
|
std::clog << "OCCI Plugin: cannot determine where to add the row limit declaration" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,7 +627,7 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
s << query;
|
s << query;
|
||||||
|
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << s.str() << endl;
|
std::clog << "OCCI Plugin: " << s.str() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return featureset_ptr (new occi_featureset (pool_,
|
return featureset_ptr (new occi_featureset (pool_,
|
||||||
|
@ -625,3 +639,4 @@ featureset_ptr occi_datasource::features_at_point(coord2d const& pt) const
|
||||||
row_prefetch_,
|
row_prefetch_,
|
||||||
size));
|
size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ class occi_datasource : public mapnik::datasource
|
||||||
bool use_connection_pool_;
|
bool use_connection_pool_;
|
||||||
bool multiple_geometries_;
|
bool multiple_geometries_;
|
||||||
bool use_spatial_index_;
|
bool use_spatial_index_;
|
||||||
|
static const std::string METADATA_TABLE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
//$Id$
|
//$Id$
|
||||||
|
|
||||||
|
// mapnik
|
||||||
#include <mapnik/global.hpp>
|
#include <mapnik/global.hpp>
|
||||||
#include <mapnik/datasource.hpp>
|
#include <mapnik/datasource.hpp>
|
||||||
#include <mapnik/box2d.hpp>
|
#include <mapnik/box2d.hpp>
|
||||||
|
@ -30,12 +31,12 @@
|
||||||
#include <mapnik/wkb.hpp>
|
#include <mapnik/wkb.hpp>
|
||||||
#include <mapnik/unicode.hpp>
|
#include <mapnik/unicode.hpp>
|
||||||
|
|
||||||
|
// boost
|
||||||
|
#include <boost/shared_array.hpp>
|
||||||
|
|
||||||
// ogr
|
// ogr
|
||||||
#include "occi_featureset.hpp"
|
#include "occi_featureset.hpp"
|
||||||
|
|
||||||
using std::clog;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
using mapnik::query;
|
using mapnik::query;
|
||||||
using mapnik::box2d;
|
using mapnik::box2d;
|
||||||
using mapnik::CoordTransform;
|
using mapnik::CoordTransform;
|
||||||
|
@ -54,6 +55,7 @@ using oracle::occi::MetaData;
|
||||||
using oracle::occi::SQLException;
|
using oracle::occi::SQLException;
|
||||||
using oracle::occi::Type;
|
using oracle::occi::Type;
|
||||||
using oracle::occi::Number;
|
using oracle::occi::Number;
|
||||||
|
using oracle::occi::Blob;
|
||||||
|
|
||||||
occi_featureset::occi_featureset(StatelessConnectionPool* pool,
|
occi_featureset::occi_featureset(StatelessConnectionPool* pool,
|
||||||
Connection* conn,
|
Connection* conn,
|
||||||
|
@ -79,7 +81,7 @@ occi_featureset::occi_featureset(StatelessConnectionPool* pool,
|
||||||
}
|
}
|
||||||
catch (SQLException &ex)
|
catch (SQLException &ex)
|
||||||
{
|
{
|
||||||
throw datasource_exception(ex.getMessage());
|
std::clog << "OCCI Plugin: error processing " << sqlstring << " : " << ex.getMessage() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,107 +105,91 @@ feature_ptr occi_featureset::next()
|
||||||
|
|
||||||
for (unsigned int i = 1; i < listOfColumns.size(); ++i)
|
for (unsigned int i = 1; i < listOfColumns.size(); ++i)
|
||||||
{
|
{
|
||||||
MetaData columnObj = listOfColumns[i];
|
MetaData columnObj = listOfColumns[i];
|
||||||
|
|
||||||
std::string fld_name = columnObj.getString(MetaData::ATTR_NAME);
|
std::string fld_name = columnObj.getString(MetaData::ATTR_NAME);
|
||||||
int type_oid = columnObj.getInt(MetaData::ATTR_DATA_TYPE);
|
int type_oid = columnObj.getInt(MetaData::ATTR_DATA_TYPE);
|
||||||
|
|
||||||
#if 0
|
/*
|
||||||
int type_code = columnObj.getInt(MetaData::ATTR_TYPECODE);
|
int type_code = columnObj.getInt(MetaData::ATTR_TYPECODE);
|
||||||
if (type_code == OCCI_TYPECODE_OBJECT)
|
if (type_code == OCCI_TYPECODE_OBJECT)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
*/
|
||||||
|
|
||||||
switch (type_oid)
|
switch (type_oid)
|
||||||
{
|
{
|
||||||
case oracle::occi::OCCIBOOL:
|
case oracle::occi::OCCIBOOL:
|
||||||
case oracle::occi::OCCIINT:
|
case oracle::occi::OCCIINT:
|
||||||
case oracle::occi::OCCIUNSIGNED_INT:
|
case oracle::occi::OCCIUNSIGNED_INT:
|
||||||
case oracle::occi::OCCIROWID:
|
case oracle::occi::OCCIROWID:
|
||||||
{
|
boost::put(*feature,fld_name,rs_->getInt (i + 1));
|
||||||
boost::put(*feature,fld_name,rs_->getInt (i + 1));
|
break;
|
||||||
break;
|
case oracle::occi::OCCIFLOAT:
|
||||||
}
|
case oracle::occi::OCCIBFLOAT:
|
||||||
|
case oracle::occi::OCCIDOUBLE:
|
||||||
case oracle::occi::OCCIFLOAT:
|
case oracle::occi::OCCIBDOUBLE:
|
||||||
case oracle::occi::OCCIBFLOAT:
|
case oracle::occi::OCCINUMBER:
|
||||||
case oracle::occi::OCCIDOUBLE:
|
case oracle::occi::OCCI_SQLT_NUM:
|
||||||
case oracle::occi::OCCIBDOUBLE:
|
boost::put(*feature,fld_name,rs_->getDouble (i + 1));
|
||||||
case oracle::occi::OCCINUMBER:
|
break;
|
||||||
case oracle::occi::OCCI_SQLT_NUM:
|
case oracle::occi::OCCICHAR:
|
||||||
{
|
case oracle::occi::OCCISTRING:
|
||||||
boost::put(*feature,fld_name,rs_->getDouble (i + 1));
|
case oracle::occi::OCCI_SQLT_AFC:
|
||||||
break;
|
case oracle::occi::OCCI_SQLT_AVC:
|
||||||
}
|
case oracle::occi::OCCI_SQLT_CHR:
|
||||||
|
case oracle::occi::OCCI_SQLT_LVC:
|
||||||
case oracle::occi::OCCICHAR:
|
case oracle::occi::OCCI_SQLT_RDD:
|
||||||
case oracle::occi::OCCISTRING:
|
case oracle::occi::OCCI_SQLT_STR:
|
||||||
case oracle::occi::OCCI_SQLT_AFC:
|
case oracle::occi::OCCI_SQLT_VCS:
|
||||||
case oracle::occi::OCCI_SQLT_AVC:
|
case oracle::occi::OCCI_SQLT_VNU:
|
||||||
case oracle::occi::OCCI_SQLT_CHR:
|
case oracle::occi::OCCI_SQLT_VBI:
|
||||||
case oracle::occi::OCCI_SQLT_LVC:
|
case oracle::occi::OCCI_SQLT_VST:
|
||||||
case oracle::occi::OCCI_SQLT_RDD:
|
boost::put(*feature,fld_name,(UnicodeString) tr_->transcode (rs_->getString (i + 1).c_str()));
|
||||||
case oracle::occi::OCCI_SQLT_STR:
|
break;
|
||||||
case oracle::occi::OCCI_SQLT_VCS:
|
case oracle::occi::OCCIDATE:
|
||||||
case oracle::occi::OCCI_SQLT_VNU:
|
case oracle::occi::OCCITIMESTAMP:
|
||||||
case oracle::occi::OCCI_SQLT_VBI:
|
case oracle::occi::OCCIINTERVALDS:
|
||||||
case oracle::occi::OCCI_SQLT_VST:
|
case oracle::occi::OCCIINTERVALYM:
|
||||||
{
|
case oracle::occi::OCCI_SQLT_DAT:
|
||||||
UnicodeString ustr = tr_->transcode (rs_->getString (i + 1).c_str());
|
case oracle::occi::OCCI_SQLT_DATE:
|
||||||
boost::put(*feature,fld_name,ustr);
|
case oracle::occi::OCCI_SQLT_TIME:
|
||||||
break;
|
case oracle::occi::OCCI_SQLT_TIME_TZ:
|
||||||
}
|
case oracle::occi::OCCI_SQLT_TIMESTAMP:
|
||||||
|
case oracle::occi::OCCI_SQLT_TIMESTAMP_LTZ:
|
||||||
case oracle::occi::OCCIDATE:
|
case oracle::occi::OCCI_SQLT_TIMESTAMP_TZ:
|
||||||
case oracle::occi::OCCITIMESTAMP:
|
case oracle::occi::OCCI_SQLT_INTERVAL_YM:
|
||||||
case oracle::occi::OCCIINTERVALDS:
|
case oracle::occi::OCCI_SQLT_INTERVAL_DS:
|
||||||
case oracle::occi::OCCIINTERVALYM:
|
case oracle::occi::OCCIANYDATA:
|
||||||
case oracle::occi::OCCI_SQLT_DAT:
|
case oracle::occi::OCCIBLOB:
|
||||||
case oracle::occi::OCCI_SQLT_DATE:
|
case oracle::occi::OCCIBFILE:
|
||||||
case oracle::occi::OCCI_SQLT_TIME:
|
case oracle::occi::OCCIBYTES:
|
||||||
case oracle::occi::OCCI_SQLT_TIME_TZ:
|
case oracle::occi::OCCICLOB:
|
||||||
case oracle::occi::OCCI_SQLT_TIMESTAMP:
|
case oracle::occi::OCCIVECTOR:
|
||||||
case oracle::occi::OCCI_SQLT_TIMESTAMP_LTZ:
|
case oracle::occi::OCCIMETADATA:
|
||||||
case oracle::occi::OCCI_SQLT_TIMESTAMP_TZ:
|
case oracle::occi::OCCIPOBJECT:
|
||||||
case oracle::occi::OCCI_SQLT_INTERVAL_YM:
|
case oracle::occi::OCCIREF:
|
||||||
case oracle::occi::OCCI_SQLT_INTERVAL_DS:
|
case oracle::occi::OCCIREFANY:
|
||||||
case oracle::occi::OCCIANYDATA:
|
case oracle::occi::OCCISTREAM:
|
||||||
case oracle::occi::OCCIBLOB:
|
case oracle::occi::OCCICURSOR:
|
||||||
case oracle::occi::OCCIBFILE:
|
case oracle::occi::OCCI_SQLT_FILE:
|
||||||
case oracle::occi::OCCIBYTES:
|
case oracle::occi::OCCI_SQLT_CFILE:
|
||||||
case oracle::occi::OCCICLOB:
|
case oracle::occi::OCCI_SQLT_REF:
|
||||||
case oracle::occi::OCCIVECTOR:
|
case oracle::occi::OCCI_SQLT_CLOB:
|
||||||
case oracle::occi::OCCIMETADATA:
|
case oracle::occi::OCCI_SQLT_BLOB:
|
||||||
case oracle::occi::OCCIPOBJECT:
|
case oracle::occi::OCCI_SQLT_RSET:
|
||||||
case oracle::occi::OCCIREF:
|
|
||||||
case oracle::occi::OCCIREFANY:
|
|
||||||
case oracle::occi::OCCISTREAM:
|
|
||||||
case oracle::occi::OCCICURSOR:
|
|
||||||
case oracle::occi::OCCI_SQLT_FILE:
|
|
||||||
case oracle::occi::OCCI_SQLT_CFILE:
|
|
||||||
case oracle::occi::OCCI_SQLT_REF:
|
|
||||||
case oracle::occi::OCCI_SQLT_CLOB:
|
|
||||||
case oracle::occi::OCCI_SQLT_BLOB:
|
|
||||||
case oracle::occi::OCCI_SQLT_RSET:
|
|
||||||
{
|
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "unsupported datatype " << occi_enums::resolve_datatype(type_oid)
|
std::clog << "OCCI Plugin: unsupported datatype " << occi_enums::resolve_datatype(type_oid)
|
||||||
<< " (type_oid=" << type_oid << ")" << endl;
|
<< " (type_oid=" << type_oid << ")" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
default: // shouldn't get here
|
||||||
|
|
||||||
default: // shouldn't get here
|
|
||||||
{
|
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "unknown datatype " << occi_enums::resolve_datatype(type_oid)
|
std::clog << "OCCI Plugin: unknown datatype (type_oid=" << type_oid << ")" << std::endl;
|
||||||
<< " (type_oid=" << type_oid << ")" << endl;
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++count_;
|
++count_;
|
||||||
|
@ -216,200 +202,150 @@ 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, bool multiple_geometries)
|
||||||
{
|
{
|
||||||
int gtype = (int) geom->getSdo_gtype();
|
int gtype = (int) geom->getSdo_gtype();
|
||||||
int dimensions = gtype / 1000;
|
int dimensions = gtype / 1000;
|
||||||
int lrsvalue = (gtype - dimensions * 1000) / 100;
|
int lrsvalue = (gtype - dimensions * 1000) / 100;
|
||||||
int geomtype = (gtype - dimensions * 1000 - lrsvalue * 100);
|
int geomtype = (gtype - dimensions * 1000 - lrsvalue * 100);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
clog << "-----------Geometry Object ------------" << endl;
|
clog << "-----------Geometry Object ------------" << endl;
|
||||||
clog << "SDO GTYPE = " << gtype << endl;
|
clog << "SDO GTYPE = " << gtype << endl;
|
||||||
clog << "SDO DIMENSIONS = " << dimensions << endl;
|
clog << "SDO DIMENSIONS = " << dimensions << endl;
|
||||||
clog << "SDO LRS = " << lrsvalue << endl;
|
clog << "SDO LRS = " << lrsvalue << endl;
|
||||||
clog << "SDO GEOMETRY TYPE = " << geomtype << endl;
|
clog << "SDO GEOMETRY TYPE = " << geomtype << endl;
|
||||||
|
|
||||||
Number sdo_srid = geom->getSdo_srid();
|
Number sdo_srid = geom->getSdo_srid();
|
||||||
if (sdo_srid.isNull())
|
if (sdo_srid.isNull())
|
||||||
clog << "SDO SRID = " << "Null" << endl;
|
clog << "SDO SRID = " << "Null" << endl;
|
||||||
else
|
else
|
||||||
clog << "SDO SRID = " << (int) sdo_srid << endl;
|
clog << "SDO SRID = " << (int) sdo_srid << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (geomtype)
|
const std::vector<Number>& elem_info = geom->getSdo_elem_info();
|
||||||
{
|
const std::vector<Number>& ordinates = geom->getSdo_ordinates();
|
||||||
case SDO_GTYPE_POINT:
|
const int ordinates_size = (int) ordinates.size();
|
||||||
convert_point (geom, feature, dimensions);
|
|
||||||
break;
|
switch (geomtype)
|
||||||
case SDO_GTYPE_LINE:
|
{
|
||||||
convert_linestring (geom, feature, dimensions);
|
case SDO_GTYPE_POINT:
|
||||||
break;
|
{
|
||||||
case SDO_GTYPE_POLYGON:
|
SDOPointType* sdopoint = geom->getSdo_point();
|
||||||
convert_polygon (geom, feature, dimensions);
|
if (sdopoint && ! sdopoint->isNull())
|
||||||
break;
|
{
|
||||||
case SDO_GTYPE_MULTIPOINT:
|
geometry_type* point = new geometry_type(mapnik::Point);
|
||||||
// Todo - using convert_multipoint_2 until we have proper multipoint handling in convert_multipoint
|
point->move_to (sdopoint->getX(), sdopoint->getY());
|
||||||
// http://trac.mapnik.org/ticket/458
|
feature->add_geometry (point);
|
||||||
//convert_multipoint (geom, feature, dimensions, multiple_geometries);
|
}
|
||||||
convert_multipoint (geom, feature, dimensions, true);
|
}
|
||||||
break;
|
break;
|
||||||
case SDO_GTYPE_MULTILINE:
|
case SDO_GTYPE_LINE:
|
||||||
convert_multilinestring (geom, feature, dimensions, multiple_geometries);
|
{
|
||||||
break;
|
if (ordinates_size >= dimensions)
|
||||||
case SDO_GTYPE_MULTIPOLYGON:
|
{
|
||||||
convert_multipolygon (geom, feature, dimensions, multiple_geometries);
|
convert_ordinates (feature,
|
||||||
break;
|
mapnik::LineString,
|
||||||
case SDO_GTYPE_COLLECTION:
|
elem_info,
|
||||||
convert_collection (geom, feature, dimensions, multiple_geometries);
|
ordinates,
|
||||||
break;
|
dimensions,
|
||||||
case SDO_GTYPE_UNKNOWN:
|
true, // is_single_geom
|
||||||
default:
|
false, // is_point_type
|
||||||
|
false); // multiple_geometries
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDO_GTYPE_POLYGON:
|
||||||
|
{
|
||||||
|
if (ordinates_size >= dimensions)
|
||||||
|
{
|
||||||
|
convert_ordinates (feature,
|
||||||
|
mapnik::Polygon,
|
||||||
|
elem_info,
|
||||||
|
ordinates,
|
||||||
|
dimensions,
|
||||||
|
true, // is_single_geom
|
||||||
|
false, // is_point_type
|
||||||
|
false); // multiple_geometries
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDO_GTYPE_MULTIPOINT:
|
||||||
|
{
|
||||||
|
if (ordinates_size >= dimensions)
|
||||||
|
{
|
||||||
|
const bool is_single_geom = false;
|
||||||
|
const bool is_point_type = true;
|
||||||
|
|
||||||
|
// Todo - force using true as multiple_geometries until we have proper multipoint handling
|
||||||
|
// http://trac.mapnik.org/ticket/458
|
||||||
|
|
||||||
|
convert_ordinates (feature,
|
||||||
|
mapnik::Point,
|
||||||
|
elem_info,
|
||||||
|
ordinates,
|
||||||
|
dimensions,
|
||||||
|
false, // is_single_geom
|
||||||
|
true, // is_point_type
|
||||||
|
true); // multiple_geometries
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDO_GTYPE_MULTILINE:
|
||||||
|
{
|
||||||
|
if (ordinates_size >= dimensions)
|
||||||
|
{
|
||||||
|
convert_ordinates (feature,
|
||||||
|
mapnik::LineString,
|
||||||
|
elem_info,
|
||||||
|
ordinates,
|
||||||
|
dimensions,
|
||||||
|
false, // is_single_geom
|
||||||
|
false, // is_point_type
|
||||||
|
multiple_geometries);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDO_GTYPE_MULTIPOLYGON:
|
||||||
|
{
|
||||||
|
if (ordinates_size >= dimensions)
|
||||||
|
{
|
||||||
|
convert_ordinates (feature,
|
||||||
|
mapnik::Polygon,
|
||||||
|
elem_info,
|
||||||
|
ordinates,
|
||||||
|
dimensions,
|
||||||
|
false, // is_single_geom
|
||||||
|
false, // is_point_type
|
||||||
|
multiple_geometries);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDO_GTYPE_COLLECTION:
|
||||||
|
{
|
||||||
|
if (ordinates_size >= dimensions)
|
||||||
|
{
|
||||||
|
const bool is_single_geom = false;
|
||||||
|
const bool is_point_type = false;
|
||||||
|
|
||||||
|
convert_ordinates (feature,
|
||||||
|
mapnik::Polygon,
|
||||||
|
elem_info,
|
||||||
|
ordinates,
|
||||||
|
dimensions,
|
||||||
|
false, // is_single_geom,
|
||||||
|
false, // is_point_type
|
||||||
|
multiple_geometries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDO_GTYPE_UNKNOWN:
|
||||||
|
default:
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
clog << "unknown <occi> " << occi_enums::resolve_gtype(geomtype)
|
std::clog << "OCCI Plugin: unknown <occi> " << occi_enums::resolve_gtype(geomtype)
|
||||||
<< "(gtype=" << gtype << ")" << endl;
|
<< "(gtype=" << gtype << ")" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void occi_featureset::convert_point (SDOGeometry* geom, feature_ptr feature, int dimensions)
|
|
||||||
{
|
|
||||||
SDOPointType* sdopoint = geom->getSdo_point();
|
|
||||||
|
|
||||||
if (sdopoint && ! sdopoint->isNull())
|
|
||||||
{
|
|
||||||
geometry_type* point = new geometry_type(mapnik::Point);
|
|
||||||
|
|
||||||
point->move_to (sdopoint->getX(), sdopoint->getY());
|
|
||||||
|
|
||||||
feature->add_geometry (point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void occi_featureset::convert_linestring (SDOGeometry* geom, feature_ptr feature, int dimensions)
|
|
||||||
{
|
|
||||||
const std::vector<Number>& elem_info = geom->getSdo_elem_info();
|
|
||||||
const std::vector<Number>& ordinates = geom->getSdo_ordinates();
|
|
||||||
|
|
||||||
if ((int) ordinates.size() >= dimensions)
|
|
||||||
{
|
|
||||||
const bool is_single_geom = true;
|
|
||||||
const bool is_point_type = false;
|
|
||||||
const bool multiple_geometries = false;
|
|
||||||
|
|
||||||
convert_ordinates (feature,
|
|
||||||
mapnik::LineString,
|
|
||||||
elem_info,
|
|
||||||
ordinates,
|
|
||||||
dimensions,
|
|
||||||
is_single_geom,
|
|
||||||
is_point_type,
|
|
||||||
multiple_geometries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void occi_featureset::convert_polygon (SDOGeometry* geom, feature_ptr feature, int dimensions)
|
|
||||||
{
|
|
||||||
const std::vector<Number>& elem_info = geom->getSdo_elem_info();
|
|
||||||
const std::vector<Number>& ordinates = geom->getSdo_ordinates();
|
|
||||||
|
|
||||||
if ((int) ordinates.size() >= dimensions)
|
|
||||||
{
|
|
||||||
const bool is_single_geom = true;
|
|
||||||
const bool is_point_type = false;
|
|
||||||
const bool multiple_geometries = false;
|
|
||||||
|
|
||||||
convert_ordinates (feature,
|
|
||||||
mapnik::Polygon,
|
|
||||||
elem_info,
|
|
||||||
ordinates,
|
|
||||||
dimensions,
|
|
||||||
is_single_geom,
|
|
||||||
is_point_type,
|
|
||||||
multiple_geometries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void occi_featureset::convert_multipoint (SDOGeometry* geom, feature_ptr feature, int dimensions, bool multiple_geometries)
|
|
||||||
{
|
|
||||||
const std::vector<Number>& elem_info = geom->getSdo_elem_info();
|
|
||||||
const std::vector<Number>& ordinates = geom->getSdo_ordinates();
|
|
||||||
|
|
||||||
if ((int) ordinates.size() >= dimensions)
|
|
||||||
{
|
|
||||||
const bool is_single_geom = false;
|
|
||||||
const bool is_point_type = true;
|
|
||||||
|
|
||||||
convert_ordinates (feature,
|
|
||||||
mapnik::Point,
|
|
||||||
elem_info,
|
|
||||||
ordinates,
|
|
||||||
dimensions,
|
|
||||||
is_single_geom,
|
|
||||||
is_point_type,
|
|
||||||
multiple_geometries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void occi_featureset::convert_multilinestring (SDOGeometry* geom, feature_ptr feature, int dimensions, bool multiple_geometries)
|
|
||||||
{
|
|
||||||
const std::vector<Number>& elem_info = geom->getSdo_elem_info();
|
|
||||||
const std::vector<Number>& ordinates = geom->getSdo_ordinates();
|
|
||||||
|
|
||||||
if ((int) ordinates.size() >= dimensions)
|
|
||||||
{
|
|
||||||
const bool is_single_geom = false;
|
|
||||||
const bool is_point_type = false;
|
|
||||||
|
|
||||||
convert_ordinates (feature,
|
|
||||||
mapnik::LineString,
|
|
||||||
elem_info,
|
|
||||||
ordinates,
|
|
||||||
dimensions,
|
|
||||||
is_single_geom,
|
|
||||||
is_point_type,
|
|
||||||
multiple_geometries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void occi_featureset::convert_multipolygon (SDOGeometry* geom, feature_ptr feature, int dimensions, bool multiple_geometries)
|
|
||||||
{
|
|
||||||
const std::vector<Number>& elem_info = geom->getSdo_elem_info();
|
|
||||||
const std::vector<Number>& ordinates = geom->getSdo_ordinates();
|
|
||||||
|
|
||||||
if ((int) ordinates.size() >= dimensions)
|
|
||||||
{
|
|
||||||
const bool is_single_geom = false;
|
|
||||||
const bool is_point_type = false;
|
|
||||||
|
|
||||||
convert_ordinates (feature,
|
|
||||||
mapnik::Polygon,
|
|
||||||
elem_info,
|
|
||||||
ordinates,
|
|
||||||
dimensions,
|
|
||||||
is_single_geom,
|
|
||||||
is_point_type,
|
|
||||||
multiple_geometries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void occi_featureset::convert_collection (SDOGeometry* geom, feature_ptr feature, int dimensions, bool multiple_geometries)
|
|
||||||
{
|
|
||||||
const std::vector<Number>& elem_info = geom->getSdo_elem_info();
|
|
||||||
const std::vector<Number>& ordinates = geom->getSdo_ordinates();
|
|
||||||
|
|
||||||
if ((int) ordinates.size() >= dimensions)
|
|
||||||
{
|
|
||||||
const bool is_single_geom = false;
|
|
||||||
const bool is_point_type = false;
|
|
||||||
|
|
||||||
convert_ordinates (feature,
|
|
||||||
mapnik::Polygon,
|
|
||||||
elem_info,
|
|
||||||
ordinates,
|
|
||||||
dimensions,
|
|
||||||
is_single_geom,
|
|
||||||
is_point_type,
|
|
||||||
multiple_geometries);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,3 +488,4 @@ void occi_featureset::fill_geometry_type (geometry_type * geom,
|
||||||
geom->line_to ((double) ordinates[p], (double) ordinates[p + 1]);
|
geom->line_to ((double) ordinates[p], (double) ordinates[p + 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,13 +50,6 @@ class occi_featureset : public mapnik::Featureset
|
||||||
virtual ~occi_featureset();
|
virtual ~occi_featureset();
|
||||||
mapnik::feature_ptr next();
|
mapnik::feature_ptr next();
|
||||||
private:
|
private:
|
||||||
void convert_point (SDOGeometry* geom, mapnik::feature_ptr feature, int dims);
|
|
||||||
void convert_linestring (SDOGeometry* geom, mapnik::feature_ptr feature, int dims);
|
|
||||||
void convert_polygon (SDOGeometry* geom, mapnik::feature_ptr feature, int dims);
|
|
||||||
void convert_multipoint (SDOGeometry* geom, mapnik::feature_ptr feature, int dims, bool multiple_geometries);
|
|
||||||
void convert_multilinestring (SDOGeometry* geom, mapnik::feature_ptr feature, int dims, bool multiple_geometries);
|
|
||||||
void convert_multipolygon (SDOGeometry* geom, mapnik::feature_ptr feature, int dims, bool multiple_geometries);
|
|
||||||
void convert_collection (SDOGeometry* geom, mapnik::feature_ptr feature, int dims, bool multiple_geometries);
|
|
||||||
void convert_geometry (SDOGeometry* geom, mapnik::feature_ptr feature, bool multiple_geometries);
|
void convert_geometry (SDOGeometry* geom, mapnik::feature_ptr feature, bool multiple_geometries);
|
||||||
void convert_ordinates (mapnik::feature_ptr feature,
|
void convert_ordinates (mapnik::feature_ptr feature,
|
||||||
const mapnik::eGeomType& geom_type,
|
const mapnik::eGeomType& geom_type,
|
||||||
|
|
|
@ -36,15 +36,13 @@
|
||||||
|
|
||||||
// check for oracle support
|
// check for oracle support
|
||||||
#if OCCI_MAJOR_VERSION >= 10 && OCCI_MINOR_VERSION >= 1
|
#if OCCI_MAJOR_VERSION >= 10 && OCCI_MINOR_VERSION >= 1
|
||||||
// Only ORACLE 10g (>= 10.2.0.X) is supported !
|
// We have at least ORACLE 10g >= 10.2.0.X
|
||||||
#else
|
#else
|
||||||
#error Only ORACLE 10g (>= 10.2.0.X) is supported !
|
#error Only ORACLE 10g >= 10.2.0.X is supported !
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define SDO_GEOMETRY_METADATA_TABLE "USER_SDO_GEOM_METADATA"
|
// geometry types definitions
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SDO_GTYPE_UNKNOWN = 0,
|
SDO_GTYPE_UNKNOWN = 0,
|
||||||
|
@ -93,7 +91,7 @@ public:
|
||||||
if (env_ == 0)
|
if (env_ == 0)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
std::clog << "occi_environment constructor" << std::endl;
|
std::clog << "OCCI Plugin: occi_environment constructor" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int mode = oracle::occi::Environment::OBJECT
|
int mode = oracle::occi::Environment::OBJECT
|
||||||
|
@ -117,7 +115,7 @@ private:
|
||||||
if (env_)
|
if (env_)
|
||||||
{
|
{
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
std::clog << "occi_environment destructor" << std::endl;
|
std::clog << "OCCI Plugin: occi_environment destructor" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oracle::occi::Environment::terminateEnvironment (env_);
|
oracle::occi::Environment::terminateEnvironment (env_);
|
||||||
|
|
Loading…
Reference in a new issue