--- dao/FuldDaekningWorker/src/main/java/dk/daoas/fulddaekning/osrm/OSRMHelper.java 2015/12/17 19:04:09 2794 +++ dao/FuldDaekningWorker/src/main/java/dk/daoas/fulddaekning/osrm/OSRMHelper.java 2015/12/28 15:19:00 2795 @@ -21,14 +21,8 @@ import dk.daoas.fulddaekning.Adresse; import dk.daoas.fulddaekning.HttpUtil; -/* -import dk.thoerup.osrmbinding.OSRMBinding; -import dk.thoerup.osrmbinding.ViarouteResult; -*/ public class OSRMHelper { - - private static final boolean ENABLE_OSRM = false; final static Logger logger = Logger.getLogger( OSRMHelper.class.toString() ); @@ -41,68 +35,9 @@ //final String host = "10.30.2.103"; final int port = 5000; final String base_url = "http://" + host + ":" + port; -/* - private static synchronized void initOsrm() { - if (binding == null) { - binding = new OSRMBinding("/home/openstreetmap/denmark-latest.osrm"); - } - } -*/ - - public Adresse getNearestTableHttp(Adresse a1, Collection haystack) { - - Adresse bedsteAdresse = null; - - Adresse hayArray[] = new Adresse[ haystack.size() ]; - haystack.toArray(hayArray); - - StringBuilder sb = new StringBuilder(); - sb.append(base_url); - sb.append("/table?loc=").append(a1.latitude).append(",").append(a1.longitude); - - for(int i = 0; i haystack) { + public Adresse getNearestTableHttp(Adresse a1, Collection haystack) { @@ -168,95 +103,7 @@ return bedsteAdresse; } - - - -/* - public Adresse getNearestTableJni(Adresse a1, Collection haystack) { - if (binding == null) { - initOsrm(); - } - - Adresse bedsteAdresse = null; - - Adresse hayArray[] = new Adresse[ haystack.size() ]; - haystack.toArray(hayArray); - - dk.thoerup.osrmbinding.Geopoint points[] = new dk.thoerup.osrmbinding.Geopoint[ hayArray.length + 1 ]; - points[0] = new dk.thoerup.osrmbinding.Geopoint( a1.latitude, a1.longitude); - - - for(int i = 0; i haystack) { - - Adresse bedsteAdresse = null; - - Adresse hayArray[] = new Adresse[ haystack.size() ]; - haystack.toArray(hayArray); - - StringBuilder sb = new StringBuilder(); - sb.append(base_url); - sb.append("/multitarget?loc=").append(a1.latitude).append(",").append(a1.longitude); - - for(int i = 0; i haystack) { int bedsteAfstand = Integer.MAX_VALUE; @@ -323,46 +170,6 @@ return bedsteAdresse; } -/* - public Adresse getNearestViarouteJni(Adresse a1, Collection haystack) { - - if (binding == null) { - initOsrm(); - } - - - int bedsteAfstand = Integer.MAX_VALUE; - Adresse bedsteAdresse = null; - - - for(Adresse a2: haystack) { - - ViarouteResult res = binding.viaRoute(a1.latitude, a1.longitude, a2.latitude, a2.longitude); - - - if (res.status != 0) { - System.out.println("OSRM Returned " + res.status ); - continue; - } - - if (res.totalDistance == 0) { - continue; - } - - - if (res.totalDistance < bedsteAfstand) { - bedsteAfstand = res.totalDistance; - bedsteAdresse = a2; - } - - if (bedsteAfstand < 200) { //vejdistance er tæt nok på - return bedsteAdresse; - } - - } - - return bedsteAdresse; - }*/ }