annotate DEPENDENCIES/generic/include/boost/polygon/rectangle_data.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +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_RECTANGLE_DATA_HPP
Chris@16 9 #define BOOST_POLYGON_RECTANGLE_DATA_HPP
Chris@16 10
Chris@16 11 #include "isotropy.hpp"
Chris@16 12 //interval
Chris@16 13 #include "interval_data.hpp"
Chris@16 14
Chris@16 15 namespace boost { namespace polygon{
Chris@16 16
Chris@16 17 template <typename T>
Chris@16 18 class rectangle_data {
Chris@16 19 public:
Chris@16 20 typedef T coordinate_type;
Chris@16 21 typedef interval_data<T> interval_type;
Chris@16 22 inline rectangle_data():ranges_() {}
Chris@16 23 inline rectangle_data(T xl, T yl, T xh, T yh):ranges_() {
Chris@16 24 if(xl > xh) std::swap(xl, xh);
Chris@16 25 if(yl > yh) std::swap(yl, yh);
Chris@16 26 ranges_[HORIZONTAL] = interval_data<T>(xl, xh);
Chris@16 27 ranges_[VERTICAL] = interval_data<T>(yl, yh);
Chris@16 28 }
Chris@16 29 template <typename interval_type_1, typename interval_type_2>
Chris@16 30 inline rectangle_data(const interval_type_1& hrange,
Chris@16 31 const interval_type_2& vrange):ranges_() {
Chris@16 32 set(HORIZONTAL, hrange); set(VERTICAL, vrange); }
Chris@16 33
Chris@16 34 inline rectangle_data(const rectangle_data& that):ranges_() { (*this) = that; }
Chris@16 35 inline rectangle_data& operator=(const rectangle_data& that) {
Chris@16 36 ranges_[0] = that.ranges_[0]; ranges_[1] = that.ranges_[1]; return *this;
Chris@16 37 }
Chris@16 38 template <typename T2>
Chris@16 39 inline rectangle_data& operator=(const T2& rvalue);
Chris@16 40
Chris@16 41 template <typename T2>
Chris@16 42 inline bool operator==(const T2& rvalue) const;
Chris@16 43 template <typename T2>
Chris@16 44 inline bool operator!=(const T2& rvalue) const { return !((*this) == rvalue); }
Chris@16 45
Chris@16 46 inline interval_data<coordinate_type> get(orientation_2d orient) const {
Chris@16 47 return ranges_[orient.to_int()]; }
Chris@16 48 inline coordinate_type get(direction_2d dir) const {
Chris@16 49 return ranges_[orientation_2d(dir).to_int()].get(direction_1d(dir));
Chris@16 50 }
Chris@16 51 inline void set(direction_2d dir, coordinate_type value) {
Chris@16 52 return ranges_[orientation_2d(dir).to_int()].set(direction_1d(dir), value);
Chris@16 53 }
Chris@16 54 template <typename interval_type_1>
Chris@16 55 inline void set(orientation_2d orient, const interval_type_1& interval);
Chris@16 56 private:
Chris@16 57 interval_data<coordinate_type> ranges_[2];
Chris@16 58 };
Chris@16 59
Chris@16 60
Chris@16 61 }
Chris@16 62 }
Chris@16 63 #endif