static void showGraph(Node n){
  printf("Noeud %d\n", getNodeValue(n));

  if (hasChild(n)){
    showGraph(getChild(n));
  }

  if (hasBrother(n)){
    showGraph(getBrother(n));
  }
}
void GUI::AnalysisBox::setFile(QString filename) {
	origVideo_=std::make_unique<Model::EncodedVideo>(filename);

	QFile f(filename);
	QFileInfo info(f);

	label_title_->setText(info.fileName());
	label_filename_->setText(info.fileName());
	label_filesize_->setText(QString::number(info.size()/(double)1000000,'f',2)+" MB");


	origVidPlayer_->setVideo(&origVideo_->getVideo(),false);
	if(globalControlPanel_.get()) {
		origVidPlayer_->setPosition(globalControlPanel_->getPosition());
	}

	origVideo_->getRedHistogram();
	origVideo_->getBitrate();
	origVideo_->getMacroBlockVideo();
	origVideo_->getRgbDiffVideo(&parentContainer_->getParentTab()->getRawVideo()->getVideo());
	origVideo_->getPsnr(&parentContainer_->getParentTab()->getRawVideo()->getVideo());

	label_codec_->setText(origVideo_->getCodec());
	label_averageBitrate_->setText(QString::number(origVideo_->getAverageBitrate()));

	if(parentContainer_) {
		showGraph(parentContainer_->getShownGraph());
		showAnalysisVideo(parentContainer_->getShownVideo());
	}
}
Example #3
0
void sort(int bl[],int x){
	int tmp;//一時
	int cmp=0,swp=0;//比較、交換	
	int i, j;//ループ用
		
	for(i=0;i<x;i++){//x=20
		for(j=0;j<(x-1)-i;j++){
			SetDrawScreen(DX_SCREEN_BACK); // 描画先を裏画面へ
			ClsDrawScreen(); //裏画面消去
			cmp++;//比較+1			



			if(bl[j]>bl[j+1]){
				swp++;//交換+1
				tmp =bl[j];
				bl[j]=bl[j+1];
				bl[j+1]=tmp;
			}



			showHeader(cmp, swp);//ヘッダー表示
			showGraph(bl, ARRAY_SIZE, j);//表示

			//_sleep(10);

			ScreenFlip();                           // 裏画面を表画面へ
			

		}
	}
	///////////////////////////////////////////////

}
Example #4
0
QWidget* TiltNRoll::createGraph()
{
    QWidget *page = new QWidget();
    QVBoxLayout *toplay = new QVBoxLayout(page);

    QWidget *group = new QGroupBox(tr("Realtime Data"), page);
    QGridLayout *grid = new QGridLayout(group);

    toplay->addWidget(group);

    // create sinus graph and model
    m_graph = new Graph(group);
    m_graph->setStyle(new QWindowsStyle());
    m_graph->setProperty("isEmbedded", m_embedded);
    m_graph->setFocusPolicy(Qt::NoFocus);
    if (!m_embedded)
        m_graph->setRenderHints(QPainter::Antialiasing);

    grid->addWidget(m_graph, 0, 0, 1, 4);

    QLabel *label = new QLabel(tr("Choose channel"), group);
    grid->addWidget(label, 1, 1, Qt::AlignRight);
    QComboBox *chooser = new QComboBox(group);
    chooser->addItems(QStringList() << tr("Accel X") << tr("Accel Y") << tr("Accel Z"));
    connect(chooser, SIGNAL(currentIndexChanged(int)), this, SLOT(showGraph(int)));
    grid->addWidget(chooser, 1, 2);


    m_graphTimer = new QTimer();
    connect(m_graphTimer, SIGNAL(timeout()), this, SLOT(getData()));
    showGraph(0);
    return page;

}
void makeSVfitMEM_xSectionPlot()
{
  gROOT->SetBatch(true);

  std::string inputFilePath = "/afs/cern.ch/user/v/veelken/scratch0/SVfitMEM_with_vamp/CMSSW_7_4_6/src/TauAnalysis/SVfitMEM/data/";
  std::string inputFileName = "svFitMEM_xSection_and_AccCorr_13TeV_fitted.root";
  std::string inputFileName_full = Form("%s%s", inputFilePath.data(), inputFileName.data());
  TFile* inputFile = new TFile(inputFileName_full.data());
  if ( !inputFile ) {
    std::cerr << "Failed to open input file = '" << inputFileName_full << "' !!" << std::endl;
    assert(0);
  }
  
  std::string graphName = "graph_Xsection_woAcc_13TeV_hadhad_vamp_fitted";
  TGraph* graph = dynamic_cast<TGraph*>(inputFile->Get(graphName.data()));
  if ( !graph ) {
    std::cerr << "Failed to load graph = '" << graphName << "' from file = '" << inputFileName.data() << "' !!" << std::endl;
    inputFile->ls();
    assert(0);
  }

  std::string outputFileName = "./makeSVfitMEM_xSectionPlot.pdf";
  showGraph(800, 650,
	    graph, 
	    false, 50., 5000., "m_{H} [GeV]", 1.30,
	    true, 1.e-4, 1.e+2, "#sigma(gg #rightarrow H) [pb]", 1.35,
	    outputFileName);

  delete inputFile;
}
Example #6
0
int main()
{
    int i, j, k, l, m;
    int tmp, ans;

    while(scanf("%d %d %d", &cows, &foods, &drinks) != EOF)
    {
	S = 0;
	T = 2*cows + foods + drinks + 1;
	memset(Graph, 0, sizeof(Graph));

	for(i = 1; i <= foods; i++)
	    Graph[S][i] = 1;
	for(i = 1; i <= drinks; i++)
	    Graph[foods+2*cows+i][T] = 1;

	for(i = 1; i <= cows; i++)
	{
	    scanf("%d %d", &j, &k);
#if DEBUG
	    printf("j:%d k:%d\n", j, k);
#endif
	    if(j == 0)//no food, S links to left cow[i]
	    {
		Graph[S][foods+i] = 1;
		printf("I j==0, Graph[S][%d]:%d\n", foods+i, Graph[S][foods+i]);
	    }
	    else
	    {
		for(l = 1; l <= j; l++)
		{
		    scanf("%d", &tmp);
		    Graph[tmp][foods+i] = 1;
		}
	    }
	    
	    Graph[foods+i][foods+cows+i] = 1;//left cow to right cow
	
	    if(k == 0)//no drinks, right cow[i] links to T 
		Graph[foods+cows+i][T] = 1;
	    else
	    {
		for(l = 1; l <=k; l++)
		{
		    scanf("%d", &tmp);
		    Graph[foods+cows+i][foods+2*cows+tmp] = 1;
		}
	    }
	}
#if DEBUG
	showGraph();
#endif
	ans = EK();
	printf("%d\n", ans);
    }

    return 0;
}
Example #7
0
int main(int argc, char *argv[])
{
	Graph G;

	G = readGraph(stdin);
	if (G == NULL)
		printf("Invalid graph\n");
	else {
		printf("Graph:\n"); showGraph(G); printf("\n");
		printf("# connected components = %d\n", nComponents(G));
	}

	return 0;
}
Example #8
0
int main(int argc, char * argv[]){
    
    Graph g;
    printf("Test newGraph\n");
    g = newGraph();    
    showGraph(g);
    assert(numV(g) == NUM_MAP_LOCATIONS);
    assert(numE(g,LAND) == 17);
    assert(numE(g, SEA) == 8);
    showIsAdjacent(g);
    printf("Passed\n");
    printf("Destroying graph\n");
    destroyGraph(g);
    printf("Finished destroy \n");
    return 0;
}
Example #9
0
int main(int argc, char **argv)
{
	int N = (argc < 2) ? 10 : atoi(argv[1]);
	if (N < 20) N = 20;
	int i, a, b;
	char x[10][20];
	for (i = 0; i < 10; i++) randomString(x[i]);
	Graph g;
	g = newGraph(10);
	for (i = 0; i < N; i++) {
		a = random()%10;
		b = random()%10;
		addEdge(g, x[a], x[b]);
		printf("Added %s -> %s\n", x[a], x[b]);
		showGraph(g,0);
	}
	return 0;
}
Example #10
0
int main()
{
    printf("Enter Time Limit : ");
    scanf("%f",&TIME_LIMIT);
    int i, j;
    srand(time(NULL));
    Heap *heap;
    Ball **ball;
    Interaction *nextCollision;
    heap = initHeap();
    ball = (Ball **)malloc(PARTICLE_COUNT * sizeof(Ball *));
    gnuplotPipe = initPipe();
    for(i = 0; i < PARTICLE_COUNT; i++)
    {
        logFile[i] = initGraph(i);
        gnuplotGraphPipe[i] = initGraphPipe(i);
    }
    for(i = 0; i < PARTICLE_COUNT; i++)
    {
        ball[i] = initBallRandom(i);
        insertToHeap(heap, eventWallCollideX(heap, ball[i]));
        insertToHeap(heap, eventWallCollideY(heap, ball[i]));
        for(j = 0; j < i; j++)
            insertToHeap(heap, eventBallCollide(heap, ball[i], ball[j]));
    }
    while(sim_time < TIME_LIMIT)
    {
        nextCollision = getNextEvent(heap);
        simulateTo(ball, nextCollision->tstamp);
        printf("Collision at t=%lf\n", sim_time);
        resolveCollision(nextCollision);
        removeFromHeap(heap, nextCollision->interactee->id);
        scheduleEvent(ball, heap, nextCollision->interactee->id);
        if(nextCollision->interactor != NULL)
        {
            removeFromHeap(heap, nextCollision->interactor->id);
            scheduleEvent(ball, heap, nextCollision->interactor->id);
        }
    }
    fprintf(gnuplotPipe, "quit\n");
    saveGraph(ball);
    showGraph(ball);
    return 0;
}
Example #11
0
// Call individual methods to show each part of Dashboard
Dashboard::Dashboard(QWidget *parent)
    : QWidget(parent)
{
    //setStyleSheet("background: url(E:/Stevens/C++/Projects/Dashboard_final/images/background1.jpg)");
    showUserName();
    showTimeline();
    showButtons();
    combineTimelineButtons();
    showFigures();
    combineFiguresTimelineButtons();
    showGraph();
    combineGraphFiguresTimelineButtons();
    showMainLayout();

    //setStyleSheet("background: url(E:/Stevens/C++/Projects/Dashboard_final/images/background_home.jpg)");
    //qApp->setStyleSheet("QWidget {background-image: url(./background_home.jpg) }");
    //setStyleSheet("background: url(E:/Stevens/C++/Projects/Dashboard_final/images/background1.jpg)");
    connect(timelineCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(getTimeline(int)));
    connect(addExpenseButton, SIGNAL(clicked()), this, SLOT(showExpenseWindow()));
    connect(addIncomeButton, SIGNAL(clicked()), this, SLOT(showIncomeWindow()));
}
Example #12
0
int main(int argc, char * argv[]){
    if (argc < 2){ 
        printf("Incorrect usage: must enter filename\n");
        exit (1);
    }
    Graph g = readGraph(argv[1]);
    showGraph(g);
    printf("\n");

    // TASK 1
    printf("TASK 1\n");
    showGraphLabels(g);
    printf("\n");
    showData(g);
    printf("\n");
    
    // TASK 2
    printf("TASK 2\n");
    int *dfsOrdered = malloc(numV(g) * sizeof(Vertex));
    dfSearch2(g, dfsOrdered);
    int i;
    for(i=0;i< cnt;i++){
        Vertex v = dfsOrdered[i];
        showVertexData(g,v);
    }
    printf("\n");
    
    // TASK 3
    printf("TASK 3\n");
    printf("\nFlying all over the world\n");

    //Uncomment out this line when you get to task 3
    getFlights(g,dfsOrdered);
    
    free(dfsOrdered);    
    destroyGraph(g);    
    return 0;
}
double* edgeArrayToDoubleArray(Edge* e, int size){
  double* res = malloc(sizeof(double)*size);

  Node n = transformEdgeArrayToGraph(e, size, 0);

  showGraph(n);

  getGraph(n, res, 0);

  /**res[0] = (double)e[0]->start;
  for (int i=1; i<size -1; i++)
    if (res[i-1] != e[i]->start)
      res[i] = (double)e[i]->start;
    else 
      res[i] = (double)e[i]->end;

  if (res[size-2] != e[size-3]->start)
      res[size-1] = (double)e[size-2]->end;
    else 
      res[size-1] = (double)e[size-2]->end;*/

  return res;
}
Example #14
0
File: graph.c Project: crcox/lens
Graph createGraph(void) {
  int g;
  Graph G = (Graph) safeCalloc(1, sizeof *G, "createGraph:G");

  for (g = 0; g < Root->numGraphs && Root->graph[g]; g++);
  if (g >= Root->numGraphs) {
    int n = imax(g + 2, 2 * Root->numGraphs);
    Root->graph = safeRealloc(Root->graph, n * sizeof(Graph), "Root->graph");
    memset(Root->graph + Root->numGraphs, 0,
           (n - Root->numGraphs) * sizeof(Graph));
    Root->numGraphs = n;
  }
  Root->graph[g] = G;
  G->num      = g;

  G->updateOn = ON_REPORT;
  G->updateEvery = 1;

  G->width    = 0;
  G->height   = 0;
  G->cols     = DEF_GR_columns;

  G->max = G->min = 0.0;
  G->fixMax   = FALSE;
  G->fixMin   = TRUE;
  G->maxVal   = -LARGE_VAL;
  G->minVal   = LARGE_VAL;
  G->scaleY   = 0;

  G->clearOnReset = FALSE;
  G->storeOnReset = TRUE;

  G->maxX     = 0;
  G->hidden   = TRUE;
  if (!Batch) showGraph(G);
  return G;
}
void GUI::AnalysisBox::updateLabels() {
	label_codec_->setText(origVideo_->getCodec());
	label_averageBitrate_->setText(QString::number(origVideo_->getAverageBitrate()/(double)1000,'f',
	                               2)+" KB/s");

	if(!anaVidPlayer_->getVideo()&&parentContainer_) {
		showAnalysisVideo(parentContainer_->getShownVideo());
	}
	if(!graphWidget_->getGraph()&&parentContainer_) {
		showGraph(parentContainer_->getShownGraph());
	}
	if(parentContainer_) {
		origVideo_->getRgbDiffVideo(&parentContainer_->getParentTab()->getRawVideo()->getVideo());
		origVideo_->getPsnr(&parentContainer_->getParentTab()->getRawVideo()->getVideo());
	}
	if(origVideo_->getAvVideo().isComplete()) {
		timer_updateLabels_.stop();
		if(origVideo_->getAvVideo().getNumberOfFrames()==0) {
			QMessageBox::warning(this,"Error while loading video","Video could not be loaded!");
			auto& stack=UndoRedo::UndoStack::getUndoStack();
			stack.setIndex(stack.index()-1);
		}
	}
}
Example #16
0
void sort(int bl[],int x){
	int tmp;//一時
	int cmp=0,swp=0;//比較、交換	
	int i, j;//ループ用
	//比較///////////////////////////////////
	for(i=0;i<x;i++){
		for(j=0;j<x-1-i;j++){
			cmp++;//比較+1			
			clear();
			showHeader(cmp, swp);
			showGraph(bl, ARRAY_SIZE, j);
			
			if(bl[j]>bl[j+1]){
				swp++;//交換+1
				tmp =bl[j];
				bl[j]=bl[j+1];
				bl[j+1]=tmp;
			}
			//Sleep(100);
		}
	}
	///////////////////////////////////////////////
	
}
// Draws graph in the chart area
void AnalyticsGUI::generateGraphSlot()
{

    QString filename;
    if (!FOOTTRAFFICONLY)
    {
        // check filename
        filename = m_filenameDisplay->text();
        if (filename==NULL || filename.length()<1)
        {
            m_errorDialog->showMessage("You must pick a file for analysis");
            m_kbpfChooseFileBtn->setFocus();

            return;
        }
    }
    else
    {
        filename = FOOTDIR + "/" + FOOTBASENAME;
    }

    // Check time quanity input
    QString timeQuantity = m_timeQuantityInput->text() ;
    if (timeQuantity==NULL || timeQuantity.length()<1)
    {
        m_errorDialog->showMessage("You must pick enter a number of " + m_periodTypeSelector->currentText() + " to analyze");
        m_timeQuantityInput->setFocus();

        return;
    }

    int tq = timeQuantity.toInt();
    if (tq < 1)
      {
          m_errorDialog->showMessage("You must pick enter a number of " + m_periodTypeSelector->currentText() + " to analyze");
          m_timeQuantityInput->setFocus();

          return;
      }


    // initialize Analysis Engine
        QFileInfo * info = new QFileInfo(filename);
        QString base = info->baseName();
        QString filetype = base.left(base.indexOf("_"));

        if (! m_fileConverter->doesTagSetExist(filetype))
        {
            m_errorDialog->showMessage("Could not find complete schema for Filetype " + filetype);
            return;
        }

        AnalyticsUtils::AnalysisTagSet tagSet = m_fileConverter->getTagSet(filetype);

        QDateTime lastTime;
        if (m_lastTimeSelector->currentIndex()==0)
        {
            lastTime = QDateTime::currentDateTime();
        }
        else
        {
            lastTime = m_lastTimePicker->dateTime();
        }

        m_analyzer->initializeAnalysis(
                    tagSet.statname,
                    info->absolutePath(),
                    info->baseName(),
                    tagSet.docType,
                    tagSet.rootTag,
                    tagSet.elementTag,
                    tagSet.projectTag,
                    tagSet.userIDTag,
                    tagSet.startTag,
                    tagSet.endTag,
                    tagSet.timeFormat,
                    lastTime,
                    AnalyticsGrapher::DEFAULTWIDTH,
                    AnalyticsGrapher::DEFAULTHEIGHT
                    );

    KbpfAnalyzer::AggregationType aggtype;
    KbpfAnalyzer::TimePeriodType timetype;
    KbpfAnalyzer::AnalysisType antype;


    QString anSelection = m_analysisTypeSelector->currentText();
    if (anSelection=="Total Count")
    {
        antype = KbpfAnalyzer::EventCount;
    }
    else if (anSelection== "Average Duration")
    {
        antype = KbpfAnalyzer::DurationAverage;
    }

    QString aggSelection = m_aggregationTypeSelector->currentText();
    if (aggSelection=="None")
    {
        aggtype = KbpfAnalyzer::None;
    }
    else if (aggSelection=="Hour of Day")
    {
        aggtype = KbpfAnalyzer::ClockHour;

    }
    else if (aggSelection=="Day of Week")
    {
        aggtype = KbpfAnalyzer::Weekday;

    }

    QString tpSelection = m_periodTypeSelector->currentText();
    if (tpSelection=="Hours")
    {
        timetype = KbpfAnalyzer::Hour;
        aggtype = KbpfAnalyzer::None;
    }
    else if (tpSelection=="Weeks")
    {
        timetype = KbpfAnalyzer::Week;
    }

    // Clear Graph Area if New Datafile
    if (filename != graphedFile)
    {
     graphedFile=filename;
     clearHistory();

    }
    // Don't redraw graphs
    if (! graphAlreadyDrawn(lastTime, antype, timetype, aggtype, tq))
    {
        // analyse and display
        if (m_analyzer->Analyze(antype, timetype, tq, aggtype))
        {
            QDeclarativeView * graph = m_analyzer->getGraph();
            showGraph(graph);
            drawnGraphs.append((GraphType){lastTime, antype,timetype,aggtype,tq});
        }
        else
        {
            m_errorDialog->showMessage("Could not analyze file");
        }

    }
    else
    {
        m_errorDialog->showMessage("Graph already drawn");
    }
}
Example #18
0
int main(int argc, char *argv[])
{
	Graph world;           // graph of world/distances
	FILE *data;            // file handle
	char  name[MAXNAME+2]; // input buffer to hold city name lines
	int   ncities;         // how many cities
	char *city[MAXCITIES]; // array of up to MAXCITIES city names
	int   maxflt;          // max length of flights

	// check command-line params
	if (argc != 1 && argc != 3 && argc != 4) usage();

	// get array of city names (assumes < MAXCITIES names)
	if ((data = fopen("ha30_name.txt","r")) == NULL) {
		fatal("Couldn't open file: ha30_name.txt");
	}
	ncities = 0;
	while (fgets(name,MAXNAME,data) != NULL) {
		name[strlen(name)-1] = '\0';
		city[ncities] = strdup(name);
		ncities++;
	}
	fclose(data);

	// make empty Graph
	world = newGraph(ncities);

	// get distances and populate Graph edges
	if ((data = fopen("ha30_dist.txt","r")) == NULL) {
		fatal("Couldn't open file: ha30_dist.txt");
	}
	int n=0, fromCity, toCity, distance;
	while (fscanf(data,"%d",&distance) == 1) {
		fromCity = n / ncities;
		toCity = n % ncities;
		// convert miles to km
		distance = distance * 100 * 1.609344;
		insertEdge(world, toCity, fromCity, distance);
		n++;
	}
	fclose(data);

	// get a new maximum flight distance
	maxflt = (argc == 4) ? atoi(argv[3]) : 10000;
	if (maxflt == 0) maxflt = 10000;

	// do what the user asks for
	if (argc == 1) {
		// only arg is data file => just show graph
		showGraph(world,city);
	}
	else {
		// find path from src -> dest
		int src = cityID(argv[1],city,ncities);
		if (src == -1)
			fatal("Source city name invalid");
		int dest = cityID(argv[2],city,ncities);
		if (dest == -1)
			fatal("Destination city name invalid");

		// use graph algorithm to find path
		int *path = malloc(ncities*sizeof(int));
		if (path == NULL)
			fatal("Can't allocate path array\n");
		int len = findPath(world,src,dest,maxflt,path);

		// display resulting path
		if (len < 0)
			printf("No route from %s to %s\n",argv[1],argv[2]);
		else {
			printf("Least-hops route:\n%s\n",city[path[0]]);
			int i;
			for (i = 1; i < len; i++)
				printf("->%s\n",city[path[i]]);
		}
	}
	return 0;
}
Example #19
0
// calculate button is pressed
int CcgView::calculate()
{
    QString command;

    int retval = 0;

    statusLabel.setText("Calculating...");

    ui->pushButtonCalculate->setEnabled(false);

    if (!globals.validData) {
        DialogData * data = new DialogData(this,&globals);
        data->exec();
        delete data;
        ui->pushButtonCalculate->setEnabled(true);
        statusLabel.setText("Ready");
        return -1;
    }

    result_filename = globals.dataDirectory + QString(PATH_SEPARATOR) + "result.png";

    command = "ccg --dir " + globals.dataDirectory +
            " --sites " + globals.sitesFilename +
            " --filename " + result_filename +
            " --width " + QString::number(image_width) +
            " --height " + QString::number(image_height) +
            " --subvertical " + QString::number(subtitle_vertical_position) +
            " --start " + ui->spinBoxStartYear->text() +
            " --end " + ui->spinBoxEndYear->text() +
            " --gas \"" + ui->comboBoxGas->currentText().toLower() + "\"";
    if (globals.emissionsFilename.length()>0) {
        command += " --emissions \"" + globals.emissionsFilename + "\"";
    }
    if (globals.graphLabel.length()>0) {
        command += " --label \"" + globals.graphLabel + "\"";
    }
    if (ui->checkBoxMinMax->isChecked()) {
        command += " --minmax";
    }
    if (ui->checkBoxVariance->isChecked()) {
        command += " --variance";
    }
    if (ui->checkBoxRunningAverage->isChecked()) {
        command += " --runningaverage";
    }
    if (ui->comboBoxRegion->currentText().contains("Europe")) {
        command += " --area \"60N,10W,37N,30E\"";
    }
    if (ui->comboBoxRegion->currentText().contains("North America")) {
        command += " --area \"75N,169W,10N,55W\"";
    }
    if (ui->comboBoxRegion->currentText().contains("South America")) {
        command += " --area \"10N,90W,55S,35W\"";
    }
    if (ui->comboBoxRegion->currentText().contains("Africa")) {
        command += " --area \"35N,20W,35S,52E\"";
    }
    if (ui->comboBoxRegion->currentText().contains("Asia")) {
        command += " --area \"80N,35E,5N,179E\"";
    }
    if ((ui->comboBoxPlotType->currentText().contains("Scatter")) ||
        (ui->comboBoxPlotType->currentText().contains("Distribution"))) {
        command += " --distribution";
    }
    if (ui->comboBoxPlotType->currentText().contains("Altitude")) {
        command += " --altitudes";
    }
    if (ui->comboBoxPlotType->currentText().contains("Change")) {
        command += " --change";
    }
    if ((ui->comboBoxPlotType->currentText().contains("monthly")) ||
        (ui->comboBoxPlotType->currentText().contains("Monthly"))) {
        command += " --monthly";
    }
    if (ui->comboBoxRegion->currentText().contains("Arctic Circle")) {
        command += " --latitudes \"90N,66N\"";
    }
    if (ui->comboBoxRegion->currentText().contains("Northern Hemisphere")) {
        command += " --latitudes \"90N,0N\"";
    }
    if (ui->comboBoxRegion->currentText().contains("Southern Hemisphere")) {
        command += " --latitudes \"0S,90S\"";
    }
    if (ui->comboBoxRegion->currentText().contains("Equatorial")) {
        command += " --latitudes \"10N,10S\"";
    }

    qDebug("%s", command.toStdString().c_str());

    QThread* thread = new QThread;
    ThreadCalculate* calc = new ThreadCalculate();
    calc->command = command;
    calc->image_filename = result_filename;
    calc->moveToThread(thread);
    connect(thread, SIGNAL(started()), calc, SLOT(process()));
    connect(calc, SIGNAL(finished()), thread, SLOT(quit()));
    connect(calc, SIGNAL(finished()), calc, SLOT(deleteLater()));
    connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
    connect(calc, SIGNAL(finished()), this, SLOT(showGraph()));
    thread->start();

    return retval;
}