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

Function bounding_rect

renderers/agg/include/agg_bounding_rect.h:29–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 //-----------------------------------------------------------bounding_rect
28 template<class VertexSource, class GetId, class CoordT>
29 bool bounding_rect(VertexSource& vs, GetId& gi,
30 unsigned start, unsigned num,
31 CoordT* x1, CoordT* y1, CoordT* x2, CoordT* y2)
32 {
33 unsigned i;
34 double x;
35 double y;
36 bool first = true;
37
38 *x1 = CoordT(1);
39 *y1 = CoordT(1);
40 *x2 = CoordT(0);
41 *y2 = CoordT(0);
42
43 for(i = 0; i < num; i++)
44 {
45 vs.rewind(gi[start + i]);
46 unsigned cmd;
47 while(!is_stop(cmd = vs.vertex(&x, &y)))
48 {
49 if(is_vertex(cmd))
50 {
51 if(first)
52 {
53 *x1 = CoordT(x);
54 *y1 = CoordT(y);
55 *x2 = CoordT(x);
56 *y2 = CoordT(y);
57 first = false;
58 }
59 else
60 {
61 if(CoordT(x) < *x1) *x1 = CoordT(x);
62 if(CoordT(y) < *y1) *y1 = CoordT(y);
63 if(CoordT(x) > *x2) *x2 = CoordT(x);
64 if(CoordT(y) > *y2) *y2 = CoordT(y);
65 }
66 }
67 }
68 }
69 return *x1 <= *x2 && *y1 <= *y2;
70 }
71
72
73 //-----------------------------------------------------bounding_rect_single

Callers 1

bounding_rectMethod · 0.85

Calls 4

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

Tested by

no test coverage detected