MCPcopy Create free account
hub / github.com/MapServer/MapServer / bounding_rect_single

Function bounding_rect_single

renderers/agg/include/agg_bounding_rect.h:75–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 //-----------------------------------------------------bounding_rect_single
74 template<class VertexSource, class CoordT>
75 bool bounding_rect_single(VertexSource& vs, unsigned path_id,
76 CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2)
77 {
78 double x;
79 double y;
80 bool first = true;
81
82 *x1 = CoordT(1);
83 *y1 = CoordT(1);
84 *x2 = CoordT(0);
85 *y2 = CoordT(0);
86
87 vs.rewind(path_id);
88 unsigned cmd;
89 while(!is_stop(cmd = vs.vertex(&x, &y)))
90 {
91 if(is_vertex(cmd))
92 {
93 if(first)
94 {
95 *x1 = CoordT(x);
96 *y1 = CoordT(y);
97 *x2 = CoordT(x);
98 *y2 = CoordT(y);
99 first = false;
100 }
101 else
102 {
103 if(CoordT(x) < *x1) *x1 = CoordT(x);
104 if(CoordT(y) < *y1) *y1 = CoordT(y);
105 if(CoordT(x) > *x2) *x2 = CoordT(x);
106 if(CoordT(y) > *y2) *y2 = CoordT(y);
107 }
108 }
109 }
110 return *x1 <= *x2 && *y1 <= *y2;
111 }
112
113
114}

Callers 1

text_widthMethod · 0.85

Calls 4

is_stopFunction · 0.85
is_vertexFunction · 0.85
rewindMethod · 0.45
vertexMethod · 0.45

Tested by

no test coverage detected