Base class for messages used between MapEx and custom renderer
Пример #1
0
        public void OnMapMessage(Map sender, XamMapz.Messaging.MapMessage message)
        {
            if (message is ZoomMessage)
            {
//                var msg = (ZoomMessage)message;
                if (_mapViewDelegate.IsRegionChanging == false)
                {
                    UpdateRegion();
                }
            }
            else if (message is ProjectionMessage)
            {
                var msg       = (ProjectionMessage)message;
                var screenPos = MKMapPoint.FromCoordinate(msg.Position.ToCoordinate2D());
                msg.ScreenPosition = new Point(screenPos.X, screenPos.Y);
            }
            else if (message is MoveMessage)
            {
                if (_mapViewDelegate.IsRegionChanging == false)
                {
                    var msg = (MoveMessage)message;
                    NativeMap.CenterCoordinate = msg.Target.ToCoordinate2D();
                }
            }
        }
Пример #2
0
        protected virtual void OnMapMessage(Map map, MapMessage message)
        {
            if (message is ZoomMessage)
            {
                //var msg = (ZoomMessage)message;
                UpdateRegion();
            }
            else if (message is ProjectionMessage)
            {
                var msg = (ProjectionMessage)message;
                var screenPos = NativeMap.Projection.ToScreenLocation(msg.Position.ToLatLng());
                msg.ScreenPosition = new Point(screenPos.X, screenPos.Y);
            }
            else if (message is MoveMessage)
            {
                var msg = (MoveMessage)message;
                UpdateGoogleMap(formsMap =>
                    {
                        var cameraUpdate = CameraUpdateFactory.NewLatLng(msg.Target.ToLatLng());
                        NativeMap.MoveCamera(cameraUpdate);
                    });

            }
        }
Пример #3
0
 protected virtual void OnMapMessage(MapMessage message)
 {
     if (message is ViewChangeMessage)
     {
         var msg = (ViewChangeMessage)message;
         Region = msg.Span;
         if (ViewChanged != null)
             ViewChanged(this, new MapViewChangeEventArgs(msg.Span, msg.ZoomLevel));
         Debug.WriteLine("ViewChangeMessage recieved:\n\tPosition: {0} {1}", msg.Span.Center.Latitude, msg.Span.Center.Longitude);
     }
 }