Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multitouch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
multitouch
Commits
b7c9d41d
Commit
b7c9d41d
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Moved translation of TUIO to pixel coordinates to TUIO server instead of gesture server.
parent
740a5e5b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
TODO.txt
+0
-1
0 additions, 1 deletion
TODO.txt
src/server.py
+2
-9
2 additions, 9 deletions
src/server.py
src/tuio_server.py
+12
-6
12 additions, 6 deletions
src/tuio_server.py
with
14 additions
and
16 deletions
TODO.txt
+
0
−
1
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.
...
...
This diff is collapsed.
Click to expand it.
src/server.py
+
2
−
9
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
(
p
x
,
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
(
p
x
,
p
y
)
point
.
set_position
(
x
,
y
)
point
.
update_window_trackers
(
'
move
'
)
def
on_point_up
(
self
,
sid
):
...
...
This diff is collapsed.
Click to expand it.
src/tuio_server.py
+
12
−
6
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
,
p
x
,
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
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment