Hi Volker,

Volker Schöch wrote On 14-10-2014 19:09:

Hi Team,

 

Thank you for pointing me to boost::geometry::svg_mapper, and to Inkscape, which are valuable tools for debugging polygons. Based on the example from the documentation …

http://www.boost.org/doc/libs/1_56_0/libs/geometry/doc/html/geometry/reference/io/svg/svg_mapper.html

… I find the following oddity: Simply change the following line

 

typedef boost::geometry::model::d2::point_xy<double> point_type;

 

into

 

typedef boost::geometry::model::d2::point_xy<int> point_type;

 

Nota bene: All values in the example code are integral numbers, anyway. Yet, the resulting output is different, see attached files. In case of int, the entire graphic is considerably offset to the north.

 

Should this be filed as a bug in boost trac?


I see it. Did not look for the cause yet. Yes, please file as a bug.


 

Further modification of the original example leads to more serious problems:

 

std::ostringstream svg;

 

// Specify the basic type

typedef boost::geometry::model::d2::point_xy<int> point_type;

 

// Declare some geometries and set their values

point_type a;

boost::geometry::assign_values(a, -100, -100);

 

// Declare a stream and an SVG mapper

boost::geometry::svg_mapper<point_type> mapper(svg, 1000, 1000);

 

// Add geometries such that all these geometries fit on the map

mapper.add(a);

 

// Draw the geometries on the SVG map, using a specific SVG style

mapper.map(a, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2", 5);

 

// Destructor of map will be called - adding </svg>

// Destructor of stream will be called, closing the file

 

This code crashes with an obscure (for me) exception deep in the callstack:

 

Unhandled exception at 0x000007FEFD62940D in POWERPNT.EXE: Microsoft C++ exception: boost::numeric::negative_overflow at memory location 0x00000000001E9D60.

(For the call stack, see the attached txt file.)

 

Should this be filed as a (separate) issue in boost trac?

 


For me it does not crash but the resulting svg is not OK. Yes, please file this too. I know the cause but it is good to have it filed such that we can work on it in a structured way.

Thanks, Barend