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

Method AppendPolygon

renderers/agg/src/clipper.cpp:1273–1372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1271//------------------------------------------------------------------------------
1272
1273void Clipper::AppendPolygon(TEdge *e1, TEdge *e2)
1274{
1275 //get the start and ends of both output polygons ...
1276 PolyPt* p1_lft = m_PolyPts[e1->outIdx];
1277 PolyPt* p1_rt = p1_lft->prev;
1278 PolyPt* p2_lft = m_PolyPts[e2->outIdx];
1279 PolyPt* p2_rt = p2_lft->prev;
1280
1281 //fixup orientation (hole) flag if necessary ...
1282 if (p1_lft->isHole != p2_lft->isHole)
1283 {
1284 PolyPt *p;
1285 PolyPt *bottom1 = PolygonBottom(p1_lft);
1286 PolyPt *bottom2 = PolygonBottom(p2_lft);
1287 if (bottom1->pt.Y > bottom2->pt.Y) p = p2_lft;
1288 else if (bottom1->pt.Y < bottom2->pt.Y) p = p1_lft;
1289 else if (bottom1->pt.X < bottom2->pt.X) p = p2_lft;
1290 else if (bottom1->pt.X > bottom2->pt.X) p = p1_lft;
1291 //todo - the following line really only a best guess ...
1292 else if (bottom1->isHole) p = p1_lft; else p = p2_lft;
1293
1294 SetHoleState(p, !p->isHole);
1295 }
1296
1297 EdgeSide side;
1298 //join e2 poly onto e1 poly and delete pointers to e2 ...
1299 if( e1->side == esLeft )
1300 {
1301 if( e2->side == esLeft )
1302 {
1303 //z y x a b c
1304 ReversePolyPtLinks(*p2_lft);
1305 p2_lft->next = p1_lft;
1306 p1_lft->prev = p2_lft;
1307 p1_rt->next = p2_rt;
1308 p2_rt->prev = p1_rt;
1309 m_PolyPts[e1->outIdx] = p2_rt;
1310 } else
1311 {
1312 //x y z a b c
1313 p2_rt->next = p1_lft;
1314 p1_lft->prev = p2_rt;
1315 p2_lft->prev = p1_rt;
1316 p1_rt->next = p2_lft;
1317 m_PolyPts[e1->outIdx] = p2_lft;
1318 }
1319 side = esLeft;
1320 } else
1321 {
1322 if( e2->side == esRight )
1323 {
1324 //a b c z y x
1325 ReversePolyPtLinks( *p2_lft );
1326 p1_rt->next = p2_rt;
1327 p2_rt->prev = p1_rt;
1328 p2_lft->next = p1_lft;
1329 p1_lft->prev = p2_lft;
1330 } else

Callers

nothing calls this directly

Calls 4

PolygonBottomFunction · 0.85
SetHoleStateFunction · 0.85
ReversePolyPtLinksFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected