@Test public void TestGetCandidateCountry() { Coordinate c = new Coordinate(-0.25, -0.25); CountryBordersPolygon[] polys = _reader.getCandidateCountry(c); assertEquals(1, polys.length); assertEquals("country3", polys[0].getName()); }
public CountryBordersPolygon[] getCandidateCountry(Coordinate c) { ArrayList<CountryBordersPolygon> countries = new ArrayList<>(); Iterator it = hierarchies.entrySet().iterator(); while(it.hasNext()) { Map.Entry<Long, CountryBordersHierarchy> pair = (Map.Entry)it.next(); CountryBordersHierarchy h = pair.getValue(); if(h.inBbox(c)) { List<CountryBordersPolygon> ps = h.getPolygons(); for(CountryBordersPolygon cp : ps) { if(cp.inBbox(c)) { countries.add(cp); } } } } return countries.toArray(new CountryBordersPolygon[countries.size()]); }
CountryBordersReader { public CountryBordersPolygon[] getCandidateCountry(Coordinate c) { ArrayList<CountryBordersPolygon> countries = new ArrayList<>(); Iterator it = hierarchies.entrySet().iterator(); while(it.hasNext()) { Map.Entry<Long, CountryBordersHierarchy> pair = (Map.Entry)it.next(); CountryBordersHierarchy h = pair.getValue(); if(h.inBbox(c)) { List<CountryBordersPolygon> ps = h.getPolygons(); for(CountryBordersPolygon cp : ps) { if(cp.inBbox(c)) { countries.add(cp); } } } } return countries.toArray(new CountryBordersPolygon[countries.size()]); } }
CountryBordersReader { public CountryBordersPolygon[] getCandidateCountry(Coordinate c) { ArrayList<CountryBordersPolygon> countries = new ArrayList<>(); Iterator it = hierarchies.entrySet().iterator(); while(it.hasNext()) { Map.Entry<Long, CountryBordersHierarchy> pair = (Map.Entry)it.next(); CountryBordersHierarchy h = pair.getValue(); if(h.inBbox(c)) { List<CountryBordersPolygon> ps = h.getPolygons(); for(CountryBordersPolygon cp : ps) { if(cp.inBbox(c)) { countries.add(cp); } } } } return countries.toArray(new CountryBordersPolygon[countries.size()]); } CountryBordersReader();  CountryBordersReader(String filepath, String idsPath, String openPath); }
CountryBordersReader { public CountryBordersPolygon[] getCandidateCountry(Coordinate c) { ArrayList<CountryBordersPolygon> countries = new ArrayList<>(); Iterator it = hierarchies.entrySet().iterator(); while(it.hasNext()) { Map.Entry<Long, CountryBordersHierarchy> pair = (Map.Entry)it.next(); CountryBordersHierarchy h = pair.getValue(); if(h.inBbox(c)) { List<CountryBordersPolygon> ps = h.getPolygons(); for(CountryBordersPolygon cp : ps) { if(cp.inBbox(c)) { countries.add(cp); } } } } return countries.toArray(new CountryBordersPolygon[countries.size()]); } CountryBordersReader();  CountryBordersReader(String filepath, String idsPath, String openPath); void addHierarchy(Long id, CountryBordersHierarchy hierarchy); void addId(String id, String localName, String englishName, String cca2, String cca3); void addOpenBorder(String country1, String country2); CountryBordersPolygon[] getCountry(Coordinate c); CountryBordersPolygon[] getCandidateCountry(Coordinate c); String getId(String name); String getEngName(String name); boolean isOpen(String c1, String c2); static int getCountryIdByISOCode(String code); }
CountryBordersReader { public CountryBordersPolygon[] getCandidateCountry(Coordinate c) { ArrayList<CountryBordersPolygon> countries = new ArrayList<>(); Iterator it = hierarchies.entrySet().iterator(); while(it.hasNext()) { Map.Entry<Long, CountryBordersHierarchy> pair = (Map.Entry)it.next(); CountryBordersHierarchy h = pair.getValue(); if(h.inBbox(c)) { List<CountryBordersPolygon> ps = h.getPolygons(); for(CountryBordersPolygon cp : ps) { if(cp.inBbox(c)) { countries.add(cp); } } } } return countries.toArray(new CountryBordersPolygon[countries.size()]); } CountryBordersReader();  CountryBordersReader(String filepath, String idsPath, String openPath); void addHierarchy(Long id, CountryBordersHierarchy hierarchy); void addId(String id, String localName, String englishName, String cca2, String cca3); void addOpenBorder(String country1, String country2); CountryBordersPolygon[] getCountry(Coordinate c); CountryBordersPolygon[] getCandidateCountry(Coordinate c); String getId(String name); String getEngName(String name); boolean isOpen(String c1, String c2); static int getCountryIdByISOCode(String code); static final String INTERNATIONAL_NAME; static final String INTERNATIONAL_ID; static final String KEY_PROPERTIES; }