protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged (sender, e);

            var UISMapView = (MKMapView)Control;
            var formsMap = (ExtendedMap)sender;
            var formsPins = formsMap.Items;
            UISMapView.ShowsUserLocation = true;
            UISMapView.UserInteractionEnabled = true;
            UISMapView.ZoomEnabled = true;
            UISMapView.ScrollEnabled = true;
            UISMapView.PitchEnabled = true;

            mapDel = new mapDelegate ();

            UISMapView.Delegate = mapDel;

            if (e.PropertyName.Equals ("MapChanged")) {
                foreach (IMKAnnotation  mtmp in UISMapView.Annotations) {
                    if (mtmp is mapAnotation) {
                        var m = mtmp as mapAnotation;
                        var i =	formsMap.Items.FirstOrDefault (x => x.Name == m.Title);
                        var viewForAnnotation = UISMapView.ViewForAnnotation (m);
                        if (viewForAnnotation != null) {
                            if (i == null) {
                                viewForAnnotation.Hidden = true;
                            } else {
                                viewForAnnotation.Hidden = false;
                            }
                        }
                    }

                }
            }

            if (e.PropertyName.Equals ("MapCreated")) {
                int index = 0;
                foreach (var c in formsPins) {
                    mapAnotation pin = new  mapAnotation (c.Name,
                                           index,
                                           new CLLocationCoordinate2D (c.Location.Latitude, c.Location.Longitude), c.ImageUrl);
                    UISMapView.AddAnnotation (pin);
                    index++;
                }
            }

            //UISMapView.DidUpdateUserLocation += delegate(object senders, MKUserLocationEventArgs eUser) {
            //eUser.UserLocation.Location.Coordinate.Latitude
            //};

            mapDel.callNackPin += delegate(mapAnotation obj) {
                var p = formsMap.Items [obj.pos];

                formsMap.callBackItemSelected (p);
            };
        }
示例#2
0
        public Editor Map(mapDelegate <int, int, byte> callback, int channel = 0)
        {
            Image <Bgr, byte> resultImage = new Image <Bgr, byte>(GetImageWidth(), GetImageHeight());

            ForEach((height, width, color) =>
            {
                resultImage.Data[height, width, channel] = callback(height, width, color);
            });
            SourceImage = resultImage;

            return(this);
        }