Example #1
0
    std::string stream_turn_index(Turns const& turns, Turn const& turn, Operation const& op)
    {
        std::ostringstream out;

        if (turn.cluster_id >= 0)
        {
            out << "cl=" << turn.cluster_id << " ";
        }

        // Because turn index is unknown here, and still useful for debugging,
        std::size_t index = 0;
        for (typename Turns::const_iterator it = turns.begin();
           it != turns.end(); ++it, ++index)
        {
          Turn const& t = *it;
          if (&t == &turn)
          {
              out << index;
              break;
          }
        }

        if (&op == &turn.operations[0]) { out << "[0]"; }
        if (&op == &turn.operations[1]) { out << "[1]"; }
        return out.str();
    }
 static inline void apply(Turns& turns)
 {
     turns.erase( std::remove_if(turns.begin(), turns.end(),
                                 IsContinueTurn()),
                  turns.end()
                  );
 }
 static inline void apply(Turns& turns)
 {
     turns.erase( std::unique(turns.begin(), turns.end(),
                              TurnEqualsTo()),
                  turns.end()
                  );
 }
 static inline int inside_or_outside_turn(Turns const& turns)
 {
     using namespace overlay;
     for (typename Turns::const_iterator it = turns.begin();
             it != turns.end(); ++it)
     {
         operation_type op0 = it->operations[0].operation;
         operation_type op1 = it->operations[1].operation;
         if (op0 == operation_intersection && op1 == operation_intersection)
         {
             return 1; // inside
         }
         else if (op0 == operation_union && op1 == operation_union)
         {
             return -1; // outside
         }
     }
     return 0;
 }
Example #5
0
 inline void merge_turns(Turns& rhs)
 {
     std::move(rhs.begin(),rhs.end(),std::back_inserter(m_turns));
 }