tillnagel / unfolding

A library to create interactive maps and geovisualizations in Processing and Java
http://unfoldingmaps.org
Other
478 stars 246 forks source link

TUIO 1.1.5 not compatible with Unfolding (Trouble with Multitouch Map App example) #83

Open chris-ann opened 10 years ago

chris-ann commented 10 years ago

Hi there,

I'm new to this Github forum but I've been using Unfolding for the last few months and thought I had the hang of it until I got to referencing the Multitouch Map App example: https://github.com/tillnagel/unfolding/blob/87f707ff57417e00c0e9ec1feccb5b720e29701c/examples/de/fhpotsdam/unfolding/examples/interaction/multitouch/MultitouchMapApp.java

I'm having difficulty adapting it for my processing sketch, I keep getting errors or the touch interactions don't work at all. I understand that there are portions of the code that are unnecessary to copy from Github into processing (ex. at the top the package de.fhpotsdam.... ect.) But I'm totally lost on the need to include the MultitouchMapApp class around setup() and draw().

Does anyone have a .pde example of the MultitouchMapApp that has the code as it should appear in processing? Any guidance would be so greatly appreciated!!!

And any guidance on how to interpret future Github examples...

Thanks in advance :)

tillnagel commented 10 years ago

You'll need to install the TUIO library for Processing. See the http://www.tuio.org/?software (linked in the MultitouchMapApp example) and download TUIO_Processing.zip from there. Then, unpack the ZIP, and either put them as library into your Processing IDE, or create a 'code' folder in your sketch folder.

Then, it should run. Note, however, that you'll need a multitouch device capable of sending TUIO commands (again, see the comment at the top of the example class), e.g. on my Macbook I use Tongseng, and the trackpad.

import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.events.EventDispatcher;
import de.fhpotsdam.unfolding.interactions.TuioCursorHandler;

UnfoldingMap map;
TuioCursorHandler tuioCursorHandler;

public void setup() {
  size(800, 600, OPENGL);

  // Init the map
  map = new UnfoldingMap(this);

  EventDispatcher eventDispatcher = new EventDispatcher();
  // Create multitouch input handler, and register map to listen to pan and zoom events.
  tuioCursorHandler = new TuioCursorHandler(this, map);
  eventDispatcher.addBroadcaster(tuioCursorHandler);
  eventDispatcher.register(map, "pan");
  eventDispatcher.register(map, "zoom");
}

public void draw() {
  background(0);

  map.draw();

  // Shows position of fingers for debugging.
  tuioCursorHandler.drawCursors();
}

Files & Folders:

code
    libTUIO.jar
    TUIO.jar
MultitouchMapApp.pde
miccferr commented 9 years ago

Hi there! I'm re-opening this issue since I'm having similar troubles to @chris-ann 's.
I structured the sketch folder as you indicated, have the TUIO and Unfolding libraries in my sketchbook (using Processing 2.xx), and I'm testing the sketch you posted above on a Macbook with TongSeng.
But I keep getting this error:

"NoSuchMethodError: You may be using a library that's incompatible with this version of Processing."

Unfolding Map v0.9.6
Using OpenGLMapDisplay with processing.opengl.PGraphics3D
java.lang.NoSuchMethodError: TUIO.TuioCursor.getPath()Ljava/util/Vector;
    at de.fhpotsdam.unfolding.interactions.TuioCursorHandler.updateTuioCursor(Unknown Source)
    at TUIO.TuioClient.acceptMessage(TuioClient.java:503)
    at com.illposed.osc.utility.OSCPacketDispatcher.dispatchMessage(OSCPacketDispatcher.java:73)
    at com.illposed.osc.utility.OSCPacketDispatcher.dispatchPacket(OSCPacketDispatcher.java:49)
    at com.illposed.osc.utility.OSCPacketDispatcher.dispatchBundle(OSCPacketDispatcher.java:56)
    at com.illposed.osc.utility.OSCPacketDispatcher.dispatchPacket(OSCPacketDispatcher.java:40)
    at com.illposed.osc.OSCPortIn.run(OSCPortIn.java:65)
    at java.lang.Thread.run(Thread.java:745)

Is it related to the sketch's folder structure? To a different version of unfolding and processing?

It truly puzzles me..

Thanks in advance for any help!

tillnagel commented 9 years ago

Ok, it might be due to some TUIO method having changed (namely TuioCursor.getPath()) from returning ArrayList instead of Vector) without updating the JavaDoc (see http://www.tuio.org/api/java/TUIO/TuioCursor.html#getPath%28%29).

For a quick fix, use the old 1.1.4 version of TUIO for Processing. http://sourceforge.net/projects/reactivision/files/TUIO%201.0/TUIO-Clients%201.4/