Boost logo

Geometry :

Subject: [geometry] Problems with svg mapper
From: Volker Schöch (vschoech_at_[hidden])
Date: 2014-10-14 13:09:13

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 ...
... I find the following oddity: Simply change the following line

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


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?

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

// Draw the geometries on the SVG map, using a specific SVG style, "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?


Volker Schöch | vschoech_at_[hidden]<mailto:vschoech_at_[hidden]>
Senior Software Engineer
We are looking for C++ Developers:
think-cell Software GmbH>
Chausseestr. 8/E        phone / fax     +49 30 666473-10 / -19
10115 Berlin, Germany   US phone / fax  +1 800 891 8091 / +1 212 504 3039
Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id DE813474306
Directors: Dr. Markus Hannebauer, Dr. Arno Schödl

Geometry list run by mateusz at