Ejemplo n.º 1
0
void CaptionDescription::Init(FeatureType & f, int8_t deviceLang, int const zoomLevel,
                              feature::EGeomType const type, drule::text_type_t const mainTextType,
                              bool const auxCaptionExists)
{
  if (auxCaptionExists || type == feature::GEOM_LINE)
    f.GetPreferredNames(true /* allowTranslit */, deviceLang, m_mainText, m_auxText);
  else
    f.GetReadableName(true /* allowTranslit */, deviceLang, m_mainText);

  // Set max text size to avoid VB/IB overflow in rendering.
  size_t constexpr kMaxTextSize = 200;
  if (m_mainText.size() > kMaxTextSize)
    m_mainText = m_mainText.substr(0, kMaxTextSize) + "...";

  m_roadNumber = f.GetRoadNumber();
  m_houseNumber = f.GetHouseNumber();

  ProcessZoomLevel(zoomLevel);
  ProcessMainTextType(mainTextType);
}
Ejemplo n.º 2
0
    void operator() (FeatureType const & f)
    {
      feature::TypesHolder types(f);
      if (!types.Has(m_coastType) && NeedProcess(types))
      {
        double const d = f.GetDistance(m_pt, m_scale);
        ASSERT_GREATER_OR_EQUAL(d, 0.0, ());

        if (IsInclude(d, types))
        {
          string name;
          f.GetReadableName(name);
          string house = f.GetHouseNumber();

          // if geom type is not GEOM_POINT, result center point doesn't matter in future use
          m2::PointD const pt =
              (types.GetGeoType() == feature::GEOM_POINT) ? f.GetCenter() : m2::PointD();

          // name, house are assigned like move semantics
          m_cont.push_back(FeatureInfoT(GetResultDistance(d, types), types, name, house, pt));
        }
      }