Exemplo n.º 1
0
bool DatabaseTask::LoadStyleConfig(const std::wstring& filename)
{
  Lum::OS::Guard<Lum::OS::Mutex> guard(mutex);

  Lum::Base::Path f;

  f.SetNativePath(filename);

  osmscout::TypeConfigRef typeConfig=database->GetTypeConfig();

  if (typeConfig.Valid()) {
    styleConfig=new osmscout::StyleConfig(typeConfig);

    delete painter;
    painter=NULL;

    if (styleConfig->Load(Lum::Base::WStringToString(f.GetPath()).c_str())) {
      painter=new osmscout::MapPainterCairo(styleConfig);

      return true;
    }
    else {
      styleConfig=NULL;

      return false;
    }
  }
  else {
    styleConfig=NULL;
    return false;
  }
}
Exemplo n.º 2
0
bool DatabaseTask::LoadStyleConfig(const std::wstring& filename,
                                   osmscout::StyleConfig*& styleConfig)
{
  Lum::OS::Guard<Lum::OS::Mutex> guard(mutex);

  Lum::Base::Path f;

  f.SetNativePath(filename);

  if (database->GetTypeConfig()!=NULL) {
    styleConfig=new osmscout::StyleConfig(database->GetTypeConfig());

    if (osmscout::LoadStyleConfig(Lum::Base::WStringToString(f.GetPath()).c_str(),
                                  *styleConfig)) {
      return true;
    }
    else {
      delete styleConfig;
      styleConfig=NULL;

      return false;
    }
  }
  else {
    styleConfig=NULL;
    return false;
  }
}