示例#1
0
bool scigraphics::legend::shouldDrawLegend( const graphCollection &Graphics )
{
  for ( graphCollection::const_iterator g = Graphics.begin(); g != Graphics.end(); ++g )
    if ( shouldDrawGraphLegend(*g) )
      return true;
  return false;
}
示例#2
0
std::list<std::string> scigraphics::legend::legendsList( const graphCollection &Graphics )
{
  std::list< std::string > Legends;
  for ( graphCollection::const_iterator g = Graphics.begin(); g != Graphics.end(); ++g )
    if ( shouldDrawGraphLegend(*g) )
      Legends.push_back( g->legend() );

  return Legends;
}
示例#3
0
void scigraphics::legend::drawAllLegends( painter &Painter, const graphCollection &Graphics, const textStyle &Style )
{
  wcoord y = getRectangle().up() - interTextVerticalDistance(Style);
  for ( graphCollection::const_reverse_iterator Graph = Graphics.rbegin(); Graph != Graphics.rend(); ++Graph )
  {
    if ( shouldDrawGraphLegend( *Graph ) )
    {
      wcoord LegendHeight = drawGraphLegend( Painter, y, *Graph, Style );
      y -=  LegendHeight + interTextVerticalDistance(Style);
    }
  }
}
示例#4
0
scigraphics::legend::legendSize scigraphics::legend::sizesForLegendRectangle( painter &Painter, const textStyle &Style, const graphCollection &Graphics )
{
  const wcoord VerticalDistance = interTextVerticalDistance(Style);
  
  legendSize Size;
  for ( graphCollection::const_iterator Graph = Graphics.begin(); Graph != Graphics.end(); ++Graph )
  {
    assert( &*Graph != NULL );

    if ( shouldDrawGraphLegend(*Graph) )
    {
      const wcoord Width  = Graph->legendExampleWidth() + Painter.textWidth(  Graph->legend(), Style );
      const wcoord Height = std::max( Graph->legendExampleHeight(), Painter.textHeight( Graph->legend(), Style ) );
      Size.updateWidth( Width + 3*textHorizontalIndent() );
      Size.updateHeight( Height + VerticalDistance );
    }
  }

  if ( Size.height() > 0 )
    Size.addToHeight( VerticalDistance );
      
  return Size;
}