コード例 #1
0
    // Note that left/right do NOT correspond to m_geometry1/m_geometry2
    // but to the "indexed_turn_operation"
    inline bool operator()(Indexed const& left, Indexed const& right) const
    {
        segment_identifier const& sl = left.subject.seg_id;
        segment_identifier const& sr = right.subject.seg_id;

        if (sl == sr
            && geometry::math::equals(left.subject.enriched.distance
                    , right.subject.enriched.distance))
        {
            // Both left and right are located on the SAME segment.

            // First check "real" intersection (crosses)
            // -> distance zero due to precision, solve it by sorting
            if (m_turn_points[left.index].method == method_crosses
                && m_turn_points[right.index].method == method_crosses)
            {
                return consider_relative_order(left, right);
            }

            // If that is not the case, cluster it later on.
            // Indicate that this is necessary.
            *m_clustered = true;

            return left.index < right.index;
        }
        return sl == sr
            ? left.subject.enriched.distance < right.subject.enriched.distance
            : sl < sr;

    }
コード例 #2
0
    // Note that left/right do NOT correspond to m_geometry1/m_geometry2
    // but to the "indexed_turn_operation"
    inline bool operator()(Indexed const& left, Indexed const& right) const
    {
        if (! (left.subject->seg_id == right.subject->seg_id))
        {
            return left.subject->seg_id < right.subject->seg_id;
        }

        // Both left and right are located on the SAME segment.

        if (! (left.subject->fraction == right.subject->fraction))
        {
            return left.subject->fraction < right.subject->fraction;
        }


        typedef typename boost::range_value<Turns>::type turn_type;
        turn_type const& left_turn = m_turns[left.turn_index];
        turn_type const& right_turn = m_turns[right.turn_index];

        // First check "real" intersection (crosses)
        // -> distance zero due to precision, solve it by sorting
        if (left_turn.method == method_crosses
            && right_turn.method == method_crosses)
        {
            return consider_relative_order(left, right);
        }

        bool const left_both_xx = left_turn.both(operation_blocked);
        bool const right_both_xx = right_turn.both(operation_blocked);
        if (left_both_xx && ! right_both_xx)
        {
            return true;
        }
        if (! left_both_xx && right_both_xx)
        {
            return false;
        }

        bool const left_both_uu = left_turn.both(operation_union);
        bool const right_both_uu = right_turn.both(operation_union);
        if (left_both_uu && ! right_both_uu)
        {
            return true;
        }
        if (! left_both_uu && right_both_uu)
        {
            return false;
        }

        return default_order(left, right);
    }