forked from organicmaps/organicmaps
[depp links] process viewport center parameter for search in viewport
This commit is contained in:
parent
1bb2b781db
commit
4f85c45bcd
6 changed files with 46 additions and 8 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "coding/file_name_utils.hpp"
|
||||
|
||||
#include "geometry/angles.hpp"
|
||||
#include "geometry/mercator.hpp"
|
||||
|
||||
#include "indexer/feature_altitude.hpp"
|
||||
|
||||
|
@ -1978,4 +1979,19 @@ Java_com_mapswithme_maps_Framework_nativeSetPowerManagerScheme(JNIEnv *, jclass,
|
|||
{
|
||||
frm()->GetPowerManager().SetScheme(static_cast<PowerManager::Scheme>(schemeType));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeSetViewportCenter(JNIEnv *, jclass, jdouble lat,
|
||||
jdouble lon, jint zoom)
|
||||
{
|
||||
auto const center = MercatorBounds::FromLatLon(static_cast<double>(lat),
|
||||
static_cast<double>(lon));
|
||||
frm()->SetViewportCenter(center, static_cast<int>(zoom));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeStopLocationFollow(JNIEnv *, jclass)
|
||||
{
|
||||
frm()->StopLocationFollow();
|
||||
}
|
||||
} // extern "C"
|
||||
|
|
|
@ -516,6 +516,8 @@ public class Framework
|
|||
public static native void nativeOnBatteryLevelChanged(int level);
|
||||
public static native void nativeSetPowerManagerFacility(int facilityType, boolean state);
|
||||
public static native void nativeSetPowerManagerScheme(int schemeType);
|
||||
public static native void nativeSetViewportCenter(double lat, double lon, int zoom);
|
||||
public static native void nativeStopLocationFollow();
|
||||
|
||||
public enum LocalAdsEventType
|
||||
{
|
||||
|
|
|
@ -1729,6 +1729,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
public static class OpenUrlTask implements MapTask
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final int SEARCH_IN_VIEWPORT_ZOOM = 16;
|
||||
private final String mUrl;
|
||||
|
||||
public OpenUrlTask(String url)
|
||||
|
@ -1762,6 +1763,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
return true;
|
||||
case ParsedUrlMwmRequest.RESULT_SEARCH:
|
||||
final ParsedSearchRequest request = Framework.nativeGetParsedSearchRequest();
|
||||
if (request.mIsSearchOnMap)
|
||||
{
|
||||
Framework.nativeStopLocationFollow();
|
||||
Framework.nativeSetViewportCenter(request.mLat, request.mLon, SEARCH_IN_VIEWPORT_ZOOM);
|
||||
}
|
||||
SearchActivity.start(target, request.mQuery, request.mLocale, request.mIsSearchOnMap,
|
||||
null, null);
|
||||
return true;
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
#include "platform/http_thread_apple.h"
|
||||
#include "platform/local_country_file_utils.hpp"
|
||||
|
||||
#include "geometry/mercator.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
#include "private.h"
|
||||
// If you have a "missing header error" here, then please run configure.sh script in the root repo
|
||||
// folder.
|
||||
|
@ -59,6 +63,8 @@ NSString * const kUDAutoNightModeOff = @"AutoNightModeOff";
|
|||
NSString * const kIOSIDFA = @"IFA";
|
||||
NSString * const kBundleVersion = @"BundleVersion";
|
||||
|
||||
auto const kSearchInViewportZoom = 16;
|
||||
|
||||
/// Adds needed localized strings to C++ code
|
||||
/// @TODO Refactor localization mechanism to make it simpler
|
||||
void InitLocalizedStrings()
|
||||
|
@ -263,9 +269,17 @@ using namespace osm_auth_ios;
|
|||
auto locale = @(request.m_locale.c_str());
|
||||
|
||||
if (request.m_isSearchOnMap)
|
||||
{
|
||||
ASSERT([self isDrapeEngineCreated], ());
|
||||
f.StopLocationFollow();
|
||||
auto const center = MercatorBounds::FromLatLon(request.m_centerLat, request.m_centerLon);
|
||||
f.SetViewportCenter(center, kSearchInViewportZoom);
|
||||
[manager searchTextOnMap:query forInputLocale:locale];
|
||||
}
|
||||
else
|
||||
{
|
||||
[manager searchText:query forInputLocale:locale];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -325,12 +325,6 @@ void Framework::OnViewportChanged(ScreenBase const & screen)
|
|||
m_viewportChanged(screen);
|
||||
}
|
||||
|
||||
void Framework::StopLocationFollow()
|
||||
{
|
||||
if (m_drapeEngine != nullptr)
|
||||
m_drapeEngine->StopLocationFollow();
|
||||
}
|
||||
|
||||
bool Framework::IsEnoughSpaceForMigrate() const
|
||||
{
|
||||
return GetPlatform().GetWritableStorageStatus(GetStorage().GetMaxMwmSizeBytes()) ==
|
||||
|
@ -1222,6 +1216,12 @@ void Framework::SetViewportListener(TViewportChanged const & fn)
|
|||
m_viewportChanged = fn;
|
||||
}
|
||||
|
||||
void Framework::StopLocationFollow()
|
||||
{
|
||||
if (m_drapeEngine != nullptr)
|
||||
m_drapeEngine->StopLocationFollow();
|
||||
}
|
||||
|
||||
void Framework::OnSize(int w, int h)
|
||||
{
|
||||
if (m_drapeEngine != nullptr)
|
||||
|
|
|
@ -248,8 +248,6 @@ protected:
|
|||
|
||||
void ClearAllCaches();
|
||||
|
||||
void StopLocationFollow();
|
||||
|
||||
void OnViewportChanged(ScreenBase const & screen);
|
||||
|
||||
void InitTransliteration();
|
||||
|
@ -628,6 +626,8 @@ public:
|
|||
|
||||
void SetViewportListener(TViewportChanged const & fn);
|
||||
|
||||
void StopLocationFollow();
|
||||
|
||||
/// Resize event from window.
|
||||
void OnSize(int w, int h);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue