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

Method ProcessHorizontal

renderers/agg/src/clipper.cpp:1557–1656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1555//------------------------------------------------------------------------------
1556
1557void Clipper::ProcessHorizontal(TEdge *horzEdge)
1558{
1559 Direction dir;
1560 long64 horzLeft, horzRight;
1561
1562 if( horzEdge->xcurr < horzEdge->xtop )
1563 {
1564 horzLeft = horzEdge->xcurr;
1565 horzRight = horzEdge->xtop;
1566 dir = dLeftToRight;
1567 } else
1568 {
1569 horzLeft = horzEdge->xtop;
1570 horzRight = horzEdge->xcurr;
1571 dir = dRightToLeft;
1572 }
1573
1574 TEdge* eMaxPair;
1575 if( horzEdge->nextInLML ) eMaxPair = 0;
1576 else eMaxPair = GetMaximaPair(horzEdge);
1577
1578 TEdge* e = GetNextInAEL( horzEdge , dir );
1579 while( e )
1580 {
1581 TEdge* eNext = GetNextInAEL( e, dir );
1582 if( e->xcurr >= horzLeft && e->xcurr <= horzRight )
1583 {
1584 //ok, so far it looks like we're still in range of the horizontal edge
1585 if ( e->xcurr == horzEdge->xtop && horzEdge->nextInLML)
1586 {
1587 if (SlopesEqual(*e, *horzEdge->nextInLML))
1588 {
1589 //if output polygons share an edge, they'll need joining later ...
1590 if (horzEdge->outIdx >= 0 && e->outIdx >= 0)
1591 AddJoin(horzEdge->nextInLML, e, horzEdge->outIdx);
1592 break; //we've reached the end of the horizontal line
1593 }
1594 else if (e->dx < horzEdge->nextInLML->dx)
1595 //we really have got to the end of the intermediate horz edge so quit.
1596 //nb: More -ve slopes follow more +ve slopes ABOVE the horizontal.
1597 break;
1598 }
1599
1600 if( e == eMaxPair )
1601 {
1602 //horzEdge is evidently a maxima horizontal and we've arrived at its end.
1603 if (dir == dLeftToRight)
1604 IntersectEdges(horzEdge, e, IntPoint(e->xcurr, horzEdge->ycurr), ipNone);
1605 else
1606 IntersectEdges(e, horzEdge, IntPoint(e->xcurr, horzEdge->ycurr), ipNone);
1607 return;
1608 }
1609 else if( e->dx == horizontal && !IsMinima(e) && !(e->xcurr > e->xtop) )
1610 {
1611 //An overlapping horizontal edge. Overlapping horizontal edges are
1612 //processed as if layered with the current horizontal edge (horizEdge)
1613 //being infinitesimally lower that the next (e). Therfore, we
1614 //intersect with e only if e.xcurr is within the bounds of horzEdge ...

Callers

nothing calls this directly

Calls 6

GetMaximaPairFunction · 0.85
GetNextInAELFunction · 0.85
SlopesEqualFunction · 0.85
IntPointClass · 0.85
IsMinimaFunction · 0.85
clipperExceptionClass · 0.85

Tested by

no test coverage detected