renamed: Util/Azimuth.h -> Util/bearing.hpp
This commit is contained in:
parent
459e2a322b
commit
acd1919e8d
@ -66,7 +66,7 @@ add_executable(osrm-prepare ${PrepareSources} $<TARGET_OBJECTS:FINGERPRINT> $<TA
|
|||||||
|
|
||||||
file(GLOB ServerGlob Server/*.cpp)
|
file(GLOB ServerGlob Server/*.cpp)
|
||||||
file(GLOB DescriptorGlob Descriptors/*.cpp)
|
file(GLOB DescriptorGlob Descriptors/*.cpp)
|
||||||
file(GLOB DatastructureGlob DataStructures/SearchEngineData.cpp DataStructures/RouteParameters.cpp)
|
file(GLOB DatastructureGlob DataStructures/SearchEngineData.cpp DataStructures/RouteParameters.cpp Util/bearing.cpp)
|
||||||
list(REMOVE_ITEM DatastructureGlob DataStructures/Coordinate.cpp)
|
list(REMOVE_ITEM DatastructureGlob DataStructures/Coordinate.cpp)
|
||||||
file(GLOB CoordinateGlob DataStructures/Coordinate.cpp)
|
file(GLOB CoordinateGlob DataStructures/Coordinate.cpp)
|
||||||
file(GLOB AlgorithmGlob Algorithms/*.cpp)
|
file(GLOB AlgorithmGlob Algorithms/*.cpp)
|
||||||
|
@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "../DataStructures/Range.h"
|
#include "../DataStructures/Range.h"
|
||||||
#include "../DataStructures/SegmentInformation.h"
|
#include "../DataStructures/SegmentInformation.h"
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
#include "../DataStructures/TurnInstructions.h"
|
||||||
#include "../Util/Azimuth.h"
|
#include "../Util/bearing.hpp"
|
||||||
#include "../Util/json_renderer.hpp"
|
#include "../Util/json_renderer.hpp"
|
||||||
#include "../Util/simple_logger.hpp"
|
#include "../Util/simple_logger.hpp"
|
||||||
#include "../Util/StringUtil.h"
|
#include "../Util/StringUtil.h"
|
||||||
@ -354,7 +354,7 @@ template <class DataFacadeT> class JSONDescriptor final : public BaseDescriptor<
|
|||||||
json_instruction_row.values.push_back(
|
json_instruction_row.values.push_back(
|
||||||
cast::integral_to_string(static_cast<unsigned>(segment.length)) + "m");
|
cast::integral_to_string(static_cast<unsigned>(segment.length)) + "m");
|
||||||
const double bearing_value = (segment.bearing / 10.);
|
const double bearing_value = (segment.bearing / 10.);
|
||||||
json_instruction_row.values.push_back(Azimuth::Get(bearing_value));
|
json_instruction_row.values.push_back(Bearing::Get(bearing_value));
|
||||||
json_instruction_row.values.push_back(
|
json_instruction_row.values.push_back(
|
||||||
static_cast<unsigned>(round(bearing_value)));
|
static_cast<unsigned>(round(bearing_value)));
|
||||||
json_instruction_row.values.push_back(segment.travel_mode);
|
json_instruction_row.values.push_back(segment.travel_mode);
|
||||||
@ -384,7 +384,7 @@ template <class DataFacadeT> class JSONDescriptor final : public BaseDescriptor<
|
|||||||
json_last_instruction_row.values.push_back(necessary_segments_running_index - 1);
|
json_last_instruction_row.values.push_back(necessary_segments_running_index - 1);
|
||||||
json_last_instruction_row.values.push_back(0);
|
json_last_instruction_row.values.push_back(0);
|
||||||
json_last_instruction_row.values.push_back("0m");
|
json_last_instruction_row.values.push_back("0m");
|
||||||
json_last_instruction_row.values.push_back(Azimuth::Get(0.0));
|
json_last_instruction_row.values.push_back(Bearing::Get(0.0));
|
||||||
json_last_instruction_row.values.push_back(0.);
|
json_last_instruction_row.values.push_back(0.);
|
||||||
json_instruction_array.values.push_back(json_last_instruction_row);
|
json_instruction_array.values.push_back(json_last_instruction_row);
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef AZIMUTH_H
|
#include "bearing.hpp"
|
||||||
#define AZIMUTH_H
|
|
||||||
|
|
||||||
#include <string>
|
std::string Bearing::Get(const double heading)
|
||||||
|
|
||||||
struct Azimuth
|
|
||||||
{
|
|
||||||
static std::string Get(const double heading)
|
|
||||||
{
|
{
|
||||||
if (heading <= 202.5)
|
if (heading <= 202.5)
|
||||||
{
|
{
|
||||||
if (heading >= 0 && heading <= 22.5)
|
if (heading >= 0. && heading <= 22.5)
|
||||||
{
|
{
|
||||||
return "N";
|
return "N";
|
||||||
}
|
}
|
||||||
@ -68,6 +63,3 @@ struct Azimuth
|
|||||||
}
|
}
|
||||||
return "N";
|
return "N";
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
#endif // AZIMUTH_H
|
|
38
Util/bearing.hpp
Normal file
38
Util/bearing.hpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
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 BEARING_HPP_
|
||||||
|
#define BEARING_HPP_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
struct Bearing
|
||||||
|
{
|
||||||
|
static std::string Get(const double heading);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BEARING_HPP_
|
Loading…
Reference in New Issue
Block a user