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

Method arrange_polygon_orientation

renderers/agg/include/agg_path_storage.h:1281–1315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1279 //------------------------------------------------------------------------
1280 template<class VC>
1281 unsigned path_base<VC>::arrange_polygon_orientation(unsigned start,
1282 path_flags_e orientation)
1283 {
1284 if(orientation == path_flags_none) return start;
1285
1286 // Skip all non-vertices at the beginning
1287 while(start < m_vertices.total_vertices() &&
1288 !is_vertex(m_vertices.command(start))) ++start;
1289
1290 // Skip all insignificant move_to
1291 while(start+1 < m_vertices.total_vertices() &&
1292 is_move_to(m_vertices.command(start)) &&
1293 is_move_to(m_vertices.command(start+1))) ++start;
1294
1295 // Find the last vertex
1296 unsigned end = start + 1;
1297 while(end < m_vertices.total_vertices() &&
1298 !is_next_poly(m_vertices.command(end))) ++end;
1299
1300 if(end - start > 2)
1301 {
1302 if(perceive_polygon_orientation(start, end) != unsigned(orientation))
1303 {
1304 // Invert polygon, set orientation flag, and skip all end_poly
1305 invert_polygon(start, end);
1306 unsigned cmd;
1307 while(end < m_vertices.total_vertices() &&
1308 is_end_poly(cmd = m_vertices.command(end)))
1309 {
1310 m_vertices.modify_command(end++, set_orientation(cmd, orientation));
1311 }
1312 }
1313 }
1314 return end;
1315 }
1316
1317 //------------------------------------------------------------------------
1318 template<class VC>

Callers

nothing calls this directly

Calls 8

is_vertexFunction · 0.85
is_move_toFunction · 0.85
is_next_polyFunction · 0.85
is_end_polyFunction · 0.85
set_orientationFunction · 0.85
total_verticesMethod · 0.45
commandMethod · 0.45
modify_commandMethod · 0.45

Tested by

no test coverage detected