/* See {pz_full_plot.h}. */ /* Last edited on 2008-02-08 12:52:56 by stolfi */ #include #include #include #include #include #include #include #include #include void pz_full_plot_cand( char *fname, pz_candidate_t *cand, pz_r3_chain_t *c0, pz_r3_chain_t *c1 /* Curves, already mapped; */ bool_t whole, bool_t closed, bool_t colors, bool_t thicker, bool_t dots, bool_t pointers, double labelSize, bool_t axes, double grid, bool_t epsFormat, char *caption, /* (:= "") */ unsigned drawEvery, /* (:= 1) */ unsigned drawMatchEvery, /* (:= 0) */ double XSize, /* (:= 150.0e0) */ double YSize, /* (:= 75.0e0) */ ) { if (( epsFormat )){ { /* with */ ??? fileName = txtcat(fname , ".eps"); ??? f = NEW(PSPlot.EPSFile).open(fileName, XSize, YSize); /* do */ fprintf(stderr, "writing %s ...\n", fileName ); pz_full_plot_scales_and_axes(f, c0, c1, aspect = XSize/YSize, axes = axes, grid = grid); pz_plot.pz_full_plot_cand( f, cand, c0, c1, whole = whole, closed = closed, colors = colors, thicker = thicker, dots = dots, pointers = pointers, labelSize = labelSize, drawEvery = drawEvery, drawMatchEvery = drawMatchEvery ); f.close() ; } }else{ { /* with */ ??? f = NEW(PSPlot.PSFile).open(fname & ".ps"); /* do */ f.beginPage(); pz_full_plot_begin_ps_drawing(f, XSize, YSize); pz_full_plot_scales_and_axes(f, c0, c1, aspect = XSize/YSize, axes = axes, grid = grid); pz_plot.pz_full_plot_cand( f, cand, c0, c1, whole = whole, closed = closed, colors = colors, thicker = thicker, dots = dots, pointers = pointers, labelSize = labelSize, drawEvery = drawEvery, drawMatchEvery = drawMatchEvery ); if (( NOT Text.Empty(caption) )){ f.setTextColor(Color{0.0, 0.0, 0.0}); f.caption(caption); ; }; f.endDrawing(); f.endPage(); f.close() ; }; } } /* pz_full_plot_cand */ void pz_full_plot_begin_ps_drawing( PSPlot.PSFile f, double xSize, double ySize ) CONST { { /* with */ ??? xMargin = 0.5e0 * (PSPlot.LetterXSize - xSize); ??? yMargin = 0.5e0 * (PSPlot.LetterYSize - ySize); ??? xCenter = xSize * 0.5e0 + xMargin; ??? yCenter = ySize * 0.5e0 + yMargin; /* do */ f.beginDrawing(xSize, ySize, xCenter, yCenter);; } } /* pz_full_plot_begin_ps_drawing */ CONST X == PSPlot.Axis.X; Y == PSPlot.Axis.Y; void pz_full_plot_scales_and_axes( PSPlot.File f, pz_r3_chain_t *c0, pz_r3_chain_t *c1, double aspect, bool_t axes, double grid ) { { /* with */ w = pz_window_expand( pz_window_join(pz_r3_chain_get_window(c0), pz_r3_chain_get_window(c1)); 0.05e0 ); ??? xm = (w[X].end[0] + w[X].end[1])/2.0e0; ??? ym = (w[Y].end[0] + w[Y].end[1])/2.0e0; ??? hwx = (w[X].end[1] - w[X].end[0])/2.0e0; ??? hwy = (w[Y].end[1] - w[Y].end[0])/2.0e0; ??? fragHalfWidth = MAX(hwx, aspect*hwy); ??? xMin = xm-fragHalfWidth; ??? xMax = xm+fragHalfWidth; ??? yMin = ym-fragHalfWidth/aspect; ??? yMax = ym+fragHalfWidth/aspect; /* do */ f.setScale(PSPlot.Axis.X, xMin, xMax); f.setScale(PSPlot.Axis.Y, yMin, yMax); if (( grid > 0.0e0 )){ pz_plot.Grid(f, grid) ;}; if (( axes )){ f.setLineWidth(0.2); f.setLineSolid(); f.setLineColor(Color{0.0, 0.0, 0.0}); f.coordLine(PSPlot.Axis.X, xm); f.coordLine(PSPlot.Axis.Y, ym);; };; }; } /* pz_full_plot_scales_and_axes */