Exemple #1
0
void scigraphics::painter::drawPointW( const wpoint &Point, const pointStyle &Style )
{
  if ( ! ableToDraw() )
    return;

  brushStyle BrushStyle( Style.getColor() );

  switch ( Style.getShape() )
  {
    case pointStyle::None:
      break;

    case pointStyle::Square:
      {
        wpoint LU( Point.x() - Style.width()/2, Point.y() - Style.width()/2 );
        wpoint RD( LU.x() + Style.width(), LU.y() + Style.width() );
        Drawer->setBrushStyle( BrushStyle );
        Drawer->setLineStyle( lineStyle(BrushStyle.getColor()) );
        Drawer->drawRectangle( wrectangle(LU,RD) );
      }
      break;

    default:
      abort();
  }
}
Exemple #2
0
void scigraphics::painter::drawTextW( const std::string &String, wpoint Point, unsigned Position, 
        const textStyle &Style, int ShiftLeft, int ShiftUp, double Angle )
{
  if ( ! ableToDraw() )
    return;

  int Width  = Drawer->textWidth( String, Style );
  int Height = Drawer->textHeight( String, Style );

  switch ( Position & 0x00FF )
  {
    case HLeft:        ShiftLeft += 0;          break;
    case HRight:       ShiftLeft += Width;      break;
    case HCenter:      ShiftLeft += Width/2;    break;
  }

  switch ( Position & 0xFF00 )
  {
    case VUp:          ShiftUp += 0;            break;
    case VDown:        ShiftUp += Height;       break;
    case VCenter:      ShiftUp += Height/2;     break;
  }

  wpoint LU( Point.x() - ShiftLeft, Point.y() - ShiftUp );
  wpoint RD( LU.x() + Width, LU.y() + Height );

  Drawer->setTextStyle( Style );
  Drawer->drawText( String, wrectangle(LU,RD), Angle );
}
Exemple #3
0
scigraphics::fpoint scigraphics::painter::wpoint2fpoint( wpoint Pt ) const
{
  if ( PlotRectangle.width() <= 0 || PlotRectangle.height() <= 0 )
    return fpoint(0,0);

  fcoord X = wcoord2fcoordX( Pt.x() ); 
  fcoord Y = wcoord2fcoordY( Pt.y() ); 

  return fpoint( X, Y );
}
Exemple #4
0
void scigraphics::legend::setRectangleFromLegendSize( painter &Painter, const legendSize &LegendSize )
{
  const wpoint LeftUp = getRectangle().leftUp();
  const wpoint RightDown( LeftUp.x() + LegendSize.width(), LeftUp.y() - LegendSize.height() );

  wrectangle LegendRectangle( LeftUp, RightDown );

  if ( LegendRectangle.width() < Painter.plotWidth() )
  {
    while ( LegendRectangle.right() > Painter.plotWidth() ) 
      LegendRectangle.moveX( -1 );
  }

  if ( LegendRectangle.height() < Painter.plotHeight() )
  {
    while ( LegendRectangle.down() < 0 )
      LegendRectangle.moveY( +1 );
  }

  setRectangle( LegendRectangle );
}
Exemple #5
0
void scigraphics::painter::drawHorizontalErrorBarW( const wpoint &Min, const wpoint &Max, const errorBarStyle &Style )
{
  assert( Min.y() == Max.y() );
  
  lineStyle LineStyle = Style.getLineStyle();
  wcoord HatWidth = Style.hatWidth();
  wcoord Y = Min.y();

  drawLineW( Min, Max, LineStyle );
  drawLineW( wpoint(Min.x(),Y-HatWidth), wpoint(Min.x(),Y+HatWidth), LineStyle );
  drawLineW( wpoint(Max.x(),Y-HatWidth), wpoint(Max.x(),Y+HatWidth), LineStyle );
}
Exemple #6
0
void scigraphics::painter::drawVecticalErrorBarW( const wpoint &Min, const wpoint &Max, const errorBarStyle &Style )
{
  assert( Min.x() == Max.x() );
  
  lineStyle LineStyle = Style.getLineStyle();
  wcoord HatWidth = Style.hatWidth();
  wcoord X = Min.x();

  drawLineW( Min, Max, LineStyle );
  drawLineW( wpoint(X-HatWidth,Min.y()), wpoint(X+HatWidth,Min.y()), LineStyle );
  drawLineW( wpoint(X-HatWidth,Max.y()), wpoint(X+HatWidth,Max.y()), LineStyle );
}