PageRenderTime 16ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/Src/Dependencies/Boost/libs/geometry/test/domains/gis/io/wkt/multi_wkt.cpp

http://hadesmem.googlecode.com/
C++ | 88 lines | 34 code | 22 blank | 32 comment | 0 complexity | 8e41a6c6c20a2c187b7980fbd6e6e998 MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2// Unit Test
 3
 4// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
 5// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
 6// Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
 7
 8// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
 9// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10
11// Use, modification and distribution is subject to the Boost Software License,
12// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13// http://www.boost.org/LICENSE_1_0.txt)
14
15//#include <iostream>
16#include <sstream>
17#include <string>
18
19#include <boost/algorithm/string.hpp>
20#include <boost/concept/requires.hpp>
21
22#include <boost/test/floating_point_comparison.hpp>
23#include <boost/test/included/test_exec_monitor.hpp>
24
25#include <boost/geometry/geometries/geometries.hpp>
26
27
28#include <boost/geometry/multi/algorithms/area.hpp>
29#include <boost/geometry/multi/algorithms/length.hpp>
30#include <boost/geometry/multi/algorithms/num_points.hpp>
31#include <boost/geometry/multi/algorithms/perimeter.hpp>
32#include <boost/geometry/multi/core/point_type.hpp>
33#include <boost/geometry/multi/core/topological_dimension.hpp>
34#include <boost/geometry/multi/geometries/multi_point.hpp>
35#include <boost/geometry/multi/geometries/multi_linestring.hpp>
36#include <boost/geometry/multi/geometries/multi_polygon.hpp>
37
38#include <boost/geometry/domains/gis/io/wkt/read_wkt_multi.hpp>
39#include <boost/geometry/domains/gis/io/wkt/write_wkt_multi.hpp>
40
41
42template <typename T>
43void test_all();
44
45
46// Include the single test
47#define GEOMETRY_TEST_MULTI
48#include "domains/gis/io/wkt/wkt.cpp"
49
50
51
52template <typename T>
53void test_all()
54{
55    using namespace boost::geometry;
56    typedef bg::model::point<T, 2, bg::cs::cartesian> P;
57
58    test_wkt<bg::model::multi_point<P> >("multipoint((1 2),(3 4))", 2);
59    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));
60    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);
61
62    test_wrong_wkt<bg::model::multi_polygon<bg::model::polygon<P> > >(
63        "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)))",
64        "expected '('");
65}
66
67
68
69/*
70
71... see comments in "wkt.cpp"
72
73union select 13,'# mpoint',npoints(geomfromtext('MULTIPOINT((1 2),(3 4))'))
74union select 14,'length mpoint',length(geomfromtext('MULTIPOINT((1 2),(3 4))'))
75union select 15,'peri mpoint',perimeter(geomfromtext('MULTIPOINT((1 2),(3 4))'))
76union select 16,'area mpoint',area(geomfromtext('MULTIPOINT((1 2),(3 4))'))
77
78union select 17,'# mls',npoints(geomfromtext('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))'))
79union select 18,'length mls',length(geomfromtext('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))'))
80union select 19,'peri mls',perimeter(geomfromtext('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))'))
81union select 20,'area mls',area(geomfromtext('MULTILINESTRING((1 1,2 2,3 3),(4 4,5 5,6 6))'))
82
83union select 21,'# mpoly',npoints(geomfromtext('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)))'))
84union select 22,'length mpoly',length(geomfromtext('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)))'))
85union select 23,'peri mpoly',perimeter(geomfromtext('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)))'))
86union select 24,'area mpoly',area(geomfromtext('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)))'))
87
88*/