// checks if given area is sub area of current area instance public bool contains(Area area) { return this.topLeftLatitude >= area.getTopLeftLatitude() && this.topLeftLongitude <= area.getTopLeftLongitude() && this.bottomRightLatitude <= area.getBottomRightLatitude() && this.bottomRightLongitude >= area.getBottomRightLongitude(); }
public String getPois(Area area) { string portalUrl = this.config.get("portal_url"); string mobappid = this.config.get("mobappid"); string areaStr = area.getTopLeftLatitude() + "," + area.getTopLeftLongitude() + "," + area.getBottomRightLatitude() + "," + area.getBottomRightLongitude(); string queryString = portalUrl + "/pois/area/" + areaStr + "/lang/pl/?mobappid=" + mobappid; Debug.WriteLine("getPois: queryString: " + queryString, ToString()); return GET(new Uri(queryString)); }
public void setCacheArea(Area cacheArea) { this.cacheArea = cacheArea; if (this.cachedPois != null) for (int i = 0; i < this.cachedPois.Count; i++) { Poi poi = this.cachedPois[i]; if (!this.cacheArea.contains(poi)) { poi.free(); this.cachedPois.Remove(poi); } } else Debug.WriteLine("setCacheArea: NULLLLLLLLLLLL", ToString()); }
public List<Poi> findPois(Area area) { List<Poi> pois = new List<Poi>(); try { String portalResponse = this.portal.getPois(area); // process response PoisXmlAdapter poisAdapter = new PoisXmlAdapter(pois); poisAdapter.parse(portalResponse); } catch (PortalException e) { Debug.WriteLine("findPois: portal error: " + e.Message, ToString()); } return pois; }
public List<Poi> findPois(Area area) { if (this.cacheArea == null) { return null; } List<Poi> areaPois = null; if (this.cacheArea.contains(area)) { areaPois = this.cachedPois.FindAll( delegate(Poi p) { return area.contains(p); } ); } return areaPois; }
public List<Poi> findPois(Area area) { if (this.pois == null) { readPoisDir(); } List<Poi> areaPois = this.pois.FindAll( delegate(Poi p) { return area.contains(p); } ); foreach (Poi p in areaPois) { if (p.isDataFree()) { this.poiMapperHdd.loadData(p, getPoiSubDir(p, this.currentNamedArea)); } } return areaPois; }
public List<Poi> getPois(Area area) { List<Poi> pois = null; //Debug.WriteLine("getPois: area: " + area, ToString()); // get pois try { pois = this.poiSourceMem.findPois(area); if (pois == null || pois.Count == 0) { Area cacheArea = newCacheArea(area); //Debug.WriteLine("getPois: new cache area: " + cacheArea, ToString()); pois = this.poiSourceHdd.findPois(cacheArea); if (pois != null && pois.Count > 0) { this.poiSourceMem.setCacheArea(cacheArea); this.poiSourceMem.putPois(pois); } else { string msg = "No pois for area: " + area; Debug.WriteLine("getPois: " + msg, ToString()); throw new NoPoiOnAreaException(msg); } } } catch (PoiSourceException e) { throw new NoPoiOnAreaException("Problem with poi source.", e); } return pois; }
// create bigger area for cache private Area newCacheArea(Area area) { double deltaLatitude = Math.Abs(area.getTopLeftLatitude() - area.getBottomRightLatitude()); double deltaLongitude = Math.Abs(area.getTopLeftLongitude() - area.getBottomRightLongitude()); double topLeftLatitude = area.getTopLeftLatitude() + this.cacheFactor * deltaLatitude; double topLeftLongitude = area.getTopLeftLongitude() - this.cacheFactor * deltaLongitude; double bottomRightLatitude = area.getBottomRightLatitude() - this.cacheFactor * deltaLatitude; double bottomRightLongitude = area.getBottomRightLongitude() + this.cacheFactor * deltaLongitude; return new Area(topLeftLatitude, topLeftLongitude, bottomRightLatitude, bottomRightLongitude); }
public void setCenterImgArea(Area centerImgArea) { this.centerImgArea = centerImgArea; }
public void setArea(Area area) { this.area = area; }
public void clear() { this.cachedPois.Clear(); this.cacheArea = null; }