From 10151fe7b851477323079b11c562aeb9f2d89d00 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (home)" <j.wuttke@fz-juelich.de> Date: Sat, 10 Oct 2009 23:33:54 +0200 Subject: [PATCH] corr --- pub/src/dualplot.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pub/src/dualplot.cpp b/pub/src/dualplot.cpp index bc9a1829..9b7feb1d 100644 --- a/pub/src/dualplot.cpp +++ b/pub/src/dualplot.cpp @@ -395,16 +395,23 @@ void CPlot::plotScan( const bool as_line, const int style_no, FILE *gp_fd; if (!(gp_fd = fopen(gp_fnam, "w"))) throw string("cannot save gnuplot data to ") + gp_fnam; + uint nout = 0; for (uint i=0; i<np; i++){ - // invalid points should be intercepted outside Line(..) if( xp[i]<X.inf || xp[i]>X.sup ) - throw "Plot::Line: x["+strg(i)+"]="+strg(xp[i])+" out of range"; + continue; + // throw "Plot::Line: x["+strg(i)+"]="+strg(xp[i])+" out of range"; if( yp[i]<Y.inf || yp[i]>Y.sup ) - throw "Plot::Line: y["+strg(i)+"]="+strg(yp[i])+" out of range"; + continue; + // throw "Plot::Line: y["+strg(i)+"]="+strg(yp[i])+" out of range"; fprintf(gp_fd, "%16.8g %16.8g\n", xp[i], yp[i]); + nout++; } fclose(gp_fd); - + if( !nout ){ + cout << "no points in frame: " << info << "\n"; + return; + } + // Live display: string cmd = "plot "; char aux[80]; @@ -431,6 +438,10 @@ void CPlot::plotScan( const bool as_line, const int style_no, strncat( outlin, "\n", CPLOT_LINSIZ ); ps_accu.push_back( outlin ); for (uint i=0; i<np; i++) { + if( xp[i]<X.inf || xp[i]>X.sup ) + continue; + if( yp[i]<Y.inf || yp[i]>Y.sup ) + continue; snprintf( outlin, CPLOT_LINSIZ, "%7.3f%7.3f%7.3f t%c %% %14.7g wx %14.7g wy\n", X.pc(xp[i]), Y.pc(yp[i]), 0.0, @@ -529,7 +540,7 @@ string CPlot::info() { string ret; ret = "x: " + X.info(); - ret += " y: " + X.info(); + ret += " y: " + Y.info(); return ret; } -- GitLab