public List <string> hit(float x, float y) { if (leftB < x && rightB > x && topB > y && bottomB < y) { List <int> hits = tree.hit(x, y); List <string> hitsReturn = new List <string>(); foreach (int i in hits) { hitsReturn.Add(Item.getLanduse(i)); } return(hitsReturn); } else { return(new List <string>()); } }
//get landuse on position x,y public List <int> hit(float x, float y) { List <int> hits = new List <int>(); foreach (int i in landuses) { hits.Add(i); } List <int> lowerHits = new List <int>(); if (nw != null && x <= cx && y >= cy) { lowerHits.AddRange(nw.hit(x, y)); } if (sw != null && x <= cx && y <= cy) { lowerHits.AddRange(sw.hit(x, y)); } if (ne != null && x >= cx && y >= cy) { lowerHits.AddRange(ne.hit(x, y)); } if (se != null && x >= cx && y <= cy) { lowerHits.AddRange(se.hit(x, y)); } foreach (int i in lowerHits) { if (!hits.Contains(i)) { hits.Add(i); } } return(hits); }