Select to view content in your preferred language

WPF Multi touch

3702
10
06-28-2010 02:48 AM
linusang
Emerging Contributor
Hi,

Would like to know if multitouch-able Map object is in the pipelline?

i created my own multi-touch behavior attached to the map object and it lags when i add a feature layer... however when i use the mouse, there is no lag.... so i'm guessing my algorithm is doing some heavy processing to get the Map rendered...

thanks
0 Kudos
10 Replies
dotMorten_esri
Esri Notable Contributor
It's on our roadmap, but will not happen until after v2.0
0 Kudos
linusang
Emerging Contributor
Hi, I've got a problem with the manipulation and touch events. Not sure if any guys can help me with this, but my guess is something to do with WPF event system.

I've added a multitouch behavior for the map to do zoom and pan, i did it with the manipulation engine. now i require the feature layer to activate something upon TouchUp. this is the symbol xaml that i set for a polyline feature class.

<esri:LineSymbol x:Key="MyLineSymbol">
        <esri:LineSymbol.ControlTemplate>
            <ControlTemplate>
                <Path x:Name="Element" Stroke="Orange" StrokeThickness="10" >
                    <i:Interaction.Behaviors>
                        <b:PathSymbolBehavior Attributes="{Binding Attributes}" />
                    </i:Interaction.Behaviors>
                </Path>
            </ControlTemplate>            
        </esri:LineSymbol.ControlTemplate>
    </esri:LineSymbol>


my PathSymbolBehavior hooks up touchup events to do some other stuff...

the problem is if i added the manipulation behavior for the map, the touchup event of the path wouldn't fire. however when i remove the manipulation behavior for the map, the touchup event could fire.... i tried using preview touchup on the path and it too does not fire...
0 Kudos
linusang
Emerging Contributor
ok... i checked with Snoop and it reports that somehow TouchUp is not fired at all... however, TouchDown is fired...

any one can explain why is the case?
0 Kudos
IdoFlatow
Emerging Contributor
Hi,

Would like to know if multitouch-able Map object is in the pipelline?

i created my own multi-touch behavior attached to the map object and it lags when i add a feature layer... however when i use the mouse, there is no lag.... so i'm guessing my algorithm is doing some heavy processing to get the Map rendered...

thanks


Hi,
I was wondering if you could share your algorithm for multi-touch?
My email is idof at sela.co.il.

thanks
0 Kudos
JenniferNery
Esri Regular Contributor
I don't know if this is something we can share but I can give you a general idea of the approach we've taken. 

In WPF4, every UIElement has additional property and events for Manipulation. IsManipulationEnabled need to be set to true if you will be subscribing to ManipulationStarted, ManipulationDelta, ManipulationCompleted, etc. You can look at this link for sample: http://msdn.microsoft.com/en-us/library/ee649090.aspx
0 Kudos
linusang
Emerging Contributor
basically the important code is in the manipulationdelta event which i've discussed in the performance thread.... here is the code.. but note that when there is a large number of polygons... the navigation becomes sluggish....

the idea behind the following code is using the matrixtransform to product the new extent... might not be the best way of doing this kinda thing.... if anyone has a better idea... i would gladly modify it and see if it improves performance...

void targetMap_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {

            e.Handled = true;

            if (this.targetMap == null) { return; }
            if (this.targetMap.Extent == null) { return; }
            if ((e.DeltaManipulation.Translation.X == 0) && (e.DeltaManipulation.Translation.Y == 0) && (e.DeltaManipulation.Scale.X == 1)) { return; }

            
            Matrix transformationMatrix = new Matrix();
            if ((e.DeltaManipulation.Translation.X != 0) || (e.DeltaManipulation.Translation.Y != 0))
            {


                transformationMatrix.Translate(-e.DeltaManipulation.Translation.X, -e.DeltaManipulation.Translation.Y);

                
            }

            if (!e.IsInertial)
            {

                if (e.DeltaManipulation.Scale.X != 1)
                {
                    if (targetMap.TouchesCaptured.Count() > 1)
                    {
                        transformationMatrix.ScaleAt(1/e.DeltaManipulation.Scale.X, 1/e.DeltaManipulation.Scale.Y, e.ManipulationOrigin.X, e.ManipulationOrigin.Y);
                    }
                }
            }

            Envelope en = this.targetMap.Extent;
            Point screenTopLeft = this.targetMap.MapToScreen(new MapPoint(en.Extent.XMin, en.Extent.YMin));
            Point screenBottomRight = this.targetMap.MapToScreen(new MapPoint(en.Extent.XMax, en.Extent.YMax));

            Point newScreenTopLeft = transformationMatrix.Transform(screenTopLeft);
            Point newScreenBottomRight = transformationMatrix.Transform(screenBottomRight);

            MapPoint newMapTopLeft = this.targetMap.ScreenToMap(newScreenTopLeft);
            MapPoint newMapBottomRight = this.targetMap.ScreenToMap(newScreenBottomRight);

            this.targetMap.Extent = new Envelope(newMapTopLeft, newMapBottomRight);
        }
0 Kudos
JenniferNery
Esri Regular Contributor
You can try ArcGIS API for Microsoft Silverlight/WPF v2.1 http://help.arcgis.com/en/webapi/silverlight/2.1/
0 Kudos
linusang
Emerging Contributor
Hi Jennifer.. i just tried it... it is not as smooth and fluid that i expected(both panning and zooming)... well it's still beta i guess...

If you have played with the iPad's google map application... it is very smooth and natural... i'm wondering if you guys can achieve something like it?

i'm using Dell's SX2210T multi touch monitor btw....
0 Kudos
dotMorten_esri
Esri Notable Contributor
Are you seeing smoother animation when you use the mouse, compared to touch? If not, it could just be a performance issue with your graphics card. Especially if you are running your app at fullscreen (1920x1080 I assume), which requires loading a lot more tiles and large images compared to what the iPad would have to do. Also if you have a lot of layers and client side graphics, you are rendering more than you would be doing on the iPad.

However if you do see smooth animation when using your mouse, but not touch, it could be your touch device itself.
We have quite a few different touch screen devices here for testing, all using different touch technologies (although we don't have the Dell screen you mention). We've seen very different performance with these screens. Some are very flaky with respect to the consistency of the touch points reported, which in turn can make the touch experience less optimal. This is especially the case for the screens that are based on cameras in the corner just like your Dell screen.
We also have iPads here and have been comparing the touch experience to our WPF/Silverlight API, and in most cases its very comparable in the "feel" of it. Personally I have Lenovo x201 tablet, and this screens works very well with the WPF API.
0 Kudos