added __declspec(dllexport)

This commit is contained in:
Artem Pavlenko 2006-03-22 15:52:29 +00:00
parent 33ec516bd4
commit 883e21fe0c
29 changed files with 183 additions and 156 deletions

View file

@ -29,26 +29,27 @@
namespace mapnik
{
template <typename T>
struct agg_renderer : public feature_style_processor<agg_renderer<T> >,
class MAPNIK_DECL agg_renderer : public feature_style_processor<agg_renderer<T> >,
private boost::noncopyable
{
agg_renderer(Map const& m, T & pixmap);
void start_map_processing(Map const& map);
void end_map_processing(Map const& map);
void start_layer_processing(Layer const& lay);
void end_layer_processing(Layer const& lay);
void process(point_symbolizer const& sym,Feature const& feature);
void process(line_symbolizer const& sym,Feature const& feature);
void process(line_pattern_symbolizer const& sym,Feature const& feature);
void process(polygon_symbolizer const& sym,Feature const& feature);
void process(polygon_pattern_symbolizer const& sym,Feature const& feature);
void process(raster_symbolizer const& sym,Feature const& feature);
void process(text_symbolizer const& sym,Feature const& feature);
public:
agg_renderer(Map const& m, T & pixmap);
void start_map_processing(Map const& map);
void end_map_processing(Map const& map);
void start_layer_processing(Layer const& lay);
void end_layer_processing(Layer const& lay);
void process(point_symbolizer const& sym,Feature const& feature);
void process(line_symbolizer const& sym,Feature const& feature);
void process(line_pattern_symbolizer const& sym,Feature const& feature);
void process(polygon_symbolizer const& sym,Feature const& feature);
void process(polygon_pattern_symbolizer const& sym,Feature const& feature);
void process(raster_symbolizer const& sym,Feature const& feature);
void process(text_symbolizer const& sym,Feature const& feature);
private:
T & pixmap_;
CoordTransform t_;
face_manager<freetype_engine> font_manager_;
label_collision_detector2 detector_;
T & pixmap_;
CoordTransform t_;
face_manager<freetype_engine> font_manager_;
label_collision_detector2 detector_;
};
}

View file

