- Timestamp:
- 03/11/09 15:03:08 (12 months ago)
- Location:
- tools/routingservice/trunk
- Files:
-
- 4 modified
-
src/jp/co/orkney/restlet/util/Edge.java (modified) (3 diffs)
-
src/jp/co/orkney/restlet/util/Format.java (modified) (1 diff)
-
src/jp/co/orkney/restlet/util/IOHelper.java (modified) (1 diff)
-
templates/route/route_gml.st (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tools/routingservice/trunk/src/jp/co/orkney/restlet/util/Edge.java
r173 r272 1 1 package jp.co.orkney.restlet.util; 2 3 import java.util.Vector; 2 4 3 5 public class Edge … … 5 7 private int gid; 6 8 private int id; 7 private String edge; 9 //private String edge; 10 private Vector<Point> points; 8 11 9 12 public Edge() 10 13 { 14 points = new Vector<Point>(); 11 15 } 12 16 13 14 public Edge(int gid, int id, String edge)15 {16 super();17 this.gid = gid;18 this.id = id;19 this.edge = edge;20 }21 22 23 17 public int getGid() 24 18 { … … 42 36 43 37 44 public String getEdge()45 {46 return edge;47 }48 49 50 public void setEdge(String edge)51 {52 this.edge = edge;53 }54 55 56 38 public void setId(int id) 57 39 { 58 40 this.id = id; 59 } 41 } 42 43 public void addPoint(Point point) { 44 this.points.add(point); 45 } 46 47 public Vector<Point> getPoints() { 48 return points; 49 } 60 50 61 51 } -
tools/routingservice/trunk/src/jp/co/orkney/restlet/util/Format.java
r172 r272 106 106 try 107 107 { 108 StringTemplateGroup group = new StringTemplateGroup("formatGroup", "templates"); 109 this.template = group.getInstanceOf(format.getAttributeValue("template")); 108 String path = format.getAttributeValue("path"); 109 if(path != null) 110 path += format.getAttributeValue("template"); 111 else 112 path = format.getAttributeValue("template"); 113 114 StringTemplateGroup group = new StringTemplateGroup("formatGroup", path); 115 this.template = group.getInstanceOf(format.getAttributeValue("template")); 110 116 } 111 117 catch (NullPointerException e) -
tools/routingservice/trunk/src/jp/co/orkney/restlet/util/IOHelper.java
r172 r272 761 761 String wkts[] = wkt.split("\\)\\("); 762 762 763 String result = new String();763 Point point = new Point(); 764 764 765 if (format.equals("gml"))765 for (int i = 0; i < wkts.length; i++) 766 766 { 767 for (int i = 0; i < wkts.length; i++) 767 String wkt2[] = wkts[i].split(","); 768 for (int j = 0; j < wkt2.length; j++) 768 769 { 769 String wkt2[] = wkts[i].split(","); 770 for (int j = 0; j < wkt2.length; j++) 771 { 772 result += new BigDecimal(wkt2[j].split(" ")[0]) + "," + new BigDecimal(wkt2[j].split(" ")[1]) + ",0 "; 773 } 774 } 775 } 776 else if (format.equals("kml")) 777 { 778 for (int i = 0; i < wkts.length; i++) 779 { 780 String wkt2[] = wkts[i].split(","); 781 for (int j = 0; j < wkt2.length; j++) 782 { 783 result += new BigDecimal(wkt2[j].split(" ")[0]) + "," + new BigDecimal(wkt2[j].split(" ")[1]) + " "; 784 } 770 point.setX(new BigDecimal(wkt2[j].split(" ")[0])); 771 point.setY(new BigDecimal(wkt2[j].split(" ")[1])); 785 772 } 786 787 }788 else if (format.equals("geojson"))789 {790 for (int i = 0; i < wkts.length; i++)791 {792 String wkt2[] = wkts[i].split(",");793 for (int j = 0; j < wkt2.length; j++)794 {795 result += "[" + new BigDecimal(wkt2[j].split(" ")[0]) + "," + new BigDecimal(wkt2[j].split(" ")[1]) + "]";796 if(j < wkt2.length-1) result += ",";797 }798 }799 800 }801 else802 {803 result = wkt;804 773 } 805 774 806 edge. setEdge(result);775 edge.addPoint(point); 807 776 edges.add(edge); 808 777 ++k; -
tools/routingservice/trunk/templates/route/route_gml.st
r271 r272 8 8 <gml:lineStringMember> 9 9 <gml:LineString gml:id="$e.id$"> 10 <gml:posList>$e.edge$</gml:posList> 10 $e.points:{ p | 11 <gml:posList>$p.x$ $p.y$</gml:posList> 12 }$ 11 13 </gml:LineString> 12 14 </gml:lineStringMember>
