Pārlūkot izejas kodu

Merge branch 'master' of https://koljastrohm-games.com:3000/GraphDrawer/NodePlacementAnimation

Kolja Strohm 6 gadi atpakaļ
vecāks
revīzija
feea0fadd1

+ 25 - 1
doc/chapter/2architecture.tex

@@ -6,8 +6,12 @@ The following assumptions are made for the implementation of the node placement
     \item There are no labels.
     \item There are no labels.
     \item There are no cross-hierarchy edges.
     \item There are no cross-hierarchy edges.
     \item No edges over multiple layers (the previous phases should have added dummy nodes).
     \item No edges over multiple layers (the previous phases should have added dummy nodes).
+    \item Graphs are connected (maybe we will get rid of this assumption later, see~\ref{ch:progress}).
 \end{itemize}
 \end{itemize}
 
 
+\section{Components}\label{sec:components}
+\TODO{rough architecture}
+
 \section{Input File Format}\label{sec:inputFileFormat}
 \section{Input File Format}\label{sec:inputFileFormat}
 The input to \appname is a JSON file.
 The input to \appname is a JSON file.
 An example is displayed in figure~\ref{fig:json-example}.
 An example is displayed in figure~\ref{fig:json-example}.
@@ -30,6 +34,7 @@ The internal representation of graphs is further explained in the section~\ref{s
     The node can be wider if it contains other nodes that need more space. \\\hline
     The node can be wider if it contains other nodes that need more space. \\\hline
     height & integer & yes & The minimum height of the node.
     height & integer & yes & The minimum height of the node.
     The node can be higher if it contains other nodes that need more space. \\\hline
     The node can be higher if it contains other nodes that need more space. \\\hline
+    dummy & boolean & yes & Iff this is set to yes, then the node is a dummy node. \\\hline
     layers & list of lists of nodes & yes & The layers of nodes inside this node (Hierarchy). \\\hline
     layers & list of lists of nodes & yes & The layers of nodes inside this node (Hierarchy). \\\hline
     edges & list of edges & yes & The edges between nodes whose parent node is this node. \\\hline
     edges & list of edges & yes & The edges between nodes whose parent node is this node. \\\hline
     \caption{Node Attributes}
     \caption{Node Attributes}
@@ -83,6 +88,7 @@ Additionally, there are multiple attributes that are used during the computation
     They are summarized in table~\ref{table:bk-variables}.
     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 \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.
     \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}
 \end{itemize}
 Similarly, edges have additional attributes:
 Similarly, edges have additional attributes:
 \begin{itemize}
 \begin{itemize}
@@ -124,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.
 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]
 \begin{figure}[tp]
     \centering
     \centering
     \includegraphics[width=\linewidth, trim={0 9cm 0 0}]{img/Algorithms_Animated.pdf}
     \includegraphics[width=\linewidth, trim={0 9cm 0 0}]{img/Algorithms_Animated.pdf}
@@ -135,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.
 This section only covers the software architecture regarding the views.
 For an explanation of what is actually displayed, see chapter~\ref{ch:ui}
 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}

+ 4 - 3
doc/chapter/4progress.tex

@@ -10,7 +10,7 @@ The following features are either planned (\planned), under construction (\progr
     \begin{itemize}
     \begin{itemize}
         \item[\progress] Calculating the conflicts between edges.
         \item[\progress] Calculating the conflicts between edges.
         \begin{itemize}
         \begin{itemize}
-            \item[\planned] Differentiating between dummy nodes and non-dummy nodes.
+            \item[\progress] Differentiating between dummy nodes and non-dummy nodes.
         \end{itemize}
         \end{itemize}
         \item[\progress] Calculating the blocks.
         \item[\progress] Calculating the blocks.
         \item[\progress] Compacting the layout.
         \item[\progress] Compacting the layout.
@@ -32,6 +32,7 @@ The following features are either planned (\planned), under construction (\progr
     Currently there is only keyboard input (cf.\ section~\ref{sec:userInterface}).
     Currently there is only keyboard input (cf.\ section~\ref{sec:userInterface}).
     \item[\done] Working with hierarchical graphs.
     \item[\done] Working with hierarchical graphs.
     \item[\done] Scaling the display with the (adjustable) window size.
     \item[\done] Scaling the display with the (adjustable) window size.
-    \item[\planned] Creating ElkNode~\cite{noauthor_elk:_2018} objects from LayeredNode (\ref{sec:model}) objects
-    \item[\planned] Creating LayeredNode (\ref{sec:model}) objects from ElkNode~\cite{noauthor_elk:_2018} objects (low priority)
+    \item[\planned] Work with disconnected graphs (cf.\ section~\ref{sec:assumptions}), either by modifying the algorithm or by processing the connected components one by one.
+    \item[\planned] Creating ElkNode~\cite{noauthor_elk:_2018} objects from LayeredNode (\ref{sec:model}) objects.
+    \item[\planned] Creating LayeredNode (\ref{sec:model}) objects from ElkNode~\cite{noauthor_elk:_2018} objects (low priority).
 \end{itemize}
 \end{itemize}

BIN
material/jjc-mt.pdf


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

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