The R Project SVN R

Rev

Rev 22974 | Rev 24735 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22974 Rev 23360
Line 2964... Line 2964...
2964
 
2964
 
2965
SEXP do_identify(SEXP call, SEXP op, SEXP args, SEXP env)
2965
SEXP do_identify(SEXP call, SEXP op, SEXP args, SEXP env)
2966
{
2966
{
2967
    SEXP ans, x, y, l, ind, pos, Offset, draw, saveans;
2967
    SEXP ans, x, y, l, ind, pos, Offset, draw, saveans;
2968
    double xi, yi, xp, yp, d, dmin, offset;
2968
    double xi, yi, xp, yp, d, dmin, offset;
2969
    int i, imin, k, n, npts, plot, posi;
2969
    int i, imin, k, n, npts, plot, posi, warn;
2970
    DevDesc *dd = CurrentDevice();
2970
    DevDesc *dd = CurrentDevice();
2971
 
2971
 
2972
    /* If we are replaying the display list, then just redraw the
2972
    /* If we are replaying the display list, then just redraw the
2973
       labels beside the identified points */
2973
       labels beside the identified points */
2974
    if (call == R_NilValue) {
2974
    if (call == R_NilValue) {
Line 3036... Line 3036...
3036
		if (d < dmin) {
3036
		if (d < dmin) {
3037
		    imin = i;
3037
		    imin = i;
3038
		    dmin = d;
3038
		    dmin = d;
3039
		}
3039
		}
3040
	    }
3040
	    }
-
 
3041
	    /* can't use warning because we want to print immediately  */
-
 
3042
	    /* might want to handle warn=2? */
-
 
3043
	    warn = asInteger(GetOption(install("warn"), R_NilValue));
3041
	    if (dmin > THRESHOLD)
3044
	    if (dmin > THRESHOLD) {
-
 
3045
	        if(warn >= 0)
3042
		REprintf("warning: no point with %.2f inches\n", THRESHOLD);
3046
		    REprintf("warning: no point with %.2f inches\n", 
-
 
3047
                                        THRESHOLD);
-
 
3048
	    }
3043
	    else if (LOGICAL(ind)[imin])
3049
	    else if (LOGICAL(ind)[imin]) {
-
 
3050
	        if(warn >= 0 )
3044
		REprintf("warning: nearest point already identified\n");
3051
		    REprintf("warning: nearest point already identified\n");
-
 
3052
	    }
3045
	    else {
3053
	    else {
3046
		k++;
3054
		k++;
3047
		LOGICAL(ind)[imin] = 1;
3055
		LOGICAL(ind)[imin] = 1;
3048
 
3056
 
3049
		xi = REAL(x)[imin];
3057
		xi = REAL(x)[imin];