Changeset 128
- Timestamp:
- 03/19/08 12:47:22 (8 months ago)
- Files:
-
- branches/debug (added)
- branches/debug/authors.txt (added)
- branches/debug/BOOST_LICENSE_1_0.txt (added)
- branches/debug/cmake (added)
- branches/debug/cmake/CheckCCompilerFlag.cmake (added)
- branches/debug/cmake/CMakeList.txt (added)
- branches/debug/cmake/FindCGAL.cmake (added)
- branches/debug/cmake/FindGAUL.cmake (added)
- branches/debug/cmake/FindPostgreSQL.cmake (added)
- branches/debug/CMakeLists.txt (added)
- branches/debug/cmake/MacroAddCompileFlags.cmake (added)
- branches/debug/cmake/MacroAddLinkFlags.cmake (added)
- branches/debug/cmake/MacroLibrary.cmake (added)
- branches/debug/cmake/MacroOptionalFindPackage.cmake (added)
- branches/debug/cmake/PlatformSpecific.cmake (added)
- branches/debug/COPYING (added)
- branches/debug/core (added)
- branches/debug/core/CMakeLists.txt (added)
- branches/debug/core/sql (added)
- branches/debug/core/sql/CMakeLists.txt (added)
- branches/debug/core/sql/routing_core.sql (added)
- branches/debug/core/sql/routing_core_wrappers.sql (added)
- branches/debug/core/src (added)
- branches/debug/core/src/astar_boost_wrapper.cpp (added)
- branches/debug/core/src/astar.c (added)
- branches/debug/core/src/astar.h (added)
- branches/debug/core/src/boost_wrapper.cpp (added)
- branches/debug/core/src/CMakeLists.txt (added)
- branches/debug/core/src/dijkstra.c (added)
- branches/debug/core/src/dijkstra.h (added)
- branches/debug/core/src/edge_visitors.hpp (added)
- branches/debug/core/src/shooting_star_boost_wrapper.cpp (added)
- branches/debug/core/src/shooting_star.c (added)
- branches/debug/core/src/shooting_star.h (added)
- branches/debug/core/src/shooting_star_relax.hpp (added)
- branches/debug/core/src/shooting_star_search.hpp (added)
- branches/debug/debian (added)
- branches/debug/debian/changelog (added)
- branches/debug/debian/compat (added)
- branches/debug/debian/control (added)
- branches/debug/debian/copyright (added)
- branches/debug/debian/docs (added)
- branches/debug/debian/postgresql-8.2-pgrouting.dirs (added)
- branches/debug/debian/postgresql-8.2-pgrouting.install (added)
- branches/debug/debian/README.Debian (added)
- branches/debug/debian/rules (added)
- branches/debug/extra (added)
- branches/debug/extra/CMakeLists.txt (added)
- branches/debug/extra/driving_distance (added)
- branches/debug/extra/driving_distance/CMakeLists.txt (added)
- branches/debug/extra/driving_distance/sql (added)
- branches/debug/extra/driving_distance/sql/CMakeLists.txt (added)
- branches/debug/extra/driving_distance/sql/routing_dd.sql (added)
- branches/debug/extra/driving_distance/sql/routing_dd_wrappers.sql (added)
- branches/debug/extra/driving_distance/src (added)
- branches/debug/extra/driving_distance/src/alpha.c (added)
- branches/debug/extra/driving_distance/src/alpha_drivedist.cpp (added)
- branches/debug/extra/driving_distance/src/alpha.h (added)
- branches/debug/extra/driving_distance/src/boost_drivedist.cpp (added)
- branches/debug/extra/driving_distance/src/CMakeLists.txt (added)
- branches/debug/extra/driving_distance/src/drivedist.c (added)
- branches/debug/extra/driving_distance/src/drivedist.h (added)
- branches/debug/extra/tsp (added)
- branches/debug/extra/tsp/CMakeLists.txt (added)
- branches/debug/extra/tsp/sql (added)
- branches/debug/extra/tsp/sql/CMakeLists.txt (added)
- branches/debug/extra/tsp/sql/routing_tsp.sql (added)
- branches/debug/extra/tsp/sql/routing_tsp_wrappers.sql (added)
- branches/debug/extra/tsp/src (added)
- branches/debug/extra/tsp/src/CMakeLists.txt (added)
- branches/debug/extra/tsp/src/tsp.c (added)
- branches/debug/extra/tsp/src/tsp.h (added)
- branches/debug/extra/tsp/src/tsp_solver.cpp (added)
- branches/debug/lib (added)
- branches/debug/README.routing (added)
- branches/debug/RELEASE_NOTES (added)
- branches/routingservice/.classpath (modified) (1 diff)
- branches/routingservice/configuration.xml (modified) (19 diffs)
- branches/routingservice/pool.xml (modified) (1 diff)
- branches/routingservice/.settings/org.eclipse.jdt.core.prefs (modified) (1 diff)
- branches/routingservice/.settings/org.eclipse.jdt.ui.prefs (modified) (1 diff)
- branches/routingservice/src/jp/co/orkney/restlet/geo/ClosestEdge.java (modified) (5 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/geo/DrivingDistance.java (modified) (4 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/geo/ShortestPath.java (modified) (4 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/geo/TravelingSalesPerson.java (modified) (4 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/util/Configuration.java (modified) (13 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/util/DatabaseConnection.java (modified) (5 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/util/IOHelper.java (modified) (26 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/util/Provider.java (modified) (2 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/util/Service.java (modified) (2 diffs)
- branches/routingservice/src/jp/co/orkney/restlet/WebRouting.java (modified) (8 diffs)
- branches/routingservice/start.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/routingservice/.classpath
r125 r128 2 2 <classpath> 3 3 <classpathentry kind="src" path="src"/> 4 <classpathentry kind="lib" path="lib/antlrworks-1.1.3.jar"/> 5 <classpathentry kind="lib" path="lib/com.noelios.restlet.ext.jdbc_3.0.jar"/> 6 <classpathentry kind="lib" path="lib/com.noelios.restlet.ext.simple_3.1.jar"/> 7 <classpathentry kind="lib" path="lib/com.noelios.restlet.jar"/> 8 <classpathentry kind="lib" path="lib/commons-dbcp-1.2.2.jar"/> 9 <classpathentry kind="lib" path="lib/commons-pool-1.4.jar"/> 10 <classpathentry kind="lib" path="lib/jdom.jar"/> 11 <classpathentry kind="lib" path="lib/org.json.jar"/> 12 <classpathentry kind="lib" path="lib/org.restlet.ext.json_2.0.jar"/> 13 <classpathentry kind="lib" path="lib/org.restlet.jar"/> 14 <classpathentry kind="lib" path="lib/org.simpleframework.jar"/> 4 15 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 5 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/antlrworks-1.1.3.jar"/> 6 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/com.noelios.restlet.ext.simple_3.1.jar"/> 7 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/com.noelios.restlet.jar"/> 8 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/jdom.jar"/> 9 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/org.json.jar"/> 10 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/org.restlet.ext.json_2.0.jar"/> 11 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/org.restlet.jar"/> 12 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/org.simpleframework.jar"/> 13 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/com.noelios.restlet.ext.jdbc_3.0.jar"/> 14 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/commons-pool-1.4.jar"/> 15 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/commons-dbcp-1.2.2.jar"/> 16 <classpathentry kind="lib" path="/home/matthieu/workspace/pgRouting_Webservice/lib/postgresql-8.2-506.jdbc4.jar"/> 16 <classpathentry kind="lib" path="/opt/pgrouting/branches/routingservice/lib/postgresql-8.2-508.jdbc4.jar"/> 17 17 <classpathentry kind="output" path="bin"/> 18 18 </classpath> branches/routingservice/configuration.xml
r125 r128 31 31 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 32 32 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 33 <parameter name="request_id" type="text" codename="request_id" required="false" /> 33 34 </parameters> 34 35 <formats> … … 64 65 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 65 66 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 67 <parameter name="request_id" type="text" codename="request_id" required="false" /> 66 68 </parameters> 67 69 <formats> … … 98 100 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 99 101 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 102 <parameter name="request_id" type="text" codename="request_id" required="false" /> 100 103 </parameters> 101 104 <formats> … … 132 135 <parameter name="findVertex" type="text" codename="findVertex" required="false" default="(select id from find_node_by_nearest_link_within_distance(''''POINT($sonPx$ $sonPy$)'''',$bbox$,''''nrn_bc''''))" /> 133 136 <parameter name="findVertexTransf" type="text" codename="findVertexTransf" required="false" default="(select id from find_node_by_nearest_link_within_distance(text2text_transform(''''POINT($sonPx$ $sonPy$)'''',$sridIn$,$sridProvider$))" /> 137 <parameter name="request_id" type="text" codename="request_id" required="false" /> 134 138 </parameters> 135 139 <formats> … … 170 174 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 171 175 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 176 <parameter name="request_id" type="text" codename="request_id" required="false" /> 172 177 </parameters> 173 178 <formats> … … 203 208 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 204 209 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 210 <parameter name="request_id" type="text" codename="request_id" required="false" /> 205 211 </parameters> 206 212 <formats> … … 238 244 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 239 245 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 240 </parameters> 241 <formats> 242 <format name="gml" input="true" output="true" /> 243 <format name="xml" input="false" output="true" /> 244 <format name="html" input="false" output="true" /> 245 <format name="geojson" input="true" output="true" />> 246 <format name="lonlat" input="true" output="false" /> 247 <format name="wkt" input="true" output="true" /> 248 <format name="kml" input="true" output="true" srid="4326" /> 249 </formats> 250 </service> 246 <parameter name="request_id" type="text" codename="request_id" required="false" /> 247 </parameters> 248 <formats> 249 <format name="gml" input="true" output="true" /> 250 <format name="xml" input="false" output="true" /> 251 <format name="html" input="false" output="true" /> 252 <format name="geojson" input="true" output="true" />> 253 <format name="lonlat" input="true" output="false" /> 254 <format name="wkt" input="true" output="true" /> 255 <format name="kml" input="true" output="true" srid="4326" /> 256 </formats> 257 </service> 258 259 <service name="security" title="Security" enable="true"> 260 <description>Authentication service</description> 261 <connection driver="org.postgresql.Driver"> 262 <url>jdbc:postgresql://192.168.20.177:5432/auth</url> 263 <user>postgres</user> 264 <password></password> 265 </connection> 266 <projection /> 267 <sql> 268 <query transformProjectionIn="false" transformProjectionOut="false">SELECT client_id, key FROM keys</query> 269 </sql> 270 <parameters> 271 <parameter name="api_key" type="text" codename="api_key" required="true" /> 272 <parameter name="signature" type="text" codename="signature" required="true" /> 273 <parameter name="id" type="text" codename="id" required="true" /> 274 </parameters> 275 <formats /> 276 </service> 277 251 278 </services> 252 279 </provider> … … 276 303 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 277 304 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 305 <parameter name="request_id" type="text" codename="request_id" required="false" /> 278 306 </parameters> 279 307 <formats> … … 309 337 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 310 338 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 339 <parameter name="request_id" type="text" codename="request_id" required="false" /> 311 340 </parameters> 312 341 <formats> … … 343 372 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 344 373 <parameter name="bbox" type="integer" codename="bbox" required="false" default="3000" /> 374 <parameter name="request_id" type="text" codename="request_id" required="false" /> 345 375 </parameters> 346 376 <formats> … … 380 410 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 381 411 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.0015" /> 412 <parameter name="request_id" type="text" codename="request_id" required="false" /> 382 413 </parameters> 383 414 <formats> … … 413 444 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 414 445 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.0015" /> 446 <parameter name="request_id" type="text" codename="request_id" required="false" /> 415 447 </parameters> 416 448 <formats> … … 447 479 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 448 480 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.0015" /> 481 <parameter name="request_id" type="text" codename="request_id" required="false" /> 449 482 </parameters> 450 483 <formats> … … 485 518 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 486 519 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.0005" /> 520 <parameter name="request_id" type="text" codename="request_id" required="false" /> 487 521 </parameters> 488 522 <formats> … … 518 552 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 519 553 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.004" /> 554 <parameter name="request_id" type="text" codename="request_id" required="false" /> 520 555 </parameters> 521 556 <formats> … … 552 587 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 553 588 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.004" /> 589 <parameter name="request_id" type="text" codename="request_id" required="false" /> 554 590 </parameters> 555 591 <formats> … … 590 626 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 591 627 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.011" /> 628 <parameter name="request_id" type="text" codename="request_id" required="false" /> 592 629 </parameters> 593 630 <formats> … … 623 660 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 624 661 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.011" /> 662 <parameter name="request_id" type="text" codename="request_id" required="false" /> 625 663 </parameters> 626 664 <formats> … … 657 695 <parameter name="sridOutput" type="integer" codename="sridOut" required="false" /> 658 696 <parameter name="bbox" type="integer" codename="bbox" required="false" default="0.011" /> 697 <parameter name="request_id" type="text" codename="request_id" required="false" /> 659 698 </parameters> 660 699 <formats> branches/routingservice/pool.xml
r107 r128 3 3 <header> 4 4 <connection> 5 <usePooling> false</usePooling>5 <usePooling>true</usePooling> 6 6 <property name="user">$user$</property > 7 7 <property name="password">$password$</property > branches/routingservice/.settings/org.eclipse.jdt.core.prefs
r67 r128 1 #Thu Nov 08 11:06:38 JST 20071 #Thu Mar 13 11:52:26 JST 2008 2 2 eclipse.preferences.version=1 3 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled4 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.55 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve6 org.eclipse.jdt.core.compiler.compliance=1.57 org.eclipse.jdt.core.compiler.debug.lineNumber=generate8 org.eclipse.jdt.core.compiler.debug.localVariable=generate9 org.eclipse.jdt.core.compiler.debug.sourceFile=generate10 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error11 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error12 org.eclipse.jdt.core.compiler.source=1.513 3 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false 14 4 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 branches/routingservice/.settings/org.eclipse.jdt.ui.prefs
r67 r128 1 #Thu Oct 25 15:23:05 JST 20071 #Thu Feb 21 15:33:40 JST 2008 2 2 eclipse.preferences.version=1 3 3 formatter_profile=_Matthieu [built-in] 4 4 formatter_settings_version=11 5 internal.default.compliance=default 5 6 org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/> branches/routingservice/src/jp/co/orkney/restlet/geo/ClosestEdge.java
r125 r128 51 51 * @see DatabaseConnection 52 52 */ 53 public class ClosestEdge 53 public class ClosestEdge extends GeoAction 54 54 { 55 private String result = "";56 private DatabaseConnection databaseConnection;57 private IOHelper ioHelper;58 private Point point;59 private Configuration configuration;60 private Log log;61 62 55 /** 63 56 * Constructor ClosestEdge … … 71 64 * the current configuration 72 65 */ 73 public ClosestEdge(Configuration configuration )66 public ClosestEdge(Configuration configuration, DatabaseConnection databaseConnection, IOHelper ioHelper, Log log) 74 67 { 75 this.configuration = configuration;76 this.log = configuration.createLog();77 ioHelper = new IOHelper(configuration);68 super(configuration, databaseConnection, ioHelper, log); 69 70 name = "Closest edge"; 78 71 79 72 // extract method for Geojson format 80 if ( this.configuration.getFormatIn().getName().equals("geojson"))73 if (configuration.getFormatIn().getName().equals("geojson")) 81 74 { 82 point = ioHelper.extractGEOJSONPxPy(this.configuration.getService().getParameter("point").getValue());75 point = this.ioHelper.extractGEOJSONPxPy(configuration.getService().getParameter("point").getValue()); 83 76 } 84 77 // extract method for Gml format 85 else if ( this.configuration.getFormatIn().getName().equals("gml"))78 else if (configuration.getFormatIn().getName().equals("gml")) 86 79 { 87 point = ioHelper.extractGMLPxPy(this.configuration.getService().getParameter("point").getValue());80 point = this.ioHelper.extractGMLPxPy(configuration.getService().getParameter("point").getValue()); 88 81 } 89 82 // extract method for lonlat format 90 else if ( this.configuration.getFormatIn().getName().equals("lonlat"))83 else if (configuration.getFormatIn().getName().equals("lonlat")) 91 84 { 92 point = ioHelper.extractLONLATPxPy(this.configuration.getService().getParameter("point").getValue());85 point = this.ioHelper.extractLONLATPxPy(configuration.getService().getParameter("point").getValue()); 93 86 } 94 87 // extract method for wkt format 95 else if ( this.configuration.getFormatIn().getName().equals("wkt"))88 else if (configuration.getFormatIn().getName().equals("wkt")) 96 89 { 97 point = ioHelper.extractWKTPxPy(this.configuration.getService().getParameter("point").getValue());90 point = this.ioHelper.extractWKTPxPy(configuration.getService().getParameter("point").getValue()); 98 91 } 99 92 // extract method for kml format 100 else if ( this.configuration.getFormatIn().getName().equals("kml"))93 else if (configuration.getFormatIn().getName().equals("kml")) 101 94 { 102 point = ioHelper.extractKMLPxPy(this.configuration.getService().getParameter("point").getValue());95 point = this.ioHelper.extractKMLPxPy(configuration.getService().getParameter("point").getValue()); 103 96 } 104 97 } 105 98 106 /**107 * Gets the result of the closest edge algorithm108 *109 * @return this closest edge's result110 */111 public String get()112 {113 return result;114 }115 116 /**117 * Starts the "closest edge" algorithm118 *119 * @throws SQLException120 * error to send the query to the database121 * @throws JSONException122 * Error to transform the result in Geojson format123 */124 99 public void start() throws SQLException, JSONException 125 100 { 126 databaseConnection = new DatabaseConnection(configuration); 127 128 StringTemplate query = ioHelper.getQuery(); 101 StringTemplate query = this.ioHelper.getQuery(); 129 102 float bboxSize = Float.parseFloat(configuration.getService().getParameter("bbox").getValue()); 130 103 … … 142 115 // System.out.println(query.toString()); 143 116 log.write(query.toString(), 1); 144 ResultSet rs = databaseConnection.getResult(query.toString()); 117 ResultSet rs = this.databaseConnection.getResult(configuration.getService(), query.toString()); 118 119 String reqId = configuration.getService().getParameter("request_id").getValue(); 145 120 146 121 // Converts the SQL Result in Geojson 147 122 if (configuration.getFormatOut().getName().equals("geojson")) 148 123 { 149 result = ioHelper.closestEdgeGEOJSONResult(rs);124 result = this.ioHelper.closestEdgeGEOJSONResult(rs, reqId); 150 125 } 151 126 // Converts the SQL Result in HTML … … 153 128 { 154 129 System.out.println("hjhh"); 155 result = ioHelper.closestEdgeHTMLResult(rs, point);130 result = this.ioHelper.closestEdgeHTMLResult(rs, point, reqId); 156 131 } 157 132 // Converts the SQL Result in XML 158 133 else if (configuration.getFormatOut().getName().equals("xml")) 159 134 { 160 result = ioHelper.closestEdgeXMLResult(rs);135 result = this.ioHelper.closestEdgeXMLResult(rs, reqId); 161 136 } 162 137 // Converts the SQL Result in ID (edge id) 163 138 else if (configuration.getFormatOut().getName().equals("id")) 164 139 { 165 result = ioHelper.closestEdgeIDResult(rs);140 result = this.ioHelper.closestEdgeIDResult(rs); 166 141 } 167 142 // Converts the SQL Result in GML 168 143 else if (configuration.getFormatOut().getName().equals("gml")) 169 144 { 170 result = ioHelper.closestEdgeGMLResult(rs);145 result = this.ioHelper.closestEdgeGMLResult(rs, reqId); 171 146 } 172 147 // Converts the SQL Result in WKT 173 148 else if (configuration.getFormatOut().getName().equals("wkt")) 174 149 { 175 result = ioHelper.closestEdgeWKTResult(rs);150 result = this.ioHelper.closestEdgeWKTResult(rs); 176 151 } 177 152 // Converts the SQL Result in KML 178 153 else if (configuration.getFormatOut().getName().equals("kml")) 179 154 { 180 result = ioHelper.closestEdgeKMLResult(rs);155 result = this.ioHelper.closestEdgeKMLResult(rs); 181 156 } 182 157 … … 185 160 */ 186 161 } 162 187 163 } branches/routingservice/src/jp/co/orkney/restlet/geo/DrivingDistance.java
r125 r128 52 52 * @see DatabaseConnection 53 53 */ 54 public class DrivingDistance 54 public class DrivingDistance extends GeoAction 55 55 { 56 private String result = "";57 private DatabaseConnection databaseConnection;58 private IOHelper ioHelper;59 private Point point;60 private Configuration configuration;61 56 private float speed; 62 57 private float time; 63 58 private float length; 64 private Log log; 59 65 60 66 61 /** … … 75 70 * the current configuration 76 71 */ 77 public DrivingDistance(Configuration configuration )72 public DrivingDistance(Configuration configuration, DatabaseConnection databaseConnection, IOHelper ioHelper, Log log) 78 73 { 79 this.configuration = configuration;80 this.log = configuration.createLog();81 ioHelper = new IOHelper(configuration);74 super(configuration, databaseConnection, ioHelper, log); 75 76 name = "Driving distance"; 82 77 83 78 // extract method for Geojson format … … 155 150 public void start() throws SQLException, JSONException 156 151 { 157 databaseConnection = new DatabaseConnection(configuration);158 159 152 StringTemplate query = ioHelper.getQuery(); 160 153 float bboxSize = Float.parseFloat(configuration.getService().getParameter("bbox").getValue()); … … 181 174 // System.out.println(query.toString()); 182 175 log.write(query.toString(), 1); 183 ResultSet rs = databaseConnection.getResult(query.toString()); 184 176 ResultSet rs = databaseConnection.getResult(configuration.getService(), query.toString()); 177 178 String reqId = configuration.getService().getParameter("request_id").getValue(); 179 185 180 // Converts the SQL Result in Geojson 186 181 if (configuration.getFormatOut().getName().equals("geojson")) 187 182 { 188 result = ioHelper.drivingDistanceGEOJSONResult(rs );183 result = ioHelper.drivingDistanceGEOJSONResult(rs, reqId); 189 184 } 190 185 // Converts the SQL Result in HTML 191 186 else if (configuration.getFormatOut().getName().equals("html")) 192 187 { 193 result = ioHelper.drivingDistanceHTMLResult(rs, point );188 result = ioHelper.drivingDistanceHTMLResult(rs, point, reqId); 194 189 } 195 190 // Converts the SQL Result in XML 196 191 else if (configuration.getFormatOut().getName().equals("xml")) 197 192 { 198 result = ioHelper.drivingDistanceXMLResult(rs );193 result = ioHelper.drivingDistanceXMLResult(rs, reqId); 199 194 } 200 195 // Converts the SQL Result in GML 201 196 else if (configuration.getFormatOut().getName().equals("gml")) 202 197 { 203 result = ioHelper.drivingDistanceGMLResult(rs );198 result = ioHelper.drivingDistanceGMLResult(rs, reqId); 204 199 } 205 200 // Converts the SQL Result in WKT branches/routingservice/src/jp/co/orkney/restlet/geo/ShortestPath.java
r125 r128 51 51 * @see DatabaseConnection 52 52 */ 53 public class ShortestPath 53 public class ShortestPath extends GeoAction 54 54 { 55 private String result = "";56 private DatabaseConnection databaseConnection;57 private IOHelper ioHelper;58 55 private Point startPoint; 59 56 private Point endPoint; 60 private Configuration configuration; 61 private Log log; 57 62 58 63 59 /** … … 72 68 * the current configuration 73 69 */ 74 public ShortestPath(Configuration configuration )70 public ShortestPath(Configuration configuration, DatabaseConnection databaseConnection, IOHelper ioHelper, Log log) 75 71 { 76 this.configuration = configuration;77 this.log = configuration.createLog();78 ioHelper = new IOHelper(configuration);72 super(configuration, databaseConnection, ioHelper, log); 73 74 name = "Shortest path"; 79 75 80 76 // extract method for Geojson format 81 if ( this.configuration.getFormatIn().getName().equals("geojson"))77 if (configuration.getFormatIn().getName().equals("geojson")) 82 78 { 83 startPoint = ioHelper.extractGEOJSONPxPy( this.configuration.getService().getParameter("point_start").getValue());84 endPoint = ioHelper.extractGEOJSONPxPy( this.configuration.getService().getParameter("point_end").getValue());79 startPoint = ioHelper.extractGEOJSONPxPy(configuration.getService().getParameter("point_start").getValue()); 80 endPoint = ioHelper.extractGEOJSONPxPy(configuration.getService().getParameter("point_end").getValue()); 85 81 } 86 82 // extract method for Gml format 87 else if ( this.configuration.getFormatIn().getName().equals("gml"))83 else if (configuration.getFormatIn().getName().equals("gml")) 88 84 { 89 startPoint = ioHelper.extractGMLPxPy( this.configuration.getService().getParameter("point_start").getValue());90 endPoint = ioHelper.extractGMLPxPy( this.configuration.getService().getParameter("point_end").getValue());85 startPoint = ioHelper.extractGMLPxPy(configuration.getService().getParameter("point_start").getValue()); 86 endPoint = ioHelper.extractGMLPxPy(configuration.getService().getParameter("point_end").getValue()); 91 87 } 92 88 // extract method for lonlat format 93 else if ( this.configuration.getFormatIn().getName().equals("lonlat"))89 else if (configuration.getFormatIn().getName().equals("lonlat")) 94 90 { 95 startPoint = ioHelper.extractLONLATPxPy( this.configuration.getService().getParameter("point_start").getValue());96 endPoint = ioHelper.extractLONLATPxPy( this.configuration.getService().getParameter("point_end").getValue());91 startPoint = ioHelper.extractLONLATPxPy(configuration.getService().getParameter("point_start").getValue()); 92 endPoint = ioHelper.extractLONLATPxPy(configuration.getService().getParameter("point_end").getValue());
