/* 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. */ #ifndef GPX_DESCRIPTOR_H_ #define GPX_DESCRIPTOR_H_ #include "BaseDescriptor.h" template class GPXDescriptor : public BaseDescriptor{ private: _DescriptorConfig config; string tmp; _Coordinate current; public: void SetConfig(const _DescriptorConfig& c) { config = c; } void Run(http::Reply& reply, RawRouteData * route, PhantomNodes * phantomNodes, SearchEngineT * sEngine, unsigned distance) { reply.content += (""); reply.content += ""; reply.content += ""; if(distance != UINT_MAX && route->routeSegments.size()) { convertInternalLatLonToString(phantomNodes->startCoord.lat, tmp); reply.content += "startCoord.lon, tmp); reply.content += "lon=\"" + tmp + "\">"; for(unsigned segmentIdx = 0; segmentIdx < route->routeSegments.size(); segmentIdx++) { const std::vector< _PathData > & path = route->routeSegments[segmentIdx]; if( ! path.size() ) continue; for(vector< _PathData >::const_iterator it = path.begin(); it != path.end(); it++) { sEngine->getCoordinatesForNodeID(it->node, current); convertInternalLatLonToString(current.lat, tmp); reply.content += ""; reply.content +=""; } } convertInternalLatLonToString(phantomNodes->targetCoord.lat, tmp); reply.content += "targetCoord.lon, tmp); reply.content += "lon=\"" + tmp + "\">"; } reply.content += ""; } }; #endif /* GPX_DESCRIPTOR_H_ */