@ -49,7 +49,7 @@ namespace mapnik
}
};
class attribute
class MAPNIK_DECL attribute
{
public:
attribute()

View file

@ -21,11 +21,12 @@
#ifndef COLOR_HPP
#define COLOR_HPP
#include "config.hpp"
#include <sstream>
namespace mapnik {
class Color
class MAPNIK_DECL Color
{
private:
unsigned int rgba_;

View file

@ -26,7 +26,7 @@
namespace mapnik
{
using namespace boost::spirit;
class color_factory
class MAPNIK_DECL color_factory
{
public:
static Color from_string(char const* css_color)

View file

@ -29,7 +29,7 @@ namespace mapnik
typedef coord_array<coord2d> CoordinateArray;
template <typename Transform,typename Geometry>
struct coord_transform
struct MAPNIK_DECL coord_transform
{
coord_transform(Transform const& t,Geometry& geom)
: t_(t), geom_(geom) {}
@ -54,10 +54,10 @@ namespace mapnik
class CoordTransform
{
private:
int width;
int height;
double scale_;
Envelope<double> extent;
int width;
int height;
double scale_;
Envelope<double> extent;
public:
CoordTransform(int width,int height,const Envelope<double>& extent)
:width(width),height(height),extent(extent)

View file

@ -33,15 +33,15 @@
namespace mapnik
{
typedef shared_ptr<Feature> feature_ptr;
struct Featureset
typedef MAPNIK_DECL shared_ptr<Feature> feature_ptr;
struct MAPNIK_DECL Featureset
{
virtual feature_ptr next()=0;
virtual ~Featureset() {};
};
typedef shared_ptr<Featureset> featureset_ptr;
class datasource_exception : public std::exception
class MAPNIK_DECL datasource_exception : public std::exception
{
private:
const std::string message_;
@ -56,7 +56,7 @@ namespace mapnik
}
};
class datasource
class MAPNIK_DECL datasource
{
public:
enum {
@ -88,15 +88,15 @@ namespace mapnik
///////////////////////////////////////////
#define DATASOURCE_PLUGIN(classname) \
extern "C" std::string datasource_name() \
extern "C" MAPNIK_DECL std::string datasource_name() \
{ \
return classname::name();\
}\
extern "C" datasource* create(const parameters &params) \
extern "C" MAPNIK_DECL datasource* create(const parameters &params) \
{ \
return new classname(params); \
}\
extern "C" void destroy(datasource *ds) \
extern "C" MAPNIK_DECL void destroy(datasource *ds) \
{ \
delete ds;\
}\

View file

@ -30,7 +30,7 @@
namespace mapnik
{
class datasource_cache : public singleton <datasource_cache,CreateStatic>
class MAPNIK_DECL datasource_cache : public singleton <datasource_cache,CreateStatic>
{
friend class CreateStatic<datasource_cache>;
private:

View file

@ -21,12 +21,13 @@
#ifndef ENVELOPE_HPP
#define ENVELOPE_HPP
#include "config.hpp"
#include "coord.hpp"
namespace mapnik
{
template <class T> class Envelope
template <class T> class MAPNIK_DECL Envelope
{
public:
typedef Envelope<T> EnvelopeType;

View file

@ -28,8 +28,9 @@ namespace mapnik
{
template <typename FeatureT> class filter_visitor;
template <typename FeatureT>
struct expression
class expression
{
public:
virtual value get_value(FeatureT const& feature) const=0;
virtual void accept(filter_visitor<FeatureT>& v)=0;
virtual expression<FeatureT>* clone() const=0;
@ -81,14 +82,14 @@ namespace mapnik
{
public:
property(std::string const& name)
: expression<FeatureT>(),
name_(name)
{}
: expression<FeatureT>(),
name_(name)
{}
property(property const& other)
: expression<FeatureT>(),
name_(other.name_)
{}
name_(other.name_)
{}
value get_value(FeatureT const& feature) const
{
@ -111,10 +112,11 @@ namespace mapnik
{
return "["+name_+"]";
}
~property() {}
private:
std::string name_;
~property() {}
private:
std::string name_;
};
}

View file

@ -28,58 +28,59 @@ namespace mapnik
{
template <typename FeatureT> class filter_visitor;
template <typename FeatureT>
struct filter
class MAPNIK_DECL filter
{
virtual bool pass(const FeatureT& feature) const=0;
virtual filter<FeatureT>* clone() const=0;
virtual void accept(filter_visitor<FeatureT>& v) = 0;
public:
virtual bool pass(const FeatureT& feature) const=0;
virtual filter<FeatureT>* clone() const=0;
virtual void accept(filter_visitor<FeatureT>& v) = 0;
virtual std::string to_string() const=0;
virtual ~filter() {}
virtual ~filter() {}
};
typedef boost::shared_ptr<filter<Feature> > filter_ptr;
template <typename FeatureT>
struct all_filter : public filter<FeatureT>
class all_filter : public filter<FeatureT>
{
bool pass (const FeatureT&) const
{
return true;
}
public:
bool pass (const FeatureT&) const
{
return true;
}
filter<FeatureT>* clone() const
{
return new all_filter<FeatureT>;
}
std::string to_string() const
{
return "true";
}
filter<FeatureT>* clone() const
{
return new all_filter<FeatureT>;
}
std::string to_string() const
{
return "true";
}
void accept(filter_visitor<FeatureT>&) {}
virtual ~all_filter() {}
virtual ~all_filter() {}
};
template <typename FeatureT>
struct none_filter : public filter<FeatureT>
class none_filter : public filter<FeatureT>
{
bool pass (const FeatureT&) const
{
return false;
}
public:
bool pass (const FeatureT&) const
{
return false;
}
filter<FeatureT>* clone() const
{
return new none_filter<FeatureT>;
}
std::string to_string() const
{
return "false";
}
void accept(filter_visitor<FeatureT>&) {}
virtual ~none_filter() {}
};
filter<FeatureT>* clone() const
{
return new none_filter<FeatureT>;
}
std::string to_string() const
{
return "false";
}
void accept(filter_visitor<FeatureT>&) {}
virtual ~none_filter() {}
};
}
#endif //FILTER_HPP

View file

@ -30,7 +30,7 @@ using std::string;
namespace mapnik
{
template<typename FeatureT>
class filter_factory
class MAPNIK_DECL filter_factory
{
public:
static filter_ptr compile(string const& str)

View file

@ -29,12 +29,13 @@ namespace mapnik
template <typename FeatureT> class expression;
template <typename Feature,template <typename> class Filter> class rule;
template <typename FeatureT>
struct filter_visitor
class filter_visitor
{
virtual void visit(filter<FeatureT>& filter)=0;
virtual void visit(expression<FeatureT>&)=0;
virtual void visit(rule<FeatureT,filter> const& r)=0;
virtual ~filter_visitor() {}
public:
virtual void visit(filter<FeatureT>& filter)=0;
virtual void visit(expression<FeatureT>&)=0;
virtual void visit(rule<FeatureT,filter> const& r)=0;
virtual ~filter_visitor() {}
};
}

View file

@ -92,7 +92,7 @@ namespace mapnik
typedef boost::shared_ptr<font_face> face_ptr;
class freetype_engine : public mapnik::singleton<freetype_engine,mapnik::CreateStatic>,
class MAPNIK_DECL freetype_engine : public mapnik::singleton<freetype_engine,mapnik::CreateStatic>,
private boost::noncopyable
{
friend class mapnik::CreateStatic<freetype_engine>;
@ -165,7 +165,7 @@ namespace mapnik
template <typename T>
class face_manager : private boost::noncopyable
class MAPNIK_DECL face_manager : private boost::noncopyable
{
typedef T font_engine_type;
typedef std::map<std::string,face_ptr> faces;
@ -238,7 +238,7 @@ namespace mapnik
{
code = p; // U+0000 - U+007f (ascii)
}
out.push_back(code);
out.push_back(wchar_t(code));
}
return out;
}
@ -308,7 +308,7 @@ namespace mapnik
pen.x = 0;
pen.y = 0;
use_kerning = FT_HAS_KERNING(face);
use_kerning = FT_HAS_KERNING(face)>0?true:false;
FT_BBox bbox;
bbox.xMin = bbox.yMin = 32000;

View file

@ -23,7 +23,7 @@
namespace mapnik
{
struct gamma
struct MAPNIK_DECL gamma
{
unsigned char g2l[256];
unsigned char l2g[256];
@ -33,7 +33,7 @@ namespace mapnik
for (int i=0;i< 256;i++)
{
result=(int)(pow(i/255.0,gamma) * 255.0 + 0.5);
g2l[i]=(unsigned short)result;
g2l[i]=(unsigned char)result;
}
for (int i = 0; i < 256; i++)
{

View file

@ -31,19 +31,19 @@
namespace mapnik
{
class Image32
class MAPNIK_DECL Image32
{
private:
unsigned width_;
unsigned height_;
Color background_;
ImageData32 data_;
static gamma gammaTable_;
//static gamma gammaTable_;
public:
Image32(int width,int height);
Image32(const Image32& rhs);
~Image32();
static void setGamma(double gamma);
//static void setGamma(double gamma);
void setBackground(const Color& background);
const Color& getBackground() const;
const ImageData32& data() const;
@ -76,6 +76,7 @@ namespace mapnik
data_(x,y)=rgba;
}
}
/*
inline int blendColor(int c0,int c1,int t)
{
int bgRed=(c1>>16)&0xff;
@ -94,7 +95,7 @@ namespace mapnik
return 0xff << 24 | r << 16 | g << 8 | b;
}
*/
inline void blendPixel(int x,int y,unsigned int rgba1,int t)
{
if (checkBounds(x,y))

View file

@ -23,7 +23,7 @@
namespace mapnik
{
class ImageUtils
class MAPNIK_DECL ImageUtils
{
public:
static void save_to_file(const std::string& filename,const std::string& type,const Image32& image);

View file

@ -29,7 +29,7 @@
namespace mapnik
{
class Layer
class MAPNIK_DECL Layer
{
friend class boost::serialization::access;
template <typename Archive>

View file

@ -26,7 +26,7 @@
namespace mapnik
{
struct line_pattern_symbolizer
struct MAPNIK_DECL line_pattern_symbolizer
{
line_pattern_symbolizer(std::string const& file,
std::string const& type,

View file

@ -25,7 +25,7 @@
namespace mapnik
{
struct line_symbolizer
struct MAPNIK_DECL line_symbolizer
{
line_symbolizer(stroke const& stroke)
: stroke_(stroke) {}
@ -42,7 +42,7 @@ namespace mapnik
}
private:
stroke stroke_;
stroke stroke_;
};
}

View file

@ -29,7 +29,7 @@ namespace mapnik
{
class Layer;
class Map
class MAPNIK_DECL Map
{
friend class boost::serialization::access;
template <typename Archive>

View file

@ -71,6 +71,8 @@
#include "css_color_parser.hpp"
#include "color_factory.hpp"
namespace mapnik
{
void save_to_xml(Map const& map,const char* filename);

View file

@ -26,7 +26,7 @@
namespace mapnik
{
struct point_symbolizer
struct MAPNIK_DECL point_symbolizer
{
point_symbolizer(std::string const& file,
std::string const& type,

View file

@ -26,7 +26,7 @@
namespace mapnik
{
struct polygon_pattern_symbolizer
struct MAPNIK_DECL polygon_pattern_symbolizer
{
polygon_pattern_symbolizer(std::string const& file,

View file

@ -23,10 +23,11 @@
//#include "symbolizer.hpp"
//#include <boost/utility.hpp>
#include "color.hpp"
namespace mapnik
{
struct polygon_symbolizer
struct MAPNIK_DECL polygon_symbolizer
{
polygon_symbolizer(Color const& fill)
: fill_(fill) {}

View file

@ -25,7 +25,7 @@
namespace mapnik
{
struct raster_symbolizer { /* TODO */};
struct MAPNIK_DECL raster_symbolizer { /* TODO */};
}
#endif //RASTER_SYMBOLIZER

View file

@ -142,7 +142,7 @@ namespace mapnik
}
bool has_dash() const
{
return dash_.size();
return dash_.size()>0 ? true : false ;
}
dash_array const& get_dash_array() const

View file

@ -34,7 +34,7 @@ namespace mapnik
typedef boost::tuple<double,double> position;
struct text_symbolizer
struct MAPNIK_DECL text_symbolizer
{
text_symbolizer(std::string const& name,unsigned size,Color const& fill);
text_symbolizer(text_symbolizer const& rhs);

View file

@ -24,9 +24,10 @@
#include <stdexcept>
#include <limits>
#include <ctime>
#include <sys/time.h>
//#include <sys/time.h>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <boost/thread/mutex.hpp>
@ -167,24 +168,24 @@ namespace mapnik
struct timer
{
struct timeval tv_;
//struct timeval tv_;
timer()
{
gettimeofday (&tv_,0);
//gettimeofday (&tv_,0);
}
void start()
{
gettimeofday (&tv_,0);
//gettimeofday (&tv_,0);
}
void stop()
{
timeval tv;
gettimeofday (&tv,0);
std::ostringstream s;
long sec=1000*(tv.tv_sec-tv_.tv_sec);
long total_ms=sec+static_cast<long>(0.001*(tv.tv_usec-tv_.tv_usec));
s << "elapsed time is "<<total_ms<<" ms";
std::clog<<s.str()<<std::endl;
//timeval tv;
//gettimeofday (&tv,0);
//std::ostringstream s;
//long sec=1000*(tv.tv_sec-tv_.tv_sec);
//long total_ms=sec+static_cast<long>(0.001*(tv.tv_usec-tv_.tv_usec));
//s << "elapsed time is "<<total_ms<<" ms";
//std::clog<<s.str()<<std::endl;
}
};
@ -217,31 +218,31 @@ namespace mapnik
throw BadConversion("fromString("+s+")");
}
inline bool space (char c)
{
return isspace(c);
}
//inline bool space (char c)
//{
// return isspace(c);
// }
inline bool not_space (char c)
{
return !isspace(c);
}
// inline bool not_space (char c)
//{
// return !isspace(c);
// }
inline std::string trim_left(const std::string& str)
{
typedef std::string::const_iterator iter;
iter i = find_if(str.begin(),str.end(),not_space);
return std::string(i,str.end());
}
inline std::string trim_right(const std::string& str)
{
std::string::size_type idx=str.find_last_not_of(" ");
return str.substr(0,idx+1);
}
inline std::string trim(const std::string& str)
{
return trim_left(trim_right(str));
}
//inline std::string trim_left(const std::string& str)
//{
// typedef std::string::const_iterator iter;
// iter i = std::find_if(str.begin(),str.end(),not_space);
//return std::string(i,str.end());
//}
//inline std::string trim_right(const std::string& str)
//{
// std::string::size_type idx=str.find_last_not_of(" ");
// return str.substr(0,idx+1);
// }
// inline std::string trim(const std::string& str)
// {
// return trim_left(trim_right(str));
//}
}

View file

@ -28,7 +28,7 @@
using namespace boost;
namespace mapnik {
typedef variant<int,double,std::string> value_base;
typedef variant<std::string,int,double> value_base;
namespace impl {
struct equals
@ -352,6 +352,17 @@ namespace mapnik {
template <typename T> value(T _val_)
: value_base(_val_) {}
value (const value& rhs)
{
//todo!!!!!!!!!
}
value& operator=(value const& rhs)
{
if (this == &rhs)
return *this;
//TODO!!!!!
return *this;
}
bool operator==(value const& other) const
{
return boost::apply_visitor(impl::equals(),*this,other);
@ -419,31 +430,35 @@ namespace mapnik {
inline const value operator+(value const& p1,value const& p2)
{
value tmp(p1);
tmp+=p2;
return tmp;
//value tmp(p1);
//tmp+=p2;
//return tmp;
return boost::apply_visitor(impl::add<value>(),p1, p2);
}
inline const value operator-(value const& p1,value const& p2)
{
value tmp(p1);
tmp-=p2;
return tmp;
//value tmp(p1);
//tmp-=p2;
//return tmp;
return boost::apply_visitor(impl::sub<value>(),p1, p2);
}
inline const value operator*(value const& p1,value const& p2)
{
value tmp(p1);
tmp*=p2;
return tmp;
//value tmp(p1);
//tmp*=p2;
//return tmp;
return boost::apply_visitor(impl::mult<value>(),p1, p2);
}
inline const value operator/(value const& p1,value const& p2)
{
value tmp(p1);
tmp/=p2;
return tmp;
}
//value tmp(p1);
//tmp/=p2;
//return tmp;
return boost::apply_visitor(impl::div<value>(),p1, p2);
}
//template <typename charT, typename traits>
//inline std::basic_ostream<charT,traits>&