void
QvisKeyframeDrawer::drawBackground(QPainter *p, const QRect &r)
{
    rect = r;

    // Draw the background and the vertical lines.
    p->fillRect(rect, kfBG);
    drawVerticalLines(p, rect, 0, numFrames, kfVLine);

    // Draw the horizontal line.
    p->setPen(kfHLine);
    int y = (rect.top() + rect.bottom()) / 2;
    int firstx = getX(0);
    int lastx  = getX(numFrames-1);
    p->drawLine(firstx, y, lastx, y);

    // Draw the current time
    if (currentIndex >= 0)
    {
        QPen pen(kfTimeLine);
        pen.setWidth(3);
        p->setPen(pen);
        int x = getX(currentIndex);
        p->drawLine(x, rect.top(), x, rect.bottom());
    }
}
Example #2
0
void Ground::draw() {
   glPushMatrix(); {
      glColor3f(1, 1, 1);
      glBegin(GL_LINES); {
         drawHorizontalLines();
         drawVerticalLines();
      } glEnd();
   } glPopMatrix();
}
void
QvisKeyframeDrawer::drawPlotRange(QPainter *p, const QRect &r, int start, int end, 
    bool highlight, int activePoint)
{
    // Draw the background.
    drawBackground(p, r);

    // draw the big bar
    int x0 = getX(start);
    int xn = getX(end);
    int y=rect.y() + rect.height()/2;
    p->fillRect(x0, y-6, xn-x0, 13, highlight ? kfPlotRangeH : kfPlotRange);
    QRect r2(rect.x(), y-6, rect.width(), 13);
    if(start != end)
        drawVerticalLines(p, r2, start, end, kfPlotRangeLines);

    // Draw the end points.
    p->fillRect(handleRect(start), (activePoint==0) ? kfHandleH : kfHandle);
    p->fillRect(handleRect(end), (activePoint==1) ? kfHandleH : kfHandle);
}
Example #4
0
///////////////////////////////////////////////////////////////////////////////
// Draw the object - main draw procedure
///////////////////////////////////////////////////////////////////////////////
void PlotContig::plotContig(void)
{
  // calc contig start
  calcStarInContig();

  // calculate offsets
  initData();

  // Calculates where to draw the labels for the peptides
  initDeNovo();

  // Calculates where to draw the labels for the peptides
  initMassIntervals(m_userIntervals, m_user);
  initMassIntervals(m_homologIntervals, m_homolog);
  initMassIntervals(m_referenceIntervals, m_reference);

  // Align spectra
  alignSpectra();

  // Calculate M/Z and Intensity limits
  calcultateLimits();

  // Initialize the graph
  initializeGraph();

  // Set the graph title
  setGraphTitle();

  // draw the sequences
  drawSequences();

  // draw vertical lines
  drawVerticalLines();

  // multiplot - store primary data
  m_rendererObject->addArea();

  // Draw spectra
  drawSpectra();
}
void TrafficGraph::drawWidget(QPainter *p, uint w, uint height, int horizontalScale)
{
  uint h = height; //h will become the height of just the bit we draw the beams in
  p->setFont( mFont );

  uint fontheight = p->fontMetrics().height();
  if(mMinValue < mNiceMinValue || mMaxValue > mNiceMaxValue || mMaxValue < (mNiceRange*0.75 + mNiceMinValue) || mNiceRange == 0)
    calculateNiceRange();
  QPen pen;
  pen.setWidth(1);
  pen.setCapStyle(Qt::RoundCap);
  p->setPen(pen);

  uint top = p->pen().width() / 2; //The y position of the top of the graph.  Basically this is one more than the height of the top bar
  h-= top;

  //check if there's enough room to actually show a top bar. Must be enough room for a bar at the top, plus horizontal lines each of a size with room for a scale
  bool showTopBar = mShowTopBar &&  h > (fontheight/*top bar size*/ +5/*smallest reasonable size for a graph*/ );
  if(showTopBar) {
    top += fontheight; //The top bar has the same height as fontheight. Thus the top of the graph is at fontheight
    h -= fontheight;
  }
  if(mBackgroundImage.isNull() || (uint)mBackgroundImage.height() != height || (uint)mBackgroundImage.width() != w) { //recreate on resize etc
    mBackgroundImage = QImage(w, height, QImage::Format_RGB32);
    QPainter pCache(&mBackgroundImage);
    pCache.setRenderHint(QPainter::Antialiasing, false);
    pCache.setFont( mFont );

    drawBackground(&pCache, w, height);

    if(mShowThinFrame) {
      drawThinFrame(&pCache, w, height);
      //We have a 'frame' in the bottom and right - so subtract them from the view
      h--;
      w--;
      pCache.setClipRect( 0, 0, w, height-1 );
    }
    
    if(showTopBar) { 
      int seperatorX = w / 2;
      drawTopBarFrame(&pCache, w, seperatorX, top);
    }

    /* Draw scope-like grid vertical lines if it doesn't move.  If it does move, draw it in the dynamic part of the code*/
    if(!mVerticalLinesScroll && mShowVerticalLines && w > 60)
      drawVerticalLines(&pCache, top, w, h);

    if ( mShowHorizontalLines ) 
      drawHorizontalLines(&pCache, top, w, h);
  
  } else {
    if(mShowThinFrame) {
      //We have a 'frame' in the bottom and right - so subtract them from the view
      h--;
      w--;
   }  
  }
  p->drawImage(0,0, mBackgroundImage);
  p->setRenderHint(QPainter::Antialiasing, true);

  if ( showTopBar ) {
    int seperatorX = w / 2;
    int topBarWidth = w - seperatorX -2;
    drawTopBarContents(p, seperatorX, topBarWidth, top -1);
  }

  p->setClipRect( 0, top, w, h);
  /* Draw scope-like grid vertical lines */
  if ( mVerticalLinesScroll && mShowVerticalLines && w > 60 )
    drawVerticalLines(p, top, w, h);

  drawBeams(p, top, w, h, horizontalScale);

  if( mShowLabels && w > 60 && h > ( fontheight + 1 ) )   //if there's room to draw the labels, then draw them!
    drawAxisText(p, top, h);

}