22 Commits cb7a849633 ... 521251cd30

Author SHA1 Message Date
  Rumei 521251cd30 changed back to trackable 5 years ago
  Rumei ace626d450 minor changes 5 years ago
  Rumei 215efb66b7 comments added and rearanged code 5 years ago
  Rumei e64e93eae7 small changes 5 years ago
  Rumei 2bc3ff794a merged 5 years ago
  Rumei e39adf3cee small changes for expertenevaluation 5 years ago
  Rumei 1f1e0efe2d testing pInvoke 5 years ago
  Martin Edlund bdc87c57f5 Merge, cleanup and optimisation: 5 years ago
  Martin Edlund a674035906 Re-added debug options, 5 years ago
  Rumei 93d1767f7f removed RightCanvas.Cursor = Cursors.AppStarting 5 years ago
  Rumei 51dc6f5485 minor fix 5 years ago
  Rumei 10785de5e4 ready for testing of setCurPos 5 years ago
  Rumei 3f5b003c53 merged 5 years ago
  Rumei 05365b087e minor changes 5 years ago
  videowall-pc-user 7bad5a23c7 updated parameter 5 years ago
  Rumei 48ab2050cc added Armband dummy 5 years ago
  videowall-pc-user 90b8aa80a0 new ttp file 5 years ago
  Rumei ba9d740392 ready for testing 5 years ago
  Rumei 6a772e547c minor changes 5 years ago
  Rumei 382ac72383 functions in Model extended 5 years ago
  videowall-pc-user c39a2397a0 optitrack working 5 years ago
  Rumei 66e0fbec4b testing 5 years ago
38 changed files with 3333 additions and 376 deletions
  1. 25 6
      .appveyor.yml
  2. 13 0
      Finished Userstories/userstory15.md
  3. 13 0
      Finished Userstories/userstory16.md
  4. 13 0
      Finished Userstories/userstory18.md
  5. 13 0
      Finished Userstories/userstory21.md
  6. 2 2
      Finished Userstories/userstory6.md
  7. 4 1
      README.md
  8. 13 0
      SketchAssistant/GenerateCoverageReport.bat
  9. 15 0
      SketchAssistant/SketchAssistant.sln
  10. BIN
      SketchAssistant/SketchAssistant/optitrack_setup.ttp
  11. 70 0
      SketchAssistant/SketchAssistantWPF/Armband.cs
  12. 0 0
      SketchAssistant/SketchAssistantWPF/DebugData.cs
  13. 1550 7
      SketchAssistant/SketchAssistantWPF/FileImporter.cs
  14. 2 2
      SketchAssistant/SketchAssistantWPF/Frame.cs
  15. 0 48
      SketchAssistant/SketchAssistantWPF/GeometryCalculator.cs
  16. 11 16
      SketchAssistant/SketchAssistantWPF/InternalLine.cs
  17. 245 43
      SketchAssistant/SketchAssistantWPF/MVP_Model.cs
  18. 149 100
      SketchAssistant/SketchAssistantWPF/MVP_Presenter.cs
  19. 9 8
      SketchAssistant/SketchAssistantWPF/MVP_View.cs
  20. 73 26
      SketchAssistant/SketchAssistantWPF/MainWindow.xaml
  21. 137 82
      SketchAssistant/SketchAssistantWPF/MainWindow.xaml.cs
  22. 2 2
      SketchAssistant/SketchAssistantWPF/OptiTrackConnector.cs
  23. 32 0
      SketchAssistant/SketchAssistantWPF/SketchAssistantWPF.csproj
  24. 6 0
      SketchAssistant/SketchAssistantWPF/packages.config
  25. 585 32
      SketchAssistant/WhiteTests/UITest.cs
  26. 47 1
      SketchAssistant/WhiteTests/WhiteTests.csproj
  27. 10 0
      SketchAssistant/WhiteTests/test.runsettings
  28. 30 0
      SketchAssistant/WhiteTests/test_input_files/blacklisted/all_no_size_def_in_header.svg
  29. 29 0
      SketchAssistant/WhiteTests/test_input_files/blacklisted/all_unclosed.svg
  30. 30 0
      SketchAssistant/WhiteTests/test_input_files/whitelisted/all.svg
  31. 14 0
      SketchAssistant/WhiteTests/test_input_files/whitelisted/circle_ellipse.svg
  32. 10 0
      SketchAssistant/WhiteTests/test_input_files/whitelisted/line.svg
  33. 21 0
      SketchAssistant/WhiteTests/test_input_files/whitelisted/path.svg
  34. 10 0
      SketchAssistant/WhiteTests/test_input_files/whitelisted/polygon.svg
  35. 11 0
      SketchAssistant/WhiteTests/test_input_files/whitelisted/polyline.svg
  36. 13 0
      SketchAssistant/WhiteTests/test_input_files/whitelisted/rect.svg
  37. BIN
      SketchAssistant/optitrack_setup.ttp
  38. 126 0
      screenres.ps1

+ 25 - 6
.appveyor.yml

@@ -1,8 +1,27 @@
 image:
- - Visual Studio 2017
- 
+    - Visual Studio 2017
+
 install:
- - "nuget install TestStack.White"
- - "nuget install MSTest.TestAdapter"
- - "nuget install MSTest.TestFramework"
- - "nuget restore SketchAssistant/SketchAssistant.sln"
+    - "nuget install TestStack.White"
+    - "nuget install MSTest.TestAdapter"
+    - "nuget install MSTest.TestFramework"
+    - "nuget restore SketchAssistant/SketchAssistant.sln"
+
+before_build:
+    - ps: .\screenres.ps1
+
+artifacts:
+    - path: \SketchAssistant\GeneratedReports\
+#  - path: SketchAssistant/WhiteTests/test_input_files/whitelisted/*.svg
+#    name: whitelisted svg files for testing
+#  - path: SketchAssistant/WhiteTests/test_input_files/blacklisted/*.svg
+#    name: blacklisted svg files for testing
+
+before_test:
+    - ps: "SketchAssistant/GenerateCoverageReport.bat"
+
+test:
+    #don't run tests depending on [DeploymentItem] and filesystem access
+    categories:
+        except:
+            - FileIO

+ 13 - 0
Finished Userstories/userstory15.md

@@ -0,0 +1,13 @@
+# Userstory 15  
+ 
+|**ID**|15|  
+|-|-|
+|**Name**|Schöne Linien|
+|**Beschreibung**|Als Auftraggeber wünsche ich, dass die Linien die gezeichnet werden, an den Enden dünner und in der Mitte dicker sind, um einem echten Stift zu ähneln.|
+|**Akzeptanzkriterium**|Die Userstory wird akzeptiert, wenn die vom Anwender gezeichnete Line am Anfang schmaler ist, im Verlauf etwas breiter wird und am Ende wieder so schmal wie am Anfang ist.|
+|Geschätzter Aufwand (Story Points)|10|
+|Entwickler|Tim|
+|Umgesetzt in Iteration|9|
+|Tatsächlicher Aufwand (Std.)|keine|
+|Velocity (Std./Story Point)|keine|
+|Bemerkungen|Wurde durch Userstory 16 umgesetzt|

+ 13 - 0
Finished Userstories/userstory16.md

@@ -0,0 +1,13 @@
+# Userstory 16  
+ 
+|**ID**|16|  
+|-|-|
+|**Name**|Änderung der Nutzeroberfläche & wpf|
+|**Beschreibung**|Die Nutzeroberfläche wird an die neuen Anforderungen des Auftraggebers angepasst.|
+|**Akzeptanzkriterium**|Die Userstory ist akzeptiert, wenn die UI eine Zeichenfläche enthält und eine Fläche zum Anzeigen von Grafiken, sowie alle vorherig verfügbare Knöpfe. Zusätzlich ist erforderlich, dass die UI statt auf WinForms auf WPF basiert. Auch sollen die Knöpfe in der Toolbar durch Symbole, statt durch Text markiert sein, und es einen Edit Button gibt in welchem zusätzlich die Funktionen vorhanden sind.|
+|Geschätzter Aufwand (Story Points)|10|
+|Entwickler|Martin Edlund|
+|Umgesetzt in Iteration|9|
+|Tatsächlicher Aufwand (Std.)|30|
+|Velocity (Std./Story Point)|3|
+|Bemerkungen|Keine|

+ 13 - 0
Finished Userstories/userstory18.md

@@ -0,0 +1,13 @@
+# Userstory 18  
+ 
+|**ID**|18|  
+|-|-|
+|**Name**|Antialiasing|
+|**Beschreibung**|Als Auftraggeber möchte ich eine möglichst saubere Linie auf dem Bildschrim sehen, das heißt, dass die Kanten der Pixel geglättet werden.|
+|**Akzeptanzkriterium**|Die Breite der Linie wird an die Größe des Bildes in der rechten Picturebox angepasst. Zudem soll Antialiasing auf die Linien angewendet werden, damit diese glatte Kanten aufweisen.|
+|Geschätzter Aufwand (Story Points)|keine|
+|Entwickler|keiner|
+|Umgesetzt in Iteration|9|
+|Tatsächlicher Aufwand (Std.)|keine|
+|Velocity (Std./Story Point)|keine|
+|Bemerkungen|Wurde durch Userstory 16 gelöst|

+ 13 - 0
Finished Userstories/userstory21.md

@@ -0,0 +1,13 @@
+# Userstory 21  
+ 
+|**ID**|21|  
+|-|-|
+|**Name**|InkCanvas|
+|**Beschreibung**|Bei den manuellen Tests haben sich beim zeichnen auserhalb der vorgesehnen Zeichenoberfläche Fehler ergeben. Als Programmierer benötige ich eine Oberfläche, die resistenter gegen solche Fehler ist.|
+|**Akzeptanzkriterium**|InkCanvas soll verwendet werden, um die aktuelle Linie zu zeichnen und anzuzeigen.|
+|Geschätzter Aufwand (Story Points)|5|
+|Entwickler|Tim Reischl|
+|Umgesetzt in Iteration|13|
+|Tatsächlicher Aufwand (Std.)|30|
+|Velocity (Std./Story Point)|6|
+|Bemerkungen|Keine|

+ 2 - 2
Finished Userstories/userstory6.md

@@ -4,10 +4,10 @@
 |-|-|
 |**Name**|Löschfunktionalität|
 |**Beschreibung**|Man kann einen Knopf in der UI drücken um in den Löschmodus zu kommen, und um wieder aus dem Löschmodus rauszukommen. Wenn man im Löschmodus ist, kann man auf einer Leinwand im rechten Bereich gezeichnete Elemente löschen indem man auf sie klickt.|
-|**Akzeptanzkriterium**|Der Knopf für den Löschmodus kann nur gedrückt werden, wenn im rechten Bereich eine Zeichennleinwand vorhanden ist. Wenn man den Knopf drückt ohne im Löschmodus zu sein, verändert sich der Knopf erkennbar und man kommt in den Löschmodus. Drückt man den Knopf, während man im Löschmodus ist, wird der Löschmodus beendet und der Knopf bekommt wieder sein urspüngliches Aussehen. Während man im Löschmodus ist, kann man auf der Leinwand im rechten Bereich Elemente löschen, wenn der Mauszeiger sie berührt während man die Maustaste gedrückt hält. Die Elemente die man löscht verschwinden. Drückt man den Löschknopf während man in einem anderen Modus ist (z.B. Zeichenmodus) wird der andere Modus beendet und man ist im Löschmodus.|
+|**Akzeptanzkriterium**|Der Knopf für den Löschmodus kann nur gedrückt werden, wenn im rechten Bereich eine Zeichennleinwand vorhanden ist. Wenn man den Knopf drückt ohne im Löschmodus zu sein, verändert sich der Knopf erkennbar und man kommt in den Löschmodus. Drückt man den Knopf, während man im Löschmodus ist, bleibt der Knopf gleich und man ist immer noch im Löschmodus. Während man im Löschmodus ist, kann man auf der Leinwand im rechten Bereich Elemente löschen, wenn der Mauszeiger sie berührt während man die Maustaste gedrückt hält. Die Elemente die man löscht verschwinden. Drückt man den Löschknopf während man in einem anderen Modus ist (z.B. Zeichenmodus) wird der andere Modus beendet und man ist im Löschmodus.|
 |Geschätzter Aufwand (Story Points)|16|
 |Entwickler|Martin Edlund, Tim Reischl|
 |Umgesetzt in Iteration|3|
 |Tatsächlicher Aufwand (Std.)|14,5|
 |Velocity (Std./Story Point)|0,90625|
-|Bemerkungen|Keine|
+|Bemerkungen|Keine|

+ 4 - 1
README.md

