Пример #1
0
bool operator== (const rset<Type1, Type2, Type1Equality, Type2Equality>& x,
                 const rset<Type1, Type2, Type1Equality, Type2Equality>& y)
{
    typedef rset<Type1, Type2, Type1Equality, Type2Equality> set_type;
    typedef typename set_type::const_iterator                iterator;
    typedef typename set_type::first_compare_type            first_compare_type;
    typedef typename set_type::second_compare_type           second_compare_type;

    if (x.size() != y.size())
        return false;

    iterator            x_iter(x.begin());
    iterator            x_last(x.end());
    iterator            y_iter(y.begin());
    first_compare_type  pred1(x.first_compare());
    second_compare_type pred2(x.second_compare());

    for (; x_iter != x_last; ++x_iter, ++y_iter)
        if (!pred1(x_iter->first, y_iter->first) ||
            !pred2(x_iter->second, y_iter->second))
            return false;

    return true;
}
Пример #2
0
void 
TraceHistoryRenderer::render_filled_posneg(ChartRenderer &chart,
                                           const TraceVariableHistory& var) const
{
  fixed x_last(fixed(0)), y_last(fixed(0));
  unsigned i=0;
  for (auto it = var.begin(); it != var.end(); ++it, ++i) {
    fixed x= fixed(i);
    fixed y= *it;
    if (i) {
      if (sgn(y)*sgn(y_last)<0) {
        if (positive(y_last))
          chart.DrawFilledLine(x_last, y_last, x_last+fixed(0.5), fixed(0),
                               vario_look.lift_brush);
        else if (negative(y_last))
          chart.DrawFilledLine(x_last, y_last, x_last+fixed(0.5), fixed(0),
                               vario_look.sink_brush);

        x_last = x-fixed(0.5);
        y_last = fixed(0);

      }
      if (positive(y) || positive(y_last))
        chart.DrawFilledLine(x_last, y_last, x, y, vario_look.lift_brush);
      else if (negative(y) || negative(y_last))
        chart.DrawFilledLine(x_last, y_last, x, y, vario_look.sink_brush);
    }
    x_last = x;
    y_last = y;
  }
  if (look.inverse)
    chart.GetCanvas().SelectWhiteBrush();
  else
    chart.GetCanvas().SelectBlackBrush();
  chart.DrawDot(x_last, y_last, Layout::Scale(2));
}