Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## eu.ensam.ii.vrpn
Class VrpnSurface

    java.lang.Object
      android.view.SurfaceView
          eu.ensam.ii.vrpn.VrpnSurface

    public class VrpnSurface

extends SurfaceView

This `SurfaceView` updates two Vrpn Analog channels with the coordinates of the Surface point that is touched.

Updates are sent as long astouch events occur within the surface. The X channel range from `app:leftX` to `app:rightX`, and the Y channel values range from `app:topY` to `app:bottomY`.

In your layout, declare the following (note the `app:` attributes)

     <eu.ensam.ii.vrpn.VrpnSurface
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       app:leftX="-1"
       app:rightX="1"
       app:topY="0"
       app:bottomY="1"
       app:vrpnAnalogX="@id/MyVrpnAnalogX"
       app:vrpnAnalogY="@id/MyVrpnAnalogY"
     />

The root element of the layout must declare the following line just after the `xmlns:android ...` line :

       xmlns:app="http://schemas.android.com/apk/res/your.package.name.here"

Custom XML attributes :

- `app:vrpnAnalogX` : the id of the Vrpn analog that will receive the X position of the touch event from this widget. The update value sent to the Vrpn analog ranges from the `app:leftX` value to the `app:rightX` value.
- `app:vrpnAnalogY` : the id of the Vrpn analog that will receive the Y position of the touch event from this widget. The update value sent to the Vrpn analog ranges from the `app:bottomY` value to the `app:topX` value.
- `app:leftX` : the numeric value mapped onto the left border of the surface.
- `app:rightX` : the numeric value mapped onto the right border of the surface. May be greater or lower than `app:leftX`.
- `app:bottomY` : the numeric value mapped onto the top border of the surface
- `app:topY` : the numeric value mapped onto the top border of the surface. May be greater or lower than `app:bottomY`

The `app:vrpnAnalogX` and `app:vrpnAnalogY` ids can be literals or a resource Ids. These resource ids may be kept in a separate Vrpn Id list

Constructor Summary
`VrpnSurface(Context context)`
`VrpnSurface(Context context, AttributeSet attrs)`
`VrpnSurface(Context context, AttributeSet attrs, int defStyle)`

Method Summary
`boolean` | `onTouch(View v, MotionEvent event)` Called when a touch event is dispatched to this widget.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### VrpnSurface

    public VrpnSurface(Context context)

### VrpnSurface

    public VrpnSurface(Context context,
                       AttributeSet attrs)

### VrpnSurface

    public VrpnSurface(Context context,
                       AttributeSet attrs,
                       int defStyle)

Method Detail

### onTouch

    public boolean onTouch(View v,
                           MotionEvent event)

  Called when a touch event is dispatched to this widget.

  If the touch event occurs within the surface of the view, two analog Vrpn updates are send for the X and y position. Updates are sent when ACTION_DOWN, ACTION_MOVE, and ACTION_UP are received. the event history is ignored.

  See Also:
    `View.OnTouchListener`, `MotionEvent`

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD