Changeset 31369 in osm for applications
- Timestamp:
- 2015-07-12T14:51:36+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/tracer2/src/org/openstreetmap/josm/plugins/tracer2/server/GetTrace.java
r30737 r31369 44 44 */ 45 45 public void run() { 46 m_listLatLon = new ArrayList<>(); 47 46 48 try { 47 49 String strResponse = callServer("traceOrder=GetTrace" … … 66 68 } 67 69 68 if (!strResponse.startsWith("(") || !strResponse.endsWith(")")){ 70 if (strResponse.startsWith("(")) { 71 GetPoints(strResponse); 69 72 return; 70 73 } 71 strResponse = strResponse.substring(1, strResponse.length()-1); 72 73 ArrayList<LatLon> nodelist = new ArrayList<>(); 74 75 String[] astrPoints = strResponse.split("\\)\\("); 76 for (String strPoint : astrPoints) { 77 String[] astrParts = strPoint.split(":"); 78 double x = Double.parseDouble(astrParts[0]); 79 double y = Double.parseDouble(astrParts[1]); 80 nodelist.add(new LatLon(x, y)); 74 String[] astrParts = strResponse.split("&"); 75 76 for (String strPart : astrParts) { 77 if (strPart.contains("tracePoints=")) 78 { 79 String strPoints = strPart.replace("tracePoints=", ""); 80 GetPoints(strPoints); 81 return; 82 } 81 83 } 82 m_listLatLon = nodelist;83 84 } catch (Exception e) { 84 m_listLatLon = new ArrayList<>();85 //m_listLatLon = new ArrayList<>(); 85 86 } 86 87 } 87 88 89 90 /** 91 * Get points from string 92 */ 93 public void GetPoints(String strResponse) { 94 try { 95 if (!strResponse.startsWith("(") || !strResponse.endsWith(")")){ 96 return; 97 } 98 strResponse = strResponse.substring(1, strResponse.length()-1); 99 100 ArrayList<LatLon> nodelist = new ArrayList<>(); 101 102 String[] astrPoints = strResponse.split("\\)\\("); 103 for (String strPoint : astrPoints) { 104 String[] astrParts = strPoint.split(":"); 105 double x = Double.parseDouble(astrParts[0]); 106 double y = Double.parseDouble(astrParts[1]); 107 nodelist.add(new LatLon(x, y)); 108 } 109 m_listLatLon = nodelist; 110 } catch (Exception e) { 111 //m_listLatLon = new ArrayList<>(); 112 } 113 } 114 88 115 }
Note:
See TracChangeset
for help on using the changeset viewer.