How to get GeographicsSymbolsSeries point from ultraGeographicMap

Answered (Verified) This post has 1 verified answer | 10 Replies | 2 Followers Thread's RSS feed.

Grzegorz
Points 125
Replied On: Fri, Aug 11 2017 5:13 AM Reply

Hi!

I have created several points on map as List of GeoLocations (name, X and Y cordinates) and added it to GeographicSymbolSeries.

Now I want to get a single object point when I click it on the map, to show more information about it. 

Can you tell me how to do that ?

By that I mean 2 things:

Capture the mouse click - and get that click coordinates.

Get exact object from GeographicSymbolSeries which I added earlier.

I really appreciate any help you can provide!

  • Post Points: 5

Verified Answer

Mike Bowshewicz
Points 11,205
Infragistics Employee
Answered (Verified) Replied On: Fri, Aug 11 2017 3:52 PM Reply
Verified by Grzegorz

Hi Grzegorz,

Try adding this event handler:


this.ultraGeographicMap1.SeriesMouseLeftButtonDown += (p1, p2) =>
{
    GeoLocation location = p2.Item as GeoLocation;
    if (location != null)
    {
        MessageBox.Show(location.Name);
    }
};

Please let me know whether this is the information you needed.

Sincerely,

Mike B
Software Developer

  • Post Points: 20

All Replies

Grzegorz
Points 125
Replied On: Fri, Aug 11 2017 7:59 AM Reply

I found partial solution.

The method is called ultraGeographicMap.CrosshairPoint();

But still looking for better one.

  • Post Points: 20
Mike Bowshewicz
Points 11,205
Infragistics Employee
Answered (Verified) Replied On: Fri, Aug 11 2017 3:52 PM Reply
Verified by Grzegorz

Hi Grzegorz,

Try adding this event handler:


this.ultraGeographicMap1.SeriesMouseLeftButtonDown += (p1, p2) =>
{
    GeoLocation location = p2.Item as GeoLocation;
    if (location != null)
    {
        MessageBox.Show(location.Name);
    }
};

Please let me know whether this is the information you needed.

Sincerely,

Mike B
Software Developer

  • Post Points: 20
Grzegorz
Points 125
Replied On: Mon, Aug 14 2017 8:37 AM Reply

Yeah,

That's totally what I meant.

Thanks a lot!

The only problem is that after this event the map is in "zooming" mode. Like after navigating Map content Using a Mouse.

How to fix this ?

  • Post Points: 20
Mike Bowshewicz
Points 11,205
Infragistics Employee
Replied On: Mon, Aug 14 2017 4:13 PM Reply

Hello,

I am not sure why this happens yet. Does it exhibit the zooming behavior when not using the supplied code? If so, it might just be a property setting.

I will investigate this further and let you know what I find.

Sincerely,

Mike B
Software Developer

  • Post Points: 5
Mike Bowshewicz
Points 11,205
Infragistics Employee
Replied On: Tue, Aug 15 2017 11:39 AM Reply

Hello,

In my testing, I do not see the behavior you described. The map does not react to a click by zooming. Please provide a sample application that demonstrates this behavior and I will find a way to disable it.

Sincerely,

Mike B
Software Developer

  • Post Points: 20
Grzegorz
Points 125
Replied On: Wed, Aug 16 2017 4:00 AM Reply

In attachment you have example file.

After clicking on "TEST" GeoPoint, and clicking on one of the options in message box (YES or NO), you will see that map is stuck in zoom by mouse mode.

  • Post Points: 35
Mike Bowshewicz
Points 11,205
Infragistics Employee
Replied On: Wed, Aug 16 2017 2:09 PM Reply

Hi Grzegorz,

I added your code to a sample and I can see the behavior you are describing. I will need to spend some more time looking this over to determine why this happens. I will follow up with more information soon.

Please let me know if you have any further questions.

Sincerely,

Mike B
Software Developer

  • Post Points: 5
Mike Bowshewicz
Points 11,205
Infragistics Employee
Replied On: Thu, Aug 17 2017 12:57 PM Reply

Hi Grzegorz,

The reason it's getting stuck in zoom mode is actually due to the fact that a new window is given focus in the mouse down event handler. This prevents the map from receiving a mouse up event so it thinks the mouse is still down. There are a few ways you might resolve this:

  1. Do not display a message box in response to the user clicking the series item.
  2. Use the SeriesMouseLeftButtonUp event instead of SeriesMouseLeftButtonDown.
  3. Set the Zoomable property on the UltraGeographicMap to false.

Please try these solutions out and let me know whether any of them work for you.

Sincerely,

Mike B
Software Developer

  • Post Points: 20
Grzegorz
Points 125
Replied On: Fri, Aug 18 2017 3:20 AM Reply

Only solution nr 2 was only acceptable ,but it doesn't work. Nothing happens :/

The main point of this topic was to display some information about point on map -> something like popup with html content.

Because tool-tips are not meant to do that I chosen message box. If you have better solution to this problem -> let me know.

And my map must be interactive all the time. So setting zommable to false is not good idea :/

Do you have other tips ? Let me know.

Thank you for all your assistance so far!

  • Post Points: 20
Mike Bowshewicz
Points 11,205
Infragistics Employee
Replied On: Fri, Aug 18 2017 10:58 AM Reply

Hi Grzegorz,

If it is necessary to display the dialog, you can get around this by adding a slight delay before showing the popup. There are many ways to accomplish this, but I think a timer is the simplest:

[code]

private void UltraGeographicMap1_SeriesMouseLeftButtonDown(object sender, ChartMouseButtonEventArgs e)
{
   Timer t = new Timer();
   t.Interval = 100;
   t.Tick += (tickSender, eventArgs) =>
   {
      t.Stop();
      // Gets the ItemsSource item associated with the current event.
      GeoLocation location = e.Item as GeoLocation;
      if (location != null)
      {
         DialogResult dialogResult = MessageBox.Show(location.Name, "Odwiedź", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
         if (dialogResult == DialogResult.Yes)
         {
         }
      }
};

t.Start();
}[code]

Please try this out and let me know if it works. If you still see the issue, try adding more time to the timer. You can probably get away with about 250ms before the lag becomes too detrimental.

Sincerely,

Mike B
Software Developer

  • Post Points: 5
Page 1 of 1 (11 items) | RSS