1. corrected LIBS in SConsctipt files
2. use boost::shared_ptr instead of ref_ptr
This commit is contained in:
parent
92803f1807
commit
a6191fade0
37 changed files with 168 additions and 295 deletions
|
@ -67,13 +67,17 @@ if not conf.CheckLib('z'):
|
|||
Exit(1)
|
||||
|
||||
if not conf.CheckLibWithHeader('png','png.h','C'):
|
||||
print 'Could not find libpng/headers, exiting!'
|
||||
print 'Could not find png lib and/or headers, exiting!'
|
||||
Exit(1)
|
||||
|
||||
if not conf.CheckLib('jpeg'):
|
||||
print 'Could not find jpeg lib, exiting!'
|
||||
Exit(1)
|
||||
|
||||
if not conf.CheckLibWithHeader('tiff','tiff.h','C'):
|
||||
print 'Could not find tiff lib and/or headers, exiting!'
|
||||
Exit(1)
|
||||
|
||||
env = conf.Finish()
|
||||
|
||||
Export('env')
|
||||
|
|
|
@ -25,4 +25,4 @@ agg_root = env['AGG_ROOT']
|
|||
agg_headers = agg_root + '/include'
|
||||
agg_src_dir = agg_root + '/src/'
|
||||
agg_src = glob.glob(agg_src_dir + '*.cpp')
|
||||
agg_lib = env.StaticLibrary('libagg',agg_src,CPPPATH=agg_headers)
|
||||
agg_lib = env.StaticLibrary('libagg',agg_src,LIBS=[],CPPPATH=agg_headers)
|
||||
|
|
|
@ -27,12 +27,12 @@ boost_root = env['BOOST_ROOT']
|
|||
# boost filesystem
|
||||
filesystem_src_dir = boost_root + '/libs/filesystem/src/'
|
||||
boost_fs_src= glob.glob(filesystem_src_dir + '*.cpp')
|
||||
lib_boost_filesystem = env.SharedLibrary('libboost-filesystem',boost_fs_src,CPPPATH=boost_root)
|
||||
lib_boost_filesystem = env.SharedLibrary('libboost-filesystem',boost_fs_src,LIBS=[],CPPPATH=boost_root)
|
||||
env.Install(prefix+'/lib',lib_boost_filesystem)
|
||||
#boost regex
|
||||
regex_src_dir = boost_root + '/libs/regex/src/'
|
||||
boost_regex_src = glob.glob(regex_src_dir+ '*.cpp')
|
||||
lib_boost_regex = env.SharedLibrary('libboost-regex',boost_regex_src,CPPPATH=boost_root)
|
||||
lib_boost_regex = env.SharedLibrary('libboost-regex',boost_regex_src,LIBS=[],CPPPATH=boost_root)
|
||||
|
||||
env.Install(prefix+'/lib',lib_boost_regex)
|
||||
|
||||
|
|
|
@ -56,16 +56,16 @@ public:
|
|||
PQclear(result);
|
||||
return ok;
|
||||
}
|
||||
ref_ptr<ResultSet> executeQuery(const std::string& sql,int type=0) const
|
||||
boost::shared_ptr<ResultSet> executeQuery(const std::string& sql,int type=0) const
|
||||
{
|
||||
PGresult *result=0;
|
||||
if (type==1)
|
||||
{
|
||||
result=PQexecParams(conn_,sql.c_str(),0,0,0,0,0,1);
|
||||
return ref_ptr<ResultSet>(new ResultSet(result));
|
||||
return boost::shared_ptr<ResultSet>(new ResultSet(result));
|
||||
}
|
||||
result=PQexec(conn_,sql.c_str());
|
||||
return ref_ptr<ResultSet>(new ResultSet(result));
|
||||
return boost::shared_ptr<ResultSet>(new ResultSet(result));
|
||||
}
|
||||
bool isOK() const
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "pool.hpp"
|
||||
#include "utils.hpp"
|
||||
#include "connection.hpp"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
using namespace mapnik;
|
||||
using std::string;
|
||||
|
@ -59,8 +60,8 @@ class ConnectionManager : public singleton <ConnectionManager,CreateStatic>
|
|||
|
||||
friend class CreateStatic<ConnectionManager>;
|
||||
typedef Pool<Connection,ConnectionCreator> PoolType;
|
||||
typedef std::map<std::string,ref_ptr<PoolType> > ContType;
|
||||
typedef ref_ptr<Connection> HolderType;
|
||||
typedef std::map<std::string,boost::shared_ptr<PoolType> > ContType;
|
||||
typedef boost::shared_ptr<Connection> HolderType;
|
||||
ContType pools_;
|
||||
|
||||
public:
|
||||
|
@ -71,13 +72,13 @@ public:
|
|||
if (pools_.find(creator.id())==pools_.end())
|
||||
{
|
||||
return pools_.insert(std::make_pair(creator.id(),
|
||||
ref_ptr<PoolType>(new PoolType(creator,initialSize,maxSize)))).second;
|
||||
boost::shared_ptr<PoolType>(new PoolType(creator,initialSize,maxSize)))).second;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
const ref_ptr<PoolType>& getPool(const std::string& key)
|
||||
const boost::shared_ptr<PoolType>& getPool(const std::string& key)
|
||||
{
|
||||
Lock lock(&mutex_);
|
||||
ContType::const_iterator itr=pools_.find(key);
|
||||
|
@ -85,7 +86,7 @@ public:
|
|||
{
|
||||
return itr->second;
|
||||
}
|
||||
static const ref_ptr<PoolType> emptyPool(0);
|
||||
static const boost::shared_ptr<PoolType> emptyPool;
|
||||
return emptyPool;
|
||||
}
|
||||
|
||||
|
@ -95,10 +96,10 @@ public:
|
|||
ContType::const_iterator itr=pools_.find(key);
|
||||
if (itr!=pools_.end())
|
||||
{
|
||||
ref_ptr<PoolType> pool=itr->second;
|
||||
boost::shared_ptr<PoolType> pool=itr->second;
|
||||
return pool->borrowObject();
|
||||
}
|
||||
static const HolderType EmptyConn(0);
|
||||
static const HolderType EmptyConn;
|
||||
return EmptyConn;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ using std::endl;
|
|||
|
||||
using boost::lexical_cast;
|
||||
using boost::bad_lexical_cast;
|
||||
using boost::shared_ptr;
|
||||
|
||||
postgis_datasource::postgis_datasource(const Parameters& params)
|
||||
: table_(params.get("table")),
|
||||
|
@ -50,13 +51,13 @@ postgis_datasource::postgis_datasource(const Parameters& params)
|
|||
ConnectionManager *mgr=ConnectionManager::instance();
|
||||
mgr->registerPool(creator_,10,20);
|
||||
|
||||
ref_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
|
||||
shared_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
|
||||
if (pool)
|
||||
{
|
||||
const ref_ptr<Connection>& conn = pool->borrowObject();
|
||||
const shared_ptr<Connection>& conn = pool->borrowObject();
|
||||
if (conn && conn->isOK())
|
||||
{
|
||||
PoolGuard<ref_ptr<Connection>,ref_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
|
||||
PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
|
||||
|
||||
std::string table_name=table_from_sql(table_);
|
||||
|
||||
|
@ -64,7 +65,7 @@ postgis_datasource::postgis_datasource(const Parameters& params)
|
|||
s << "select f_geometry_column,srid,type from ";
|
||||
s << GEOMETRY_COLUMNS <<" where f_table_name='"<<table_name<<"'";
|
||||
|
||||
ref_ptr<ResultSet> rs=conn->executeQuery(s.str());
|
||||
shared_ptr<ResultSet> rs=conn->executeQuery(s.str());
|
||||
|
||||
if (rs->next())
|
||||
{
|
||||
|
@ -179,13 +180,13 @@ featureset_ptr postgis_datasource::features(const query& q) const
|
|||
Featureset *fs=0;
|
||||
Envelope<double> const& box=q.get_bbox();
|
||||
ConnectionManager *mgr=ConnectionManager::instance();
|
||||
ref_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
|
||||
shared_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
|
||||
if (pool)
|
||||
{
|
||||
const ref_ptr<Connection>& conn = pool->borrowObject();
|
||||
const shared_ptr<Connection>& conn = pool->borrowObject();
|
||||
if (conn && conn->isOK())
|
||||
{
|
||||
PoolGuard<ref_ptr<Connection>,ref_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
|
||||
PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
|
||||
std::ostringstream s;
|
||||
// can we rely on 'gid' name???
|
||||
s << "select gid,asbinary("<<geometryColumn_<<") as geom";
|
||||
|
@ -201,7 +202,7 @@ featureset_ptr postgis_datasource::features(const query& q) const
|
|||
s << box.minx() << " " << box.miny() << ",";
|
||||
s << box.maxx() << " " << box.maxy() << ")'::box3d,"<<srid_<<")";
|
||||
cout << s.str() << endl;
|
||||
ref_ptr<ResultSet> rs=conn->executeQuery(s.str(),1);
|
||||
shared_ptr<ResultSet> rs=conn->executeQuery(s.str(),1);
|
||||
fs=new postgis_featureset(rs,props.size());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,12 +65,12 @@ private:
|
|||
class postgis_featureset : public Featureset
|
||||
{
|
||||
private:
|
||||
ref_ptr<ResultSet> rs_;
|
||||
boost::shared_ptr<ResultSet> rs_;
|
||||
unsigned num_attrs_;
|
||||
mutable int totalGeomSize_;
|
||||
mutable int count_;
|
||||
public:
|
||||
postgis_featureset(const ref_ptr<ResultSet>& rs,unsigned num_attrs);
|
||||
postgis_featureset(const boost::shared_ptr<ResultSet>& rs,unsigned num_attrs);
|
||||
void dispose();
|
||||
feature_ptr next();
|
||||
~postgis_featureset();
|
||||
|
|
|
@ -27,7 +27,7 @@ using boost::lexical_cast;
|
|||
using boost::bad_lexical_cast;
|
||||
using std::string;
|
||||
|
||||
postgis_featureset::postgis_featureset(const ref_ptr<ResultSet>& rs,
|
||||
postgis_featureset::postgis_featureset(boost::shared_ptr<ResultSet> const& rs,
|
||||
unsigned num_attrs=0)
|
||||
: rs_(rs),
|
||||
num_attrs_(num_attrs),
|
||||
|
@ -97,7 +97,7 @@ feature_ptr postgis_featureset::next()
|
|||
rs_->close();
|
||||
std::cout << "totalGeomSize="<<totalGeomSize_<<" bytes"<<std::endl;
|
||||
std::cout << "count="<<count_<<std::endl;
|
||||
return feature_ptr(0);
|
||||
return feature_ptr();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ feature_ptr raster_featureset<LookupPolicy>::next()
|
|||
++curIter_;
|
||||
return feature;
|
||||
}
|
||||
return feature_ptr(0);
|
||||
return feature_ptr();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,6 @@ shape_src = Split(
|
|||
|
||||
headers = ['#include',boost_root]
|
||||
|
||||
shape_datasource = env.SharedLibrary('shape',source=shape_src,SHLIBPREFIX='',LIBS="",CPPPATH=headers)
|
||||
shape_datasource = env.SharedLibrary('shape',source=shape_src,SHLIBPREFIX='',LIBS=[],CPPPATH=headers)
|
||||
env.Install(prefix+"/datasources",shape_datasource)
|
||||
env.Alias("install",prefix + '/datasources')
|
||||
|
|
|
@ -101,7 +101,7 @@ feature_ptr shape_featureset<filterT>::next()
|
|||
}
|
||||
else
|
||||
{
|
||||
return feature_ptr(0);
|
||||
return feature_ptr();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ feature_ptr shape_featureset<filterT>::next()
|
|||
break;
|
||||
}
|
||||
default:
|
||||
return feature_ptr(0);
|
||||
return feature_ptr();
|
||||
}
|
||||
|
||||
if (attr_ids_.size())
|
||||
|
@ -178,7 +178,7 @@ feature_ptr shape_featureset<filterT>::next()
|
|||
else
|
||||
{
|
||||
std::cout<<" total shapes read="<<count_<<"\n";
|
||||
return feature_ptr(0);
|
||||
return feature_ptr();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ feature_ptr shape_index_featureset<filterT>::next()
|
|||
else
|
||||
{
|
||||
std::cout<<count_<<" features\n";
|
||||
return feature_ptr(0);
|
||||
return feature_ptr();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,23 +23,25 @@
|
|||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "ptr.hpp"
|
||||
#include "ctrans.hpp"
|
||||
#include "params.hpp"
|
||||
#include "feature.hpp"
|
||||
#include "query.hpp"
|
||||
#include "feature_layer_desc.hpp"
|
||||
|
||||
//#include "ptr.hpp"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
typedef ref_ptr<Feature> feature_ptr;
|
||||
typedef shared_ptr<Feature> feature_ptr;
|
||||
struct Featureset
|
||||
{
|
||||
virtual feature_ptr next()=0;
|
||||
virtual ~Featureset() {};
|
||||
};
|
||||
|
||||
typedef ref_ptr<Featureset> featureset_ptr;
|
||||
typedef shared_ptr<Featureset> featureset_ptr;
|
||||
class datasource_exception : public std::exception
|
||||
{
|
||||
private:
|
||||
|
@ -73,17 +75,18 @@ namespace mapnik
|
|||
typedef datasource* create_ds(const Parameters& params);
|
||||
typedef void destroy_ds(datasource *ds);
|
||||
|
||||
template <typename DATASOURCE>
|
||||
struct datasource_delete
|
||||
|
||||
class datasource_deleter
|
||||
{
|
||||
static void destroy(DATASOURCE* ds)
|
||||
{
|
||||
public:
|
||||
void operator() (datasource* ds)
|
||||
{
|
||||
delete ds;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef ref_ptr<datasource,datasource_delete> datasource_p;
|
||||
|
||||
typedef boost::shared_ptr<datasource> datasource_p;
|
||||
|
||||
///////////////////////////////////////////
|
||||
#define DATASOURCE_PLUGIN(classname) \
|
||||
extern "C" std::string datasource_name() \
|
||||
|
@ -92,7 +95,7 @@ namespace mapnik
|
|||
}\
|
||||
extern "C" datasource* create(const Parameters ¶ms) \
|
||||
{ \
|
||||
return new classname(params);\
|
||||
return new classname(params); \
|
||||
}\
|
||||
extern "C" void destroy(datasource *ds) \
|
||||
{ \
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
|
||||
//$Id: datasource_cache.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef DSFACTORY_HPP
|
||||
#define DSFACTORY_HPP
|
||||
#ifndef DATASOURCE_CACHE_HPP
|
||||
#define DATASOURCE_CACHE_HPP
|
||||
|
||||
#include "utils.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "params.hpp"
|
||||
#include "plugin.hpp"
|
||||
#include "datasource.hpp"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <map>
|
||||
|
||||
namespace mapnik
|
||||
|
@ -38,12 +38,12 @@ namespace mapnik
|
|||
~datasource_cache();
|
||||
datasource_cache(const datasource_cache&);
|
||||
datasource_cache& operator=(const datasource_cache&);
|
||||
static std::map<std::string,ref_ptr<PluginInfo> > plugins_;
|
||||
static std::map<std::string,boost::shared_ptr<PluginInfo> > plugins_;
|
||||
static bool registered_;
|
||||
static bool insert(const std::string& name,const lt_dlhandle module);
|
||||
public:
|
||||
static void register_datasources(const std::string& path);
|
||||
static ref_ptr<datasource,datasource_delete> create(const Parameters& params);
|
||||
static boost::shared_ptr<datasource> create(Parameters const& params);
|
||||
};
|
||||
}
|
||||
#endif //DSFACTORY_HPP
|
||||
#endif //DATASOURCE_CACHE_HPP
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace mapnik
|
||||
{
|
||||
typedef ref_ptr<raster> raster_ptr;
|
||||
typedef boost::shared_ptr<raster> raster_ptr;
|
||||
typedef std::vector<value> properties;
|
||||
|
||||
template <typename T1,typename T2>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "rule.hpp"
|
||||
#include "feature.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "feature.hpp"
|
||||
namespace mapnik
|
||||
{
|
||||
typedef ref_ptr<filter<Feature> > filter_ptr;
|
||||
typedef boost::shared_ptr<filter<Feature> > filter_ptr;
|
||||
|
||||
template <typename FeatureT> class filter_visitor;
|
||||
template <typename FeatureT>
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
//$Id$
|
||||
|
||||
#ifndef FILTER_FACTORY_HPP
|
||||
#define FILTER_FACTORY_HPP
|
||||
|
||||
#include "filter_parser.hpp"
|
||||
|
||||
using std::string;
|
||||
|
@ -30,8 +33,8 @@ namespace mapnik
|
|||
public:
|
||||
static filter_ptr compile(string const& str)
|
||||
{
|
||||
stack<ref_ptr<filter<FeatureT> > > filters;
|
||||
stack<ref_ptr<expression<FeatureT> > > exps;
|
||||
stack<shared_ptr<filter<FeatureT> > > filters;
|
||||
stack<shared_ptr<expression<FeatureT> > > exps;
|
||||
filter_grammar<FeatureT> grammar(filters,exps);
|
||||
char const *text = str.c_str();
|
||||
parse_info<> info = parse(text,text+strlen(text),grammar,space_p);
|
||||
|
@ -47,3 +50,5 @@ namespace mapnik
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //FILTER_FACTORY_HPP
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef FILTER_PARSER_HPP
|
||||
#define FILTER_PARSER_HPP
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/spirit/core.hpp>
|
||||
#include <boost/spirit/symbols.hpp>
|
||||
#include <boost/spirit/utility/confix.hpp>
|
||||
|
@ -46,32 +47,32 @@ namespace mapnik
|
|||
template <typename FeatureT>
|
||||
struct push_integer
|
||||
{
|
||||
push_integer(stack<ref_ptr<expression<FeatureT> > >& exprs)
|
||||
push_integer(stack<shared_ptr<expression<FeatureT> > >& exprs)
|
||||
: exprs_(exprs) {}
|
||||
|
||||
void operator() (int val) const
|
||||
{
|
||||
exprs_.push(ref_ptr<expression<FeatureT> >(new literal<FeatureT>(val)));
|
||||
exprs_.push(shared_ptr<expression<FeatureT> >(new literal<FeatureT>(val)));
|
||||
}
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs_;
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs_;
|
||||
};
|
||||
|
||||
template <typename FeatureT>
|
||||
struct push_real
|
||||
{
|
||||
push_real(stack<ref_ptr<expression<FeatureT> > >& exprs)
|
||||
push_real(stack<shared_ptr<expression<FeatureT> > >& exprs)
|
||||
: exprs_(exprs) {}
|
||||
void operator() (double val) const
|
||||
{
|
||||
exprs_.push(ref_ptr<expression<FeatureT> >(new literal<FeatureT>(val)));
|
||||
exprs_.push(shared_ptr<expression<FeatureT> >(new literal<FeatureT>(val)));
|
||||
}
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs_;
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs_;
|
||||
};
|
||||
|
||||
template <typename FeatureT>
|
||||
struct push_string
|
||||
{
|
||||
push_string(stack<ref_ptr<expression<FeatureT> > >& exprs)
|
||||
push_string(stack<shared_ptr<expression<FeatureT> > >& exprs)
|
||||
: exprs_(exprs) {}
|
||||
|
||||
template <typename Iter>
|
||||
|
@ -86,30 +87,30 @@ namespace mapnik
|
|||
str.erase(idx,1);
|
||||
idx = str.find(quote);
|
||||
}
|
||||
exprs_.push(ref_ptr<expression<FeatureT> >(new literal<FeatureT>(str)));
|
||||
exprs_.push(shared_ptr<expression<FeatureT> >(new literal<FeatureT>(str)));
|
||||
}
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs_;
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs_;
|
||||
};
|
||||
|
||||
template <typename FeatureT>
|
||||
struct push_property
|
||||
{
|
||||
push_property(stack<ref_ptr<expression<FeatureT> > >& exprs)
|
||||
push_property(stack<shared_ptr<expression<FeatureT> > >& exprs)
|
||||
: exprs_(exprs) {}
|
||||
|
||||
template <typename Iter>
|
||||
void operator() (Iter start,Iter end) const
|
||||
{
|
||||
string str(start,end);
|
||||
exprs_.push(ref_ptr<expression<FeatureT> >(new property<FeatureT>(str)));
|
||||
exprs_.push(shared_ptr<expression<FeatureT> >(new property<FeatureT>(str)));
|
||||
}
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs_;
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs_;
|
||||
};
|
||||
|
||||
template <typename FeatureT,typename Op>
|
||||
struct compose_expression
|
||||
{
|
||||
compose_expression(stack<ref_ptr<expression<FeatureT> > >& exprs)
|
||||
compose_expression(stack<shared_ptr<expression<FeatureT> > >& exprs)
|
||||
: exprs_(exprs) {}
|
||||
|
||||
template <typename Iter>
|
||||
|
@ -117,24 +118,24 @@ namespace mapnik
|
|||
{
|
||||
if (exprs_.size()>=2)
|
||||
{
|
||||
ref_ptr<expression<FeatureT> > right = exprs_.top();
|
||||
shared_ptr<expression<FeatureT> > right = exprs_.top();
|
||||
exprs_.pop();
|
||||
ref_ptr<expression<FeatureT> > left = exprs_.top();
|
||||
shared_ptr<expression<FeatureT> > left = exprs_.top();
|
||||
exprs_.pop();
|
||||
if (left && right)
|
||||
{
|
||||
exprs_.push(ref_ptr<expression<FeatureT> >(new math_expr_b<FeatureT,Op>(*left,*right)));
|
||||
exprs_.push(shared_ptr<expression<FeatureT> >(new math_expr_b<FeatureT,Op>(*left,*right)));
|
||||
}
|
||||
}
|
||||
}
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs_;
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs_;
|
||||
};
|
||||
|
||||
template <typename FeatureT>
|
||||
struct compose_regex
|
||||
{
|
||||
compose_regex(stack<ref_ptr<filter<FeatureT> > >& filters,
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs)
|
||||
compose_regex(stack<shared_ptr<filter<FeatureT> > >& filters,
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs)
|
||||
: filters_(filters),exprs_(exprs) {}
|
||||
|
||||
template <typename Iter>
|
||||
|
@ -142,14 +143,14 @@ namespace mapnik
|
|||
{
|
||||
if (exprs_.size()>=1)
|
||||
{
|
||||
ref_ptr<expression<FeatureT> > exp = exprs_.top();
|
||||
shared_ptr<expression<FeatureT> > exp = exprs_.top();
|
||||
exprs_.pop();
|
||||
if (exp)
|
||||
{
|
||||
std::string pattern(start,end);
|
||||
try
|
||||
{
|
||||
filters_.push(ref_ptr<filter<FeatureT> >(new regex_filter<FeatureT>(*exp,pattern)));
|
||||
filters_.push(shared_ptr<filter<FeatureT> >(new regex_filter<FeatureT>(*exp,pattern)));
|
||||
}
|
||||
catch (...)//boost::regex_error& ex)
|
||||
{
|
||||
|
@ -159,16 +160,16 @@ namespace mapnik
|
|||
}
|
||||
}
|
||||
}
|
||||
stack<ref_ptr<filter<FeatureT> > >& filters_;
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs_;
|
||||
stack<shared_ptr<filter<FeatureT> > >& filters_;
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs_;
|
||||
};
|
||||
|
||||
|
||||
template <typename FeatureT,typename Op>
|
||||
struct compose_filter
|
||||
{
|
||||
compose_filter(stack<ref_ptr<filter<FeatureT> > >& filters,
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs)
|
||||
compose_filter(stack<shared_ptr<filter<FeatureT> > >& filters,
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs)
|
||||
: filters_(filters),exprs_(exprs) {}
|
||||
|
||||
template <typename Iter>
|
||||
|
@ -176,24 +177,24 @@ namespace mapnik
|
|||
{
|
||||
if (exprs_.size()>=2)
|
||||
{
|
||||
ref_ptr<expression<FeatureT> > right = exprs_.top();
|
||||
shared_ptr<expression<FeatureT> > right = exprs_.top();
|
||||
exprs_.pop();
|
||||
ref_ptr<expression<FeatureT> > left = exprs_.top();
|
||||
shared_ptr<expression<FeatureT> > left = exprs_.top();
|
||||
exprs_.pop();
|
||||
if (left && right)
|
||||
{
|
||||
filters_.push(ref_ptr<filter<FeatureT> >(new compare_filter<FeatureT,Op>(*left,*right)));
|
||||
filters_.push(shared_ptr<filter<FeatureT> >(new compare_filter<FeatureT,Op>(*left,*right)));
|
||||
}
|
||||
}
|
||||
}
|
||||
stack<ref_ptr<filter<FeatureT> > >& filters_;
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs_;
|
||||
stack<shared_ptr<filter<FeatureT> > >& filters_;
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs_;
|
||||
};
|
||||
|
||||
template <typename FeatureT>
|
||||
struct compose_and_filter
|
||||
{
|
||||
compose_and_filter(stack<ref_ptr<filter<FeatureT> > >& filters)
|
||||
compose_and_filter(stack<shared_ptr<filter<FeatureT> > >& filters)
|
||||
: filters_(filters) {}
|
||||
|
||||
template <typename Iter>
|
||||
|
@ -201,23 +202,23 @@ namespace mapnik
|
|||
{
|
||||
if (filters_.size()>=2)
|
||||
{
|
||||
ref_ptr<filter<FeatureT> > right = filters_.top();
|
||||
shared_ptr<filter<FeatureT> > right = filters_.top();
|
||||
filters_.pop();
|
||||
ref_ptr<filter<FeatureT> > left = filters_.top();
|
||||
shared_ptr<filter<FeatureT> > left = filters_.top();
|
||||
filters_.pop();
|
||||
if (left && right)
|
||||
{
|
||||
filters_.push(ref_ptr<filter<FeatureT> >(new logical_and<FeatureT>(*left,*right)));
|
||||
filters_.push(shared_ptr<filter<FeatureT> >(new logical_and<FeatureT>(*left,*right)));
|
||||
}
|
||||
}
|
||||
}
|
||||
stack<ref_ptr<filter<FeatureT> > >& filters_;
|
||||
stack<shared_ptr<filter<FeatureT> > >& filters_;
|
||||
};
|
||||
|
||||
template <typename FeatureT>
|
||||
struct compose_or_filter
|
||||
{
|
||||
compose_or_filter(stack<ref_ptr<filter<FeatureT> > >& filters)
|
||||
compose_or_filter(stack<shared_ptr<filter<FeatureT> > >& filters)
|
||||
: filters_(filters) {}
|
||||
|
||||
template <typename Iter>
|
||||
|
@ -225,23 +226,23 @@ namespace mapnik
|
|||
{
|
||||
if (filters_.size()>=2)
|
||||
{
|
||||
ref_ptr<filter<FeatureT> > right = filters_.top();
|
||||
shared_ptr<filter<FeatureT> > right = filters_.top();
|
||||
filters_.pop();
|
||||
ref_ptr<filter<FeatureT> > left = filters_.top();
|
||||
shared_ptr<filter<FeatureT> > left = filters_.top();
|
||||
filters_.pop();
|
||||
if (left && right)
|
||||
{
|
||||
filters_.push(ref_ptr<filter<FeatureT> >(new logical_or<FeatureT>(*left,*right)));
|
||||
filters_.push(shared_ptr<filter<FeatureT> >(new logical_or<FeatureT>(*left,*right)));
|
||||
}
|
||||
}
|
||||
}
|
||||
stack<ref_ptr<filter<FeatureT> > >& filters_;
|
||||
stack<shared_ptr<filter<FeatureT> > >& filters_;
|
||||
};
|
||||
|
||||
template <typename FeatureT>
|
||||
struct compose_not_filter
|
||||
{
|
||||
compose_not_filter(stack<ref_ptr<filter<FeatureT> > >& filters)
|
||||
compose_not_filter(stack<shared_ptr<filter<FeatureT> > >& filters)
|
||||
: filters_(filters) {}
|
||||
|
||||
template <typename Iter>
|
||||
|
@ -249,22 +250,22 @@ namespace mapnik
|
|||
{
|
||||
if (filters_.size()>=1)
|
||||
{
|
||||
ref_ptr<filter<FeatureT> > filter_ = filters_.top();
|
||||
shared_ptr<filter<FeatureT> > filter_ = filters_.top();
|
||||
filters_.pop();
|
||||
if (filter_)
|
||||
{
|
||||
filters_.push(ref_ptr<filter<FeatureT> >(new logical_not<FeatureT>(*filter_)));
|
||||
filters_.push(shared_ptr<filter<FeatureT> >(new logical_not<FeatureT>(*filter_)));
|
||||
}
|
||||
}
|
||||
}
|
||||
stack<ref_ptr<filter<FeatureT> > >& filters_;
|
||||
stack<shared_ptr<filter<FeatureT> > >& filters_;
|
||||
};
|
||||
|
||||
template <typename FeatureT>
|
||||
struct filter_grammar : public grammar<filter_grammar<FeatureT> >
|
||||
{
|
||||
filter_grammar(stack<ref_ptr<filter<FeatureT> > >& filters_,
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs_)
|
||||
filter_grammar(stack<shared_ptr<filter<FeatureT> > >& filters_,
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs_)
|
||||
: filters(filters_),exprs(exprs_) {}
|
||||
|
||||
template <typename ScannerT>
|
||||
|
@ -430,8 +431,8 @@ namespace mapnik
|
|||
symbols<string> func2_op;
|
||||
symbols<string> spatial_op;
|
||||
};
|
||||
stack<ref_ptr<filter<FeatureT> > >& filters;
|
||||
stack<ref_ptr<expression<FeatureT> > >& exprs;
|
||||
stack<shared_ptr<filter<FeatureT> > >& filters;
|
||||
stack<shared_ptr<expression<FeatureT> > >& exprs;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
#include "vertex_vector.hpp"
|
||||
#include "vertex_transform.hpp"
|
||||
#include "ctrans.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "geom_util.hpp"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
enum {
|
||||
|
@ -259,7 +260,7 @@ namespace mapnik
|
|||
typedef polygon<vertex2d> polygon_impl;
|
||||
|
||||
typedef geometry<vertex2d> geometry_type;
|
||||
typedef ref_ptr<geometry_type> geometry_ptr;
|
||||
typedef boost::shared_ptr<geometry_type> geometry_ptr;
|
||||
}
|
||||
|
||||
#endif //GEOMETRY_HPP
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
#include <vector>
|
||||
#include "feature.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "datasource.hpp"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace mapnik
|
|||
datasource_p ds_;
|
||||
std::vector<std::string> styles_;
|
||||
std::string selection_style_;
|
||||
mutable std::vector<ref_ptr<Feature> > selection_;
|
||||
mutable std::vector<boost::shared_ptr<Feature> > selection_;
|
||||
|
||||
public:
|
||||
explicit Layer(const Parameters& params);
|
||||
|
@ -62,8 +62,8 @@ namespace mapnik
|
|||
void setSelectable(bool selectable);
|
||||
bool isSelectable() const;
|
||||
bool isVisible(double scale) const;
|
||||
void add_to_selection(ref_ptr<Feature>& feature) const;
|
||||
std::vector<ref_ptr<Feature> >& selection() const;
|
||||
void add_to_selection(boost::shared_ptr<Feature>& feature) const;
|
||||
std::vector<boost::shared_ptr<Feature> >& selection() const;
|
||||
void clear_selection() const;
|
||||
datasource_p const& datasource() const;
|
||||
Envelope<double> envelope() const;
|
||||
|
@ -72,4 +72,4 @@ namespace mapnik
|
|||
void swap(const Layer& other);
|
||||
};
|
||||
}
|
||||
#endif //LAYER_HPP
|
||||
#endif //LAYER_HPP
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <vector>
|
||||
#include <cassert>
|
||||
#include "global.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "factory.hpp"
|
||||
#include "filter.hpp"
|
||||
#include "query.hpp"
|
||||
|
|
|
@ -25,9 +25,8 @@
|
|||
#include <map>
|
||||
#include <deque>
|
||||
#include <ctime>
|
||||
|
||||
#include "ptr.hpp"
|
||||
#include "utils.hpp"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -56,7 +55,7 @@ namespace mapnik
|
|||
template <typename T,template <typename> class Creator>
|
||||
class Pool
|
||||
{
|
||||
typedef ref_ptr<T> HolderType;
|
||||
typedef boost::shared_ptr<T> HolderType;
|
||||
typedef std::deque<HolderType> ContType;
|
||||
|
||||
Creator<T> creator_;
|
||||
|
@ -90,7 +89,7 @@ namespace mapnik
|
|||
mutex_.unlock();
|
||||
return usedPool_[usedPool_.size()-1];
|
||||
}
|
||||
static const HolderType defaultObj(0);
|
||||
static const HolderType defaultObj;
|
||||
return defaultObj;
|
||||
}
|
||||
|
||||
|
|
107
include/ptr.hpp
107
include/ptr.hpp
|
@ -1,107 +0,0 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
* Copyright (C) 2005 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//$Id: ptr.hpp 39 2005-04-10 20:39:53Z pavlenko $
|
||||
|
||||
#ifndef PTR_HPP
|
||||
#define PTR_HPP
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
||||
template <typename T> struct DefaultDeletePolicy
|
||||
{
|
||||
static void destroy(T* p)
|
||||
{
|
||||
delete p;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T,
|
||||
template <typename T> class DeallocPolicy=DefaultDeletePolicy>
|
||||
class ref_ptr
|
||||
{
|
||||
private:
|
||||
T* ptr_;
|
||||
int* pCount_;
|
||||
public:
|
||||
T* operator->() {return ptr_;}
|
||||
const T* operator->() const {return ptr_;}
|
||||
T* get() {return ptr_;}
|
||||
const T* get() const {return ptr_;}
|
||||
const T& operator *() const {return *ptr_;}
|
||||
T& operator *() {return *ptr_;}
|
||||
explicit ref_ptr(T* ptr=0)
|
||||
:ptr_(ptr),pCount_(new int(1)) {}
|
||||
ref_ptr(const ref_ptr& rhs)
|
||||
:ptr_(rhs.ptr_),pCount_(rhs.pCount_)
|
||||
{
|
||||
(*pCount_)++;
|
||||
}
|
||||
ref_ptr& operator=(const ref_ptr& rhs)
|
||||
{
|
||||
if (ptr_==rhs.ptr_) return *this;
|
||||
if (--(*pCount_)==0)
|
||||
{
|
||||
DeallocPolicy<T>::destroy(ptr_);
|
||||
delete pCount_;
|
||||
}
|
||||
ptr_=rhs.ptr_;
|
||||
pCount_=rhs.pCount_;
|
||||
(*pCount_)++;
|
||||
return *this;
|
||||
}
|
||||
bool operator !() const
|
||||
{
|
||||
return ptr_==0;
|
||||
}
|
||||
operator bool () const
|
||||
{
|
||||
return ptr_!=0;
|
||||
}
|
||||
inline friend bool operator==(const ref_ptr& lhs,
|
||||
const T* rhs)
|
||||
{
|
||||
return lhs.ptr_==rhs;
|
||||
}
|
||||
inline friend bool operator==(const T* lhs,
|
||||
const ref_ptr& rhs)
|
||||
{
|
||||
return lhs==rhs.ptr_;
|
||||
}
|
||||
inline friend bool operator!=(const ref_ptr& lhs,
|
||||
const T* rhs)
|
||||
{
|
||||
return lhs.ptr_!=rhs;
|
||||
}
|
||||
inline friend bool operator!=(const T* lhs,
|
||||
const ref_ptr& rhs)
|
||||
{
|
||||
return lhs!=rhs.ptr_;
|
||||
}
|
||||
~ref_ptr()
|
||||
{
|
||||
if (--(*pCount_)==0)
|
||||
{
|
||||
DeallocPolicy<T>::destroy(ptr_);
|
||||
delete pCount_;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif //PTR_HPP
|
|
@ -22,8 +22,6 @@
|
|||
#define RENDER_HPP
|
||||
|
||||
#include <stack>
|
||||
#include "memory.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "style.hpp"
|
||||
#include "envelope.hpp"
|
||||
#include "graphics.hpp"
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
#include "symbolizer.hpp"
|
||||
#include "filter.hpp"
|
||||
#include <ptr.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
typedef ref_ptr<symbolizer> symbolizer_ptr;
|
||||
typedef boost::shared_ptr<symbolizer> symbolizer_ptr;
|
||||
typedef std::vector<symbolizer_ptr> symbolizers;
|
||||
template <typename FeatureT> class all_filter;
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace mapnik
|
|||
class rule
|
||||
{
|
||||
typedef Filter<FeatureT> filter_type;
|
||||
typedef ref_ptr<filter_type> filter_ptr;
|
||||
typedef boost::shared_ptr<filter_type> filter_ptr;
|
||||
private:
|
||||
|
||||
std::string name_;
|
||||
|
|
|
@ -22,26 +22,26 @@
|
|||
#define STYLE_HPP
|
||||
|
||||
#include "color.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "symbolizer.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
class Style
|
||||
{
|
||||
private:
|
||||
std::vector<ref_ptr<symbolizer> > symbols_;
|
||||
static ref_ptr<symbolizer> zero_symbol_;
|
||||
std::vector<boost::shared_ptr<symbolizer> > symbols_;
|
||||
static boost::shared_ptr<symbolizer> zero_symbol_;
|
||||
public:
|
||||
typedef std::vector<ref_ptr<symbolizer> >::const_iterator Iterator;
|
||||
typedef std::vector<boost::shared_ptr<symbolizer> >::const_iterator Iterator;
|
||||
|
||||
Style() {}
|
||||
|
||||
Style(const ref_ptr<symbolizer>& symbol)
|
||||
Style(const boost::shared_ptr<symbolizer>& symbol)
|
||||
{
|
||||
symbols_.push_back(symbol);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace mapnik
|
|||
return *this;
|
||||
}
|
||||
|
||||
void add(const ref_ptr<symbolizer>& symbol)
|
||||
void add(const boost::shared_ptr<symbolizer>& symbol)
|
||||
{
|
||||
symbols_.push_back(symbol);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define STYLE_CACHE_HPP
|
||||
|
||||
#include "utils.hpp"
|
||||
#include "ptr.hpp"
|
||||
#include "style.hpp"
|
||||
#include <map>
|
||||
#include "feature_type_style.hpp"
|
||||
|
|
|
@ -39,8 +39,8 @@ namespace mapnik
|
|||
std::string fontName_;
|
||||
public:
|
||||
TextRasterizer(PixBuffer& pixbuf,const char* fontName)
|
||||
:pixbuf_(&pixbuf),
|
||||
fontName_(fontName) {}
|
||||
: pixbuf_(&pixbuf),
|
||||
fontName_(fontName) {}
|
||||
void render(const char* text);
|
||||
private:
|
||||
TextRasterizer(const TextRasterizer&);
|
||||
|
|
|
@ -45,11 +45,10 @@ namespace mapnik
|
|||
}
|
||||
private:
|
||||
expression<FeatureT>* label_;
|
||||
fill fill_;
|
||||
|
||||
fill fill_;
|
||||
private:
|
||||
text_symbolizer(const text_symbolizer&);
|
||||
text_symbolizer& operator=(const text_symbolizer&);
|
||||
text_symbolizer(text_symbolizer const&);
|
||||
text_symbolizer& operator=(text_symbolizer const&);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -93,8 +93,8 @@ mapnik_python_src=Split(
|
|||
|
||||
headers =[ '#include',boost_root,freetype2_root,agg_headers,python_headers]
|
||||
|
||||
libraries=['mapnik','agg','boost-filesystem','boost-regex','boost-python']
|
||||
libpaths = [prefix+"/lib",'#agg']
|
||||
libraries=['mapnik','boost-python']
|
||||
libpaths = [prefix+"/lib"]
|
||||
|
||||
_mapnik_python = env.PythonExtension(target='_mapnik',\
|
||||
source=mapnik_python_src,\
|
||||
|
|
|
@ -27,31 +27,6 @@
|
|||
|
||||
using namespace mapnik;
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace python
|
||||
{
|
||||
|
||||
template <typename T,
|
||||
template <typename T> class DeallocPolicy>
|
||||
T* get_pointer(ref_ptr< T , DeallocPolicy> const& ptr)
|
||||
{
|
||||
return ( T* )ptr.get();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct pointee<ref_ptr<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <> struct pointee<ref_ptr<datasource,datasource_delete> >
|
||||
{
|
||||
typedef datasource type;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void export_color();
|
||||
void export_layer();
|
||||
void export_parameters();
|
||||
|
@ -78,36 +53,36 @@ void render(const Map& map,Image32& image)
|
|||
}
|
||||
|
||||
|
||||
ref_ptr<symbolizer> create_point_symbolizer(std::string const& file,unsigned w,unsigned h)
|
||||
boost::shared_ptr<symbolizer> create_point_symbolizer(std::string const& file,unsigned w,unsigned h)
|
||||
{
|
||||
return ref_ptr<symbolizer>(new image_symbolizer(file,"png",w,h));
|
||||
return boost::shared_ptr<symbolizer>(new image_symbolizer(file,"png",w,h));
|
||||
}
|
||||
|
||||
ref_ptr<symbolizer> create_line_symbolizer(const Color& pen,float width)
|
||||
boost::shared_ptr<symbolizer> create_line_symbolizer(const Color& pen,float width)
|
||||
{
|
||||
return ref_ptr<symbolizer>(new line_symbolizer(pen,width));
|
||||
return boost::shared_ptr<symbolizer>(new line_symbolizer(pen,width));
|
||||
}
|
||||
|
||||
ref_ptr<symbolizer> create_line_symbolizer2(stroke const& strk)
|
||||
boost::shared_ptr<symbolizer> create_line_symbolizer2(stroke const& strk)
|
||||
{
|
||||
return ref_ptr<symbolizer>(new line_symbolizer(strk));
|
||||
return boost::shared_ptr<symbolizer>(new line_symbolizer(strk));
|
||||
}
|
||||
|
||||
ref_ptr<symbolizer> create_polygon_symbolizer(const Color& fill)
|
||||
boost::shared_ptr<symbolizer> create_polygon_symbolizer(const Color& fill)
|
||||
{
|
||||
return ref_ptr<symbolizer>(new polygon_symbolizer(fill));
|
||||
return boost::shared_ptr<symbolizer>(new polygon_symbolizer(fill));
|
||||
}
|
||||
|
||||
ref_ptr<symbolizer> create_polygon_symbolizer2(std::string const& file,unsigned w,unsigned h)
|
||||
boost::shared_ptr<symbolizer> create_polygon_symbolizer2(std::string const& file,unsigned w,unsigned h)
|
||||
{
|
||||
return ref_ptr<symbolizer>(new pattern_symbolizer(file,"png",w,h));
|
||||
return boost::shared_ptr<symbolizer>(new pattern_symbolizer(file,"png",w,h));
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE(_mapnik)
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
||||
class_<datasource,ref_ptr<datasource,datasource_delete>,
|
||||
class_<datasource,boost::shared_ptr<datasource>,
|
||||
boost::noncopyable>("datasource",no_init)
|
||||
.def("envelope",&datasource::envelope,
|
||||
return_value_policy<reference_existing_object>())
|
||||
|
@ -115,7 +90,7 @@ BOOST_PYTHON_MODULE(_mapnik)
|
|||
|
||||
class_<symbolizer,boost::noncopyable> ("symbolizer_",no_init)
|
||||
;
|
||||
class_<ref_ptr<symbolizer,mapnik::DefaultDeletePolicy>,
|
||||
class_<boost::shared_ptr<symbolizer>,
|
||||
boost::noncopyable>("symbolizer",no_init)
|
||||
;
|
||||
export_parameters();
|
||||
|
@ -144,6 +119,6 @@ BOOST_PYTHON_MODULE(_mapnik)
|
|||
def("line_symbolizer",&create_line_symbolizer2);
|
||||
def("polygon_symbolizer",&create_polygon_symbolizer);
|
||||
def("polygon_symbolizer",&create_polygon_symbolizer2);
|
||||
register_ptr_to_python<ref_ptr<symbolizer> >();
|
||||
register_ptr_to_python<boost::shared_ptr<symbolizer> >();
|
||||
register_ptr_to_python<filter_ptr>();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#edit this file
|
||||
PREFIX = '/opt/mapnik'
|
||||
BOOST_ROOT = '/opt/boost/boost_1_33_1'
|
||||
FREETYPE2_ROOT = '/usr/include/freetype2'
|
||||
FREETYPE2_ROOT = '/opt/freetype'
|
||||
PYTHON_VERSION = '2.4'
|
||||
PYTHON_ROOT = '/opt/python'
|
||||
AGG_ROOT = '/opt/agg-2.4'
|
||||
|
|
|
@ -39,16 +39,16 @@ namespace mapnik
|
|||
lt_dlexit();
|
||||
}
|
||||
|
||||
std::map<string,ref_ptr<PluginInfo> > datasource_cache::plugins_;
|
||||
std::map<string,boost::shared_ptr<PluginInfo> > datasource_cache::plugins_;
|
||||
bool datasource_cache::registered_=false;
|
||||
|
||||
datasource_p datasource_cache::create(const Parameters& params)
|
||||
{
|
||||
datasource *ds=0;
|
||||
datasource_p ds;
|
||||
try
|
||||
{
|
||||
std::string type=params.get("type");
|
||||
map<string,ref_ptr<PluginInfo> >::iterator itr=plugins_.find(type);
|
||||
map<string,boost::shared_ptr<PluginInfo> >::iterator itr=plugins_.find(type);
|
||||
if (itr!=plugins_.end())
|
||||
{
|
||||
if (itr->second->handle())
|
||||
|
@ -60,7 +60,7 @@ namespace mapnik
|
|||
}
|
||||
else
|
||||
{
|
||||
ds=create_datasource(params);
|
||||
ds=datasource_p(create_datasource(params),datasource_deleter());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -78,12 +78,12 @@ namespace mapnik
|
|||
{
|
||||
std::cerr<<"exception caught "<<std::endl;
|
||||
}
|
||||
return ref_ptr<datasource,datasource_delete>(ds);
|
||||
return ds;
|
||||
}
|
||||
|
||||
bool datasource_cache::insert(const std::string& type,const lt_dlhandle module)
|
||||
{
|
||||
return plugins_.insert(make_pair(type,ref_ptr<PluginInfo>(new PluginInfo(type,module)))).second;
|
||||
return plugins_.insert(make_pair(type,boost::shared_ptr<PluginInfo>(new PluginInfo(type,module)))).second;
|
||||
}
|
||||
|
||||
void datasource_cache::register_datasources(const std::string& str)
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
//$Id: layer.cpp 17 2005-03-08 23:58:43Z pavlenko $
|
||||
|
||||
#include <string>
|
||||
#include "ptr.hpp"
|
||||
#include "style.hpp"
|
||||
#include "datasource.hpp"
|
||||
#include "datasource_cache.hpp"
|
||||
|
@ -41,17 +40,14 @@ namespace mapnik
|
|||
try
|
||||
{
|
||||
name_=params_.get("name");
|
||||
//volatile datasource_cache* factory=datasource_cache::instance();
|
||||
//ds_=factory->create(params_);
|
||||
ds_=datasource_cache::instance()->create(params_);
|
||||
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Layer::Layer(const Layer& rhs)
|
||||
:params_(rhs.params_),
|
||||
name_(rhs.name_),
|
||||
|
@ -177,12 +173,12 @@ namespace mapnik
|
|||
return selection_style_;
|
||||
}
|
||||
|
||||
void Layer::add_to_selection(ref_ptr<Feature>& feature) const
|
||||
void Layer::add_to_selection(shared_ptr<Feature>& feature) const
|
||||
{
|
||||
selection_.push_back(feature);
|
||||
}
|
||||
|
||||
vector<ref_ptr<Feature> >& Layer::selection() const
|
||||
vector<shared_ptr<Feature> >& Layer::selection() const
|
||||
{
|
||||
return selection_;
|
||||
}
|
||||
|
|
|
@ -22,5 +22,5 @@
|
|||
|
||||
namespace mapnik
|
||||
{
|
||||
ref_ptr<symbolizer> Style::zero_symbol_=ref_ptr<symbolizer>(0);
|
||||
boost::shared_ptr<symbolizer> Style::zero_symbol_ = boost::shared_ptr<symbolizer>();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace mapnik
|
|||
{
|
||||
return itr->second;
|
||||
}
|
||||
static const Style default_style(ref_ptr<symbolizer>(new line_symbolizer(Color(255,0,0))));
|
||||
static const Style default_style(boost::shared_ptr<symbolizer>(new line_symbolizer(Color(255,0,0))));
|
||||
return default_style;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue