Changeset 272 for tools

Show
Ignore:
Timestamp:
03/11/09 15:03:08 (12 months ago)
Author:
anton
Message:

Templates filling changed

Location:
tools/routingservice/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • tools/routingservice/trunk/src/jp/co/orkney/restlet/util/Edge.java

    r173 r272  
    11package jp.co.orkney.restlet.util; 
     2 
     3import java.util.Vector; 
    24 
    35public class Edge 
     
    57    private int gid; 
    68    private int id; 
    7     private String edge; 
     9    //private String edge; 
     10    private Vector<Point> points; 
    811 
    912    public Edge() 
    1013    { 
     14        points = new Vector<Point>(); 
    1115    } 
    1216     
    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  
    2317    public int getGid() 
    2418    { 
     
    4236 
    4337 
    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  
    5638    public void setId(int id) 
    5739    { 
    5840        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        }      
    6050     
    6151} 
  • tools/routingservice/trunk/src/jp/co/orkney/restlet/util/Format.java

    r172 r272  
    106106            try 
    107107            { 
    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")); 
    110116            } 
    111117            catch (NullPointerException e) 
  • tools/routingservice/trunk/src/jp/co/orkney/restlet/util/IOHelper.java

    r172 r272  
    761761                        String wkts[] = wkt.split("\\)\\("); 
    762762                         
    763                         String result = new String(); 
     763                        Point point = new Point(); 
    764764                         
    765                         if (format.equals("gml")) 
     765                        for (int i = 0; i < wkts.length; i++) 
    766766                        { 
    767                                 for (int i = 0; i < wkts.length; i++) 
     767                                String wkt2[] = wkts[i].split(","); 
     768                                for (int j = 0; j < wkt2.length; j++) 
    768769                                { 
    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])); 
    785772                                } 
    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                         else 
    802                         { 
    803                             result = wkt; 
    804773                        } 
    805774                         
    806                         edge.setEdge(result); 
     775                        edge.addPoint(point); 
    807776                        edges.add(edge); 
    808777                        ++k; 
  • tools/routingservice/trunk/templates/route/route_gml.st

    r271 r272  
    88                        <gml:lineStringMember> 
    99                                <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                                }$ 
    1113                                </gml:LineString> 
    1214                        </gml:lineStringMember>