Ejemplo n.º 1
0
void scigraphics::sequence::graphViewGeneralLine::drawLegendExample( painter &Painter, const wrectangle &Rectangle ) const
{
  const wcoord VCenter = ( Rectangle.up() + Rectangle.down() )/2;

  std::vector<wpoint> Polyline;
  Polyline.push_back( wpoint( Rectangle.left()+1, VCenter ) );
  Polyline.push_back( wpoint( Rectangle.right()-1, VCenter ) );
  
  Painter.setLineStyle( getStyle() );
  drawLineBetweenPoints( Painter, &Polyline );
}
Ejemplo n.º 2
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 );
}
Ejemplo n.º 3
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 );
}
Ejemplo n.º 4
0
scigraphics::wcoord scigraphics::legend::drawGraphLegend( painter &Painter, wcoord y, const graph &Graph, const textStyle &Style )
{
  const wcoord TextHeight = Painter.textHeight( Graph.legend(), Style );

  const wcoord XForExample = getRectangle().left() + textHorizontalIndent();
  const wcoord ExampleWidth = Graph.legendExampleWidth();
  const wcoord GraphLegendHeight = std::max( Graph.legendExampleHeight(), TextHeight );

  Graph.drawLegendExample( Painter, wrectangle( wpoint( XForExample, y-GraphLegendHeight ), wpoint(XForExample+ExampleWidth,y) ) );
  
  const wcoord XForText = XForExample + ExampleWidth + textHorizontalIndent();
  Painter.drawTextW( Graph.legend(), wpoint( XForText, y-GraphLegendHeight/2 ), painter::HLeft|painter::VCenter, Style );

  return GraphLegendHeight;
}
Ejemplo n.º 5
0
void scigraphics::sequence::graphViewLineHystogram::drawLineBetweenPoints( painter &Painter, std::vector<wpoint> *Points ) const
{
  assert( Points != NULL );

  const size_t Size = Points->size();
  if ( Size <= 1 )
    return;

  Points->resize( 2*Size-1, wpoint(0,0) );
  for ( size_t i = Size-1; i >= 1; i-- )
  {
    const size_t j = i*2;
    assert( j >= 1 );
    assert( j >= i );
    assert( j < Points->size() );

    wpoint Prev   = (*Points)[i-1];
    wpoint Next   = (*Points)[i];
    wpoint Middle( Next.x(), Prev.y() );

    (*Points)[j] = Next;
    (*Points)[j-1] = Middle;
  }

  Painter.drawLineW( *Points );
}
Ejemplo n.º 6
0
  void pointsWithSameXCoord::addToPolyline( std::vector<wpoint> *Polyline ) const
  {
    assert( Polyline != NULL );

    if ( Count == 0 )
      return;

    Polyline->push_back( wpoint( X, FirstY ) );
   
    if ( MinY != FirstY )
      Polyline->push_back( wpoint( X, MinY ) );

    if ( MaxY != MinY )
      Polyline->push_back( wpoint( X, MaxY ) );

    if ( MaxY != LastY )
      Polyline->push_back( wpoint( X, LastY ) );
  }
Ejemplo n.º 7
0
scigraphics::wpoint scigraphics::painter::fpoint2wpoint( fpoint Pt ) const
{
  wcoord X = fcoord2wcoordX(Pt.x()); 
  wcoord Y = fcoord2wcoordY(Pt.y()); 
  return wpoint( X, Y );
}
Ejemplo n.º 8
0
// ============================================================

#include "scigraphics/legend.h"
#include "scigraphics/textstyle.h"
#include "scigraphics/graphcollection.h"
#include "scigraphics/graph.h"
#include "scigraphics/painter.h"

#include <iostream>
#include <algorithm>
#include <cassert>

// ============================================================

const scigraphics::wrectangle scigraphics::legend::InitLegendRectangle( wpoint(0,0), wpoint(0,0) );

// ============================================================

scigraphics::legend::legendSize::legendSize() :
  Width(0), 
  Height(0) 
{
}

// ------------------------------------------------------------
          
scigraphics::legend::legendSize::legendSize( wcoord W, wcoord H ) : 
  Width(W), 
  Height(H) 
{
Ejemplo n.º 9
0
 wpoint last() const { return wpoint( X, LastY ); }
Ejemplo n.º 10
0
 wpoint max()  const { return wpoint( X, MaxY );  }
Ejemplo n.º 11
0
 wpoint min()  const { return wpoint( X, MinY );  }
Ejemplo n.º 12
0
void scigraphics::sequence::graphViewPoints::drawLegendExample( painter &Painter, const wrectangle &Rectangle ) const
{
  const wcoord VCenter = ( Rectangle.up() + Rectangle.down() )/2;
  const wcoord HCenter = ( Rectangle.left() + Rectangle.right() )/2;
  Painter.drawPointW( wpoint(HCenter,VCenter), getStyle() );
}