diff --git a/Plugins/BasicDescriptor.h b/Plugins/BasicDescriptor.h index 33e229fd6..50907aac8 100644 --- a/Plugins/BasicDescriptor.h +++ b/Plugins/BasicDescriptor.h @@ -40,23 +40,58 @@ public: void Run(http::Reply& reply, std::vector< _PathData > * path, PhantomNodes * phantomNodes, SearchEngineT * sEngine, unsigned distance) { string tmp; string lineString; + string startName; + string targetName; + string direction = "East"; reply.content += ("\n"); reply.content += ("\n"); reply.content += ("\n"); - //todo reply.content += (" to ]]>"); - reply.content += ("\t\n"); - reply.content += ("\t\t direction ]]>\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\n"); if(distance != UINT_MAX) { + unsigned streetID = sEngine->GetNameIDForOriginDestinationNodeID(phantomNodes->startNode1, phantomNodes->startNode2); + startName = sEngine->GetNameForNameID(streetID); + streetID = sEngine->GetNameIDForOriginDestinationNodeID(phantomNodes->targetNode1, phantomNodes->targetNode2); + targetName = sEngine->GetNameForNameID(streetID); + + reply.content += ("\t\n"); + reply.content += ("\t\tsize() > 0) + sEngine->getNodeInfo(path->begin()->node, tmpCoord); + else + tmpCoord = phantomNodes->targetCoord; + + int angle = round(GetAngleBetweenTwoEdges(_Coordinate(phantomNodes->startCoord.lat, phantomNodes->startCoord.lon), tmpCoord, _Coordinate(tmpCoord.lat, tmpCoord.lon-1000))); + if(angle >= 23 && angle < 67) + direction = "South-East"; + if(angle >= 67 && angle < 113) + direction = "South"; + if(angle >= 113 && angle < 158) + direction = "South-West"; + if(angle >= 158 && angle < 202) + direction = "West"; + if(angle >= 202 && angle < 248) + direction = "North-West"; + if(angle >= 248 && angle < 292) + direction = "North"; + if(angle >= 292 && angle < 336) + direction = "North-East"; + + reply.content += direction; + + reply.content += ("]]>\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\n"); _Coordinate previous(phantomNodes->startCoord.lat, phantomNodes->startCoord.lon); _Coordinate next, current, lastPlace; stringstream numberString; @@ -160,15 +195,15 @@ public: 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 += ")]]>\n\t\tdrive for "; +// reply.content += " (type: "; +// numberString << type; +// reply.content += numberString.str(); +// numberString.str(""); +// reply.content += ", id: "; +// numberString << nameID; +// reply.content += numberString.str(); +// numberString.str(")"); + reply.content += "]]>\n\t\tdrive for "; lengthOfInstruction = ApproximateDistance(previous.lat, previous.lon, phantomNodes->targetCoord.lat, phantomNodes->targetCoord.lon) + tempDist; entireDistance += lengthOfInstruction; numberString << 10*(round(lengthOfInstruction/10.)); @@ -193,7 +228,11 @@ public: lineString += tmp; reply.content += "\t\n" - "\t\tRoute\n" + "\t\t\n" "\t\t" "