Example #1
0
 FeatureBuilder1::TGeometry & GetHoles()
 {
   ASSERT(m_holes.empty(), ("Can call only once"));
   m_merger.ForEachArea(false, [this](FeatureBuilder1::TPointSeq & v, vector<uint64_t> const &)
   {
     m_holes.push_back(FeatureBuilder1::TPointSeq());
     m_holes.back().swap(v);
   });
   return m_holes;
 }
Example #2
0
void FeatureBuilder1::SetAreaAddHoles(FeatureBuilder1::TGeometry const & holes)
{
  m_params.SetGeomType(GEOM_AREA);
  m_polygons.resize(1);

  if (holes.empty()) return;

  TPointSeq const & poly = GetOuterGeometry();
  m2::Region<m2::PointD> rgn(poly.begin(), poly.end());

  for (TPointSeq const & points : holes)
  {
    ASSERT ( !points.empty(), (*this) );

    size_t j = 0;
    size_t const count = points.size();
    for (; j < count; ++j)
      if (!rgn.Contains(points[j]))
        break;

    if (j == count)
      m_polygons.push_back(points);
  }
}