Пример #1
0
 public void putPois(List<Poi> pois, NamedArea namedArea)
 {
     foreach (Poi p in pois)
     {
         put(p, namedArea);
     }
 }
Пример #2
0
        // 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;
        }
Пример #3
0
 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();
     }
 }
Пример #4
0
 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;
     }
 }
Пример #5
0
 public void setCurrentArea(NamedArea namedArea)
 {
     this.currentNamedArea = namedArea;
     this.poiSourceHdd.setCurrentArea(namedArea);
 }
Пример #6
0
 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);
         }
     //}
 }
Пример #7
0
 // 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);
     }
 }
Пример #8
0
 public void setCurrentArea(NamedArea namedArea)
 {
     this.currentNamedArea = namedArea;
     readPoisDir();
 }
Пример #9
0
 /**
  * Returns poi sub dir by dir name and named area
  */
 private string getPoiSubDir(string dirName, NamedArea namedArea)
 {
     return namedArea.getName() + "\\" + dirName;
 }
Пример #10
0
 /**
  * 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);
 }
Пример #11
0
 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);
         //}
     }
 }