Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77103 - in trunk: boost/geometry/multi/io/wkt libs/geometry/doc libs/geometry/test/multi/io/wkt
From: barend.gehrels_at_[hidden]
Date: 2012-02-24 05:25:26


Author: barendgehrels
Date: 2012-02-24 05:25:24 EST (Fri, 24 Feb 2012)
New Revision: 77103
URL: http://svn.boost.org/trac/boost/changeset/77103

Log:
Boost.Geometry applied patch from ticket https://svn.boost.org/trac/boost/ticket/6585
Text files modified:
   trunk/boost/geometry/multi/io/wkt/read.hpp | 66 ++++++++++++++++++++++++++++++++++++++-
   trunk/libs/geometry/doc/release_notes.qbk | 19 +++++++++++
   trunk/libs/geometry/test/multi/io/wkt/wkt.cpp | 21 ++++++++++++
   trunk/libs/geometry/test/multi/io/wkt/wkt.vcproj | 8 ++--
   4 files changed, 108 insertions(+), 6 deletions(-)

Modified: trunk/boost/geometry/multi/io/wkt/read.hpp
==============================================================================
--- trunk/boost/geometry/multi/io/wkt/read.hpp (original)
+++ trunk/boost/geometry/multi/io/wkt/read.hpp 2012-02-24 05:25:24 EST (Fri, 24 Feb 2012)
@@ -58,6 +58,69 @@
 
             handle_close_parenthesis(it, tokens.end(), wkt);
         }
+
+ check_end(it, tokens.end(), wkt);
+ }
+};
+
+template <typename P>
+struct noparenthesis_point_parser
+{
+ static inline void apply(tokenizer::iterator& it, tokenizer::iterator end,
+ std::string const& wkt, P& point)
+ {
+ parsing_assigner<P, 0, dimension<P>::value>::apply(it, end, point, wkt);
+ }
+};
+
+template <typename MultiGeometry, typename PrefixPolicy>
+struct multi_point_parser
+{
+ static inline void apply(std::string const& wkt, MultiGeometry& geometry)
+ {
+ traits::clear<MultiGeometry>::apply(geometry);
+
+ tokenizer tokens(wkt, boost::char_separator<char>(" ", ",()"));
+ tokenizer::iterator it;
+
+ if (initialize<MultiGeometry>(tokens, PrefixPolicy::apply(), wkt, it))
+ {
+ handle_open_parenthesis(it, tokens.end(), wkt);
+
+ // If first point definition starts with "(" then parse points as (x y)
+ // otherwise as "x y"
+ bool using_brackets = (it != tokens.end() && *it == "(");
+
+ while(it != tokens.end() && *it != ")")
+ {
+ traits::resize<MultiGeometry>::apply(geometry, boost::size(geometry) + 1);
+
+ if (using_brackets)
+ {
+ point_parser
+ <
+ typename boost::range_value<MultiGeometry>::type
+ >::apply(it, tokens.end(), wkt, geometry.back());
+ }
+ else
+ {
+ noparenthesis_point_parser
+ <
+ typename boost::range_value<MultiGeometry>::type
+ >::apply(it, tokens.end(), wkt, geometry.back());
+ }
+
+ if (it != tokens.end() && *it == ",")
+ {
+ // Skip "," after point is parsed
+ ++it;
+ }
+ }
+
+ handle_close_parenthesis(it, tokens.end(), wkt);
+ }
+
+ check_end(it, tokens.end(), wkt);
     }
 };
 
@@ -69,10 +132,9 @@
 
 template <typename MultiGeometry>
 struct read_wkt<multi_point_tag, MultiGeometry>
- : detail::wkt::multi_parser
+ : detail::wkt::multi_point_parser
             <
                 MultiGeometry,
- detail::wkt::point_parser,
                 detail::wkt::prefix_multipoint
>
 {};

Modified: trunk/libs/geometry/doc/release_notes.qbk
==============================================================================
--- trunk/libs/geometry/doc/release_notes.qbk (original)
+++ trunk/libs/geometry/doc/release_notes.qbk 2012-02-24 05:25:24 EST (Fri, 24 Feb 2012)
@@ -13,6 +13,25 @@
 [section:release_notes Release Notes]
 
 [/=================]
