Пример #1
0
void RuleDrawer::operator()(FeatureType const & f)
{
  if (CheckCancelled())
    return;

  Stylist s;
  m_callback(f, s);

  if (s.IsEmpty())
    return;

  int const zoomLevel = m_context->GetTileKey().m_zoomLevel;

  if (s.IsCoastLine() &&
      zoomLevel > scales::GetUpperWorldScale() &&
      f.GetID().m_mwmId.GetInfo()->GetType() == MwmInfo::COASTS)
  {
    string name;
    if (f.GetName(StringUtf8Multilang::kDefaultCode, name))
    {
      ASSERT(!name.empty(), ());
      strings::SimpleTokenizer iter(name, ";");
      while (iter)
      {
        if (m_isLoadedFn(*iter))
          return;
        ++iter;
      }
    }
Пример #2
0
bool InitStylist(FeatureType & f, int8_t deviceLang, int const zoomLevel, bool buildings3d, Stylist & s)
{
  feature::TypesHolder const types(f);

  if (!buildings3d && IsBuildingPartChecker::Instance()(types) &&
      !ftypes::IsBuildingChecker::Instance()(types))
    return false;

  drule::KeysT keys;
  auto const geomType = feature::GetDrawRule(types, zoomLevel, keys);

  feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys);

  if (keys.empty())
    return false;

  drule::MakeUnique(keys);

  if (geomType.second)
    s.RaiseCoastlineFlag();

  auto const mainGeomType = feature::EGeomType(geomType.first);

  switch (mainGeomType)
  {
  case feature::GEOM_POINT:
    s.RaisePointStyleFlag();
    break;
  case feature::GEOM_LINE :
    s.RaiseLineStyleFlag();
    break;
  case feature::GEOM_AREA :
    s.RaiseAreaStyleFlag();
    break;
  default:
    ASSERT(false, ());
    return false;
  }

  Aggregator aggregator(f, mainGeomType, zoomLevel, static_cast<int>(keys.size()));
  aggregator.AggregateKeys(keys);

  CaptionDescription & descr = s.GetCaptionDescriptionImpl();
  descr.Init(f, deviceLang, zoomLevel, mainGeomType, aggregator.m_mainTextType, aggregator.m_auxCaptionFound);

  aggregator.AggregateStyleFlags(keys, descr.IsNameExists());

  if (aggregator.m_pointStyleFound)
    s.RaisePointStyleFlag();
  if (aggregator.m_lineStyleFound)
    s.RaiseLineStyleFlag();

  s.m_rules.swap(aggregator.m_rules);

  return true;
}
Пример #3
0
bool RuleDrawer::CheckCoastlines(FeatureType & f, Stylist const & s)
{
  int const zoomLevel = m_context->GetTileKey().m_zoomLevel;

  if (s.IsCoastLine() &&
      zoomLevel > scales::GetUpperWorldScale() &&
      f.GetID().m_mwmId.GetInfo()->GetType() == MwmInfo::COASTS)
  {
    string name;
    if (f.GetName(StringUtf8Multilang::kDefaultCode, name))
    {
      ASSERT(!name.empty(), ());
      strings::SimpleTokenizer iter(name, ";");
      while (iter)
      {
        if (m_isLoadedFn(*iter))
          return false;
        ++iter;
      }
    }