question

yanjinhua avatar image
0 Votes"
yanjinhua asked yanjinhua commented

WPF bingMAP Pushpin Clusterer

wpf bing map Pushpin polymerization
How to achieve point aggregation?
96452-%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE-20210513234354.png



如何实现Pushpin 聚合。

windows-wpfwindows-maps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DaisyTian-1203 avatar image
0 Votes"
DaisyTian-1203 answered yanjinhua commented

Do you want to get the collection of Pushpin? How did you add Pushpin? I will show you my demo of getting collection of Pushpin, and if it doesn't help you, please let me. I use ObservableCollection<Pushpin> Pushpins to store the Pushpin.

 int counter = 0;
         ObservableCollection<Pushpin> Pushpins = new ObservableCollection<Pushpin>();
    
         public MainWindow()
         {
             InitializeComponent();
             myMap.MouseDoubleClick += new MouseButtonEventHandler(myMap_MouseDoubleClick);
    
         }
    
         private void myMap_MouseDoubleClick(object sender, MouseButtonEventArgs e)
         {
             e.Handled = true;
             Point mousePosition = e.GetPosition(this);
             Location pinLocation = myMap.ViewportPointToLocation(mousePosition);
             Pushpin pin = new Pushpin();
             pin.Location = pinLocation;
             pin.Content = counter += 1;
             pin.MouseDown += new MouseButtonEventHandler(pin_MouseDown);
             myMap.Children.Add(pin);
             Pushpins.Add(pin);
         }
    
         private void pin_MouseDown(object sender, MouseButtonEventArgs e)
         {
             e.Handled = true;
    
             var pushPinContent = 0;
             var pushPin = sender as Pushpin;
             if (pushPin != null & pushPin.GetType() == typeof(Pushpin))
                 pushPinContent = Convert.ToInt32(pushPin.Content);
    
             myMap.Heading = (double)pushPinContent;
         }

If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you. I want to do the aggregated display of thumbtacks

0 Votes 0 ·

Similar arcgis Clusterer
Multiple thumbtacks are displayed next to one, and multiple thumbtacks are displayed after amplification

0 Votes 0 ·