annotate DEPENDENCIES/generic/include/boost/polygon/polygon_90_data.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*
Chris@16 2 Copyright 2008 Intel Corporation
Chris@16 3
Chris@16 4 Use, modification and distribution are subject to the Boost Software License,
Chris@16 5 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 http://www.boost.org/LICENSE_1_0.txt).
Chris@16 7 */
Chris@16 8 #ifndef BOOST_POLYGON_POLYGON_90_DATA_HPP
Chris@16 9 #define BOOST_POLYGON_POLYGON_90_DATA_HPP
Chris@16 10 namespace boost { namespace polygon{
Chris@16 11 struct polygon_90_concept;
Chris@16 12 template <typename T>
Chris@16 13 class polygon_90_data {
Chris@16 14 public:
Chris@16 15 typedef polygon_90_concept geometry_type;
Chris@16 16 typedef T coordinate_type;
Chris@16 17 typedef typename std::vector<coordinate_type>::const_iterator compact_iterator_type;
Chris@16 18 typedef iterator_compact_to_points<compact_iterator_type, point_data<coordinate_type> > iterator_type;
Chris@16 19 typedef typename coordinate_traits<T>::area_type area_type;
Chris@16 20
Chris@16 21 inline polygon_90_data() : coords_() {} //do nothing default constructor
Chris@16 22
Chris@16 23 // initialize a polygon from x,y values, it is assumed that the first is an x
Chris@16 24 // and that the input is a well behaved polygon
Chris@16 25 template<class iT>
Chris@16 26 inline polygon_90_data& set(iT begin_point, iT end_point) {
Chris@16 27 return set_compact(iterator_points_to_compact<iT, typename std::iterator_traits<iT>::value_type>(begin_point, end_point),
Chris@16 28 iterator_points_to_compact<iT, typename std::iterator_traits<iT>::value_type>(end_point, end_point));
Chris@16 29 }
Chris@16 30
Chris@16 31 template<class iT>
Chris@16 32 inline polygon_90_data& set_compact(iT input_begin, iT input_end) {
Chris@16 33 coords_.clear(); //just in case there was some old data there
Chris@16 34 while(input_begin != input_end) {
Chris@16 35 coords_.insert(coords_.end(), *input_begin);
Chris@16 36 ++input_begin;
Chris@16 37 }
Chris@16 38 return *this;
Chris@16 39 }
Chris@16 40
Chris@16 41 // copy constructor (since we have dynamic memory)
Chris@16 42 inline polygon_90_data(const polygon_90_data& that) : coords_(that.coords_) {}
Chris@16 43
Chris@16 44 // assignment operator (since we have dynamic memory do a deep copy)
Chris@16 45 inline polygon_90_data& operator=(const polygon_90_data& that) {
Chris@16 46 coords_ = that.coords_;
Chris@16 47 return *this;
Chris@16 48 }
Chris@16 49
Chris@16 50 template <typename T2>
Chris@16 51 inline polygon_90_data& operator=(const T2& rvalue);
Chris@16 52
Chris@16 53 // assignment operator (since we have dynamic memory do a deep copy)
Chris@16 54 inline bool operator==(const polygon_90_data& that) const {
Chris@16 55 return coords_ == that.coords_;
Chris@16 56 }
Chris@16 57
Chris@16 58 // get begin iterator, returns a pointer to a const Unit
Chris@16 59 inline iterator_type begin() const { return iterator_type(coords_.begin(), coords_.end()); }
Chris@16 60
Chris@16 61 // get end iterator, returns a pointer to a const Unit
Chris@16 62 inline iterator_type end() const { return iterator_type(coords_.end(), coords_.end()); }
Chris@16 63
Chris@16 64 // get begin iterator, returns a pointer to a const Unit
Chris@16 65 inline compact_iterator_type begin_compact() const { return coords_.begin(); }
Chris@16 66
Chris@16 67 // get end iterator, returns a pointer to a const Unit
Chris@16 68 inline compact_iterator_type end_compact() const { return coords_.end(); }
Chris@16 69
Chris@16 70 inline std::size_t size() const { return coords_.size(); }
Chris@16 71
Chris@16 72 private:
Chris@16 73 std::vector<coordinate_type> coords_;
Chris@16 74 };
Chris@16 75
Chris@16 76
Chris@16 77 }
Chris@16 78 }
Chris@16 79 #endif