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::graphViewOrdered::drawOrderedByX( painter &Painter, const pairScales& Scales, sequence::data::iterator Begin, sequence::data::iterator End ) const 
{
  if ( Begin == End )
    return;

  if ( Scales.numberToFractionX((End-1)->x()) < 0 )
    return;
  if ( Scales.numberToFractionX(Begin->x()) > 1 )
    return;

  checkIsLessThan Checker(Scales);
  sequence::data::iterator BeginVisbile = Checker(0,*Begin)   ? Begin : std::lower_bound( Begin,        End, static_cast<fcoord>(0), Checker );
  if ( BeginVisbile != Begin )
    --BeginVisbile;
  sequence::data::iterator EndVisible   = Checker(*(End-1),1) ? End   : std::upper_bound( BeginVisbile, End, static_cast<fcoord>(1), Checker );
  if ( EndVisible != End )
    ++EndVisible;
  drawUnorderedByX( Painter, Scales, BeginVisbile, EndVisible );
}
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;
}
예제 #5
0
scigraphics::number scigraphics::selectionHorizontal::minF( const pairScales &Scales ) const 
{ 
  return Scales.numberToFractionY(min()); 
}
예제 #6
0
void scigraphics::selectionStrip::shiftPointsF( fpoint From, fpoint To, const pairScales &Scales )
{
  npoint NFrom = Scales.fpoint2npoint( From );
  npoint NTo   = Scales.fpoint2npoint( To );
  shiftPoints( NFrom, NTo );
}
예제 #7
0
void scigraphics::selectionStrip::setIntervalPointsF( const fpoint &A, const fpoint &B, const pairScales &Scales )
{
  npoint NA = Scales.fpoint2npoint( A );
  npoint NB = Scales.fpoint2npoint( B );
  setIntervalPoints( NA, NB );
}
예제 #8
0
scigraphics::fpoint scigraphics::selection::secondCornerF( const pairScales& Scales ) const
{
  return Scales.npoint2fpoint( secondCorner() );
}
예제 #9
0
scigraphics::number scigraphics::selectionVertical::maxF( const pairScales &Scales ) const 
{ 
  return Scales.numberToFractionX(max()); 
}
예제 #10
0
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;
    }

  }

}