[geos-commits] r2177 - in branches/3.0: capi source/headers/geos
source/io
svn_geos at osgeo.org
svn_geos at osgeo.org
Fri Aug 29 10:57:50 EDT 2008
Author: sgillies
Date: 2008-08-29 10:57:50 -0400 (Fri, 29 Aug 2008)
New Revision: 2177
Modified:
branches/3.0/capi/geos_c.cpp
branches/3.0/source/headers/geos/io.h
branches/3.0/source/io/Makefile.am
branches/3.0/source/io/WKTWriter.cpp
Log:
Added CLocalizer class that switches to C locale and restores to the outer context's locale when deleted (#201)
Modified: branches/3.0/capi/geos_c.cpp
===================================================================
--- branches/3.0/capi/geos_c.cpp 2008-08-29 00:30:47 UTC (rev 2176)
+++ branches/3.0/capi/geos_c.cpp 2008-08-29 14:57:50 UTC (rev 2177)
@@ -32,6 +32,7 @@
#include <geos/io/WKBReader.h>
#include <geos/io/WKTWriter.h>
#include <geos/io/WKBWriter.h>
+#include <geos/io/CLocalizer.h>
#include <geos/simplify/DouglasPeuckerSimplifier.h>
#include <geos/simplify/TopologyPreservingSimplifier.h>
#include <geos/operation/valid/IsValidOp.h>
@@ -83,6 +84,7 @@
using geos::io::WKTWriter;
using geos::io::WKBReader;
using geos::io::WKBWriter;
+using geos::io::CLocalizer;
using geos::operation::overlay::OverlayOp;
using geos::operation::overlay::overlayOp;
@@ -501,7 +503,7 @@
Geometry *
GEOSGeomFromWKT(const char *wkt)
{
- using geos::io::WKTReader;
+ CLocalizer clocale;
try
{
WKTReader r(geomFactory);
@@ -525,6 +527,7 @@
char *
GEOSGeomToWKT(const Geometry *g1)
{
+ CLocalizer clocale;
try
{
std::string s = g1->toString();
@@ -1914,6 +1917,7 @@
Geometry*
GEOSWKTReader_read(WKTReader *reader, const char *wkt)
{
+ CLocalizer clocale;
try
{
const std::string wktstring = std::string(wkt);
@@ -1977,6 +1981,7 @@
char*
GEOSWKTWriter_write(WKTWriter *writer, const Geometry *geom)
{
+ CLocalizer clocale;
try
{
std::string s = writer->write(geom);
Modified: branches/3.0/source/headers/geos/io.h
===================================================================
--- branches/3.0/source/headers/geos/io.h 2008-08-29 00:30:47 UTC (rev 2176)
+++ branches/3.0/source/headers/geos/io.h 2008-08-29 14:57:50 UTC (rev 2177)
@@ -55,6 +55,7 @@
#include <geos/io/WKBWriter.h>
#include <geos/io/WKTReader.h>
#include <geos/io/WKTWriter.h>
+#include <geos/io/CLocalizer.h>
//#include <geos/io/Writer.h>
#ifdef __GNUC__
Modified: branches/3.0/source/io/Makefile.am
===================================================================
--- branches/3.0/source/io/Makefile.am 2008-08-29 00:30:47 UTC (rev 2176)
+++ branches/3.0/source/io/Makefile.am 2008-08-29 14:57:50 UTC (rev 2177)
@@ -14,7 +14,8 @@
WKBReader.cpp \
WKBWriter.cpp \
Writer.cpp \
- Unload.cpp
+ Unload.cpp \
+ CLocalizer.cpp
libio_la_LIBADD =
Modified: branches/3.0/source/io/WKTWriter.cpp
===================================================================
--- branches/3.0/source/io/WKTWriter.cpp 2008-08-29 00:30:47 UTC (rev 2176)
+++ branches/3.0/source/io/WKTWriter.cpp 2008-08-29 14:57:50 UTC (rev 2177)
@@ -54,6 +54,7 @@
WKTWriter::toLineString(const CoordinateSequence& seq)
{
stringstream buf("LINESTRING ", ios_base::in|ios_base::out);
+ buf.imbue(std::locale("C"));
unsigned int npts = seq.getSize();
if ( npts == 0 )
{
@@ -81,6 +82,7 @@
WKTWriter::toLineString(const Coordinate& p0, const Coordinate& p1)
{
stringstream ret("LINESTRING (", ios_base::in|ios_base::out);
+ ret.imbue(std::locale("C"));
ret << p0.x << " " << p0.y;
#if PRINT_Z
ret << " " << p0.z;
@@ -98,6 +100,7 @@
WKTWriter::toPoint(const Coordinate& p0)
{
stringstream ret("POINT (", ios_base::in|ios_base::out);
+ ret.imbue(std::locale("C"));
#if PRINT_Z
ret << p0.x << " " << p0.y << " " << p0.z << " )";
#else
More information about the geos-commits
mailing list