add boost on mac
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2014-2015, Oracle and/or its affiliates.
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_COMPARE_TURNS_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_COMPARE_TURNS_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace detail { namespace turns
|
||||
{
|
||||
|
||||
// TURNS SORTING AND SEARCHING
|
||||
|
||||
// sort turns by G1 - source_index == 0 by:
|
||||
// seg_id -> fraction -> other_id -> operation
|
||||
template
|
||||
<
|
||||
typename IdLess = std::less<signed_size_type>,
|
||||
int N = 0, int U = 1, int I = 2, int B = 3, int C = 4, int O = 0,
|
||||
std::size_t OpId = 0
|
||||
>
|
||||
struct less_seg_fraction_other_op
|
||||
{
|
||||
BOOST_STATIC_ASSERT(OpId < 2);
|
||||
static const std::size_t other_op_id = (OpId + 1) % 2;
|
||||
|
||||
template <typename Op>
|
||||
static inline int order_op(Op const& op)
|
||||
{
|
||||
switch (op.operation)
|
||||
{
|
||||
case detail::overlay::operation_none : return N;
|
||||
case detail::overlay::operation_union : return U;
|
||||
case detail::overlay::operation_intersection : return I;
|
||||
case detail::overlay::operation_blocked : return B;
|
||||
case detail::overlay::operation_continue : return C;
|
||||
case detail::overlay::operation_opposite : return O;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
template <typename Op>
|
||||
static inline bool use_operation(Op const& left, Op const& right)
|
||||
{
|
||||
return order_op(left) < order_op(right);
|
||||
}
|
||||
|
||||
template <typename Turn>
|
||||
static inline bool use_other_id(Turn const& left, Turn const& right)
|
||||
{
|
||||
segment_identifier const& left_other_seg_id = left.operations[other_op_id].seg_id;
|
||||
segment_identifier const& right_other_seg_id = right.operations[other_op_id].seg_id;
|
||||
|
||||
if ( left_other_seg_id.multi_index != right_other_seg_id.multi_index )
|
||||
{
|
||||
return left_other_seg_id.multi_index < right_other_seg_id.multi_index;
|
||||
}
|
||||
if ( left_other_seg_id.ring_index != right_other_seg_id.ring_index )
|
||||
{
|
||||
return left_other_seg_id.ring_index != right_other_seg_id.ring_index;
|
||||
}
|
||||
if ( left_other_seg_id.segment_index != right_other_seg_id.segment_index )
|
||||
{
|
||||
return IdLess()(left_other_seg_id.segment_index,
|
||||
right_other_seg_id.segment_index);
|
||||
}
|
||||
return use_operation(left.operations[OpId], right.operations[OpId]);
|
||||
}
|
||||
|
||||
template <typename Turn>
|
||||
static inline bool use_fraction(Turn const& left, Turn const& right)
|
||||
{
|
||||
return
|
||||
geometry::math::equals(left.operations[OpId].fraction,
|
||||
right.operations[OpId].fraction)
|
||||
?
|
||||
use_other_id(left, right)
|
||||
:
|
||||
(left.operations[OpId].fraction < right.operations[OpId].fraction)
|
||||
;
|
||||
}
|
||||
|
||||
template <typename Turn>
|
||||
inline bool operator()(Turn const& left, Turn const& right) const
|
||||
{
|
||||
segment_identifier const& sl = left.operations[OpId].seg_id;
|
||||
segment_identifier const& sr = right.operations[OpId].seg_id;
|
||||
|
||||
return sl < sr || ( sl == sr && use_fraction(left, right) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace detail::turns
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_COMPARE_TURNS_HPP
|
||||
@@ -0,0 +1,65 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2014, Oracle and/or its affiliates.
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_DEBUG_TURN_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_DEBUG_TURN_HPP
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_TURNS
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#include <boost/geometry/io/wkt/write.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
#endif // BOOST_GEOMETRY_DEBUG_TURNS
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace turns
|
||||
{
|
||||
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_TURNS
|
||||
template <typename Turn, typename Operation>
|
||||
inline void debug_turn(Turn const& turn, Operation op,
|
||||
std::string const& header)
|
||||
{
|
||||
std::cout << header
|
||||
<< " at " << op.seg_id
|
||||
<< " meth: " << method_char(turn.method)
|
||||
<< " op: " << operation_char(op.operation)
|
||||
<< " of: " << operation_char(turn.operations[0].operation)
|
||||
<< operation_char(turn.operations[1].operation)
|
||||
<< " " << geometry::wkt(turn.point)
|
||||
<< std::endl;
|
||||
|
||||
if (boost::contains(header, "Finished"))
|
||||
{
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
#else
|
||||
template <typename Turn, typename Operation>
|
||||
inline void debug_turn(Turn const& , Operation, const char*)
|
||||
{
|
||||
}
|
||||
#endif // BOOST_GEOMETRY_DEBUG_TURNS
|
||||
|
||||
|
||||
}} // namespace detail::turns
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
}} // namespace boost:geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_DEBUG_TURN_HPP
|
||||
@@ -0,0 +1,78 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2014, Oracle and/or its affiliates.
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_FILTER_CONTINUE_TURNS_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_FILTER_CONTINUE_TURNS_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace detail { namespace turns
|
||||
{
|
||||
|
||||
|
||||
template <typename Turns, bool Enable>
|
||||
struct filter_continue_turns
|
||||
{
|
||||
static inline void apply(Turns&) {}
|
||||
};
|
||||
|
||||
|
||||
template <typename Turns>
|
||||
class filter_continue_turns<Turns, true>
|
||||
{
|
||||
private:
|
||||
class IsContinueTurn
|
||||
{
|
||||
private:
|
||||
template <typename Operation>
|
||||
inline bool is_continue_or_opposite(Operation const& operation) const
|
||||
{
|
||||
return operation == detail::overlay::operation_continue
|
||||
|| operation == detail::overlay::operation_opposite;
|
||||
}
|
||||
|
||||
public:
|
||||
template <typename Turn>
|
||||
bool operator()(Turn const& turn) const
|
||||
{
|
||||
if ( turn.method != detail::overlay::method_collinear
|
||||
&& turn.method != detail::overlay::method_equal )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return is_continue_or_opposite(turn.operations[0].operation)
|
||||
&& is_continue_or_opposite(turn.operations[1].operation);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
static inline void apply(Turns& turns)
|
||||
{
|
||||
turns.erase( std::remove_if(turns.begin(), turns.end(),
|
||||
IsContinueTurn()),
|
||||
turns.end()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}} // namespace detail::turns
|
||||
|
||||
}} // namespect boost::geometry
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_FILTER_CONTINUE_TURNS_HPP
|
||||
@@ -0,0 +1,105 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2014, Oracle and/or its affiliates.
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_PRINT_TURNS_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_PRINT_TURNS_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/range.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
#include <boost/geometry/io/wkt/write.hpp>
|
||||
#include <boost/geometry/io/dsv/write.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace detail { namespace turns
|
||||
{
|
||||
|
||||
struct turn_printer
|
||||
{
|
||||
turn_printer(std::ostream & os)
|
||||
: index(0)
|
||||
, out(os)
|
||||
{}
|
||||
|
||||
template <typename Turn>
|
||||
void operator()(Turn const& turn)
|
||||
{
|
||||
out << index
|
||||
<< ": " << geometry::method_char(turn.method);
|
||||
|
||||
if ( turn.discarded )
|
||||
out << " (discarded)\n";
|
||||
else if ( turn.blocked() )
|
||||
out << " (blocked)\n";
|
||||
else
|
||||
out << '\n';
|
||||
|
||||
double fraction[2];
|
||||
|
||||
fraction[0] = turn.operations[0].fraction.numerator()
|
||||
/ turn.operations[0].fraction.denominator();
|
||||
|
||||
out << geometry::operation_char(turn.operations[0].operation)
|
||||
<<": seg: " << turn.operations[0].seg_id.source_index
|
||||
<< ", m: " << turn.operations[0].seg_id.multi_index
|
||||
<< ", r: " << turn.operations[0].seg_id.ring_index
|
||||
<< ", s: " << turn.operations[0].seg_id.segment_index;
|
||||
out << ", fr: " << fraction[0];
|
||||
out << ", col?: " << turn.operations[0].is_collinear;
|
||||
out << ' ' << geometry::dsv(turn.point) << ' ';
|
||||
|
||||
out << '\n';
|
||||
|
||||
fraction[1] = turn.operations[1].fraction.numerator()
|
||||
/ turn.operations[1].fraction.denominator();
|
||||
|
||||
out << geometry::operation_char(turn.operations[1].operation)
|
||||
<< ": seg: " << turn.operations[1].seg_id.source_index
|
||||
<< ", m: " << turn.operations[1].seg_id.multi_index
|
||||
<< ", r: " << turn.operations[1].seg_id.ring_index
|
||||
<< ", s: " << turn.operations[1].seg_id.segment_index;
|
||||
out << ", fr: " << fraction[1];
|
||||
out << ", col?: " << turn.operations[1].is_collinear;
|
||||
out << ' ' << geometry::dsv(turn.point) << ' ';
|
||||
|
||||
++index;
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
int index;
|
||||
std::ostream & out;
|
||||
};
|
||||
|
||||
template <typename Geometry1, typename Geometry2, typename Turns>
|
||||
static inline void print_turns(Geometry1 const& g1,
|
||||
Geometry2 const& g2,
|
||||
Turns const& turns)
|
||||
{
|
||||
std::cout << geometry::wkt(g1) << std::endl;
|
||||
std::cout << geometry::wkt(g2) << std::endl;
|
||||
|
||||
std::for_each(boost::begin(turns), boost::end(turns), turn_printer(std::cout));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace detail::turns
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_PRINT_TURNS_HPP
|
||||
@@ -0,0 +1,62 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
|
||||
// Copyright (c) 2014, Oracle and/or its affiliates.
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/geometry/algorithms/equals.hpp>
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
|
||||
namespace detail { namespace turns
|
||||
{
|
||||
|
||||
template <typename Turns, bool Enable>
|
||||
struct remove_duplicate_turns
|
||||
{
|
||||
static inline void apply(Turns&) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename Turns>
|
||||
class remove_duplicate_turns<Turns, true>
|
||||
{
|
||||
private:
|
||||
struct TurnEqualsTo
|
||||
{
|
||||
template <typename Turn>
|
||||
bool operator()(Turn const& t1, Turn const& t2) const
|
||||
{
|
||||
return geometry::equals(t1.point, t2.point)
|
||||
&& t1.operations[0].seg_id == t2.operations[0].seg_id
|
||||
&& t1.operations[1].seg_id == t2.operations[1].seg_id;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
static inline void apply(Turns& turns)
|
||||
{
|
||||
turns.erase( std::unique(turns.begin(), turns.end(),
|
||||
TurnEqualsTo()),
|
||||
turns.end()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}} // namespace detail::turns
|
||||
|
||||
}} // namespect boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
|
||||
Reference in New Issue
Block a user