File indexing completed on 2025-03-13 08:58:14
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_POLYGON_POLYGON_DATA_HPP
0009 #define BOOST_POLYGON_POLYGON_DATA_HPP
0010 namespace boost { namespace polygon{
0011 struct polygon_concept;
0012 template <typename T>
0013 class polygon_data {
0014 public:
0015 typedef polygon_concept geometry_type;
0016 typedef T coordinate_type;
0017 typedef typename std::vector<point_data<coordinate_type> >::const_iterator iterator_type;
0018 typedef typename coordinate_traits<T>::coordinate_distance area_type;
0019 typedef point_data<T> point_type;
0020
0021 inline polygon_data() : coords_() {}
0022
0023 template<class iT>
0024 inline polygon_data(iT input_begin, iT input_end) : coords_(input_begin, input_end) {}
0025
0026 template<class iT>
0027 inline polygon_data& set(iT input_begin, iT input_end) {
0028 coords_.clear();
0029 coords_.insert(coords_.end(), input_begin, input_end);
0030 return *this;
0031 }
0032
0033
0034 inline polygon_data(const polygon_data& that) : coords_(that.coords_) {}
0035
0036
0037 inline polygon_data& operator=(const polygon_data& that) {
0038 coords_ = that.coords_;
0039 return *this;
0040 }
0041
0042 template <typename T2>
0043 inline polygon_data& operator=(const T2& rvalue);
0044
0045 inline bool operator==(const polygon_data& that) const {
0046 if(coords_.size() != that.coords_.size()) return false;
0047 for(std::size_t i = 0; i < coords_.size(); ++i) {
0048 if(coords_[i] != that.coords_[i]) return false;
0049 }
0050 return true;
0051 }
0052
0053 inline bool operator!=(const polygon_data& that) const { return !((*this) == that); }
0054
0055
0056 inline iterator_type begin() const { return coords_.begin(); }
0057
0058
0059 inline iterator_type end() const { return coords_.end(); }
0060
0061 inline std::size_t size() const { return coords_.size(); }
0062
0063 public:
0064 std::vector<point_data<coordinate_type> > coords_;
0065 };
0066
0067 }
0068 }
0069 #endif