ZoomEvent / MouseWheel

Within this forum we want to offer discussions all around our .NET based xServer controls.

ZoomEvent / MouseWheel

Postby peter.detzner » Mon Apr 03, 2017 7:47 am

I'd like to catch the "MouseWheel"-Scroll Event, thats how I defined it:

Code: Select all
<Map:WpfMap Name="ptvWpfMap" HorizontalAlignment="Stretch" Margin="0,0,0,0"  VerticalAlignment="Stretch" Loaded="ptvWpfMap_Loaded" ContextMenu="{StaticResource cmButton}" MouseWheel="ptvWpfMap_MouseWheel"/>


and the Code inside the class looks like this:

Code: Select all
   private void ptvWpfMap_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
    WriteLine("scroll");
}


What did I miss? Thanks for your help!
peter.detzner
 
Posts: 12
Joined: Fri Feb 10, 2017 6:57 am

Re: ZoomEvent / MouseWheel

Postby Oliver Heilig » Mon Apr 03, 2017 9:38 am

Hello Peter,

do you want to modify the behavious of the mouse-wheel, or just get a notification when the user interacts on the map? To get the map-navagaion-events, you can catch the ViewPortBegin/While/EndChanged-Events.

ViewportBeginChanged="Map_ViewportBeginChanged"

These will be fired on all zoom and pan actions. You also can completely modify the behaviour of the Pan/Zoom class. There's a sample "CustomPanAndZoom" here https://github.com/ptv-logistics/xservernet-bin
Oliver Heilig
Chief Developer
PTV GROUP - Germany

https://github.com/oliverheilig/
User avatar
Oliver Heilig
 
Posts: 75
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany

Re: ZoomEvent / MouseWheel

Postby peter.detzner » Mon Apr 03, 2017 9:55 am

The idea is, if the user scrolls to a "country" view, to collapse some symbols... if the user zooms in for a closer look, to expand some symbols...
peter.detzner
 
Posts: 12
Joined: Fri Feb 10, 2017 6:57 am

Re: ZoomEvent / MouseWheel

Postby Oliver Heilig » Mon Apr 03, 2017 12:29 pm

ok, in your case i would catch the ViewPortEndChanged-Event. Then you can get the zoom level of the map and expand your icons. With the MapViewPort-Events you can update your data depending on the map zoom and center.

ViewPortChanged.png
Map Viewport Events


There's also a "Clustering" Demo in the DemoCenter which works like this.
Oliver Heilig
Chief Developer
PTV GROUP - Germany

https://github.com/oliverheilig/
User avatar
Oliver Heilig
 
Posts: 75
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany


Return to PTV xServer.NET (Admin=OH)

cron