Parcourir la source

write on views

Eren Yilmaz il y a 6 ans
Parent
commit
14a4ad39f2
2 fichiers modifiés avec 22 ajouts et 3 suppressions
  1. 21 2
      doc/chapter/2architecture.tex
  2. 1 1
      src/Algorithms/Animated/AnimatedAlgorithm.java

+ 21 - 2
doc/chapter/2architecture.tex

@@ -9,7 +9,7 @@ The following assumptions are made for the implementation of the node placement
     \item Graphs are connected (maybe we will get rid of this assumption later, see~\ref{ch:progress}).
 \end{itemize}
 
-\section{Components}
+\section{Components}\label{sec:components}
 \TODO{rough architecture}
 
 \section{Input File Format}\label{sec:inputFileFormat}
@@ -88,6 +88,7 @@ Additionally, there are multiple attributes that are used during the computation
     They are summarized in table~\ref{table:bk-variables}.
     \item The \enquote{parent} of a node is the node that contains it in the hierarchy.
     \item The attributes $x$ and $y$ are the coordinates of the node relative to its parent node.
+    There is one coordinate for each of the four extremal layouts and on coordinate for the combined layout.
 \end{itemize}
 Similarly, edges have additional attributes:
 \begin{itemize}
@@ -129,6 +130,18 @@ All the stages are displayed in class diagram~\ref{fig:animated}.
 
 To be able to undo a step each stage needs to implement methods for both forward and backward steps.
 
+Note that the \enquote{AnimationController} is not a controller in the MVC sense that it processes user input, but in the sense that it \enquote{controls} the execution of steps/stages.
+This works the following:
+\begin{enumerate}
+    \item The main view creates a node placement algorithm (only \enquote{BKNodePlacement} available).
+    It sends a controller as a parameter for the constructor.
+    \item The algorithm concurrently asks the AnimationController if it should do a forward or backward step.
+    \item The AnimationController waits until it knows which action to take (for example if the user pressed the right arrow key).
+    Alternatively, if the animation is not paused, then it waits until a specific delay has passed.
+    Then it returns to the algorithm which step to take next.
+    \item The algorithm potentially calls the step function of other alogrithms while executing one step.
+\end{enumerate}
+
 \begin{figure}[tp]
     \centering
     \includegraphics[width=\linewidth, trim={0 9cm 0 0}]{img/Algorithms_Animated.pdf}
@@ -140,4 +153,10 @@ To be able to undo a step each stage needs to implement methods for both forward
 This section only covers the software architecture regarding the views.
 For an explanation of what is actually displayed, see chapter~\ref{ch:ui}
 
-\TODO{Kolja ausfragen}
+The distinguish two kinds of views:
+\begin{itemize}
+    \item The main window displays four regions for the different extremal layouts while also forwarding keyboard commands to the AnimationController.
+    For this we use a JFrame from the Swing library.
+    \item \enquote{EdgeView} and \enquote{NodeView} are JPanels, which means they can be drawn onto the JFrame.
+    For this they have to know about which part of the model and which layout they belong to.
+\end{itemize}

+ 1 - 1
src/Algorithms/Animated/AnimatedAlgorithm.java

@@ -18,7 +18,7 @@ public abstract class AnimatedAlgorithm extends Thread implements AlgorithmStage
 	@Override
 	public void run()
 	{
-		while( true )
+		while( true ) // if this loop would end we could not undo steps any more
 		{
 			try {
 				switch( ac.getNextAction() )