コード例 #1
0
void CGameGraphBuilder::build_graph			(const float &start, const float &amount)
{
	Progress				(start);

	Msg						("Building graph");

	CTimer					timer;
	timer.Start				();

	m_graph_engine			= xr_new<CGraphEngine>(level_graph().header().vertex_count());
	Progress				(start + 0.000000f*amount + amount*0.067204f);
//	Msg						("BG : %f",timer.GetElapsed_sec());

	generate_edges			(start + 0.067204f*amount, amount*0.922647f);
//	Msg						("BG : %f",timer.GetElapsed_sec());

	xr_delete				(m_graph_engine);
	Progress				(start + 0.989851f*amount + amount*0.002150f);
//	Msg						("BG : %f",timer.GetElapsed_sec());

	connectivity_check		(start + 0.992001f*amount, amount*0.000030f);
//	Msg						("BG : %f",timer.GetElapsed_sec());
	optimize_graph			(start + 0.992031f*amount, amount*0.000454f);
//	Msg						("BG : %f",timer.GetElapsed_sec());
	save_graph				(start + 0.992485f*amount, amount*0.007515f);
//	Msg						("BG : %f",timer.GetElapsed_sec());

	Progress				(start + amount);
}
コード例 #2
0
ファイル: logging.c プロジェクト: erikbrinkman/tup
void log_graph(struct graph *g, const char *name)
{
	if(enabled) {
		char fullname[PATH_MAX];
		if(snprintf(fullname, sizeof(fullname), ".tup/log/%s.dot.0", name) >= (signed)sizeof(fullname)) {
			fprintf(stderr, "tup internal error: log graph name is sized incorrectly.\n");
			return;
		}
		save_graph(NULL, g, fullname);
	}
}
コード例 #3
0
ファイル: ge.cpp プロジェクト: Strongc/proview
void Ge::activate_creanextpage()
{
    char old_name[40];
    char name[40];
    char next_name[40];
    int page;
    char *s;

    if ( ! graph->is_subgraph()) {
        message( 'E', "This is not a subgraph");
        return;
    }

    if ( graph->is_modified()) {
        message( 'E', "Subgraph is not saved");
        return;
    }

    // Get next subgraph name
    graph->get_name( old_name);
    strcpy( name, old_name);
    if ( (s = strstr( name, "__p")) &&
            (sscanf( s+3, "%d", &page) == 1))
        sprintf( s+3, "%d", page+1);
    else
        strcat( name, "__p2");

    // Store next name in graph
    graph->get_next_subgraph( next_name);
    if ( strcmp( next_name, name) == 0) {
        // Next subgraph is already created, check file...
        message( 'E', "Subgraph is already created");
        return;
    }

    graph->set_next_subgraph( name);
    save_graph( this, old_name);
    prevtable_insert( name, old_name);

    graph->set_name( name);
    graph->set_next_subgraph( "");
    graph->set_java_name( "");
    set_title();

    message( 'I', "New page created");
}
コード例 #4
0
ファイル: ge.cpp プロジェクト: Strongc/proview
void Ge::save_and_close()
{
    char name[40];

    graph->get_name( name);
    if ( strcmp( name, "") == 0) {
        if ( ! graph->is_subgraph())
            open_input_dialog( "Graph name", "Save Graph", "",
                               Ge::save_graph_and_close);
        else
            open_input_dialog( "SubGraph name", "Save SubGraph", "",
                               Ge::save_graph_and_close);
    }
    else {
        save_graph( this, name);

        delete this;
    }
}
コード例 #5
0
ファイル: menucallbacks.c プロジェクト: ekoontz/graphviz
void mQuitSlot(GtkWidget * widget, gpointer user_data)
{
    //1 check all graphs 1 by 1 to see any unsaved
    int respond;
    int gIndex;
#ifdef UNUSED
    int active_graph = view->activeGraph;	//stores the active graph in case quit aborted
#endif
    for (gIndex = 0; gIndex < view->graphCount; gIndex++) {
	view->activeGraph = gIndex;
	if (GD_Modified(view->g[view->activeGraph])) {
	    sprintf(buf,
		    "graph %s has been modified \n , would you like to save it before quitting the the program?",
		     GD_GraphName(view->g[view->activeGraph]));
	    Dlg =
		(GtkMessageDialog *) gtk_message_dialog_new(NULL,
							    GTK_DIALOG_MODAL,
							    GTK_MESSAGE_QUESTION,
							    GTK_BUTTONS_NONE,
							    buf);
	    gtk_dialog_add_button((GtkDialog *) Dlg, "YES", 100);
	    gtk_dialog_add_button((GtkDialog *) Dlg, "NO", 101);
	    gtk_dialog_add_button((GtkDialog *) Dlg, "Cancel", 102);

	    respond = gtk_dialog_run((GtkDialog *) Dlg);
	    if (respond == 100)	//save and continue
	    {
		if (!save_graph())
		    break;
	    }
	    if (respond == 102)	//save and continue
	    {
		break;
	    }
	}
    }
    gtk_main_quit();
}
コード例 #6
0
void SCTPGraphDialog::on_saveButton_clicked()
{
    save_graph(this, ui->sctpPlot);
}
コード例 #7
0
void mSaveSlot(GtkWidget * widget, gpointer user_data)
{

    save_graph();		//save without prompt

}
コード例 #8
0
ファイル: ge.cpp プロジェクト: Strongc/proview
void Ge::save( char *name)
{
    save_graph( this, name);
}
コード例 #9
0
ファイル: itm.c プロジェクト: gitter-badger/TFWC
char *
makegraph(char *iname)
{
    FILE *infile;
    Graph *G = NULL;
    char inbuf[LINE],outfilename[LINE];
    register char *cp;
    char *method;
    int count, lineno=0, numlevels, nerrors;
    int i, m=0, prefixlen;
    int edgeConnMeth, haux, stubsPerTrans, tsEdges, ssEdges;
    long seed;
    geo_parms	parmsbuf[MAXLEVEL];	/* make sure MAXLEVEL >= 3 */

    if ((infile = fopen(iname, "r")) == NULL) {
        sprintf(errstr, "can't open input file %s", iname);
        die(errstr);
    }

    /* set up output file name */

    sprintf(outfilename,"%s-",iname);
    prefixlen = strlen(outfilename);

    do {
        fgets(inbuf, LINE - 1, infile);
        lineno++;
        method = strtok(inbuf, delim);
    } while (((method == NULL) || (*method == '#'))
             && !feof(infile));
    /* skip over comments  and blank lines */

    if ((cp = strtok(NULL, delim))==NULL)
        return "missing <number of graphs>";

    count = atoi(cp);

    if ((cp = strtok(NULL, delim))==NULL)
        seed = 0;
    else
        seed = atol(cp);

    if (strcmp(method,GEO_KW)==0) {

        if (cp = get_geoparms(infile,parmsbuf))
            return cp;
        m = GEO;

    } else if (strcmp(method,HIER_KW)==0) {

        if (cp = get_hierparms(infile,
                               &numlevels, &edgeConnMeth, &haux, parmsbuf))
            return cp;
        m = HIER;

    } else if (strcmp(method,TS_KW)==0) {

        if (cp = get_tsparms(infile,
                             &stubsPerTrans, &tsEdges, &ssEdges, parmsbuf))
            return cp;
        m = TS;
    } else {
        sprintf(errstr,"Unknown generation method %s",method);
        return errstr;
    }


    if (seed)
        gb_init_rand(seed);
    else
        gb_init_rand(DEFAULT_SEED);

    for (i=0; i<count; i++) {
        sprintf(outfilename+prefixlen,"%d.gb",i);
        switch(m) {
        case GEO:
            do {
                gb_recycle(G);
                G = geo(0,parmsbuf);
            } while (G != NULL && !isconnected(G));
            break;
        case HIER:
            G = geo_hier(0,numlevels,edgeConnMeth,haux,parmsbuf);
            break;
        case TS:
            G = transtub(0,stubsPerTrans,tsEdges,ssEdges,&parmsbuf[0],
                         &parmsbuf[1],&parmsbuf[2]);
            break;
        default:
            return "This can't happen!";

        }	/* switch */

        if (G==NULL) {
            sprintf(errstr,"Error creating graph %d, trouble code=%d",i,
                    gb_trouble_code);
            return errstr;
        }

        nerrors = save_graph(G, outfilename);
        if (nerrors > 0)
            fprintf(stderr, "%s had %d anomalies\n", outfilename,nerrors);
        gb_recycle(G);
    }	/* for */

    return NULL;
}