@@ -1 +1,4 @@
-# BP-SketchAssistant
+# Interactive Sketch Assistant
+[![Build status](https://ci.appveyor.com/api/projects/status/yvefugnjqwc8649y?svg=true)](https://ci.appveyor.com/project/m-edlund/bp-sketchassistant)
+
+A Sketch Assistant to help you with sketching

+ 13 - 0
SketchAssistant/GenerateCoverageReport.bat

@@ -0,0 +1,13 @@
+if not exist "%~dp0GeneratedReports" mkdir "%~dp0GeneratedReports"
+
+"%~dp0\packages\OpenCover.4.7.922\tools\OpenCover.Console.exe" ^
+-register:user ^
+-target:"%~dp0\packages\Microsoft.TestPlatform.16.0.0\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" ^
+-targetargs:"%~dp0\WhiteTests\bin\Debug\WhiteTests.dll" ^
+-filter:"+[SketchAssistantWPF*]*" ^
+-mergebyhash ^
+-output:"%~dp0\GeneratedReports\opencovertests.xml"
+
+"%~dp0\packages\ReportGenerator.4.0.14\tools\net47\ReportGenerator.exe" ^
+-reports:"%~dp0\GeneratedReports\opencovertests.xml" ^
+-targetdir:"%~dp0\GeneratedReports\ReportGeneratorOutput"

+ 15 - 0
SketchAssistant/SketchAssistant.sln

@@ -7,20 +7,35 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SketchAssistantWPF", "Sketc
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WhiteTests", "WhiteTests\WhiteTests.csproj", "{EB09C624-91F2-465F-825B-559BF7A7D5CB}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CoverageTools", "CoverageTools", "{A179F8A5-FBEB-4DBB-8AF4-DD1B5C714A8F}"
+	ProjectSection(SolutionItems) = preProject
+		GenerateCoverageReport.bat = GenerateCoverageReport.bat
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
+		Debug|x86 = Debug|x86
 		Release|Any CPU = Release|Any CPU
+		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Debug|x86.ActiveCfg = Debug|x86
+		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Debug|x86.Build.0 = Debug|x86
 		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Release|x86.ActiveCfg = Release|x86
+		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Release|x86.Build.0 = Release|x86
 		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Debug|x86.Build.0 = Debug|Any CPU
 		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Release|x86.ActiveCfg = Release|Any CPU
+		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

BIN
SketchAssistant/SketchAssistant/optitrack_setup.ttp


+ 70 - 0
SketchAssistant/SketchAssistantWPF/Armband.cs

@@ -0,0 +1,70 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace SketchAssistantWPF
+{
+    internal class Armband
+    {
+        //[StructLayout(LayoutKind.Sequential)]
+        //public class BodyActuator
+        //{
+        //    enum BodyActuator_Type
+        //    {
+        //        BODYACTUATOR_TYPE_NONE,
+        //        BODYACTUATOR_TYPE_EAI,
+        //        BODYACTUATOR_TYPE_PIEZO,
+        //        BODYACTUATOR_TYPE_ERM,
+        //        BODYACTUATOR_TYPE_EMS
+        //    };
+        //    bool valid;
+        //    ushort actuatorCount;
+        //    BodyActuator_Type type;
+        //    ArduinoHub arduinoHub;
+        //    EAIHub eaiHub;
+        //}
+
+
+        //[StructLayout(LayoutKind.Sequential)]
+        //public class EAIHub
+        //{
+        //    bool valid;
+        //    pthread_mutex_t mutex; //TODO fix this
+        //    pthread_t thread;
+        //    Actuator* actuators; //TODO
+        //    uint tactorType;
+        //    uint modulation;
+        //    int deviceID;
+        //}
+
+        //[StructLayout(LayoutKind.Sequential)]
+        //public class ArduinoHub
+        //{
+        //    enum ArduinoHub_Type
+        //    {
+        //        ARDUINOHUB_TYPE_PIEZO = 'P',
+        //        ARDUINOHUB_TYPE_ERM = 'E',
+        //        ARDUINOHUB_TYPE_EMS = 'M'
+        //    }
+        //    bool valid;
+        //    pthread_mutex_t mutex; //TODO fix this
+        //    pthread_t thread;
+        //    ArduinoHub_Type arduinoType;
+        //    Serial* serial;
+        //    Actuator* actuators;
+        //}
+
+        //[DllImport("BodyActuator.dll", EntryPoint = "BodyActuator_actuate")]
+        //static extern void pushForward(ref BodyActuator self, byte tactor, double intensity, ulong duration);
+
+        internal void pushForward()
+        {
+            Console.WriteLine("FORWARD_PUSH");
+        }
+
+        internal void pushBackward()
+        {
+            Console.WriteLine("BACKWARD_PUSH");
+        }
+    }
+}

File diff suppressed because it is too large
+ 0 - 0
SketchAssistant/SketchAssistantWPF/DebugData.cs


+ 1550 - 7
SketchAssistant/SketchAssistantWPF/FileImporter.cs

@@ -1,5 +1,7 @@
 using System;
 using System.Collections.Generic;
+//using System.Drawing;
+using System.Globalization;
 using System.Windows;
 using System.Linq;
 using System.Text;
@@ -10,6 +12,32 @@ namespace SketchAssistantWPF
 {
     public class FileImporter
     {
+
+        /// <summary>
+        /// scale factor for coordinates of svg file
+        /// </summary>
+        double scale;
+
+        /// <summary>
+        /// line pointer for the current svg document
+        /// </summary>
+        int i;
+
+        /// <summary>
+        /// array containing all characters interpreted as whitespaces which seperate words/tokens in the input file
+        /// </summary>
+        readonly char[] whitespaces = new char[] { ' ', ',' };
+
+        /// <summary>
+        /// number of points to create along the outline of an ellipse, divisible by 4
+        /// </summary>
+        readonly int samplingRateEllipse = 12;
+
+        /// <summary>
+        /// number of points to create on a bezier curve, including start and end point (even number will result in "flat" bezier curves, uneven number in "pointed" ones)
+        /// </summary>
+        readonly int samplingRateBezier = 101;
+
         /// <summary>
         /// parses a drawing consisting of line objects, given as a file in the application specific .isad format
         /// </summary>
@@ -27,7 +55,6 @@ namespace SketchAssistantWPF
         /// <returns>the width and height of the left canvas and the parsed picture as a list of lines</returns>
         private Tuple<int, int, List<InternalLine>> ParseISADInput(String[] allLines)
         {
-
             if (allLines.Length == 0)
             {
                 throw new FileImporterException("file is empty", "", -1);
@@ -40,10 +67,9 @@ namespace SketchAssistantWPF
             {
                 throw new FileImporterException("unterminated drawing definition", ".isad files have to end with the 'enddrawing' token", allLines.Length);
             }
-
             Tuple<int, int> dimensions = ParseISADHeader(allLines);
             List<InternalLine> picture = ParseISADBody(allLines, dimensions.Item1, dimensions.Item2);
-            
+
             return new Tuple<int, int, List<InternalLine>>(dimensions.Item1, dimensions.Item2, picture);
         }
 
@@ -75,12 +101,9 @@ namespace SketchAssistantWPF
         /// <returns>the parsed picture as a list of lines</returns>
         private List<InternalLine> ParseISADBody(String[] allLines, int width, int height)
         {
-
             String lineStartString = "line";
             String lineEndString = "endline";
-
             List<InternalLine> drawing = new List<InternalLine>();
-
             //number of the line currently being parsed, enumeration starting at 0, body starts at the third line, therefore lin number 2
             int i = 2;
             //parse 'line' token and complete line definition
@@ -140,5 +163,1525 @@ namespace SketchAssistantWPF
             return ParseISADInput(allLines);
         }
 
+        /// <summary>
+        /// parses a svg drawing, given as a .svg file
+        /// <para />several severe restrictions to the svg standard apply:
+        /// <para /> - width and heigth values must be integers
+        /// <para /> - the supported svg elements to be drawn must be placed on top level directly inside the 'svg' tag
+        /// <para /> - except for the global 'svg' tag, no hierarchical elements (elements which contain other svg elements) may exist. in other words: after an opening element tag no other opening element tag may occur before the closing tag of this element.
+        /// <para /> - lines in front of the (single) opening and after the (single) closing global svg tag will be ignored during parsing
+        /// <para /> - unsupported svg elements on top level will be ignored during parsing
+        /// <para /> - the input file must not contain empty lines
+        /// <para /> - all input files have to be manually tested and approved for use with this program by a developer or otherwise entitled personnel, otherwise no guarantee about correct and error-free parsing will be given
+        /// </summary>
+        /// <param name="fileName">the path of the input file</param>
+        /// <returns>the width and height of the left canvas and the parsed picture as a list of lines</returns>
+        public Tuple<int, int, List<InternalLine>> ParseSVGInputFile(String fileName, int windowWidth, int windowHeight)
+        {
+            return ParseSVGInput(System.IO.File.ReadAllLines(fileName), windowWidth, windowHeight);
+        }
+
+        /// <summary>
+        /// parses a svg drawing, given as the content of a .svg file, seperated into lines
+        /// </summary>
+        /// <param name="allLines">an array holding all lines of the input file</param>
+        /// <returns>the width and height of the left canvas and the parsed picture as a list of lines</returns>
+        private Tuple<int, int, List<InternalLine>> ParseSVGInput(String[] allLines, double windowWidth, double windowHeight)
+        {
+            i = 0; //reset line pointer
+            if (allLines.Length == 0) //check for empty file
+            {
+                throw new FileImporterException("file is empty", "", -1);
+            }
+            var sizedef = ParseSVGHeader(allLines); //parse svg file header and get internal coordinate range
+            i++;
+            int width; //width of the resulting picture in pixels
+            int height; //height of the resulting picture in pixels
+            if (windowWidth != 0 && windowHeight != 0)
+            {
+                if (windowWidth / windowHeight > sizedef.Item1 / sizedef.Item2) //height dominant, width has to be smaller than drawing window to preserve xy-scale
+                {
+                    scale = windowHeight / sizedef.Item2;
+                    height = (int)Math.Round(windowHeight);
+                    width = (int)Math.Round(scale * sizedef.Item1);
+                }
+                else //width dominant, height has to be smaller than drawing window to preserve xy-scale
+                {
+                    scale = windowWidth / sizedef.Item1;
+                    width = (int)Math.Round(windowWidth);
+                    height = (int)Math.Round(scale * sizedef.Item2);
+                }
+            }
+            else
+            {
+                scale = 1;
+                width = sizedef.Item1;
+                height = sizedef.Item2;
+            }
+            for (int j = 0; j < allLines.Length; j++)
+            {
+                allLines[j] = allLines[j].Trim(whitespaces);
+            }
+            List<InternalLine> picture = ParseSVGBody(allLines); //parse whole svg drawing into list of lines
+            return new Tuple<int, int, List<InternalLine>>(width, height, picture);
+        }
+
+        /// <summary>
+        /// parses the svg file header and returns the internal coordinate range of this drawing, and iterates i to point to the start of svg element definitions
+        /// </summary>
+        /// <param name="allLines">an array holding all lines of the input file</param>
+        /// <returns>the internal coordinate range of this drawing</returns>
+        private Tuple<int, int> ParseSVGHeader(String[] allLines)
+        {
+            while (!allLines[i].StartsWith("<svg")) //skip non-relevant metadata at start of svg file
+            {
+                i++;
+            }
+            String[] currentLine = allLines[i].Split(' ');
+            int width = -1;
+            int height = -1;
+            for (int j = 0; j < currentLine.Length; j++)
+            {
+                if (currentLine[j].StartsWith("width"))
+                {
+                    width = Convert.ToInt32(ParseSingleSVGAttribute(currentLine[j]));
+                }
+                else if (currentLine[j].StartsWith("height"))
+                {
+                    height = Convert.ToInt32(ParseSingleSVGAttribute(currentLine[j]));
+                }
+            }
+            if (width == -1)
+            {
+                throw new FileImporterException("missing width definition in SVG header", "the header should contain the \"width=...\" attribute", i + 1);
+            }
+            if (height == -1)
+            {
+                throw new FileImporterException("missing height definition in SVG header", "the header should contain the \"height=...\" attribute", i + 1);
+            }
+            return new Tuple<int, int>(width, height);
+        }
+
+        /// <summary>
+        /// parses all relevant svg element definitions and skips the ones not representable by the sketch assistant
+        /// </summary>
+        /// <param name="allLines">an array holding all lines of the input file</param>
+        /// <returns>the parsed picture as a list of lines</returns>
+        private List<InternalLine> ParseSVGBody(String[] allLines)
+        {
+            List<InternalLine> picture = new List<InternalLine>();
+            while (!allLines[i].StartsWith("</svg"))
+            {
+                List<InternalLine> element = ParseSingleSVGElement(allLines);
+                if (element != null)
+                {
+                    picture.AddRange(element);
+                }
+                i++;
+                if (i > allLines.Length - 1) throw new FileImporterException("unterminated input file: missing </svg> tag", "the file must not contain empty lines", i + 1);
+            }
+            return picture;
+        }
+
+        /// <summary>
+        /// parses one toplevel svg element
+        /// </summary>
+        /// <param name="allLines">an array holding all lines of the input file</param>
+        /// <returns>the parsed Element as a list of lines</returns>
+        private List<InternalLine> ParseSingleSVGElement(string[] allLines)
+        {
+            String[] currentElement = GetCurrentElement(allLines);
+            return ParseSingleLineSVGElement(currentElement);
+        }
+
+        /// <summary>
+        /// parses a single toplevel svg element only taking one line
+        /// </summary>
+        /// <param name="allLines">an array holding all lines of the input file</param>
+        /// <returns>the parsed element as a Line object, or null if the element is not supported</returns>
+        private List<InternalLine> ParseSingleLineSVGElement(string[] currentElement)
+        {
+            List<Point> points = null;
+            List<InternalLine> element = null;
+            switch (currentElement[0])
+            {
+                case "<rect":
+                    points = ParseRect(currentElement);
+                    break;
+                case "<circle":
+                    points = ParseCircle(currentElement);
+                    break;
+                case "<ellipse":
+                    points = ParseEllipse(currentElement);
+                    break;
+                case "<line":
+                    points = ParseLine(currentElement);
+                    break;
+                case "<polyline":
+                    points = ParsePolyline(currentElement);
+                    break;
+                case "<polygon":
+                    points = ParsePolygon(currentElement);
+                    break;
+                case "<path":
+                    element = ParsePath(currentElement);
+                    break;
+                default: //unsupported svg element
+                    return null; //simply ignore
+            }
+            if (element == null)
+            {
+                element = new List<InternalLine>();
+                element.Add(new InternalLine(points));
+            }
+            return element;
+        }
+
+        /// <summary>
+        /// parses a rectangle definition into a List of Points representing a single line around the rectangle (in clockwise direction), ignoring rounded corners
+        /// </summary>
+        /// <param name="currentElement">the definition of the element as whitespace seperated String[]</param>
+        /// <returns>the parsed element as a List of Points</returns>
+        private List<Point> ParseRect(string[] currentElement)
+        {
+            double x = 0;
+            double y = 0;
+            double w = 0;
+            double h = 0;
+            double rx = 0;
+            double ry = 0;
+            for (int j = 0; j < currentElement.Length; j++)
+            {
+                if (currentElement[j].StartsWith("x="))
+                {
+                    x = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("y="))
+                {
+                    y = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("width="))
+                {
+                    w = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("height="))
+                {
+                    h = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("rx="))
+                {
+                    rx = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("ry="))
+                {
+                    ry = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+            }
+            List<Point> rect = new List<Point>();
+            rect.Add(ScaleAndCreatePoint(x, y));
+            rect.Add(ScaleAndCreatePoint(x + w, y));
+            rect.Add(ScaleAndCreatePoint(x + w, y + h));
+            rect.Add(ScaleAndCreatePoint(x, y + h));
+            rect.Add(ScaleAndCreatePoint(x, y));
+            return rect;
+        }
+
+        /// <summary>
+        /// parses a circle definition into a List of Points
+        /// </summary>
+        /// <param name="currentElement">the definition of the element as whitespace seperated String[]</param>
+        /// <returns>the parsed element as a List of Points</returns>
+        private List<Point> ParseCircle(string[] currentElement)
+        {
+            double x = 0;
+            double y = 0;
+            double r = 0;
+            for (int j = 0; j < currentElement.Length; j++)
+            {
+                if (currentElement[j].StartsWith("cx="))
+                {
+                    x = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("cy="))
+                {
+                    y = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("r="))
+                {
+                    r = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+            }
+            return SampleEllipse(x, y, r, r);
+        }
+
+        /// <summary>
+        /// parses a ellipse definition into a List of Points
+        /// </summary>
+        /// <param name="currentElement">the definition of the element as whitespace seperated String[]</param>
+        /// <returns>the parsed element as a List of Points</returns>
+        private List<Point> ParseEllipse(string[] currentElement)
+        {
+            double x = 0;
+            double y = 0;
+            double rx = 0;
+            double ry = 0;
+            for (int j = 0; j < currentElement.Length; j++)
+            {
+                if (currentElement[j].StartsWith("cx="))
+                {
+                    x = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("cy="))
+                {
+                    y = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("rx="))
+                {
+                    rx = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("ry="))
+                {
+                    ry = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+            }
+            return SampleEllipse(x, y, rx, ry);
+        }
+
+        /// <summary>
+        /// parses a line definition into a List of two Points
+        /// </summary>
+        /// <param name="currentElement">the definition of the element as whitespace seperated String[]</param>
+        /// <returns>the parsed element as a List of Points</returns>
+        private List<Point> ParseLine(string[] currentElement)
+        {
+            double x1 = 0;
+            double y1 = 0;
+            double x2 = 0;
+            double y2 = 0;
+            for (int j = 0; j < currentElement.Length; j++)
+            {
+                if (currentElement[j].StartsWith("x1="))
+                {
+                    x1 = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("y1="))
+                {
+                    y1 = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("x2="))
+                {
+                    x2 = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+                else if (currentElement[j].StartsWith("y2="))
+                {
+                    y2 = Convert.ToDouble(ParseSingleSVGAttribute(currentElement[j]), CultureInfo.InvariantCulture);
+                }
+            }
+            List<Point> line = new List<Point>();
+            line.Add(ScaleAndCreatePoint(x1, y1));
+            line.Add(ScaleAndCreatePoint(x2, y2));
+            return line;
+        }
+
+        /// <summary>
+        /// parses a polyline definition into a List of Points
+        /// </summary>
+        /// <param name="currentElement">the definition of the element as whitespace seperated String[]</param>
+        /// <returns>the parsed element as a List of Points</returns>
+        private List<Point> ParsePolyline(string[] currentElement)
+        {
+            String[] points = null;
+            for (int j = 0; j < currentElement.Length; j++)
+            {
+                if (currentElement[j].StartsWith("points="))
+                {
+                    List<String> pointDefs = new List<string>();
+                    pointDefs.Add(currentElement[j].Substring(8)); //parse first point coordinates by removing 'points="'
+                    j++;
+                    while (!currentElement[j].EndsWith("\""))
+                    {
+                        pointDefs.Add(currentElement[j]); //parse intermediate point coordinates
+                        j++;
+                    }
+                    pointDefs.Add(currentElement[j].Trim('"')); //parse last point coordinates by removing '"'
+                    points = pointDefs.ToArray();
+                }
+            }
+            List<Point> polyline = new List<Point>();
+            for (int k = 0; k < points.Length - 1; k += 2)
+            {
+                polyline.Add(ScaleAndCreatePoint(Convert.ToDouble(points[k], CultureInfo.InvariantCulture), Convert.ToDouble(points[k + 1], CultureInfo.InvariantCulture)));
+            }
+            return polyline;
+        }
+
+        /// <summary>
+        /// parses a polygon definition into a List of Points
+        /// </summary>
+        /// <param name="currentElement">the definition of the element as whitespace seperated String[]</param>
+        /// <returns>the parsed element as a List of Points</returns>
+        private List<Point> ParsePolygon(string[] currentElement)
+        {
+            String[] points = null;
+            for (int j = 0; j < currentElement.Length; j++)
+            {
+                if (currentElement[j].StartsWith("points="))
+                {
+                    List<String> pointDefs = new List<string>();
+                    pointDefs.Add(currentElement[j].Substring(8)); //parse first point coordinates by removing 'points="'
+                    j++;
+                    while (!currentElement[j].EndsWith("\""))
+                    {
+                        pointDefs.Add(currentElement[j]); //parse intermediate point coordinates
+                        j++;
+                    }
+                    pointDefs.Add(currentElement[j].Trim('"')); //parse last point coordinates by removing '"'
+                    points = pointDefs.ToArray();
+                }
+            }
+            List<Point> polygon = new List<Point>();
+            for (int k = 0; k < points.Length - 1; k += 2)
+            {
+                polygon.Add(ScaleAndCreatePoint(Convert.ToDouble(points[k], CultureInfo.InvariantCulture), Convert.ToDouble(points[k + 1], CultureInfo.InvariantCulture)));
+            }
+            polygon.Add(ScaleAndCreatePoint(Convert.ToDouble(points[0], CultureInfo.InvariantCulture), Convert.ToDouble(points[1], CultureInfo.InvariantCulture))); //close polygon
+            return polygon;
+        }
+
+        /// <summary>
+        /// parses a path definition into a List of Points
+        /// </summary>
+        /// <param name="currentElement">the definition of the element as whitespace seperated String[]</param>
+        /// <returns>the parsed element as a List of Points</returns>
+        private List<InternalLine> ParsePath(string[] currentElement)
+        {
+            List<String> pathElements = new List<string>();
+            for (int j = 0; j < currentElement.Length; j++)
+            {
+                if (currentElement[j].StartsWith("d="))
+                {
+                    pathElements.Add(currentElement[j].Substring(3)); //parse first path element by removing 'd="'
+                    j++;
+                    while (!currentElement[j].EndsWith("\""))
+                    {
+                        pathElements.Add(currentElement[j]); //parse intermediate path element
+                        j++;
+                    }
+                    pathElements.Add(currentElement[j].Trim('"')); //parse last path element by removing '"'
+                }
+            }
+            NormalizePathDeclaration(pathElements); //expand path data to always explicitly have the command descriptor in front of the appropriate number of arguments and to seperate command descriptors, coordinates and other tokens always into seperate list elements (equivalent to seperation with spaces in the input file, but svg allows also for comma as a seperator, and for omitting seperators where possible without losing information (refer to svg grammer) to reduce file size
+            List<InternalLine> element = new List<InternalLine>();
+            List<Point> currentLine = new List<Point>();
+            double lastBezierControlPointX = 0;
+            double lastBezierControlPointY = 0;
+            double lastPositionX;
+            double lastPositionY;
+            double initialPositionX = -1;
+            double initialPositionY = -1;
+            bool newSubpath = true;
+            Tuple<List<Point>, double, double> valuesArc; //list of points, new values for: lastPositionX, lastPositionY
+            Tuple<List<Point>, double, double, double, double> valuesBezierCurve; //list of points, new values for: lastPositionX, lastPositionY, lastBezierControlPointX, lastBezierControlPointY
+            var valuesSinglePoint = Parse_M_L(pathElements); //new point, new values for: lastPositionX, lastPositionY
+            currentLine = new List<Point>();
+            currentLine.Add(valuesSinglePoint.Item1);
+            lastPositionX = valuesSinglePoint.Item2;
+            lastPositionY = valuesSinglePoint.Item3;
+            String currentToken;
+            while (!(pathElements.Count == 0))
+            {
+                if (newSubpath)
+                {
+                    initialPositionX = lastPositionX; //update buffers for coordinates of first point of active subpath
+                    initialPositionY = lastPositionY;
+                    newSubpath = false;
+                }
+                currentToken = pathElements.First();
+                if (currentToken.Equals("M"))
+                {
+                    element.Add(new InternalLine(currentLine)); //save current line
+                    valuesSinglePoint = Parse_M_L(pathElements);
+                    currentLine = new List<Point>(); //create new empty line
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("m"))
+                {
+                    element.Add(new InternalLine(currentLine)); //save current line
+                    valuesSinglePoint = Parse_m_l(pathElements, lastPositionX, lastPositionY);
+                    currentLine = new List<Point>(); //create new empty line
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("Z") || currentToken.Equals("z"))
+                {
+                    valuesSinglePoint = Parse_Z(pathElements, initialPositionX, initialPositionY); //method call only used for uniform program structure... only real effect of method is to consume one token
+                    newSubpath = true;
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to old line
+                    element.Add(new InternalLine(currentLine)); //save current line
+                    currentLine = new List<Point>(); //create new empty line
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("L"))
+                {
+                    valuesSinglePoint = Parse_M_L(pathElements);
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("l"))
+                {
+                    valuesSinglePoint = Parse_m_l(pathElements, lastPositionX, lastPositionY);
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("H"))
+                {
+                    valuesSinglePoint = Parse_H(pathElements, lastPositionY);
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("h"))
+                {
+                    valuesSinglePoint = Parse_h(pathElements, lastPositionX, lastPositionY);
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("V"))
+                {
+                    valuesSinglePoint = Parse_V(pathElements, lastPositionX);
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("v"))
+                {
+                    valuesSinglePoint = Parse_v(pathElements, lastPositionX, lastPositionY);
+                    currentLine.Add(valuesSinglePoint.Item1); //add point to new line
+                    lastPositionX = valuesSinglePoint.Item2; //save last point coordinates
+                    lastPositionY = valuesSinglePoint.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("C"))
+                {
+                    valuesBezierCurve = Parse_C(pathElements, lastPositionX, lastPositionY);
+                    currentLine.AddRange(valuesBezierCurve.Item1); //add point to new line
+                    lastPositionX = valuesBezierCurve.Item2; //save last point coordinates
+                    lastPositionY = valuesBezierCurve.Item3; //save last point coordinates
+                    lastBezierControlPointX = valuesBezierCurve.Item4; //save last bezier control point coordinates
+                    lastBezierControlPointY = valuesBezierCurve.Item5; //save last bezier control point coordinates
+                }
+                else if (currentToken.Equals("c"))
+                {
+                    valuesBezierCurve = Parse_C(pathElements, lastPositionX, lastPositionY);
+                    currentLine.AddRange(valuesBezierCurve.Item1); //add point to new line
+                    lastPositionX = valuesBezierCurve.Item2; //save last point coordinates
+                    lastPositionY = valuesBezierCurve.Item3; //save last point coordinates
+                    lastBezierControlPointX = valuesBezierCurve.Item4; //save last bezier control point coordinates
+                    lastBezierControlPointY = valuesBezierCurve.Item5; //save last bezier control point coordinates
+                }
+                else if (currentToken.Equals("S"))
+                {
+                    valuesBezierCurve = Parse_S(pathElements, lastPositionX, lastPositionY, lastBezierControlPointX, lastBezierControlPointY);
+                    currentLine.AddRange(valuesBezierCurve.Item1); //add point to new line
+                    lastPositionX = valuesBezierCurve.Item2; //save last point coordinates
+                    lastPositionY = valuesBezierCurve.Item3; //save last point coordinates
+                    lastBezierControlPointX = valuesBezierCurve.Item4; //save last bezier control point coordinates
+                    lastBezierControlPointY = valuesBezierCurve.Item5; //save last bezier control point coordinates
+                }
+                else if (currentToken.Equals("s"))
+                {
+                    valuesBezierCurve = Parse_s(pathElements, lastPositionX, lastPositionY, lastBezierControlPointX, lastBezierControlPointY);
+                    currentLine.AddRange(valuesBezierCurve.Item1); //add point to new line
+                    lastPositionX = valuesBezierCurve.Item2; //save last point coordinates
+                    lastPositionY = valuesBezierCurve.Item3; //save last point coordinates
+                    lastBezierControlPointX = valuesBezierCurve.Item4; //save last bezier control point coordinates
+                    lastBezierControlPointY = valuesBezierCurve.Item5; //save last bezier control point coordinates
+                }
+                else if (currentToken.Equals("Q"))
+                {
+                    valuesBezierCurve = Parse_Q(pathElements, lastPositionX, lastPositionY);
+                    currentLine.AddRange(valuesBezierCurve.Item1); //add point to new line
+                    lastPositionX = valuesBezierCurve.Item2; //save last point coordinates
+                    lastPositionY = valuesBezierCurve.Item3; //save last point coordinates
+                    lastBezierControlPointX = valuesBezierCurve.Item4; //save last bezier control point coordinates
+                    lastBezierControlPointY = valuesBezierCurve.Item5; //save last bezier control point coordinates
+                }
+                else if (currentToken.Equals("q"))
+                {
+                    valuesBezierCurve = Parse_q(pathElements, lastPositionX, lastPositionY);
+                    currentLine.AddRange(valuesBezierCurve.Item1); //add point to new line
+                    lastPositionX = valuesBezierCurve.Item2; //save last point coordinates
+                    lastPositionY = valuesBezierCurve.Item3; //save last point coordinates
+                    lastBezierControlPointX = valuesBezierCurve.Item4; //save last bezier control point coordinates
+                    lastBezierControlPointY = valuesBezierCurve.Item5; //save last bezier control point coordinates
+                }
+                else if (currentToken.Equals("T"))
+                {
+                    valuesBezierCurve = Parse_T(pathElements, lastPositionX, lastPositionY, lastBezierControlPointX, lastBezierControlPointY);
+                    currentLine.AddRange(valuesBezierCurve.Item1); //add point to new line
+                    lastPositionX = valuesBezierCurve.Item2; //save last point coordinates
+                    lastPositionY = valuesBezierCurve.Item3; //save last point coordinates
+                    lastBezierControlPointX = valuesBezierCurve.Item4; //save last bezier control point coordinates
+                    lastBezierControlPointY = valuesBezierCurve.Item5; //save last bezier control point coordinates
+                }
+                else if (currentToken.Equals("t"))
+                {
+                    valuesBezierCurve = Parse_t(pathElements, lastPositionX, lastPositionY, lastBezierControlPointX, lastBezierControlPointY);
+                    currentLine.AddRange(valuesBezierCurve.Item1); //add point to new line
+                    lastPositionX = valuesBezierCurve.Item2; //save last point coordinates
+                    lastPositionY = valuesBezierCurve.Item3; //save last point coordinates
+                    lastBezierControlPointX = valuesBezierCurve.Item4; //save last bezier control point coordinates
+                    lastBezierControlPointY = valuesBezierCurve.Item5; //save last bezier control point coordinates
+                }
+                else if (currentToken.Equals("A"))
+                {
+                    valuesArc = Parse_A(pathElements, lastPositionX, lastPositionY);
+                    currentLine.AddRange(valuesArc.Item1); //add points to new line
+                    lastPositionX = valuesArc.Item2; //save last point coordinates
+                    lastPositionY = valuesArc.Item3; //save last point coordinates
+                }
+                else if (currentToken.Equals("a"))
+                {
+                    valuesArc = Parse_a(pathElements, lastPositionX, lastPositionY);
+                    currentLine.AddRange(valuesArc.Item1); //add points to new line
+                    lastPositionX = valuesArc.Item2; //save last point coordinates
+                    lastPositionY = valuesArc.Item3; //save last point coordinates
+                }
+                else
+                {
+                    throw new FileImporterException("invalid path argument or path data formatting: read argument " + pathElements.First(), "valid path arguments are: {M,Z,L,H,V,C,S,Q,T,A} in upper and lower case", i + 1);
+                }
+            }
+            if (currentLine.Count > 1)
+            {
+                element.Add(new InternalLine(currentLine)); //save current line
+            }
+            return element;
+        }
+
+        /// <summary>
+        /// normalizes the declaration of the data field of a path declaration by splitting coordinates still connected by a semicolon and command descriptors which are directly attached to the following coordinate into seperate tokens, also repeats omitted command descriptor tokens when the same command is repeated multiple times
+        /// </summary>
+        /// <param name="pathElements">the list of tokens to normalize, by splitting up existing tokens and adding new command descriptor tokens</param>
+        private void NormalizePathDeclaration(List<string> pathElements)
+        {
+            Char lastCommand = 'M';
+            int argumentCounter = 0;
+            for (int j = 0; j < pathElements.Count; j++)
+            {
+                String currentElement = pathElements.ElementAt(j);
+                if (currentElement.Length != 1)
+                {
+                    if (((currentElement.First() >= 'A' && currentElement.First() <= 'Z') || (currentElement.First() >= 'a' && currentElement.First() <= 'z')) && currentElement.First() != 'e') //seperate a single command descriptor / letter
+                    {
+                        pathElements.RemoveAt(j);
+                        pathElements.Insert(j, currentElement.First() + ""); //insert letter as seperate element
+                        pathElements.Insert(j + 1, currentElement.Substring(1)); //insert rest of String at next position so it will be processed again
+                        lastCommand = currentElement.First();
+                        argumentCounter = 0;
+                    }
+                    else if ((currentElement.First() >= '0' && currentElement.First() <= '9') || currentElement.First() == '-' || currentElement.First() == '+' || currentElement.First() != 'e') //seperate a single coordinate / number
+                    {
+                        bool repeatCommandDescriptor = false;
+                        switch (lastCommand)
+                        { //check for reaching of next command with omitted command descriptor
+                            case 'M':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'm':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'L':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'l':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'V':
+                                if (argumentCounter >= 1) repeatCommandDescriptor = true;
+                                break;
+                            case 'v':
+                                if (argumentCounter >= 1) repeatCommandDescriptor = true;
+                                break;
+                            case 'H':
+                                if (argumentCounter >= 1) repeatCommandDescriptor = true;
+                                break;
+                            case 'h':
+                                if (argumentCounter >= 1) repeatCommandDescriptor = true;
+                                break;
+                            case 'C':
+                                if (argumentCounter >= 6) repeatCommandDescriptor = true;
+                                break;
+                            case 'c':
+                                if (argumentCounter >= 6) repeatCommandDescriptor = true;
+                                break;
+                            case 'S':
+                                if (argumentCounter >= 4) repeatCommandDescriptor = true;
+                                break;
+                            case 's':
+                                if (argumentCounter >= 4) repeatCommandDescriptor = true;
+                                break;
+                            case 'Q':
+                                if (argumentCounter >= 4) repeatCommandDescriptor = true;
+                                break;
+                            case 'q':
+                                if (argumentCounter >= 4) repeatCommandDescriptor = true;
+                                break;
+                            case 'T':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 't':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'A':
+                                if (argumentCounter >= 7) repeatCommandDescriptor = true;
+                                break;
+                            case 'a':
+                                if (argumentCounter >= 7) repeatCommandDescriptor = true;
+                                break;
+                        }
+                        if (repeatCommandDescriptor)
+                        {
+                            pathElements.Insert(j, lastCommand + ""); //repeat command descriptor
+                            j++; //skip command descriptor (was put into active position in the list
+                            argumentCounter = 0; //reset argument counter
+                        }
+                        bool decimalPointEncountered = false;
+                        for (int k = 1; k < currentElement.Length; k++)
+                        {
+                            if (!decimalPointEncountered && currentElement.ElementAt(k) == '.') //allow up to one decimal point in numbers
+                            {
+                                decimalPointEncountered = true;
+                            }
+                            else if (!((currentElement.ElementAt(k) >= '0' && currentElement.ElementAt(k) <= '9') || currentElement.First() == '-' || currentElement.First() == '+' || currentElement.First() != 'e'))
+                            {
+                                pathElements.RemoveAt(j);
+                                pathElements.Insert(j, currentElement.Substring(0, k - 1)); //insert number as seperate element
+                                pathElements.Insert(j + 1, currentElement.Substring(k)); //insert rest of String at next position so it will be processed again
+                                break;
+                            }
+                        }
+                        argumentCounter++;
+                    }
+                    else //parse non-space seperators and skip other unsupported characters (the only other valid ones per svg standard would be weird tokens looking like format descriptors (e.g. '#xC'), these are unsopported and will likely cause an error or other inconsitencies during parsing)
+                    {
+                        for (int k = 1; k < currentElement.Length; k++)
+                        {
+                            if (((currentElement.ElementAt(k) >= '0' && currentElement.ElementAt(k) <= '9')) || currentElement.ElementAt(k) == '-' || currentElement.ElementAt(k) == '+' || (currentElement.ElementAt(k) >= 'A' && currentElement.ElementAt(k) <= 'Z') || (currentElement.ElementAt(k) >= 'a' && currentElement.ElementAt(k) <= 'z'))
+                            {
+                                pathElements.RemoveAt(j);
+                                pathElements.Insert(j + 1, currentElement.Substring(k)); //insert rest of String at next position so it will be processed again
+                                break;
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    if ((currentElement.First() >= 'A' && currentElement.First() <= 'Z') || (currentElement.First() >= 'a' && currentElement.First() <= 'z')) //update lastCommand buffer when reading single letter
+                    {
+                        lastCommand = currentElement.First();
+                        argumentCounter = 0;
+                    }
+                    else if (!(currentElement.First() >= '0' && currentElement.First() <= '9')) //not a number
+                    {
+                        pathElements.RemoveAt(j); //remove element
+                        j--; //decrement index pointer so next element will not be skipped (indices of all folowing elements just decreased by 1)
+                    }
+                    else //a single digit number
+                    {
+                        bool repeatCommandDescriptor = false;
+                        switch (lastCommand)
+                        { //check for reaching of next command with omitted command descriptor
+                            case 'M':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'm':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'L':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'l':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'V':
+                                if (argumentCounter >= 1) repeatCommandDescriptor = true;
+                                break;
+                            case 'v':
+                                if (argumentCounter >= 1) repeatCommandDescriptor = true;
+                                break;
+                            case 'H':
+                                if (argumentCounter >= 1) repeatCommandDescriptor = true;
+                                break;
+                            case 'h':
+                                if (argumentCounter >= 1) repeatCommandDescriptor = true;
+                                break;
+                            case 'C':
+                                if (argumentCounter >= 6) repeatCommandDescriptor = true;
+                                break;
+                            case 'c':
+                                if (argumentCounter >= 6) repeatCommandDescriptor = true;
+                                break;
+                            case 'S':
+                                if (argumentCounter >= 4) repeatCommandDescriptor = true;
+                                break;
+                            case 's':
+                                if (argumentCounter >= 4) repeatCommandDescriptor = true;
+                                break;
+                            case 'Q':
+                                if (argumentCounter >= 4) repeatCommandDescriptor = true;
+                                break;
+                            case 'q':
+                                if (argumentCounter >= 4) repeatCommandDescriptor = true;
+                                break;
+                            case 'T':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 't':
+                                if (argumentCounter >= 2) repeatCommandDescriptor = true;
+                                break;
+                            case 'A':
+                                if (argumentCounter >= 7) repeatCommandDescriptor = true;
+                                break;
+                            case 'a':
+                                if (argumentCounter >= 7) repeatCommandDescriptor = true;
+                                break;
+                        }
+                        if (repeatCommandDescriptor)
+                        {
+                            pathElements.Insert(j, lastCommand + ""); //repeat command descriptor
+                            j++; //skip command descriptor (was put into active position in the list
+                            argumentCounter = 0; //reset argument counter
+                        }
+                        argumentCounter++;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// parses a "closeloop" path element
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="initialPositionX">absolute x coordinate of the last initial point of this subpath</param>
+        /// <param name="initialPositionY">absolute y coordinate of the last initial point of this subpath</param>
+        /// <returns></returns>
+        private Tuple<Point, double, double> Parse_Z(List<string> pathElements, double initialPositionX, double initialPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            return new Tuple<Point, double, double>(ScaleAndCreatePoint(initialPositionX, initialPositionY), initialPositionX, initialPositionY);
+        }
+
+        /// <summary>
+        /// parses a "moveto", "close loop" or "lineto" path element with absolute coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <returns>the point at the end of the move, close loop or line action and its exact, unscaled coordinates</returns>
+        private Tuple<Point, double, double> Parse_M_L(List<string> pathElements)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            return new Tuple<Point, double, double>(ScaleAndCreatePoint(x, y), x, y);
+        }
+
+        /// <summary>
+        /// parses a "moveto", "close loop" or "lineto" path element with relative coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>the point at the end of the move, close loop or line action and its exact, unscaled coordinates</returns>
+        private Tuple<Point, double, double> Parse_m_l(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse relative x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse relative y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            x = lastPositionX + x; //compute absolute x coordinate
+            y = lastPositionY + y; //compute absolute y coordinate
+            return new Tuple<Point, double, double>(ScaleAndCreatePoint(x, y), x, y);
+        }
+
+        /// <summary>
+        /// parses a "horizontal lineto" path element with absolute coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>the point at the end of the horizontal line action and its exact, unscaled coordinates</returns>
+        private Tuple<Point, double, double> Parse_H(List<string> pathElements, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            return new Tuple<Point, double, double>(ScaleAndCreatePoint(x, lastPositionY), x, lastPositionY);
+        }
+
+        /// <summary>
+        /// parses a "horizontal lineto" path element with relative coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>the point at the end of the horizontal line action and its exact, unscaled coordinates</returns>
+        private Tuple<Point, double, double> Parse_h(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse relative x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            x = lastPositionX + x; //compute absolute x coordinate
+            return new Tuple<Point, double, double>(ScaleAndCreatePoint(x, lastPositionY), x, lastPositionY);
+        }
+
+        /// <summary>
+        /// parses a "vertical lineto" path element with absolute coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <returns>the point at the end of the vertical line action and its exact, unscaled coordinates</returns>
+        private Tuple<Point, double, double> Parse_V(List<string> pathElements, double lastPositionX)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            return new Tuple<Point, double, double>(ScaleAndCreatePoint(lastPositionX, y), lastPositionX, y);
+        }
+
+        /// <summary>
+        /// parses a "vertical lineto" path element with relative coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>the point at the end of the vertical line action and its exact, unscaled coordinates</returns>
+        private Tuple<Point, double, double> Parse_v(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse relative y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            y = lastPositionY + y; //compute absolute y coordinate
+            return new Tuple<Point, double, double>(ScaleAndCreatePoint(lastPositionX, y), lastPositionX, y);
+        }
+
+        /// <summary>
+        /// parses a "cubic bezier curve" path element with absolute coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>a List of Points containing all sampled points on the bezier curve, aswell as the unscaled x and y coordinates of the last point of the curve and of the second bezier control point</returns>
+        private Tuple<List<Point>, double, double, double, double> Parse_C(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x1 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse first control point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y1 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse first control point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x2 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse second control point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y2 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse second control point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            return new Tuple<List<Point>, double, double, double, double>(SampleCubicBezier(lastPositionX, lastPositionY, x1, y1, x2, y2, x, y), x, y, x2, y2);
+        }
+
+        /// <summary>
+        /// parses a "cubic bezier curve" path element with relative coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>a List of Points containing all sampled points on the bezier curve, aswell as the unscaled x and y coordinates of the last point of the curve and of the second bezier control point</returns>
+        private Tuple<List<Point>, double, double, double, double> Parse_c(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x1 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse first control point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y1 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse first control point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x2 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse second control point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y2 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse second control point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            x1 = lastPositionX + x1; //compute absolute x coordinate
+            y1 = lastPositionY + y1; //compute absolute y coordinate
+            x2 = lastPositionX + x2; //compute absolute x coordinate
+            y2 = lastPositionY + y2; //compute absolute y coordinate
+            x = lastPositionX + x; //compute absolute x coordinate
+            y = lastPositionY + y; //compute absolute y coordinate
+            return new Tuple<List<Point>, double, double, double, double>(SampleCubicBezier(lastPositionX, lastPositionY, x1, y1, x2, y2, x, y), x, y, x2, y2);
+        }
+
+        /// <summary>
+        /// parses a "cubic bezier curve shorthand" path element with absolute coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <param name="lastBezierControlPointX">absolute x coordinate of the last bezier control point of the previous bezier curve</param>
+        /// <param name="lastBezierControlPointY">absolute y coordinate of the last bezier control point of the previous bezier curve</param>
+        /// <returns>a List of Points containing all sampled points on the bezier curve, aswell as the unscaled x and y coordinates of the last point of the curve and of the second bezier control point</returns>
+        private Tuple<List<Point>, double, double, double, double> Parse_S(List<string> pathElements, double lastPositionX, double lastPositionY, double lastBezierControlPointX, double lastBezierControlPointY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x2 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse second control point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y2 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse second control point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x1 = lastPositionX + (lastPositionX - lastBezierControlPointX); //mirror last bezier control point at bezier start point to get first new bezier control point
+            double y1 = lastPositionY + (lastPositionY - lastBezierControlPointY); //mirror last bezier control point at bezier start point to get first new bezier control point
+            return new Tuple<List<Point>, double, double, double, double>(SampleCubicBezier(lastPositionX, lastPositionY, x1, y1, x2, y2, x, y), x, y, x2, y2);
+        }
+
+        /// <summary>
+        /// parses a "cubic bezier curve shorthand" path element with relative coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <param name="lastBezierControlPointX">absolute x coordinate of the last bezier control point of the previous bezier curve</param>
+        /// <param name="lastBezierControlPointY">absolute y coordinate of the last bezier control point of the previous bezier curve</param>
+        /// <returns>a List of Points containing all sampled points on the bezier curve, aswell as the unscaled x and y coordinates of the last point of the curve and of the second bezier control point</returns>
+        private Tuple<List<Point>, double, double, double, double> Parse_s(List<string> pathElements, double lastPositionX, double lastPositionY, double lastBezierControlPointX, double lastBezierControlPointY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x2 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse second control point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y2 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse second control point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x1 = lastPositionX + (lastPositionX - lastBezierControlPointX); //mirror last bezier control point at bezier start point to get first new bezier control point
+            double y1 = lastPositionY + (lastPositionY - lastBezierControlPointY); //mirror last bezier control point at bezier start point to get first new bezier control point
+            x2 = lastPositionX + x2; //compute absolute x coordinate
+            y2 = lastPositionY + y2; //compute absolute y coordinate
+            x = lastPositionX + x; //compute absolute x coordinate
+            y = lastPositionY + y; //compute absolute y coordinate
+            return new Tuple<List<Point>, double, double, double, double>(SampleCubicBezier(lastPositionX, lastPositionY, x1, y1, x2, y2, x, y), x, y, x2, y2);
+        }
+
+        /// <summary>
+        /// parses a "quadratic bezier curve" path element with absolute coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>a List of Points containing all sampled points on the bezier curve, aswell as the unscaled x and y coordinates of the last point of the curve and of the bezier control point</returns>
+        private Tuple<List<Point>, double, double, double, double> Parse_Q(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x1 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse control point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y1 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse control point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            return new Tuple<List<Point>, double, double, double, double>(SampleQuadraticBezier(lastPositionX, lastPositionY, x1, y1, x, y), x, y, x1, y1);
+        }
+
+        /// <summary>
+        /// parses a "quadratic bezier curve" path element with relative coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>a List of Points containing all sampled points on the bezier curve, aswell as the unscaled x and y coordinates of the last point of the curve and of the bezier control point</returns>
+        private Tuple<List<Point>, double, double, double, double> Parse_q(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x1 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse control point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y1 = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse control point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            x1 = lastPositionX + x1; //compute absolute x coordinate
+            y1 = lastPositionY + y1; //compute absolute y coordinate
+            x = lastPositionX + x; //compute absolute x coordinate
+            y = lastPositionY + y; //compute absolute y coordinate
+            return new Tuple<List<Point>, double, double, double, double>(SampleQuadraticBezier(lastPositionX, lastPositionY, x1, y1, x, y), x, y, x1, y1);
+        }
+
+        /// <summary>
+        /// parses a "quadratic bezier curve shorthand" path element with absolute coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <param name="lastBezierControlPointX">absolute x coordinate of the last bezier control point of the previous bezier curve</param>
+        /// <param name="lastBezierControlPointY">absolute y coordinate of the last bezier control point of the previous bezier curve</param>
+        /// <returns>a List of Points containing all sampled points on the bezier curve, aswell as the unscaled x and y coordinates of the last point of the curve and of the bezier control point</returns>
+        private Tuple<List<Point>, double, double, double, double> Parse_T(List<string> pathElements, double lastPositionX, double lastPositionY, double lastBezierControlPointX, double lastBezierControlPointY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            double x1 = lastPositionX + (lastPositionX - lastBezierControlPointX); //mirror last bezier control point at bezier start point to get first new bezier control point
+            double y1 = lastPositionY + (lastPositionY - lastBezierControlPointY); //mirror last bezier control point at bezier start point to get first new bezier control point
+            return new Tuple<List<Point>, double, double, double, double>(SampleQuadraticBezier(lastPositionX, lastPositionY, x1, y1, x, y), x, y, x1, y1);
+        }
+
+        /// <summary>
+        /// parses a "quadratic bezier curve shorthand" path element with relative coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <param name="lastBezierControlPointX">absolute x coordinate of the last bezier control point of the previous bezier curve</param>
+        /// <param name="lastBezierControlPointY">absolute y coordinate of the last bezier control point of the previous bezier curve</param>
+        /// <returns>a List of Points containing all sampled points on the bezier curve, aswell as the unscaled x and y coordinates of the last point of the curve and of the bezier control point</returns>
+        private Tuple<List<Point>, double, double, double, double> Parse_t(List<string> pathElements, double lastPositionX, double lastPositionY, double lastBezierControlPointX, double lastBezierControlPointY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            x = lastPositionX + x; //compute absolute x coordinate
+            y = lastPositionY + y; //compute absolute y coordinate
+            double x1 = lastPositionX + (lastPositionX - lastBezierControlPointX); //mirror last bezier control point at bezier start point to get first new bezier control point
+            double y1 = lastPositionY + (lastPositionY - lastBezierControlPointY); //mirror last bezier control point at bezier start point to get first new bezier control point
+            return new Tuple<List<Point>, double, double, double, double>(SampleQuadraticBezier(lastPositionX, lastPositionY, x1, y1, x, y), x, y, x1, y1);
+        }
+
+        /// <summary>
+        /// parses a "elliptical arc" path element with absolute coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>a List of Points containing all sampled points on the elliptic arc, aswell as the unscaled x and y coordinates of the last point of the arc<returns>
+        private Tuple<List<Point>, double, double> Parse_A(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double rx = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse x radius
+            pathElements.RemoveAt(0); //remove x radius token
+            double ry = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse y radius
+            pathElements.RemoveAt(0); //remove y radius token
+            double thetha = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse rotation
+            pathElements.RemoveAt(0); //remove rotation token
+            bool largeArcFlag = Convert.ToInt16(pathElements.First()) == 1 ? true : false; //parse large arc flag
+            pathElements.RemoveAt(0); //remove large arc flag token
+            bool sweepFlag = Convert.ToInt16(pathElements.First()) == 1 ? true : false; //parse sweep flag
+            pathElements.RemoveAt(0); //remove sweep flag token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            x = x - lastPositionX; //compute relative x coordinate
+            y = y - lastPositionY; //compute relative y coordinate
+            return new Tuple<List<Point>, double, double>(SampleArc(lastPositionX, lastPositionY, rx, ry, x, y, thetha, largeArcFlag, sweepFlag), x, y);
+        }
+
+        /// <summary>
+        /// parses a "elliptical arc" path element with relative coordinates
+        /// </summary>
+        /// <param name="pathElements">a list of all not yet parsed path element tokens and values in correct order, starting with the element to be parsed</param>
+        /// <param name="lastPositionX">absolute x coordinate of the last active point</param>
+        /// <param name="lastPositionY">absolute y coordinate of the last active point</param>
+        /// <returns>a List of Points containing all sampled points on the elliptic arc, aswell as the unscaled x and y coordinates of the last point of the arc</returns>
+        private Tuple<List<Point>, double, double> Parse_a(List<string> pathElements, double lastPositionX, double lastPositionY)
+        {
+            pathElements.RemoveAt(0); //remove element descriptor token
+            double rx = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse x radius
+            pathElements.RemoveAt(0); //remove x radius token
+            double ry = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse y radius
+            pathElements.RemoveAt(0); //remove y radius token
+            double thetha = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse rotation
+            pathElements.RemoveAt(0); //remove rotation token
+            bool largeArcFlag = Convert.ToInt16(pathElements.First()) == 1 ? true : false; //parse large arc flag
+            pathElements.RemoveAt(0); //remove large arc flag token
+            bool sweepFlag = Convert.ToInt16(pathElements.First()) == 1 ? true : false; //parse sweep flag
+            pathElements.RemoveAt(0); //remove sweep flag token
+            double x = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point x coordinate
+            pathElements.RemoveAt(0); //remove x coordinate token
+            double y = Convert.ToDouble(pathElements.First(), CultureInfo.InvariantCulture); //parse target point y coordinate
+            pathElements.RemoveAt(0); //remove y coordinate token
+            return new Tuple<List<Point>, double, double>(SampleArc(lastPositionX, lastPositionY, rx, ry, x, y, thetha, largeArcFlag, sweepFlag), x, y);
+        }
+
+        /// <summary>
+        /// samples an arc of an ellipse into a list of points
+        /// </summary>
+        /// <param name="lastPositionX">x coordinate of last point</param>
+        /// <param name="lastPositionY">y coordinate of last point</param>
+        /// <param name="rx">x radius of the ellipse</param>
+        /// <param name="ry">y radius of the ellipse</param>
+        /// <param name="nextPositionXRelative">x coordinate of next point</param>
+        /// <param name="nextPositionYRelative">y coordinate of next point</param>
+        /// <param name="thetha">rotation of the ellipse around the x axis</param>
+        /// <param name="largeArcFlag">flag determining if the large or the small arc is to be drawn</param>
+        /// <param name="sweepFlag">flag determining in which direction the arc is to be drawn (false = ccw, true = cw)</param>
+        /// <returns></returns>
+        private List<Point> SampleArc(double lastPositionX, double lastPositionY, double rx, double ry, double nextPositionXRelative, double nextPositionYRelative, double thetha, bool largeArcFlag, bool sweepFlag)
+        {
+            double cos = Math.Cos(thetha / 180 * Math.PI);
+            double sin = Math.Sin(thetha / 180 * Math.PI);
+            double targetXTransformed = cos * nextPositionXRelative - sin * nextPositionYRelative; //rotate target point counterclockwise around the start point by [thetha] degrees, thereby practically rotating an intermediate coordinate system, which has its origin in the start point, clockwise by the same amount
+            double targetYTransformed = sin * nextPositionXRelative + cos * nextPositionYRelative;
+            var values = SampleEllipticArcBiasedNoRotation(rx, ry, targetXTransformed, targetYTransformed, largeArcFlag, sweepFlag);
+            List<Point> result = new List<Point>();
+            for (int j = 0; j < values.Item1.Length; j++)
+            {
+                double xCoordinateRelative = cos * values.Item1[j] + sin * values.Item2[j]; //rotate backwards so intermediate coordinate system and "real" coordinate system have the same rotation again
+                double yCoordinateRelative = cos * values.Item2[j] - sin * values.Item1[j];
+                double xCoordinateAbsolute = lastPositionX + xCoordinateRelative; //translate relative to absolute coordinates (intermediate coordinate system is now again aligned with the "real" one (the virtual pane on which all vectorgraphic elements are placed) (note that this "real" coordinate system is still not the same as the one actually representing pixels for drawing, as it still has to be scaled appropriately (done inside the ScaleAndCreatePoint method)))
+                double yCoordinateAbsolute = lastPositionY + yCoordinateRelative;
+                result.Add(ScaleAndCreatePoint(xCoordinateAbsolute, yCoordinateAbsolute));
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// samples an elliptical arc with given radii through coordinate origin and endpoint with specified properties
+        /// </summary>
+        /// <param name="rx">x radius</param>
+        /// <param name="ry">y radius</param>
+        /// <param name="targetXTransformed">x coordinate of next point</param>
+        /// <param name="targetYTransformed">y coordinate of next point</param>
+        /// <param name="largeArcFlag">flag determining if the large or the small arc is to be drawn</param>
+        /// <param name="sweepFlag">flag determining in which direction the arc is to be drawn (false = ccw, true = cw)</param>
+        /// <returns></returns>
+        private Tuple<double[], double[]> SampleEllipticArcBiasedNoRotation(double rx, double ry, double targetXTransformed, double targetYTransformed, bool largeArcFlag, bool sweepFlag)
+        {
+            double xStretchFactor = rx / ry; //get rx to ry ratio
+            var values = SampleCircleArcBiasedNoRotation(ry, targetXTransformed / xStretchFactor, targetYTransformed, largeArcFlag, sweepFlag); //get a circular arc with radius ry
+            for (int j = 0; j < values.Item1.Length; j++)
+            {
+                values.Item1[j] = values.Item1[j] * xStretchFactor; //correct x coordinates to get an elliptical arc from a circular one
+            }
+            return values;
+        }
+
+        /// <summary>
+        /// samples a circular arc with given radius through coordinate origin and endpoint with specified properties
+        /// </summary>
+        /// <param name="r">radius</param>
+        /// <param name="nextPositionXRelative">x coordinate of next point</param>
+        /// <param name="nextPositionYRelative">y coordinate of next point</param>
+        /// <param name="largeArcFlag">flag determining if the large or the small arc is to be drawn</param>
+        /// <param name="sweepFlag">flag determining in which direction the arc is to be drawn (false = ccw, true = cw)</param>
+        /// <returns></returns>
+        private Tuple<double[], double[]> SampleCircleArcBiasedNoRotation(double r, double nextPositionXRelative, double nextPositionYRelative, bool largeArcFlag, bool sweepFlag)
+        {
+            // code for center computation adapted from https://stackoverflow.com/a/36211852
+            double radsq = r * r;
+            double q = Math.Sqrt(((nextPositionXRelative) * (nextPositionXRelative)) + ((nextPositionYRelative) * (nextPositionYRelative))); //Math.Sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
+            double x3 = (nextPositionXRelative) / 2; //(x1 + x2) / 2;
+            double y3 = (nextPositionYRelative) / 2; //(y1 + y2) / 2;
+            bool xPlusFlag; //flags needed to select center point "left" of the line between origin and the endpoint (will be used to select correct one ("left" or "right" one) later together with flags passed as arguments
+            bool yPlusFlag;
+            if (nextPositionXRelative > 0)
+            {
+                yPlusFlag = true; //left point lies above line
+            }
+            else
+            {
+                yPlusFlag = false; //left point lies below line
+            }
+            if (nextPositionYRelative > 0)
+            {
+                xPlusFlag = false; //left point lies left of line
+            }
+            else
+            {
+                xPlusFlag = true; //left point lies right of line
+            }
+            if (sweepFlag != largeArcFlag) //need "right" center point, not "left" one (refer to svg specification, sweepFlag means going around the circle in "clockwise" direction, largeArcFlag means tracing the larger of the two possible arcs in the selected direction) 
+            {
+                xPlusFlag = !xPlusFlag;
+                yPlusFlag = !yPlusFlag;
+            }
+            double xC; // coordinates of center point of circle
+            double yC;
+            if (xPlusFlag) xC = x3 + Math.Sqrt(radsq - ((q / 2) * (q / 2))) * ((nextPositionYRelative) / q); //x3 + Math.Sqrt(radsq - ((q / 2) * (q / 2))) * ((y1 - y2) / q);
+            else xC = x3 - Math.Sqrt(radsq - ((q / 2) * (q / 2))) * ((nextPositionYRelative) / q);
+            if (yPlusFlag) yC = y3 + Math.Sqrt(radsq - ((q / 2) * (q / 2))) * ((nextPositionXRelative) / q); //y3 + Math.Sqrt(radsq - ((q / 2) * (q / 2))) * ((x2-x1) / q);
+            else yC = y3 - Math.Sqrt(radsq - ((q / 2) * (q / 2))) * ((nextPositionXRelative) / q);
+            var values = SampleCircleArcBiasedAroundCenter(-xC, -yC, nextPositionXRelative - xC, nextPositionYRelative - yC, r, largeArcFlag, sweepFlag);
+            for (int j = 0; j < values.Item1.Length; j++)
+            {
+                values.Item1[j] = values.Item1[j] + xC; //correct center point coordinate bias
+                values.Item2[j] = values.Item2[j] + yC;
+            }
+            return values;
+        }
+
+        /// <summary>
+        /// samples a circular arc with given radius around the center from the startpoint to the endpoint in the specified direction
+        /// </summary>
+        /// <param name="xStartPoint">x coordinate of the start point</param>
+        /// <param name="yStartPoint">y coordinate of the start point</param>
+        /// <param name="xFinalPoint">x coordinate of the final point</param>
+        /// <param name="yFinalPoint">y coordinate of the final point</param>
+        /// <param name="r">radius</param>
+        /// <param name="clockwise">direction</param>
+        /// <returns></returns>
+        private Tuple<double[], double[]> SampleCircleArcBiasedAroundCenter(double xStartPoint, double yStartPoint, double xFinalPoint, double yFinalPoint, double r, bool largeArcFlag, bool clockwise)
+        {
+            double phiEnd = Math.Atan2(yFinalPoint, xFinalPoint); // angles between points and origin and the positive x Axis
+            double phiStart = Math.Atan2(yStartPoint, xStartPoint);
+            double angle = ((double)2 * Math.PI) / (double)samplingRateEllipse; //compute angle increment (equal to the one used for ellipses)
+            double angleDifference = Math.Abs(phiStart - phiEnd);
+            if (angleDifference > 2 * Math.PI || angleDifference < 0) throw new Exception("angleDifference out of range: " + angleDifference); //TODO remove
+            if (largeArcFlag) // get larger angleDifference
+            {
+                if (angleDifference < Math.PI) angleDifference = ((double)2 * Math.PI) - angleDifference;  // was smaller angleDifference
+            }
+            else // get smaller angleDifference
+            {
+                if (angleDifference > Math.PI) angleDifference = ((double)2 * Math.PI) - angleDifference;  // was larger angleDifference
+            }
+            int numberOfPoints = (int)Math.Ceiling(angleDifference / angle);  //compute number of points to sample
+            double[] xValues = new double[numberOfPoints];
+            double[] yValues = new double[numberOfPoints];
+            double phiCurrent = phiStart;
+            for (int j = 0; j < numberOfPoints - 1; j++) //compute intermediate points
+            {
+                if (clockwise) phiCurrent -= angle; //get new angle
+                else phiCurrent += angle;
+                yValues[j] = Math.Sin(phiCurrent) * r; //angles are relative to positive x Axis!
+                xValues[j] = Math.Cos(phiCurrent) * r;
+            }
+            xValues[numberOfPoints - 1] = xFinalPoint; //(last segment always has an angle of less than or exactly 'angle')
+            yValues[numberOfPoints - 1] = yFinalPoint;
+            return new Tuple<double[], double[]>(xValues, yValues);
+        }
+
+        /// <summary>
+        /// samples a cubic bezier curve with a static number of steps (samplingRateBezier)
+        /// </summary>
+        /// <param name="lastPositionX">x coordinate of last point</param>
+        /// <param name="lastPositionY">y coordinate of last point</param>
+        /// <param name="controlPoint1X">x coordinate of control point 1</param>
+        /// <param name="controlPoint1Y">y coordinate of control point 1</param>
+        /// <param name="controlPoint2X">x coordinate of control point 2</param>
+        /// <param name="controlPoint2Y">y coordinate of control point 2</param>
+        /// <param name="nextPositionX">x coordinate of next point</param>
+        /// <param name="nextPositionY">y coordinate of next point</param>
+        /// <returns>a List of Points containing all sampled points</returns>
+        private List<Point> SampleCubicBezier(double lastPositionX, double lastPositionY, double controlPoint1X, double controlPoint1Y, double controlPoint2X, double controlPoint2Y, double nextPositionX, double nextPositionY)
+        {
+            var line1 = CreateDiscreteLine(lastPositionX, lastPositionY, controlPoint1X, controlPoint1Y);
+            var line2 = CreateDiscreteLine(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y);
+            var line3 = CreateDiscreteLine(controlPoint2X, controlPoint2Y, nextPositionX, nextPositionY);
+            var quadraticBezier1 = ComputeBezierStep(line1.Item1, line1.Item2, line2.Item1, line2.Item2);
+            var quadraticBezier2 = ComputeBezierStep(line2.Item1, line2.Item2, line3.Item1, line3.Item2);
+            var values = ComputeBezierStep(quadraticBezier1.Item1, quadraticBezier1.Item2, quadraticBezier2.Item1, quadraticBezier2.Item2);
+            List<Point> result = new List<Point>();
+            for (int j = 0; j < samplingRateBezier; j++)
+            {
+                result.Add(ScaleAndCreatePoint(values.Item1[j], values.Item2[j]));
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// samples a quadratic bezier curve with a static number of steps (samplingRateBezier)
+        /// </summary>
+        /// <param name="lastPositionX">x coordinate of last point</param>
+        /// <param name="lastPositionY">y coordinate of last point</param>
+        /// <param name="controlPointX">x coordinate of control point</param>
+        /// <param name="controlPointY">y coordinate of control point</param>
+        /// <param name="nextPositionX">x coordinate of next point</param>
+        /// <param name="nextPositionY">y coordinate of next point</param>
+        /// <returns>a List of Points containing all sampled points</returns>
+        private List<Point> SampleQuadraticBezier(double lastPositionX, double lastPositionY, double controlPointX, double controlPointY, double nextPositionX, double nextPositionY)
+        {
+            var line1 = CreateDiscreteLine(lastPositionX, lastPositionY, controlPointX, controlPointY);
+            var line2 = CreateDiscreteLine(controlPointX, controlPointY, nextPositionX, nextPositionY);
+            var values = ComputeBezierStep(line1.Item1, line1.Item2, line2.Item1, line2.Item2);
+            List<Point> result = new List<Point>();
+            for (int j = 0; j < samplingRateBezier; j++)
+            {
+                result.Add(ScaleAndCreatePoint(values.Item1[j], values.Item2[j]));
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// create a discrete line with [samplingRateBezier] points (including start and end point) between two points
+        /// </summary>
+        /// <param name="point1X">coordinate of point 1</param>
+        /// <param name="point1Y">y coordinate of point 1</param>
+        /// <param name="point2X">x coordinate of point 2</param>
+        /// <param name="point2Y">y coordinate of point 2</param>
+        /// <returns>the discrete line as arrays of x and y coordinates</returns>
+        private Tuple<double[], double[]> CreateDiscreteLine(double point1X, double point1Y, double point2X, double point2Y)
+        {
+            double[] resultX = new double[samplingRateBezier];
+            double[] resultY = new double[samplingRateBezier];
+            for (int j = 0; j < samplingRateBezier; j++)
+            {
+                var pointResult = LinearInterpolationForBezier(point1X, point1Y, point2X, point2Y, j);
+                resultX[j] = pointResult.Item1;
+                resultY[j] = pointResult.Item2;
+            }
+            return new Tuple<double[], double[]>(resultX, resultY);
+        }
+
+        /// <summary>
+        /// computes the discrete bezier curve between two given dicrete lines/curves
+        /// </summary>
+        /// <param name="line1X">x coordinates of all points in line 1</param>
+        /// <param name="line1Y">y coordinates of all points in line 1</param>
+        /// <param name="line2X">x coordinates of all points in line 2</param>
+        /// <param name="line2Y">y coordinates of all points in line 2</param>
+        /// <returns>the discrete bezier curve</returns>
+        private Tuple<double[], double[]> ComputeBezierStep(double[] line1X, double[] line1Y, double[] line2X, double[] line2Y)
+        {
+            double[] resultX = new double[samplingRateBezier];
+            double[] resultY = new double[samplingRateBezier];
+            for (int j = 0; j < samplingRateBezier; j++)
+            {
+                var pointResult = LinearInterpolationForBezier(line1X[j], line1Y[j], line2X[j], line2Y[j], j);
+                resultX[j] = pointResult.Item1;
+                resultY[j] = pointResult.Item2;
+            }
+            return new Tuple<double[], double[]>(resultX, resultY);
+        }
+
+        /// <summary>
+        /// creates the linearly interpolated point at j/(samplingRateBezier - 1) between point 1 and point 2
+        /// </summary>
+        /// <param name="point1X">x coordinate of point 1</param>
+        /// <param name="point1Y">y coordinate of point 1</param>
+        /// <param name="point2X">x coordinate of point 2</param>
+        /// <param name="point2Y">y coordinate of point 2</param>
+        /// <param name="j">number of point to be interpolated, at a total number of [samplingRateBezier] points</param>
+        /// <returns>the linearly interpolated point</returns>
+        private Tuple<double, double> LinearInterpolationForBezier(double point1X, double point1Y, double point2X, double point2Y, int j)
+        {
+            double factor = ((double)1 / (double)(samplingRateBezier - 1)) * (double)j; //factor for linear interpolation
+            double x = point1X + ((point2X - point1X) * factor);
+            double y = point1Y + ((point2Y - point1Y) * factor);
+            return new Tuple<double, double>(x, y);
+        }
+
+        /// <summary>
+        /// parses a hierarchical svg element and all its sub-elements
+        /// </summary>
+        /// <param name="currentElement">the definition of the top level element as whitespace seperated String[]</param>
+        /// <param name="allLines">an array holding all lines of the input file</param>
+        /// <returns>the parsed element as a Line object, or null if the element is not supported</returns>
+        private List<InternalLine> ParseMultiLineSVGElement(string[] currentElement, string[] allLines)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// removes the name of the attribute aswell as the '="' at the beginning and the '"' or '">' at the end of an attribute definition
+        /// </summary>
+        /// <param name="definition">the definition from the svg file</param>
+        /// <returns>the value of the attribute, as String (the part of definition contained between '"'s)</returns>
+        private String ParseSingleSVGAttribute(String definition)
+        {
+            return definition.Split('"')[1];
+        }
+
+        /// <summary>
+        /// fetches a single svg element definition that may extend ovr several lines of the input file, iterates i to point to the last line of the element definition
+        /// </summary>
+        /// <param name="allLines">an array holding all lines of the input file</param>
+        /// <returns>the definition of the current svg element, as String[] split by whitespaces</returns>
+        private String[] GetCurrentElement(String[] allLines)
+        {
+            List<String> currentElementTemp = allLines[i].Split(whitespaces).ToList();
+            while (!currentElementTemp.Last().EndsWith(">"))
+            {
+                i++;
+                currentElementTemp.AddRange(allLines[i].Split(whitespaces).ToList());
+            }
+            return currentElementTemp.ToArray();
+        }
+
+        /// <summary>
+        /// applies the scale factor to the coordinates and creates a new Point
+        /// </summary>
+        /// <param name="x">unscaled x coordinate</param>
+        /// <param name="y">unscaled y coordinate</param>
+        /// <returns>new Point with scaled coordinates</returns>
+        private Point ScaleAndCreatePoint(double x, double y)
+        {
+            return new Point((int)Math.Round(x * scale), (int)Math.Round(y * scale));
+        }
+
+        /// <summary>
+        /// creates a representation of an ellipse as a List of Points by sampling the outline of the ellipse
+        /// </summary>
+        /// <param name="x">x coordinate of the center of the ellipse</param>
+        /// <param name="y">y coordinate of the center of the ellipse</param>
+        /// <param name="rx">x radius of the ellipse</param>
+        /// <param name="ry">y radius of the ellipse</param>
+        /// <returns>the parsed element as a List of Points</returns>
+        private List<Point> SampleEllipse(double x, double y, double rx, double ry)
+        {
+            List<Point> ellipse = new List<Point>();
+            double angle = ((double)2 * Math.PI) / (double)samplingRateEllipse;
+            double yScale = ry / rx;
+            double[] xValues = new double[samplingRateEllipse / 4];
+            double[] yValues = new double[samplingRateEllipse / 4];
+            for (int j = 0; j < samplingRateEllipse / 4; j++) //compute offset values of points for one quadrant
+            {
+                xValues[j] = Math.Sin((double)j * angle) * rx;
+                yValues[j] = Math.Cos((double)j * angle) * rx;
+            }
+            for (int j = 0; j < samplingRateEllipse / 4; j++) //create actual points for first quadrant
+            {
+                int xCoord = Convert.ToInt32(Math.Round(x + xValues[j]));
+                int yCoord = Convert.ToInt32(Math.Round(y - yValues[j] * yScale));
+                ellipse.Add(ScaleAndCreatePoint(xCoord, yCoord));
+            }
+            for (int j = 0; j < samplingRateEllipse / 4; j++) //create actual points for second quadrant
+            {
+                int xCoord = Convert.ToInt32(Math.Round(x + yValues[j]));
+                int yCoord = Convert.ToInt32(Math.Round(y + xValues[j] * yScale));
+                ellipse.Add(ScaleAndCreatePoint(xCoord, yCoord));
+            }
+            for (int j = 0; j < samplingRateEllipse / 4; j++) //create actual points for third quadrant
+            {
+                int xCoord = Convert.ToInt32(Math.Round(x - xValues[j]));
+                int yCoord = Convert.ToInt32(Math.Round(y + yValues[j] * yScale));
+                ellipse.Add(ScaleAndCreatePoint(xCoord, yCoord));
+            }
+            for (int j = 0; j < samplingRateEllipse / 4; j++) //create actual points for fourth quadrant
+            {
+                int xCoord = Convert.ToInt32(Math.Round(x - yValues[j]));
+                int yCoord = Convert.ToInt32(Math.Round(y - xValues[j] * yScale));
+                ellipse.Add(ScaleAndCreatePoint(xCoord, yCoord));
+            }
+            ellipse.Add(ScaleAndCreatePoint(Convert.ToInt32(Math.Round(x + 0)), Convert.ToInt32(Math.Round(y - rx * yScale)))); //close ellipse
+            return ellipse;
+        }
     }
-}
+}

+ 2 - 2
SketchAssistant/SketchAssistantWPF/Frame.cs

@@ -1,4 +1,4 @@
-namespace OptiTrack
+namespace OptiTrack
 {
     public class Frame
     {
@@ -36,4 +36,4 @@
             Z = z;
         }
     }
-}
+}

+ 0 - 48
SketchAssistant/SketchAssistantWPF/GeometryCalculator.cs

@@ -12,54 +12,6 @@ namespace SketchAssistantWPF
     /// </summary>
     public static class GeometryCalculator
     {
-        /// <summary>
-        /// An implementation of the Bresenham Line Algorithm,
-        /// which calculates the points of a circle in a radius around a center point.
-        /// Implemented with the help of code examples on Wikipedia.
-        /// </summary>
-        /// <param name="center">The center of the circle.</param>
-        /// <param name="radius">The radius of the circle, 
-        /// when it is zero or less, only the midpoint is returned</param>
-        /// <returns>The HashSet containing all Points on the circle.</returns>
-        public static HashSet<Point> BresenhamCircleAlgorithm(Point center, int radius)
-        {
-            if (radius <= 0) { return new HashSet<Point> { center }; }
-
-            int x = radius - 1;
-            int y = 0;
-            int dx = 1;
-            int dy = 1;
-            int err = dx - (radius * 2);
-            HashSet<Point> returnSet = new HashSet<Point>();
-
-            while (x >= y)
-            {
-                returnSet.Add(new Point(center.X + x, center.Y + y));
-                returnSet.Add(new Point(center.X + y, center.Y + x));
-                returnSet.Add(new Point(center.X - y, center.Y + x));
-                returnSet.Add(new Point(center.X - x, center.Y + y));
-                returnSet.Add(new Point(center.X - x, center.Y - y));
-                returnSet.Add(new Point(center.X - y, center.Y - x));
-                returnSet.Add(new Point(center.X + y, center.Y - x));
-                returnSet.Add(new Point(center.X + x, center.Y - y));
-
-                if (err <= 0)
-                {
-                    y++;
-                    err += dy;
-                    dy += 2;
-                }
-
-                if (err > 0)
-                {
-                    x--;
-                    dx += 2;
-                    err += dx - (radius * 2);
-                }
-            }
-            return returnSet;
-        }
-
         /// <summary>
         /// A simple algorithm that returns a filled circle with a radius and a center point.
         /// </summary>

+ 11 - 16
SketchAssistant/SketchAssistantWPF/InternalLine.cs

@@ -101,12 +101,12 @@ namespace SketchAssistantWPF
                     if (currPoint.X >= 0 && currPoint.Y >= 0 &&
                         currPoint.X < boolMatrix.GetLength(0) && currPoint.Y < boolMatrix.GetLength(1))
                     {
-                        boolMatrix[(int) currPoint.X, (int) currPoint.Y] = true;
-                        if (listMatrix[(int) currPoint.X, (int) currPoint.Y] == null)
+                        boolMatrix[(int)currPoint.X, (int)currPoint.Y] = true;
+                        if (listMatrix[(int)currPoint.X, (int)currPoint.Y] == null)
                         {
-                            listMatrix[(int) currPoint.X, (int) currPoint.Y] = new HashSet<int>();
+                            listMatrix[(int)currPoint.X, (int)currPoint.Y] = new HashSet<int>();
                         }
-                        listMatrix[(int) currPoint.X, (int) currPoint.Y].Add(identifier);
+                        listMatrix[(int)currPoint.X, (int)currPoint.Y].Add(identifier);
                     }
                 }
             }
@@ -117,26 +117,21 @@ namespace SketchAssistantWPF
         /// </summary>
         private void CleanPoints()
         {
-            if (linePoints.Count > 1)
+            if (linePoints.Any())
             {
-                //if this is a point or not
-                var localIsPoint = true;
                 //check if its a point
-                foreach(Point p in linePoints)
+                var localIsPoint = linePoints.All(o => o.X == linePoints.First().X && o.Y == linePoints.First().Y);
+                if (!localIsPoint)
                 {
-                    if (p.X != linePoints[0].X || p.Y != linePoints[0].Y)
-                        localIsPoint = false;
-                }
-                if (!localIsPoint) {
                     List<Point> newList = new List<Point>();
                     List<Point> tempList = new List<Point>();
                     //Since Point is non-nullable, we must ensure the nullPoints, 
                     //which we remove can not possibly be points of the original given line.
-                    int nullValue = (int) linePoints[0].X + 1;
+                    int nullValue = (int)linePoints[0].X + 1;
                     //Fill the gaps between points
                     for (int i = 0; i < linePoints.Count - 1; i++)
                     {
-                        nullValue += (int) linePoints[i + 1].X;
+                        nullValue += (int)linePoints[i + 1].X;
                         List<Point> partialList = GeometryCalculator.BresenhamLineAlgorithm(linePoints[i], linePoints[i + 1]);
                         tempList.AddRange(partialList);
                     }
@@ -162,8 +157,8 @@ namespace SketchAssistantWPF
                 else
                 {
                     isPoint = true;
-                    point = linePoints[0];
-                    linePoints = new List<Point>();
+                    point = linePoints.First();
+                    linePoints.Clear();
                     linePoints.Add(point);
                 }
             }

+ 245 - 43
SketchAssistant/SketchAssistantWPF/MVP_Model.cs

@@ -8,6 +8,8 @@ using System.Windows.Controls;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using OptiTrack;
+using System.Runtime.InteropServices;
+using System.IO;
 
 namespace SketchAssistantWPF
 {
@@ -21,12 +23,8 @@ namespace SketchAssistantWPF
         /// History of Actions
         /// </summary>
         ActionHistory historyOfActions;
-		/// <summary>
-		/// The assistant responsible for the redraw mode
-		/// </summary>
-		//RedrawAssistant redrawAss;
-		OptiTrackConnector connector;
-		OptiTrackConnector.OnFrameReady frameReady;
+
+        OptiTrackConnector connector;
 
         /***********************/
         /*** CLASS VARIABLES ***/
@@ -37,6 +35,10 @@ namespace SketchAssistantWPF
         /// </summary>
         bool inDrawingMode;
         /// <summary>
+        /// if the program is using OptiTrack
+        /// </summary>
+        public bool optiTrackInUse { get; private set; }
+        /// <summary>
         /// Size of deletion area
         /// </summary>
         int deletionRadius = 5;
@@ -91,22 +93,57 @@ namespace SketchAssistantWPF
         /// <summary>
         /// Indicates whether or not the canvas on the right side is active.
         /// </summary>
-        public bool canvasActive {get; set;}
+        public bool canvasActive { get; set; }
         /// <summary>
         /// Indicates if there is a graphic loaded in the left canvas.
         /// </summary>
         public bool graphicLoaded { get; set; }
+        /// <summary>
+        /// Whether or not an optitrack system is avaiable.
+        /// </summary>
+        public bool optitrackAvailable { get; private set; }
+        /// <summary>
+        /// x koordinate in real world. one unit is one meter. If standing in front of video wall facing it, moving left results in incrementation of x.
+        /// </summary>
+        public float optiTrackX;
+        /// <summary>
+        /// y koordinate in real world. one unit is one meter. If standing in front of video wall, moving up results in incrementation of y.
+        /// </summary>
+        public float optiTrackY;
+        /// <summary>
+        /// z koordinate in real world. one unit is one meter. If standing in front of video wall, moving back results in incrementation of y.
+        /// </summary>
+        public float optiTrackZ;
+        /// <summary>
+        /// keeps track of whether last tick the trackable was inside drawing zone or not.
+        /// </summary>
+        private bool optiTrackInsideDrawingZone = false;
+        /// <summary>
+        /// this is a variable used for detecting whether the tracker is in the warning zone (0 +- variable), no drawing zone (0 +- 2 * variable) or normal drawing zone
+        /// </summary>
+        private double WARNING_ZONE_BOUNDARY = 0.10; //10cm
+        /// <summary>
+        /// object of class Armband used for controlling the vibrotactil armband
+        /// </summary>
+        private Armband armband;
+        /// <summary>
+        /// deactivates all Console.WriteLine() when set to false
+        /// </summary>
+        bool testing = false;//TODO: remove after finishing userstory
+
 
         Image rightImageWithoutOverlay;
+        /// <summary>
+        /// Whether or not the mouse is pressed.
+        /// </summary>
+        private bool mouseDown;
 
         List<InternalLine> leftLineList;
-        
+
         List<Tuple<bool, InternalLine>> rightLineList;
 
         List<Point> currentLine = new List<Point>();
 
-
-
         public MVP_Model(MVP_Presenter presenter)
         {
             programPresenter = presenter;
@@ -118,9 +155,35 @@ namespace SketchAssistantWPF
             UpdateUI();
             rightImageSize = new ImageDimension(0, 0);
             leftImageSize = new ImageDimension(0, 0);
-			connector = new OptiTrackConnector();
+            connector = new OptiTrackConnector();
+            armband = new Armband();
+
+            optitrackAvailable = false;
+            if (File.Exists(@"C:\Users\videowall-pc-user\Documents\BP-SketchAssistant\SketchAssistant\optitrack_setup.ttp"))
+            {
+                if (connector.Init(@"C:\Users\videowall-pc-user\Documents\BP-SketchAssistant\SketchAssistant\optitrack_setup.ttp"))
+                {
+                    optitrackAvailable = true;
+                    connector.StartTracking(getOptiTrackPosition);
+                }
+            }
+        }
+
+        [DllImport("user32.dll", EntryPoint = "SetCursorPos")]
+        private static extern bool SetCursorPos(int X, int Y);
+
+        //[DllImport("user32.dll")]
+        //public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
+
+        public enum MouseEventType : int
+        {
+            LeftDown = 0x02,
+            LeftUp = 0x04,
+            RightDown = 0x08,
+            RightUp = 0x10
         }
 
+
         /**************************/
         /*** INTERNAL FUNCTIONS ***/
         /**************************/
@@ -166,7 +229,7 @@ namespace SketchAssistantWPF
         /// </summary>
         private void UpdateUI()
         {
-            programPresenter.UpdateUIState(inDrawingMode, historyOfActions.CanUndo(), historyOfActions.CanRedo(), canvasActive, graphicLoaded);
+            programPresenter.UpdateUIState(inDrawingMode, historyOfActions.CanUndo(), historyOfActions.CanRedo(), canvasActive, graphicLoaded, optitrackAvailable, optiTrackInUse);
         }
 
         /// <summary>
@@ -193,6 +256,51 @@ namespace SketchAssistantWPF
             return returnSet;
         }
 
+        //TODO: calibrate
+        double OPTITRACK_X_OFFSET = 0.7878;
+        double OPTITRACK_Y_OFFSET = 0.7977;
+        double OPTITRACK_CANVAS_HEIGHT = 1.29;
+        double OPTITRACK_X_SCALE = -0.254 * (((1.816/*size of canvis*/ / 0.0254) * 96) / (1.816));
+        double OPTITRACK_Y_SCALE = 0.254 * (((1.360 / 0.0254) * 96) / (1.360));
+        /// <summary>
+        /// converts given point to device-independent pixel
+        /// </summary>
+        /// <param name="p">real world coordinate</param>
+        /// <returns>The given Point converted to device-independent pixel </returns>
+        private Point ConvertTo96thsOfInch(Point p)
+        {
+            double xCoordinate = (p.X - OPTITRACK_X_OFFSET) * OPTITRACK_X_SCALE;
+            double yCoordinate = (OPTITRACK_CANVAS_HEIGHT - (p.Y - OPTITRACK_Y_OFFSET)) * OPTITRACK_Y_SCALE;
+            return new Point(xCoordinate, yCoordinate);
+        }
+
+        /// <summary>
+        /// converts given point to pixel, calibrated for video wall in a08
+        /// </summary>
+        /// <param name="p"></param>
+        /// <returns></returns>
+        private Point ConvertToPixel(Point p)
+        {//TODO: realize comments
+            double xCoordinate = (p.X - OPTITRACK_X_OFFSET) * -1 * (/*Anzahl Pixel X-Richtung*/0 / (1.816)) + 0/*1/2 * x-richtung pixel*/; //TODO
+            double yCoordinate = (((OPTITRACK_CANVAS_HEIGHT + 0/*meter von oberer Rand Leinwand zu oberer Rand Bildschirm*/) - (p.Y - OPTITRACK_Y_OFFSET))) * (/*Anzahl Pixel Y-Richtung*/0 / (1.360));
+            return new Point(xCoordinate, yCoordinate);
+        }
+
+        /// <summary>
+        /// Updates the current cursor position of the model.
+        /// </summary>
+        /// <param name="p">The new cursor position</param>
+        public void SetCurrentFingerPosition(Point p)
+        {
+            Point correctedPoint = ConvertTo96thsOfInch(p);
+            if (testing)
+            {
+                Console.WriteLine("raw coordinates: " + p.X + ";" + p.Y);
+                Console.WriteLine(correctedPoint.X + "," + correctedPoint.Y);
+            }
+            currentCursorPosition = correctedPoint;
+        }
+
         /********************************************/
         /*** FUNCTIONS TO INTERACT WITH PRESENTER ***/
         /********************************************/
@@ -204,9 +312,9 @@ namespace SketchAssistantWPF
         /// <param name="RightCanvas">The size of the right canvas.</param>
         public void ResizeEvent(ImageDimension LeftCanvas, ImageDimension RightCanvas)
         {
-            if(LeftCanvas.Height >= 0 && LeftCanvas.Width>= 0) { leftImageSize = LeftCanvas; }
-            if(RightCanvas.Height >= 0 && RightCanvas.Width >= 0) { rightImageSize = RightCanvas; }
-          
+            if (LeftCanvas.Height >= 0 && LeftCanvas.Width >= 0) { leftImageSize = LeftCanvas; }
+            if (RightCanvas.Height >= 0 && RightCanvas.Width >= 0) { rightImageSize = RightCanvas; }
+
             RepopulateDeletionMatrixes();
         }
 
@@ -332,73 +440,153 @@ namespace SketchAssistantWPF
             inDrawingMode = nowDrawing;
             UpdateUI();
         }
-        
+
+        /// <summary>
+        /// The function called by the Presenter to set a variable which describes if OptiTrack is in use
+        /// </summary>
+        /// <param name="usingOptiTrack"></param>
+        public void SetOptiTrack(bool usingOptiTrack)
+        {
+            optiTrackInUse = usingOptiTrack;
+            if (usingOptiTrack && optiTrackX == 0 && optiTrackY == 0 && optiTrackZ == 0)
+            {
+                programPresenter.PassMessageToView("Trackable not detected, please check if OptiTrack is activated and Trackable is recognized", "Warning");
+            }
+        }
+
         /// <summary>
         /// Updates the current cursor position of the model.
         /// </summary>
         /// <param name="p">The new cursor position</param>
         public void SetCurrentCursorPosition(Point p)
         {
-            currentCursorPosition = p;
+            if (!optiTrackInUse) currentCursorPosition = p;
+            mouseDown = programPresenter.IsMousePressed();
         }
 
         /// <summary>
         /// Start a new Line, when the Mouse is pressed down.
         /// </summary>
-        public void MouseDown()
+        public void StartNewLine()
         {
-            if (inDrawingMode)
+            if (optiTrackInUse || programPresenter.IsMousePressed())
             {
-                currentLine.Clear();
-                currentLine.Add(currentCursorPosition);
+                if (inDrawingMode)
+                {
+                    currentLine.Clear();
+                    currentLine.Add(currentCursorPosition);
+                }
             }
         }
 
         /// <summary>
         /// Finish the current Line, when the pressed Mouse is released.
         /// </summary>
-        public void MouseUp()
+        /// <param name="valid">Whether the up event is valid or not</param>
+        public void FinishCurrentLine(bool valid)
         {
-            if (inDrawingMode && currentLine.Count > 0)
+            foreach (Point p in currentLine)
+            {
+                if (testing)
+                {
+                    Console.WriteLine(p.X + ";" + p.Y);
+                }
+            }
+            if (valid)
+            {
+                if (inDrawingMode && currentLine.Count > 0)
+                {
+                    InternalLine newLine = new InternalLine(currentLine, rightLineList.Count);
+                    rightLineList.Add(new Tuple<bool, InternalLine>(true, newLine));
+                    newLine.PopulateMatrixes(isFilledMatrix, linesMatrix);
+                    programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Draw, newLine.GetID())));
+                    //TODO: For the person implementing overlay: Add check if overlay needs to be added
+                    programPresenter.UpdateRightLines(rightLineList);
+                    currentLine.Clear();
+                    programPresenter.UpdateCurrentLine(currentLine);
+                }
+            }
+            else
             {
-                InternalLine newLine = new InternalLine(currentLine, rightLineList.Count);
-                rightLineList.Add(new Tuple<bool, InternalLine>(true, newLine));
-                newLine.PopulateMatrixes(isFilledMatrix, linesMatrix);
-                programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Draw, newLine.GetID())));
-                //TODO: For the person implementing overlay: Add check if overlay needs to be added
-                programPresenter.UpdateRightLines(rightLineList);
                 currentLine.Clear();
-                programPresenter.UpdateCurrentLine(currentLine);
             }
             UpdateUI();
         }
 
+
+        void getOptiTrackPosition(OptiTrack.Frame frame)
+        {
+            if(frame.Trackables.Length > 1)
+            {
+                optiTrackX = frame.Trackables[0].X;
+                optiTrackY = frame.Trackables[0].Y;
+                optiTrackZ = frame.Trackables[0].Z;
+            }
+        }
+
         /// <summary>
         /// Method to be called every tick. Updates the current Line, or checks for Lines to delete, depending on the drawing mode.
         /// </summary>
         public void Tick()
         {
-			if(inDrawingMode)
-			{
-				if (connector.Init(@"C:\Users\videowall-pc-user\Documents\BP-SketchAssistant\SketchAssistant\optitrack_setup.ttp"))
-				{
-					connector.StartTracking(programPresenter.PassOptiTrackMessage);
-				}
-			}
-			
             if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
             else { previousCursorPosition = currentCursorPosition; }
-            cursorPositions.Enqueue(currentCursorPosition);
-            //Drawing
-            if (inDrawingMode && programPresenter.IsMousePressed())
+            if (optiTrackInUse) //drawing optiTrack
             {
-                currentLine.Add(currentCursorPosition);
-                programPresenter.UpdateCurrentLine(currentLine);
+                if (CheckInsideDrawingZone(optiTrackZ))
+                {
+                    SetCurrentFingerPosition(new Point(optiTrackX, optiTrackY));
+                    currentLine.Add(currentCursorPosition);
+                    programPresenter.UpdateCurrentLine(currentLine);
+                    if (!optiTrackInsideDrawingZone)
+                    {
+                        optiTrackInsideDrawingZone = true;
+                        StartNewLine();
+                        if (testing)
+                        {
+                            Console.WriteLine("new line begun");
+                        }
+                    }
+                    if (optiTrackZ > WARNING_ZONE_BOUNDARY)
+                    {
+                        armband.pushForward();
+                    }
+                    else if (optiTrackZ < -1 * WARNING_ZONE_BOUNDARY)
+                    {
+                        armband.pushBackward();
+                    }
+                }
+                else
+                {
+                    if (optiTrackInsideDrawingZone) //trackable was in drawing zone last tick -> finish line
+                    {
+                        optiTrackInsideDrawingZone = false;
+                        FinishCurrentLine(true);
+                        if (testing)
+                        {
+                            Console.WriteLine("line finished");
+                        }
+                    }
+                }
+                //if (optitrackAvailable) { TODO test and remove
+                projectPointOntoScreen(optiTrackX, optiTrackY);
+                //}
+                cursorPositions.Enqueue(currentCursorPosition);
+            }
+            else //drawing normal
+            {
+                cursorPositions.Enqueue(currentCursorPosition);
+                if (inDrawingMode && programPresenter.IsMousePressed())
+                {
+                    currentLine.Add(currentCursorPosition);
+                    //programPresenter.UpdateCurrentLine(currentLine);
+                }
             }
             //Deleting
             if (!inDrawingMode && programPresenter.IsMousePressed())
             {
                 List<Point> uncheckedPoints = GeometryCalculator.BresenhamLineAlgorithm(previousCursorPosition, currentCursorPosition);
+
                 foreach (Point currPoint in uncheckedPoints)
                 {
                     HashSet<int> linesToDelete = CheckDeletionMatrixesAroundPoint(currPoint, deletionRadius);
@@ -417,6 +605,19 @@ namespace SketchAssistantWPF
             }
         }
 
+        private void projectPointOntoScreen(float optiTrackX, float optiTrackY)
+        {
+            Point auxiliaryPoint = ConvertToPixel(new Point(optiTrackX, optiTrackY));
+            SetCursorPos((int)auxiliaryPoint.X, (int)auxiliaryPoint.Y);
+        }
+
+        private bool CheckInsideDrawingZone(float optiTrackZ)
+        {
+            if (Math.Abs(optiTrackZ) > WARNING_ZONE_BOUNDARY * 2) return false;
+            return true;
+        }
+
+        /*
         /// <summary>
         /// A helper Function that updates the markerRadius & deletionRadius, considering the size of the canvas.
         /// </summary>
@@ -447,6 +648,7 @@ namespace SketchAssistantWPF
                 deletionRadius = (int)(5 * zoomFactor);
             }
         }
+        */
 
         /// <summary>
         /// If there is unsaved progress.

+ 149 - 100
SketchAssistant/SketchAssistantWPF/MVP_Presenter.cs

@@ -27,7 +27,7 @@ namespace SketchAssistantWPF
         /// </summary>
         Dictionary<int, Shape> rightPolyLines;
 
-        ImageDimension CanvasSizeLeft = new ImageDimension(0,0);
+        ImageDimension CanvasSizeLeft = new ImageDimension(0, 0);
 
         ImageDimension CanvasSizeRight = new ImageDimension(0, 0);
 
@@ -44,6 +44,7 @@ namespace SketchAssistantWPF
             Click,
             Down,
             Up,
+            Up_Invalid,
             Move
         }
 
@@ -78,7 +79,7 @@ namespace SketchAssistantWPF
         {
             CanvasSizeLeft.ChangeDimension(leftPBS.Item1, leftPBS.Item2);
             CanvasSizeRight.ChangeDimension(rightPBS.Item1, rightPBS.Item2);
-            programModel.UpdateSizes(CanvasSizeRight);
+            //programModel.UpdateSizes(CanvasSizeRight);
             programModel.ResizeEvent(CanvasSizeLeft, CanvasSizeRight);
         }
 
@@ -98,14 +99,63 @@ namespace SketchAssistantWPF
                 if (!fileNameTup.Item1.Equals("") && !fileNameTup.Item2.Equals(""))
                 {
                     programView.SetToolStripLoadStatus(fileNameTup.Item2);
-                    Tuple<int, int, List<InternalLine>> values = fileImporter.ParseISADInputFile(fileNameTup.Item1);
-                    programModel.SetLeftLineList(values.Item1, values.Item2, values.Item3);
-
-                    programModel.ResetRightImage();
-                    programModel.CanvasActivated();
-                    programModel.ChangeState(true);
-                    programView.EnableTimer();
-                    ClearRightLines();
+                    try
+                    {
+                        Tuple<int, int, List<InternalLine>> values = fileImporter.ParseISADInputFile(fileNameTup.Item1);
+                        programModel.SetLeftLineList(values.Item1, values.Item2, values.Item3);
+
+                        programModel.ResetRightImage();
+                        programModel.CanvasActivated();
+                        programModel.ChangeState(true);
+                        programView.EnableTimer();
+                        ClearRightLines();
+                    }
+                    catch (FileImporterException ex)
+                    {
+                        programView.ShowInfoMessage(ex.ToString(),"");
+                    }
+                    catch (Exception ex)
+                    {
+                        programView.ShowInfoMessage("exception occured while trying to load interactive sketch-assistant drawing file:\n\n" + ex.ToString() + "\n\n" + ex.StackTrace, "");
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// Display a new FileDialog to a svg drawing.
+        /// </summary>
+        public void SVGToolStripMenuItemClick()
+        {
+            var okToContinue = true;
+            if (programModel.HasUnsavedProgress())
+            {
+                okToContinue = programView.ShowWarning("You have unsaved progress. Continue?");
+            }
+            if (okToContinue)
+            {
+                var fileNameTup = programView.openNewDialog("Scalable Vector Graphics|*.svg");
+                if (!fileNameTup.Item1.Equals("") && !fileNameTup.Item2.Equals(""))
+                {
+                    programView.SetToolStripLoadStatus(fileNameTup.Item2);
+                    try
+                    {
+                        Tuple<int, int, List<InternalLine>> values = fileImporter.ParseSVGInputFile(fileNameTup.Item1, programModel.leftImageBoxWidth, programModel.leftImageBoxHeight);
+                        programModel.SetLeftLineList(values.Item1, values.Item2, values.Item3);
+                        programModel.ResetRightImage();
+                        programModel.CanvasActivated();
+                        programModel.ChangeState(true);
+                        programView.EnableTimer();
+                        ClearRightLines();
+                    }
+                    catch (FileImporterException ex)
+                    {
+                        programView.ShowInfoMessage(ex.ToString(), "");
+                    }
+                    catch (Exception ex)
+                    {
+                        programView.ShowInfoMessage("exception occured while trying to parse svg file:\n\n" + ex.ToString() + "\n\n" + ex.StackTrace, "");
+                    }
                 }
             }
         }
@@ -119,6 +169,17 @@ namespace SketchAssistantWPF
             programModel.ChangeState(NowDrawing);
         }
 
+        /// <summary>
+        /// Pass-through function to change the OptiTrack-in-use state of the model
+        /// </summary>
+        public void ChangeOptiTrack(bool usingOptiTrack)
+        {
+            if (programModel.optitrackAvailable)
+            {
+                programModel.SetOptiTrack(usingOptiTrack);
+            }
+        }
+
         /// <summary>
         /// Pass-trough function to undo an action.
         /// </summary>
@@ -168,7 +229,7 @@ namespace SketchAssistantWPF
         /// Pass-trough when the mouse is moved.
         /// </summary>
         /// <param name="mouseAction">The action which is sent by the View.</param>
-        /// <param name="e">The Mouse event arguments.</param>
+        /// <param name="position">The position of the mouse.</param>
         public void MouseEvent(MouseAction mouseAction, Point position)
         {
             switch (mouseAction)
@@ -185,24 +246,29 @@ namespace SketchAssistantWPF
         /// Pass-trough function that calls the correct Mouse event of the model, when the mouse is clicked.
         /// </summary>
         /// <param name="mouseAction">The action which is sent by the View.</param>
-        /// <param name="e">The Mouse event arguments.</param>
         public void MouseEvent(MouseAction mouseAction)
         {
-            switch (mouseAction)
+            if (!programModel.optiTrackInUse)
             {
-                case MouseAction.Click:
-                    programModel.MouseDown();
-                    programModel.Tick();
-                    programModel.MouseUp();
-                    break;
-                case MouseAction.Down:
-                    programModel.MouseDown();
-                    break;
-                case MouseAction.Up:
-                    programModel.MouseUp();
-                    break;
-                default:
-                    break;
+                switch (mouseAction)
+                {
+                    case MouseAction.Click:
+                        programModel.StartNewLine();
+                        programModel.Tick();
+                        programModel.FinishCurrentLine(true);
+                        break;
+                    case MouseAction.Down:
+                        programModel.StartNewLine();
+                        break;
+                    case MouseAction.Up:
+                        programModel.FinishCurrentLine(true);
+                        break;
+                    case MouseAction.Up_Invalid:
+                        programModel.FinishCurrentLine(false);
+                        break;
+                    default:
+                        break;
+                }
             }
         }
 
@@ -245,7 +311,7 @@ namespace SketchAssistantWPF
         /// </summary>
         public void UpdateRightLines(List<Tuple<bool, InternalLine>> lines)
         {
-            foreach(Tuple<bool, InternalLine> tup in lines)
+            foreach (Tuple<bool, InternalLine> tup in lines)
             {
                 var status = tup.Item1;
                 var line = tup.Item2;
@@ -261,10 +327,8 @@ namespace SketchAssistantWPF
                     else
                     {
                         Ellipse newPoint = new Ellipse();
-                        newPoint.SetValue(Canvas.LeftProperty, line.point.X);
-                        newPoint.SetValue(Canvas.TopProperty, line.point.Y);
                         rightPolyLines.Add(line.GetID(), newPoint);
-                        programView.AddNewPointRight(newPoint);
+                        programView.AddNewPointRight(newPoint, line);
                     }
                 }
                 SetVisibility(rightPolyLines[line.GetID()], status);
@@ -297,23 +361,49 @@ namespace SketchAssistantWPF
         /// <param name="canRedo">If actions in the model can be redone</param>
         /// <param name="canvasActive">If the right canvas is active</param>
         /// <param name="graphicLoaded">If an image is loaded in the model</param>
-        public void UpdateUIState(bool inDrawingMode, bool canUndo, bool canRedo, bool canvasActive, bool graphicLoaded)
+        /// <param name="optiTrackAvailable">If there is an optitrack system available</param>
+        /// <param name="optiTrackInUse">If the optitrack system is active</param>
+        public void UpdateUIState(bool inDrawingMode, bool canUndo, bool canRedo, bool canvasActive,
+                bool graphicLoaded, bool optiTrackAvailable, bool optiTrackInUse)
         {
             Dictionary<String, MainWindow.ButtonState> dict = new Dictionary<String, MainWindow.ButtonState> {
                 {"canvasButton", MainWindow.ButtonState.Enabled }, {"drawButton", MainWindow.ButtonState.Disabled}, {"deleteButton",MainWindow.ButtonState.Disabled },
-                {"undoButton", MainWindow.ButtonState.Disabled },{"redoButton",  MainWindow.ButtonState.Disabled}};
+                {"undoButton", MainWindow.ButtonState.Disabled },{"redoButton",  MainWindow.ButtonState.Disabled}, {"drawWithOptiButton", MainWindow.ButtonState.Disabled}};
 
             if (canvasActive)
             {
                 if (inDrawingMode)
                 {
-                    dict["drawButton"] = MainWindow.ButtonState.Active;
-                    dict["deleteButton"] = MainWindow.ButtonState.Enabled;
+                    if (optiTrackAvailable)
+                    {
+                        if (optiTrackInUse)
+                        {
+                            dict["drawButton"] = MainWindow.ButtonState.Enabled;
+                            dict["drawWithOptiButton"] = MainWindow.ButtonState.Active;
+                            dict["deleteButton"] = MainWindow.ButtonState.Enabled;
+                        }
+                        else
+                        {
+                            dict["drawButton"] = MainWindow.ButtonState.Active;
+                            dict["drawWithOptiButton"] = MainWindow.ButtonState.Enabled;
+                            dict["deleteButton"] = MainWindow.ButtonState.Enabled;