2011-11-24 11:47:05 -05:00
|
|
|
/*
|
|
|
|
|
2015-02-19 03:19:51 -05:00
|
|
|
Copyright (c) 2015, Project OSRM contributors
|
2013-10-14 07:42:28 -04:00
|
|
|
All rights reserved.
|
2011-11-24 11:47:05 -05:00
|
|
|
|
2013-10-14 07:42:28 -04:00
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
are permitted provided that the following conditions are met:
|
2011-11-24 11:47:05 -05:00
|
|
|
|
2013-10-14 07:42:28 -04:00
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
2011-11-24 11:47:05 -05:00
|
|
|
|
2015-01-23 07:53:02 -05:00
|
|
|
#ifndef SEGMENT_INFORMATION_HPP
|
|
|
|
#define SEGMENT_INFORMATION_HPP
|
2011-11-24 11:47:05 -05:00
|
|
|
|
2014-11-28 06:13:18 -05:00
|
|
|
#include "turn_instructions.hpp"
|
2013-06-26 19:48:22 -04:00
|
|
|
|
2014-11-28 06:13:18 -05:00
|
|
|
#include "../data_structures/travel_mode.hpp"
|
2013-12-08 12:33:53 -05:00
|
|
|
#include "../typedefs.h"
|
2012-12-17 07:14:43 -05:00
|
|
|
|
2014-11-24 11:57:01 -05:00
|
|
|
#include <osrm/coordinate.hpp>
|
2015-08-18 06:56:34 -04:00
|
|
|
#include <utility>
|
2013-12-17 11:59:44 -05:00
|
|
|
|
2013-12-08 12:33:53 -05:00
|
|
|
// Struct fits everything in one cache line
|
2014-05-07 12:39:16 -04:00
|
|
|
struct SegmentInformation
|
|
|
|
{
|
2013-08-14 07:12:28 -04:00
|
|
|
FixedPointCoordinate location;
|
2013-12-08 12:33:53 -05:00
|
|
|
NodeID name_id;
|
2014-06-03 05:28:39 -04:00
|
|
|
EdgeWeight duration;
|
2014-05-26 09:30:06 -04:00
|
|
|
float length;
|
2014-05-07 12:39:16 -04:00
|
|
|
short bearing; // more than enough [0..3600] fits into 12 bits
|
2013-12-08 12:33:53 -05:00
|
|
|
TurnInstruction turn_instruction;
|
2015-01-23 08:24:02 -05:00
|
|
|
TravelMode travel_mode;
|
|
|
|
bool necessary;
|
|
|
|
bool is_via_location;
|
2014-08-18 10:27:51 -04:00
|
|
|
|
2015-08-18 06:56:34 -04:00
|
|
|
explicit SegmentInformation(FixedPointCoordinate location,
|
2014-05-07 12:39:16 -04:00
|
|
|
const NodeID name_id,
|
2014-06-03 05:28:39 -04:00
|
|
|
const EdgeWeight duration,
|
2014-05-26 09:30:06 -04:00
|
|
|
const float length,
|
2014-05-07 12:39:16 -04:00
|
|
|
const TurnInstruction turn_instruction,
|
2014-05-26 09:30:06 -04:00
|
|
|
const bool necessary,
|
2014-08-09 09:13:04 -04:00
|
|
|
const bool is_via_location,
|
|
|
|
const TravelMode travel_mode)
|
2015-08-18 06:56:34 -04:00
|
|
|
: location(std::move(location)), name_id(name_id), duration(duration), length(length),
|
|
|
|
bearing(0), turn_instruction(turn_instruction), travel_mode(travel_mode),
|
|
|
|
necessary(necessary), is_via_location(is_via_location)
|
2014-05-07 12:39:16 -04:00
|
|
|
{
|
|
|
|
}
|
2013-12-08 12:33:53 -05:00
|
|
|
|
2015-08-18 06:56:34 -04:00
|
|
|
explicit SegmentInformation(FixedPointCoordinate location,
|
2014-05-07 12:39:16 -04:00
|
|
|
const NodeID name_id,
|
2014-06-03 05:28:39 -04:00
|
|
|
const EdgeWeight duration,
|
2014-05-26 09:30:06 -04:00
|
|
|
const float length,
|
2014-08-09 09:13:04 -04:00
|
|
|
const TurnInstruction turn_instruction,
|
|
|
|
const TravelMode travel_mode)
|
2015-08-18 06:56:34 -04:00
|
|
|
: location(std::move(location)), name_id(name_id), duration(duration), length(length),
|
|
|
|
bearing(0), turn_instruction(turn_instruction), travel_mode(travel_mode),
|
2014-08-19 03:24:05 -04:00
|
|
|
necessary(turn_instruction != TurnInstruction::NoTurn), is_via_location(false)
|
2014-05-07 12:39:16 -04:00
|
|
|
{
|
|
|
|
}
|
2011-11-24 11:47:05 -05:00
|
|
|
};
|
|
|
|
|
2015-01-23 07:53:02 -05:00
|
|
|
#endif /* SEGMENT_INFORMATION_HPP */
|