diff --git a/extensions/example/units/08_units_example.cpp b/extensions/example/units/08_units_example.cpp deleted file mode 100644 index 8e8eba12c..000000000 --- a/extensions/example/units/08_units_example.cpp +++ /dev/null @@ -1,210 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. - -// 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) -// -// Example combining Boost.Geometry with Boost.Units - -#include - -#include - - -#include -#include -#include -#include - - -// TEMPORARY this will go to somewhere within Boost.Geometry -namespace boost { namespace geometry -{ - -namespace cs -{ - -template -struct units_cartesian {}; - -} - -namespace traits -{ -template -struct cs_tag > -{ - typedef cartesian_tag type; -}; - -} - - -namespace model -{ - -// Define a point type to interoperate with Boost.Units, having -// 1. a constructor taking quantities -// 2. defining a quantified coordinate system -// Note that all values are still stored in "normal" types as double -template > -class quantity_point : public model::point -{ - typedef boost::units::quantity qtype; - -public : - - // Templated constructor to allow constructing with other units then qtype, - // e.g. to convert from centimeters to meters - template - inline quantity_point(Q const& x, Q const& y) - : model::point( - qtype(x).value(), - qtype(y).value()) - {} -}; - -} - - -// Adapt quantity_point to the Point Concept -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - -template -struct tag > -{ - typedef point_tag type; -}; - -template -struct coordinate_type > -{ - typedef CoordinateType type; -}; - -template -struct coordinate_system > -{ - typedef CoordinateSystem type; -}; - -template -struct dimension > - : boost::mpl::int_ -{}; - -template -struct access, Dimension > -{ - static inline CoordinateType get( - model::quantity_point const& p) - { - return p.template get(); - } - - static inline void set(model::quantity_point& p, - CoordinateType const& value) - { - p.template set(value); - } -}; - -} // namespace traits -#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS - - - -// For extra support for functions as distance,area,get,set -namespace units -{ - namespace detail - { - // Define an extra meta-function to get the units of a coordinate system - template - struct unit_dimension - { - // define it as dimensionless - // or MPL ASSERT - }; - - template - struct unit_dimension > - { - typedef U type; - }; - } - - // Define an extra metafunction to define the quantity of a Geometry type - template ::type> - struct quantity - { - typedef boost::units::quantity - < - typename detail::unit_dimension - < - typename coordinate_system::type - >::type, - CT - > type; - }; - - - template - inline typename quantity::type>::type - distance(Geometry1 const& g1, Geometry2 const& g2) - { - typedef typename quantity::type>::type q; - return q::from_value(geometry::distance(g1, g2)); - } - - template - inline typename quantity::type get(Point const& p) - { - typedef typename quantity::type q; - return q::from_value(geometry::get(p)); - } -} - -}} -// END TEMPORARY - - - -int main(void) -{ - using namespace boost::geometry; - using namespace boost::units; - - // 1: using it directly - { - typedef model::quantity_point point; - point p1(1 * si::meter, 2 * si::meter); - point p2(3 * si::meter, 4 * si::meter); - - std::cout << get<0>(p2) << std::endl; - - // This is a little inconvenient: - quantity d = distance(p1, p2) * si::meter; - - std::cout << d << std::endl; - } - - // 2: same but now using centimeters, and using boost::geometry::units:: - { - typedef model::quantity_point point; - point p1(1 * si::meter, 2 * si::meter); - point p2(3 * si::meter, 4 * si::meter); - - std::cout << boost::geometry::units::get<0>(p2) << std::endl; - quantity d = boost::geometry::units::distance(p1, p2); - std::cout << d << std::endl; - } - - return 0; -} diff --git a/include/boost/geometry/extensions/algorithms/detail/overlay/msm_state.hpp b/include/boost/geometry/extensions/algorithms/detail/overlay/msm_state.hpp deleted file mode 100644 index 1cff563ca..000000000 --- a/include/boost/geometry/extensions/algorithms/detail/overlay/msm_state.hpp +++ /dev/null @@ -1,187 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2007-2012 Barend Gehrels, 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) - - -#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_MSM_STATE_HPP -#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_MSM_STATE_HPP - - - -#ifdef USE_MSM_MINI - -# include -# include - -#else - -# include -# include - -#endif - - - -// Events -struct starting {}; -struct visit {}; -struct finish {}; - - -// Flags -struct is_init {}; -struct is_visited {}; - -enum StatesEnum -{ - STATE_NONE=0, - STATE_IS_INIT=1, - STATE_IS_VISITED=2 -}; - - - -#ifndef USE_MSM_MINI - -// front-end: define the FSM structure -struct traverse_state_ : public boost::msm::front::state_machine_def -{ - traverse_state_():m_state(STATE_IS_INIT){} - // The list of FSM states - struct Init : public boost::msm::front::state<> - { - typedef boost::mpl::vector1 flag_list; - //template - //void on_entry(Event const&,FSM& fsm) {fsm.m_state=STATE_IS_INIT;} - }; - - struct Started : public boost::msm::front::state<> - { - //template - //void on_entry(Event const&,FSM& fsm) {fsm.m_state=STATE_NONE;} - }; - - struct Visited : public boost::msm::front::state<> - { - typedef boost::mpl::vector1 flag_list; - //template - //void on_entry(Event const&,FSM& fsm) {fsm.m_state=STATE_IS_VISITED;} - }; - - struct Finished : public boost::msm::front::state<> - { - typedef boost::mpl::vector1 flag_list; - //template - //void on_entry(Event const&,FSM& fsm) {fsm.m_state=STATE_IS_VISITED;} - }; - - - // the initial state of the player SM. Must be defined - typedef Init initial_state; - - // transition actions - void start_traverse(starting const&) {m_state=STATE_NONE;} - void finish_after_visit(finish const&) {m_state=STATE_IS_VISITED;} - void do_finish(finish const&) {m_state=STATE_IS_VISITED;} - void do_visit(visit const&) {m_state=STATE_IS_VISITED;} - void do_visit2(visit const&) {m_state=STATE_IS_VISITED;} - void do_nothing(finish const&) {m_state=STATE_IS_VISITED;} - - - typedef traverse_state_ p; // makes transition table cleaner - - // Transition table for player - struct transition_table : mpl::vector - < - // Start Event Next Action Guard - // +---------+-------------+---------+---------------------+----------------------+ - a_row < Init , starting , Started , &p::start_traverse >, - a_row < Init , visit , Visited , &p::do_visit >, - a_row < Init , finish , Finished , &p::do_nothing >, - a_row < Started , finish , Finished , &p::do_finish >, - a_row < Started , visit , Visited , &p::do_visit2 >, - // +---------+-------------+---------+---------------------+----------------------+ - a_row < Visited , finish , Finished , &p::finish_after_visit > - // +---------+-------------+---------+---------------------+----------------------+ - > {}; - - // Replaces the default no-transition response. - template - void no_transition(Event const& e, Machine&, int state) - { - //std::cout << "no transition from state " << state << " on event " << typeid(e).name() << std::endl; - } - - typedef int no_exception_thrown; - typedef int no_message_queue; - StatesEnum m_state; - -}; - - -typedef boost::msm::back::state_machine traverse_state; - -#else - -// mini-back-end - - -struct traverse_state : public boost::msm::back::mini::state_machine -{ - traverse_state():m_state(STATE_IS_INIT){} - - // The list of FSM states - enum states - { - Init, Started, Visited, Finished - , initial_state = Init - }; - - friend class boost::msm::back::mini::state_machine; - typedef traverse_state p; // makes transition table cleaner - - // transition actions - void start_traverse(starting const&) {m_state=STATE_NONE;} - void finish_after_visit(finish const&) {m_state=STATE_IS_VISITED;} - void do_finish(finish const&) {m_state=STATE_IS_VISITED;} - void do_visit(visit const&) {m_state=STATE_IS_VISITED;} - void do_visit2(visit const&) {m_state=STATE_IS_VISITED;} - void do_nothing(finish const&) {m_state=STATE_IS_VISITED;} - - bool flag_none() const { return m_state == STATE_IS_INIT; } - bool flag_visited() const { return m_state == STATE_IS_VISITED; } - - - // Transition table - struct transition_table : mpl::vector6< - // Start Event Next Action - // +---------+-------------+---------+---------------------+ - row < Init , starting , Started , &p::start_traverse >, - row < Init , visit , Visited , &p::do_visit >, - row < Init , finish , Finished, &p::do_nothing >, - row < Started , finish , Finished, &p::do_finish >, - row < Started , visit , Visited , &p::do_visit2 >, - row < Visited , finish , Finished, &p::finish_after_visit> - // +---------+-------------+---------+---------------------+ - > {}; - - // Replaces the default no-transition response. - template - int no_transition(int state, Event const& e) - { - std::cout << "no transition from state " << state - << " on event " << typeid(e).name() << std::endl; - return state; - } - StatesEnum m_state; - -}; - -#endif - - -#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_MSM_STATE_HPP diff --git a/include/boost/geometry/extensions/geometries/quantity_point.hpp b/include/boost/geometry/extensions/geometries/quantity_point.hpp deleted file mode 100644 index ebfd894d1..000000000 --- a/include/boost/geometry/extensions/geometries/quantity_point.hpp +++ /dev/null @@ -1,134 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) - -// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. -// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. -// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. - -// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library -// (geolib/GGL), copyright (c) 1995-2010 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) - -#ifndef BOOST_GEOMETRY_EXTENSIONS_GEOMETRIES_QUANTITY_POINT_HPP -#define BOOST_GEOMETRY_EXTENSIONS_GEOMETRIES_QUANTITY_POINT_HPP - -#include - -#include - -#include -#include - -#include - - -namespace boost { namespace geometry -{ - -namespace cs -{ - -template -struct units_cartesian {}; - -} - -namespace traits -{ - -template -struct cs_tag > -{ - typedef cartesian_tag type; -}; - -} - - -namespace model -{ - -// Define a point type to interoperate with Boost.Units, having -// 1. a constructor taking quantities -// 2. defining a quantified coordinate system -// Note that all values are still stored in "normal" types as double -template -< - typename Units, - std::size_t DimensionCount = 2, - typename CoordinateType = double, - typename CoordinateSystem = cs::units_cartesian -> -class quantity_point - : public model::point -{ - typedef boost::units::quantity qtype; - -public : - - // Templated constructor to allow constructing with other units then qtype, - // e.g. to convert from centimeters to meters - template - inline quantity_point(Quantity const& x, Quantity const& y) - : model::point( - qtype(x).value(), - qtype(y).value()) - {} -}; - -} - - -// Adapt quantity_point to the Point Concept -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - -template -struct tag > -{ - typedef point_tag type; -}; - -template -struct coordinate_type > -{ - typedef CoordinateType type; -}; - -template -struct coordinate_system > -{ - typedef CoordinateSystem type; -}; - -template -struct dimension > - : boost::mpl::int_ -{}; - -template -struct access, Dimension > -{ - static inline CoordinateType get( - model::quantity_point const& p) - { - return p.template get(); - } - - static inline void set(model::quantity_point& p, - CoordinateType const& value) - { - p.template set(value); - } -}; - -} // namespace traits -#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS - - -}} // namespace boost::geometry - -#endif // BOOST_GEOMETRY_EXTENSIONS_GEOMETRIES_QUANTITY_POINT_HPP