Beispiel #1
0
  void DirSelect::Resync(Base::Model* model, const Base::ResyncMsg& /*msg*/)
  {
    if (model==this->model) {
      GenerateItemList();
      Redraw();
    }
    else { // Buttons
      size_t x=0;
      while (x<models.size()) {
        if (models[x].Get()==model && models[x]->IsFinished()) {
          if (this->model.Valid()) {
            Lum::Base::Path newPath;

            if (x==this->model->Get().GetPartCount()) {
              newPath.SetNativeDir(this->model->Get().GetRoot());
            }
            else {
              newPath.SetNativeDir(this->model->Get().GetSubDir(this->model->Get().GetPartCount()-x-1));
            }
            this->model->Set(newPath);
          }
          break;
        }
        x++;
      }
    }
  }
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()) {
    return false;
  }

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

  GetCarSpeedTable(speedMap);

  routingProfile=new osmscout::FastestPathRoutingProfile(database->GetTypeConfig());
  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 #4
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;
  }
}