The R Project SVN R

Rev

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

Rev 27811 Rev 29956
Line 419... Line 419...
419
    int jjj = 1;
419
    int jjj = 1;
420
    while ((jjj < ns) && (distanceSum < labelDistance)) {
420
    while ((jjj < ns) && (distanceSum < labelDistance)) {
421
	/* Find a gap big enough for the label
421
	/* Find a gap big enough for the label
422
	   use several segments if necessary
422
	   use several segments if necessary
423
	*/
423
	*/
424
	dX = xxx[jjj] - xxx[jjj - n - 1];
424
	dX = xxx[jjj] - xxx[jjj - n - 1]; /* jjj - n - 1 == 0 */
425
	dY = yyy[jjj] - yyy[jjj - n - 1];
425
	dY = yyy[jjj] - yyy[jjj - n - 1];
426
	dXC = GConvertXUnits(dX, USER, INCHES, dd);
426
	dXC = GConvertXUnits(dX, USER, INCHES, dd);
427
	dYC = GConvertYUnits(dY, USER, INCHES, dd);
427
	dYC = GConvertYUnits(dY, USER, INCHES, dd);
428
	distanceSum = hypot(dXC, dYC);
428
	distanceSum = hypot(dXC, dYC);
429
	jjj = (jjj + 1);
429
	jjj++;
430
	n += 1;
430
	n++;
431
    }
431
    }
432
    if (distanceSum < labelDistance)
432
    if (distanceSum < labelDistance)
433
	return 0;
433
	return 0;
434
    else
434
    else
435
	return n;
435
	return n;
Line 445... Line 445...
445
    int jjj = ns - 2;
445
    int jjj = ns - 2;
446
    while ((jjj > -1) && (distanceSum < labelDistance)) {
446
    while ((jjj > -1) && (distanceSum < labelDistance)) {
447
	/* Find a gap big enough for the label
447
	/* Find a gap big enough for the label
448
	   use several segments if necessary
448
	   use several segments if necessary
449
	*/
449
	*/
-
 
450
	REprintf("%d %d %d\n",ns, jjj, jjj+n+1);
450
	dX = xxx[jjj] - xxx[jjj + n + 1];
451
	dX = xxx[jjj] - xxx[jjj + n + 1]; /*jjj + n + 1 == ns -1 */
451
	dY = yyy[jjj] - yyy[jjj + n + 1];
452
	dY = yyy[jjj] - yyy[jjj + n + 1];
452
	dXC = GConvertXUnits(dX, USER, INCHES, dd);
453
	dXC = GConvertXUnits(dX, USER, INCHES, dd);
453
	dYC = GConvertYUnits(dY, USER, INCHES, dd);
454
	dYC = GConvertYUnits(dY, USER, INCHES, dd);
454
	distanceSum = hypot(dXC, dYC);
455
	distanceSum = hypot(dXC, dYC);
455
	jjj--;
456
	jjj--;
456
	n -= 1;
457
	n++;
457
    }
458
    }
458
    if (distanceSum < labelDistance)
459
    if (distanceSum < labelDistance)
459
	return 0;
460
	return 0;
460
    else
461
    else
461
	return -n;
462
	return n;
462
}
463
}
463
 
464
 
464
/* 
465
/* 
465
 * Generate a list of segments for a single level
466
 * Generate a list of segments for a single level
466
 */
467
 */