/[projects]/dao/FuldDaekningWorker/src/main/java/dk/daoas/fulddaekning/osrm/OSRMHelper.java
ViewVC logotype

Diff of /dao/FuldDaekningWorker/src/main/java/dk/daoas/fulddaekning/osrm/OSRMHelper.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2708 by torben, Sun Sep 27 18:20:41 2015 UTC revision 2723 by torben, Mon Sep 28 20:04:21 2015 UTC
# Line 3  package dk.daoas.fulddaekning.osrm; Line 3  package dk.daoas.fulddaekning.osrm;
3  import java.io.IOException;  import java.io.IOException;
4  import java.util.Collection;  import java.util.Collection;
5  import java.util.Iterator;  import java.util.Iterator;
6    import java.util.logging.Level;
7    import java.util.logging.Logger;
8    
9  import com.google.gson.Gson;  import com.google.gson.Gson;
10    
11  import dk.daoas.fulddaekning.Adresse;  import dk.daoas.fulddaekning.Adresse;
12  import dk.daoas.fulddaekning.HttpUtil;  import dk.daoas.fulddaekning.HttpUtil;
13    import dk.daoas.fulddaekning.LookupWorker;
14    
15  public class OSRMHelper {  public class OSRMHelper {
16                    
17            final static Logger logger = Logger.getLogger( OSRMHelper.class.toString() );
18            
19          Gson gson = new Gson();          Gson gson = new Gson();
20                    
21          final String base_url = "http://10.30.2.61:5000";          final String base_url = "http://10.30.2.61:5000";
# Line 34  public class OSRMHelper { Line 39  public class OSRMHelper {
39                  try {                  try {
40                          String txtResponse = HttpUtil.getContentString(sb.toString(), 500, "UTF-8");                          String txtResponse = HttpUtil.getContentString(sb.toString(), 500, "UTF-8");
41                          OSRMDistanceTable table = gson.fromJson(txtResponse, OSRMDistanceTable.class);                          OSRMDistanceTable table = gson.fromJson(txtResponse, OSRMDistanceTable.class);
42                            if (table.status != 0) {
43                                    logger.info("OSRM failed with message: " + table.status_message);
44                                    return null;
45                            }
46                            
47                          int bedsteTid = Integer.MAX_VALUE;                          int bedsteTid = Integer.MAX_VALUE;
48                                                    
49                          for (int i = 1; i<table.distance_table.length; i++) {                          for (int i = 1; i<table.distance_table.length; i++) {
# Line 45  public class OSRMHelper { Line 55  public class OSRMHelper {
55                          }                          }
56    
57                  } catch (Exception e) {                  } catch (Exception e) {
58                          System.out.println( e.getMessage() );                          logger.log(Level.SEVERE, "Lookup failed", e);
59                          System.exit(1);                                          System.exit(1);                
60                  }                  }
61                                    

Legend:
Removed from v.2708  
changed lines
  Added in v.2723

  ViewVC Help
Powered by ViewVC 1.1.20