Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
multitouch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
multitouch
Commits
b7c9d41d
Commit
b7c9d41d
authored
Jun 03, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved translation of TUIO to pixel coordinates to TUIO server instead of gesture server.
parent
740a5e5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
16 deletions
+14
-16
TODO.txt
TODO.txt
+0
-1
src/server.py
src/server.py
+2
-9
src/tuio_server.py
src/tuio_server.py
+12
-6
No files found.
TODO.txt
View file @
b7c9d41d
...
...
@@ -2,7 +2,6 @@ Code:
- Connect to VTK.
- Rotation has a 'bump' at 0.
- tracker.gesture(...) instead of tracker.bind('gesture', ...)
- TODO: vertaling coordinaten doen in InputServer ipv GestureServer
Thesis:
- Network protocol.
...
...
src/server.py
View file @
b7c9d41d
...
...
@@ -2,7 +2,6 @@ from input_server import InputServerHandler
from
tuio_server
import
TuioServer2D
from
window
import
FullscreenWindow
from
point
import
TouchPoint
from
screen
import
pixel_coords
class
GestureServer
(
InputServerHandler
):
...
...
@@ -33,11 +32,8 @@ class GestureServer(InputServerHandler):
if
sid
in
self
.
points
:
raise
ValueError
(
'Point with sid %d already exists.'
%
sid
)
# Translate to pixel coordinates
px
,
py
=
pixel_coords
(
x
,
y
)
# Create a new touch point
self
.
points
[
sid
]
=
point
=
TouchPoint
(
px
,
p
y
,
sid
)
self
.
points
[
sid
]
=
point
=
TouchPoint
(
x
,
y
,
sid
)
# Save the windows containing the point in a dictionary, and update
# their trackers
...
...
@@ -50,12 +46,9 @@ class GestureServer(InputServerHandler):
if
sid
not
in
self
.
points
:
raise
KeyError
(
'No point with sid %d exists.'
%
sid
)
# Translate to pixel coordinates
px
,
py
=
pixel_coords
(
x
,
y
)
# Update point position and corresponding window trackers
point
=
self
.
points
[
sid
]
point
.
set_position
(
px
,
p
y
)
point
.
set_position
(
x
,
y
)
point
.
update_window_trackers
(
'move'
)
def
on_point_up
(
self
,
sid
):
...
...
src/tuio_server.py
View file @
b7c9d41d
...
...
@@ -2,6 +2,7 @@ from OSC import OSCServer
OSCServer
.
print_tracebacks
=
True
from
input_server
import
InputServer
from
screen
import
pixel_coords
class
TuioServer2D
(
InputServer
):
...
...
@@ -51,15 +52,20 @@ class TuioServer2D(InputServer):
if
sid
not
in
self
.
alive
:
raise
ValueError
(
'Point with sid "%d" is not alive.'
%
sid
)
# Translate to pixel coordinates
px
,
py
=
pixel_coords
(
x
,
y
)
# Check if 'point_down' has already been triggered. If so, trigger
# a 'point_move' event instead
if
sid
in
self
.
down
:
self
.
debug
(
'Moved %d to (%s, %s).'
%
(
sid
,
x
,
y
))
self
.
handler_obj
.
on_point_move
(
sid
,
x
,
y
)
self
.
debug
(
'Moved %d to (%.4f, %.4f) or (%d, %d).'
%
(
sid
,
x
,
y
,
px
,
py
))
self
.
handler_obj
.
on_point_move
(
sid
,
px
,
py
)
else
:
self
.
debug
(
'Down %d at (%s, %s).'
%
(
sid
,
x
,
y
))
self
.
debug
(
'Down %d at (%.4f, %.4f) or (%d, %d).'
%
(
sid
,
x
,
y
,
px
,
py
))
self
.
down
.
add
(
sid
)
self
.
handler_obj
.
on_point_down
(
sid
,
x
,
y
)
self
.
handler_obj
.
on_point_down
(
sid
,
px
,
p
y
)
def
run
(
self
):
self
.
server
.
handle_request
()
...
...
@@ -98,13 +104,13 @@ if __name__ == '__main__':
# Define handlers
class
Handler
(
InputServerHandler
,
Logger
):
def
on_point_down
(
self
,
sid
,
x
,
y
):
self
.
info
(
'Point down: sid=%d (%
s, %s
)'
%
(
sid
,
x
,
y
))
self
.
info
(
'Point down: sid=%d (%
.4f, %.4f
)'
%
(
sid
,
x
,
y
))
def
on_point_up
(
self
,
sid
):
self
.
info
(
'Point up: sid=%d'
%
sid
)
def
on_point_move
(
self
,
sid
,
x
,
y
):
self
.
info
(
'Point move: sid=%d (%
s, %s
)'
%
(
sid
,
x
,
y
))
self
.
info
(
'Point move: sid=%d (%
.4f, %.4f
)'
%
(
sid
,
x
,
y
))
server
=
TuioServer2D
(
Handler
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment