public MapController(Entity entity)
        {
            try {
                Entity = entity;

                Title = Entity.EntityTypeName;

                _map = new MKMapView();

                _pin = new Pin(Entity);

                _map.Frame            = View.Bounds;
                _map.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

                _map.AddAnnotation(_pin);

                _map.Region = new MKCoordinateRegion(_pin.Coordinate, new MKCoordinateSpan(0.01, 0.01));

                View.AddSubview(_map);

                _map.SelectAnnotation(_pin, true);
            } catch (Exception error) {
                Log.Error(error);
            }
        }
示例#2
0
        public override void ShowIncidentInformationPanel(IncidentModel incident)
        {
            // search for the annotation in the map
            var annotation = _nativeMap?.Annotations?.OfType <IncidentAnnotation>().Where(i => i.Incident.Id == incident.Id).FirstOrDefault();

            _nativeMap.SelectAnnotation(annotation, false);
        }
        public override void ShowPushpinInformationPanel(CustomPin pin)
        {
            // search for the annotation in the map
            var annotation = _nativeMap?.Annotations?.OfType <CustomPinAnnotation>().Where(i => i.CustomPin.Id == pin.Id).FirstOrDefault();

            _nativeMap.SelectAnnotation(annotation, false);
        }
示例#4
0
        public MapController(Entity entity)
        {
            try {
                Entity = entity;

                Title = Entity.EntityTypeName;

                _map = new MKMapView ();

                _pin = new Pin(Entity);

                _map.Frame = View.Bounds;
                _map.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

                _map.AddAnnotation(_pin);

                _map.Region = new MKCoordinateRegion (_pin.Coordinate, new MKCoordinateSpan (0.01, 0.01));

                View.AddSubview (_map);

                _map.SelectAnnotation(_pin, true);

            } catch (Exception error) {
                Log.Error (error);
            }
        }
 public override void SelectCluster(CKCluster cluster, bool animated)
 {
     if (_internalMap.SelectedAnnotations.Contains(cluster))
     {
         return;
     }
     _internalMap.SelectAnnotation(cluster, animated);
 }
示例#6
0
        void OnDidDeselectAnnotationView(object sender, MKAnnotationViewEventArgs e)
        {
            if (!e.View.Selected && !touchOnCustonPinView)
            {
                customPinView.RemoveFromSuperview();
                customPinView.Dispose();
                customPinView = null;
            }
            else if (touchOnCustonPinView && !e.View.Selected)
            {
                nativeMap.SelectAnnotation(e.View.Annotation, false);
            }

            touchOnCustonPinView = false;
        }
        void AddLocationAnnotation(
            CLLocationCoordinate2D coordinate,
            ChangeableWrapper <GeoPolyline> polyline = null,
            int index = 0)
        {
            var locationStr = ToLatLonString(
                coordinate.Latitude,
                coordinate.Longitude);
            var annotation = new PolylinePointAnnotation {
                Title      = locationStr,
                Coordinate = coordinate,
                Polyline   = polyline,
                Index      = index,
            };

            mapView.AddAnnotation(annotation);
            mapView.SelectAnnotation(annotation, animated: true);
        }
示例#8
0
 public static void SelectCluster(this MKMapView map, CKCluster cluster, bool animated)
 {
     map.SelectAnnotation(cluster, animated);
 }