| 1609 | } |
| 1610 | |
| 1611 | void msPolylineLabelPointLineString(shapeObj *p, int min_length, int repeat_distance, double ***angles, double ***lengths, double** segment_lengths, |
| 1612 | int line_index, double line_length, double total_length, int segment_index, int* labelpoints_index, int* labelpoints_size, pointObj ***labelpoints, int anglemode) |
| 1613 | { |
| 1614 | int i, j, k, l, n, index, point_repeat; |
| 1615 | double t, tmp_length, theta, fwd_length, point_distance; |
| 1616 | double center_point_position, left_point_position, right_point_position, point_position; |
| 1617 | |
| 1618 | tmp_length = total_length; |
| 1619 | if (repeat_distance > 0) |
| 1620 | tmp_length = line_length; |
| 1621 | |
| 1622 | if((min_length != -1) && (tmp_length < min_length)) /* too short to label */ |
| 1623 | return; |
| 1624 | |
| 1625 | i = line_index; |
| 1626 | |
| 1627 | if(p->line[i].numpoints < 2) |
| 1628 | return; |
| 1629 | point_distance = 0; |
| 1630 | point_repeat = 1; |
| 1631 | left_point_position = right_point_position = center_point_position = line_length / 2.0; |
| 1632 | |
| 1633 | if (repeat_distance > 0) { |
| 1634 | point_repeat = line_length / repeat_distance; |
| 1635 | |
| 1636 | if (point_repeat > 1) { |
| 1637 | if (point_repeat % 2 == 0) |
| 1638 | point_repeat -= 1; |
| 1639 | point_distance = (line_length / point_repeat); // buffer allowed per point |
| 1640 | |
| 1641 | // initial point position |
| 1642 | left_point_position -= ((point_repeat-1)/2 * point_distance); |
| 1643 | right_point_position += ((point_repeat-1)/2 * point_distance); |
| 1644 | |
| 1645 | point_repeat = (point_repeat-1)/2+1; |
| 1646 | } |
| 1647 | else |
| 1648 | point_repeat = 1; |
| 1649 | } |
| 1650 | |
| 1651 | for (l=0; l < point_repeat; ++l) |
| 1652 | { |
| 1653 | if (l == point_repeat-1) { // last point to place is always the center point |
| 1654 | point_position = center_point_position; |
| 1655 | n = 1; |
| 1656 | } |
| 1657 | else { |
| 1658 | point_position = right_point_position; |
| 1659 | n = 0; |
| 1660 | } |
| 1661 | |
| 1662 | do { |
| 1663 | if (*labelpoints_index == *labelpoints_size) { |
| 1664 | *labelpoints_size *= 2; |
| 1665 | (*labelpoints) = (pointObj **) msSmallRealloc(*labelpoints,sizeof(pointObj *) * (*labelpoints_size)); |
| 1666 | (*angles) = (double **) msSmallRealloc(*angles,sizeof(double *) * (*labelpoints_size)); |
| 1667 | (*lengths) = (double **) msSmallRealloc(*lengths,sizeof(double *) * (*labelpoints_size)); |
| 1668 | } |
no test coverage detected