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 @@ ...@@ -103,7 +103,6 @@
\end{figure} \end{figure}
} }
\newcommand{\trackerdiagram}[1]{ \newcommand{\trackerdiagram}[1]{
\begin{figure}[H] \begin{figure}[H]
\label{fig:trackerdiagram} \label{fig:trackerdiagram}
...@@ -125,54 +124,32 @@ ...@@ -125,54 +124,32 @@
\end{figure} \end{figure}
} }
\newcommand{\examplediagrams}{ \newcommand{\examplediagram}[1]{
\begin{figure}[H] \begin{figure}[H]
\hspace{-2.3em} \center
\subfigure[Architecture using a single widget, demonstration gesture \architecture{
delegation from the widget to the application. Dotted arrows \node[block, below of=driver] (eventdriver) {Event driver}
represent gestures, regular arrows represent events (unless edge[linefrom] node[right, near end] {driver-specific messages} (driver);
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);
\node[block, below of=eventdriver] (rootwidget) {Root widget} \node[block, below of=eventdriver] (rootwidget) {Root widget}
edge[linefrom] (eventdriver); edge[linefrom] (eventdriver);
\node[block, below of=rootwidget] (subwidget) {Sub widget} \node[block, below of=rootwidget] (subwidget) {Button widget}
edge[linefrom] (rootwidget) edge[linefrom] (rootwidget)
edge[lineto, bend right=45] node[right=3] {propagation} (rootwidget); edge[lineto, bend right=45] node[right=3] {event propagation} (rootwidget);
\node[block, right of=rootwidget, xshift=5em] {Gesture tracker} \node[block, right of=rootwidget, xshift=5em] {\emph{pinch} tracker}
edge[lineto, dotted, bend left=10] (rootwidget) edge[lineto, dotted, bend left=10] (rootwidget)
edge[linefrom, bend right=10] (rootwidget); edge[linefrom, bend right=10] (rootwidget);
\node[block, right of=subwidget, xshift=5em] (tracker) {Gesture tracker} \node[block, right of=subwidget, xshift=5em] (tracker) {\emph{tap} tracker}
edge[lineto, dotted, bend left=10] (subwidget) edge[lineto, dotted, bend left=10] (subwidget)
edge[linefrom, bend right=10] (subwidget); edge[linefrom, bend right=10] (subwidget);
\node[block, below of=subwidget, yshift=-.5em] {Application} \node[block, below of=subwidget, yshift=-.5em] {Application}
edge[linefrom, dotted, bend left=60] (rootwidget) edge[linefrom, dotted, bend left=60] (rootwidget)
edge[linefrom, dotted] (subwidget); edge[linefrom, dotted] (subwidget);
\group{subwidget}{eventdriver}{tracker}{subwidget}{Architecture} \group{subwidget}{eventdriver}{tracker}{subwidget}{Architecture}
}
} }
\caption{#1}
\end{figure} \end{figure}
} }
...@@ -314,52 +314,53 @@ messages to some simple touch gestures that are used by a test application. ...@@ -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 \ref{fig:widgetdiagram}, showing the position of gesture trackers in
the architecture.} the architecture.}
\section{Nog iets hier met example diagrams...}
% TODO
\section{Example usage} \section{Example usage}
This section describes an example that illustrates the API of the This section describes an example that illustrates the API of the
architecture. The example application listens to tap events in a GUI architecture. The example application listens to tap events on a button.
window. The button is located inside an application window, which can be resized
using pinch gestures.
\begin{verbatim} \begin{verbatim}
# Add a new window to the server, representing the GUI initialize GUI, creating a window
widget = new rectangular Widget object
set widget position and size to that of the GUI window
# If the GUI toolkit allows it, bind window movement and resize handlers # Add widgets representing the application window and button
# that alter the position size and sieze of the window object 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 # Create an event server that will be started later
server = new EventServer object 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 tap_handler_handler(gesture)
begin function handler(gesture) # Perform some action that the button is meant to do
# Do something
end function end function
# Bind the handler to the 'tap' event (the widget creates a tap tracker) bind ('pinch', resize_handler) to rootwidget
bind ('tap', handler) to widget bind ('tap', tap_handler) to buttonwidget
# Start event server (which in turn starts a driver-specific event server) # Start event server (which in turn starts a driver-specific event server)
start server start server
\end{verbatim} \end{verbatim}
\examplediagram{Diagram representation of the example above. Dotted arrows
represent gestures, normal arrows represent events (unless labeled
otherwise).}
\chapter{Test applications} \chapter{Test applications}
% TODO % TODO
% testprogramma's met PyGame/Cairo % 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} \chapter{Suggestions for future work}
% TODO % 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