| 21 | } |
| 22 | |
| 23 | void MergedFeatureBuilder::AppendFeature(MergedFeatureBuilder const & fb, bool fromBegin, bool toBack) |
| 24 | { |
| 25 | // Also merge Osm IDs for debugging |
| 26 | m_osmIds.insert(m_osmIds.end(), fb.m_osmIds.begin(), fb.m_osmIds.end()); |
| 27 | |
| 28 | PointSeq & thisG = m_polygons.front(); |
| 29 | PointSeq const & fbG = fb.GetOuterGeometry(); |
| 30 | |
| 31 | if (fb.m_isRound) |
| 32 | { |
| 33 | if (toBack) |
| 34 | m_roundBounds[1] = fbG; |
| 35 | else |
| 36 | m_roundBounds[0] = fbG; |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | if (toBack) |
| 41 | m_roundBounds[1].clear(); |
| 42 | else |
| 43 | m_roundBounds[0].clear(); |
| 44 | |
| 45 | m_isRound = false; |
| 46 | |
| 47 | using namespace feature; |
| 48 | |
| 49 | if (fromBegin) |
| 50 | { |
| 51 | if (toBack) |
| 52 | { |
| 53 | thisG.insert(thisG.end(), fbG.begin() + 1, fbG.end()); |
| 54 | CalcRect(fbG.begin() + 1, fbG.end(), m_limitRect); |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | thisG.insert(thisG.begin(), fbG.begin(), fbG.end() - 1); |
| 59 | CalcRect(fbG.begin(), fbG.end() - 1, m_limitRect); |
| 60 | } |
| 61 | } |
| 62 | else if (toBack) |
| 63 | { |
| 64 | thisG.insert(thisG.end(), fbG.rbegin() + 1, fbG.rend()); |
| 65 | CalcRect(fbG.rbegin() + 1, fbG.rend(), m_limitRect); |
| 66 | } |
| 67 | else |
| 68 | { |
| 69 | thisG.insert(thisG.begin(), fbG.rbegin(), fbG.rend() - 1); |
| 70 | CalcRect(fbG.rbegin(), fbG.rend() - 1, m_limitRect); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | bool MergedFeatureBuilder::EqualGeometry(MergedFeatureBuilder const & fb) const |
| 75 | { |