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

Method JoinCommonEdges

renderers/agg/src/clipper.cpp:2140–2278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2138//------------------------------------------------------------------------------
2139
2140void Clipper::JoinCommonEdges()
2141{
2142 for (JoinList::size_type i = 0; i < m_Joins.size(); i++)
2143 {
2144 PolyPt *pp1a, *pp1b, *pp2a, *pp2b;
2145 IntPoint pt1, pt2;
2146 JoinRec* j = m_Joins[i];
2147
2148 pp1a = m_PolyPts[j->poly1Idx];
2149 pp2a = m_PolyPts[j->poly2Idx];
2150 bool found = FindSegment(pp1a, j->pt1a, j->pt1b);
2151 if (found)
2152 {
2153 if (j->poly1Idx == j->poly2Idx)
2154 {
2155 //we're searching the same polygon for overlapping segments so
2156 //we really don't want segment 2 to be the same as segment 1 ...
2157 pp2a = pp1a->next;
2158 found = FindSegment(pp2a, j->pt2a, j->pt2b) && (pp2a != pp1a);
2159 }
2160 else
2161 found = FindSegment(pp2a, j->pt2a, j->pt2b);
2162 }
2163
2164 if (found)
2165 {
2166 if (PointsEqual(pp1a->next->pt, j->pt1b))
2167 pp1b = pp1a->next; else pp1b = pp1a->prev;
2168 if (PointsEqual(pp2a->next->pt, j->pt2b))
2169 pp2b = pp2a->next; else pp2b = pp2a->prev;
2170 if (GetOverlapSegment(pp1a->pt, pp1b->pt, pp2a->pt, pp2b->pt, pt1, pt2))
2171 {
2172 PolyPt *p1, *p2, *p3, *p4;
2173 //get p1 & p2 polypts - the overlap start & endpoints on poly1
2174 Position pos1 = GetPosition(pp1a->pt, pp1b->pt, pt1);
2175 if (pos1 == pFirst) p1 = pp1a;
2176 else if (pos1 == pSecond) p1 = pp1b;
2177 else p1 = InsertPolyPtBetween(pp1a, pp1b, pt1);
2178 Position pos2 = GetPosition(pp1a->pt, pp1b->pt, pt2);
2179 if (pos2 == pMiddle)
2180 {
2181 if (pos1 == pMiddle)
2182 {
2183 if (Pt3IsBetweenPt1AndPt2(pp1a->pt, p1->pt, pt2))
2184 p2 = InsertPolyPtBetween(pp1a, p1, pt2); else
2185 p2 = InsertPolyPtBetween(p1, pp1b, pt2);
2186 }
2187 else if (pos2 == pFirst) p2 = pp1a;
2188 else p2 = pp1b;
2189 }
2190 else if (pos2 == pFirst) p2 = pp1a;
2191 else p2 = pp1b;
2192 //get p3 & p4 polypts - the overlap start & endpoints on poly2
2193 pos1 = GetPosition(pp2a->pt, pp2b->pt, pt1);
2194 if (pos1 == pFirst) p3 = pp2a;
2195 else if (pos1 == pSecond) p3 = pp2b;
2196 else p3 = InsertPolyPtBetween(pp2a, pp2b, pt1);
2197 pos2 = GetPosition(pp2a->pt, pp2b->pt, pt2);

Callers

nothing calls this directly

Calls 13

FindSegmentFunction · 0.85
PointsEqualFunction · 0.85
GetOverlapSegmentFunction · 0.85
GetPositionFunction · 0.85
InsertPolyPtBetweenFunction · 0.85
Pt3IsBetweenPt1AndPt2Function · 0.85
DeletePolyPtFunction · 0.85
PointInPolygonFunction · 0.85
SetHoleStateFunction · 0.85
PointIsVertexFunction · 0.85
FixSpikesFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected