Advertisement
Guest User

circularstring_def.h

a guest
Jul 20th, 2011
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.91 KB | None | 0 0
  1. #ifndef CIRCULARSTRING_DEF_H_INCLUDED
  2. #define CIRCULARSTRING_DEF_H_INCLUDED
  3.  
  4. #include <boost/geometry/core/access.hpp>
  5. #include <boost/geometry/core/mutable_range.hpp>
  6. #include <boost/geometry/core/point_type.hpp>
  7.  
  8. #include <boost/geometry/geometries/concepts/point_concept.hpp>
  9.  
  10. #include <memory>
  11. #include <vector>
  12.  
  13. #include <boost/concept/assert.hpp>
  14. #include <boost/range.hpp>
  15.  
  16. #include <boost/geometry/core/tag.hpp>
  17. #include <boost/geometry/core/tags.hpp>
  18.  
  19. #include <boost/geometry/domains/gis/io/wkt/write_wkt.hpp>
  20.  
  21. namespace boost
  22. {
  23.     namespace geometry
  24.     {
  25.  
  26.         /// Circularstring identifying tag
  27.         struct circularstring_tag : single_tag {};
  28.  
  29. //        namespace concept
  30. //
  31. //        {
  32. //            template <typename Geometry>
  33. //            class Circularstring
  34. //            {
  35. //            #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  36. //                typedef typename point_type<Geometry>::type point_type;
  37. //
  38. //                BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
  39. //                BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  40. //
  41. //            public :
  42. //
  43. //                BOOST_CONCEPT_USAGE(Circularstring)
  44. //                {
  45. //                    Geometry* ls = 0;
  46. //                    traits::clear<Geometry>::apply(*ls);
  47. //                    traits::resize<Geometry>::apply(*ls, 0);
  48. //                    point_type* point = 0;
  49. //                    traits::push_back<Geometry>::apply(*ls, *point);
  50. //                }
  51. //            #endif
  52. //            };
  53. //        }
  54.  
  55.  
  56.         namespace model
  57.         {
  58.  
  59.             template
  60.             <
  61.                 typename Point,
  62.                 template<typename,typename> class Container = std::vector,
  63.                 template<typename> class Allocator = std::allocator
  64.             >
  65.             class circularstring : public Container<Point, Allocator<Point> >
  66.             {
  67.                 BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
  68.  
  69.                 typedef Container<Point, Allocator<Point> > base_type;
  70.  
  71.             public :
  72.                 /// \constructor_default{circularstring}
  73.                 inline circularstring()
  74.                     : base_type()
  75.                 {}
  76.  
  77.                 /// \constructor_begin_end{circularstring}
  78.                 template <typename Iterator>
  79.                 inline circularstring(Iterator begin, Iterator end)
  80.                     : base_type(begin, end)
  81.                 {}
  82.             };
  83.         } // namespace model
  84.  
  85.         #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  86.         namespace traits
  87.         {
  88.             template
  89.             <
  90.                 typename Point,
  91.                 template<typename,typename> class Container,
  92.                 template<typename> class Allocator
  93.             >
  94.             struct tag<model::circularstring<Point, Container, Allocator> >
  95.             {
  96.                 typedef circularstring_tag type;
  97.             };
  98.         } // namespace traits
  99.         #endif
  100.  
  101.  
  102.         #ifndef DOXYGEN_NO_DETAIL
  103.         namespace detail
  104.         {
  105.             namespace wkt
  106.             {
  107.                 struct prefix_circularstring_par
  108.                 {
  109.                     static inline const char* apply() { return "CIRCULARSTRING("; }
  110.                 };
  111.  
  112.  
  113.             }
  114.         } // namespace detail
  115.         #endif
  116.  
  117.         #ifndef DOXYGEN_NO_DISPATCH
  118.         namespace dispatch
  119.         {
  120.             template <typename Linestring>
  121.             struct wkt<circularstring_tag, Linestring>
  122.                 : detail::wkt::wkt_range
  123.                     <
  124.                         Linestring,
  125.                         detail::wkt::prefix_circularstring_par,
  126.                         detail::wkt::closing_parenthesis
  127.                     >
  128.             {};
  129.         } // namespace dispatch
  130.         #endif
  131.  
  132.     } //namespace geometry
  133. } // namespace boost
  134.  
  135.  
  136. #endif // CIRCULARSTRING_DEF_H_INCLUDED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement