BREAKING CHANGE: kml-based turn-by-turn instructions
This commit is contained in:
parent
b6cf33b353
commit
3d44f3eb64
@ -33,12 +33,6 @@ struct _HeapData {
|
||||
_HeapData( NodeID p ) : parent(p) { }
|
||||
};
|
||||
|
||||
struct _PathData {
|
||||
_PathData(NodeID n, bool t) : node(n), turn(t) { }
|
||||
NodeID node:31;
|
||||
bool turn:1;
|
||||
};
|
||||
|
||||
struct _Statistics {
|
||||
_Statistics () : insertedNodes(0), stalledNodes(0), meetingNodes(0), deleteMins(0), decreasedNodes(0), oqf(0), eqf(0), df(0), preprocTime(0) {};
|
||||
void Reset() {
|
||||
@ -220,13 +214,11 @@ public:
|
||||
packedPath.push_back( pathNode );
|
||||
}
|
||||
|
||||
path->push_back( _PathData(packedPath[0], false) );
|
||||
{
|
||||
path->push_back( _PathData(packedPath[0]) );
|
||||
for(deque<NodeID>::size_type i = 0; i < packedPath.size()-1; i++)
|
||||
{
|
||||
_UnpackEdge(packedPath[i], packedPath[i+1], path);
|
||||
}
|
||||
}
|
||||
|
||||
packedPath.clear();
|
||||
delete _forwardHeap;
|
||||
@ -472,7 +464,7 @@ private:
|
||||
return false;
|
||||
} else {
|
||||
assert(!ed.shortcut);
|
||||
path->push_back(_PathData(target, (forward ? ed.forwardTurn : ed.backwardTurn) ) );
|
||||
path->push_back(_PathData(target) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
237
Plugins/BasicDescriptor.h
Normal file
237
Plugins/BasicDescriptor.h
Normal file
@ -0,0 +1,237 @@
|
||||
/*
|
||||
open source routing machine
|
||||
Copyright (C) Dennis Luxen, others 2010
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../typedefs.h"
|
||||
#include "../DataStructures/ExtractorStructs.h"
|
||||
#include "../Util/StrIngUtil.h"
|
||||
|
||||
#ifndef BASICDESCRIPTOR_H_
|
||||
#define BASICDESCRIPTOR_H_
|
||||
|
||||
struct _PathData {
|
||||
_PathData(NodeID n) : node(n) { }
|
||||
NodeID node;
|
||||
};
|
||||
|
||||
class BasicDescriptor {
|
||||
public:
|
||||
template<class SearchEngineT>
|
||||
void Run(http::Reply& reply, std::vector< _PathData > * path, PhantomNodes * phantomNodes, SearchEngineT * sEngine, unsigned distance) {
|
||||
string tmp;
|
||||
string lineString;
|
||||
reply.content += ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
reply.content += ("<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n");
|
||||
reply.content += ("<Document>\n");
|
||||
//todo reply.content += ("<name><![CDATA[<start> to <target>]]><name>");
|
||||
reply.content += ("\t<Placemark>\n");
|
||||
reply.content += ("\t\t<name><![CDATA[Start from <start> direction <northeast>]]></name>\n");
|
||||
|
||||
//put start coord to linestring;
|
||||
convertLatLon(phantomNodes->startCoord.lon, tmp);
|
||||
lineString += tmp;
|
||||
lineString += ",";
|
||||
convertLatLon(phantomNodes->startCoord.lat, tmp);
|
||||
lineString += tmp;
|
||||
lineString += " ";
|
||||
|
||||
reply.content += ("\t</Placemark>\n");
|
||||
if(distance != UINT_MAX) {
|
||||
_Coordinate previous(phantomNodes->startCoord.lat, phantomNodes->startCoord.lon);
|
||||
_Coordinate next, current, lastPlace;
|
||||
stringstream numberString;
|
||||
|
||||
double tempDist = 0;
|
||||
double entireDistance = 0;
|
||||
double lengthOfInstruction = 0;
|
||||
NodeID nextID = UINT_MAX;
|
||||
NodeID nameID = sEngine->GetNameIDForOriginDestinationNodeID(phantomNodes->startNode1, phantomNodes->startNode2);
|
||||
short type = sEngine->GetTypeOfEdgeForOriginDestinationNodeID(phantomNodes->startNode1, phantomNodes->startNode2);
|
||||
lastPlace.lat = phantomNodes->startCoord.lat;
|
||||
lastPlace.lon = phantomNodes->startCoord.lon;
|
||||
short nextType = SHRT_MAX;
|
||||
short prevType = SHRT_MAX;
|
||||
reply.content += "\t<Placemark>\n\t\t<name><![CDATA[";
|
||||
for(vector< _PathData >::iterator it = path->begin(); it != path->end(); it++) {
|
||||
sEngine->getNodeInfo(it->node, current);
|
||||
convertLatLon(current.lon, tmp);
|
||||
lineString += tmp;
|
||||
lineString += ",";
|
||||
convertLatLon(current.lat, tmp);
|
||||
lineString += tmp;
|
||||
lineString += " ";
|
||||
|
||||
if(it==path->end()-1){
|
||||
next = _Coordinate(phantomNodes->targetCoord.lat, phantomNodes->targetCoord.lon);
|
||||
nextID = sEngine->GetNameIDForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2);
|
||||
nextType = sEngine->GetTypeOfEdgeForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2);
|
||||
} else {
|
||||
sEngine->getNodeInfo((it+1)->node, next);
|
||||
nextID = sEngine->GetNameIDForOriginDestinationNodeID(it->node, (it+1)->node);
|
||||
nextType = sEngine->GetTypeOfEdgeForOriginDestinationNodeID(it->node, (it+1)->node);
|
||||
}
|
||||
|
||||
|
||||
if(nextID == nameID) {
|
||||
tempDist += ApproximateDistance(previous.lat, previous.lon, current.lat, current.lon);
|
||||
} else {
|
||||
if(type == 0 && prevType != 0)
|
||||
reply.content += "enter motorway and ";
|
||||
if(type != 0 && prevType == 0 )
|
||||
reply.content += "leave motorway and ";
|
||||
|
||||
double angle = GetAngleBetweenTwoEdges(previous, current, next);
|
||||
reply.content += "follow road ";
|
||||
if(nameID != 0)
|
||||
reply.content += sEngine->GetNameForNameID(nameID);
|
||||
/*
|
||||
reply.content += " (type: ";
|
||||
numberString << type;
|
||||
reply.content += numberString.str();
|
||||
numberString.str("");
|
||||
reply.content += ", id: ";
|
||||
numberString << nameID;
|
||||
reply.content += numberString.str();
|
||||
numberString.str("");
|
||||
reply.content += ")";
|
||||
*/
|
||||
reply.content += "]]></name>\n\t\t<description>drive for ";
|
||||
lengthOfInstruction = ApproximateDistance(previous.lat, previous.lon, current.lat, current.lon)+tempDist;
|
||||
entireDistance += lengthOfInstruction;
|
||||
numberString << 10*(round(lengthOfInstruction/10.));;
|
||||
reply.content += numberString.str();
|
||||
numberString.str("");
|
||||
reply.content += "m</description>";
|
||||
string lat; string lon;
|
||||
convertLatLon(lastPlace.lon, lon);
|
||||
convertLatLon(lastPlace.lat, lat);
|
||||
lastPlace = current;
|
||||
// reply.content += "\n <Point>";
|
||||
// reply.content += "<Coordinates>";
|
||||
// reply.content += lon;
|
||||
// reply.content += ",";
|
||||
// reply.content += lat;
|
||||
// reply.content += "</Coordinates></Point>";
|
||||
reply.content += "\n\t</Placemark>\n";
|
||||
reply.content += "\t<Placemark>\n\t\t<name><![CDATA[";
|
||||
if(angle > 160 && angle < 200) {
|
||||
reply.content += /* " (" << angle << ")*/"drive ahead, ";
|
||||
} else if (angle > 290 && angle <= 360) {
|
||||
reply.content += /*" (" << angle << ")*/ "turn sharp left, ";
|
||||
} else if (angle > 230 && angle <= 290) {
|
||||
reply.content += /*" (" << angle << ")*/ "turn left, ";
|
||||
} else if (angle > 200 && angle <= 230) {
|
||||
reply.content += /*" (" << angle << ") */"bear left, ";
|
||||
} else if (angle > 130 && angle <= 160) {
|
||||
reply.content += /*" (" << angle << ") */"bear right, ";
|
||||
} else if (angle > 70 && angle <= 130) {
|
||||
reply.content += /*" (" << angle << ") */"turn right, ";
|
||||
} else {
|
||||
reply.content += /*" (" << angle << ") */"turn sharp right, ";
|
||||
}
|
||||
tempDist = 0;
|
||||
prevType = type;
|
||||
}
|
||||
nameID = nextID;
|
||||
previous = current;
|
||||
type = nextType;
|
||||
}
|
||||
nameID = sEngine->GetNameIDForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2);
|
||||
type = sEngine->GetTypeOfEdgeForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2);
|
||||
reply.content += "follow road ";
|
||||
reply.content += sEngine->GetNameForNameID(nameID);
|
||||
reply.content += " (type: ";
|
||||
numberString << type;
|
||||
reply.content += numberString.str();
|
||||
numberString.str("");
|
||||
reply.content += ", id: ";
|
||||
numberString << nameID;
|
||||
reply.content += numberString.str();
|
||||
numberString.str("");
|
||||
reply.content += ")]]></name>\n\t\t<description>drive for ";
|
||||
lengthOfInstruction = ApproximateDistance(previous.lat, previous.lon, phantomNodes->targetCoord.lat, phantomNodes->targetCoord.lon) + tempDist;
|
||||
entireDistance += lengthOfInstruction;
|
||||
numberString << 10*(round(lengthOfInstruction/10.));
|
||||
reply.content += numberString.str();
|
||||
numberString.str("");
|
||||
reply.content += "m</description>\n ";
|
||||
string lat; string lon;
|
||||
// convertLatLon(lastPlace.lon, lon);
|
||||
// convertLatLon(lastPlace.lat, lat);
|
||||
// reply.content += "<Point><Coordinates>";
|
||||
// reply.content += lon;
|
||||
// reply.content += ",";
|
||||
// reply.content += lat;
|
||||
// reply.content += "</Coordinates></Point>";
|
||||
reply.content += "\t</Placemark>\n";
|
||||
|
||||
//put targetCoord to linestring
|
||||
convertLatLon(phantomNodes->targetCoord.lon, tmp);
|
||||
lineString += tmp;
|
||||
lineString += ",";
|
||||
convertLatLon(phantomNodes->targetCoord.lat, tmp);
|
||||
lineString += tmp;
|
||||
|
||||
reply.content += "\t<Placemark>\n"
|
||||
"\t\t<name>Route</name>\n"
|
||||
"\t\t<description>"
|
||||
"<![CDATA[Distance: ";
|
||||
|
||||
//give complete distance in meters;
|
||||
ostringstream s;
|
||||
s << 10*(round(entireDistance/10.));
|
||||
reply.content += s.str();
|
||||
reply.content += " m (ca. ";
|
||||
|
||||
//give travel time in minutes
|
||||
int travelTime = (distance/60) + 1;
|
||||
s.str("");
|
||||
s << travelTime;
|
||||
reply.content += s.str();
|
||||
|
||||
reply.content += " minutes)]]>"
|
||||
"</description>\n"
|
||||
"\t\t<GeometryCollection>\n"
|
||||
"\t\t\t<LineString>\n"
|
||||
"\t\t\t\t<coordinates>";
|
||||
reply.content += lineString;
|
||||
reply.content += "</coordinates>\n"
|
||||
"\t\t\t</LineString>\n"
|
||||
"\t\t</GeometryCollection>\n"
|
||||
"\t</Placemark>\n";
|
||||
}
|
||||
reply.content += "</Document>\n</kml>";
|
||||
|
||||
reply.headers.resize(3);
|
||||
reply.headers[0].name = "Content-Length";
|
||||
intToString(reply.content.size(), tmp);
|
||||
reply.headers[0].value = tmp;
|
||||
reply.headers[1].name = "Content-Type";
|
||||
reply.headers[1].value = "application/vnd.google-earth.kml+xml";
|
||||
reply.headers[2].name = "Content-Disposition";
|
||||
reply.headers[2].value = "attachment; filename=\"route.kml\"";
|
||||
|
||||
}
|
||||
private:
|
||||
};
|
||||
#endif /* BASICDESCRIPTOR_H_ */
|
@ -36,6 +36,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
typedef ContractionCleanup::Edge::EdgeData EdgeData;
|
||||
typedef StaticGraph<EdgeData>::InputEdge InputEdge;
|
||||
|
||||
template <class DescriptorT>
|
||||
class RoutePlugin : public BasePlugin {
|
||||
public:
|
||||
RoutePlugin(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string namesPath) {
|
||||
@ -58,17 +59,29 @@ public:
|
||||
namesInStream.read((char *)&size, sizeof(unsigned));
|
||||
names = new std::vector<std::string>();
|
||||
|
||||
for(unsigned i = 0; i < size; i++) {
|
||||
unsigned sizeOfString = 0;
|
||||
namesInStream.read((char *)&sizeOfString, sizeof(unsigned));
|
||||
char * buf = new char[1024];
|
||||
namesInStream.read(buf, sizeOfString);
|
||||
std::string currentStreetName(buf);
|
||||
names->push_back(currentStreetName);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
//init complete search engine
|
||||
sEngine = new SearchEngine<EdgeData, StaticGraph<EdgeData> >(graph, nodeHelpDesk, names);
|
||||
descriptor = new DescriptorT();
|
||||
}
|
||||
~RoutePlugin() {
|
||||
delete names;
|
||||
delete sEngine;
|
||||
delete graph;
|
||||
delete nodeHelpDesk;
|
||||
delete descriptor;
|
||||
}
|
||||
std::string GetDescriptor() { return std::string("route"); }
|
||||
std::string GetVersionString() { return std::string("0.2a (DL)"); }
|
||||
std::string GetVersionString() { return std::string("0.3 (DL)"); }
|
||||
void HandleRequest(std::vector<std::string> parameters, http::Reply& reply) {
|
||||
//check number of parameters
|
||||
if(parameters.size() != 4) {
|
||||
@ -99,221 +112,18 @@ public:
|
||||
sEngine->FindRoutingStarts(startCoord, targetCoord, phantomNodes);
|
||||
unsigned int distance = sEngine->ComputeRoute(phantomNodes, path, startCoord, targetCoord);
|
||||
reply.status = http::Reply::ok;
|
||||
|
||||
string tmp;
|
||||
|
||||
reply.content += ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
reply.content += ("<kml xmlns=\"http://www.opengis.net/kml/2.2\">");
|
||||
reply.content += ("<Document>");
|
||||
|
||||
/* if(distance != std::numeric_limits<unsigned int>::max())
|
||||
computeDescription(tmp, path, phantomNodes);
|
||||
cout << tmp << endl;
|
||||
*/
|
||||
// reply.content += tmp;
|
||||
reply.content += ("<Placemark>");
|
||||
reply.content += ("<name>OSM Routing Engine (c) Dennis Luxen and others </name>");
|
||||
|
||||
reply.content += "<description>Route from ";
|
||||
convertLatLon(lat1, tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += ",";
|
||||
convertLatLon(lon1, tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += " to ";
|
||||
convertLatLon(lat2, tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += ",";
|
||||
convertLatLon(lon2, tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += "</description> ";
|
||||
reply.content += ("<LineString>");
|
||||
reply.content += ("<extrude>1</extrude>");
|
||||
reply.content += ("<tessellate>1</tessellate>");
|
||||
reply.content += ("<altitudeMode>absolute</altitudeMode>");
|
||||
reply.content += ("<coordinates>");
|
||||
|
||||
|
||||
if(distance != std::numeric_limits<unsigned int>::max())
|
||||
{ //A route has been found
|
||||
convertLatLon(phantomNodes->startCoord.lon, tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += (",");
|
||||
doubleToString(phantomNodes->startCoord.lat/100000., tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += (" ");
|
||||
_Coordinate result;
|
||||
for(vector< _PathData >::iterator it = path->begin(); it != path->end(); it++)
|
||||
{
|
||||
sEngine->getNodeInfo(it->node, result);
|
||||
convertLatLon(result.lon, tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += (",");
|
||||
convertLatLon(result.lat, tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += (" ");
|
||||
}
|
||||
|
||||
convertLatLon(phantomNodes->targetCoord.lon, tmp);
|
||||
reply.content += tmp;
|
||||
reply.content += (",");
|
||||
convertLatLon(phantomNodes->targetCoord.lat, tmp);
|
||||
reply.content += tmp;
|
||||
}
|
||||
|
||||
reply.content += ("</coordinates>");
|
||||
reply.content += ("</LineString>");
|
||||
reply.content += ("</Placemark>");
|
||||
reply.content += ("</Document>");
|
||||
reply.content += ("</kml>");
|
||||
|
||||
reply.headers.resize(3);
|
||||
reply.headers[0].name = "Content-Length";
|
||||
intToString(reply.content.size(), tmp);
|
||||
reply.headers[0].value = tmp;
|
||||
reply.headers[1].name = "Content-Type";
|
||||
reply.headers[1].value = "application/vnd.google-earth.kml+xml";
|
||||
reply.headers[2].name = "Content-Disposition";
|
||||
reply.headers[2].value = "attachment; filename=\"route.kml\"";
|
||||
descriptor->Run(reply, path, phantomNodes, sEngine, distance);
|
||||
|
||||
delete path;
|
||||
delete phantomNodes;
|
||||
return;
|
||||
}
|
||||
private:
|
||||
// void computeDescription(string &tmp, vector< _PathData > * path, PhantomNodes * phantomNodes)
|
||||
// {
|
||||
// _Coordinate previous(phantomNodes->startCoord.lat, phantomNodes->startCoord.lon);
|
||||
// _Coordinate next, current, lastPlace;
|
||||
// stringstream numberString;
|
||||
//
|
||||
// double tempDist = 0;
|
||||
// NodeID nextID = UINT_MAX;
|
||||
// NodeID nameID = sEngine->GetNameIDForOriginDestinationNodeID(phantomNodes->startNode1, phantomNodes->startNode2);
|
||||
// short type = sEngine->GetTypeOfEdgeForOriginDestinationNodeID(phantomNodes->startNode1, phantomNodes->startNode2);
|
||||
// lastPlace.lat = phantomNodes->startCoord.lat;
|
||||
// lastPlace.lon = phantomNodes->startCoord.lon;
|
||||
// short nextType = SHRT_MAX;
|
||||
// short prevType = SHRT_MAX;
|
||||
// tmp += "<Placemark>\n <Name>";
|
||||
// for(vector< _PathData >::iterator it = path->begin(); it != path->end(); it++)
|
||||
// {
|
||||
// sEngine->getNodeInfo(it->node, current);
|
||||
// if(it==path->end()-1){
|
||||
// next = _Coordinate(phantomNodes->targetCoord.lat, phantomNodes->targetCoord.lon);
|
||||
// nextID = sEngine->GetNameIDForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2);
|
||||
// nextType = sEngine->GetTypeOfEdgeForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2);
|
||||
// } else {
|
||||
// sEngine->getNodeInfo((it+1)->node, next);
|
||||
// nextID = sEngine->GetNameIDForOriginDestinationNodeID(it->node, (it+1)->node);
|
||||
// nextType = sEngine->GetTypeOfEdgeForOriginDestinationNodeID(it->node, (it+1)->node);
|
||||
// }
|
||||
// if(nextID == nameID) {
|
||||
// tempDist += ApproximateDistance(previous.lat, previous.lon, current.lat, current.lon);
|
||||
// } else {
|
||||
// if(type == 0 && prevType != 0)
|
||||
// tmp += "enter motorway and ";
|
||||
// if(type != 0 && prevType == 0 )
|
||||
// tmp += "leave motorway and ";
|
||||
//
|
||||
// double angle = GetAngleBetweenTwoEdges(previous, current, next);
|
||||
//// if(it->turn)
|
||||
//// tmp += " turn! ";
|
||||
// tmp += "follow road ";
|
||||
// if(nameID != 0)
|
||||
// tmp += sEngine->GetNameForNameID(nameID);
|
||||
// tmp += " (type: ";
|
||||
// numberString << type;
|
||||
// tmp += numberString.str();
|
||||
// numberString.str("");
|
||||
// tmp += ", id: ";
|
||||
// numberString << nameID;
|
||||
// tmp += numberString.str();
|
||||
// numberString.str("");
|
||||
// tmp += ")</Name>\n <Description>drive for ";
|
||||
// numberString << ApproximateDistance(previous.lat, previous.lon, current.lat, current.lon)+tempDist;
|
||||
// tmp += numberString.str();
|
||||
// numberString.str("");
|
||||
// tmp += "m </Description>";
|
||||
// string lat; string lon;
|
||||
// convertLatLon(lastPlace.lon, lon);
|
||||
// convertLatLon(lastPlace.lat, lat);
|
||||
// lastPlace = current;
|
||||
// tmp += "\n <Point><Coordinates>";
|
||||
// tmp += lon;
|
||||
// tmp += ",";
|
||||
// tmp += lat;
|
||||
// tmp += "</Coordinates></Point>";
|
||||
// tmp += "\n</Placemark>\n";
|
||||
// tmp += "<Placemark>\n <Name> (";
|
||||
// numberString << angle;
|
||||
// tmp += numberString.str();
|
||||
// numberString.str("");
|
||||
// tmp +=") ";
|
||||
// if(angle > 160 && angle < 200) {
|
||||
// tmp += /* " (" << angle << ")*/"drive ahead, ";
|
||||
// } else if (angle > 290 && angle <= 360) {
|
||||
// tmp += /*" (" << angle << ")*/ "turn sharp left, ";
|
||||
// } else if (angle > 230 && angle <= 290) {
|
||||
// tmp += /*" (" << angle << ")*/ "turn left, ";
|
||||
// } else if (angle > 200 && angle <= 230) {
|
||||
// tmp += /*" (" << angle << ") */"bear left, ";
|
||||
// } else if (angle > 130 && angle <= 160) {
|
||||
// tmp += /*" (" << angle << ") */"bear right, ";
|
||||
// } else if (angle > 70 && angle <= 130) {
|
||||
// tmp += /*" (" << angle << ") */"turn right, ";
|
||||
// } else {
|
||||
// tmp += /*" (" << angle << ") */"turn sharp right, ";
|
||||
// }
|
||||
// tempDist = 0;
|
||||
// prevType = type;
|
||||
// }
|
||||
// nameID = nextID;
|
||||
// previous = current;
|
||||
// type = nextType;
|
||||
// }
|
||||
// nameID = sEngine->GetNameIDForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2);
|
||||
// type = sEngine->GetTypeOfEdgeForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2);
|
||||
// tmp += "follow road ";
|
||||
// tmp += sEngine->GetNameForNameID(nameID);
|
||||
// tmp += " (type: ";
|
||||
// numberString << type;
|
||||
// tmp += numberString.str();
|
||||
// numberString.str("");
|
||||
// tmp += ", id: ";
|
||||
// numberString << nameID;
|
||||
// tmp += numberString.str();
|
||||
// numberString.str("");
|
||||
// tmp += ")</name>\n <Description> drive for ";
|
||||
// numberString << ApproximateDistance(previous.lat, previous.lon, phantomNodes->targetCoord.lat, phantomNodes->targetCoord.lon) + tempDist;
|
||||
// tmp += numberString.str();
|
||||
// numberString.str("");
|
||||
// tmp += "m</Description>\n ";
|
||||
// string lat; string lon;
|
||||
// convertLatLon(lastPlace.lon, lon);
|
||||
// convertLatLon(lastPlace.lat, lat);
|
||||
// tmp += "<Point><Coordinates>";
|
||||
// tmp += lon;
|
||||
// tmp += ",";
|
||||
// tmp += lat;
|
||||
// tmp += "</Coordinates></Point>";
|
||||
// tmp += "</Placemark>\n";
|
||||
// tmp += "<Placemark>\n <Name>you have reached your destination</Name>\n ";
|
||||
// tmp += "<Description>End of Route</Description>";
|
||||
// convertLatLon(phantomNodes->targetCoord.lon, lon);
|
||||
// convertLatLon(phantomNodes->targetCoord.lat, lat);
|
||||
// tmp += "\n <Point><Coordinates>";
|
||||
// tmp += lon;
|
||||
// tmp += ",";
|
||||
// tmp += lat;
|
||||
// tmp +="</Coordinates></Point>\n";
|
||||
// tmp += "</Placemark>";
|
||||
// }
|
||||
|
||||
NodeInformationHelpDesk * nodeHelpDesk;
|
||||
SearchEngine<EdgeData, StaticGraph<EdgeData> > * sEngine;
|
||||
std::vector<std::string> * names;
|
||||
StaticGraph<EdgeData> * graph;
|
||||
DescriptorT * descriptor;
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#include "Server/ServerConfiguration.h"
|
||||
#include "Server/ServerFactory.h"
|
||||
|
||||
#include "Plugins/BasicDescriptor.h"
|
||||
#include "Plugins/HelloWorldPlugin.h"
|
||||
#include "Plugins/LocatePlugin.h"
|
||||
#include "Plugins/RoutePlugin.h"
|
||||
@ -67,7 +68,7 @@ int main (int argc, char *argv[])
|
||||
serverConfig.GetParameter("nodesData"));
|
||||
h.RegisterPlugin(locate);
|
||||
|
||||
BasePlugin * route = new RoutePlugin(
|
||||
BasePlugin * route = new RoutePlugin<BasicDescriptor>(
|
||||
serverConfig.GetParameter("hsgrData"),
|
||||
serverConfig.GetParameter("ramIndex"),
|
||||
serverConfig.GetParameter("fileIndex"),
|
||||
|
Loading…
Reference in New Issue
Block a user