JSN ImageShow - Joomla 1.5 extension (component, module) by JoomlaShine.com
Home
Living Silver Desk Project architecture Stampa E-mail
Scritto da Gene   
luned́ 15 settembre 2008

 Living Silver Desk Project has been renamed to MIRIA Project, please refer to the MIRIA Project home page for the latest infos.

 

In order to let Silverlight2 applications receive input from multitouch devices, the MIG application must be running (Multi Input Gateway).

 

The MIG application works as a forwarder for UDP packets sent by TouchLib OSC.exe app. UDP packets are forwarded into an HTTP Stream which SL2 app can process trough the TouchListener class available in Living Silver Desk framework.

MIG actually runs as a standard application. perhaps it will be implemented as a system service in the next release.

The MIG application also includes a socket policy server (http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx).

 

Tangible...

 

Multitouch.TouchListener

The TUIO HTTP stream is received by the TouchListener class which propagates touch events within a given UIElement (or derived class) and its contained objects.

 

 

     // we get a reference to the main canvas

         Canvas myCanvas = (Canvas)this.FindName("Main");

         // we bind a new TouchListener on our main Canvas

         // so that contained elements can receive events from

         // multitouch and/or mice devices

         TouchListener mTouchInput = new TouchListener(myCanvas);

         // only elements implementing Touchable interface

         // will receive events

         TouchableObj obj = new TouchableObj();

         myCanvas.Children.Add(obj);

 

In this example, only myCanvas' children implementing the Multitouch.Touchable interface will receive events from TouchListener.


         public class TouchableObj : Canvas, MultiTouch.Touchable

         {

                  [...]

                  public void CursorAdd(String hid, Point p)

                  {

                           [...]

                  }

                  public void CursorUpdate(String hid, Point p)

                  {

                           [...]

                  }

                  public void CursorRemove(string hid)

                  {

                           [...]

                  }

         }

 

LivingSilverDesk.MultiTouch.Touchable Interface Reference

Public Member Functions :

void CursorAdd (string hid, Point p)

void CursorUpdate (string hid, Point p)

void CursorRemove (string hid) 

 

 

 

 

 

 

This interface is implemented in LivingSilverDesk.UIKit.Button, LivingSilverDesk.UIKit.ScrollView, and LivingSilverDesk.UIKit.TCanvas.


 

 Interpreting gestures within Touchable elements : the Gesture.Interpreter class

A gesture interpreter class is also provided. This class traces and analyzes cursors (fingers) movements received by Touchable elements and raises appropriate gesture events.

Each time a cursor is added/updated (see CursorAdd and CursorUpdate from Touchable interface) we pass cursor data to the Gestures.Interpreter.FingerUpdate method.

Once a known gesture is detected the Interpreter raise the matching event.

In the following example you can also notice the TransformHelper class that will be explained later.


         private Animations.TransformHelper transformHelper;

         private Gestures.Interpreter gesturesInterpreter;


         public TouchableObj()

         {

                  transformHelper = new Animations.TransformHelper(this);


                  gesturesInterpreter = new Gestures.Interpreter(this);

                  gesturesInterpreter.Translate += GestureTranslate;

                  gesturesInterpreter.Rotate += GestureRotate;

                  gesturesInterpreter.Scale += GestureScale;

         }


         private void GestureTranslate(Point c)

         {

                  transformHelper.Translate = new Point(transformHelper.Translate.X + c.X,

                  transformHelper.Translate.Y + c.Y);

         }

         private void GestureScale(double v)

         {

                  transformHelper.Scale *= nscale;

         }

         private void GestureRotate(double v)

         {

                  transformHelper.Angle += v;

         }


         public void CursorAdd(String hid, Point p)

         {

                  gesturesInterpreter.FingerUpdate(hid, p,

                                                                                 transformHelper.GetVertexes(),

                                                                                 transformHelper.GetCentroid());

         }

         public void CursorUpdate(String hid, Point p)

         {

                  gesturesInterpreter.FingerUpdate(hid, p,

                                                                                 transformHelper.GetVertexes(),

                                                                                 transformHelper.GetCentroid());

         }

         public void CursorRemove(string hid)

         {

                  gesturesInterpreter.FingerRemove(hid);

         }

         [...]


The Gestures.Interpreter.FingerUpdate method requires the following arguments:

  • String hid
    id of the cursor to add/update

  • Point p
    the coordinates of the cursor

  • PointCollection vertexes
    the vertexes of the shape, in most cases it is a four points collection for rectangular shapes

  • Point cn
    coordinates of the shape' centroid (center)


To easily obtain the last two parameters the TransformHelper class is being used in most cases.

In the current release Gestures.Interpreter class recognizes the following gestures:

  • Rotate

  • Translate

  • Scale

  • Tap

  • Double Tap

  • Hold

  • Release


 Animations.TransformHelper

This class helps you animating your application shapes in a smooth and realistic way.

It also gives you useful methods like GetTranslateTransform, GetScaleTransform, GetRotateTransform, mostly useful for storyboard animations.

A particular note for the GetVertexes and GetCentroid methods: [... to be continued =) ...]

TransformHelper is still under early development though already working fine. It will support physics (eg. acceleration) in next release.


         private Animations.TransformHelper transformHelper;


         public TouchableObj()

         {

                  transformHelper = new Animations.TransformHelper(this);

                  [...]

                  // Translate this shape to coordinates 10,10

                  transformHelper.Translate = new Point(10, 10);

                  // Set scale factor

                  transformHelper.Scale = 1.2;

                  // Set rotation angle of this shape (45 degrees)

                  transformHelper.Angle = 45;

         }

 

Animations.Actions class

[... doc to be continued =) stay tuned ...]

Please referer to online SDK http://www.generoso.info/gene/livingsilverdesk/docs/html/index.htm


 

UIKit package: Touch-Ready UI Elements for your Silverlight2 applications

[... doc to be continued =) stay tuned ...] 

Please referer to online SDK http://www.generoso.info/gene/livingsilverdesk/docs/html/index.html


 

Commenti
Nuovo Cerca RSS
Commenta
Nome:
Email:
 
Website:
Titolo:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Ultimo aggiornamento ( domenica 26 ottobre 2008 )
 
Pros. >
Free Joomla Templates