Beispiel #1
0
bool DatabaseTask::Open(const std::wstring& path)
{
  Lum::OS::Guard<Lum::OS::Mutex> guard(mutex);

  Lum::Base::Path  p;

  p.SetNativeDir(path);

  if (!database->Open(Lum::Base::WStringToString(p.GetPath()).c_str())) {
    return false;
  }

  if (!router->Open(Lum::Base::WStringToString(p.GetPath()).c_str())) {
    return false;
  }

  std::map<std::string,double> speedMap;

  GetCarSpeedTable(speedMap);

  routingProfile.ParametrizeForCar(*router->GetTypeConfig(),
                                   speedMap,
                                   160.0);

  return true;
}
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;
  }
}
Beispiel #3
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;
  }
}