$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r52019 - in sandbox-branches/andreo/guigl: boost/guigl libs/guigl/build/vc8ide libs/guigl/example libs/guigl/example/autogeo
From: andreytorba_at_[hidden]
Date: 2009-03-27 12:56:46
Author: andreo
Date: 2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
New Revision: 52019
URL: http://svn.boost.org/trac/boost/changeset/52019
Log:
separate autogeo
Added:
   sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/
   sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/Jamfile   (contents, props changed)
   sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/acceptor.hpp   (contents, props changed)
   sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/geometry.cpp   (contents, props changed)
   sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/geometry.hpp   (contents, props changed)
   sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/graph.hpp   (contents, props changed)
   sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/node_types.hpp   (contents, props changed)
   sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/visitors.hpp   (contents, props changed)
Removed:
   sandbox-branches/andreo/guigl/libs/guigl/example/acceptor.hpp
   sandbox-branches/andreo/guigl/libs/guigl/example/geometry.cpp
   sandbox-branches/andreo/guigl/libs/guigl/example/geometry.hpp
   sandbox-branches/andreo/guigl/libs/guigl/example/graph.hpp
   sandbox-branches/andreo/guigl/libs/guigl/example/node_types.hpp
   sandbox-branches/andreo/guigl/libs/guigl/example/visitors.hpp
Text files modified: 
   sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp                    |     1 -                                       
   sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj |    12 ++++++------                            
   sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/guigl.sln      |     8 +++++++-                                
   sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile             |     4 +---                                    
   4 files changed, 14 insertions(+), 11 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-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -427,7 +427,6 @@
 
         ////////////////////////////////////////////////////////////////////////////////
         // polygon_tag
-        // polygon is not implemented yet
         template<typename G>
         struct object_tag<geometry::polygon_tag, G>
         {
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-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -62,27 +62,27 @@
                         Name="autogeo"
 			>
                         <File
-				RelativePath="..\..\example\acceptor.hpp"
+				RelativePath="..\..\example\autogeo\acceptor.hpp"
 				>
                         </File>
                         <File
-				RelativePath="..\..\example\geometry.cpp"
+				RelativePath="..\..\example\autogeo\geometry.cpp"
 				>
                         </File>
                         <File
-				RelativePath="..\..\example\geometry.hpp"
+				RelativePath="..\..\example\autogeo\geometry.hpp"
 				>
                         </File>
                         <File
-				RelativePath="..\..\example\graph.hpp"
+				RelativePath="..\..\example\autogeo\graph.hpp"
 				>
                         </File>
                         <File
-				RelativePath="..\..\example\node_types.hpp"
+				RelativePath="..\..\example\autogeo\node_types.hpp"
 				>
                         </File>
                         <File
-				RelativePath="..\..\example\visitors.hpp"
+				RelativePath="..\..\example\autogeo\visitors.hpp"
 				>
                         </File>
                 </Filter>
Modified: sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/guigl.sln
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/guigl.sln	(original)
+++ sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/guigl.sln	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -1,5 +1,5 @@
 Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
+# Visual Studio 2005
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build", "build.vcproj", "{96DD7085-0763-49FF-9986-0244D7B43704}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc", "doc.vcproj", "{9D6EDF83-2360-4267-8075-64934F754048}"
@@ -8,6 +8,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{A3977511-76A6-42A1-B6E4-917905E23ABA}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "autogeo", "autogeo.vcproj", "{AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 debug|Win32 = debug|Win32
@@ -30,6 +32,10 @@
                 {A3977511-76A6-42A1-B6E4-917905E23ABA}.debug|Win32.Build.0 = debug|Win32
                 {A3977511-76A6-42A1-B6E4-917905E23ABA}.release|Win32.ActiveCfg = release|Win32
                 {A3977511-76A6-42A1-B6E4-917905E23ABA}.release|Win32.Build.0 = release|Win32
+		{AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}.debug|Win32.ActiveCfg = debug|Win32
+		{AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}.debug|Win32.Build.0 = debug|Win32
+		{AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}.release|Win32.ActiveCfg = release|Win32
+		{AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}.release|Win32.Build.0 = release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE
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-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -28,7 +28,6 @@
 exe overlapping_example : overlapping_example.cpp ;
 exe sexy_button : sexy_button.cpp ;
 exe ggl : ggl.cpp ;
-exe geometry : geometry.cpp ;
 exe polygon : polygon.cpp ;
 
 install window_example_stage
@@ -39,8 +38,7 @@
         overlapping_example
         sexy_button
         ggl
-        geometry
-	polygon
+ 	polygon
     :
         <install-dependencies>on
         <install-type>EXE
Deleted: sandbox-branches/andreo/guigl/libs/guigl/example/acceptor.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/acceptor.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
+++ (empty file)
@@ -1,50 +0,0 @@
-#ifndef BOOST_GUIGL_EXAMPLE_ACCEPTOR_HPP
-#define BOOST_GUIGL_EXAMPLE_ACCEPTOR_HPP
-
-#include <boost/shared_ptr.hpp>
-#include <boost/make_shared.hpp>
-
-class IVisitor;
-
-class IAcceptor
-  {
-  public:
-    virtual ~IAcceptor() {}
-    virtual void accept(int key, IVisitor const& v) = 0;
-  };
-
-template<class T>
-class Acceptor :
-  public IAcceptor,
-  public T
-  {
-  public:
-    explicit Acceptor(T const& obj) : T(obj) {}
-    void accept(int key, IVisitor const& v){
-      T& obj = *this;
-      v.visit(key, obj);
-      }
-
-    //T& get() {return m_obj;}
-    //T const& get() const {return m_obj;}
-
-    typedef typename T::result_type result_type;
-    result_type const& result() const {return T::result;}
-  };
-
-template<class T>
-boost::shared_ptr<Acceptor<T> > make_acceptor(T const& g)
-  {
-  return boost::make_shared<Acceptor<T> >(g);
-  }
-
-struct accept_each
-  {
-  IVisitor const& visitor;
-  accept_each(IVisitor const& v):visitor(v){}
-
-  template<class T>
-  void operator()(T& obj) const {obj.second->accept(obj.first, visitor);}
-  };
-
-#endif
Added: sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/Jamfile
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/Jamfile	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -0,0 +1,25 @@
+#==================================---------------------------------------------
+#   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)
+#----------------------------------------------===============================*/
+
+project boost/guigl/example
+    : requirements
+        <library>$(TOP)/libs/guigl/build//boost_guigl/<use-window-manager>platform_glut
+    ;
+
+exe geometry : geometry.cpp ;
+
+install window_example_stage
+    :
+        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/autogeo/acceptor.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/acceptor.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -0,0 +1,47 @@
+#ifndef BOOST_GUIGL_EXAMPLE_ACCEPTOR_HPP
+#define BOOST_GUIGL_EXAMPLE_ACCEPTOR_HPP
+
+#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
+
+class IVisitor;
+
+class IAcceptor
+  {
+  public:
+    virtual ~IAcceptor() {}
+    virtual void accept(int key, IVisitor const& v) = 0;
+  };
+
+template<class T>
+class Acceptor :
+  public IAcceptor,
+  public T
+  {
+  public:
+    explicit Acceptor(T const& obj) : T(obj) {}
+    void accept(int key, IVisitor const& v){
+      T& obj = *this;
+      v.visit(key, obj);
+      }
+
+    typedef typename T::result_type result_type;
+    result_type const& result() const {return T::result;}
+  };
+
+template<class T>
+boost::shared_ptr<Acceptor<T> > make_acceptor(T const& g)
+  {
+  return boost::make_shared<Acceptor<T> >(g);
+  }
+
+struct accept_each
+  {
+  IVisitor const& visitor;
+  accept_each(IVisitor const& v):visitor(v){}
+
+  template<class T>
+  void operator()(T& obj) const {obj.second->accept(obj.first, visitor);}
+  };
+
+#endif
Added: sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/geometry.cpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/geometry.cpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -0,0 +1,336 @@
+#define NOMINMAX
+
+//*=================================---------------------------------------------
+//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/widget/custom.hpp>
+
+#include <boost/guigl/ggl.hpp>
+#include <boost/guigl/gl.hpp>
+
+#include <geometry/geometries/geometries.hpp>
+#include <geometry/geometry.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
+#include <boost/assign/std.hpp>
+#include <boost/foreach.hpp>
+
+#include <geometry/io/wkt/streamwkt.hpp>
+
+#include <geometry/algorithms/correct.hpp>
+#include <geometry/geometry.hpp>
+#include <geometry/algorithms/centroid.hpp>
+#include "graph.hpp"
+
+using namespace boost::guigl;
+
+class RenderVisitor : public IVisitor
+  {
+  public:
+    void visit(int key, source_point& g) const
+      {
+      gl::color(blue(0.7f));
+      ggl::draw(g.result);
+      }
+
+    void visit(int key, line_from_two_points& g) const
+      {
+      gl::line_width(4);
+      gl::color(red(0.8f));
+      ggl::draw(g.result);
+      }
+
+    void visit(int key, plane_from_three_points& g) const
+      {
+      gl::color(green(0.5f));
+      glBegin(GL_POLYGON);
+      ggl::vertex(g.result.outer());
+      glEnd();
+
+      gl::line_width(2);
+      gl::color(black(0.2));
+      ggl::draw<geometry::ring_tag>(g.result.outer());
+      }
+  };
+
+class RecomputeVisitor : public IVisitor
+  {
+  public:
+    void visit(int key, line_from_two_points& g) const
+      {
+      g.result = line_type(g.pt1, g.pt2);
+      };
+
+    void visit(int key, plane_from_three_points& g) const
+      {
+      using namespace boost::assign;
+      g.result.outer().clear();
+      g.result.outer() += g.pt1, g.pt2, g.pt3;
+      geometry::correct(g.result);
+      };
+  };
+
+struct StreamWriter
+  {
+  template<class T>
+  void operator()(int key, T& g) const
+    {
+    std::cout << g.result << std::endl;
+    }
+
+  template<>
+  void operator()<line_from_two_points>(int key, line_from_two_points& g) const
+    {
+    geometry::linestring<point_type> s;
+    geometry::append(s, g.result.first);
+    geometry::append(s, g.result.second);
+    std::cout << s << std::endl;
+    }
+
+  };
+
+template<class Tag>
+struct StreamByTag
+  {
+  template<class T>
+  void operator()(int key, T& g) const
+    {
+    return ;
+    }
+
+  template<>
+  void operator()<Tag>(int key, Tag& g) const
+    {
+    std::cout << g.result << std::endl;
+    }
+  };
+
+void drawString(const char *str, int x, int y, color_type const& clr, void *font)
+  {
+  glPushAttrib(GL_LIGHTING_BIT | GL_CURRENT_BIT); // lighting and color mask
+  glDisable(GL_LIGHTING);     // need to disable lighting for proper text color
+
+  gl::color(clr);
+  glRasterPos2i(x, y);        // place text position
+
+  // loop all characters in the string
+  while(*str)
+    {
+    glutBitmapCharacter(font, *str);
+    ++str;
+    }
+
+  glEnable(GL_LIGHTING);
+  glPopAttrib();
+  }
+
+struct PrintDescription
+  {
+  std::map<int, std::string> const& descriptions;
+  dependency_graph const& g;
+
+  PrintDescription(
+    std::map<int, std::string> const& descriptions_,
+    dependency_graph const& g_)
+    :descriptions(descriptions_), g(g_) {}
+
+  template<class T>
+  point_type get_center(T const& obj) const
+    {
+    point_type center;
+    geometry::centroid(obj, center);
+    return center;
+    }
+
+  template<>
+  point_type get_center<point_type>(point_type const& obj) const
+    {
+    return obj;
+    }
+
+  template<>
+  point_type get_center<line_type>(line_type const& obj) const
+    {
+    return point_type(
+      (obj.first.x + obj.second.x)/2,
+      (obj.first.y + obj.second.y)/2);
+    }
+
+  //template<class T>
+  //point_type get_center<base_result<line_type> >(T const& obj)
+  //  {
+  //  return geometry::centet
+  //  }
+
+  //template<class T>
+  //point_type get_center<base_result<line_type> >(T const& obj)
+  //  {
+
+  //  }
+
+  template<class T>
+  void operator()(int key, T const& obj) const
+    {
+    boost::optional<int> i = g.get_key(key);
+    if(!i) return ;
+
+    point_type center = get_center(obj.result);
+    drawString(descriptions.find(*i)->second.c_str(), center.x + 10, center.y, grey(0.1f), GLUT_BITMAP_8_BY_13);
+    }
+  };
+
+widget::custom *w;
+
+struct drawer {
+  typedef boost::shared_ptr<IAcceptor> IAcceptorPtr;
+  dependency_graph g;
+  std::map<int, std::string> names;
+
+  void init_geometry_graph();
+
+  enum {
+    middle_notch_point,
+    femoral_head_point,
+    lateral_epi_point,
+    medial_epi_point,
+
+    point1,
+
+    mechanical_axis,
+    epi_axis,
+
+    axial_plane
+    };
+
+  drawer()
+    {
+    using namespace boost::assign;
+
+    typedef GraphVertex<int, point_type> Point;
+    typedef GraphVertex<int, line_type> Line;
+    typedef GraphVertex<int, plane_type> Plane;
+
+
+    insert(names)
+      (middle_notch_point, "middle notch point")
+      (femoral_head_point, "femoral head point")
+      (lateral_epi_point, "lateral epi point")
+      (medial_epi_point, "medial epi point")
+      (point1, "point1")
+      (mechanical_axis, "mechanical axis")
+      (epi_axis, "epi axis")
+      (axial_plane, "axial plane")
+      ;
+
+    init_geometry_graph();
+
+    std::for_each(
+      g.objects.begin(),
+      g.objects.end(),
+      accept_each(RecomputeVisitor()));
+
+    std::for_each(
+      g.objects.begin(),
+      g.objects.end(),
+      accept_each(Visitor<StreamWriter>()));
+    }
+
+  void operator()() const
+    {
+    gl::line_width(0.5);
+    gl::color(black(0.5));
+    ggl::draw(w->segment<HC>());
+    ggl::draw(w->segment<VC>());
+
+    gl::scoped_matrix m;
+    gl::translate(250., 250.);
+
+//    drawString("center", 0, 0, grey(0.1), GLUT_BITMAP_8_BY_13);
+
+    gl::point_size(10);
+    //gl::line_width(2);
+    glEnable(GL_LINE_SMOOTH);
+    glEnable(GL_POINT_SMOOTH);
+
+
+    std::for_each(
+      g.objects.begin(),
+      g.objects.end(),
+      accept_each(RecomputeVisitor()));
+
+    std::for_each(
+      g.objects.begin(),
+      g.objects.end(),
+      accept_each(RenderVisitor()));
+
+    std::for_each(
+      g.objects.begin(),
+      g.objects.end(),
+      accept_each(Visitor<PrintDescription>(PrintDescription(names, g))));
+    }
+  };
+
+int main()
+  {
+  window wnd((
+    _label = "geometry example",
+    _size = size_type(500, 500),
+    _background = white()
+    ));
+
+  w = new widget::custom((
+    _size = size_type(500,500),
+    _position = position_type(0, 0),
+    _draw_prologue = drawer()
+    ));
+
+  wnd << w;
+
+  application::run();
+  return 0;
+  }
+
+
+
+
+void drawer::init_geometry_graph()
+  {
+  using namespace boost::assign;
+
+  typedef GraphVertex<int, point_type> Point;
+  typedef GraphVertex<int, line_type> Line;
+  typedef GraphVertex<int, plane_type> Plane;
+
+  Point
+    pt_mnp = g.make_source_point(middle_notch_point, point_type(90, 90)),
+    pt_fh = g.make_source_point(femoral_head_point, point_type(-90, -90)),
+    pt_laepi = g.make_source_point(lateral_epi_point, point_type(90, -90)),
+    pt_meepi = g.make_source_point(medial_epi_point, point_type(0, -180));
+
+  ////Point
+  ////  pt_mnp = g.make_indicatable_point(middle_notch_point);
+
+  Line
+    ax_mech = g.make_line(mechanical_axis, pt_mnp, pt_fh),
+    ax_epi = g.make_line(epi_axis, pt_meepi, pt_laepi);
+
+  Plane
+    pl_axial = g.make_plane(axial_plane, pt_mnp, pt_fh, pt_laepi);
+
+  Point pt1 = g.make_source_point(point1, point_type(120, 30));
+
+  g.make_plane(
+    g.make_source_point(point_type(-90, 90)),
+    pt1,
+    pt_mnp);
+  }
\ No newline at end of file
Added: sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/geometry.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/geometry.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -0,0 +1,7 @@
+#ifndef BOOST_GUIGL_EXAMPLE_GEOMETRY_HPP
+#define BOOST_GUIGL_EXAMPLE_GEOMETRY_HPP
+
+#include "acceptor.hpp"
+#include "visitors.hpp"
+
+#endif
Added: sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/graph.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/graph.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -0,0 +1,130 @@
+#ifndef BOOST_GUIGL_EXAMPLE_GRAPH_HPP
+#define BOOST_GUIGL_EXAMPLE_GRAPH_HPP
+
+#include "node_types.hpp"
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+//#include <boost/graph/dijkstra_shortest_paths.hpp>
+
+template<class Key, class T>
+class GraphVertex
+  {
+  public:
+    Key key;
+    boost::shared_ptr<base_result<T> > obj;
+
+    GraphVertex(
+      Key key_,
+      boost::shared_ptr<base_result<T> > const& obj_)
+      :key(key_), obj(obj_) {}
+  };
+
+
+class dependency_graph
+  {
+  public:
+    std::map<int, boost::shared_ptr<IAcceptor> > objects;
+    std::map<int, int> key_map;
+
+  public:
+    typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> Graph;
+
+    Graph g;
+
+    boost::shared_ptr<IAcceptor> get(int key)
+      {
+      return objects[key_map[key]];
+      }
+
+    int add_vertex(boost::shared_ptr<IAcceptor> const& ptr)
+      {
+      int v = boost::add_vertex(g);
+      objects[v] = ptr;
+      return v;
+      }
+
+    void add_key(int key, int v)
+      {
+      if(key_map.end() != key_map.find(key))
+        throw std::runtime_error("vertex already exists");
+      key_map[key] = v;
+      }
+
+    boost::optional<int> get_key(int v) const
+      {
+      typedef std::pair<int, int> pair_type;
+      BOOST_FOREACH(pair_type const& p, key_map)
+        if(p.second == v)
+          return p.first;
+      return boost::optional<int>();
+      }
+
+    GraphVertex<int, point_type> make_source_point(point_type const& pt)
+      {
+      boost::shared_ptr<Acceptor<source_point> >
+        obj(new Acceptor<source_point>(source_point(pt)) );
+      int v = add_vertex(obj);
+      return GraphVertex<int, point_type>(v, obj);
+      }
+
+    GraphVertex<int, point_type> make_source_point(int key, point_type const& pt)
+      {
+      GraphVertex<int, point_type> result = make_source_point(pt);
+      add_key(key, result.key);
+      return result;
+      }
+
+    GraphVertex<int, line_type> make_line(
+      GraphVertex<int, point_type> const& pt1,
+      GraphVertex<int, point_type> const& pt2)
+      {
+      boost::shared_ptr<Acceptor<line_from_two_points> >
+        obj(new Acceptor<line_from_two_points>(line_from_two_points(pt1.obj->result, pt2.obj->result)) );
+
+      int v = add_vertex(obj);
+
+      boost::add_edge(pt1.key, v, g);
+      boost::add_edge(pt2.key, v, g);
+
+      return GraphVertex<int, line_type>(v, obj);
+      }
+
+    GraphVertex<int, line_type> make_line(int key,
+      GraphVertex<int, point_type> const& pt1,
+      GraphVertex<int, point_type> const& pt2)
+      {
+      GraphVertex<int, line_type> result = make_line(pt1, pt2);
+      add_key(key, result.key);
+      return result;
+      }
+
+    GraphVertex<int, plane_type> make_plane(
+      GraphVertex<int, point_type> const& pt1,
+      GraphVertex<int, point_type> const& pt2,
+      GraphVertex<int, point_type> const& pt3)
+      {
+      boost::shared_ptr<Acceptor<plane_from_three_points> >
+        obj(new Acceptor<plane_from_three_points>(plane_from_three_points(pt1.obj->result, pt2.obj->result, pt3.obj->result)) );
+
+      int v = add_vertex(obj);
+
+      boost::add_edge(pt1.key, v, g);
+      boost::add_edge(pt2.key, v, g);
+      boost::add_edge(pt3.key, v, g);
+
+      return GraphVertex<int, plane_type>(v, obj);
+      }
+
+    GraphVertex<int, plane_type> make_plane(int key,
+      GraphVertex<int, point_type> const& pt1,
+      GraphVertex<int, point_type> const& pt2,
+      GraphVertex<int, point_type> const& pt3)
+      {
+      GraphVertex<int, plane_type> result = make_plane(pt1, pt2, pt3);
+      add_key(key, result.key);
+      return result;
+      }
+  };
+
+#endif
Added: sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/node_types.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/node_types.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -0,0 +1,48 @@
+#ifndef BOOST_GUIGL_EXAMPLE_NODE_TYPES_HPP
+#define BOOST_GUIGL_EXAMPLE_NODE_TYPES_HPP
+
+#include <boost/guigl/types.hpp>
+#include <boost/array.hpp>
+#include <geometry/geometries/polygon.hpp>
+#include <boost/guigl/ggl.hpp>
+
+typedef boost::guigl::position_type point_type;
+typedef boost::guigl::segment_type line_type;
+typedef geometry::polygon<point_type> plane_type;
+
+template<class T>
+struct base_result
+  {
+  typedef T result_type;
+  result_type result;
+
+  base_result():result(){}
+  explicit base_result(T const& r):result(r){}
+  };
+
+struct source_point : public base_result<point_type>
+  {
+  source_point(point_type const& pt):base_result<point_type>(pt){}
+  };
+
+struct line_from_two_points : public base_result<line_type>
+  {
+  point_type const& pt1, pt2;
+
+  line_from_two_points(
+    point_type const& pt1_, point_type const& pt2_)
+    : pt1(pt1_), pt2(pt2_)
+    {}
+  };
+
+struct plane_from_three_points : public base_result<plane_type>
+  {
+  point_type const& pt1, pt2, pt3;
+
+  plane_from_three_points(
+    point_type const& pt1_, point_type const& pt2_, point_type const& pt3_)
+    : pt1(pt1_), pt2(pt2_), pt3(pt3_)
+    {}
+  };
+
+#endif // BOOST_GUIGL_EXAMPLE_NODE_TYPES_HPP
Added: sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/visitors.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/autogeo/visitors.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
@@ -0,0 +1,30 @@
+#ifndef BOOST_GUIGL_EXAMPLE_VISITOR_HPP
+#define BOOST_GUIGL_EXAMPLE_VISITOR_HPP
+
+#include "node_types.hpp"
+
+class IVisitor
+  {
+  public:
+    virtual ~IVisitor(){}
+
+    virtual void visit(int key, source_point& g) const {}
+    virtual void visit(int key, line_from_two_points& g) const {};
+    virtual void visit(int key, plane_from_three_points& g) const {};
+  };
+
+template<class StaticVisitor>
+class Visitor : public IVisitor
+  {
+  private:
+    StaticVisitor m_static_visitor;
+
+  public:
+    Visitor(StaticVisitor const& static_visitor = StaticVisitor())
+      : m_static_visitor(static_visitor) {}
+    void visit(int key, source_point& g) const {m_static_visitor(key, g);}
+    void visit(int key, line_from_two_points& g) const {m_static_visitor(key, g);};
+    void visit(int key, plane_from_three_points& g) const {m_static_visitor(key, g);};
+  };
+
+#endif
Deleted: sandbox-branches/andreo/guigl/libs/guigl/example/geometry.cpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/geometry.cpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
+++ (empty file)
@@ -1,336 +0,0 @@
-#define NOMINMAX
-
-//*=================================---------------------------------------------
-//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/widget/custom.hpp>
-
-#include <boost/guigl/ggl.hpp>
-#include <boost/guigl/gl.hpp>
-
-#include <geometry/geometries/geometries.hpp>
-#include <geometry/geometry.hpp>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/make_shared.hpp>
-#include <boost/assign/std.hpp>
-#include <boost/foreach.hpp>
-
-#include <geometry/io/wkt/streamwkt.hpp>
-
-#include <geometry/algorithms/correct.hpp>
-#include <geometry/geometry.hpp>
-#include <geometry/algorithms/centroid.hpp>
-#include "graph.hpp"
-
-using namespace boost::guigl;
-
-class RenderVisitor : public IVisitor
-  {
-  public:
-    void visit(int key, source_point& g) const
-      {
-      gl::color(blue(0.7f));
-      ggl::draw(g.result);
-      }
-
-    void visit(int key, line_from_two_points& g) const
-      {
-      gl::line_width(4);
-      gl::color(red(0.8f));
-      ggl::draw(g.result);
-      }
-
-    void visit(int key, plane_from_three_points& g) const
-      {
-      gl::color(green(0.5f));
-      glBegin(GL_POLYGON);
-      ggl::vertex(g.result.outer());
-      glEnd();
-
-      gl::line_width(2);
-      gl::color(black(0.2));
-      ggl::draw<geometry::ring_tag>(g.result.outer());
-      }
-  };
-
-class RecomputeVisitor : public IVisitor
-  {
-  public:
-    void visit(int key, line_from_two_points& g) const
-      {
-      g.result = line_type(g.pt1, g.pt2);
-      };
-
-    void visit(int key, plane_from_three_points& g) const
-      {
-      using namespace boost::assign;
-      g.result.outer().clear();
-      g.result.outer() += g.pt1, g.pt2, g.pt3;
-      geometry::correct(g.result);
-      };
-  };
-
-struct StreamWriter
-  {
-  template<class T>
-  void operator()(int key, T& g) const
-    {
-    std::cout << g.result << std::endl;
-    }
-
-  template<>
-  void operator()<line_from_two_points>(int key, line_from_two_points& g) const
-    {
-    geometry::linestring<point_type> s;
-    geometry::append(s, g.result.first);
-    geometry::append(s, g.result.second);
-    std::cout << s << std::endl;
-    }
-
-  };
-
-template<class Tag>
-struct StreamByTag
-  {
-  template<class T>
-  void operator()(int key, T& g) const
-    {
-    return ;
-    }
-
-  template<>
-  void operator()<Tag>(int key, Tag& g) const
-    {
-    std::cout << g.result << std::endl;
-    }
-  };
-
-void drawString(const char *str, int x, int y, color_type const& clr, void *font)
-  {
-  glPushAttrib(GL_LIGHTING_BIT | GL_CURRENT_BIT); // lighting and color mask
-  glDisable(GL_LIGHTING);     // need to disable lighting for proper text color
-
-  gl::color(clr);
-  glRasterPos2i(x, y);        // place text position
-
-  // loop all characters in the string
-  while(*str)
-    {
-    glutBitmapCharacter(font, *str);
-    ++str;
-    }
-
-  glEnable(GL_LIGHTING);
-  glPopAttrib();
-  }
-
-struct PrintDescription
-  {
-  std::map<int, std::string> const& descriptions;
-  dependency_graph const& g;
-
-  PrintDescription(
-    std::map<int, std::string> const& descriptions_,
-    dependency_graph const& g_)
-    :descriptions(descriptions_), g(g_) {}
-
-  template<class T>
-  point_type get_center(T const& obj) const
-    {
-    point_type center;
-    geometry::centroid(obj, center);
-    return center;
-    }
-
-  template<>
-  point_type get_center<point_type>(point_type const& obj) const
-    {
-    return obj;
-    }
-
-  template<>
-  point_type get_center<line_type>(line_type const& obj) const
-    {
-    return point_type(
-      (obj.first.x + obj.second.x)/2,
-      (obj.first.y + obj.second.y)/2);
-    }
-
-  //template<class T>
-  //point_type get_center<base_result<line_type> >(T const& obj)
-  //  {
-  //  return geometry::centet
-  //  }
-
-  //template<class T>
-  //point_type get_center<base_result<line_type> >(T const& obj)
-  //  {
-
-  //  }
-
-  template<class T>
-  void operator()(int key, T const& obj) const
-    {
-    boost::optional<int> i = g.get_key(key);
-    if(!i) return ;
-
-    point_type center = get_center(obj.result);
-    drawString(descriptions.find(*i)->second.c_str(), center.x + 10, center.y, grey(0.1f), GLUT_BITMAP_8_BY_13);
-    }
-  };
-
-widget::custom *w;
-
-struct drawer {
-  typedef boost::shared_ptr<IAcceptor> IAcceptorPtr;
-  dependency_graph g;
-  std::map<int, std::string> names;
-
-  void init_geometry_graph();
-
-  enum {
-    middle_notch_point,
-    femoral_head_point,
-    lateral_epi_point,
-    medial_epi_point,
-
-    point1,
-
-    mechanical_axis,
-    epi_axis,
-
-    axial_plane
-    };
-
-  drawer()
-    {
-    using namespace boost::assign;
-
-    typedef GraphVertex<int, point_type> Point;
-    typedef GraphVertex<int, line_type> Line;
-    typedef GraphVertex<int, plane_type> Plane;
-
-
-    insert(names)
-      (middle_notch_point, "middle notch point")
-      (femoral_head_point, "femoral head point")
-      (lateral_epi_point, "lateral epi point")
-      (medial_epi_point, "medial epi point")
-      (point1, "point1")
-      (mechanical_axis, "mechanical axis")
-      (epi_axis, "epi axis")
-      (axial_plane, "axial plane")
-      ;
-
-    init_geometry_graph();
-
-    std::for_each(
-      g.objects.begin(),
-      g.objects.end(),
-      accept_each(RecomputeVisitor()));
-
-    std::for_each(
-      g.objects.begin(),
-      g.objects.end(),
-      accept_each(Visitor<StreamWriter>()));
-    }
-
-  void operator()() const
-    {
-    gl::line_width(0.5);
-    gl::color(black(0.5));
-    ggl::draw(w->segment<HC>());
-    ggl::draw(w->segment<VC>());
-
-    gl::scoped_matrix m;
-    gl::translate(250., 250.);
-
-//    drawString("center", 0, 0, grey(0.1), GLUT_BITMAP_8_BY_13);
-
-    gl::point_size(10);
-    //gl::line_width(2);
-    glEnable(GL_LINE_SMOOTH);
-    glEnable(GL_POINT_SMOOTH);
-
-
-    std::for_each(
-      g.objects.begin(),
-      g.objects.end(),
-      accept_each(RecomputeVisitor()));
-
-    std::for_each(
-      g.objects.begin(),
-      g.objects.end(),
-      accept_each(RenderVisitor()));
-
-    std::for_each(
-      g.objects.begin(),
-      g.objects.end(),
-      accept_each(Visitor<PrintDescription>(PrintDescription(names, g))));
-    }
-  };
-
-int main()
-  {
-  window wnd((
-    _label = "geometry example",
-    _size = size_type(500, 500),
-    _background = white()
-    ));
-
-  w = new widget::custom((
-    _size = size_type(500,500),
-    _position = position_type(0, 0),
-    _draw_prologue = drawer()
-    ));
-
-  wnd << w;
-
-  application::run();
-  return 0;
-  }
-
-
-
-
-void drawer::init_geometry_graph()
-  {
-  using namespace boost::assign;
-
-  typedef GraphVertex<int, point_type> Point;
-  typedef GraphVertex<int, line_type> Line;
-  typedef GraphVertex<int, plane_type> Plane;
-
-  Point
-    pt_mnp = g.make_source_point(middle_notch_point, point_type(90, 90)),
-    pt_fh = g.make_source_point(femoral_head_point, point_type(-90, -90)),
-    pt_laepi = g.make_source_point(lateral_epi_point, point_type(90, -90)),
-    pt_meepi = g.make_source_point(medial_epi_point, point_type(0, -180));
-
-  ////Point
-  ////  pt_mnp = g.make_indicatable_point(middle_notch_point);
-
-  Line
-    ax_mech = g.make_line(mechanical_axis, pt_mnp, pt_fh),
-    ax_epi = g.make_line(epi_axis, pt_meepi, pt_laepi);
-
-  Plane
-    pl_axial = g.make_plane(axial_plane, pt_mnp, pt_fh, pt_laepi);
-
-  Point pt1 = g.make_source_point(point1, point_type(120, 30));
-
-  g.make_plane(
-    g.make_source_point(point_type(-90, 90)),
-    pt1,
-    pt_mnp);
-  }
\ No newline at end of file
Deleted: sandbox-branches/andreo/guigl/libs/guigl/example/geometry.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/geometry.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
+++ (empty file)
@@ -1,7 +0,0 @@
-#ifndef BOOST_GUIGL_EXAMPLE_GEOMETRY_HPP
-#define BOOST_GUIGL_EXAMPLE_GEOMETRY_HPP
-
-#include "acceptor.hpp"
-#include "visitors.hpp"
-
-#endif
Deleted: sandbox-branches/andreo/guigl/libs/guigl/example/graph.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/graph.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
+++ (empty file)
@@ -1,130 +0,0 @@
-#ifndef BOOST_GUIGL_EXAMPLE_GRAPH_HPP
-#define BOOST_GUIGL_EXAMPLE_GRAPH_HPP
-
-#include "node_types.hpp"
-
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/adjacency_list.hpp>
-//#include <boost/graph/dijkstra_shortest_paths.hpp>
-
-template<class Key, class T>
-class GraphVertex
-  {
-  public:
-    Key key;
-    boost::shared_ptr<base_result<T> > obj;
-
-    GraphVertex(
-      Key key_,
-      boost::shared_ptr<base_result<T> > const& obj_)
-      :key(key_), obj(obj_) {}
-  };
-
-
-class dependency_graph
-  {
-  public:
-    std::map<int, boost::shared_ptr<IAcceptor> > objects;
-    std::map<int, int> key_map;
-
-  public:
-    typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> Graph;
-
-    Graph g;
-
-    boost::shared_ptr<IAcceptor> get(int key)
-      {
-      return objects[key_map[key]];
-      }
-
-    int add_vertex(boost::shared_ptr<IAcceptor> const& ptr)
-      {
-      int v = boost::add_vertex(g);
-      objects[v] = ptr;
-      return v;
-      }
-
-    void add_key(int key, int v)
-      {
-      if(key_map.end() != key_map.find(key))
-        throw std::runtime_error("vertex already exists");
-      key_map[key] = v;
-      }
-
-    boost::optional<int> get_key(int v) const
-      {
-      typedef std::pair<int, int> pair_type;
-      BOOST_FOREACH(pair_type const& p, key_map)
-        if(p.second == v)
-          return p.first;
-      return boost::optional<int>();
-      }
-
-    GraphVertex<int, point_type> make_source_point(point_type const& pt)
-      {
-      boost::shared_ptr<Acceptor<source_point> >
-        obj(new Acceptor<source_point>(source_point(pt)) );
-      int v = add_vertex(obj);
-      return GraphVertex<int, point_type>(v, obj);
-      }
-
-    GraphVertex<int, point_type> make_source_point(int key, point_type const& pt)
-      {
-      GraphVertex<int, point_type> result = make_source_point(pt);
-      add_key(key, result.key);
-      return result;
-      }
-
-    GraphVertex<int, line_type> make_line(
-      GraphVertex<int, point_type> const& pt1,
-      GraphVertex<int, point_type> const& pt2)
-      {
-      boost::shared_ptr<Acceptor<line_from_two_points> >
-        obj(new Acceptor<line_from_two_points>(line_from_two_points(pt1.obj->result, pt2.obj->result)) );
-
-      int v = add_vertex(obj);
-
-      boost::add_edge(pt1.key, v, g);
-      boost::add_edge(pt2.key, v, g);
-
-      return GraphVertex<int, line_type>(v, obj);
-      }
-
-    GraphVertex<int, line_type> make_line(int key,
-      GraphVertex<int, point_type> const& pt1,
-      GraphVertex<int, point_type> const& pt2)
-      {
-      GraphVertex<int, line_type> result = make_line(pt1, pt2);
-      add_key(key, result.key);
-      return result;
-      }
-
-    GraphVertex<int, plane_type> make_plane(
-      GraphVertex<int, point_type> const& pt1,
-      GraphVertex<int, point_type> const& pt2,
-      GraphVertex<int, point_type> const& pt3)
-      {
-      boost::shared_ptr<Acceptor<plane_from_three_points> >
-        obj(new Acceptor<plane_from_three_points>(plane_from_three_points(pt1.obj->result, pt2.obj->result, pt3.obj->result)) );
-
-      int v = add_vertex(obj);
-
-      boost::add_edge(pt1.key, v, g);
-      boost::add_edge(pt2.key, v, g);
-      boost::add_edge(pt3.key, v, g);
-
-      return GraphVertex<int, plane_type>(v, obj);
-      }
-
-    GraphVertex<int, plane_type> make_plane(int key,
-      GraphVertex<int, point_type> const& pt1,
-      GraphVertex<int, point_type> const& pt2,
-      GraphVertex<int, point_type> const& pt3)
-      {
-      GraphVertex<int, plane_type> result = make_plane(pt1, pt2, pt3);
-      add_key(key, result.key);
-      return result;
-      }
-  };
-
-#endif
Deleted: sandbox-branches/andreo/guigl/libs/guigl/example/node_types.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/node_types.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
+++ (empty file)
@@ -1,48 +0,0 @@
-#ifndef BOOST_GUIGL_EXAMPLE_NODE_TYPES_HPP
-#define BOOST_GUIGL_EXAMPLE_NODE_TYPES_HPP
-
-#include <boost/guigl/types.hpp>
-#include <boost/array.hpp>
-#include <geometry/geometries/polygon.hpp>
-#include <boost/guigl/ggl.hpp>
-
-typedef boost::guigl::position_type point_type;
-typedef boost::guigl::segment_type line_type;
-typedef geometry::polygon<point_type> plane_type;
-
-template<class T>
-struct base_result
-  {
-  typedef T result_type;
-  result_type result;
-
-  base_result():result(){}
-  explicit base_result(T const& r):result(r){}
-  };
-
-struct source_point : public base_result<point_type>
-  {
-  source_point(point_type const& pt):base_result<point_type>(pt){}
-  };
-
-struct line_from_two_points : public base_result<line_type>
-  {
-  point_type const& pt1, pt2;
-
-  line_from_two_points(
-    point_type const& pt1_, point_type const& pt2_)
-    : pt1(pt1_), pt2(pt2_)
-    {}
-  };
-
-struct plane_from_three_points : public base_result<plane_type>
-  {
-  point_type const& pt1, pt2, pt3;
-
-  plane_from_three_points(
-    point_type const& pt1_, point_type const& pt2_, point_type const& pt3_)
-    : pt1(pt1_), pt2(pt2_), pt3(pt3_)
-    {}
-  };
-
-#endif // BOOST_GUIGL_EXAMPLE_NODE_TYPES_HPP
Deleted: sandbox-branches/andreo/guigl/libs/guigl/example/visitors.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/visitors.hpp	2009-03-27 12:56:41 EDT (Fri, 27 Mar 2009)
+++ (empty file)
@@ -1,30 +0,0 @@
-#ifndef BOOST_GUIGL_EXAMPLE_VISITOR_HPP
-#define BOOST_GUIGL_EXAMPLE_VISITOR_HPP
-
-#include "node_types.hpp"
-
-class IVisitor
-  {
-  public:
-    virtual ~IVisitor(){}
-
-    virtual void visit(int key, source_point& g) const {}
-    virtual void visit(int key, line_from_two_points& g) const {};
-    virtual void visit(int key, plane_from_three_points& g) const {};
-  };
-
-template<class StaticVisitor>
-class Visitor : public IVisitor
-  {
-  private:
-    StaticVisitor m_static_visitor;
-
-  public:
-    Visitor(StaticVisitor const& static_visitor = StaticVisitor())
-      : m_static_visitor(static_visitor) {}
-    void visit(int key, source_point& g) const {m_static_visitor(key, g);}
-    void visit(int key, line_from_two_points& g) const {m_static_visitor(key, g);};
-    void visit(int key, plane_from_three_points& g) const {m_static_visitor(key, g);};
-  };
-
-#endif