/// <summary> /// Initialise the map /// </summary> public override void InitMap() { MapControlManager.InitMap(22f, true); // display all seekios on the map foreach (var seekios in App.CurrentUserEnvironment.LsSeekios) { if (seekios != null && seekios.LastKnownLocation_dateLocationCreation.HasValue && (seekios.LastKnownLocation_latitude != App.DefaultLatitude && seekios.LastKnownLocation_longitude != App.DefaultLongitude)) { var mode = App.CurrentUserEnvironment.LsMode.FirstOrDefault(el => el.Seekios_idseekios == seekios.Idseekios); var isDontMove = mode != null && mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeDontMove; MapControlManager.CreateSeekiosMarkerAsync(seekios.Idseekios.ToString() , seekios.SeekiosName , seekios.SeekiosPicture , seekios.LastKnownLocation_dateLocationCreation.Value , seekios.LastKnownLocation_latitude , seekios.LastKnownLocation_longitude , seekios.LastKnownLocation_accuracy , isDontMove); } } MapControlManager.SeekiosMarkerClicked += OnSeekiosMarkerClicked; }
/// <summary> /// Callback d'initialisation de la map /// </summary> public override void OnMapReady(GoogleMap googleMap) { if (googleMap != null) { this.MapWrapperLayout.Init(googleMap); if (_mapControlManager == null) { // initialisation de la map _mapControlManager = new MapControlManager(googleMap , BaseContext , AddPointSvgImageView , UndoSvgImageView , CenterSeekiosSvgImageView , MapViewModelBase.Seekios.Idseekios.ToString()); App.Locator.ModeZone.MapControlManager = _mapControlManager; App.Locator.ModeZone.InitMap(); //Ajout d'un polygone pour la zone du mode zone App.Locator.ModeZone.InitMode(); App.Locator.ModeZone.InitZone(); if (_mapControlManager.ZonePolygon != null) { ShowZoneSvgImageView.Visibility = ViewStates.Visible; } //(_modeMetaDataFragment as ZoneMetaDataFragment).ZonePolygon = _mapControlManager.ZonePolygon; _mapControlManager.ZoneInformationUpdated += OnInformationZoneRefresh; _mapControlManager.RegisterMethodes(); } } base.OnMapReady(googleMap); }
public async void InitDontMoveTrackingRouteAsync() { if (MapControlManager == null) { return; } var mode = App.CurrentUserEnvironment.LsMode.Where(el => el.Seekios_idseekios == Seekios.Idseekios).FirstOrDefault(); // Is there location from the database ? //if (mode != null && LsLocations?.Count < 2) //{ try { var locations = await _dataService.LocationsByMode(mode.Idmode); if (locations?.Count > 0) { App.CurrentUserEnvironment.LsLocations.RemoveAll(el => el.Mode_idmode == mode.Idmode); App.CurrentUserEnvironment.LsLocations.AddRange(locations); App.CurrentUserEnvironment.LsLocations.RemoveAll(el => el.Idlocation == 0); } } catch (Exception) { _dispatcherService.Invoke(async() => { await _dialogService.ShowMessage(Resources.NoDataFromLocationByMode , string.Empty , Resources.NoDataFromLocationByModeButton , null); }); } //} MapControlManager.CreateRouteBackground(LsLocations); }
/// <summary> /// Allows to zoom on a seekios marker using its index in the list /// </summary> public void ZoomToSeekios() { if (Seekios == null) { return; } MapControlManager.CenterInMarker(Seekios.Idseekios.ToString(), true); }
public override void ViewDidUnload() { base.ViewDidUnload(); if (_mapControlManager != null) { _mapControlManager.Dispose(); } _mapControlManager = null; }
/// <summary> /// Initialize zone /// </summary> public void InitZone() { var isInAlert = Mode != null && Mode.StatusDefinition_idstatusDefinition != 1; if (LsAreaCoords != null && LsAreaCoords.Count > 0) { MapControlManager.CreateZone(LsAreaCoords.Select(el => new LatitudeLongitude(el.Latitude, el.Longitude)).ToList(), isInAlert, true); MapControlManager.CreateUndoActionsToRemoveActualZone(); } }
/// <summary> /// Set up the business logic for the map /// </summary> public override void SetMapControlManager() { _mapControlManager = new MapControlManager(MapViewControl , this , FocusOnSeekiosButton , ChangeMapTypeButton , MapZoomInButton , MapZoomOutButton , MapViewModelBase.Seekios.Idseekios.ToString()); App.Locator.Historic.MapControlManager = _mapControlManager; App.Locator.Historic.InitMap(); _mapControlManager.RegisterMethodes(); }
public override void SetMapControlManager() { _mapControlManager = new MapControlManager(MapViewControl , this , MapZoomInButton , MapZoomOutButton); App.Locator.MapAllSeekios.MapControlManager = _mapControlManager; App.Locator.MapAllSeekios.InitMap(); if (App.CurrentUserEnvironment.LsSeekios.Count != 0) { _mapControlManager.RegisterMethodes(); var listLatLong = _mapControlManager.ConvertLatitudeLongitudeToLatLng(GetSeekiosListCordinates()); _mapControlManager.CenterOnLocations(listLatLong, true); } }
/// <summary> /// Initialize tracking route sorted ASC date /// </summary> public async void InitTrackingRoute() { if (MapControlManager == null) { return; } var mode = App.CurrentUserEnvironment.LsMode.Where(el => el.Seekios_idseekios == Seekios.Idseekios).FirstOrDefault(); // Is there location from the database ? //if (mode != null && LsLocations?.Count < 2) // Even if we have 1 position, we get position in db in case of some delay //{ try { // Skip, the seekios is in power saving and it's waiting for activation if (!Seekios.HasGetLastInstruction && Seekios.IsInPowerSaving && mode.StatusDefinition_idstatusDefinition == (int)StatutDefinitionEnum.RAS) { MapControlManager.CreateRouteBackground(LsLocations); } // Get positions from database var locations = await _dataService.LocationsByMode(mode.Idmode); if (locations?.Count > 0) { App.CurrentUserEnvironment.LsLocations.RemoveAll(el => el.Mode_idmode == mode.Idmode); App.CurrentUserEnvironment.LsLocations.AddRange(locations); App.CurrentUserEnvironment.LsLocations.RemoveAll(el => el.Idlocation == 0); } } catch (Exception) { _dispatcherService.Invoke(async() => { await _dialogService.ShowMessage(Resources.NoDataFromLocationByMode , string.Empty , Resources.NoDataFromLocationByModeButton , null); }); } //} MapControlManager.CreateRouteBackground(LsLocations); }
/// <summary> /// Initialize the map with markers /// </summary> public virtual void InitMap() { MapControlManager.InitMap(22f, true); var seekios = MapViewModelBase.Seekios; var isDontMove = MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeDontMove; if (seekios != null && seekios.LastKnownLocation_dateLocationCreation.HasValue) { MapControlManager.CreateSeekiosMarkerAsync(seekios.Idseekios.ToString() , seekios.SeekiosName , seekios.SeekiosPicture , seekios.LastKnownLocation_dateLocationCreation.Value , seekios.LastKnownLocation_latitude , seekios.LastKnownLocation_longitude , seekios.LastKnownLocation_accuracy , isDontMove); MapControlManager.CenterInLocalisation(seekios.LastKnownLocation_latitude, seekios.LastKnownLocation_longitude, (float)ZoomLevelEnum.MediumZoom); } }
/// <summary> /// Callback d'initialisation de la map /// </summary> public override void OnMapReady(GoogleMap googleMap) { if (googleMap != null) { MapWrapperLayout.Init(googleMap); // Initialisation de la map _mapControlManager = new MapControlManager(googleMap , this , null , null , CenterSeekiosSvgImageView , MapViewModelBase.Seekios.Idseekios.ToString()); App.Locator.Historic.MapControlManager = _mapControlManager; App.Locator.Historic.InitMap(); _mapControlManager.RegisterMethodes(); } base.OnMapReady(googleMap); }
public override void SetMapControlManager() { // map initialisation _mapControlManager = new MapControlManager(MapViewControl , this , FocusOnSeekiosButton , FocusOnZoneButton , ChangeMapTypeButton , MapZoomInButton , MapZoomOutButton , null , UndoButton , NextButton , App.Locator.DetailSeekios.SeekiosSelected.Idseekios.ToString()); App.Locator.ModeZone.MapControlManager = _mapControlManager; App.Locator.ModeZone.InitMap(); App.Locator.ModeZone.InitMode(); App.Locator.ModeZone.InitZone(); if (App.Locator.DetailSeekios.SeekiosSelected.LastKnownLocation_accuracy > 0) { // display the area for accuracy (triangulation) _mapControlManager.CreateAccuracyArea(App.Locator.DetailSeekios.SeekiosSelected.LastKnownLocation_latitude , App.Locator.DetailSeekios.SeekiosSelected.LastKnownLocation_longitude , App.Locator.DetailSeekios.SeekiosSelected.LastKnownLocation_accuracy); } else { // big zoom _mapControlManager.CenterInLocalisation(App.Locator.DetailSeekios.SeekiosSelected.LastKnownLocation_latitude , App.Locator.DetailSeekios.SeekiosSelected.LastKnownLocation_longitude , (float)ZoomLevelEnum.BigZoom , true); } _mapControlManager.RegisterMethodes(); _mapControlManager.IsOnPointAdding = true; }
/// <summary> /// Initialize the map with markers /// </summary> public virtual void InitMap() { MapControlManager.InitMap((float)ZoomLevelEnum.MediumZoom, true); if (Seekios != null && Seekios.LastKnownLocation_dateLocationCreation.HasValue) { var isDontMove = Mode != null && Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeDontMove; var isInAlert = Mode != null && Mode.StatusDefinition_idstatusDefinition != 1; if (Seekios.LastKnownLocation_accuracy >= 0 && Seekios.LastKnownLocation_accuracy <= 10) { Seekios.LastKnownLocation_accuracy = 0; } MapControlManager.CreateSeekiosMarkerAsync(Seekios.Idseekios.ToString() , Seekios.SeekiosName , Seekios.SeekiosPicture , Seekios.LastKnownLocation_dateLocationCreation.Value , Seekios.LastKnownLocation_latitude , Seekios.LastKnownLocation_longitude , Seekios.LastKnownLocation_accuracy , isDontMove , isInAlert); } }
private void InitializeMap() { var map = (MapControl)GetChildren(ListSeekiosView).First(x => x.Name == "Map"); if (_mapControlManager == null) { _mapControlManager = new MapControlManager(map, null, null); _mapControlManager.RegisterMethodes(); } if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeDontMove) { if (MapViewModelBase.Mode.StatusDefinition_idstatusDefinition != 1) { MapControlManager.IsOutOf = true; } SeekiosApp.App.Locator.ModeDontMove.MapControlManager = _mapControlManager; //SeekiosApp.App.Locator.ModeDontMove.MapControlManager.OnInitTrackingRouteComplete -= OnInitTrackingRouteComplete; //SeekiosApp.App.Locator.ModeDontMove.MapControlManager.OnInitTrackingRouteComplete += OnInitTrackingRouteComplete; SeekiosApp.App.Locator.ModeDontMove.InitMap(); SeekiosApp.App.Locator.ModeDontMove.InitModeDontMove(); if (SeekiosApp.App.Locator.ModeDontMove.LsSeekiosInTrackingAfterMove.Contains(SeekiosApp.App.Locator.DetailSeekios.SeekiosSelected.Idseekios)) { Task.Factory.StartNew(() => { SeekiosApp.App.Locator.ModeDontMove.InitDontMoveTrackingRouteAsync(); }); } } else if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeZone) { if (MapViewModelBase.Mode.StatusDefinition_idstatusDefinition != 1) { MapControlManager.IsOutOf = true; } SeekiosApp.App.Locator.ModeZone.MapControlManager = _mapControlManager; //SeekiosApp.App.Locator.ModeZone.MapControlManager.OnInitTrackingRouteComplete -= OnInitTrackingRouteComplete; //SeekiosApp.App.Locator.ModeZone.MapControlManager.OnInitTrackingRouteComplete += OnInitTrackingRouteComplete; SeekiosApp.App.Locator.ModeZone.InitMap(); var isInAlert = MapViewModelBase.Mode != null && MapViewModelBase.Mode.StatusDefinition_idstatusDefinition != 1; _mapControlManager.CreateZone(SeekiosApp.App.Locator.ModeZone.DecodeTrame(MapViewModelBase.Mode.Trame), isInAlert); if (SeekiosApp.App.Locator.ModeZone.LsSeekiosInTrackingAfterOOZ.Contains(SeekiosApp.App.Locator.DetailSeekios.SeekiosSelected.Idseekios)) { Task.Factory.StartNew(() => { SeekiosApp.App.Locator.ModeZone.InitZoneTrackingRouteAsync(); }); } //FocusOnZoneButton.Hidden = false; } else if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeTracking) { MapControlManager.IsOutOf = false; SeekiosApp.App.Locator.ModeTracking.MapControlManager = _mapControlManager; //SeekiosApp.App.Locator.ModeTracking.MapControlManager.OnInitTrackingRouteComplete -= OnInitTrackingRouteComplete; //SeekiosApp.App.Locator.ModeTracking.MapControlManager.OnInitTrackingRouteComplete += OnInitTrackingRouteComplete; SeekiosApp.App.Locator.ModeTracking.InitMap(); Task.Factory.StartNew(() => { SeekiosApp.App.Locator.ModeTracking.InitTrackingRoute(); }); } else { MapControlManager.IsOutOf = false; SeekiosApp.App.Locator.Map.MapControlManager = _mapControlManager; SeekiosApp.App.Locator.Map.InitMap(); } //SetZoom(); }
/// <summary> /// Verify if a seekios is in the zone being defined /// </summary> public bool VerifyIfSeekiosIsInZone(LatitudeLongitude seekiosPos, List <LatitudeLongitude> zone) { return(MapControlManager.IsSeekiosInZone(seekiosPos, zone)); }
/// <summary> /// Center the map on the zone /// </summary> public void CenterOnZone() { MapControlManager.CenterOnZone(); }
public override void OnMapReady(GoogleMap googleMap) { if (googleMap != null) { MapWrapperLayout.Init(googleMap); if (App.Locator.ModeTracking.MapControlManager != null) { App.Locator.ModeTracking.MapControlManager.OnInitTrackingRouteComplete -= OnInitTrackingRouteComplete; } _mapControlManager = new MapControlManager(googleMap , this , CenterSeekiosSvgImageView , MapViewModelBase.Seekios.Idseekios.ToString()); // subscribe to tracking Route Drawing events _mapControlManager.OnInitTrackingRouteComplete += OnInitTrackingRouteComplete; if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeDontMove) { if (MapViewModelBase.Mode.StatusDefinition_idstatusDefinition == (int)StatutDefinitionEnum.SeekiosMoved) { MapControlManager.IsInAlert = true; } App.Locator.ModeDontMove.MapControlManager = _mapControlManager; App.Locator.ModeDontMove.InitMap(); App.Locator.ModeDontMove.InitModeDontMove(); if (App.Locator.Map.LsSeekiosOnTracking.Any(x => x.Seekios.Idseekios == App.Locator.DetailSeekios.SeekiosSelected.Idseekios)) { using (var handler = new Handler(Looper.MainLooper)) { handler.Post(() => { App.Locator.ModeDontMove.InitDontMoveTrackingRouteAsync(); }); } } } else if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeZone) { if (MapViewModelBase.Mode.StatusDefinition_idstatusDefinition == (int)StatutDefinitionEnum.SeekiosOutOfZone) { MapControlManager.IsInAlert = true; } App.Locator.ModeZone.MapControlManager = _mapControlManager; App.Locator.ModeZone.InitMap(); var isInAlert = MapViewModelBase.Mode != null && MapViewModelBase.Mode.StatusDefinition_idstatusDefinition != 1; _mapControlManager.CreateZone(App.Locator.ModeZone.DecodeTrame(MapViewModelBase.Mode.Trame), isInAlert); if (App.Locator.Map.LsSeekiosOnTracking.Any(x => x.Seekios.Idseekios == App.Locator.DetailSeekios.SeekiosSelected.Idseekios)) { using (var handler = new Handler(Looper.MainLooper)) { handler.Post(() => { App.Locator.ModeZone.InitZoneTrackingRouteAsync(); }); } } CenterOnZoneButton.Visibility = ViewStates.Visible; } else if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeTracking) { MapControlManager.IsInAlert = false; App.Locator.ModeTracking.MapControlManager = _mapControlManager; App.Locator.ModeTracking.InitMap(); LoadingLayout.Visibility = ViewStates.Visible; using (var handler = new Handler(Looper.MainLooper)) { handler.Post(() => { App.Locator.ModeTracking.InitTrackingRoute(); }); } } else { MapControlManager.IsInAlert = false; App.Locator.Map.MapControlManager = _mapControlManager; App.Locator.Map.InitMap(); } _mapControlManager.RegisterMethodes(); } base.OnMapReady(googleMap); //the call to the function is made before the map is initialized => _mapControlManager = null //we need to Hide & Show the markerInfo once we have initialized the control manager in order to reflect the right //internet connection state if (!App.DeviceIsConnectedToInternet) { UpdateUIOnConnectionStateChanged(false); } }