-
Notifications
You must be signed in to change notification settings - Fork 228
Symmetrizing read/write wkt #670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
410b0c3
abe1339
19855ae
aa5b1b5
6c10e7a
40071e4
b5cb2a4
8c48b58
d9c8ff3
267097c
dc6ab7e
29975b2
7ef8419
cfd58ad
1fd9b22
44c342c
72a4788
2051e75
5abaed5
fa4b3dd
36cf42f
89c58a6
322cd9f
6bf00d4
6b67192
2d096e5
d4e9f6e
3b08f8c
ea31a91
1d32d87
0839e31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[/============================================================================ | ||
Boost.Geometry (aka GGL, Generic Geometry Library) | ||
|
||
Copyright (c) 2020 Baidyanath Kundu, Haldia, India. | ||
|
||
Use, modification and distribution is subject to the Boost Software License, | ||
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||
http://www.boost.org/LICENSE_1_0.txt) | ||
=============================================================================/] | ||
|
||
[heading Conformance] | ||
Other libraries refer to this functionality as [*ST_GeomFromText] or [*STGeomFromText]. | ||
That is not done here because Boost.Geometry support more text formats. The name GeomFromText | ||
is reserved for future usage, which will then have an indication of the used text format. | ||
|
||
|
||
[heading Example] | ||
[from_wkt] | ||
|
||
[heading See also] | ||
* [link geometry.reference.io.wkt.wkt WKT streaming manipulator] | ||
* [link geometry.reference.io.wkt.read_wkt Read WKT] | ||
* [link geometry.reference.io.wkt.to_wkt To WKT] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[/============================================================================ | ||
Boost.Geometry (aka GGL, Generic Geometry Library) | ||
|
||
Copyright (c) 2009-2014 Barend Gehrels, Amsterdam, the Netherlands. | ||
sudo-panda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Copyright (c) 2020 Baidyanath Kundu, Haldia, India. | ||
|
||
Use, modification and distribution is subject to the Boost Software License, | ||
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||
http://www.boost.org/LICENSE_1_0.txt) | ||
=============================================================================/] | ||
|
||
[def __this_function__ to_wkt] | ||
|
||
[heading_conformance_ogc __this_function__..AsText] | ||
[note __this_function__ is not named "AsText" or "as_text" because Boost.Geometry | ||
also supports other textformats (svg, dsv)] | ||
|
||
[heading Example] | ||
[to_wkt] | ||
[to_wkt_output] | ||
|
||
[heading See also] | ||
* [link geometry.reference.io.wkt.read_wkt Read WKT] | ||
* [link geometry.reference.io.wkt.from_wkt From WKT] | ||
* [link geometry.reference.io.wkt.wkt WKT streaming manipulator] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Boost.Geometry (aka GGL, Generic Geometry Library) | ||
// QuickBook Example | ||
|
||
// Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands. | ||
sudo-panda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Copyright (c) 2020 Baidyanath Kundu, Haldia, India. | ||
|
||
// Use, modification and distribution is subject to the Boost Software License, | ||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
//[from_wkt | ||
//` Shows the usage of from_wkt | ||
|
||
#include <boost/geometry.hpp> | ||
#include <boost/geometry/geometries/point_xy.hpp> | ||
#include <boost/geometry/geometries/linestring.hpp> | ||
#include <boost/geometry/geometries/polygon.hpp> | ||
|
||
int main() | ||
{ | ||
using point_type = boost::geometry::model::d2::point_xy<double>; | ||
using box_type = boost::geometry::model::box<point_type>; | ||
using segment_type = boost::geometry::model::segment<point_type>; | ||
using polygon_type = boost::geometry::model::polygon<point_type>; | ||
using linestring_type = boost::geometry::model::linestring<point_type>; | ||
|
||
auto const a = boost::geometry::from_wkt<point_type>("POINT(1 2)"); | ||
auto const d = boost::geometry::from_wkt<box_type>("BOX(0 0,3 3)"); | ||
auto const e = boost::geometry::from_wkt<segment_type>("SEGMENT(1 0,3 4)"); | ||
auto const c = boost::geometry::from_wkt<polygon_type>("POLYGON((0 0,0 7,4 2,2 0,0 0))"); | ||
auto const b = boost::geometry::from_wkt<linestring_type>("LINESTRING(0 0,2 2,3 1)"); | ||
|
||
return 0; | ||
} | ||
|
||
//] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Boost.Geometry (aka GGL, Generic Geometry Library) | ||
// QuickBook Example | ||
|
||
// Copyright (c) 2020 Baidyanath Kundu, Haldia, India. | ||
|
||
// Use, modification and distribution is subject to the Boost Software License, | ||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
//[to_wkt | ||
//` Shows the usage of to_wkt | ||
|
||
#include <iostream> | ||
|
||
#include <boost/geometry.hpp> | ||
#include <boost/geometry/geometries/point_xy.hpp> | ||
#include <boost/geometry/geometries/polygon.hpp> | ||
|
||
int main() | ||
{ | ||
namespace geom = boost::geometry; | ||
typedef geom::model::d2::point_xy<double> point_type; | ||
|
||
point_type point = geom::make<point_type>(3, 2); | ||
geom::model::polygon<point_type> polygon; | ||
geom::append(geom::exterior_ring(polygon), geom::make<point_type>(0, 0)); | ||
geom::append(geom::exterior_ring(polygon), geom::make<point_type>(0, 4)); | ||
geom::append(geom::exterior_ring(polygon), geom::make<point_type>(4, 4)); | ||
geom::append(geom::exterior_ring(polygon), geom::make<point_type>(4, 0)); | ||
geom::append(geom::exterior_ring(polygon), geom::make<point_type>(0, 0)); | ||
|
||
std::cout << boost::geometry::to_wkt(point) << std::endl; | ||
std::cout << boost::geometry::to_wkt(polygon) << std::endl; | ||
|
||
point_type point_frac = geom::make<point_type>(3.141592654, 27.18281828); | ||
geom::model::polygon<point_type> polygon_frac; | ||
geom::append(geom::exterior_ring(polygon_frac), geom::make<point_type>(0.00000, 0.00000)); | ||
geom::append(geom::exterior_ring(polygon_frac), geom::make<point_type>(0.00000, 4.00001)); | ||
geom::append(geom::exterior_ring(polygon_frac), geom::make<point_type>(4.00001, 4.00001)); | ||
geom::append(geom::exterior_ring(polygon_frac), geom::make<point_type>(4.00001, 0.00000)); | ||
geom::append(geom::exterior_ring(polygon_frac), geom::make<point_type>(0.00000, 0.00000)); | ||
|
||
std::cout << boost::geometry::to_wkt(point_frac, 3) << std::endl; | ||
std::cout << boost::geometry::to_wkt(polygon_frac, 3) << std::endl; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the efforts of course. But I'm not sure about this example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am waiting for comments from other reviewers before I change anything w.r.t. |
||
return 0; | ||
} | ||
|
||
//] | ||
|
||
|
||
//[to_wkt_output | ||
/*` | ||
Output: | ||
[pre | ||
POINT(3 2) | ||
POLYGON((0 0,0 4,4 4,4 0,0 0)) | ||
POINT(3.14 27.2) | ||
POLYGON((0 0,0 4,4 4,4 0,0 0)) | ||
] | ||
*/ | ||
//] |
Uh oh!
There was an error while loading. Please reload this page.