void scigraphics::sequence::graphViewErrorBars::drawVerticalErrorBar( painter &Painter, const pairScales& Scales, const npoint &Point, number ErrY ) const
{
  if ( ErrY <= 0 )
    return;
  const fpoint Min = Scales.npoint2fpoint(npoint( Point.x(), Point.y() - ErrY ));
  const fpoint Max = Scales.npoint2fpoint(npoint( Point.x(), Point.y() + ErrY ));
  Painter.drawVerticalErrorBarF( Min, Max, getStyle() );
}
void scigraphics::sequence::graphViewPoints::drawUnorderedByX( painter &Painter, const pairScales& Scales, sequence::data::iterator Begin, sequence::data::iterator End ) const
{
  if ( getStyle().getShape() == pointStyle::None )
    return;

  for ( sequence::data::iterator Point = Begin; Point != End; ++Point )
  {
    if ( ! Point->isValid() )
      continue;
    const fpoint FPoint = Scales.npoint2fpoint( npoint(*Point) );
    Painter.drawPointF( FPoint, getStyle() );
  }
}
scigraphics::sequence::data::iterator scigraphics::sequence::graphViewCoveredArea::fillPolygonVector( sequence::data::iterator Begin, sequence::data::iterator End, const pairScales& Scales, 
  std::vector<fpoint> *Polygon )
{
  assert( Polygon != NULL );

  Polygon->clear();
  Polygon->reserve( 1024 );

  sequence::data::iterator Point = Begin;
  while ( Point != End && Point->isValid() )
  {
    const fpoint FPoint = Scales.npoint2fpoint( npoint(*Point) );
    Polygon->push_back( FPoint );
    ++Point;
  }

  if ( Point != End )
    ++Point;
  return Point;
}
예제 #4
0
scigraphics::fpoint scigraphics::selection::secondCornerF( const pairScales& Scales ) const
{
  return Scales.npoint2fpoint( secondCorner() );
}
void scigraphics::sequence::graphViewGeneralLine::drawUnorderedByX( painter &Painter, const pairScales& Scales, sequence::data::iterator Begin, sequence::data::iterator End ) const
{
  if ( getStyle().getStyle() == lineStyle::None )
    return;

  if ( Begin == End )
    return;

  const size_t MaxPolylineSize = 2*std::min<size_t>( ( End - Begin ), std::max( Painter.width(), Painter.height() ) ) + 128;
  
  std::vector< wpoint > Polyline;
  Polyline.reserve( MaxPolylineSize );

  pointsWithSameXCoord PointsWithSameXCoord;

  sequence::data::iterator Point = Begin;

  Painter.setLineStyle( getStyle() );
  while ( true )
  {
    if ( Point == End )
    {
      PointsWithSameXCoord.addToPolyline( &Polyline );
      drawLineBetweenPoints( Painter, &Polyline );
      break;
    }

    if ( Point->isValid() )
    {
      const fpoint CurrFPoint = Scales.npoint2fpoint(*Point);
      if ( PointsWithSameXCoord.canSeparate( Painter, CurrFPoint ) )
      {
        PointsWithSameXCoord.addToPolyline( &Polyline );
        PointsWithSameXCoord.clear();
        if ( Polyline.size() >= MaxPolylineSize )
        {
          const wpoint LastPoint = Polyline.back();
          drawLineBetweenPoints( Painter, &Polyline );
          Polyline.clear();
          Polyline.reserve( MaxPolylineSize );
          Polyline.push_back( LastPoint );
        }
      }
      PointsWithSameXCoord.append( Painter, CurrFPoint );
      ++Point;
      continue;
    }
    
    {
      assert( ! Point->isValid() );
      PointsWithSameXCoord.addToPolyline( &Polyline );
      PointsWithSameXCoord.clear();
      drawLineBetweenPoints( Painter, &Polyline );
      Polyline.clear();

      ++Point;
      while ( Point != End && ! Point->isValid() )
        ++Point;
    }

  }

}