+[heading Boost 1.50]
+[/=================]
+
+[*Breaking changes]
+
+[*Bugfixes]
+
+[*Solved tickets]
+
+* [@https://svn.boost.org/trac/boost/ticket/6585 6585] patch for alternative syntax multipoint, applied
+
+[*Additional functionality]
+
+[*Documentation]
+
+[*Internal changes]
+
+
+[/=================]
 [heading Boost 1.49]
 [/=================]
 

Modified: trunk/libs/geometry/test/multi/io/wkt/wkt.cpp
==============================================================================
--- trunk/libs/geometry/test/multi/io/wkt/wkt.cpp (original)
+++ trunk/libs/geometry/test/multi/io/wkt/wkt.cpp 2012-02-24 05:25:24 EST (Fri, 24 Feb 2012)
@@ -55,9 +55,30 @@
     test_wkt<bg::model::multi_linestring<bg::model::linestring<P> > >("multilinestring((1 1,2 2,3 3),(4 4,5 5,6 6))", 6, 4 * sqrt(2.0));
     test_wkt<bg::model::multi_polygon<bg::model::polygon<P> > >("multipolygon(((0 0,0 2,2 2,2 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((0 0,0 4,4 4,4 0,0 0)))", 15, 0, 21, 28);
 
+ // Support for the official alternative syntax for multipoint
+ // (provided by Aleksey Tulinov):
+ test_relaxed_wkt<bg::model::multi_point<P> >("multipoint(1 2,3 4)", "multipoint((1 2),(3 4))");
+
     test_wrong_wkt<bg::model::multi_polygon<bg::model::polygon<P> > >(
         "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0),(1 1,1 2,2 2,2 1,1 1)),(0 0,0 4,4 4,4 0,0 0)))",
         "expected '('");
+
+ test_wrong_wkt<bg::model::multi_linestring<bg::model::linestring<P> > >(
+ "MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10)), (0 0, 1 1)",
+ "too much tokens at ','");
+
+ test_wrong_wkt<bg::model::multi_point<P> >(
+ "MULTIPOINT((8 9), 10 11)",
+ "expected '(' at '10'");
+ test_wrong_wkt<bg::model::multi_point<P> >(
+ "MULTIPOINT(12 13, (14 15))",
+ "bad lexical cast: source type value could not be interpreted as target at '(' in 'multipoint(12 13, (14 15))'");
+ test_wrong_wkt<bg::model::multi_point<P> >(
+ "MULTIPOINT((16 17), (18 19)",
+ "expected ')' in 'multipoint((16 17), (18 19)'");
+ test_wrong_wkt<bg::model::multi_point<P> >(
+ "MULTIPOINT(16 17), (18 19)",
+ "too much tokens at ',' in 'multipoint(16 17), (18 19)'");
 }
 
 /*

Modified: trunk/libs/geometry/test/multi/io/wkt/wkt.vcproj
==============================================================================
--- trunk/libs/geometry/test/multi/io/wkt/wkt.vcproj (original)
+++ trunk/libs/geometry/test/multi/io/wkt/wkt.vcproj 2012-02-24 05:25:24 EST (Fri, 24 Feb 2012)
@@ -20,7 +20,7 @@
                         OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                         IntermediateDirectory="$(ConfigurationName)\wkt"
                         ConfigurationType="1"
- InheritedPropertySheets="..\..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
                         CharacterSet="1"
>
                         <Tool
@@ -41,7 +41,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
- AdditionalIncludeDirectories="../../../../../../..;../../../.."
+ AdditionalIncludeDirectories="../../../../../..;../../.."
                                 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
                                 ExceptionHandling="2"
                                 RuntimeLibrary="1"
@@ -93,7 +93,7 @@
                         OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                         IntermediateDirectory="$(ConfigurationName)\wkt"
                         ConfigurationType="1"
- InheritedPropertySheets="..\..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
                         CharacterSet="1"
                         WholeProgramOptimization="1"
>
@@ -114,7 +114,7 @@
                         />
                         <Tool
                                 Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../../../..;../../../.."
+ AdditionalIncludeDirectories="../../../../../..;../../.."
                                 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
                                 ExceptionHandling="2"
                                 UsePrecompiledHeader="0"


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk