|
Boost-Commit : |
From: lucanus.j.simonson_at_[hidden]
Date: 2008-05-19 13:06:44
Author: ljsimons
Date: 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
New Revision: 45547
URL: http://svn.boost.org/trac/boost/changeset/45547
Log:
added lazy iterators input to booleans algorithm and fixed all warnings
Added:
sandbox/gtl/gtl/iterator_geometry_to_set.h (contents, props changed)
sandbox/gtl/gtl/polygon_set_wrapper.h (contents, props changed)
Text files modified:
sandbox/gtl/gtl/gtl.h | 7 +++++--
sandbox/gtl/gtl/interval_concept.h | 7 +++----
sandbox/gtl/gtl/isotropy.h | 2 +-
sandbox/gtl/gtl/iterator_vertex_orient_conversion.h | 8 +++++---
sandbox/gtl/gtl/point_data.h | 6 ++++++
sandbox/gtl/gtl/polygon_concept.h | 9 ++++++++-
sandbox/gtl/gtl/polygon_formation.h | 6 +++---
sandbox/gtl/gtl/polygon_set_data.h | 5 +++++
sandbox/gtl/gtl/polygon_set_traits.h | 10 +++++-----
sandbox/gtl/gtl/polygon_set_view.h | 6 +++---
sandbox/gtl/gtl/rectangle_concept.h | 6 ++++--
sandbox/gtl/gtl/rectangle_data.h | 2 +-
12 files changed, 49 insertions(+), 25 deletions(-)
Modified: sandbox/gtl/gtl/gtl.h
==============================================================================
--- sandbox/gtl/gtl/gtl.h (original)
+++ sandbox/gtl/gtl/gtl.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -57,6 +57,7 @@
#include "polygon_formation.h"
#include "rectangle_formation.h"
#include "iterator_vertex_orient_conversion.h"
+#include "iterator_geometry_to_set.h"
//polygon set data types
#include "polygon_set_data.h"
@@ -67,6 +68,8 @@
//geometry traits
#include "geometry_traits.h"
+#include "polygon_set_wrapper.h"
+
//defintions
#include "post_geometry_traits_definitions.h"
@@ -76,8 +79,8 @@
template <typename geometry_type_1, typename geometry_type_2>
bool contains(const geometry_type_1& geometry_object, const geometry_type_2& contained_geometry_object,
bool consider_touch = true) {
- typename geometry_traits<geometry_type_1>::geometry_concept().contains(geometry_object, contained_geometry_object,
- consider_touch, typename geometry_traits<geometry_type_2>::geometry_concept());
+ return typename geometry_traits<geometry_type_1>::geometry_concept().contains(geometry_object, contained_geometry_object,
+ consider_touch, typename geometry_traits<geometry_type_2>::geometry_concept());
}
template <typename geometry_type_1, typename geometry_type_2>
Modified: sandbox/gtl/gtl/interval_concept.h
==============================================================================
--- sandbox/gtl/gtl/interval_concept.h (original)
+++ sandbox/gtl/gtl/interval_concept.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -60,9 +60,9 @@
get(interval2, HIGH);
}
- template <typename interval_type, typename coordinate_type>
+ template <typename interval_type>
static bool contains(const interval_type& interval,
- coordinate_type value, bool consider_touch) {
+ typename interval_traits<interval_type>::coordinate_type value, bool consider_touch) {
if(consider_touch) {
return value <= get<HIGH>(interval) && value >= get<LOW>(interval);
} else {
@@ -72,8 +72,7 @@
template <typename interval_type, typename interval_type_2>
static bool contains(const interval_type& interval,
- const interval_type_2& value, bool consider_touch,
- interval_concept concept) {
+ const interval_type_2& value, bool consider_touch, interval_concept tag) {
return contains(interval, get(value, LOW), consider_touch) &&
contains(interval, get(value, HIGH), consider_touch);
}
Modified: sandbox/gtl/gtl/isotropy.h
==============================================================================
--- sandbox/gtl/gtl/isotropy.h (original)
+++ sandbox/gtl/gtl/isotropy.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -32,7 +32,7 @@
bool operator==(direction_1d d) const { return (val_ == d.val_); }
bool operator!=(direction_1d d) const { return !((*this) == d); }
unsigned int to_int(void) const { return val_; }
- direction_1d& backward() { val_ ^ 1; }
+ direction_1d& backward() { val_ ^= 1; return *this; }
};
class direction_2d;
Added: sandbox/gtl/gtl/iterator_geometry_to_set.h
==============================================================================
--- (empty file)
+++ sandbox/gtl/gtl/iterator_geometry_to_set.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -0,0 +1,309 @@
+/*
+ Copyright 2008 Intel Corporation
+
+ Use, modification and distribution are 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).
+*/
+template <typename concept_type, typename geometry_type>
+class iterator_geometry_to_set {};
+
+template <typename concept_type, typename iterator_type>
+class iterator_geometry_range_to_set {
+ typedef typename iterator_type::value_type geometry_type;
+ typedef iterator_geometry_to_set<concept_type, geometry_type> internal_iterator_type;
+ typedef typename internal_iterator_type::value_type value_type;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer; //immutable
+ typedef const value_type& reference; //immutable
+private:
+ iterator_type itr_;
+ mutable internal_iterator_type itrb_, itre_;
+ mutable bool dereferenced_;
+ orientation_2d orient_;
+public:
+ iterator_geometry_range_to_set(iterator_type itr,
+ orientation_2d orient = HORIZONTAL) :
+ itr_(itr), dereferenced_(false), orient_(orient) {}
+
+ inline iterator_geometry_range_to_set& operator++() {
+ if(!dereferenced_) **this;
+ if(itrb_ == itre_) {
+ ++itr_;
+ dereferenced_ = false;
+ } else {
+ ++itrb_;
+ if(itrb_ == itre_) {
+ ++itr_;
+ dereferenced_ = false;
+ }
+ }
+ return *this;
+ }
+ inline iterator_geometry_range_to_set operator++(int) {
+ iterator_geometry_range_to_set tmp(*this);
+ ++(*this);
+ return tmp;
+ }
+ inline bool operator==(const iterator_geometry_range_to_set& that) const {
+ return (itr_ == that.itr_);
+ }
+ inline bool operator!=(const iterator_geometry_range_to_set& that) const {
+ return !(*this == that);
+ }
+ inline reference operator*() const {
+ if(!dereferenced_) {
+ itrb_ = iterator_geometry_to_set<concept_type, geometry_type>(*itr_, LOW, orient_);
+ itre_ = iterator_geometry_to_set<concept_type, geometry_type>(*itr_, HIGH, orient_);
+ dereferenced_ = true;
+ }
+ return *itrb_;
+ }
+};
+
+template <typename rectangle_type>
+class iterator_geometry_to_set<rectangle_concept, rectangle_type> {
+public:
+ typedef typename rectangle_traits<rectangle_type>::coordinate_type coordinate_type;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef std::pair<coordinate_type, std::pair<coordinate_type, int> > value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer; //immutable
+ typedef const value_type& reference; //immutable
+private:
+ rectangle_data<coordinate_type> rectangle_;
+ mutable value_type vertex_;
+ unsigned int corner_;
+ orientation_2d orient_;
+public:
+ iterator_geometry_to_set() : corner_(4) {}
+ iterator_geometry_to_set(const rectangle_type& rectangle, direction_1d dir,
+ orientation_2d orient = HORIZONTAL) : corner_(0), orient_(orient) {
+ rectangle_concept::assign(rectangle_, rectangle);
+ if(dir == HIGH) corner_ = 4;
+ }
+ inline iterator_geometry_to_set& operator++() {
+ ++corner_;
+ return *this;
+ }
+ inline iterator_geometry_to_set operator++(int) {
+ iterator_geometry_to_set tmp(*this);
+ ++(*this);
+ return tmp;
+ }
+ inline bool operator==(const iterator_geometry_to_set& that) const {
+ return corner_ == that.corner_;
+ }
+ inline bool operator!=(const iterator_geometry_to_set& that) const {
+ return !(*this == that);
+ }
+ inline reference operator*() const {
+ if(corner_ == 0) {
+ vertex_.first = interval_concept::get(rectangle_concept::get(rectangle_, orient_.get_perpendicular()), LOW);
+ vertex_.second.first = interval_concept::get(rectangle_concept::get(rectangle_, orient_), LOW);
+ vertex_.second.second = 1;
+ } else if(corner_ == 1) {
+ vertex_.second.first = interval_concept::get(rectangle_concept::get(rectangle_, orient_), HIGH);
+ vertex_.second.second = -1;
+ } else if(corner_ == 2) {
+ vertex_.first = interval_concept::get(rectangle_concept::get(rectangle_, orient_.get_perpendicular()), HIGH);
+ vertex_.second.first = interval_concept::get(rectangle_concept::get(rectangle_, orient_), LOW);
+ } else {
+ vertex_.second.first = interval_concept::get(rectangle_concept::get(rectangle_, orient_), HIGH);
+ vertex_.second.second = 1;
+ }
+ return vertex_;
+ }
+};
+
+template <typename polygon_type>
+class iterator_geometry_to_set<polygon_concept, polygon_type> {
+public:
+ typedef typename polygon_traits<polygon_type>::coordinate_type coordinate_type;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef std::pair<coordinate_type, std::pair<coordinate_type, int> > value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer; //immutable
+ typedef const value_type& reference; //immutable
+ typedef typename polygon_traits<polygon_type>::iterator_type coord_iterator_type;
+private:
+ value_type vertex_;
+ iterator_compact_to_points<typename polygon_traits<polygon_type>::iterator_type,
+ point_data<typename polygon_traits<polygon_type>::coordinate_type> > itrb, itre;
+ bool last_vertex_;
+ bool is_hole_;
+ int multiplier_;
+ point_data<coordinate_type> first_pt, second_pt, pts[3];
+ bool use_wrap;
+ orientation_2d orient_;
+ int polygon_index;
+public:
+ iterator_geometry_to_set() : polygon_index(-1) {}
+ iterator_geometry_to_set(const polygon_type& polygon, direction_1d dir, orientation_2d orient = HORIZONTAL, bool is_hole = false) :
+ is_hole_(is_hole), orient_(orient), polygon_index(0) {
+ itrb = polygon_concept::begin_points(polygon);
+ itre = polygon_concept::end_points(polygon);
+ use_wrap = false;
+ if(itrb == itre || dir == HIGH || polygon_concept::size(polygon) < 4) {
+ polygon_index = -1;
+ } else {
+ direction_1d wdir = polygon_concept::winding(polygon);
+ multiplier_ = wdir == LOW ? -1 : 1;
+ if(is_hole_) multiplier_ *= -1;
+ first_pt = pts[0] = *itrb;
+ ++itrb;
+ second_pt = pts[1] = *itrb;
+ ++itrb;
+ pts[2] = *itrb;
+ }
+ evaluate_();
+ }
+
+ inline iterator_geometry_to_set& operator++() {
+ ++polygon_index;
+ if(itrb == itre) {
+ if(first_pt == pts[1]) polygon_index = -1;
+ else {
+ pts[0] = pts[1];
+ pts[1] = pts[2];
+ if(first_pt == pts[2]) {
+ pts[2] = second_pt;
+ } else {
+ pts[2] = first_pt;
+ }
+ }
+ } else {
+ ++itrb;
+ pts[0] = pts[1];
+ pts[1] = pts[2];
+ if(itrb == itre) {
+ if(first_pt == pts[2]) {
+ pts[2] = second_pt;
+ } else {
+ pts[2] = first_pt;
+ }
+ } else {
+ pts[2] = *itrb;
+ }
+ }
+ evaluate_();
+ return *this;
+ }
+ inline iterator_geometry_to_set operator++(int) {
+ iterator_geometry_to_set tmp(*this);
+ ++(*this);
+ return tmp;
+ }
+ inline bool operator==(const iterator_geometry_to_set& that) const {
+ return polygon_index == that.polygon_index;
+ }
+ inline bool operator!=(const iterator_geometry_to_set& that) const {
+ return !(*this == that);
+ }
+ inline reference operator*() const {
+ return vertex_;
+ }
+
+ inline void evaluate_() {
+ vertex_.first = pts[1].get(orient_.get_perpendicular());
+ vertex_.second.first =pts[1].get(orient_);
+ if(pts[0].get(HORIZONTAL) != pts[1].get(HORIZONTAL)) {
+ vertex_.second.second = -1;
+ } else {
+ vertex_.second.second = 1;
+ }
+ vertex_.second.second *= multiplier_;
+ }
+};
+
+template <typename polygon_with_holes_type>
+class iterator_geometry_to_set<polygon_with_holes_concept, polygon_with_holes_type> {
+public:
+ typedef typename rectangle_traits<polygon_with_holes_type>::coordinate_type coordinate_type;
+ typedef std::forward_iterator_tag iterator_category;
+ typedef std::pair<coordinate_type, std::pair<coordinate_type, int> > value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer; //immutable
+ typedef const value_type& reference; //immutable
+private:
+ iterator_geometry_to_set<polygon_concept, polygon_with_holes_type> itrb, itre;
+ iterator_geometry_to_set<polygon_concept, typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type> itrhib, itrhie;
+ typename polygon_with_holes_traits<polygon_with_holes_type>::iterator_holes_type itrhb, itrhe;
+ orientation_2d orient_;
+ bool started_holes;
+public:
+ iterator_geometry_to_set() {}
+ iterator_geometry_to_set(const polygon_with_holes_type& polygon, direction_1d dir,
+ orientation_2d orient = HORIZONTAL) : orient_(orient) {
+ itre = iterator_geometry_to_set<polygon_concept, polygon_with_holes_type>(polygon, HIGH, orient);
+ itrhe = polygon_with_holes_concept::end_holes(polygon);
+ if(dir == HIGH) {
+ itrb = itre;
+ itrhb = itrhe;
+ started_holes = true;
+ } else {
+ itrb = iterator_geometry_to_set<polygon_concept, polygon_with_holes_type>(polygon, LOW, orient);
+ itrhb = polygon_with_holes_concept::begin_holes(polygon);
+ started_holes = false;
+ }
+ }
+ inline iterator_geometry_to_set& operator++() {
+ //this code can be folded with flow control factoring
+ if(itrb == itre) {
+ if(itrhib == itrhie) {
+ if(itrhb != itrhe) {
+ itrhib = iterator_geometry_to_set<polygon_concept,
+ typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type>(*itrhb, LOW, orient_, true);
+ itrhie = iterator_geometry_to_set<polygon_concept,
+ typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type>(*itrhb, HIGH, orient_, true);
+ ++itrhb;
+ } else {
+ itrhib = itrhie = iterator_geometry_to_set<polygon_concept,
+ typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type>();
+ }
+ } else {
+ ++itrhib;
+ if(itrhib == itrhie) {
+ if(itrhb != itrhe) {
+ itrhib = iterator_geometry_to_set<polygon_concept,
+ typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type>(*itrhb, LOW, orient_, true);
+ itrhie = iterator_geometry_to_set<polygon_concept,
+ typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type>(*itrhb, HIGH, orient_, true);
+ ++itrhb;
+ } else {
+ itrhib = itrhie = iterator_geometry_to_set<polygon_concept,
+ typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type>();
+ }
+ }
+ }
+ } else {
+ ++itrb;
+ if(itrb == itre) {
+ if(itrhb != itrhe) {
+ itrhib = iterator_geometry_to_set<polygon_concept,
+ typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type>(*itrhb, LOW, orient_, true);
+ itrhie = iterator_geometry_to_set<polygon_concept,
+ typename polygon_with_holes_traits<polygon_with_holes_type>::hole_type>(*itrhb, HIGH, orient_, true);
+ ++itrhb;
+ }
+ }
+ }
+ return *this;
+ }
+ inline iterator_geometry_to_set operator++(int) {
+ iterator_geometry_to_set tmp(*this);
+ ++(*this);
+ return tmp;
+ }
+ inline bool operator==(const iterator_geometry_to_set& that) const {
+ return itrb == that.itrb && itrhb == that.itrhb && itrhib == that.itrhib;
+ }
+ inline bool operator!=(const iterator_geometry_to_set& that) const {
+ return !(*this == that);
+ }
+ inline reference operator*() const {
+ if(itrb != itre) return *itrb;
+ return *itrhib;
+ }
+};
Modified: sandbox/gtl/gtl/iterator_vertex_orient_conversion.h
==============================================================================
--- sandbox/gtl/gtl/iterator_vertex_orient_conversion.h (original)
+++ sandbox/gtl/gtl/iterator_vertex_orient_conversion.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -23,8 +23,6 @@
iter_(iter) {}
inline iterator_vertex_orient_conversion& operator++() {
++iter_;
- vertex_.first = (*iter_).second.first;
- vertex_.second = std::pair<coordinate_type, int>((*iter_).first, (*iter_).second.second);
return *this;
}
inline iterator_vertex_orient_conversion operator++(int) {
@@ -38,6 +36,10 @@
inline bool operator!=(const iterator_vertex_orient_conversion& that) const {
return (iter_ != that.iter_);
}
- inline reference operator*() const { return vertex_; }
+ inline reference operator*() const {
+ vertex_.first = (*iter_).second.first;
+ vertex_.second = std::pair<coordinate_type, int>((*iter_).first, (*iter_).second.second);
+ return vertex_;
+ }
};
Modified: sandbox/gtl/gtl/point_data.h
==============================================================================
--- sandbox/gtl/gtl/point_data.h (original)
+++ sandbox/gtl/gtl/point_data.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -19,6 +19,12 @@
}
template <typename T2>
inline point_data& operator=(const T2& rvalue);
+ inline bool operator==(const point_data& that) const {
+ return coords_[0] == that.coords_[0] && coords_[1] == that.coords_[1];
+ }
+ inline bool operator!=(const point_data& that) const {
+ return !((*this) == that);
+ }
inline coordinate_type get(orientation_2d orient) const {
return coords_[orient.to_int()];
}
Modified: sandbox/gtl/gtl/polygon_concept.h
==============================================================================
--- sandbox/gtl/gtl/polygon_concept.h (original)
+++ sandbox/gtl/gtl/polygon_concept.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -8,6 +8,12 @@
struct polygon_concept {
inline polygon_concept() {}
+ template <typename polygon_type>
+ struct registration {
+ typedef typename polygon_traits<polygon_type>::coordinate_type coordinate_type;
+ };
+
+
template<typename polygon_type, typename iterator_type>
static void set(polygon_type& polygon, iterator_type input_begin, iterator_type input_end) {
polygon_traits<polygon_type>::set(polygon, input_begin, input_end);
@@ -87,7 +93,7 @@
}
direction_1d dir = HIGH;
typedef typename polygon_traits<polygon_type>::coordinate_type coordinate_type;
- typedef typename polygon_traits<polygon_type>::iterator iterator;
+ typedef typename polygon_traits<polygon_type>::iterator_type iterator;
iterator itr = begin(polygon);
coordinate_type firstx = *itr;
coordinate_type minX = firstx;
@@ -312,6 +318,7 @@
move(0, displacement);
}
}
+
};
Modified: sandbox/gtl/gtl/polygon_formation.h
==============================================================================
--- sandbox/gtl/gtl/polygon_formation.h (original)
+++ sandbox/gtl/gtl/polygon_formation.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -336,7 +336,7 @@
//if it is horizontal we need to skip the first element
pLine_ = at->getTail();
index_ = at->getTail()->numSegments() - 1;
- if(at->getOrient() == HORIZONTAL ^ (orient == HORIZONTAL)) {
+ if((at->getOrient() == HORIZONTAL) ^ (orient == HORIZONTAL)) {
pLineEnd_ = at->getTail();
indexEnd_ = pLineEnd_->numSegments() - 1;
if(index_ == 0) {
@@ -1202,7 +1202,7 @@
nextPolyLinep = tailp_->writeOut(outVec);
}
Unit firsty = outVec[size + 1];
- if(getOrient() == HORIZONTAL ^ !isHole) {
+ if((getOrient() == HORIZONTAL) ^ !isHole) {
//our first coordinate is a y value, so we need to rotate it to the end
typename std::vector<Unit>::iterator tmpItr = outVec.begin();
tmpItr += size;
@@ -1215,7 +1215,7 @@
nextPolyLinep = nextPolyLinep->writeOut(outVec, startEnd);
startEnd = nextStartEnd;
}
- if(getOrient() == HORIZONTAL ^ !isHole) {
+ if((getOrient() == HORIZONTAL) ^ !isHole) {
//we want to push the y value onto the end since we ought to have ended with an x
outVec.push_back(firsty); //should never be executed because we want first value to be an x
}
Modified: sandbox/gtl/gtl/polygon_set_data.h
==============================================================================
--- sandbox/gtl/gtl/polygon_set_data.h (original)
+++ sandbox/gtl/gtl/polygon_set_data.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -119,6 +119,11 @@
std::sort(data_.begin(), data_.end());
unsorted_ = false;
}
+
+ void set(const value_type& value, orientation_2d orient) {
+ data_ = value;
+ orient_ = orient;
+ }
private:
orientation_2d orient_;
mutable value_type data_;
Modified: sandbox/gtl/gtl/polygon_set_traits.h
==============================================================================
--- sandbox/gtl/gtl/polygon_set_traits.h (original)
+++ sandbox/gtl/gtl/polygon_set_traits.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -13,16 +13,16 @@
typedef typename T::operator_arg_type operator_arg_type;
static inline iterator_type begin(const T& polygon_set) {
- return polygon_set.value.begin();
+ return polygon_set.begin();
}
static inline iterator_type end(const T& polygon_set) {
- return polygon_set.value.end();
+ return polygon_set.end();
}
- static inline void insert(T& polygon_set, const std::vector<std::pair<coordinate_type, std::pair<coordinate_type, int> > >& value,
- orientation_2d orient) {
- polygon_set.insert(value, orient);
+ static inline void set(T& polygon_set, const std::vector<std::pair<coordinate_type, std::pair<coordinate_type, int> > >& value,
+ orientation_2d orient) {
+ polygon_set.set(value, orient);
}
static inline orientation_2d orient(const T& polygon_set) { return polygon_set.orient(); }
Modified: sandbox/gtl/gtl/polygon_set_view.h
==============================================================================
--- sandbox/gtl/gtl/polygon_set_view.h (original)
+++ sandbox/gtl/gtl/polygon_set_view.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -91,7 +91,7 @@
const rtype& rvalue,
orientation_2d orient,
op_type op) :
- lvalue_(lvalue), rvalue_(rvalue), orient_(orient), op_(op) {}
+ lvalue_(lvalue), rvalue_(rvalue), op_(op), orient_(orient) {}
/// get iterator to begin vertex data
const value_type& value() const {
@@ -151,7 +151,7 @@
const rtype& rvalue,
orientation_2d orient,
op_type op) :
- lvalue_(lvalue), rvalue_(rvalue), orient_(orient), op_(op) {}
+ lvalue_(lvalue), rvalue_(rvalue), op_(op) , orient_(orient) {}
/// get iterator to begin vertex data
const value_type& value() const {
@@ -201,7 +201,7 @@
const rtype& rvalue,
orientation_2d orient,
op_type op) :
- lvalue_(lvalue), rvalue_(rvalue), orient_(orient), op_(op) {}
+ lvalue_(lvalue), rvalue_(rvalue), op_(op), orient_(orient) {}
/// get iterator to begin vertex data
const value_type& value() const {
Added: sandbox/gtl/gtl/polygon_set_wrapper.h
==============================================================================
--- (empty file)
+++ sandbox/gtl/gtl/polygon_set_wrapper.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -0,0 +1,80 @@
+/*
+ Copyright 2008 Intel Corporation
+
+ Use, modification and distribution are 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).
+*/
+template <typename T>
+class polygon_set_const_wrapper {
+private:
+ const T& t_;
+public:
+ typedef typename T::value_type geometry_type;
+ typedef typename geometry_traits<geometry_type>::geometry_concept geometry_concept;
+ typedef typename geometry_concept::template registration<geometry_type>::coordinate_type coordinate_type;
+ typedef iterator_geometry_range_to_set<geometry_concept, typename T::const_iterator> iterator_type;
+ typedef polygon_set_const_wrapper operator_arg_type;
+ typedef operator_requires_copy operator_storage_tag;
+
+ polygon_set_const_wrapper(const T& t) : t_(t) {}
+
+ inline iterator_type begin() const {
+ return iterator_type(t_.begin());
+ }
+
+ inline iterator_type end(const T& polygon_set) const {
+ return iterator_type(t_.end());
+ }
+
+ inline orientation_2d orient() const { return HORIZONTAL; }
+
+ inline bool dirty(const T& polygon_set) const { return true; }
+
+ inline bool sorted(const T& polygon_set) const { return false; }
+
+};
+
+template <typename T>
+polygon_set_const_wrapper<T> wrap_const(const T& t) {
+ return polygon_set_const_wrapper<T>(t);
+}
+
+template <typename T>
+class polygon_set_wrapper {
+private:
+ T& t_;
+public:
+ typedef typename T::value_type geometry_type;
+ typedef typename geometry_traits<geometry_type>::geometry_concept geometry_concept;
+ typedef typename geometry_concept::template registration<geometry_type>::coordinate_type coordinate_type;
+ typedef iterator_geometry_range_to_set<geometry_concept, typename T::const_iterator> iterator_type;
+ typedef polygon_set_wrapper operator_arg_type;
+ typedef operator_requires_copy operator_storage_tag;
+
+ inline polygon_set_wrapper(T& t) : t_(t) {}
+
+ inline iterator_type begin() const {
+ return iterator_type(t_.begin());
+ }
+
+ inline iterator_type end(const T& polygon_set) const {
+ return iterator_type(t_.end());
+ }
+
+ inline void set(const std::vector<std::pair<coordinate_type, std::pair<coordinate_type, int> > >& value,
+ orientation_2d orient) {
+ }
+
+ inline orientation_2d orient() const { return HORIZONTAL; }
+
+ inline bool dirty(const T& polygon_set) const { return true; }
+
+ inline bool sorted(const T& polygon_set) const { return false; }
+
+};
+
+template <typename T>
+polygon_set_const_wrapper<T> wrap(const T& t) {
+ return polygon_set_wrapper<T>(t);
+}
Modified: sandbox/gtl/gtl/rectangle_concept.h
==============================================================================
--- sandbox/gtl/gtl/rectangle_concept.h (original)
+++ sandbox/gtl/gtl/rectangle_concept.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -96,12 +96,14 @@
template <typename rectangle_type, typename rectangle_type2>
static bool contains(const rectangle_type& rectangle, const rectangle_type2 rectangle_contained,
bool consider_touch, rectangle_concept tag) {
- std::cout << "rectangle contains rectangle\n";
+ return interval_concept::contains(get<HORIZONTAL>(rectangle), get<HORIZONTAL>(rectangle_contained), consider_touch, interval_concept()) &&
+ interval_concept::contains(get<VERTICAL>(rectangle), get<VERTICAL>(rectangle_contained), consider_touch, interval_concept());
}
template <typename rectangle_type, typename point_type>
static bool contains(const rectangle_type& rectangle, const point_type point_contained,
bool consider_touch, point_concept tag) {
- std::cout << "rectangle contains point\n";
+ return interval_concept::contains(get<HORIZONTAL>(rectangle), point_concept::get<HORIZONTAL>(point_contained), consider_touch) &&
+ interval_concept::contains(get<VERTICAL>(rectangle), point_concept::get<VERTICAL>(point_contained), consider_touch);
}
template <typename rectangle_type_1, typename rectangle_type_2>
Modified: sandbox/gtl/gtl/rectangle_data.h
==============================================================================
--- sandbox/gtl/gtl/rectangle_data.h (original)
+++ sandbox/gtl/gtl/rectangle_data.h 2008-05-19 13:06:42 EDT (Mon, 19 May 2008)
@@ -13,7 +13,7 @@
template <typename interval_type_1, typename interval_type_2>
inline rectangle_data(const interval_type_1& hrange,
const interval_type_2& vrange) {
- set(HORIZONTAL, hrange); set(VERTICAL, hrange); }
+ set(HORIZONTAL, hrange); set(VERTICAL, vrange); }
inline rectangle_data(const rectangle_data& that) { (*this) = that; }
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk