Esempio n. 1
0
/*!
  Draw a subset of the histogram samples

  \param painter Painter
  \param xMap Maps x-values into pixel coordinates.
  \param yMap Maps y-values into pixel coordinates.
  \param canvasRect Contents rect of the canvas
  \param from Index of the first sample to be painted
  \param to Index of the last sample to be painted. If to < 0 the
         series will be painted to its last sample.

  \sa drawOutline(), drawLines(), drawColumns
*/
void QwtPlotHistogram::drawSeries( QPainter *painter,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &, int from, int to ) const
{
    if ( !painter || dataSize() <= 0 )
        return;

    if ( to < 0 )
        to = dataSize() - 1;

    switch ( d_data->style )
    {
        case Outline:
            drawOutline( painter, xMap, yMap, from, to );
            break;
        case Lines:
            drawLines( painter, xMap, yMap, from, to );
            break;
        case Columns:
            drawColumns( painter, xMap, yMap, from, to );
            break;
        default:
            break;
    }
}
Esempio n. 2
0
void Plot2DHistogram::drawSeries( QPainter *painter, const QwtScaleMap &xMap,
                const QwtScaleMap &yMap, const QRectF & rect, int from, int to ) const {
    if ( !painter || m_data.size() <= 0 ){
        return;
    }
    if ( to < 0 ){
        to= m_data.size() - 1;
    }
    m_lastY = rect.bottom();
    m_lastX = rect.left();
    drawColumns( painter, xMap, yMap, from, to );
    if ( m_drawStyle == Carta::Data::PlotStyles::PLOT_STYLE_OUTLINE ){
        QwtPainter::drawLine( painter, m_lastX, m_lastY, m_lastX, rect.bottom());
    }
}
Esempio n. 3
0
/* Initialize anything necessary to set up the scene for the roller coaster simulation. */
void init(void){
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);
    
    // Read in the control points from a file, first lets test without that feature.
    leftRail = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    rightRail = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    centerRail = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    columnTopRight = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    columnTopLeft = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    qValues = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    dqValues = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    ddqValues = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    uValues = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    vValues = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    nValues = (double **)malloc(COASTER_POINTS*NUMBER_SEGMENTS * sizeof(double *));
    calculateVectors();
    
    // Generate a display list that will hold the scene.
    scene = glGenLists(1);
    glNewList(scene, GL_COMPILE);
        // Draw the ground and colour it green.
        drawGround();
    
        // Draw the sky and colour it blue.
        drawSkybox();
        // Draw the coaster.
        drawCurve();
    
        // Draw the connection pieces for the rails.
        drawConnectors();
    
        // Draw the columnst that support the rails.
        drawColumns();
    glEndList();
}