/* Copyright (c) 2013, Project OSRM, Dennis Luxen, others All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef GPX_DESCRIPTOR_H #define GPX_DESCRIPTOR_H #include "BaseDescriptor.h" template class GPXDescriptor : public BaseDescriptor { private: DescriptorConfig config; FixedPointCoordinate current; std::string tmp; public: void SetConfig(const DescriptorConfig &c) { config = c; } // TODO: reorder parameters void Run(const RawRouteData &raw_route, const PhantomNodes &phantom_node_list, DataFacadeT *facade, http::Reply &reply) { reply.content.push_back(""); reply.content.push_back(""); reply.content.push_back("Data (c)" " OpenStreetMap contributors (ODbL)" ""); reply.content.push_back(""); bool found_route = (raw_route.shortest_path_length != INVALID_EDGE_WEIGHT) && (!raw_route.unpacked_path_segments.front().empty()); if (found_route) { FixedPointCoordinate::convertInternalLatLonToString( phantom_node_list.source_phantom.location.lat, tmp); reply.content.push_back(""); for (const std::vector &path_data_vector : raw_route.unpacked_path_segments) { for (const PathData &path_data : path_data_vector) { FixedPointCoordinate current_coordinate = facade->GetCoordinateOfNode(path_data.node); FixedPointCoordinate::convertInternalLatLonToString(current_coordinate.lat, tmp); reply.content.push_back(""); } } // Add the via point or the end coordinate FixedPointCoordinate::convertInternalLatLonToString( phantom_node_list.target_phantom.location.lat, tmp); reply.content.push_back(""); } reply.content.push_back(""); } }; #endif // GPX_DESCRIPTOR_H