Commit 44060f57 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added example usage to architecture design in report.

parent 3268b80f
......@@ -103,7 +103,6 @@
\end{figure}
}
\newcommand{\trackerdiagram}[1]{
\begin{figure}[H]
\label{fig:trackerdiagram}
......@@ -125,54 +124,32 @@
\end{figure}
}
\newcommand{\examplediagrams}{
\newcommand{\examplediagram}[1]{
\begin{figure}[H]
\hspace{-2.3em}
\subfigure[Architecture using a single widget, demonstration gesture
delegation from the widget to the application. Dotted arrows
represent gestures, regular arrows represent events (unless
labeled otherwise).]{
\architecture{
\node[block, below of=driver] (eventdriver) {Event driver}
edge[linefrom] node[right, near end] {driver-specific messages} (driver);
\node[block, below of=eventdriver] (widget) {Widget}
edge[linefrom] (eventdriver);
\node[block, right of=widget, xshift=5em] (tracker) {Gesture tracker}
edge[lineto, dotted, bend left=10] (widget)
edge[linefrom, bend right=10] (widget);
\node[block, below of=widget] {Application}
edge[linefrom, dotted] node[right, near start] {delegation} (widget);
\group{eventdriver}{eventdriver}{tracker}{tracker}{Architecture}
}
}
\hspace{1.5em}
\subfigure[Architecture using a sub widget, demonstrating gesture
propagation. Dotted arrows represent gestures, regular arrows
represent events (unless labeled otherwise).]{
\architecture{
\node[block, below of=driver] (eventdriver) {Event driver}
edge[linefrom] node[right, near end] {driver-specific messages} (driver);
\center
\architecture{
\node[block, below of=driver] (eventdriver) {Event driver}
edge[linefrom] node[right, near end] {driver-specific messages} (driver);
\node[block, below of=eventdriver] (rootwidget) {Root widget}
edge[linefrom] (eventdriver);
\node[block, below of=eventdriver] (rootwidget) {Root widget}
edge[linefrom] (eventdriver);
\node[block, below of=rootwidget] (subwidget) {Sub widget}
edge[linefrom] (rootwidget)
edge[lineto, bend right=45] node[right=3] {propagation} (rootwidget);
\node[block, right of=rootwidget, xshift=5em] {Gesture tracker}
edge[lineto, dotted, bend left=10] (rootwidget)
edge[linefrom, bend right=10] (rootwidget);
\node[block, below of=rootwidget] (subwidget) {Button widget}
edge[linefrom] (rootwidget)
edge[lineto, bend right=45] node[right=3] {event propagation} (rootwidget);
\node[block, right of=rootwidget, xshift=5em] {\emph{pinch} tracker}
edge[lineto, dotted, bend left=10] (rootwidget)
edge[linefrom, bend right=10] (rootwidget);
\node[block, right of=subwidget, xshift=5em] (tracker) {Gesture tracker}
edge[lineto, dotted, bend left=10] (subwidget)
edge[linefrom, bend right=10] (subwidget);
\node[block, below of=subwidget, yshift=-.5em] {Application}
edge[linefrom, dotted, bend left=60] (rootwidget)
edge[linefrom, dotted] (subwidget);
\node[block, right of=subwidget, xshift=5em] (tracker) {\emph{tap} tracker}
edge[lineto, dotted, bend left=10] (subwidget)
edge[linefrom, bend right=10] (subwidget);
\node[block, below of=subwidget, yshift=-.5em] {Application}
edge[linefrom, dotted, bend left=60] (rootwidget)
edge[linefrom, dotted] (subwidget);
\group{subwidget}{eventdriver}{tracker}{subwidget}{Architecture}
}
\group{subwidget}{eventdriver}{tracker}{subwidget}{Architecture}
}
\caption{#1}
\end{figure}
}
......@@ -314,52 +314,53 @@ messages to some simple touch gestures that are used by a test application.
\ref{fig:widgetdiagram}, showing the position of gesture trackers in
the architecture.}
\section{Nog iets hier met example diagrams...}
% TODO
\section{Example usage}
This section describes an example that illustrates the API of the
architecture. The example application listens to tap events in a GUI
window.
architecture. The example application listens to tap events on a button.
The button is located inside an application window, which can be resized
using pinch gestures.
\begin{verbatim}
# Add a new window to the server, representing the GUI
widget = new rectangular Widget object
set widget position and size to that of the GUI window
initialize GUI, creating a window
# If the GUI toolkit allows it, bind window movement and resize handlers
# that alter the position size and sieze of the window object
# Add widgets representing the application window and button
rootwidget = new rectangular Widget object
set rootwidget position and size to that of the application window
buttonwidget = new rectangular Widget object
set buttonwidget position and size to that of the GUI button
# Create an event server that will be started later
server = new EventServer object
set widget as root widget for server
set rootwidget as root widget for server
# Define handlers and bind them to corresponding widgets
begin function resize_handler(gesture)
resize GUI window
update position and size of root wigdet
end function
# Define a handler that must be triggered when a tap gesture is detected
begin function handler(gesture)
# Do something
begin function tap_handler_handler(gesture)
# Perform some action that the button is meant to do
end function
# Bind the handler to the 'tap' event (the widget creates a tap tracker)
bind ('tap', handler) to widget
bind ('pinch', resize_handler) to rootwidget
bind ('tap', tap_handler) to buttonwidget
# Start event server (which in turn starts a driver-specific event server)
start server
\end{verbatim}
\examplediagram{Diagram representation of the example above. Dotted arrows
represent gestures, normal arrows represent events (unless labeled
otherwise).}
\chapter{Test applications}
% TODO
% testprogramma's met PyGame/Cairo
%\chapter{Conclusions}
% TODO
% Windows zijn een manier om globale events toe te wijzen aan vensters
% Trackers zijn een effectieve manier om gebaren te detecteren
% Trackers zijn uitbreidbaar door object-orientatie
\chapter{Suggestions for future work}
% TODO
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment