+ various win32 fixes, mainly adding extra namespace qualifiers

for vc++10, MAPNIK_DECL ...
This commit is contained in:
Artem Pavlenko 2011-10-19 15:29:24 +01:00
parent 49cb8c7368
commit 9088d7bbc8
31 changed files with 110 additions and 68 deletions

View file

@ -49,7 +49,7 @@ geometry_type const& getitem_impl(path_type & p, int key)
void from_wkt_impl(path_type& p, std::string const& wkt)
{
bool result = mapnik::from_wkt(wkt, p);
bool result = mapnik::from_wkt(wkt , p);
if (!result) throw std::runtime_error("Failed to parse WKT");
}

View file

@ -46,7 +46,7 @@ void export_grid()
"Grid",
"This class represents a feature hitgrid.",
init<int,int,std::string,unsigned>(
( arg("width"),arg("height"),arg("key")="__id__",arg("resolution")=1 ),
( boost::python::arg("width"), boost::python::arg("height"),boost::python::arg("key")="__id__", boost::python::arg("resolution")=1 ),
"Create a mapnik.Grid object\n"
))
.def("painted",&painted)
@ -54,7 +54,7 @@ void export_grid()
.def("height",&mapnik::grid::height)
.def("view",&mapnik::grid::get_view)
.def("encode",encode,
( arg("encoding")="utf",arg("features")=true,arg("resolution")=4 ),
( boost::python::arg("encoding")="utf", boost::python::arg("features")=true,boost::python::arg("resolution")=4 ),
"Encode the grid as as optimized json\n"
)
.add_property("key",

View file

@ -45,7 +45,7 @@ void export_grid_view()
.def("width",&mapnik::grid_view::width)
.def("height",&mapnik::grid_view::height)
.def("encode",encode,
( arg("encoding")="utf",arg("add_features")=true,arg("resolution")=4 ),
( boost::python::arg("encoding")="utf",boost::python::arg("add_features")=true,boost::python::arg("resolution")=4 ),
"Encode the grid as as optimized json\n"
)
;

View file

@ -148,8 +148,8 @@ struct rule_pickle_suite : boost::python::pickle_suite
extract_symbolizer serializer( r );
for (int i=0;i<len(syms);++i)
{
symbolizer symbol = extract<symbolizer>(syms[i]);
boost::apply_visitor( serializer, symbol );
//symbolizer symbol = extract<symbolizer>(syms[i]);
//boost::apply_visitor( serializer, symbol );
}
}

View file

@ -43,7 +43,7 @@ template <class T>
void set_svg_transform(T& symbolizer, std::string const& transform_wkt)
{
agg::trans_affine tr;
if (!mapnik::svg::parse_transform(transform_wkt, tr))
if (!mapnik::svg::parse_transform(transform_wkt.c_str(), tr))
{
std::stringstream ss;
ss << "Could not parse transform from '" << transform_wkt << "', expected string like: 'matrix(1, 0, 0, 1, 0, 0)'";

View file

@ -50,12 +50,12 @@ static void grid2utf(T const& grid_type,
typename T::key_type::const_iterator key_pos;
typename T::feature_key_type::const_iterator feature_pos;
// start counting at utf8 codepoint 32, aka space character
uint16_t codepoint = 32;
boost::uint16_t codepoint = 32;
unsigned array_size = data.width();
for (unsigned y = 0; y < data.height(); ++y)
{
uint16_t idx = 0;
boost::uint16_t idx = 0;
boost::scoped_array<Py_UNICODE> line(new Py_UNICODE[array_size]);
typename T::value_type const* row = data.getRow(y);
for (unsigned x = 0; x < data.width(); ++x)
@ -103,13 +103,13 @@ static void grid2utf(T const& grid_type,
typename T::key_type::const_iterator key_pos;
typename T::feature_key_type::const_iterator feature_pos;
// start counting at utf8 codepoint 32, aka space character
uint16_t codepoint = 32;
boost::uint16_t codepoint = 32;
// TODO - use double?
unsigned array_size = static_cast<unsigned int>(grid_type.width()/resolution);
for (unsigned y = 0; y < grid_type.height(); y=y+resolution)
{
uint16_t idx = 0;
boost::uint16_t idx = 0;
boost::scoped_array<Py_UNICODE> line(new Py_UNICODE[array_size]);
mapnik::grid::value_type const* row = grid_type.getRow(y);
for (unsigned x = 0; x < grid_type.width(); x=x+resolution)

View file

@ -43,7 +43,7 @@ enum filter_mode_enum {
DEFINE_ENUM( filter_mode_e, filter_mode_enum );
typedef std::vector<rule> rules;
class feature_type_style
class MAPNIK_DECL feature_type_style
{
private:
rules rules_;

View file

@ -200,7 +200,7 @@ public:
void init(double radius)
{
FT_Stroker_Set(s_,radius * (1<<6),
FT_Stroker_Set(s_, (FT_Fixed) radius * (1<<6),
FT_STROKER_LINECAP_ROUND,
FT_STROKER_LINEJOIN_ROUND,
0);

View file

@ -24,6 +24,7 @@
#define MAPNIK_GRID_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/image_data.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/grid/grid_view.hpp>
@ -31,6 +32,9 @@
#include <mapnik/value.hpp>
#include <mapnik/feature.hpp>
// boost
#include <boost/cstdint.hpp>
// stl
#include <map>
#include <set>
@ -95,17 +99,17 @@ public:
~hit_grid() {}
void painted(bool painted)
inline void painted(bool painted)
{
painted_ = painted;
}
bool painted() const
inline bool painted() const
{
return painted_;
}
void add_feature(mapnik::Feature const& feature)
inline void add_feature(mapnik::Feature const& feature)
{
// copies feature props
@ -152,12 +156,12 @@ public:
}
}
void add_property_name(std::string const& name)
inline void add_property_name(std::string const& name)
{
names_.insert(name);
}
std::set<std::string> property_names() const
inline std::set<std::string> const& property_names() const
{
return names_;
}
@ -275,7 +279,7 @@ public:
inline void blendPixel(value_type feature_id,int x,int y,unsigned int rgba1,int t)
{
blendPixel2(x,y,rgba1,t,1.0); // do not change opacity
blendPixel2(feature_id ,x,y,rgba1,t,1.0); // do not change opacity
}
inline void blendPixel2(value_type feature_id,int x,int y,unsigned int rgba1,int t,double opacity)
@ -331,7 +335,7 @@ public:
};
typedef hit_grid<uint16_t> grid;
typedef MAPNIK_DECL hit_grid<boost::uint16_t> grid;
}
#endif //MAPNIK_GRID_HPP

View file

@ -30,6 +30,8 @@
#include <mapnik/global.hpp>
#include <mapnik/value.hpp>
// boost
#include <boost/cstdint.hpp>
// stl
#include <map>
#include <set>
@ -188,7 +190,7 @@ private:
feature_type const& features_;
};
typedef hit_grid_view<mapnik::ImageData<uint16_t> > grid_view;
typedef hit_grid_view<mapnik::ImageData<boost::uint16_t> > grid_view;
}

View file

@ -434,7 +434,7 @@ private:
}
tries=0;
// ignore leaves and also nodes with small mean error and not excessive number of pixels
if ((cur_node->reduce_cost / cur_node->pixel_count + 1) * std::log(long(cur_node->pixel_count)) > 15
if ((cur_node->reduce_cost / cur_node->pixel_count + 1) * std::log(double(cur_node->pixel_count)) > 15
&& cur_node->children_count > 0)
{
colors_--;

View file

@ -255,6 +255,8 @@ inline MAPNIK_DECL std::string save_to_string(image_32 const& image,
return save_to_string<image_data_32>(image.data(), type, palette);
}
///////////////////////////////////////////////////////////////////////////
#ifdef _MSC_VER
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
std::string const&,
@ -263,19 +265,32 @@ template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
std::string const&,
rgba_palette const&);
template MAPNIK_DECL void save_to_file<image_data_32>(image_data_32 const&,
std::string const&);
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
std::string const&,
std::string const&,
rgba_palette const&);
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
std::string const&,
std::string const&);
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
std::string const&,
rgba_palette const&);
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
std::string const&);
template MAPNIK_DECL std::string save_to_string<image_data_32>(image_data_32 const&,
std::string const&,
rgba_palette const&);
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
std::string const&,
std::string const&,
rgba_palette const&);
template MAPNIK_DECL void save_to_file<image_view<image_data_32> > (image_view<image_data_32> const&,
std::string const&,
rgba_palette const&);
template MAPNIK_DECL std::string save_to_string<image_view<image_data_32> > (image_view<image_data_32> const&,
std::string const&,
rgba_palette const&);

View file

@ -25,6 +25,7 @@
#define METAWRITER_INMEM_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/metawriter.hpp>
// boost
@ -50,7 +51,7 @@ namespace mapnik {
* very common in the rendered image will increase memory usage, especially if
* many attributes are also kept.
*/
class metawriter_inmem
class MAPNIK_DECL metawriter_inmem
: public metawriter, private boost::noncopyable {
public:
/**
@ -87,7 +88,7 @@ public:
* are the intersection of the features' properties and the "kept"
* properties of the metawriter.
*/
struct meta_instance {
struct MAPNIK_DECL meta_instance {
box2d<double> box;
std::map<std::string, value> properties;
};

View file

@ -26,6 +26,7 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/global.hpp>
#include <mapnik/config_error.hpp>
@ -124,7 +125,7 @@ struct rgba
typedef boost::unordered_map<unsigned, unsigned> rgba_hash_table;
class rgba_palette : private boost::noncopyable {
class MAPNIK_DECL rgba_palette : private boost::noncopyable {
public:
enum palette_type { PALETTE_RGBA = 0, PALETTE_RGB = 1, PALETTE_ACT = 2 };

View file

@ -24,6 +24,7 @@
#define MAPNIK_PARSE_PATH_HPP
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/attribute.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/value.hpp>
@ -41,7 +42,7 @@ typedef boost::variant<std::string, attribute> path_component;
typedef std::vector<path_component> path_expression;
typedef boost::shared_ptr<path_expression> path_expression_ptr;
path_expression_ptr parse_path(std::string const & str);
MAPNIK_DECL path_expression_ptr parse_path(std::string const & str);
template <typename T>
struct path_processor

View file

@ -51,7 +51,7 @@
namespace mapnik
{
using namespace boost;
namespace qi = boost::spirit::qi;
namespace phoenix = boost::phoenix;
namespace standard_wide = boost::spirit::standard_wide;
@ -79,7 +79,7 @@ struct path_expression_grammar : qi::grammar<Iterator, std::vector<path_componen
* (
str [ push_back(_val, _1)]
|
( '[' >> attr [ push_back(_val, construct<attribute>( _1 )) ] >> ']')
( '[' >> attr [ push_back(_val, construct<mapnik::attribute>( _1 )) ] >> ']')
)
;

View file

@ -68,7 +68,7 @@ enum colorizer_mode_enum
DEFINE_ENUM( colorizer_mode, colorizer_mode_enum );
//! \brief Structure to represent a stop position.
class colorizer_stop {
class MAPNIK_DECL colorizer_stop {
public:
//! \brief Constructor
@ -142,7 +142,7 @@ typedef std::vector<colorizer_stop> colorizer_stops;
//! \brief Class representing the raster colorizer
class raster_colorizer {
class MAPNIK_DECL raster_colorizer {
public:
//! \brief Constructor
raster_colorizer(colorizer_mode mode = COLORIZER_LINEAR, const color& _color = color(0,0,0,0));

View file

@ -28,6 +28,11 @@
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#ifdef _WINDOWS
#define _USE_MATH_DEFINES
#include <math.h>
#endif
namespace mapnik { namespace svg {
using namespace boost::fusion;

View file

@ -23,6 +23,7 @@
#ifndef SVG_PATH_PARSER_HPP
#define SVG_PATH_PARSER_HPP
#include <mapnik/config.hpp>
#include <string>
namespace mapnik { namespace svg {
@ -34,10 +35,10 @@ template <typename PathType>
bool parse_points(const char * wkt, PathType & p);
template <typename TransformType>
bool parse_transform(const char * wkt, TransformType & tr);
bool MAPNIK_DECL parse_transform(const char * wkt, TransformType & tr);
template <typename TransformType>
bool parse_transform(std::string const& wkt, TransformType & tr);
//template <typename TransformType>
//bool MAPNIK_DECL parse_transform(std::string const& wkt, TransformType & tr);
}}

View file

@ -35,6 +35,10 @@
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/home/phoenix/object/construct.hpp>
#ifdef _WINDOWS
#define _USE_MATH_DEFINES
#include <math.h>
#endif
namespace mapnik { namespace svg {

View file

@ -23,6 +23,7 @@
#define TEXT_PLACEMENTS_HPP
//mapnik
#include <mapnik/config.hpp>
#include <mapnik/enumeration.hpp>
//stl
@ -154,14 +155,14 @@ typedef boost::shared_ptr<text_placements> text_placements_ptr;
class text_placements_info_dummy;
class text_placements_dummy: public text_placements
class MAPNIK_DECL text_placements_dummy: public text_placements
{
public:
text_placement_info_ptr get_placement_info() const;
friend class text_placement_info_dummy;
};
class text_placement_info_dummy : public text_placement_info
class MAPNIK_DECL text_placement_info_dummy : public text_placement_info
{
public:
text_placement_info_dummy(text_placements_dummy const* parent) : text_placement_info(parent),

View file

@ -47,12 +47,10 @@ struct MAPNIK_DECL text_symbolizer : public symbolizer_base
{
text_symbolizer(expression_ptr name, std::string const& face_name,
unsigned size, color const& fill,
text_placements_ptr placements = text_placements_ptr(
boost::make_shared<text_placements_dummy>())
text_placements_ptr placements = text_placements_ptr(new text_placements_dummy)
);
text_symbolizer(expression_ptr name, unsigned size, color const& fill,
text_placements_ptr placements = text_placements_ptr(
boost::make_shared<text_placements_dummy>())
text_placements_ptr placements = text_placements_ptr(new text_placements_dummy)
);
text_symbolizer(text_symbolizer const& rhs);
text_symbolizer& operator=(text_symbolizer const& rhs);

View file

@ -25,9 +25,12 @@
#define VALUE_HPP
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/unicode.hpp>
#include <mapnik/config_error.hpp>
// boost
#include <boost/variant.hpp>
#include <boost/scoped_array.hpp>
#include <boost/concept_check.hpp>
@ -49,9 +52,9 @@ inline void to_utf8(UnicodeString const& input, std::string & target)
{
if (input.length() == 0) return;
const int32_t BUF_SIZE = 256;
const int BUF_SIZE = 256;
char buf [BUF_SIZE];
int32_t len;
int len;
UErrorCode err = U_ZERO_ERROR;
u_strToUTF8(buf, BUF_SIZE, &len, input.getBuffer(), input.length(), &err);
@ -106,10 +109,8 @@ struct equals
bool operator() (value_null, value_null) const
{
// this changed from false to true - see http://trac.mapnik.org/ticket/794
return true;
return false;
}
};
struct not_equals
@ -145,21 +146,18 @@ struct not_equals
bool operator() (value_null, value_null) const
{
// TODO - needs review http://trac.mapnik.org/ticket/794
return false;
}
template <typename T>
bool operator() (value_null, const T &) const
{
// TODO - needs review http://trac.mapnik.org/ticket/794
return false;
}
template <typename T>
bool operator() (const T &, value_null) const
{
// TODO - needs review http://trac.mapnik.org/ticket/794
return false;
}
};
@ -533,7 +531,7 @@ struct to_bool : public boost::static_visitor<bool>
template <typename T>
bool operator() (T val) const
{
return bool(val);
return val > 0 ? true : false;
}
};

View file

@ -23,13 +23,16 @@
#ifndef MAPNIK_WKT_FACTORY_HPP
#define MAPNIK_WKT_FACTORY_HPP
#include <string>
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/geometry.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
// stl
#include <string>
namespace mapnik {
bool from_wkt(std::string const& wkt, boost::ptr_vector<geometry_type> & paths);
MAPNIK_DECL bool from_wkt(std::string const& wkt, boost::ptr_vector<geometry_type> & paths);
}

View file

@ -173,5 +173,7 @@ void grid_renderer<T>::render_marker(Feature const& feature, unsigned int step,
pixmap_.add_feature(feature);
}
template class hit_grid<boost::uint16_t>;
template class grid_renderer<grid>;
}

View file

@ -896,7 +896,7 @@ void map_parser::parse_point_symbolizer( rule & rule, ptree const & sym )
if (transform_wkt)
{
agg::trans_affine tr;
if (!mapnik::svg::parse_transform(*transform_wkt,tr))
if (!mapnik::svg::parse_transform((*transform_wkt).c_str(),tr))
{
std::stringstream ss;
ss << "Could not parse transform from '" << transform_wkt
@ -1025,7 +1025,7 @@ void map_parser::parse_markers_symbolizer( rule & rule, ptree const & sym )
if (transform_wkt)
{
agg::trans_affine tr;
if (!mapnik::svg::parse_transform(*transform_wkt,tr))
if (!mapnik::svg::parse_transform((*transform_wkt).c_str(),tr))
{
std::stringstream ss;
ss << "Could not parse transform from '" << transform_wkt
@ -1671,7 +1671,7 @@ void map_parser::parse_shield_symbolizer( rule & rule, ptree const & sym )
if (transform_wkt)
{
agg::trans_affine tr;
if (!mapnik::svg::parse_transform(*transform_wkt,tr))
if (!mapnik::svg::parse_transform((*transform_wkt).c_str(),tr))
{
std::stringstream ss;
ss << "Could not parse transform from '" << transform_wkt << "', expected string like: 'matrix(1, 0, 0, 1, 0, 0)'";

View file

@ -23,6 +23,7 @@
//$Id$
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/proj_transform.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/utils.hpp>

View file

@ -118,10 +118,13 @@ void raster_colorizer::colorize(raster_ptr const& raster,const std::map<std::str
bool hasNoData = false;
float noDataValue = 0;
if (Props.count("NODATA")>0)
const std::map<std::string,value>::const_iterator fi = Props.find("NODATA");
if (fi != Props.end())
//if (Props.count("NODATA")>0)
{
hasNoData = true;
noDataValue = Props.at("NODATA").to_double();
//noDataValue = Props.at("NODATA").to_double();
noDataValue = fi->second.to_double();
}
for (int i=0; i<len; ++i)

View file

@ -42,6 +42,7 @@ bool parse_transform(const char * wkt, TransformType & p)
return qi::phrase_parse(first, last, g, skip_type());
}
/*
template <typename TransformType>
bool parse_transform(std::string const& wkt, TransformType & p)
{
@ -53,8 +54,9 @@ bool parse_transform(std::string const& wkt, TransformType & p)
iterator_type last = wkt.end();
return qi::phrase_parse(first, last, g, skip_type());
}
*/
template bool parse_transform<agg::trans_affine>(const char*, agg::trans_affine&);
template bool parse_transform<agg::trans_affine>(std::string const& , agg::trans_affine&);
template MAPNIK_DECL bool parse_transform<agg::trans_affine>(const char*, agg::trans_affine&);
//template bool parse_transform<agg::trans_affine>(std::string const& , agg::trans_affine&);
}}

View file

@ -168,7 +168,7 @@ void text_placements_simple::set_positions(std::string positions)
std::string::iterator first = positions.begin(), last = positions.end();
qi::phrase_parse(first, last,
(direction_name[push_back(ref(direction_), _1)] % ',') >> *(',' >> qi::int_[push_back(ref(text_sizes_), _1)]),
(direction_name[push_back(phoenix::ref(direction_), _1)] % ',') >> *(',' >> qi::int_[push_back(phoenix::ref(text_sizes_), _1)]),
space
);
if (first != last) {