public void putPois(List<Poi> pois, NamedArea namedArea) { foreach (Poi p in pois) { put(p, namedArea); } }
// TODO: should get list of areas from server public Hashtable findAreas() { Hashtable areas = new Hashtable(); areas["Kraków"] = new NamedArea("Krakow", 50.1046, 19.8669, 50.0233, 20.0029); return areas; }
public void downloadAreaPois(NamedArea namedArea) { // download pois from the web server List<Poi> pois = this.poiSourceWeb.findPois(namedArea); this.poiSourceHdd.removePois(namedArea); this.poiSourceMem.clear(); // save downloaded pois foreach (Poi p in pois) { this.poiSourceWeb.downloadPoiMedia(p); this.poiSourceHdd.put(p, namedArea); p.free(); } }
public void removePois(NamedArea namedArea) { if (currentNamedArea.getName().Equals(namedArea.getName())) this.pois = new List<Poi>(); string poisAreaDir = this.poisDir + "\\" + currentNamedArea.getName(); // get poi dirs DirectoryInfo[] dirs; try { DirectoryInfo dirInfo = new DirectoryInfo(poisAreaDir); dirInfo.Delete(true); } catch (Exception e) { Debug.WriteLine("removePois: can't delete dir: " + poisAreaDir, ToString()); return; } }
public void setCurrentArea(NamedArea namedArea) { this.currentNamedArea = namedArea; this.poiSourceHdd.setCurrentArea(namedArea); }
private void updatePoisList() { //if (this.allPois == null) //{ // TODO user should be able to choose area, but now it is only for krakow Hashtable areas = this.poiRepository.getAreas(); this.currentNamedArea = (NamedArea)areas["Kraków"]; this.poiRepository.setCurrentArea(this.currentNamedArea); // get all pois list this.allPois = this.poiRepository.allPois(); this.listBoxPois.Items.Clear(); foreach (Poi p in this.allPois) { this.listBoxPois.Items.Add(p); } //} }
// TODO: should find area by current gps location, // but not there is only one area: Kraków private void findCurrentArea() { if (this.currentNamedArea == null) { Hashtable areas = this.poiRepository.getAreas(); this.currentNamedArea = (NamedArea)areas["Kraków"]; this.poiRepository.setCurrentArea(this.currentNamedArea); } }
public void setCurrentArea(NamedArea namedArea) { this.currentNamedArea = namedArea; readPoisDir(); }
/** * Returns poi sub dir by dir name and named area */ private string getPoiSubDir(string dirName, NamedArea namedArea) { return namedArea.getName() + "\\" + dirName; }
/** * Returns poi sub dir by poi and named area */ private string getPoiSubDir(Poi p, NamedArea namedArea) { string dirName = p.getName() + "_" + p.getLatitude() + "_" + p.getLongitude(); return getPoiSubDir(dirName, namedArea); }
internal void put(Poi p, NamedArea namedArea) { if (this.pois == null) { this.pois = new List<Poi>(); } if (!p.isDataFree()) { this.poiMapperHdd.save(p, getPoiSubDir(p, namedArea)); p.free(); //if (!this.pois.Contains(p)) //{ this.pois.Add(p); //} } }