MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / gmtplot_annot_too_crowded

Function gmtplot_annot_too_crowded

src/gmt_plot.c:1756–1776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1754}
1755
1756GMT_LOCAL bool gmtplot_annot_too_crowded (struct GMT_CTRL *GMT, double x, double y, unsigned int side) {
1757 /* Checks if the proposed annotation is too close to a previously plotted annotation */
1758 unsigned int i;
1759 double d_min;
1760
1761 if (GMT->current.setting.map_annot_min_spacing <= 0.0) return (false);
1762
1763 for (i = 0, d_min = DBL_MAX; i < GMT_n_annotations[side]; i++)
1764 d_min = MIN (d_min, hypot (GMT_x_annotation[side][i] - x, GMT_y_annotation[side][i] - y));
1765 if (d_min < GMT->current.setting.map_annot_min_spacing) {
1766 GMT_n_annotations_skip[side]++;
1767 return (true);
1768 }
1769
1770 /* OK to plot and add to list */
1771
1772 if (GMT_n_annotations[side] == GMT_alloc_annotations[side]) gmt_M_malloc2 (GMT, GMT_x_annotation[side], GMT_y_annotation[side], GMT_n_annotations[side], &(GMT_alloc_annotations[side]), double);
1773 GMT_x_annotation[side][GMT_n_annotations[side]] = x, GMT_y_annotation[side][GMT_n_annotations[side]] = y, GMT_n_annotations[side]++;
1774
1775 return (false);
1776}
1777
1778/*! . */
1779GMT_LOCAL double gmtplot_get_annot_offset (struct GMT_CTRL *GMT, bool *flip, unsigned int level) {

Callers 1

gmtplot_map_symbolFunction · 0.85

Calls 1

hypotFunction · 0.85

Tested by

no test coverage detected