Ejemplo n.º 1
0
void fractFunc::draw_aa(float min_progress, float max_progress)
{
    int w = im->Xres();
    int h = im->Yres();

    reset_counts();

    float delta = (max_progress - min_progress)/2.0;

    // if we have multiple threads, make sure they don't modify
    // pixels the other thread will look at - that wouldn't be 
    // an error per se but would make drawing nondeterministic,
    // which I'm trying to avoid
    // We do this by drawing every even line, then every odd one.

    for(int i = 0; i < 2 ; ++i)
    {
	set_progress_range(
	    min_progress + delta * i,
	    min_progress + delta * (i+1));

	reset_progress(0.0);
        last_update_y = 0;

        for(int y = i; y < h ; y+= 2) 
	{
	    worker->row_aa(0,y,w);
	    if(update_image(y))
	    {
		break;
	    }
        }
        reset_progress(1.0);
    }
    stats_changed();
}
Ejemplo n.º 2
0
ProvamiMainWindow::ProvamiMainWindow(Model& model, QWidget *parent) :
    QMainWindow(parent),
    model(model), datagrid_model(model), stationgrid_model(model), attrgrid_model(model),
    rawquery_model(model),
    lat_validator(-90, 90, 5),
    lon_validator(-180, 180, 5),
    id_validator(0, std::numeric_limits<int>::max()),
    ui(new Ui::ProvamiMainWindow)
{
    ui->setupUi(this);
    ui->mapview->set_model(model);
    SparseWindows::init(*(ui->tabWidget));
    progress_indicator.set_statusbar(*statusBar());
    connect(&model, SIGNAL(next_filter_changed()), this, SLOT(next_filter_changed()));
    connect(&model.highlight, SIGNAL(changed()), this, SLOT(highlight_changed()));
    connect(&model, SIGNAL(progress(QString, QString)), &progress_indicator, SLOT(update_progress(QString, QString)));
    connect(ui->filter_latmin, SIGNAL(editingFinished()), this, SLOT(filter_latlon_changed()));
    connect(ui->filter_latmax, SIGNAL(editingFinished()), this, SLOT(filter_latlon_changed()));
    connect(ui->filter_lonmin, SIGNAL(editingFinished()), this, SLOT(filter_latlon_changed()));
    connect(ui->filter_lonmax, SIGNAL(editingFinished()), this, SLOT(filter_latlon_changed()));
    connect(ui->filter_datemin, SIGNAL(activate(QDateTime)), this, SLOT(filter_datemin_activated(QDateTime)));
    connect(ui->filter_datemax, SIGNAL(activate(QDateTime)), this, SLOT(filter_datemax_activated(QDateTime)));
    connect(ui->filter_limit, SIGNAL(editingFinished()), this, SLOT(filter_limit_changed()));
    //connect(ui->text_query, SIGNAL(textChanged()), this, SLOT(text_query_changed());
    connect(ui->station_data, SIGNAL(clicked(QModelIndex)), this, SLOT(station_data_clicked(QModelIndex)));
    connect(ui->export_go, SIGNAL(clicked()), this, SLOT(export_go()));
    connect(&model, SIGNAL(active_filter_changed()), this, SLOT(stats_changed()));

    ui->results->setModel(&datagrid_model);
    ui->results->setEditTriggers(
                QAbstractItemView::DoubleClicked
              | QAbstractItemView::SelectedClicked
              | QAbstractItemView::EditKeyPressed);
    connect(ui->results->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(results_current_changed(QModelIndex, QModelIndex)));

    ui->station_data->setModel(&stationgrid_model);
    ui->attr_data->setModel(&attrgrid_model);
    ui->raw_query->setModel(&rawquery_model);
    RawQueryItemDelegate* rqd = new RawQueryItemDelegate(ui->raw_query);
    ui->raw_query->setItemDelegate(rqd);
    ui->filter_report->setModel(&model.reports);
    ui->filter_level->setModel(&model.levels);
    ui->filter_trange->setModel(&model.tranges);
    ui->filter_varcode->setModel(&model.varcodes);
    ui->filter_ident->setModel(&model.idents);
    ui->filter_latmin->setValidator(&lat_validator);
    ui->filter_latmax->setValidator(&lat_validator);
    ui->filter_lonmin->setValidator(&lon_validator);
    ui->filter_lonmax->setValidator(&lon_validator);
    ui->filter_ana_id->setValidator(&id_validator);
    ui->filter_latmin->set_record(model, "latmin");
    ui->filter_latmax->set_record(model, "latmax");
    ui->filter_lonmin->set_record(model, "lonmin");
    ui->filter_lonmax->set_record(model, "lonmax");
    ui->filter_ana_id->set_record(model, "ana_id");
    ui->filter_datemin->set_model(model);
    ui->filter_datemax->set_model(model);
    ui->filter_limit->setText(QString::number(model.limit));

    //map_scene.load_coastlines("/usr/share/provami/world.dat");
    //ui->mapview->setScene(&map_scene.scene);
    //qDebug() << "Scene rect: " << map_scene.scene.sceneRect();

    ui->export_format->addItem("BUFR", "bufr");
    ui->export_format->addItem("BUFR (generic)", "gbufr");
    ui->export_format->addItem("CREX", "crex");
    ui->export_format->addItem("CREX (generic)", "gcrex");
    ui->export_format->addItem("Gnu R", "gnur");
    ui->export_format->addItem("CSV", "csv");

    //statusBar()->showMessage("Antani");
}
Ejemplo n.º 3
0
void 
fractFunc::draw(
    int rsize, int drawsize, float min_progress, float max_progress)
{
    if(debug_flags & DEBUG_QUICK_TRACE)
    {
	printf("drawing: %d\n", render_type);
    }
    reset_counts();

    // init RNG based on time before generating image
    time_t now;
    time(&now);
    srand((unsigned int)now);

    int y;
    int w = im->Xres();
    int h = im->Yres();

    /* reset progress indicator & clear screen */
    last_update_y = 0;
    reset_progress(min_progress);

    float mid_progress = (max_progress + min_progress)/2.0;
    set_progress_range(min_progress, mid_progress);

    // first pass - big blocks and edges
    for (y = 0 ; y < h - rsize ; y += rsize) 
    {
	worker->qbox_row (w, y, rsize, drawsize);
	if(update_image(y)) 
	{
	    goto done;
	}
    }
 
    // remaining lines
    for ( ; y < h ; y++)
    {
        worker->row(0,y,w);
        if(update_image(y)) 
        {
            goto done;
        }
    }

    last_update_y = 0;
    reset_progress(0.0);
    set_progress_range(mid_progress, max_progress);

    // fill in gaps in the rsize-blocks
    for ( y = 0; y < h - rsize; y += rsize) 
    {
	worker->box_row(w,y,rsize);
        if(update_image(y))
        {
            goto done;
        }
    }

 done:
    /* refresh entire image & reset progress bar */
    reset_progress(1.0);
    stats_changed();
}