예제 #1
0
void
draw_main(void)
{
	if (draw_flag) {
		draw_flag = 0; // so "stop" really stops
		stop("draw calls draw");
	}

	draw_flag++;

	setup_trange();

	setup_xrange();

	setup_yrange();

	check_for_parametric_draw();

	create_point_set();

	emit_graph();

	draw_flag--;
}
예제 #2
0
void dotneato_write(graph_t* g, std::string *output_str)
{
	double	xf, yf;
	char	*p;
	int	i;

	/* margins */
	if ((p = agget(g,"margin"))) {
		i = sscanf(p,"%lf,%lf",&xf,&yf);
		if (i > 0) g->u.drawing->margin.x = g->u.drawing->margin.y = POINTS(xf);
		if (i > 1) g->u.drawing->margin.y = POINTS(yf);
	}
	else {
		/* set default margins depending on format */
		switch (Output_lang) {
			case GIF:
			case PNG:
			case JPEG:
			case GD:
			case GD2:
			case ISMAP:
			case IMAP:
			case VRML:
			case SVG:
	        		g->u.drawing->margin.x = DEFAULT_EMBED_MARGIN_X;
				g->u.drawing->margin.y = DEFAULT_EMBED_MARGIN_Y;
				break;
			case POSTSCRIPT:
			case HPGL:
			case PCL:
			case MIF:
			case METAPOST:
			case FIG:
			case VTX:
			case ATTRIBUTED_DOT:
			case PLAIN:		
	        		g->u.drawing->margin.x = g->u.drawing->margin.y = DEFAULT_MARGIN;
				break;
			case CANONICAL_DOT:
				break;
		}
	}

	switch (Output_lang) {
		case POSTSCRIPT:
		case HPGL:
		case PCL:
		case MIF:
		case GIF:
		case PNG:
		case JPEG:
		case GD:
		case GD2:
		case ISMAP:
		case IMAP:
		case VRML:
		case METAPOST:
		case FIG:
		case SVG:
			/* output in breadth first graph walk order */
			emit_graph(g,0); break;
		case VTX:
			/* output sorted, i.e. all nodes then all edges */
			emit_graph(g,1); break;
		case ATTRIBUTED_DOT:
			attach_attrs(g);
			agwrite(g,Output_file); break;
		case CANONICAL_DOT:
			agwrite(g,Output_file); break;
		case PLAIN:
			attach_attrs(g);
			if (output_str)
			    write_plainstr(g,output_str);
			else
			    write_plain(g,Output_file);
			break;
	}
	fflush(Output_file);
}