|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51972 - in sandbox-branches/andreo/guigl: boost/guigl boost/guigl/view libs/guigl/build/vc8ide libs/guigl/example
From: andreytorba_at_[hidden]
Date: 2009-03-25 13:41:59
Author: andreo
Date: 2009-03-25 13:41:57 EDT (Wed, 25 Mar 2009)
New Revision: 51972
URL: http://svn.boost.org/trac/boost/changeset/51972
Log:
added example of drawing std::vector as linestring/ring to ggl.cpp
added geometry.cpp
Added:
sandbox-branches/andreo/guigl/libs/guigl/example/geometry.cpp (contents, props changed)
sandbox-branches/andreo/guigl/libs/guigl/example/geometry.hpp (contents, props changed)
Text files modified:
sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp | 28 +++++++++++++++++----
sandbox-branches/andreo/guigl/boost/guigl/view/base.hpp | 6 ++--
sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj | 12 +++++++-
sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile | 17 ++++++++++--
sandbox-branches/andreo/guigl/libs/guigl/example/ggl.cpp | 51 ++++++++++++++++++++++++++++++++++++---
5 files changed, 95 insertions(+), 19 deletions(-)
Modified: sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp (original)
+++ sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp 2009-03-25 13:41:57 EDT (Wed, 25 Mar 2009)
@@ -11,11 +11,28 @@
#include <boost/guigl/gl.hpp>
#include <boost/guigl/types.hpp>
-#include <boost/ggl/geometry/geometry.hpp>
+
+#include <boost/ggl/geometry/geometries/point.hpp>
+#include <boost/ggl/geometry/geometries/box.hpp>
+#include <boost/ggl/geometry/geometries/segment.hpp>
+#include <boost/ggl/geometry/geometries/linestring.hpp>
+#include <boost/ggl/geometry/geometries/linear_ring.hpp>
+#include <boost/ggl/geometry/geometries/polygon.hpp>
+#include <boost/ggl/geometry/geometries/nsphere.hpp>
+
+#include <boost/ggl/geometry/core/concepts/point_concept.hpp>
+#include <boost/ggl/geometry/core/concepts/segment_concept.hpp>
+#include <boost/ggl/geometry/core/concepts/box_concept.hpp>
+#include <boost/ggl/geometry/core/concepts/linestring_concept.hpp>
+#include <boost/ggl/geometry/core/concepts/ring_concept.hpp>
+#include <boost/ggl/geometry/core/concepts/polygon_concept.hpp>
+#include <boost/ggl/geometry/core/concepts/nsphere_concept.hpp>
+
+#include <boost/ggl/geometry/core/cs.hpp>
#include <boost/ggl/geometry/geometries/register/register_point.hpp>
#include <boost/static_assert.hpp>
-// i don't know why but GEOMETRY_REGISTER_POINT_2D needs type to be without '::'
+// GEOMETRY_REGISTER_POINT_2D needs type without '::'
typedef boost::guigl::position_type boost__guigl__position_type;
GEOMETRY_REGISTER_POINT_2D( boost__guigl__position_type, double, geometry::cs::cartesian, operator[](0), operator[](1) );
@@ -331,9 +348,11 @@
(void))
vertex(G const& g)
{
+ ggl::vertex(geometry::exterior_ring(g));
std::for_each(
- boost::begin(exterior_ring(g)), boost::end(exterior_ring(g)),
+ boost::begin(geometry::interior_rings(g)),
+ boost::end(geometry::interior_rings(g)),
vertex_drawer());
}
@@ -342,9 +361,6 @@
(void))
draw(G const& g)
{
- //glBegin(GL_POLYGON);
- //vertex(g);
- //glEnd();
}
};
Modified: sandbox-branches/andreo/guigl/boost/guigl/view/base.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/boost/guigl/view/base.hpp (original)
+++ sandbox-branches/andreo/guigl/boost/guigl/view/base.hpp 2009-03-25 13:41:57 EDT (Wed, 25 Mar 2009)
@@ -59,9 +59,9 @@
template<class PositionTag>
position_type point() const;
-#define BOOST_GUIGL_SPECIAL_POINT_IMPL(point_tag_, val1_, val2_) \
- template<> \
- inline position_type point<point_tag_>() const \
+#define BOOST_GUIGL_SPECIAL_POINT_IMPL(point_tag_, val1_, val2_) \
+ template<> \
+ inline position_type point<point_tag_>() const \
{ return position_type(val1_, val2_); }
BOOST_GUIGL_SPECIAL_POINT_IMPL(LT, 0., 0.);
Modified: sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj (original)
+++ sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj 2009-03-25 13:41:57 EDT (Wed, 25 Mar 2009)
@@ -27,7 +27,7 @@
CleanCommandLine="bjam --v2 --clean ../../$(ProjectName) $(ConfigurationName)"
Output=""
PreprocessorDefinitions=""
- IncludeSearchPath=""
+ IncludeSearchPath="D:\Libraries\ggl\boost\ggl;D:\Libraries\ggl"
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
@@ -47,7 +47,7 @@
CleanCommandLine="bjam --v2 --clean ../../$(ProjectName) $(ConfigurationName)"
Output=""
PreprocessorDefinitions=""
- IncludeSearchPath=""
+ IncludeSearchPath="D:\Libraries\ggl\boost\ggl;D:\Libraries\ggl"
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
@@ -63,6 +63,14 @@
>
</File>
<File
+ RelativePath="..\..\example\geometry.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\example\geometry.hpp"
+ >
+ </File>
+ <File
RelativePath="..\..\example\ggl.cpp"
>
</File>
Modified: sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile (original)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile 2009-03-25 13:41:57 EDT (Wed, 25 Mar 2009)
@@ -28,10 +28,21 @@
exe overlapping_example : overlapping_example.cpp ;
exe sexy_button : sexy_button.cpp ;
exe ggl : ggl.cpp ;
+exe geometry : geometry.cpp ;
install window_example_stage
- : window_example custom_example window_only_example overlapping_example sexy_button ggl
- : <install-dependencies>on <install-type>EXE
- <install-type>LIB <location>$(TOP)/bin/stage/window_example
+ :
+ window_example
+ custom_example
+ window_only_example
+ overlapping_example
+ sexy_button
+ ggl
+ geometry
+ :
+ <install-dependencies>on
+ <install-type>EXE
+ <install-type>LIB
+ <location>$(TOP)/bin/stage/window_example
;
\ No newline at end of file
Added: sandbox-branches/andreo/guigl/libs/guigl/example/geometry.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/geometry.cpp 2009-03-25 13:41:57 EDT (Wed, 25 Mar 2009)
@@ -0,0 +1,59 @@
+///*=================================---------------------------------------------
+//Copyright 2009 Andrey Torba
+//
+//Distributed under 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)
+//-----------------------------------------------===============================*/
+//#include "geometry.hpp"
+//
+//#include <boost/guigl/application.hpp>
+//#include <boost/guigl/window.hpp>
+//#include <boost/guigl/view/positioned.hpp>
+//#include <boost/guigl/view/impl/positioned.hpp>
+//
+//#include <boost/guigl/ggl.hpp>
+//#include <boost/guigl/gl.hpp>
+//
+//#include <geometry/geometries/geometries.hpp>
+//#include <geometry/geometry.hpp>
+//
+//using namespace boost::guigl;
+//
+//typedef view::positioned<> my_widget_base_type;
+//class my_widget : public my_widget_base_type
+// {
+// public:
+// typedef my_widget_base_type base_type;
+//
+// template<typename ArgumentPack>
+// my_widget(const ArgumentPack &args)
+// : base_type(args)
+// {}
+//
+// void draw_prologue()
+// {
+// base_type::draw_prologue();
+//
+// geometry::polygon_2d ;
+// }
+//
+// BOOST_GUIGL_WIDGET_DRAW_IMPL(my_widget);
+// };
+//
+int main()
+ {
+// window wnd((
+// _label = "geometry example",
+// _size = size_type(500, 500),
+// _background = white()
+// ));
+//
+// wnd << new my_widget((
+// _size = size_type(300, 300),
+// _position = position_type(100, 100)
+// ));
+//
+// application::run();
+// return 0;
+ }
Added: sandbox-branches/andreo/guigl/libs/guigl/example/geometry.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/geometry.hpp 2009-03-25 13:41:57 EDT (Wed, 25 Mar 2009)
@@ -0,0 +1,6 @@
+#ifndef BOOST_GUIGL_EXAMPLE_GEOMETRY_HPP
+#define BOOST_GUIGL_EXAMPLE_GEOMETRY_HPP
+
+
+
+#endif
Modified: sandbox-branches/andreo/guigl/libs/guigl/example/ggl.cpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/ggl.cpp (original)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/ggl.cpp 2009-03-25 13:41:57 EDT (Wed, 25 Mar 2009)
@@ -14,6 +14,18 @@
#include <boost/guigl/ggl.hpp>
#include <boost/guigl/gl.hpp>
+#include <boost/assign/std.hpp>
+
+#include <geometry/geometries/geometries.hpp>
+
+namespace geometry { namespace traits{
+ template<class T>
+ struct point_type<std::vector<T> >
+ {
+ typedef T type;
+ };
+ }}
+
using namespace boost::guigl;
typedef view::positioned<> my_widget_base_type;
@@ -30,14 +42,28 @@
void draw_prologue()
{
base_type::draw_prologue();
+ using namespace boost::assign;
+ geometry::linear_ring<position_type> r;
+ r.push_back(point<LT>());
+ r.push_back(point<RB>());
+ r.push_back(point<RT>());
+ r.push_back(point<LB>());
+
+ // linear_ring
+ gl::color(yellow());
+ glLineWidth(7);
+ ggl::draw(r);
+
+ // box
gl::color(blue());
glLineWidth(1);
- ggl::draw(segment<VL>());
- ggl::draw(segment<HT>());
- ggl::draw(segment<VR>());
- ggl::draw(segment<HB>());
+ geometry::box<position_type> b(
+ point<LT>(),
+ point<RB>());
+ ggl::draw(b);
+ // segment
gl::color(green(0.5));
glLineWidth(2);
ggl::draw(segment<HC>());
@@ -48,6 +74,21 @@
ggl::draw(segment<D1>());
ggl::draw(segment<D2>());
+ // std::vector as a ring
+ gl::color(black());
+ std::vector<position_type> v;
+ v +=
+ point<LC>(),
+ point<CT>(),
+ point<RC>(),
+ point<CB>();
+ ggl::draw<geometry::ring_tag>(v);
+
+ // std::vector as a linestring
+ glLineWidth(0.5);
+ gl::color(white());
+ ggl::draw<geometry::linestring_tag>(v);
+
}
BOOST_GUIGL_WIDGET_DRAW_IMPL(my_widget);
@@ -56,7 +97,7 @@
int main()
{
window wnd((
- _label = "custom example",
+ _label = "GGL example",
_size = size_type(500, 500),
_background = white()
));
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