break out PhantomNode.h into a header/impl combo, rename to new naming scheme.
This commit is contained in:
parent
1c56671f01
commit
369f669227
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.8)
|
cmake_minimum_required(VERSION 2.8.8)
|
||||||
|
|
||||||
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE)
|
||||||
message(FATAL_ERROR "In-source builds are not allowed.
|
message(FATAL_ERROR "In-source builds are not allowed.
|
||||||
Please create a directory and run cmake from there, passing the path to this source directory as the last argument.
|
Please create a directory and run cmake from there, passing the path to this source directory as the last argument.
|
||||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
|
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.")
|
||||||
@ -54,6 +54,7 @@ file(GLOB ExtractorGlob Extractor/*.cpp)
|
|||||||
file(GLOB ImporterGlob DataStructures/Import*.cpp)
|
file(GLOB ImporterGlob DataStructures/Import*.cpp)
|
||||||
add_library(IMPORT OBJECT ${ImporterGlob})
|
add_library(IMPORT OBJECT ${ImporterGlob})
|
||||||
add_library(LOGGER OBJECT Util/simple_logger.cpp)
|
add_library(LOGGER OBJECT Util/simple_logger.cpp)
|
||||||
|
add_library(PHANTOMNODE OBJECT DataStructures/phantom_node.cpp)
|
||||||
|
|
||||||
set(ExtractorSources extractor.cpp ${ExtractorGlob})
|
set(ExtractorSources extractor.cpp ${ExtractorGlob})
|
||||||
add_executable(osrm-extract ${ExtractorSources} $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:IMPORT> $<TARGET_OBJECTS:LOGGER>)
|
add_executable(osrm-extract ${ExtractorSources} $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:IMPORT> $<TARGET_OBJECTS:LOGGER>)
|
||||||
@ -84,7 +85,7 @@ set(
|
|||||||
add_library(COORDINATE OBJECT ${CoordinateGlob})
|
add_library(COORDINATE OBJECT ${CoordinateGlob})
|
||||||
add_library(FINGERPRINT OBJECT Util/FingerPrint.cpp)
|
add_library(FINGERPRINT OBJECT Util/FingerPrint.cpp)
|
||||||
add_library(GITDESCRIPTION OBJECT Util/GitDescription.cpp)
|
add_library(GITDESCRIPTION OBJECT Util/GitDescription.cpp)
|
||||||
add_library(OSRM ${OSRMSources} $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:LOGGER>)
|
add_library(OSRM ${OSRMSources} $<TARGET_OBJECTS:GITDESCRIPTION> $<TARGET_OBJECTS:FINGERPRINT> $<TARGET_OBJECTS:COORDINATE> $<TARGET_OBJECTS:LOGGER> $<TARGET_OBJECTS:PHANTOMNODE>)
|
||||||
add_dependencies(FINGERPRINT FingerPrintConfigure)
|
add_dependencies(FINGERPRINT FingerPrintConfigure)
|
||||||
|
|
||||||
add_executable(osrm-routed routed.cpp ${ServerGlob})
|
add_executable(osrm-routed routed.cpp ${ServerGlob})
|
||||||
|
@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef RAW_ROUTE_DATA_H
|
#ifndef RAW_ROUTE_DATA_H
|
||||||
#define RAW_ROUTE_DATA_H
|
#define RAW_ROUTE_DATA_H
|
||||||
|
|
||||||
#include "../DataStructures/PhantomNodes.h"
|
#include "../DataStructures/phantom_node.hpp"
|
||||||
#include "../DataStructures/TravelMode.h"
|
#include "../DataStructures/TravelMode.h"
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
#include "../DataStructures/TurnInstructions.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "DeallocatingVector.h"
|
#include "DeallocatingVector.h"
|
||||||
#include "HilbertValue.h"
|
#include "HilbertValue.h"
|
||||||
#include "PhantomNodes.h"
|
#include "phantom_node.hpp"
|
||||||
#include "QueryNode.h"
|
#include "QueryNode.h"
|
||||||
#include "SharedMemoryFactory.h"
|
#include "SharedMemoryFactory.h"
|
||||||
#include "SharedMemoryVectorWrapper.h"
|
#include "SharedMemoryVectorWrapper.h"
|
||||||
|
119
DataStructures/phantom_node.cpp
Normal file
119
DataStructures/phantom_node.cpp
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "phantom_node.hpp"
|
||||||
|
|
||||||
|
PhantomNode::PhantomNode(NodeID forward_node_id, NodeID reverse_node_id, unsigned name_id,
|
||||||
|
int forward_weight, int reverse_weight, int forward_offset, int reverse_offset,
|
||||||
|
unsigned packed_geometry_id, FixedPointCoordinate &location,
|
||||||
|
unsigned short fwd_segment_position,
|
||||||
|
TravelMode forward_travel_mode, TravelMode backward_travel_mode) :
|
||||||
|
forward_node_id(forward_node_id),
|
||||||
|
reverse_node_id(reverse_node_id),
|
||||||
|
name_id(name_id),
|
||||||
|
forward_weight(forward_weight),
|
||||||
|
reverse_weight(reverse_weight),
|
||||||
|
forward_offset(forward_offset),
|
||||||
|
reverse_offset(reverse_offset),
|
||||||
|
packed_geometry_id(packed_geometry_id),
|
||||||
|
location(location),
|
||||||
|
fwd_segment_position(fwd_segment_position),
|
||||||
|
forward_travel_mode(forward_travel_mode),
|
||||||
|
backward_travel_mode(backward_travel_mode)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
PhantomNode::PhantomNode() :
|
||||||
|
forward_node_id(SPECIAL_NODEID),
|
||||||
|
reverse_node_id(SPECIAL_NODEID),
|
||||||
|
name_id(std::numeric_limits<unsigned>::max()),
|
||||||
|
forward_weight(INVALID_EDGE_WEIGHT),
|
||||||
|
reverse_weight(INVALID_EDGE_WEIGHT),
|
||||||
|
forward_offset(0),
|
||||||
|
reverse_offset(0),
|
||||||
|
packed_geometry_id(SPECIAL_EDGEID),
|
||||||
|
fwd_segment_position(0),
|
||||||
|
forward_travel_mode(TRAVEL_MODE_INACCESSIBLE),
|
||||||
|
backward_travel_mode(TRAVEL_MODE_INACCESSIBLE)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
int PhantomNode::GetForwardWeightPlusOffset() const
|
||||||
|
{
|
||||||
|
if (SPECIAL_NODEID == forward_node_id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const int result = (forward_offset + forward_weight);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PhantomNode::GetReverseWeightPlusOffset() const
|
||||||
|
{
|
||||||
|
if (SPECIAL_NODEID == reverse_node_id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const int result = (reverse_offset + reverse_weight);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PhantomNode::isBidirected() const
|
||||||
|
{
|
||||||
|
return (forward_node_id != SPECIAL_NODEID) &&
|
||||||
|
(reverse_node_id != SPECIAL_NODEID);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PhantomNode::IsCompressed() const
|
||||||
|
{
|
||||||
|
return (forward_offset != 0) || (reverse_offset != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PhantomNode::isValid(const unsigned numberOfNodes) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
location.isValid() &&
|
||||||
|
(
|
||||||
|
(forward_node_id < numberOfNodes) ||
|
||||||
|
(reverse_node_id < numberOfNodes)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
(forward_weight != INVALID_EDGE_WEIGHT) ||
|
||||||
|
(reverse_weight != INVALID_EDGE_WEIGHT)
|
||||||
|
) &&
|
||||||
|
(name_id != std::numeric_limits<unsigned>::max()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PhantomNode::isValid() const
|
||||||
|
{
|
||||||
|
return location.isValid() &&
|
||||||
|
(name_id != std::numeric_limits<unsigned>::max());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PhantomNode::operator==(const PhantomNode & other) const
|
||||||
|
{
|
||||||
|
return location == other.location;
|
||||||
|
}
|
@ -41,34 +41,9 @@ struct PhantomNode
|
|||||||
int forward_weight, int reverse_weight, int forward_offset, int reverse_offset,
|
int forward_weight, int reverse_weight, int forward_offset, int reverse_offset,
|
||||||
unsigned packed_geometry_id, FixedPointCoordinate &location,
|
unsigned packed_geometry_id, FixedPointCoordinate &location,
|
||||||
unsigned short fwd_segment_position,
|
unsigned short fwd_segment_position,
|
||||||
TravelMode forward_travel_mode, TravelMode backward_travel_mode) :
|
TravelMode forward_travel_mode, TravelMode backward_travel_mode);
|
||||||
forward_node_id(forward_node_id),
|
|
||||||
reverse_node_id(reverse_node_id),
|
|
||||||
name_id(name_id),
|
|
||||||
forward_weight(forward_weight),
|
|
||||||
reverse_weight(reverse_weight),
|
|
||||||
forward_offset(forward_offset),
|
|
||||||
reverse_offset(reverse_offset),
|
|
||||||
packed_geometry_id(packed_geometry_id),
|
|
||||||
location(location),
|
|
||||||
fwd_segment_position(fwd_segment_position),
|
|
||||||
forward_travel_mode(forward_travel_mode),
|
|
||||||
backward_travel_mode(backward_travel_mode)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
PhantomNode() :
|
PhantomNode();
|
||||||
forward_node_id(SPECIAL_NODEID),
|
|
||||||
reverse_node_id(SPECIAL_NODEID),
|
|
||||||
name_id(std::numeric_limits<unsigned>::max()),
|
|
||||||
forward_weight(INVALID_EDGE_WEIGHT),
|
|
||||||
reverse_weight(INVALID_EDGE_WEIGHT),
|
|
||||||
forward_offset(0),
|
|
||||||
reverse_offset(0),
|
|
||||||
packed_geometry_id(SPECIAL_EDGEID),
|
|
||||||
fwd_segment_position(0),
|
|
||||||
forward_travel_mode(TRAVEL_MODE_INACCESSIBLE),
|
|
||||||
backward_travel_mode(TRAVEL_MODE_INACCESSIBLE)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
NodeID forward_node_id;
|
NodeID forward_node_id;
|
||||||
NodeID reverse_node_id;
|
NodeID reverse_node_id;
|
||||||
@ -83,63 +58,19 @@ struct PhantomNode
|
|||||||
TravelMode forward_travel_mode : 4;
|
TravelMode forward_travel_mode : 4;
|
||||||
TravelMode backward_travel_mode : 4;
|
TravelMode backward_travel_mode : 4;
|
||||||
|
|
||||||
int GetForwardWeightPlusOffset() const
|
int GetForwardWeightPlusOffset() const;
|
||||||
{
|
|
||||||
if (SPECIAL_NODEID == forward_node_id)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const int result = (forward_offset + forward_weight);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetReverseWeightPlusOffset() const
|
int GetReverseWeightPlusOffset() const;
|
||||||
{
|
|
||||||
if (SPECIAL_NODEID == reverse_node_id)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const int result = (reverse_offset + reverse_weight);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isBidirected() const
|
bool isBidirected() const;
|
||||||
{
|
|
||||||
return (forward_node_id != SPECIAL_NODEID) &&
|
|
||||||
(reverse_node_id != SPECIAL_NODEID);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsCompressed() const
|
bool IsCompressed() const;
|
||||||
{
|
|
||||||
return (forward_offset != 0) || (reverse_offset != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isValid(const unsigned numberOfNodes) const
|
bool isValid(const unsigned numberOfNodes) const;
|
||||||
{
|
|
||||||
return
|
|
||||||
location.isValid() &&
|
|
||||||
(
|
|
||||||
(forward_node_id < numberOfNodes) ||
|
|
||||||
(reverse_node_id < numberOfNodes)
|
|
||||||
) &&
|
|
||||||
(
|
|
||||||
(forward_weight != INVALID_EDGE_WEIGHT) ||
|
|
||||||
(reverse_weight != INVALID_EDGE_WEIGHT)
|
|
||||||
) &&
|
|
||||||
(name_id != std::numeric_limits<unsigned>::max()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isValid() const
|
bool isValid() const;
|
||||||
{
|
|
||||||
return location.isValid() &&
|
|
||||||
(name_id != std::numeric_limits<unsigned>::max());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const PhantomNode & other) const
|
bool operator==(const PhantomNode & other) const;
|
||||||
{
|
|
||||||
return location == other.location;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using PhantomNodeArray = std::vector<std::vector<PhantomNode>>;
|
using PhantomNodeArray = std::vector<std::vector<PhantomNode>>;
|
@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef BASE_DESCRIPTOR_H
|
#ifndef BASE_DESCRIPTOR_H
|
||||||
#define BASE_DESCRIPTOR_H
|
#define BASE_DESCRIPTOR_H
|
||||||
|
|
||||||
#include "../DataStructures/PhantomNodes.h"
|
#include "../DataStructures/phantom_node.hpp"
|
||||||
#include "../DataStructures/RawRouteData.h"
|
#include "../DataStructures/RawRouteData.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
@ -44,14 +44,14 @@ struct DescriptorTable : public std::unordered_map<std::string, unsigned>
|
|||||||
unsigned get_id(const std::string &key)
|
unsigned get_id(const std::string &key)
|
||||||
{
|
{
|
||||||
auto iter = find(key);
|
auto iter = find(key);
|
||||||
if (iter != end())
|
if (iter != end())
|
||||||
{
|
{
|
||||||
return iter->second;
|
return iter->second;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct DescriptorConfig
|
struct DescriptorConfig
|
||||||
{
|
{
|
||||||
@ -60,9 +60,9 @@ struct DescriptorConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class OtherT>
|
template<class OtherT>
|
||||||
DescriptorConfig(const OtherT &other) : instructions(other.print_instructions),
|
DescriptorConfig(const OtherT &other) : instructions(other.print_instructions),
|
||||||
geometry(other.geometry),
|
geometry(other.geometry),
|
||||||
encode_geometry(other.compression),
|
encode_geometry(other.compression),
|
||||||
zoom_level(other.zoom_level) { }
|
zoom_level(other.zoom_level) { }
|
||||||
bool instructions;
|
bool instructions;
|
||||||
bool geometry;
|
bool geometry;
|
||||||
|
@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
#include "../Algorithms/PolylineCompressor.h"
|
#include "../Algorithms/PolylineCompressor.h"
|
||||||
#include "../DataStructures/PhantomNodes.h"
|
|
||||||
#include "../DataStructures/RawRouteData.h"
|
#include "../DataStructures/RawRouteData.h"
|
||||||
#include "../DataStructures/SegmentInformation.h"
|
#include "../DataStructures/SegmentInformation.h"
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
#include "../DataStructures/TurnInstructions.h"
|
||||||
|
@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "../Algorithms/DouglasPeucker.h"
|
#include "../Algorithms/DouglasPeucker.h"
|
||||||
#include "../Algorithms/PolylineCompressor.h"
|
#include "../Algorithms/PolylineCompressor.h"
|
||||||
#include "../DataStructures/PhantomNodes.h"
|
#include "../DataStructures/phantom_node.hpp"
|
||||||
#include "../DataStructures/SegmentInformation.h"
|
#include "../DataStructures/SegmentInformation.h"
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
#include "../DataStructures/TurnInstructions.h"
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
@ -77,8 +77,8 @@ class HelloWorldPlugin final : public BasePlugin
|
|||||||
JSON::Object json_location;
|
JSON::Object json_location;
|
||||||
JSON::Array json_coordinates;
|
JSON::Array json_coordinates;
|
||||||
|
|
||||||
json_coordinates.values.push_back(coordinate.lat / COORDINATE_PRECISION);
|
json_coordinates.values.push_back(static_cast<double>(coordinate.lat / COORDINATE_PRECISION));
|
||||||
json_coordinates.values.push_back(coordinate.lon / COORDINATE_PRECISION);
|
json_coordinates.values.push_back(static_cast<double>(coordinate.lon / COORDINATE_PRECISION));
|
||||||
json_location.values[cast::integral_to_string(counter)] = json_coordinates;
|
json_location.values[cast::integral_to_string(counter)] = json_coordinates;
|
||||||
json_locations.values.push_back(json_location);
|
json_locations.values.push_back(json_location);
|
||||||
++counter;
|
++counter;
|
||||||
|
@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "BasePlugin.h"
|
#include "BasePlugin.h"
|
||||||
#include "../DataStructures/JSONContainer.h"
|
#include "../DataStructures/JSONContainer.h"
|
||||||
#include "../DataStructures/PhantomNodes.h"
|
#include "../DataStructures/phantom_node.hpp"
|
||||||
#include "../DataStructures/Range.h"
|
#include "../DataStructures/Range.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#include "../../DataStructures/EdgeBasedNode.h"
|
#include "../../DataStructures/EdgeBasedNode.h"
|
||||||
#include "../../DataStructures/ImportNode.h"
|
#include "../../DataStructures/ImportNode.h"
|
||||||
#include "../../DataStructures/PhantomNodes.h"
|
#include "../../DataStructures/phantom_node.hpp"
|
||||||
#include "../../DataStructures/Range.h"
|
#include "../../DataStructures/Range.h"
|
||||||
#include "../../DataStructures/TurnInstructions.h"
|
#include "../../DataStructures/TurnInstructions.h"
|
||||||
#include "../../Util/OSRMException.h"
|
#include "../../Util/OSRMException.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user