Boost logo

Geometry :

Subject: [ggl] read_wkt and write_wkt
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-04-27 10:23:41


Hi,

Some things about wkt:

The read_wkt function currently returns true/false if it is successfully
or not, while inside lexical_cast<> is used which might throw an
exception. I would like to change this by returning void and always
throw an exception if it is not successful. Is this OK for everyone?

This exception is already defined as struct read_wkt_exception : public
geometry_exception, we need to move that geometry_exception to core. Is
that OK ?

Boost defines an "exception/exception.hpp" which is not used by boost
libraries. At least not by e.g. spirit. So I derive from std::exception,
like most boost libraries do, is that OK?

Finally the wkt is streamed like one of:
(G geometry where G is a template parameter or type)
1) cout << wkt<G>(geometry) << endl // needs <G>
2) cout << make_wkt(geometry) << endl // same but does not need <G>
3) cout << geometry << endl // only if stream_wkt.hpp is included

About 2)
The "make_" prefix is normally reserved for object generators. This is
one but actually it is, more strictly, generating an manipulator (which
is an object). Is the "make_" prefix appropriate here? I thought I asked
this earlier but cannot find that mail so probably I didn't.
Alternatively it would be:
1) cout << wkt_manip<G>(geometry) << endl
2) cout << wkt(geometry) << end // because this will be most widely used

About 3)
The last one is prone to errors if geometry is not a geometry or not a
tag. It is not living in namespace ggl to enable the library to stream
custom geometries which are living outside the namespace ggl. So it is
not in any namespace. Bruno recently mailed me that this behaviour will
never be accepted by Boost so we have to re-add the namespace there, or
remove it at all.

This is also for the upcoming WKB, and myself am writing VEShapes for a
project (Virtual Earth shapes), so we can harmonize it.

Regards, Barend


Geometry list run by mateusz at loskot.net