|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68679 - trunk/libs/geometry/doc/src/examples/core
From: barend.gehrels_at_[hidden]
Date: 2011-02-06 16:00:23
Author: barendgehrels
Date: 2011-02-06 16:00:10 EST (Sun, 06 Feb 2011)
New Revision: 68679
URL: http://svn.boost.org/trac/boost/changeset/68679
Log:
Added set/get examples
Added:
trunk/libs/geometry/doc/src/examples/core/
trunk/libs/geometry/doc/src/examples/core/Jamfile.v2 (contents, props changed)
trunk/libs/geometry/doc/src/examples/core/get_box.cpp (contents, props changed)
trunk/libs/geometry/doc/src/examples/core/get_point.cpp (contents, props changed)
trunk/libs/geometry/doc/src/examples/core/set_box.cpp (contents, props changed)
trunk/libs/geometry/doc/src/examples/core/set_point.cpp (contents, props changed)
Added: trunk/libs/geometry/doc/src/examples/core/Jamfile.v2
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/core/Jamfile.v2 2011-02-06 16:00:10 EST (Sun, 06 Feb 2011)
@@ -0,0 +1,17 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# Copyright Barend Gehrels, Geodan Holding B.V. Amsterdam, the Netherlands.
+# Copyright (c) 2009 Mateusz Loskot <mateusz_at_[hidden]>
+# 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)
+
+
+project boost-geometry-doc-example-core
+ : # requirements
+ ;
+
+exe get_point : get_point.cpp ;
+exe get_box : get_box.cpp ;
+exe set_point : set_point.cpp ;
+exe set_box : set_box.cpp ;
Added: trunk/libs/geometry/doc/src/examples/core/get_box.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/core/get_box.cpp 2011-02-06 16:00:10 EST (Sun, 06 Feb 2011)
@@ -0,0 +1,44 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, Geodan, Amsterdam, the Netherlands
+// 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)
+//
+// Quickbook Example
+
+//[get_box
+//` Set the coordinate of a box
+
+#include <iostream>
+#include <boost/geometry/geometry.hpp>
+
+namespace bg = boost::geometry;
+
+int main()
+{
+ bg::model::box<bg::model::d2::point_xy<double> > box;
+
+ bg::assign(box, 1, 3, 5, 6);
+
+ std::cout << "Box:"
+ << " " << bg::get<bg::min_corner, 0>(box)
+ << " " << bg::get<bg::min_corner, 1>(box)
+ << " " << bg::get<bg::max_corner, 0>(box)
+ << " " << bg::get<bg::max_corner, 1>(box)
+ << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[get_box_output
+/*`
+Output:
+[pre
+Box: 1 3 5 6
+]
+*/
+//]
Added: trunk/libs/geometry/doc/src/examples/core/get_point.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/core/get_point.cpp 2011-02-06 16:00:10 EST (Sun, 06 Feb 2011)
@@ -0,0 +1,40 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, Geodan, Amsterdam, the Netherlands
+// 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)
+//
+// Quickbook Example
+
+//[get_point
+//` Get the coordinate of a point
+
+#include <iostream>
+#include <boost/geometry/geometry.hpp>
+
+namespace bg = boost::geometry;
+
+int main()
+{
+ bg::model::d2::point_xy<double> point(1, 2);
+
+ double x = bg::get<0>(point);
+ double y = bg::get<1>(point);
+
+ std::cout << "x=" << x << " y=" << y << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[get_point_output
+/*`
+Output:
+[pre
+x=1 y=2
+]
+*/
+//]
Added: trunk/libs/geometry/doc/src/examples/core/set_box.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/core/set_box.cpp 2011-02-06 16:00:10 EST (Sun, 06 Feb 2011)
@@ -0,0 +1,42 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, Geodan, Amsterdam, the Netherlands
+// 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)
+//
+// Quickbook Example
+
+//[set_box
+//` Set the coordinate of a box
+
+#include <iostream>
+#include <boost/geometry/geometry.hpp>
+
+namespace bg = boost::geometry;
+
+int main()
+{
+ bg::model::box<bg::model::d2::point_xy<double> > box;
+
+ bg::set<bg::min_corner, 0>(box, 0);
+ bg::set<bg::min_corner, 1>(box, 2);
+ bg::set<bg::max_corner, 0>(box, 4);
+ bg::set<bg::max_corner, 1>(box, 5);
+
+ std::cout << "Extent: " << bg::dsv(box) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[set_box_output
+/*`
+Output:
+[pre
+Extent: ((0, 2), (4, 5))
+]
+*/
+//]
Added: trunk/libs/geometry/doc/src/examples/core/set_point.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/core/set_point.cpp 2011-02-06 16:00:10 EST (Sun, 06 Feb 2011)
@@ -0,0 +1,40 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, Geodan, Amsterdam, the Netherlands
+// 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)
+//
+// Quickbook Example
+
+//[set_point
+//` Set the coordinate of a point
+
+#include <iostream>
+#include <boost/geometry/geometry.hpp>
+
+namespace bg = boost::geometry;
+
+int main()
+{
+ bg::model::d2::point_xy<double> point;
+
+ bg::set<0>(point, 1);
+ bg::set<1>(point, 2);
+
+ std::cout << "Location: " << bg::dsv(point) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[set_point_output
+/*`
+Output:
+[pre
+Location: (1, 2)
+]
+*/
+//]
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