Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2017-02-15 17:14:29 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2017-02-16 19:39:55 +0300
commitf6607f40c47cde66a79eabd1d1029d33b9225b0b (patch)
tree6d654f72834d74f62d6af221440d19180b68d4ae
parent4ab5235841551ac8a81d239aba1aa95fcdef1794 (diff)
Added support of vehicle styles
l---------android/assets/drules_proto_vehicle_clear.bin1
l---------android/assets/drules_proto_vehicle_dark.bin1
-rw-r--r--android/script/replace_links.bat2
-rw-r--r--android/src/com/mapswithme/maps/Framework.java2
-rw-r--r--indexer/map_style.cpp8
-rw-r--r--indexer/map_style.hpp2
-rw-r--r--indexer/map_style_reader.cpp36
-rw-r--r--iphone/Maps/Maps.xcodeproj/project.pbxproj16
-rw-r--r--map/chart_generator.cpp4
-rw-r--r--map/style_tests/classificator_tests.cpp23
-rw-r--r--qt/CMakeLists.txt2
-rw-r--r--qt/search_panel.cpp17
12 files changed, 103 insertions, 11 deletions
diff --git a/android/assets/drules_proto_vehicle_clear.bin b/android/assets/drules_proto_vehicle_clear.bin
new file mode 120000
index 0000000000..ebc6e8cfc8
--- /dev/null
+++ b/android/assets/drules_proto_vehicle_clear.bin
@@ -0,0 +1 @@
+../../data/drules_proto_vehicle_clear.bin \ No newline at end of file
diff --git a/android/assets/drules_proto_vehicle_dark.bin b/android/assets/drules_proto_vehicle_dark.bin
new file mode 120000
index 0000000000..ab8f2484ae
--- /dev/null
+++ b/android/assets/drules_proto_vehicle_dark.bin
@@ -0,0 +1 @@
+../../data/drules_proto_vehicle_dark.bin \ No newline at end of file
diff --git a/android/script/replace_links.bat b/android/script/replace_links.bat
index 8f8fed16c7..fe49651977 100644
--- a/android/script/replace_links.bat
+++ b/android/script/replace_links.bat
@@ -10,6 +10,8 @@ cp ../data/countries.txt assets/
cp ../data/countries_obsolete.txt assets/
cp ../data/drules_proto_dark.bin assets/
cp ../data/drules_proto_clear.bin assets/
+cp ../data/drules_proto_vehicle_dark.bin assets/
+cp ../data/drules_proto_vehicle_clear.bin assets/
cp ../data/editor.config assets/
cp ../data/external_resources.txt assets/
cp ../data/faq.html assets/
diff --git a/android/src/com/mapswithme/maps/Framework.java b/android/src/com/mapswithme/maps/Framework.java
index 7efc022db2..afb15049d0 100644
--- a/android/src/com/mapswithme/maps/Framework.java
+++ b/android/src/com/mapswithme/maps/Framework.java
@@ -25,6 +25,8 @@ public class Framework
{
public static final int MAP_STYLE_CLEAR = 0;
public static final int MAP_STYLE_DARK = 1;
+ public static final int MAP_STYLE_VEHICLE_CLEAR = 3;
+ public static final int MAP_STYLE_VEHICLE_DARK = 4;
@Retention(RetentionPolicy.SOURCE)
@IntDef({ROUTER_TYPE_VEHICLE, ROUTER_TYPE_PEDESTRIAN, ROUTER_TYPE_BICYCLE, ROUTER_TYPE_TAXI})
diff --git a/indexer/map_style.cpp b/indexer/map_style.cpp
index 0b2d766cc7..206429b9dc 100644
--- a/indexer/map_style.cpp
+++ b/indexer/map_style.cpp
@@ -11,6 +11,10 @@ MapStyle MapStyleFromSettings(std::string const & str)
return MapStyleClear;
else if (str == "MapStyleDark")
return MapStyleDark;
+ else if (str == "MapStyleVehicleClear")
+ return MapStyleVehicleClear;
+ else if (str == "MapStyleVehicleDark")
+ return MapStyleVehicleDark;
return kDefaultMapStyle;
}
@@ -25,6 +29,10 @@ std::string MapStyleToString(MapStyle mapStyle)
return "MapStyleClear";
case MapStyleMerged:
return "MapStyleMerged";
+ case MapStyleVehicleDark:
+ return "MapStyleVehicleDark";
+ case MapStyleVehicleClear:
+ return "MapStyleVehicleClear";
case MapStyleCount:
break;
diff --git a/indexer/map_style.hpp b/indexer/map_style.hpp
index 6258a976ff..6f043a14f4 100644
--- a/indexer/map_style.hpp
+++ b/indexer/map_style.hpp
@@ -7,6 +7,8 @@ enum MapStyle
MapStyleClear = 0,
MapStyleDark = 1,
MapStyleMerged = 2,
+ MapStyleVehicleClear = 3,
+ MapStyleVehicleDark = 4,
// Add new map style here
// Specifies number of MapStyle enum values, must be last
diff --git a/indexer/map_style_reader.cpp b/indexer/map_style_reader.cpp
index b0e7bfced2..fbf8d2f6d6 100644
--- a/indexer/map_style_reader.cpp
+++ b/indexer/map_style_reader.cpp
@@ -13,15 +13,43 @@ namespace
const char * const kSuffixDark = "_dark";
const char * const kSuffixClear = "_clear";
+const char * const kSuffixVehicleDark = "_vehicle_dark";
+const char * const kSuffixVehicleClear = "_vehicle_clear";
-string GetStyleSuffix(MapStyle mapStyle)
+string GetStyleRulesSuffix(MapStyle mapStyle)
{
switch (mapStyle)
{
- case MapStyleDark:
+ case MapStyleDark:
return kSuffixDark;
case MapStyleClear:
return kSuffixClear;
+ case MapStyleVehicleDark:
+ return kSuffixVehicleDark;
+ case MapStyleVehicleClear:
+ return kSuffixVehicleClear;
+ case MapStyleMerged:
+ return string();
+
+ case MapStyleCount:
+ break;
+ }
+ LOG(LWARNING, ("Unknown map style", mapStyle));
+ return kSuffixClear;
+}
+
+string GetStyleResourcesSuffix(MapStyle mapStyle)
+{
+ // We use the same resources for default and vehicle styles
+ // to avoid textures duplication and package size increasing.
+ switch (mapStyle)
+ {
+ case MapStyleDark:
+ case MapStyleVehicleDark:
+ return kSuffixDark;
+ case MapStyleClear:
+ case MapStyleVehicleClear:
+ return kSuffixClear;
case MapStyleMerged:
return string();
@@ -51,13 +79,13 @@ MapStyle StyleReader::GetCurrentStyle()
ReaderPtr<Reader> StyleReader::GetDrawingRulesReader()
{
- string const rulesFile = string("drules_proto") + GetStyleSuffix(GetCurrentStyle()) + ".bin";
+ string const rulesFile = string("drules_proto") + GetStyleRulesSuffix(GetCurrentStyle()) + ".bin";
return GetPlatform().GetReader(rulesFile);
}
ReaderPtr<Reader> StyleReader::GetResourceReader(string const & file, string const & density)
{
- string const resourceDir = string("resources-") + density + GetStyleSuffix(GetCurrentStyle());
+ string const resourceDir = string("resources-") + density + GetStyleResourcesSuffix(GetCurrentStyle());
return GetPlatform().GetReader(my::JoinFoldersToPath(resourceDir, file));
}
diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj
index 112aa3568a..69e7d0d8a4 100644
--- a/iphone/Maps/Maps.xcodeproj/project.pbxproj
+++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj
@@ -424,6 +424,12 @@
34FE4C451BCC013500066718 /* MWMMapWidgets.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34FE4C441BCC013500066718 /* MWMMapWidgets.mm */; };
4519503A1B7A3E070085DA05 /* patterns.txt in Resources */ = {isa = PBXBuildFile; fileRef = 451950391B7A3E070085DA05 /* patterns.txt */; };
452FCA3B1B6A3DF7007019AB /* colors.txt in Resources */ = {isa = PBXBuildFile; fileRef = 452FCA3A1B6A3DF7007019AB /* colors.txt */; };
+ 4554B6EA1E55F02B0084017F /* drules_proto_vehicle_clear.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4554B6E81E55F02B0084017F /* drules_proto_vehicle_clear.bin */; };
+ 4554B6EB1E55F02B0084017F /* drules_proto_vehicle_dark.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4554B6E91E55F02B0084017F /* drules_proto_vehicle_dark.bin */; };
+ 4554B6EC1E55F0EF0084017F /* drules_proto_vehicle_clear.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4554B6E81E55F02B0084017F /* drules_proto_vehicle_clear.bin */; };
+ 4554B6ED1E55F0F00084017F /* drules_proto_vehicle_clear.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4554B6E81E55F02B0084017F /* drules_proto_vehicle_clear.bin */; };
+ 4554B6EE1E55F0F30084017F /* drules_proto_vehicle_dark.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4554B6E91E55F02B0084017F /* drules_proto_vehicle_dark.bin */; };
+ 4554B6EF1E55F0F40084017F /* drules_proto_vehicle_dark.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4554B6E91E55F02B0084017F /* drules_proto_vehicle_dark.bin */; };
46F26CD810F623BA00ECCA39 /* EAGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46F26CD710F623BA00ECCA39 /* EAGLView.mm */; };
4A00DBDF1AB704C400113624 /* drules_proto_dark.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4A00DBDE1AB704C400113624 /* drules_proto_dark.bin */; };
4A23D15B1B8B4DD700D4EB6F /* drules_proto_clear.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4A23D1561B8B4DD700D4EB6F /* drules_proto_clear.bin */; };
@@ -1674,6 +1680,8 @@
3DDB4BC31DAB98F000F4D021 /* libpartners_api.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpartners_api.a; path = "../../../omim-xcode-build/Debug-iphonesimulator/libpartners_api.a"; sourceTree = "<group>"; };
451950391B7A3E070085DA05 /* patterns.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = patterns.txt; path = ../../data/patterns.txt; sourceTree = "<group>"; };
452FCA3A1B6A3DF7007019AB /* colors.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = colors.txt; path = ../../data/colors.txt; sourceTree = "<group>"; };
+ 4554B6E81E55F02B0084017F /* drules_proto_vehicle_clear.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = drules_proto_vehicle_clear.bin; path = ../../data/drules_proto_vehicle_clear.bin; sourceTree = "<group>"; };
+ 4554B6E91E55F02B0084017F /* drules_proto_vehicle_dark.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = drules_proto_vehicle_dark.bin; path = ../../data/drules_proto_vehicle_dark.bin; sourceTree = "<group>"; };
458287C21AD3BE2000BA8940 /* DownloadIndicatorProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadIndicatorProtocol.h; sourceTree = "<group>"; };
46F26CD610F623BA00ECCA39 /* EAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = EAGLView.h; sourceTree = "<group>"; };
46F26CD710F623BA00ECCA39 /* EAGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = EAGLView.mm; sourceTree = "<group>"; };
@@ -3749,6 +3757,8 @@
FA065FC61286143F00FEA989 /* External Resources */ = {
isa = PBXGroup;
children = (
+ 4554B6E81E55F02B0084017F /* drules_proto_vehicle_clear.bin */,
+ 4554B6E91E55F02B0084017F /* drules_proto_vehicle_dark.bin */,
F623DA6A1C9C2731006A3436 /* opening_hours_how_to_edit.html */,
6B9978341C89A316003B8AA0 /* editor.config */,
671182DE1C7F0DD400CB8177 /* countries_obsolete.txt */,
@@ -3984,6 +3994,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 4554B6EA1E55F02B0084017F /* drules_proto_vehicle_clear.bin in Resources */,
+ 4554B6EB1E55F02B0084017F /* drules_proto_vehicle_dark.bin in Resources */,
EEA61601134C496A003A9827 /* 01_dejavusans.ttf in Resources */,
341C2A571B72092A00AD41A1 /* 02_droidsans-fallback.ttf in Resources */,
EEA61603134C496A003A9827 /* 03_jomolhari-id-a3d.ttf in Resources */,
@@ -4155,6 +4167,7 @@
F6E2FEB21E097BA00083EBEC /* _MWMPPPSchedule.xib in Resources */,
F6E2FEB51E097BA00083EBEC /* _MWMPPPSpace.xib in Resources */,
F6E2FEB81E097BA00083EBEC /* _MWMPPPSubtitle.xib in Resources */,
+ 4554B6EE1E55F0F30084017F /* drules_proto_vehicle_dark.bin in Resources */,
F6E2FEBB1E097BA00083EBEC /* _MWMPPPTitle.xib in Resources */,
6741A9781BF340DE002C974C /* AddSetTableViewCell.xib in Resources */,
340E1EEC1E2F614400CE49BF /* Authorization.storyboard in Resources */,
@@ -4224,6 +4237,7 @@
F6E2FDEF1E097BA00083EBEC /* MWMOpeningHoursAddClosedTableViewCell.xib in Resources */,
F6E2FDF51E097BA00083EBEC /* MWMOpeningHoursAddScheduleTableViewCell.xib in Resources */,
F6E2FDFB1E097BA00083EBEC /* MWMOpeningHoursAllDayTableViewCell.xib in Resources */,
+ 4554B6EC1E55F0EF0084017F /* drules_proto_vehicle_clear.bin in Resources */,
F6E2FE761E097BA00083EBEC /* MWMOpeningHoursCell.xib in Resources */,
F6E2FE011E097BA00083EBEC /* MWMOpeningHoursClosedSpanTableViewCell.xib in Resources */,
F6E2FE071E097BA00083EBEC /* MWMOpeningHoursDaysSelectorTableViewCell.xib in Resources */,
@@ -4311,6 +4325,7 @@
F6E2FEB31E097BA00083EBEC /* _MWMPPPSchedule.xib in Resources */,
F6E2FEB61E097BA00083EBEC /* _MWMPPPSpace.xib in Resources */,
F6E2FEB91E097BA00083EBEC /* _MWMPPPSubtitle.xib in Resources */,
+ 4554B6EF1E55F0F40084017F /* drules_proto_vehicle_dark.bin in Resources */,
F6E2FEBC1E097BA00083EBEC /* _MWMPPPTitle.xib in Resources */,
849CF6441DE842290024A8A5 /* AddSetTableViewCell.xib in Resources */,
340E1EED1E2F614400CE49BF /* Authorization.storyboard in Resources */,
@@ -4380,6 +4395,7 @@
F6E2FDF61E097BA00083EBEC /* MWMOpeningHoursAddScheduleTableViewCell.xib in Resources */,
F6E2FDFC1E097BA00083EBEC /* MWMOpeningHoursAllDayTableViewCell.xib in Resources */,
F6E2FE771E097BA00083EBEC /* MWMOpeningHoursCell.xib in Resources */,
+ 4554B6ED1E55F0F00084017F /* drules_proto_vehicle_clear.bin in Resources */,
F6E2FE021E097BA00083EBEC /* MWMOpeningHoursClosedSpanTableViewCell.xib in Resources */,
F6E2FE081E097BA00083EBEC /* MWMOpeningHoursDaysSelectorTableViewCell.xib in Resources */,
F6E2FE0E1E097BA00083EBEC /* MWMOpeningHoursDeleteScheduleTableViewCell.xib in Resources */,
diff --git a/map/chart_generator.cpp b/map/chart_generator.cpp
index ac715071e3..6d1f754674 100644
--- a/map/chart_generator.cpp
+++ b/map/chart_generator.cpp
@@ -56,8 +56,10 @@ agg::rgba8 GetLineColor(MapStyle mapStyle)
LOG(LERROR, ("Wrong map style param."));
// No need break or return here.
case MapStyleDark:
+ case MapStyleVehicleDark:
return agg::rgba8(255, 230, 140, 255);
case MapStyleClear:
+ case MapStyleVehicleClear:
case MapStyleMerged:
return agg::rgba8(30, 150, 240, 255);
}
@@ -71,8 +73,10 @@ agg::rgba8 GetCurveColor(MapStyle mapStyle)
LOG(LERROR, ("Wrong map style param."));
// No need break or return here.
case MapStyleDark:
+ case MapStyleVehicleDark:
return agg::rgba8(255, 230, 140, 20);
case MapStyleClear:
+ case MapStyleVehicleClear:
case MapStyleMerged:
return agg::rgba8(30, 150, 240, 20);
}
diff --git a/map/style_tests/classificator_tests.cpp b/map/style_tests/classificator_tests.cpp
index 65516eae12..53d5575e01 100644
--- a/map/style_tests/classificator_tests.cpp
+++ b/map/style_tests/classificator_tests.cpp
@@ -151,24 +151,41 @@ pair<int, int> GetMinMax(int level, vector<uint32_t> const & types, drule::rule_
return res;
}
+string CombineArrT(StringIL const & arrT)
+{
+ string result;
+ for (auto it = arrT.begin(); it != arrT.end(); ++it)
+ {
+ if (it != arrT.begin())
+ result.append("-");
+ result.append(*it);
+ }
+ return result;
+}
+
void CheckPriority(vector<StringIL> const & arrT, vector<size_t> const & arrI, drule::rule_type_t ruleType)
{
Classificator const & c = classif();
vector<vector<uint32_t> > types;
+ vector<vector<string> > typesInfo;
styles::RunForEveryMapStyle([&](MapStyle style)
{
types.clear();
+ typesInfo.clear();
size_t ind = 0;
for (size_t i = 0; i < arrI.size(); ++i)
{
types.push_back(vector<uint32_t>());
types.back().reserve(arrI[i]);
+ typesInfo.push_back(vector<string>());
+ typesInfo.back().reserve(arrI[i]);
for (size_t j = 0; j < arrI[i]; ++j)
{
types.back().push_back(c.GetTypeByPath(arrT[ind]));
+ typesInfo.back().push_back(CombineArrT(arrT[ind]));
++ind;
}
}
@@ -178,11 +195,15 @@ void CheckPriority(vector<StringIL> const & arrT, vector<size_t> const & arrI, d
for (int level = scales::GetUpperWorldScale() + 1; level <= scales::GetUpperStyleScale(); ++level)
{
pair<int, int> minmax(numeric_limits<int>::max(), numeric_limits<int>::min());
+ vector<string> minmaxInfo;
for (size_t i = 0; i < types.size(); ++i)
{
pair<int, int> const mm = GetMinMax(level, types[i], ruleType);
- TEST_LESS(minmax.second, mm.first, ("Priority bug on zoom", level, "group", i, ":", minmax.first, minmax.second, "vs", mm.first, mm.second));
+ TEST_LESS(minmax.second, mm.first, ("Priority bug on zoom", level, "group", i, ":",
+ minmaxInfo, minmax.first, minmax.second, "vs",
+ typesInfo[i], mm.first, mm.second));
minmax = mm;
+ minmaxInfo = typesInfo[i];
}
}
});
diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt
index b2152c6826..2388ab3580 100644
--- a/qt/CMakeLists.txt
+++ b/qt/CMakeLists.txt
@@ -141,6 +141,8 @@ copy_resources(
countries_obsolete.txt
drules_proto_clear.bin
drules_proto_dark.bin
+ drules_proto_vehicle_clear.bin
+ drules_proto_vehicle_dark.bin
editor.config
fonts_blacklist.txt
fonts_whitelist.txt
diff --git a/qt/search_panel.cpp b/qt/search_panel.cpp
index 194e7b9109..b1f63a1136 100644
--- a/qt/search_panel.cpp
+++ b/qt/search_panel.cpp
@@ -154,10 +154,16 @@ void SearchPanel::OnSearchResult(ResultsT * results)
bool SearchPanel::TryChangeMapStyleCmd(QString const & str)
{
// Hook for shell command on change map style
- bool const isDark = (str == "mapstyle:dark") || (str == "?dark");
- bool const isLight = isDark ? false : (str == "mapstyle:light") || (str == "?light");
-
- if (!isDark && !isLight)
+ MapStyle desiredStyle = MapStyleCount;
+ if (str == "mapstyle:dark" || str == "?dark")
+ desiredStyle = MapStyleDark;
+ else if (str == "mapstyle:light" || str == "?light")
+ desiredStyle = MapStyleClear;
+ else if (str == "mapstyle:vehicle_dark" || str == "?vdark")
+ desiredStyle = MapStyleVehicleDark;
+ else if (str == "mapstyle:vehicle_light" || str == "?vlight")
+ desiredStyle = MapStyleVehicleClear;
+ else
return false;
// close Search panel
@@ -165,8 +171,7 @@ bool SearchPanel::TryChangeMapStyleCmd(QString const & str)
parentWidget()->hide();
// change color scheme for the Map activity
- MapStyle const mapStyle = isDark ? MapStyleDark : MapStyleClear;
- m_pDrawWidget->SetMapStyle(mapStyle);
+ m_pDrawWidget->SetMapStyle(desiredStyle);
return true;
}