2009-02-03 18:06:23 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Artem Pavlenko
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
//$Id$
|
|
|
|
|
2010-11-22 12:40:08 +01:00
|
|
|
// mapnik
|
2009-02-03 18:06:23 +01:00
|
|
|
#include <mapnik/global.hpp>
|
|
|
|
#include <mapnik/datasource.hpp>
|
2009-12-16 21:02:06 +01:00
|
|
|
#include <mapnik/box2d.hpp>
|
2009-02-03 18:06:23 +01:00
|
|
|
#include <mapnik/geometry.hpp>
|
|
|
|
#include <mapnik/feature.hpp>
|
|
|
|
#include <mapnik/feature_layer_desc.hpp>
|
|
|
|
#include <mapnik/wkb.hpp>
|
|
|
|
#include <mapnik/unicode.hpp>
|
2011-05-17 01:41:34 +02:00
|
|
|
#include <mapnik/feature_factory.hpp>
|
2009-02-03 18:06:23 +01:00
|
|
|
|
|
|
|
// ogr
|
|
|
|
#include "occi_featureset.hpp"
|
|
|
|
|
|
|
|
using mapnik::query;
|
2009-12-16 21:02:06 +01:00
|
|
|
using mapnik::box2d;
|
2009-02-03 18:06:23 +01:00
|
|
|
using mapnik::CoordTransform;
|
|
|
|
using mapnik::Feature;
|
|
|
|
using mapnik::feature_ptr;
|
2010-11-03 14:19:15 +01:00
|
|
|
using mapnik::geometry_type;
|
2009-02-03 18:06:23 +01:00
|
|
|
using mapnik::geometry_utils;
|
|
|
|
using mapnik::transcoder;
|
|
|
|
using mapnik::datasource_exception;
|
2011-05-23 17:54:58 +02:00
|
|
|
using mapnik::feature_factory;
|
2009-02-03 18:06:23 +01:00
|
|
|
|
|
|
|
using oracle::occi::Connection;
|
|
|
|
using oracle::occi::Statement;
|
|
|
|
using oracle::occi::ResultSet;
|
|
|
|
using oracle::occi::StatelessConnectionPool;
|
|
|
|
using oracle::occi::MetaData;
|
|
|
|
using oracle::occi::SQLException;
|
|
|
|
using oracle::occi::Type;
|
|
|
|
using oracle::occi::Number;
|
2010-11-22 12:40:08 +01:00
|
|
|
using oracle::occi::Blob;
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-16 18:31:13 +01:00
|
|
|
occi_featureset::occi_featureset(StatelessConnectionPool* pool,
|
|
|
|
Connection* conn,
|
2009-02-03 18:06:23 +01:00
|
|
|
std::string const& sqlstring,
|
|
|
|
std::string const& encoding,
|
|
|
|
bool multiple_geometries,
|
2010-11-16 18:31:13 +01:00
|
|
|
bool use_connection_pool,
|
2009-04-28 16:06:35 +02:00
|
|
|
unsigned prefetch_rows,
|
2009-02-03 18:06:23 +01:00
|
|
|
unsigned num_attrs)
|
2010-11-16 18:31:13 +01:00
|
|
|
: tr_(new transcoder(encoding)),
|
2009-02-03 18:06:23 +01:00
|
|
|
multiple_geometries_(multiple_geometries),
|
|
|
|
num_attrs_(num_attrs),
|
2011-04-29 22:00:45 +02:00
|
|
|
feature_id_(1)
|
2009-02-03 18:06:23 +01:00
|
|
|
{
|
2010-11-16 18:31:13 +01:00
|
|
|
if (use_connection_pool)
|
|
|
|
conn_.set_pool(pool);
|
|
|
|
else
|
|
|
|
conn_.set_connection(conn, false);
|
|
|
|
|
2009-02-03 18:06:23 +01:00
|
|
|
try
|
|
|
|
{
|
2009-04-28 16:06:35 +02:00
|
|
|
rs_ = conn_.execute_query (sqlstring, prefetch_rows);
|
2009-02-03 18:06:23 +01:00
|
|
|
}
|
|
|
|
catch (SQLException &ex)
|
|
|
|
{
|
2010-11-22 12:40:08 +01:00
|
|
|
std::clog << "OCCI Plugin: error processing " << sqlstring << " : " << ex.getMessage() << std::endl;
|
2009-02-03 18:06:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
occi_featureset::~occi_featureset()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
feature_ptr occi_featureset::next()
|
|
|
|
{
|
2009-02-03 23:23:33 +01:00
|
|
|
if (rs_ && rs_->next())
|
2009-02-03 18:06:23 +01:00
|
|
|
{
|
2011-05-17 01:41:34 +02:00
|
|
|
feature_ptr feature(feature_factory::create(feature_id_));
|
2011-04-29 22:00:45 +02:00
|
|
|
++feature_id_;
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2009-02-05 12:17:27 +01:00
|
|
|
boost::scoped_ptr<SDOGeometry> geom (dynamic_cast<SDOGeometry*> (rs_->getObject(1)));
|
2009-02-03 23:23:33 +01:00
|
|
|
if (geom.get())
|
2009-02-03 18:06:23 +01:00
|
|
|
{
|
2010-11-16 18:31:13 +01:00
|
|
|
convert_geometry (geom.get(), feature, multiple_geometries_);
|
2009-02-03 18:06:23 +01:00
|
|
|
}
|
|
|
|
|
2009-02-05 12:17:27 +01:00
|
|
|
std::vector<MetaData> listOfColumns = rs_->getColumnListMetaData();
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-16 18:31:13 +01:00
|
|
|
for (unsigned int i = 1; i < listOfColumns.size(); ++i)
|
2009-02-03 18:06:23 +01:00
|
|
|
{
|
2010-11-22 12:40:08 +01:00
|
|
|
MetaData columnObj = listOfColumns[i];
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-22 12:40:08 +01:00
|
|
|
std::string fld_name = columnObj.getString(MetaData::ATTR_NAME);
|
|
|
|
int type_oid = columnObj.getInt(MetaData::ATTR_DATA_TYPE);
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-22 12:40:08 +01:00
|
|
|
/*
|
|
|
|
int type_code = columnObj.getInt(MetaData::ATTR_TYPECODE);
|
|
|
|
if (type_code == OCCI_TYPECODE_OBJECT)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
*/
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-22 12:40:08 +01:00
|
|
|
switch (type_oid)
|
|
|
|
{
|
|
|
|
case oracle::occi::OCCIBOOL:
|
|
|
|
case oracle::occi::OCCIINT:
|
|
|
|
case oracle::occi::OCCIUNSIGNED_INT:
|
|
|
|
case oracle::occi::OCCIROWID:
|
|
|
|
boost::put(*feature,fld_name,rs_->getInt (i + 1));
|
|
|
|
break;
|
|
|
|
case oracle::occi::OCCIFLOAT:
|
|
|
|
case oracle::occi::OCCIBFLOAT:
|
|
|
|
case oracle::occi::OCCIDOUBLE:
|
|
|
|
case oracle::occi::OCCIBDOUBLE:
|
|
|
|
case oracle::occi::OCCINUMBER:
|
|
|
|
case oracle::occi::OCCI_SQLT_NUM:
|
|
|
|
boost::put(*feature,fld_name,rs_->getDouble (i + 1));
|
|
|
|
break;
|
|
|
|
case oracle::occi::OCCICHAR:
|
|
|
|
case oracle::occi::OCCISTRING:
|
|
|
|
case oracle::occi::OCCI_SQLT_AFC:
|
|
|
|
case oracle::occi::OCCI_SQLT_AVC:
|
|
|
|
case oracle::occi::OCCI_SQLT_CHR:
|
|
|
|
case oracle::occi::OCCI_SQLT_LVC:
|
|
|
|
case oracle::occi::OCCI_SQLT_RDD:
|
|
|
|
case oracle::occi::OCCI_SQLT_STR:
|
|
|
|
case oracle::occi::OCCI_SQLT_VCS:
|
|
|
|
case oracle::occi::OCCI_SQLT_VNU:
|
|
|
|
case oracle::occi::OCCI_SQLT_VBI:
|
|
|
|
case oracle::occi::OCCI_SQLT_VST:
|
|
|
|
boost::put(*feature,fld_name,(UnicodeString) tr_->transcode (rs_->getString (i + 1).c_str()));
|
|
|
|
break;
|
|
|
|
case oracle::occi::OCCIDATE:
|
|
|
|
case oracle::occi::OCCITIMESTAMP:
|
|
|
|
case oracle::occi::OCCIINTERVALDS:
|
|
|
|
case oracle::occi::OCCIINTERVALYM:
|
|
|
|
case oracle::occi::OCCI_SQLT_DAT:
|
|
|
|
case oracle::occi::OCCI_SQLT_DATE:
|
|
|
|
case oracle::occi::OCCI_SQLT_TIME:
|
|
|
|
case oracle::occi::OCCI_SQLT_TIME_TZ:
|
|
|
|
case oracle::occi::OCCI_SQLT_TIMESTAMP:
|
|
|
|
case oracle::occi::OCCI_SQLT_TIMESTAMP_LTZ:
|
|
|
|
case oracle::occi::OCCI_SQLT_TIMESTAMP_TZ:
|
|
|
|
case oracle::occi::OCCI_SQLT_INTERVAL_YM:
|
|
|
|
case oracle::occi::OCCI_SQLT_INTERVAL_DS:
|
|
|
|
case oracle::occi::OCCIANYDATA:
|
|
|
|
case oracle::occi::OCCIBLOB:
|
|
|
|
case oracle::occi::OCCIBFILE:
|
|
|
|
case oracle::occi::OCCIBYTES:
|
|
|
|
case oracle::occi::OCCICLOB:
|
|
|
|
case oracle::occi::OCCIVECTOR:
|
|
|
|
case oracle::occi::OCCIMETADATA:
|
|
|
|
case oracle::occi::OCCIPOBJECT:
|
|
|
|
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:
|
2009-02-03 18:06:23 +01:00
|
|
|
#ifdef MAPNIK_DEBUG
|
2010-11-22 12:40:08 +01:00
|
|
|
std::clog << "OCCI Plugin: unsupported datatype " << occi_enums::resolve_datatype(type_oid)
|
|
|
|
<< " (type_oid=" << type_oid << ")" << std::endl;
|
2009-02-03 18:06:23 +01:00
|
|
|
#endif
|
2010-11-22 12:40:08 +01:00
|
|
|
break;
|
|
|
|
default: // shouldn't get here
|
2009-02-03 18:06:23 +01:00
|
|
|
#ifdef MAPNIK_DEBUG
|
2010-11-22 12:40:08 +01:00
|
|
|
std::clog << "OCCI Plugin: unknown datatype (type_oid=" << type_oid << ")" << std::endl;
|
2009-02-03 18:06:23 +01:00
|
|
|
#endif
|
2010-11-22 12:40:08 +01:00
|
|
|
break;
|
2011-04-02 05:45:50 +02:00
|
|
|
}
|
2009-02-03 18:06:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return feature;
|
|
|
|
}
|
|
|
|
|
|
|
|
return feature_ptr();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-16 18:31:13 +01:00
|
|
|
void occi_featureset::convert_geometry (SDOGeometry* geom, feature_ptr feature, bool multiple_geometries)
|
2009-02-03 18:06:23 +01:00
|
|
|
{
|
2010-11-22 12:40:08 +01:00
|
|
|
int gtype = (int) geom->getSdo_gtype();
|
|
|
|
int dimensions = gtype / 1000;
|
|
|
|
int lrsvalue = (gtype - dimensions * 1000) / 100;
|
|
|
|
int geomtype = (gtype - dimensions * 1000 - lrsvalue * 100);
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2009-02-23 18:16:09 +01:00
|
|
|
#if 0
|
2010-11-22 12:40:08 +01:00
|
|
|
clog << "-----------Geometry Object ------------" << endl;
|
|
|
|
clog << "SDO GTYPE = " << gtype << endl;
|
|
|
|
clog << "SDO DIMENSIONS = " << dimensions << endl;
|
|
|
|
clog << "SDO LRS = " << lrsvalue << endl;
|
|
|
|
clog << "SDO GEOMETRY TYPE = " << geomtype << endl;
|
|
|
|
|
|
|
|
Number sdo_srid = geom->getSdo_srid();
|
|
|
|
if (sdo_srid.isNull())
|
|
|
|
clog << "SDO SRID = " << "Null" << endl;
|
|
|
|
else
|
|
|
|
clog << "SDO SRID = " << (int) sdo_srid << endl;
|
2009-02-03 18:06:23 +01:00
|
|
|
#endif
|
|
|
|
|
2009-02-05 12:17:27 +01:00
|
|
|
const std::vector<Number>& elem_info = geom->getSdo_elem_info();
|
|
|
|
const std::vector<Number>& ordinates = geom->getSdo_ordinates();
|
2010-11-22 12:40:08 +01:00
|
|
|
const int ordinates_size = (int) ordinates.size();
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-22 12:40:08 +01:00
|
|
|
switch (geomtype)
|
2009-02-03 18:06:23 +01:00
|
|
|
{
|
2010-11-22 12:40:08 +01:00
|
|
|
case SDO_GTYPE_POINT:
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SDO_GTYPE_LINE:
|
|
|
|
{
|
|
|
|
if (ordinates_size >= dimensions)
|
|
|
|
{
|
|
|
|
convert_ordinates (feature,
|
|
|
|
mapnik::LineString,
|
|
|
|
elem_info,
|
|
|
|
ordinates,
|
|
|
|
dimensions,
|
|
|
|
true, // is_single_geom
|
|
|
|
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;
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-22 12:40:08 +01:00
|
|
|
// 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);
|
|
|
|
}
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-22 12:40:08 +01:00
|
|
|
}
|
|
|
|
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
|
|
|
|
std::clog << "OCCI Plugin: unknown <occi> " << occi_enums::resolve_gtype(geomtype)
|
|
|
|
<< "(gtype=" << gtype << ")" << std::endl;
|
|
|
|
#endif
|
|
|
|
break;
|
2009-02-03 18:06:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-16 18:31:13 +01:00
|
|
|
void occi_featureset::convert_ordinates (mapnik::feature_ptr feature,
|
|
|
|
const mapnik::eGeomType& geom_type,
|
|
|
|
const std::vector<Number>& elem_info,
|
|
|
|
const std::vector<Number>& ordinates,
|
|
|
|
const int dimensions,
|
|
|
|
const bool is_single_geom,
|
|
|
|
const bool is_point_geom,
|
|
|
|
const bool multiple_geometries)
|
2009-02-03 18:06:23 +01:00
|
|
|
{
|
2010-11-16 18:31:13 +01:00
|
|
|
const int elem_size = elem_info.size();
|
|
|
|
const int ord_size = ordinates.size();
|
|
|
|
|
2009-02-03 18:06:23 +01:00
|
|
|
if (elem_size >= 0)
|
|
|
|
{
|
2010-11-16 18:31:13 +01:00
|
|
|
int offset = elem_info [0];
|
|
|
|
int etype = elem_info [1];
|
|
|
|
int interp = elem_info [2];
|
2009-02-03 18:06:23 +01:00
|
|
|
|
2010-11-16 18:31:13 +01:00
|
|
|
if (! is_single_geom && elem_size > SDO_ELEM_INFO_SIZE)
|
2009-02-03 18:06:23 +01:00
|
|
|
{
|
2010-11-16 18:31:13 +01:00
|
|
|
geometry_type* geom = multiple_geometries ? 0 : new geometry_type(geom_type);
|
|
|
|
if (geom) geom->set_capacity (ord_size);
|
|
|
|
|
2009-02-03 18:06:23 +01:00
|
|
|
for (int i = SDO_ELEM_INFO_SIZE; i < elem_size; i+=3)
|
|
|
|
{
|
|
|
|
int next_offset = elem_info [i];
|
|
|
|
int next_etype = elem_info [i + 1];
|
|
|
|
int next_interp = elem_info [i + 2];
|
|
|
|
bool is_linear_element = true;
|
|
|
|
bool is_unknown_etype = false;
|
2010-11-16 18:31:13 +01:00
|
|
|
mapnik::eGeomType gtype = mapnik::Point;
|
2009-02-03 18:06:23 +01:00
|
|
|
|
|
|
|
switch (etype)
|
|
|
|
{
|
|
|
|
case SDO_ETYPE_POINT:
|
|
|
|
if (interp == SDO_INTERPRETATION_POINT) {}
|
|
|
|
if (interp > SDO_INTERPRETATION_POINT) {}
|
2010-11-16 18:31:13 +01:00
|
|
|
gtype = mapnik::Point;
|
2009-02-03 18:06:23 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SDO_ETYPE_LINESTRING:
|
|
|
|
if (interp == SDO_INTERPRETATION_STRAIGHT) {}
|
|
|
|
if (interp == SDO_INTERPRETATION_CIRCULAR) {}
|
2010-11-16 18:31:13 +01:00
|
|
|
gtype = mapnik::LineString;
|
2009-02-03 18:06:23 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SDO_ETYPE_POLYGON:
|
|
|
|
case SDO_ETYPE_POLYGON_INTERIOR:
|
|
|
|
if (interp == SDO_INTERPRETATION_STRAIGHT) {}
|
|
|
|
if (interp == SDO_INTERPRETATION_CIRCULAR) {}
|
|
|
|
if (interp == SDO_INTERPRETATION_RECTANGLE) {}
|
|
|
|
if (interp == SDO_INTERPRETATION_CIRCLE) {}
|
2010-11-16 18:31:13 +01:00
|
|
|
gtype = mapnik::Polygon;
|
2009-02-03 18:06:23 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SDO_ETYPE_COMPOUND_LINESTRING:
|
|
|
|
case SDO_ETYPE_COMPOUND_POLYGON:
|
|
|
|
case SDO_ETYPE_COMPOUND_POLYGON_INTERIOR:
|
|
|
|
// interp = next ETYPE to consider
|
|
|
|
is_linear_element = false;
|
2010-11-16 18:31:13 +01:00
|
|
|
gtype = mapnik::Polygon;
|
2009-02-03 18:06:23 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SDO_ETYPE_UNKNOWN: // unknown
|
|
|
|
default:
|
|
|
|
is_unknown_etype = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_unknown_etype)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (is_linear_element)
|
|
|
|
{
|
2010-11-16 18:31:13 +01:00
|
|
|
if (multiple_geometries)
|
|
|
|
{
|
|
|
|
if (geom)
|
|
|
|
feature->add_geometry (geom);
|
|
|
|
|
|
|
|
geom = new geometry_type(gtype);
|
|
|
|
geom->set_capacity ((next_offset - 1) - (offset - 1 - dimensions));
|
|
|
|
}
|
|
|
|
|
2010-11-03 14:19:15 +01:00
|
|
|
fill_geometry_type (geom,
|
2010-11-16 18:31:13 +01:00
|
|
|
offset - 1,
|
|
|
|
next_offset - 1,
|
|
|
|
ordinates,
|
|
|
|
dimensions,
|
|
|
|
is_point_geom);
|
2009-02-03 18:06:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
offset = next_offset;
|
|
|
|
etype = next_etype;
|
|
|
|
interp = next_interp;
|
|
|
|
}
|
2010-11-16 18:31:13 +01:00
|
|
|
|
|
|
|
if (geom)
|
|
|
|
{
|
|
|
|
feature->add_geometry (geom);
|
|
|
|
geom = 0;
|
|
|
|
}
|
2009-02-03 18:06:23 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-11-16 18:31:13 +01:00
|
|
|
geometry_type * geom = new geometry_type(geom_type);
|
|
|
|
geom->set_capacity (ord_size);
|
|
|
|
|
2010-11-03 14:19:15 +01:00
|
|
|
fill_geometry_type (geom,
|
2010-11-16 18:31:13 +01:00
|
|
|
offset - 1,
|
|
|
|
ord_size,
|
|
|
|
ordinates,
|
|
|
|
dimensions,
|
|
|
|
is_point_geom);
|
|
|
|
|
|
|
|
feature->add_geometry (geom);
|
2009-02-03 18:06:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 14:19:15 +01:00
|
|
|
void occi_featureset::fill_geometry_type (geometry_type * geom,
|
2010-11-16 18:31:13 +01:00
|
|
|
const int real_offset,
|
|
|
|
const int next_offset,
|
|
|
|
const std::vector<Number>& ordinates,
|
|
|
|
const int dimensions,
|
|
|
|
const bool is_point_geom)
|
2009-02-05 12:17:27 +01:00
|
|
|
{
|
|
|
|
geom->move_to ((double) ordinates[real_offset], (double) ordinates[real_offset + 1]);
|
|
|
|
|
|
|
|
if (is_point_geom)
|
2010-11-16 18:31:13 +01:00
|
|
|
{
|
2009-02-05 12:17:27 +01:00
|
|
|
for (int p = real_offset + dimensions; p < next_offset; p += dimensions)
|
|
|
|
geom->move_to ((double) ordinates[p], (double) ordinates[p + 1]);
|
2010-11-16 18:31:13 +01:00
|
|
|
}
|
2009-02-05 12:17:27 +01:00
|
|
|
else
|
2010-11-16 18:31:13 +01:00
|
|
|
{
|
2009-02-05 12:17:27 +01:00
|
|
|
for (int p = real_offset + dimensions; p < next_offset; p += dimensions)
|
|
|
|
geom->line_to ((double) ordinates[p], (double) ordinates[p + 1]);
|
2010-11-16 18:31:13 +01:00
|
|
|
}
|
2009-02-05 12:17:27 +01:00
|
|
|
}
|
2010-11-22 12:40:08 +01:00
|
|
|
|