コード例 #1
0
        public PointDataSummary GetForPlaceMark(PlaceMark pm)
        {
            PointDataSummary ret = null;
            string guid = pm.Id;

            if (PDSummaries.ContainsKey(guid))
            {

                ret = PDSummaries[guid];

            }
            else
            {
                ret = new PointDataSummary();
                ret.Guid = guid;
                ret.Name = pm.Name; // this is temp until data is retrieved
                ret.Latitude = pm.Location.Latitude;
                ret.Longitude = pm.Location.Longitude;
                ret.LayerId = pm.FeedId;

                PDSummaries[guid] = ret;
            }

            if (!IsCurrent(guid))
            {
                UpdateSummaryByGuid(guid);
            }

            return ret;
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: remiolivier/Openturf
        // HACK: Callback after point is created by _pointDataViewCreate
        public void PointCreated(PointDataSummary pds)
        {
            // Delegate method is called more than once, so we will check if it is already on the map, and remove it
            // before adding it.
            UIElement elem = (UIElement)this.currentUserMapLayer.FindName(pds.Guid);
            if (elem != null)
            {
                currentUserMapLayer.Children.Remove(elem);
            }

            ImageBrush brush = new ImageBrush();
            SolidColorBrush stroke = new SolidColorBrush(Colors.White);
            brush.ImageSource = new BitmapImage(new Uri(Service.User.currentUser.profile_image_url));

            userGenMapLayer.Children.Remove(_pointDataViewCreate.Pin);
            _pointDataViewCreate.Visibility = Visibility.Collapsed;

            PlaceMark pm = new PlaceMark();
            pm.Location = new Location(pds.Latitude, pds.Longitude);
            pm.Summary = pds;
            pm.Id = pds.Guid;

            Ellipse pin = new Ellipse();
            pin.Fill = brush;
            pin.StrokeThickness = 1;
            pin.Stroke = stroke;
            pin.Width = 22;
            pin.Height = 22;
            pin.Opacity = 0.9;
            pin.Tag = pm;
            pin.Name = pm.Id;

            ToolTipService.SetToolTip(pin, pds.Name);

            pin.MouseLeftButtonUp += pin_MouseLeftButtonUp;
            currentUserMapLayer.AddChild(pin, pm.Location,PositionOrigin.Center);
            pin_MouseLeftButtonUp(pin, null);
        }
コード例 #3
0
ファイル: MainPage.xaml.cs プロジェクト: remiolivier/Openturf
        public void EditLandmark(PlaceMark pm)
        {
            if (_pointDataViewCreate == null)
            {
                _pointDataViewCreate = new PointDataViewCreate();
                _pointDataViewCreate.Summary = Service.Summaries;
                _pointDataViewCreate.User = Service.User;
                _pointDataViewCreate.MainPage = this; // HACK for callback
            }
            else
            {
                if (_pointDataViewCreate.Pin != null)
                {
                    userGenMapLayer.Children.Remove(_pointDataViewCreate.Pin);

                    _pointDataViewCreate.Pin = null;
                }

                userGenMapLayer.Children.Remove(_pointDataViewCreate);
            }

            _pointDataView.Visibility = Visibility.Collapsed;

            _pointDataViewCreate.createViewBox.ClearForm();
            _pointDataViewCreate.createViewBox.Data = pm.Summary;

            Pushpin customPin = new Pushpin();
            customPin.Location = new Location(_pointDataView.CurrentSummary.Latitude, _pointDataView.CurrentSummary.Longitude);

            _pointDataViewCreate.Pin = customPin;

            userGenMapLayer.AddChild(_pointDataViewCreate, customPin.Location, PositionOrigin.BottomCenter);
            customPin.Background = new SolidColorBrush(Color.FromArgb(255, 0x40, 0x22, 0x5F));////40225F

            userGenMapLayer.Visibility = Visibility.Visible;
            userGenMapLayer.Children.Add(customPin);

            _pointDataViewCreate.Visibility = Visibility.Visible;

            customPin.MouseLeftButtonDown += new MouseButtonEventHandler(customPin_MouseLeftButtonDown);
            customPin.MouseLeftButtonUp += new MouseButtonEventHandler(customPin_MouseLeftButtonUp);
        }
コード例 #4
0
ファイル: MainPage.xaml.cs プロジェクト: remiolivier/Openturf
 public void DeleteLandmark(PlaceMark pm)
 {
     ConfirmDelete(pm.Id);
 }
コード例 #5
0
ファイル: MainPage.xaml.cs プロジェクト: remiolivier/Openturf
        void Summaries_UserSummaryUpdate(SummariesController sender)
        {
            ImageBrush brush = new ImageBrush();
            brush.ImageSource = new BitmapImage(new Uri(Service.User.currentUser.profile_image_url));

            foreach(string key in sender.UserSummaries.Keys)
            {
                PointDataSummary pds = sender.UserSummaries[key];
                PlaceMark pm = new PlaceMark();
                pm.Location = new Location(pds.Latitude,pds.Longitude);
                pm.Summary = pds;
                pm.Id = pds.Guid;

                Pushpin oldElem = (Pushpin)communityMapLayer.FindName(pds.Guid);
                if (oldElem != null)
                {
                    communityMapLayer.Children.Remove(oldElem);
                    oldElem = null;
                }

                Pushpin pin = new Pushpin();
                pin.Background = brush;
                pin.Name = pds.Guid;
                pin.Tag = pm;

                ToolTipService.SetToolTip(pin, pds.Name);

                pin.MouseLeftButtonUp += pin_MouseLeftButtonUp;
                currentUserMapLayer.AddChild(pin, pm.Location,PositionOrigin.BottomCenter);
            }
        }
コード例 #6
0
ファイル: MainPage.xaml.cs プロジェクト: remiolivier/Openturf
        void Summaries_CommunityUpdate(SummariesController sender)
        {
            foreach (string key in sender.CommunitySummaries.Keys)
            {

                PointDataSummary pds = sender.CommunitySummaries[key];
                ImageBrush brush = new ImageBrush();
                brush.ImageSource = new BitmapImage(new Uri(pds.CreatorProfileImageUrl));

                Pushpin elem = (Pushpin)this.communityMapLayer.FindName(pds.Guid);
                // only create a new item if it is not already on the map
                if(elem == null)
                {
                    PlaceMark pm = new PlaceMark();
                    pm.Location = new Location(pds.Latitude, pds.Longitude);
                    pm.Summary = pds;
                    pm.Id = pds.Guid;

                    Pushpin pin = new Pushpin();
                    //pin.Template = (ControlTemplate)Application.Current.Resources["PushPinTemplate"];
                    pin.Background = brush;
                    // pin.BorderBrush = borderBrush;
                    pin.Tag = pm;
                    pin.Name = pm.Id; // use name/guid so we can find it later if need be

                    ToolTipService.SetToolTip(pin, pds.Name);

                    pin.MouseLeftButtonUp += pin_MouseLeftButtonUp;
                    this.communityMapLayer.AddChild(pin, pm.Location,PositionOrigin.BottomCenter);
                }
            }
        }