forked from organicmaps/organicmaps
tmp
This commit is contained in:
parent
47618745db
commit
7d470dd1a3
27 changed files with 153 additions and 161 deletions
|
@ -32,3 +32,4 @@ List of changes made to original code:
|
|||
- Added namespace divsuf.
|
||||
- Added divsufsort_with_empty().
|
||||
- Added unit tests.
|
||||
- Patch to avoid int/uint comparison warnings.
|
||||
|
|
|
@ -57,8 +57,8 @@ sort_typeBstar(const sauchar_t *T, saidx_it SA,
|
|||
saint_t c0, c1;
|
||||
|
||||
/* Initialize bucket arrays. */
|
||||
for(i = 0; i < BUCKET_A_SIZE; ++i) { bucket_A[i] = 0; }
|
||||
for(i = 0; i < BUCKET_B_SIZE; ++i) { bucket_B[i] = 0; }
|
||||
for(i = 0; i < static_cast<saidx_t>(BUCKET_A_SIZE); ++i) { bucket_A[i] = 0; }
|
||||
for(i = 0; i < static_cast<saidx_t>(BUCKET_B_SIZE); ++i) { bucket_B[i] = 0; }
|
||||
|
||||
/* Count the number of occurrences of the first one or two characters of each
|
||||
type A, B and B* suffix. Moreover, store the beginning position of all
|
||||
|
@ -84,11 +84,11 @@ note:
|
|||
*/
|
||||
|
||||
/* Calculate the index of start/end point of each bucket. */
|
||||
for(c0 = 0, i = 0, j = 0; c0 < ALPHABET_SIZE; ++c0) {
|
||||
for(c0 = 0, i = 0, j = 0; c0 < static_cast<saint_t>(ALPHABET_SIZE); ++c0) {
|
||||
t = i + BUCKET_A(c0);
|
||||
BUCKET_A(c0) = i + j; /* start point */
|
||||
i = t + BUCKET_B(c0, c0);
|
||||
for(c1 = c0 + 1; c1 < ALPHABET_SIZE; ++c1) {
|
||||
for(c1 = c0 + 1; c1 < static_cast<saint_t>(ALPHABET_SIZE); ++c1) {
|
||||
j += BUCKET_BSTAR(c0, c1);
|
||||
BUCKET_BSTAR(c0, c1) = j; /* end point */
|
||||
i += BUCKET_B(c0, c1);
|
||||
|
@ -178,10 +178,9 @@ construct_SA(const sauchar_t *T, saidx_it SA,
|
|||
the sorted order of type B* suffixes. */
|
||||
for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) {
|
||||
/* Scan the suffix array from right to left. */
|
||||
for(i = SA + BUCKET_BSTAR(c1, c1 + 1),
|
||||
j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1;
|
||||
i <= j;
|
||||
--j) {
|
||||
for (i = SA + BUCKET_BSTAR(c1, c1 + 1), j = SA + BUCKET_A(c1 + 1) - 1,
|
||||
k = nullptr, c2 = -1;
|
||||
i <= j; --j) {
|
||||
if(0 < (s = *j)) {
|
||||
assert(T[s] == c1);
|
||||
assert(((s + 1) < n) && (T[s] <= T[s + 1]));
|
||||
|
@ -239,16 +238,24 @@ divsufsort(const sauchar_t *T, saidx_it SA, saidx_t n) {
|
|||
saint_t err = 0;
|
||||
|
||||
/* Check arguments. */
|
||||
if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; }
|
||||
else if(n == 0) { return 0; }
|
||||
else if(n == 1) { SA[0] = 0; return 0; }
|
||||
else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; }
|
||||
if ((T == nullptr) || (SA == nullptr) || (n < 0)) {
|
||||
return -1;
|
||||
} else if (n == 0) {
|
||||
return 0;
|
||||
} else if (n == 1) {
|
||||
SA[0] = 0;
|
||||
return 0;
|
||||
} else if (n == 2) {
|
||||
m = (T[0] < T[1]);
|
||||
SA[m ^ 1] = 0, SA[m] = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t));
|
||||
bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t));
|
||||
|
||||
/* Suffixsort. */
|
||||
if((bucket_A != NULL) && (bucket_B != NULL)) {
|
||||
if ((bucket_A != nullptr) && (bucket_B != nullptr)) {
|
||||
m = sort_typeBstar(T, SA, bucket_A, bucket_B, n);
|
||||
construct_SA(T, SA, bucket_A, bucket_B, n, m);
|
||||
} else {
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace {
|
|||
|
||||
/*- Private Functions -*/
|
||||
|
||||
const saint_t lg_table[256]= {
|
||||
const saint_t lg_table_[256]= {
|
||||
-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
|
||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
|
||||
|
@ -67,11 +67,11 @@ saint_t
|
|||
tr_ilg(saidx_t n) {
|
||||
return (n & 0xffff0000) ?
|
||||
((n & 0xff000000) ?
|
||||
24 + lg_table[(n >> 24) & 0xff] :
|
||||
16 + lg_table[(n >> 16) & 0xff]) :
|
||||
24 + lg_table_[(n >> 24) & 0xff] :
|
||||
16 + lg_table_[(n >> 16) & 0xff]) :
|
||||
((n & 0x0000ff00) ?
|
||||
8 + lg_table[(n >> 8) & 0xff] :
|
||||
0 + lg_table[(n >> 0) & 0xff]);
|
||||
8 + lg_table_[(n >> 8) & 0xff] :
|
||||
0 + lg_table_[(n >> 0) & 0xff]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -352,7 +352,7 @@ tr_introsort(saidx_it ISA, const_saidx_it ISAd,
|
|||
|
||||
/* push */
|
||||
if(1 < (b - a)) {
|
||||
STACK_PUSH5(NULL, a, b, 0, 0);
|
||||
STACK_PUSH5(nullptr, a, b, 0, 0);
|
||||
STACK_PUSH5(ISAd - incr, first, last, -2, trlink);
|
||||
trlink = ssize - 2;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
project(icu)
|
||||
|
||||
# set(CMAKE_PREFIX_PATH ./)
|
||||
|
||||
set(SRC
|
||||
uconfig_local.h
|
||||
icu/icu4c/source/common/appendable.cpp
|
||||
|
@ -131,3 +129,5 @@ target_include_directories(${PROJECT_NAME}
|
|||
icu/icu4c/source/common
|
||||
icu/icu4c/source/i18n
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD OFF)
|
||||
|
|
|
@ -8,6 +8,10 @@ set(CMAKE_C_STANDARD 11)
|
|||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
|
||||
set(CMAKE_UNITY_BUILD ON)
|
||||
set(CMAKE_UNITY_BUILD_BATCH_SIZE 50)
|
||||
|
||||
|
||||
if(NOT (DEFINED ENV{COLORS_DISABLE}) AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
message(STATUS "export COLORS_DISABLE=1 to disable colored compiler output.")
|
||||
add_compile_options($<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always> $<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics>)
|
||||
|
|
|
@ -79,13 +79,10 @@ using platform::ToNativeNetworkPolicy;
|
|||
|
||||
static_assert(sizeof(int) >= 4, "Size of jint in less than 4 bytes.");
|
||||
|
||||
::Framework * frm() { return g_framework->NativeFramework(); }
|
||||
|
||||
namespace
|
||||
{
|
||||
::Framework * frm()
|
||||
{
|
||||
return g_framework->NativeFramework();
|
||||
}
|
||||
|
||||
jobject g_placePageActivationListener = nullptr;
|
||||
|
||||
android::AndroidVulkanContextFactory * CastFactory(drape_ptr<dp::GraphicsContextFactory> const & f)
|
||||
|
|
|
@ -199,3 +199,4 @@ namespace android
|
|||
}
|
||||
|
||||
extern std::unique_ptr<android::Framework> g_framework;
|
||||
::Framework * frm();
|
||||
|
|
|
@ -51,9 +51,9 @@ struct TBatchedData
|
|||
{}
|
||||
};
|
||||
|
||||
jmethodID g_listAddMethod;
|
||||
jclass g_countryItemClass;
|
||||
jobject g_countryChangedListener;
|
||||
jmethodID g_listAddMethod = nullptr;
|
||||
jclass g_countryItemClass = nullptr;
|
||||
jobject g_countryChangedListener = nullptr;
|
||||
|
||||
DECLARE_THREAD_CHECKER(g_batchingThreadChecker);
|
||||
std::unordered_map<jobject, std::vector<TBatchedData>> g_batchedCallbackData;
|
||||
|
@ -61,11 +61,11 @@ bool g_isBatched;
|
|||
|
||||
Storage & GetStorage()
|
||||
{
|
||||
CHECK(g_framework != nullptr, ());
|
||||
ASSERT(g_framework != nullptr, ());
|
||||
return g_framework->GetStorage();
|
||||
}
|
||||
|
||||
void PrepareClassRefs(JNIEnv * env)
|
||||
void CacheListClassRefs(JNIEnv * env)
|
||||
{
|
||||
if (g_listAddMethod)
|
||||
return;
|
||||
|
@ -268,7 +268,7 @@ static void PutItemsToList(
|
|||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_downloader_MapManager_nativeListItems(JNIEnv * env, jclass clazz, jstring parent, jdouble lat, jdouble lon, jboolean hasLocation, jboolean myMapsMode, jobject result)
|
||||
{
|
||||
PrepareClassRefs(env);
|
||||
CacheListClassRefs(env);
|
||||
|
||||
if (hasLocation && !myMapsMode)
|
||||
{
|
||||
|
@ -291,9 +291,9 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeListItems(JNIEnv * env, jcl
|
|||
|
||||
// static void nativeUpdateItem(CountryItem item);
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_downloader_MapManager_nativeGetAttributes(JNIEnv * env, jclass clazz, jobject item)
|
||||
Java_com_mapswithme_maps_downloader_MapManager_nativeGetAttributes(JNIEnv * env, jclass, jobject item)
|
||||
{
|
||||
PrepareClassRefs(env);
|
||||
CacheListClassRefs(env);
|
||||
|
||||
static jfieldID countryItemFieldId = env->GetFieldID(g_countryItemClass, "id", "Ljava/lang/String;");
|
||||
jstring id = static_cast<jstring>(env->GetObjectField(item, countryItemFieldId));
|
||||
|
@ -462,7 +462,7 @@ static void ProgressChangedCallback(std::shared_ptr<jobject> const & listenerRef
|
|||
JNIEXPORT jint JNICALL
|
||||
Java_com_mapswithme_maps_downloader_MapManager_nativeSubscribe(JNIEnv * env, jclass clazz, jobject listener)
|
||||
{
|
||||
PrepareClassRefs(env);
|
||||
CacheListClassRefs(env);
|
||||
return GetStorage().Subscribe(std::bind(&StatusChangedCallback, jni::make_global_ref(listener), _1),
|
||||
std::bind(&ProgressChangedCallback, jni::make_global_ref(listener), _1, _2));
|
||||
}
|
||||
|
|
|
@ -4,16 +4,6 @@
|
|||
|
||||
#include <chrono>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
::Framework * frm()
|
||||
{
|
||||
return (g_framework ? g_framework->NativeFramework() : nullptr);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
{
|
||||
JNIEXPORT void JNICALL
|
||||
|
|
|
@ -21,8 +21,6 @@ using namespace std::placeholders;
|
|||
|
||||
namespace
|
||||
{
|
||||
::Framework * frm() { return g_framework->NativeFramework(); }
|
||||
|
||||
jclass g_bookmarkManagerClass;
|
||||
jfieldID g_bookmarkManagerInstanceField;
|
||||
jmethodID g_onBookmarksChangedMethod;
|
||||
|
|
|
@ -2,12 +2,6 @@
|
|||
|
||||
#include "com/mapswithme/core/jni_helper.hpp"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
::Framework * frm() { return g_framework->NativeFramework(); }
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
{
|
||||
JNIEXPORT void JNICALL
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
#include "com/mapswithme/maps/Framework.hpp"
|
||||
#include "platform/settings.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
::Framework * frm() { return g_framework->NativeFramework(); }
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
JNIEXPORT jboolean JNICALL
|
||||
|
|
|
@ -71,8 +71,8 @@ endfunction()
|
|||
|
||||
function(omim_add_library library)
|
||||
add_library(${library} ${ARGN})
|
||||
set_target_properties(${library} PROPERTIES UNITY_BUILD ON)
|
||||
set_target_properties(${library} PROPERTIES UNITY_BUILD_BATCH_SIZE 50)
|
||||
# set_target_properties(${library} PROPERTIES UNITY_BUILD ON)
|
||||
# set_target_properties(${library} PROPERTIES UNITY_BUILD_BATCH_SIZE 50)
|
||||
add_dependencies(${library} BuildVersion)
|
||||
# Enable warnings for all our libraries.
|
||||
target_compile_options(${library} PRIVATE ${OMIM_WARNING_FLAGS})
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
|
||||
namespace df
|
||||
{
|
||||
namespace arrow3d {
|
||||
double constexpr kArrowSize = 12.0;
|
||||
double constexpr kArrow3dScaleMin = 1.0;
|
||||
double constexpr kArrow3dScaleMax = 2.2;
|
||||
int constexpr kArrow3dMinZoom = 16;
|
||||
} // namespace arrow3d
|
||||
|
||||
float constexpr kOutlineScale = 1.2f;
|
||||
|
||||
|
@ -40,12 +42,12 @@ Arrow3d::Arrow3d(ref_ptr<dp::GraphicsContext> context)
|
|||
0.0f, 0.0f, -1.0f, 1.0f, 0.0f, 2.0f, 0.0f, 1.0f, 1.2f, -1.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, -1.0f, 1.0f, 0.0f, -0.5f, 0.0f, 1.0f, -1.2f, -1.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, -1.0f, 1.0f, 1.2f, -1.0f, 0.0f, 1.0f, 0.0f, -0.5f, 0.0f, 1.0f,
|
||||
|
||||
|
||||
0.0f, 2.27f, 0.0f, 0.0f, 1.4f, -1.17f, 0.0f, 0.0f, 0.0f, 2.0f, 0.0f, 1.0f,
|
||||
0.0f, 2.0f, 0.0f, 1.0f, 1.4f, -1.17f, 0.0f, 0.0f, 1.2f, -1.0f, 0.0f, 1.0f,
|
||||
0.0f, 2.27f, 0.0f, 0.0f, 0.0f, 2.0f, 0.0f, 1.0f, -1.4f, -1.17f, 0.0f, 0.0f,
|
||||
0.0f, 2.0f, 0.0f, 1.0f, -1.2f, -1.0f, 0.0f, 1.0f, -1.4f, -1.17f, 0.0f, 0.0f,
|
||||
|
||||
|
||||
1.2f, -1.0f, 0.0f, 1.0f, 1.4f, -1.17f, 0.0f, 0.0f, 0.0f, -0.67f, 0.0f, 0.0f,
|
||||
0.0f, -0.5f, 0.0f, 1.0f, 1.2f, -1.0f, 0.0f, 1.0f, 0.0f, -0.67f, 0.0f, 0.0f,
|
||||
-1.2f, -1.0f, 0.0f, 1.0f, 0.0f, -0.67f, 0.0f, 0.0f, -1.4f, -1.17f, 0.0f, 0.0f,
|
||||
|
@ -74,7 +76,7 @@ Arrow3d::Arrow3d(ref_ptr<dp::GraphicsContext> context)
|
|||
double Arrow3d::GetMaxBottomSize()
|
||||
{
|
||||
double const kBottomSize = 1.0;
|
||||
return kBottomSize * kArrowSize * kArrow3dScaleMax * kOutlineScale;
|
||||
return kBottomSize * arrow3d::kArrowSize * arrow3d::kArrow3dScaleMax * kOutlineScale;
|
||||
}
|
||||
|
||||
void Arrow3d::SetPosition(const m2::PointD & position)
|
||||
|
@ -140,11 +142,11 @@ void Arrow3d::RenderArrow(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::Pro
|
|||
math::Matrix<float, 4, 4> Arrow3d::CalculateTransform(ScreenBase const & screen, float dz,
|
||||
float scaleFactor, dp::ApiVersion apiVersion) const
|
||||
{
|
||||
double arrowScale = VisualParams::Instance().GetVisualScale() * kArrowSize * scaleFactor;
|
||||
double arrowScale = VisualParams::Instance().GetVisualScale() * arrow3d::kArrowSize * scaleFactor;
|
||||
if (screen.isPerspective())
|
||||
{
|
||||
double const t = GetNormalizedZoomLevel(screen.GetScale(), kArrow3dMinZoom);
|
||||
arrowScale *= (kArrow3dScaleMin * (1.0 - t) + kArrow3dScaleMax * t);
|
||||
double const t = GetNormalizedZoomLevel(screen.GetScale(), arrow3d::kArrow3dMinZoom);
|
||||
arrowScale *= (arrow3d::kArrow3dScaleMin * (1.0 - t) + arrow3d::kArrow3dScaleMax * t);
|
||||
}
|
||||
|
||||
auto const scaleX = static_cast<float>(arrowScale * 2.0 / screen.PixelRect().SizeX());
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace df
|
||||
{
|
||||
namespace
|
||||
namespace mp
|
||||
{
|
||||
df::ColorConstant const kMyPositionAccuracyColor = "MyPositionAccuracy";
|
||||
|
||||
|
@ -52,7 +52,7 @@ dp::BindingInfo GetMarkerBindingInfo()
|
|||
|
||||
return info;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace mp
|
||||
|
||||
MyPosition::MyPosition(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> mng)
|
||||
: m_position(m2::PointF::Zero())
|
||||
|
@ -159,10 +159,10 @@ void MyPosition::CacheAccuracySector(ref_ptr<dp::GraphicsContext> context,
|
|||
auto const etalonSector = static_cast<float>(2.0 * math::pi / kTriangleCount);
|
||||
|
||||
dp::TextureManager::ColorRegion color;
|
||||
mng->GetColorRegion(df::GetColorConstant(df::kMyPositionAccuracyColor), color);
|
||||
mng->GetColorRegion(df::GetColorConstant(mp::kMyPositionAccuracyColor), color);
|
||||
glsl::vec2 colorCoord = glsl::ToVec2(color.GetTexRect().Center());
|
||||
|
||||
buffer_vector<MarkerVertex, kTriangleCount> buffer;
|
||||
buffer_vector<mp::MarkerVertex, kTriangleCount> buffer;
|
||||
glsl::vec2 startNormal(0.0f, 1.0f);
|
||||
|
||||
for (size_t i = 0; i < kTriangleCount + 1; ++i)
|
||||
|
@ -193,7 +193,7 @@ void MyPosition::CacheAccuracySector(ref_ptr<dp::GraphicsContext> context,
|
|||
});
|
||||
|
||||
dp::AttributeProvider provider(1 /* stream count */, kVertexCount);
|
||||
provider.InitStream(0 /* stream index */, GetMarkerBindingInfo(), make_ref(buffer.data()));
|
||||
provider.InitStream(0 /* stream index */, mp::GetMarkerBindingInfo(), make_ref(buffer.data()));
|
||||
|
||||
m_parts[MyPositionAccuracy].first = batcher.InsertTriangleList(context, state,
|
||||
make_ref(&provider), nullptr);
|
||||
|
@ -209,7 +209,7 @@ void MyPosition::CacheSymbol(ref_ptr<dp::GraphicsContext> context,
|
|||
m2::RectF const & texRect = symbol.GetTexRect();
|
||||
m2::PointF const halfSize = symbol.GetPixelSize() * 0.5f;
|
||||
|
||||
MarkerVertex data[4] =
|
||||
mp::MarkerVertex data[4] =
|
||||
{
|
||||
{ glsl::vec2(-halfSize.x, halfSize.y), glsl::ToVec2(texRect.LeftTop()) },
|
||||
{ glsl::vec2(-halfSize.x, -halfSize.y), glsl::ToVec2(texRect.LeftBottom()) },
|
||||
|
@ -218,7 +218,7 @@ void MyPosition::CacheSymbol(ref_ptr<dp::GraphicsContext> context,
|
|||
};
|
||||
|
||||
dp::AttributeProvider provider(1 /* streamCount */, dp::Batcher::VertexPerQuad);
|
||||
provider.InitStream(0 /* streamIndex */, GetMarkerBindingInfo(), make_ref(data));
|
||||
provider.InitStream(0 /* streamIndex */, mp::GetMarkerBindingInfo(), make_ref(data));
|
||||
m_parts[part].first = batcher.InsertTriangleStrip(context, state, make_ref(&provider), nullptr);
|
||||
ASSERT(m_parts[part].first.IsValid(), ());
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ std::array<float, 20> const kRouteHalfWidthInPixelOthers =
|
|||
1.5f, 1.7f, 2.3f, 2.7f, 3.5, 4.5f, 5.0f, 7.0f, 11.0f, 13.0f
|
||||
};
|
||||
|
||||
namespace
|
||||
namespace rs
|
||||
{
|
||||
float const kLeftSide = 1.0f;
|
||||
float const kCenter = 0.0f;
|
||||
|
@ -166,7 +166,7 @@ glsl::vec3 MarkerNormal(float x, float y, float z, float cosAngle, float sinAngl
|
|||
{
|
||||
return glsl::vec3(x * cosAngle - y * sinAngle, x * sinAngle + y * cosAngle, z);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace rs
|
||||
|
||||
void Subroute::AddStyle(SubrouteStyle const & style)
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ void RouteShape::PrepareGeometry(std::vector<m2::PointD> const & path, m2::Point
|
|||
double constexpr kMinExtent = mercator::Bounds::kRangeX / (1 << 10);
|
||||
|
||||
float depth = baseDepth;
|
||||
float const depthStep = kRouteDepth / (1 + segments.size());
|
||||
float const depthStep = rs::kRouteDepth / (1 + segments.size());
|
||||
for (auto i = static_cast<int>(segments.size() - 1); i >= 0; i--)
|
||||
{
|
||||
auto & geomBufferData = geometryBufferData.back();
|
||||
|
@ -240,22 +240,22 @@ void RouteShape::PrepareGeometry(std::vector<m2::PointD> const & path, m2::Point
|
|||
float const projRightEnd = segments[i].m_rightWidthScalar[EndPoint].y;
|
||||
|
||||
geometry.emplace_back(startPivot, glsl::vec2(0, 0),
|
||||
glsl::vec3(startLength, 0, kCenter), segments[i].m_color);
|
||||
glsl::vec3(startLength, 0, rs::kCenter), segments[i].m_color);
|
||||
geometry.emplace_back(startPivot, leftNormalStart,
|
||||
glsl::vec3(startLength, projLeftStart, kLeftSide), segments[i].m_color);
|
||||
glsl::vec3(startLength, projLeftStart, rs::kLeftSide), segments[i].m_color);
|
||||
geometry.emplace_back(endPivot, glsl::vec2(0, 0),
|
||||
glsl::vec3(length, 0, kCenter), segments[i].m_color);
|
||||
glsl::vec3(length, 0, rs::kCenter), segments[i].m_color);
|
||||
geometry.emplace_back(endPivot, leftNormalEnd,
|
||||
glsl::vec3(length, projLeftEnd, kLeftSide), segments[i].m_color);
|
||||
glsl::vec3(length, projLeftEnd, rs::kLeftSide), segments[i].m_color);
|
||||
|
||||
geometry.emplace_back(startPivot, rightNormalStart,
|
||||
glsl::vec3(startLength, projRightStart, kRightSide), segments[i].m_color);
|
||||
glsl::vec3(startLength, projRightStart, rs::kRightSide), segments[i].m_color);
|
||||
geometry.emplace_back(startPivot, glsl::vec2(0, 0),
|
||||
glsl::vec3(startLength, 0, kCenter), segments[i].m_color);
|
||||
glsl::vec3(startLength, 0, rs::kCenter), segments[i].m_color);
|
||||
geometry.emplace_back(endPivot, rightNormalEnd,
|
||||
glsl::vec3(length, projRightEnd, kRightSide), segments[i].m_color);
|
||||
glsl::vec3(length, projRightEnd, rs::kRightSide), segments[i].m_color);
|
||||
geometry.emplace_back(endPivot, glsl::vec2(0, 0),
|
||||
glsl::vec3(length, 0, kCenter), segments[i].m_color);
|
||||
glsl::vec3(length, 0, rs::kCenter), segments[i].m_color);
|
||||
|
||||
auto & joinsGeometry = geomBufferData.m_joinsGeometry;
|
||||
|
||||
|
@ -275,8 +275,8 @@ void RouteShape::PrepareGeometry(std::vector<m2::PointD> const & path, m2::Point
|
|||
GenerateJoinNormals(dp::RoundJoin, n1, n2, 1.0f, segments[i].m_hasLeftJoin[EndPoint],
|
||||
widthScalar, normals);
|
||||
|
||||
GenerateJoinsTriangles(endPivot, normals, segments[i].m_color, glsl::vec2(length, 0),
|
||||
segments[i].m_hasLeftJoin[EndPoint], joinsGeometry);
|
||||
rs::GenerateJoinsTriangles(endPivot, normals, segments[i].m_color, glsl::vec2(length, 0),
|
||||
segments[i].m_hasLeftJoin[EndPoint], joinsGeometry);
|
||||
}
|
||||
|
||||
// Generate caps.
|
||||
|
@ -288,8 +288,8 @@ void RouteShape::PrepareGeometry(std::vector<m2::PointD> const & path, m2::Point
|
|||
segments[i].m_rightNormals[StartPoint], -segments[i].m_tangent,
|
||||
1.0f, true /* isStart */, normals);
|
||||
|
||||
GenerateJoinsTriangles(startPivot, normals, segments[i].m_color, glsl::vec2(startLength, 0),
|
||||
true, joinsGeometry);
|
||||
rs::GenerateJoinsTriangles(startPivot, normals, segments[i].m_color, glsl::vec2(startLength, 0),
|
||||
true, joinsGeometry);
|
||||
}
|
||||
|
||||
if (i == static_cast<int>(segments.size()) - 1)
|
||||
|
@ -300,8 +300,8 @@ void RouteShape::PrepareGeometry(std::vector<m2::PointD> const & path, m2::Point
|
|||
segments[i].m_rightNormals[EndPoint], segments[i].m_tangent,
|
||||
1.0f, false /* isStart */, normals);
|
||||
|
||||
GenerateJoinsTriangles(endPivot, normals, segments[i].m_color, glsl::vec2(length, 0),
|
||||
true, joinsGeometry);
|
||||
rs::GenerateJoinsTriangles(endPivot, normals, segments[i].m_color, glsl::vec2(length, 0),
|
||||
true, joinsGeometry);
|
||||
}
|
||||
|
||||
auto const verticesCount = geomBufferData.m_geometry.size() + geomBufferData.m_joinsGeometry.size();
|
||||
|
@ -355,9 +355,9 @@ void RouteShape::PrepareArrowGeometry(std::vector<m2::PointD> const & path, m2::
|
|||
glsl::vec2 const leftNormalEnd = GetNormal(segments[i], true /* isLeft */, EndNormal);
|
||||
glsl::vec2 const rightNormalEnd = GetNormal(segments[i], false /* isLeft */, EndNormal);
|
||||
|
||||
glsl::vec2 const uvCenter = GetUV(tr, 0.5f, 0.5f);
|
||||
glsl::vec2 const uvLeft = GetUV(tr, 0.5f, 0.0f);
|
||||
glsl::vec2 const uvRight = GetUV(tr, 0.5f, 1.0f);
|
||||
glsl::vec2 const uvCenter = rs::GetUV(tr, 0.5f, 0.5f);
|
||||
glsl::vec2 const uvLeft = rs::GetUV(tr, 0.5f, 0.0f);
|
||||
glsl::vec2 const uvRight = rs::GetUV(tr, 0.5f, 1.0f);
|
||||
|
||||
geometry.emplace_back(startPivot, glsl::vec2(0, 0), uvCenter);
|
||||
geometry.emplace_back(startPivot, leftNormalStart, uvLeft);
|
||||
|
@ -393,7 +393,7 @@ void RouteShape::PrepareArrowGeometry(std::vector<m2::PointD> const & path, m2::
|
|||
|
||||
ASSERT_EQUAL(normals.size(), uv.size(), ());
|
||||
|
||||
GenerateArrowsTriangles(endPivot, normals, tr, uv, true /* normalizedUV */, joinsGeometry);
|
||||
rs::GenerateArrowsTriangles(endPivot, normals, tr, uv, true /* normalizedUV */, joinsGeometry);
|
||||
}
|
||||
|
||||
// Generate arrow head.
|
||||
|
@ -409,7 +409,7 @@ void RouteShape::PrepareArrowGeometry(std::vector<m2::PointD> const & path, m2::
|
|||
std::vector<glsl::vec2> uv = { glsl::vec2(u, 1.0f), glsl::vec2(u, 0.0f), glsl::vec2(1.0f, 0.5f) };
|
||||
glsl::vec4 const headPivot = glsl::vec4(glsl::ToVec2(endPt), depth, 1.0);
|
||||
depth += depthInc;
|
||||
GenerateArrowsTriangles(headPivot, normals, texRect, uv, true /* normalizedUV */, joinsGeometry);
|
||||
rs::GenerateArrowsTriangles(headPivot, normals, texRect, uv, true /* normalizedUV */, joinsGeometry);
|
||||
}
|
||||
|
||||
// Generate arrow tail.
|
||||
|
@ -433,7 +433,7 @@ void RouteShape::PrepareArrowGeometry(std::vector<m2::PointD> const & path, m2::
|
|||
glsl::ToVec2(t.LeftTop())
|
||||
};
|
||||
|
||||
GenerateArrowsTriangles(startPivot, normals, texRect, uv, false /* normalizedUV */, joinsGeometry);
|
||||
rs::GenerateArrowsTriangles(startPivot, normals, texRect, uv, false /* normalizedUV */, joinsGeometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -490,13 +490,13 @@ void RouteShape::PrepareMarkersGeometry(std::vector<SubrouteMarker> const & mark
|
|||
auto const sinAngle = static_cast<float>(m2::CrossProduct(marker.m_up, m2::PointD(0.0, 1.0)));
|
||||
|
||||
// Here we use a right triangle to render half-circle.
|
||||
geometry.emplace_back(outerPos, MarkerNormal(-kSqrt2, 0.0f, outerRadius, cosAngle, sinAngle), c1);
|
||||
geometry.emplace_back(outerPos, MarkerNormal(0.0f, -kSqrt2, outerRadius, cosAngle, sinAngle), c1);
|
||||
geometry.emplace_back(outerPos, MarkerNormal(0.0f, kSqrt2, outerRadius, cosAngle, sinAngle), c1);
|
||||
geometry.emplace_back(outerPos, rs::MarkerNormal(-kSqrt2, 0.0f, outerRadius, cosAngle, sinAngle), c1);
|
||||
geometry.emplace_back(outerPos, rs::MarkerNormal(0.0f, -kSqrt2, outerRadius, cosAngle, sinAngle), c1);
|
||||
geometry.emplace_back(outerPos, rs::MarkerNormal(0.0f, kSqrt2, outerRadius, cosAngle, sinAngle), c1);
|
||||
|
||||
geometry.emplace_back(outerPos, MarkerNormal(kSqrt2, 0.0f, outerRadius, cosAngle, sinAngle), c2);
|
||||
geometry.emplace_back(outerPos, MarkerNormal(0.0f, kSqrt2, outerRadius, cosAngle, sinAngle), c2);
|
||||
geometry.emplace_back(outerPos, MarkerNormal(0.0f, -kSqrt2, outerRadius, cosAngle, sinAngle), c2);
|
||||
geometry.emplace_back(outerPos, rs::MarkerNormal(kSqrt2, 0.0f, outerRadius, cosAngle, sinAngle), c2);
|
||||
geometry.emplace_back(outerPos, rs::MarkerNormal(0.0f, kSqrt2, outerRadius, cosAngle, sinAngle), c2);
|
||||
geometry.emplace_back(outerPos, rs::MarkerNormal(0.0f, -kSqrt2, outerRadius, cosAngle, sinAngle), c2);
|
||||
}
|
||||
|
||||
if (marker.m_colors.size() > 1 || marker.m_colors.front() != marker.m_innerColor)
|
||||
|
@ -519,18 +519,18 @@ void RouteShape::CacheRouteArrows(ref_ptr<dp::GraphicsContext> context,
|
|||
{
|
||||
GeometryBufferData<ArrowGeometryBuffer> geometryData;
|
||||
dp::TextureManager::SymbolRegion region;
|
||||
GetArrowTextureRegion(mng, region);
|
||||
rs::GetArrowTextureRegion(mng, region);
|
||||
auto state = CreateRenderState(gpu::Program::RouteArrow, DepthLayer::GeometryLayer);
|
||||
state.SetColorTexture(region.GetTexture());
|
||||
state.SetTextureIndex(region.GetTextureIndex());
|
||||
|
||||
// Generate arrow geometry.
|
||||
auto depth = static_cast<float>(baseDepthIndex * kDepthPerSubroute) + kArrowsDepth;
|
||||
float const depthStep = (kArrowsDepth - kRouteDepth) / (1 + borders.size());
|
||||
auto depth = static_cast<float>(baseDepthIndex * rs::kDepthPerSubroute) + rs::kArrowsDepth;
|
||||
float const depthStep = (rs::kArrowsDepth - rs::kRouteDepth) / (1 + borders.size());
|
||||
for (ArrowBorders const & b : borders)
|
||||
{
|
||||
depth -= depthStep;
|
||||
std::vector<m2::PointD> points = CalculatePoints(polyline, b.m_startDistance, b.m_endDistance);
|
||||
std::vector<m2::PointD> points = rs::CalculatePoints(polyline, b.m_startDistance, b.m_endDistance);
|
||||
ASSERT_LESS_OR_EQUAL(points.size(), polyline.GetSize(), ());
|
||||
PrepareArrowGeometry(points, routeArrowsData.m_pivot, region.GetTexRect(), depthStep,
|
||||
depth, geometryData);
|
||||
|
@ -600,7 +600,7 @@ drape_ptr<df::SubrouteData> RouteShape::CacheRoute(ref_ptr<dp::GraphicsContext>
|
|||
|
||||
std::vector<GeometryBufferData<GeometryBuffer>> geometryBufferData;
|
||||
PrepareGeometry(points, subrouteData->m_pivot, segmentsColors,
|
||||
static_cast<float>(subroute->m_baseDepthIndex * kDepthPerSubroute),
|
||||
static_cast<float>(subroute->m_baseDepthIndex * rs::kDepthPerSubroute),
|
||||
geometryBufferData);
|
||||
|
||||
auto state = CreateRenderState(subroute->m_style[styleIndex].m_pattern.m_isDashed ?
|
||||
|
@ -635,7 +635,7 @@ drape_ptr<df::SubrouteMarkersData> RouteShape::CacheMarkers(ref_ptr<dp::Graphics
|
|||
markersData->m_recacheId = recacheId;
|
||||
|
||||
MarkersGeometryBuffer geometry;
|
||||
auto const depth = static_cast<float>(subroute->m_baseDepthIndex * kDepthPerSubroute + kMarkersDepth);
|
||||
auto const depth = static_cast<float>(subroute->m_baseDepthIndex * rs::kDepthPerSubroute + rs::kMarkersDepth);
|
||||
PrepareMarkersGeometry(subroute->m_markers, markersData->m_pivot, depth, geometry);
|
||||
if (geometry.empty())
|
||||
return nullptr;
|
||||
|
|
|
@ -253,6 +253,8 @@ target_link_libraries(${PROJECT_NAME}
|
|||
$<$<BOOL:CMAKE_DL_LIBS>:${CMAKE_DL_LIBS}> # dladdr from boost::stacktrace
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD OFF)
|
||||
|
||||
omim_add_test_subdirectory(generator_tests_support)
|
||||
omim_add_test_subdirectory(generator_tests)
|
||||
omim_add_test_subdirectory(generator_integration_tests)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
|
||||
namespace
|
||||
namespace gps_track
|
||||
{
|
||||
|
||||
inline pair<size_t, size_t> UnionRanges(pair<size_t, size_t> const & a, pair<size_t, size_t> const & b)
|
||||
|
@ -30,7 +30,7 @@ inline pair<size_t, size_t> UnionRanges(pair<size_t, size_t> const & a, pair<siz
|
|||
|
||||
size_t constexpr kItemBlockSize = 1000;
|
||||
|
||||
} // namespace
|
||||
} // namespace gps_track
|
||||
|
||||
size_t const GpsTrack::kInvalidId = GpsTrackCollection::kInvalidId;
|
||||
|
||||
|
@ -181,7 +181,7 @@ void GpsTrack::InitCollection(hours duration)
|
|||
// and filtered points are inserted in the runtime collection.
|
||||
|
||||
vector<location::GpsInfo> originPoints;
|
||||
originPoints.reserve(kItemBlockSize);
|
||||
originPoints.reserve(gps_track::kItemBlockSize);
|
||||
|
||||
m_storage->ForEach([this, &originPoints](location::GpsInfo const & originPoint)->bool
|
||||
{
|
||||
|
@ -301,7 +301,8 @@ void GpsTrack::UpdateCollection(hours duration, bool needClear, vector<location:
|
|||
else
|
||||
addedIds = make_pair(kInvalidId, kInvalidId);
|
||||
|
||||
evictedIds = UnionRanges(evictedIdsByAdd, UnionRanges(evictedIdsByClear, evictedIdsByDuration));
|
||||
evictedIds = gps_track::UnionRanges(evictedIdsByAdd,
|
||||
gps_track::UnionRanges(evictedIdsByClear, evictedIdsByDuration));
|
||||
}
|
||||
|
||||
void GpsTrack::NotifyCallback(pair<size_t, size_t> const & addedIds, pair<size_t, size_t> const & evictedIds)
|
||||
|
|
|
@ -198,7 +198,7 @@ void ReadTransitTask::FillLinesAndRoutes(::transit::experimental::TransitData co
|
|||
|
||||
for (auto const & line : transitData.GetLines())
|
||||
{
|
||||
transit::TransitId const routeId = line.GetRouteId();
|
||||
::transit::TransitId const routeId = line.GetRouteId();
|
||||
auto const itRoute = ::transit::FindById(routes, routeId);
|
||||
auto const itLineMetadata = ::transit::FindById(linesMeta, line.GetId(), false /*exists*/);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ using namespace routing;
|
|||
|
||||
namespace openlr
|
||||
{
|
||||
namespace
|
||||
namespace cpg
|
||||
{
|
||||
int const kNumBuckets = 256;
|
||||
double const kAnglesInBucket = 360.0 / kNumBuckets;
|
||||
|
@ -35,7 +35,7 @@ uint32_t Bearing(m2::PointD const & a, m2::PointD const & b)
|
|||
CHECK_GREATER_OR_EQUAL(angle, 0, ("Angle should be greater than or equal to 0"));
|
||||
return base::Clamp(angle / kAnglesInBucket, 0.0, 255.0);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace cpg
|
||||
|
||||
// CandidatePathsGetter::Link ----------------------------------------------------------------------
|
||||
Graph::Edge CandidatePathsGetter::Link::GetStartEdge() const
|
||||
|
@ -215,7 +215,7 @@ void CandidatePathsGetter::GetBestCandidatePaths(
|
|||
auto const bearEndPoint =
|
||||
pointsSelector.GetEndPoint(part->m_edge, part->m_distanceM);
|
||||
|
||||
auto const bearing = Bearing(bearStartPoint, bearEndPoint);
|
||||
auto const bearing = cpg::Bearing(bearStartPoint, bearEndPoint);
|
||||
auto const bearingDiff = AbsDifference(bearing, requiredBearing);
|
||||
auto const pathDistDiff = AbsDifference(part->m_distanceM, bearDistM);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ using namespace std;
|
|||
|
||||
namespace openlr
|
||||
{
|
||||
namespace
|
||||
namespace scpg
|
||||
{
|
||||
int constexpr kNumBuckets = 256;
|
||||
double constexpr kAnglesInBucket = 360.0 / kNumBuckets;
|
||||
|
@ -66,7 +66,7 @@ void EdgeSortUniqueByStartAndEndPoints(Graph::EdgeListT & edges)
|
|||
return e1.GetStartPoint() == e2.GetStartPoint() && e1.GetEndPoint() == e2.GetEndPoint();
|
||||
});
|
||||
}
|
||||
} // namespace
|
||||
} // namespace scpg
|
||||
|
||||
// ScoreCandidatePathsGetter::Link ----------------------------------------------------------------------
|
||||
Graph::Edge ScoreCandidatePathsGetter::Link::GetStartEdge() const
|
||||
|
@ -191,7 +191,7 @@ void ScoreCandidatePathsGetter::GetAllSuitablePaths(ScoreEdgeVec const & startLi
|
|||
// It's possible that road edges are duplicated a lot of times. It's a error but
|
||||
// a mapper may do that. To prevent a combinatorial explosion while matching
|
||||
// duplicated edges should be removed.
|
||||
EdgeSortUniqueByStartAndEndPoints(edges);
|
||||
scpg::EdgeSortUniqueByStartAndEndPoints(edges);
|
||||
|
||||
for (auto const & e : edges)
|
||||
{
|
||||
|
@ -322,9 +322,9 @@ bool ScoreCandidatePathsGetter::GetBearingScore(BearingPointsSelector const & po
|
|||
{
|
||||
auto const bearEndPoint = pointsSelector.GetEndPoint(part.m_edge, part.m_distanceM);
|
||||
|
||||
auto const bearingDeg = BearingInDeg(bearStartPoint, bearEndPoint);
|
||||
double const requiredBearingDeg = ToAngleInDeg(requiredBearing);
|
||||
double const angleDeviationDeg = DifferenceInDeg(bearingDeg, requiredBearingDeg);
|
||||
auto const bearingDeg = scpg::BearingInDeg(bearStartPoint, bearEndPoint);
|
||||
double const requiredBearingDeg = scpg::ToAngleInDeg(requiredBearing);
|
||||
double const angleDeviationDeg = scpg::DifferenceInDeg(bearingDeg, requiredBearingDeg);
|
||||
|
||||
// If the bearing according to osm segments (|bearingDeg|) is significantly different
|
||||
// from the bearing set in openlr (|requiredBearingDeg|) the candidate should be skipped.
|
||||
|
|
|
@ -159,20 +159,20 @@ omim_add_test_subdirectory(platform_tests)
|
|||
set_property(
|
||||
SOURCE
|
||||
preferred_languages.cpp
|
||||
apple_location_service.mm
|
||||
gui_thread_apple.mm
|
||||
http_client_apple.mm
|
||||
http_thread_apple.h
|
||||
http_thread_apple.mm
|
||||
http_uploader_apple.mm
|
||||
http_uploader_background_dummy.cpp
|
||||
locale.mm
|
||||
platform_mac.mm
|
||||
platform_unix_impl.cpp
|
||||
platform_unix_impl.hpp
|
||||
secure_storage_qt.cpp
|
||||
socket_apple.mm
|
||||
http_session_manager.mm
|
||||
PROPERTY
|
||||
apple_location_service.mm
|
||||
gui_thread_apple.mm
|
||||
http_client_apple.mm
|
||||
http_thread_apple.h
|
||||
http_thread_apple.mm
|
||||
http_uploader_apple.mm
|
||||
http_uploader_background_dummy.cpp
|
||||
locale.mm
|
||||
platform_mac.mm
|
||||
platform_unix_impl.cpp
|
||||
platform_unix_impl.hpp
|
||||
secure_storage_qt.cpp
|
||||
socket_apple.mm
|
||||
http_session_manager.mm
|
||||
PROPERTY
|
||||
SKIP_UNITY_BUILD_INCLUSION ON
|
||||
)
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
// Test preconditions: files from the kMapFiles set with '.mwm'
|
||||
// Test preconditions: files from the kBicycleMapFiles set with '.mwm'
|
||||
// extension must be placed in omim/data folder.
|
||||
std::set<std::string> const kMapFiles = {"Russia_Moscow"};
|
||||
std::set<std::string> const kBicycleMapFiles = {"Russia_Moscow"};
|
||||
|
||||
class BicycleTest : public RoutingTest
|
||||
{
|
||||
public:
|
||||
BicycleTest()
|
||||
: RoutingTest(routing::IRoadGraph::Mode::ObeyOnewayTag, routing::VehicleType::Bicycle, kMapFiles)
|
||||
: RoutingTest(routing::IRoadGraph::Mode::ObeyOnewayTag, routing::VehicleType::Bicycle, kBicycleMapFiles)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
std::set<std::string> const kMapFiles = {"Russia_Moscow"};
|
||||
std::set<std::string> const kCarMapFiles = {"Russia_Moscow"};
|
||||
|
||||
class CarTest : public RoutingTest
|
||||
{
|
||||
public:
|
||||
CarTest()
|
||||
: RoutingTest(routing::IRoadGraph::Mode::ObeyOnewayTag, routing::VehicleType::Car, kMapFiles)
|
||||
: RoutingTest(routing::IRoadGraph::Mode::ObeyOnewayTag, routing::VehicleType::Car, kCarMapFiles)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ using namespace std;
|
|||
|
||||
namespace
|
||||
{
|
||||
// Test preconditions: files from the kMapFiles set with '.mwm'
|
||||
// Test preconditions: files from the kPedestrianMapFiles set with '.mwm'
|
||||
// extension must be placed in omim/data folder.
|
||||
set<string> const kMapFiles =
|
||||
set<string> const kPedestrianMapFiles =
|
||||
{
|
||||
"UK_England_East Midlands",
|
||||
"UK_England_East of England_Essex",
|
||||
|
@ -40,7 +40,7 @@ class PedestrianTest : public RoutingTest
|
|||
public:
|
||||
PedestrianTest()
|
||||
: RoutingTest(routing::IRoadGraph::Mode::IgnoreOnewayTag, routing::VehicleType::Pedestrian,
|
||||
kMapFiles)
|
||||
kPedestrianMapFiles)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace
|
|||
{
|
||||
// Shows distribution of simularity in comparison mode.
|
||||
static std::string const kPythonDistribution = "show_distribution.py";
|
||||
static std::string const kPythonBarError = "show_errors_distribution.py";
|
||||
static std::string const kPythonBarDistributionError = "show_errors_distribution.py";
|
||||
|
||||
double constexpr kBadETADiffPercent = std::numeric_limits<double>::max();
|
||||
|
||||
|
@ -239,7 +239,7 @@ void RunComparison(std::vector<std::pair<RoutesBuilder::Result, std::string>> &&
|
|||
FillLabelsAndErrorTypeDistribution(errorLabels, errorsCount, mapsmeErrorCounter,
|
||||
anotherErrorCounter);
|
||||
|
||||
auto const pythonScriptPath = base::JoinPath(FLAGS_save_results, kPythonBarError);
|
||||
auto const pythonScriptPath = base::JoinPath(FLAGS_save_results, kPythonBarDistributionError);
|
||||
CreatePythonBarByMap(pythonScriptPath, errorLabels, errorsCount,
|
||||
{"mapsme", IsMapsmeVsMapsme() ? "old mapsme" : "api"} /* legends */,
|
||||
"Type of errors" /* xlabel */, "Number of errors" /* ylabel */);
|
||||
|
|
|
@ -15,10 +15,10 @@ using namespace std;
|
|||
|
||||
namespace
|
||||
{
|
||||
class VehicleModelTest
|
||||
class VehicleModelForCountryTest
|
||||
{
|
||||
public:
|
||||
VehicleModelTest() { classificator::Load(); }
|
||||
VehicleModelForCountryTest() { classificator::Load(); }
|
||||
};
|
||||
|
||||
string GetRegionParent(string const & id)
|
||||
|
@ -84,17 +84,17 @@ void ParentTest(string child, string parent)
|
|||
} // namespace
|
||||
|
||||
// Test we have default vehicle models for nonexistent(unknown) country
|
||||
UNIT_CLASS_TEST(VehicleModelTest, CarModel_Default)
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, CarModel_Default)
|
||||
{
|
||||
TestVehicleModelDefault<CarModel, CarModelFactory>();
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(VehicleModelTest, BicycleModel_Default)
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, BicycleModel_Default)
|
||||
{
|
||||
TestVehicleModelDefault<BicycleModel, BicycleModelFactory>();
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(VehicleModelTest, PedestrianModel_Default)
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, PedestrianModel_Default)
|
||||
{
|
||||
TestVehicleModelDefault<PedestrianModel, PedestrianModelFactory>();
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ UNIT_CLASS_TEST(VehicleModelTest, PedestrianModel_Default)
|
|||
// 1. Test we have nondefault car model for Russia
|
||||
// 2. Test we can get car model for Moscow using GetRegionParent callback: car model for Moscow equals
|
||||
// car model for Russia and it's not default model.
|
||||
UNIT_CLASS_TEST(VehicleModelTest, CarModel_DirectParent)
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, CarModel_DirectParent)
|
||||
{
|
||||
TestHaveNondefaultRestrictionForSelectedCountry<CarModel, CarModelFactory>("Russian Federation");
|
||||
ParentTest<CarModel, CarModelFactory>("Moscow", "Russian Federation");
|
||||
|
@ -111,7 +111,7 @@ UNIT_CLASS_TEST(VehicleModelTest, CarModel_DirectParent)
|
|||
// 1. Test we have nondefault bicycle model for Russia
|
||||
// 2. Test we can get bicycle model for Moscow using GetRegionParent callback: bicycle model for Moscow
|
||||
// equals bicycle model for Russia and it's not default model.
|
||||
UNIT_CLASS_TEST(VehicleModelTest, BicycleModel_DirectParent)
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, BicycleModel_DirectParent)
|
||||
{
|
||||
TestHaveNondefaultRestrictionForSelectedCountry<BicycleModel, BicycleModelFactory>(
|
||||
"Russian Federation");
|
||||
|
@ -121,7 +121,7 @@ UNIT_CLASS_TEST(VehicleModelTest, BicycleModel_DirectParent)
|
|||
// 1. Test we have nondefault pedestrian model for Russia
|
||||
// 2. Test we can get pedestrian model for Moscow using GetRegionParent callback: pedestrian model for
|
||||
// Moscow equals pedestrian model for Russia and it's not default model.
|
||||
UNIT_CLASS_TEST(VehicleModelTest, PedestrianModel_DirectParent)
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, PedestrianModel_DirectParent)
|
||||
{
|
||||
TestHaveNondefaultRestrictionForSelectedCountry<PedestrianModel, PedestrianModelFactory>(
|
||||
"Russian Federation");
|
||||
|
@ -129,25 +129,25 @@ UNIT_CLASS_TEST(VehicleModelTest, PedestrianModel_DirectParent)
|
|||
}
|
||||
|
||||
// Test has the same idea as previous one except Germany is not direct parent of Munich
|
||||
// in GetRegionParent function: Munich -> Bavaria -> Germany
|
||||
UNIT_CLASS_TEST(VehicleModelTest, CarModel_InirectParent)
|
||||
// in GetRegionParent function: Munich -> Bavaria -> Germany
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, CarModel_InirectParent)
|
||||
{
|
||||
TestHaveNondefaultRestrictionForSelectedCountry<CarModel, CarModelFactory>("Germany");
|
||||
ParentTest<CarModel, CarModelFactory>("Munich", "Germany");
|
||||
}
|
||||
|
||||
// Test has the same idea as previous one except United States of America are not direct parent of
|
||||
// Test has the same idea as previous one except United States of America are not direct parent of
|
||||
// San Francisco in GetRegionParent function: San Francisco -> California -> United States of America
|
||||
UNIT_CLASS_TEST(VehicleModelTest, BicycleModel_IndirectParent)
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, BicycleModel_IndirectParent)
|
||||
{
|
||||
TestHaveNondefaultRestrictionForSelectedCountry<BicycleModel, BicycleModelFactory>(
|
||||
"United States of America");
|
||||
ParentTest<BicycleModel, BicycleModelFactory>("San Francisco", "United States of America");
|
||||
}
|
||||
|
||||
// Test has the same idea as previous one except United States of America are not direct parent of
|
||||
// Test has the same idea as previous one except United States of America are not direct parent of
|
||||
// San Francisco in GetRegionParent function: San Francisco -> California -> United States of America
|
||||
UNIT_CLASS_TEST(VehicleModelTest, PedestrianModel_IndirectParent)
|
||||
UNIT_CLASS_TEST(VehicleModelForCountryTest, PedestrianModel_IndirectParent)
|
||||
{
|
||||
TestHaveNondefaultRestrictionForSelectedCountry<PedestrianModel, PedestrianModelFactory>(
|
||||
"United States of America");
|
||||
|
|
Loading…
Add table
Reference in a new issue