Browse Source

Display first point of every line

videowall-pc-user 5 years ago
parent
commit
5314a6da53

+ 6 - 1
SketchAssistant/SketchAssistantWPF/GeometryCalculator.cs

@@ -81,7 +81,12 @@ namespace SketchAssistantWPF
                 List<Point> shortL = points0; List<Point> longL = points0;
                 if (points0.Count < points1.Count) { longL = points1; }
                 if (points0.Count > points1.Count) { shortL = points1; }
-                double dif = (longL.Count - 1) / (shortL.Count - 1);
+                double dif = 2;
+                if (shortL.Count != 1)
+                {
+                    dif = (longL.Count - 1) / (shortL.Count - 1);
+                }
+                
                 if (dif > 1)
                 {
                     //The longer list is significantly longer

+ 59 - 2
SketchAssistant/SketchAssistantWPF/LocalArmbandInterface.cs

@@ -13,6 +13,16 @@ namespace SketchAssistantWPF
     /// </summary>
     public static class LocalArmbandInterface
     {
+        /// <summary>
+        /// constant to set the vibration mode:
+        /// 0 -> no vibration
+        /// 1 -> intensity 0.33
+        /// 2 -> intensity 0.66
+        /// 3 -> intensity 1.0
+        /// </summary>
+        static readonly int VIBRATION_MODE = 2;
+
+
         /// <summary>
         /// initializes the armband (and binds the C dll)
         /// must be called before calling any other of the methods of this class
@@ -49,14 +59,61 @@ namespace SketchAssistantWPF
         public static extern void StopVibration(int motorNumber);
 
         /// <summary>
-        /// starts actuation of the specified tactor (motor) at the specified intensity for a specified amount of time
+        /// starts actuation of the specified tactor (motor) at  0.33 for a specified amount of time
+        /// </summary>
+        /// <param name="tactor">integer from 0 to 7 specifying the number of the tactor to actuate</param>
+        /// <param name="intensity">intensity, ranging from 0.0 to 1.0 by default</param>
+        /// <param name="duration">number of millisecons to actuate the tactor for</param>
+        [DllImport(@"../Debug/StaticLibMotors.dll", EntryPoint = "?actuate33@ArmbandInterface@@QAAXHNH@Z",
+     CallingConvention = CallingConvention.Cdecl)]
+        private static extern void Actuate33(int tactor, double intensity, int duration);
+
+        /// <summary>
+        /// starts actuation of the specified tactor (motor) at intensity 0.66 for a specified amount of time
+        /// </summary>
+        /// <param name="tactor">integer from 0 to 7 specifying the number of the tactor to actuate</param>
+        /// <param name="intensity">intensity, ranging from 0.0 to 1.0 by default</param>
+        /// <param name="duration">number of millisecons to actuate the tactor for</param>
+        [DllImport(@"../Debug/StaticLibMotors.dll", EntryPoint = "?actuate66@ArmbandInterface@@QAAXHNH@Z",
+     CallingConvention = CallingConvention.Cdecl)]
+        private static extern void Actuate66(int tactor, double intensity, int duration);
+
+        /// <summary>
+        /// starts actuation of the specified tactor (motor) at intensity 1.0 for a specified amount of time
         /// </summary>
         /// <param name="tactor">integer from 0 to 7 specifying the number of the tactor to actuate</param>
         /// <param name="intensity">intensity, ranging from 0.0 to 1.0 by default</param>
         /// <param name="duration">number of millisecons to actuate the tactor for</param>
         [DllImport(@"../Debug/StaticLibMotors.dll", EntryPoint = "?actuate100@ArmbandInterface@@QAAXHNH@Z",
      CallingConvention = CallingConvention.Cdecl)]
-        public static extern void Actuate(int tactor, double intensity, int duration);
+        private static extern void Actuate100(int tactor, double intensity, int duration);
+
+        /// <summary>
+        /// starts actuation of the specified tactor (motor) at the specified intensity (specified in VIBRATION_MODE) for a specified amount of time
+        /// </summary>
+        /// <param name="tactor">integer from 0 to 7 specifying the number of the tactor to actuate</param>
+        /// <param name="intensity">intensity, ranging from 0.0 to 1.0 by default</param>
+        /// <param name="duration">number of millisecons to actuate the tactor for</param>
+        public static void Actuate(int tactor, double intensity, int duration)
+        {
+            switch (VIBRATION_MODE)
+            {
+                case 0:
+                    break;
+                case 1:
+                    Actuate33(tactor, intensity, duration);
+                    break;
+                case 2:
+                    Actuate66(tactor, intensity, duration);
+                    break;
+                case 3:
+                    Actuate100(tactor, intensity, duration);
+                    break;
+                default:
+                    Console.WriteLine("Error: invalid value for VIBRATION_MODE constant");
+                    break;
+            }
+        }
 
     }
 }

+ 20 - 0
SketchAssistant/SketchAssistantWPF/MVP_Model.cs

@@ -188,6 +188,11 @@ namespace SketchAssistantWPF
                 Console.WriteLine("trying to initialize Armband...");
                 int tmp = LocalArmbandInterface.SetupArmband();
                 Console.WriteLine("Armband initialization terminated, exit code: " + tmp);
+                comFiveAvailable = true;
+            }
+            else
+            {
+                Console.WriteLine("COM5 device not found");
             }
 
             programPresenter = presenter;
@@ -607,6 +612,21 @@ namespace SketchAssistantWPF
         /// </summary>
         public void Tick()
         {
+            //Show startpoints
+            if (leftLineList != null && leftLineList.Count > 0)
+            {
+                var templist = rightLineList.Where(tup => tup.Item1).ToList();
+                if (templist.Count < leftLineList.Count)
+                {
+                    programPresenter.SetOverlayStatus("startpoint", true, leftLineList[templist.Count].GetPoints()[0]);
+                }
+                else
+                {
+                    programPresenter.SetOverlayStatus("startpoint", false, new Point(50, 50));
+                }
+
+            }
+
             if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
             else { previousCursorPosition = currentCursorPosition; }
 

BIN
SketchAssistant/SketchAssistantWPF/StaticLibMotors.dll


+ 2 - 2
SketchAssistant/StaticLib1/ArmbandInterface.cpp

@@ -171,7 +171,7 @@ extern "C" {
 	make the specified tactor (number from 0 to 7) actuate at a intensity 0.66 (default: between 0.0 and 1.0, but range may be set using the setIntensityRange function) for the specified duration (number of milliseconds) ,or until it is stopped
 	provides access to the DLLs BodyActuator_actuate method and handles type conversion to C types required by the DLL which are not available in C#
 	*/
-	DllExport void __cdecl ArmbandInterface::actuate66(int tactor, int duration) {
+	DllExport void __cdecl ArmbandInterface::actuate66(int tactor, double intensity, int duration) {
 		(actuateFunctionHandle)(armband, tactor, 0.66, duration);
 	}
 
@@ -179,7 +179,7 @@ extern "C" {
 	make the specified tactor (number from 0 to 7) actuate at intensity 0.33 (default: between 0.0 and 1.0, but range may be set using the setIntensityRange function) for the specified duration (number of milliseconds) ,or until it is stopped
 	provides access to the DLLs BodyActuator_actuate method and handles type conversion to C types required by the DLL which are not available in C#
 	*/
-	DllExport void __cdecl ArmbandInterface::actuate33(int tactor, int duration) {
+	DllExport void __cdecl ArmbandInterface::actuate33(int tactor, double intensity, int duration) {
 		(actuateFunctionHandle)(armband, tactor, 0.33, duration);
 	}
 

+ 4 - 4
SketchAssistant/StaticLib1/ArmbandInterface.h

@@ -17,8 +17,8 @@ DllExport int setupArmband();
 DllExport void startVibrate(int tactor, float intensity);
 DllExport void stopVibrate(int tactor);
 DllExport void actuate100(int tactor, double intensity, int duration);
-DllExport void actuate66(int tactor, int duration);
-DllExport void actuate33(int tactor, int duration);
+DllExport void actuate66(int tactor, double intensity, int duration);
+DllExport void actuate33(int tactor, double intensity, int duration);
 DllExport void deleteArmband();
 
 class ArmbandInterface
@@ -58,12 +58,12 @@ class ArmbandInterface
 		make the specified tactor (number from 0 to 7) actuate at intensity 0.66 (default: between 0.0 and 1.0, but range may be set using the setIntensityRange function) for the specified duration (number of milliseconds) ,or until it is stopped
 		provides access to the DLLs BodyActuator_actuate method and handles type conversion to C types required by the DLL which are not available in C#
 		*/
-		__declspec(dllexport) void __cdecl actuate66(int tactor, int duration);
+		__declspec(dllexport) void __cdecl actuate66(int tactor, double intensity, int duration);
 		/*
 		make the specified tactor (number from 0 to 7) actuate at intensity 0.33 (default: between 0.0 and 1.0, but range may be set using the setIntensityRange function) for the specified duration (number of milliseconds) ,or until it is stopped
 		provides access to the DLLs BodyActuator_actuate method and handles type conversion to C types required by the DLL which are not available in C#
 		*/
-		__declspec(dllexport) void __cdecl actuate33(int tactor, int duration);
+		__declspec(dllexport) void __cdecl actuate33(int tactor, double intensity, int duration);
 		/*
 		sets the frequency of the specified tactor to a new value (unit unknown, possibly Hz...)
 		*/

+ 3 - 0
SketchAssistant/WhiteTests/test_input_files/whitelisted/H_V_C_S.svg

@@ -0,0 +1,3 @@
+<svg width="1437" height="961" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
+<path fill="#ffffff" stroke="#000000" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" d="M720,203.5H945V341C945,340.5 871,435.5 852,406.5 833,377.5 694,332.5 681,425.5S482,500.5 487,437.5" id="svg_2"/>
+</svg>

+ 8 - 0
SketchAssistant/WhiteTests/test_input_files/whitelisted/circle_h_v_c_s.svg

@@ -0,0 +1,8 @@
+<svg width="1437" height="961" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
+ <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
+ <g>
+  <title>Layer 1</title>
+  <circle fill="#ffffff" stroke="#000000" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" cx="388" cy="217.5" r="93.60556" id="svg_1"/>
+  <path fill="#ffffff" stroke="#000000" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" d="m720,203.5h225v138c0,-0.5 -74,94.5 -93,65.5c-19,-29 -158,-74 -171,19s-199,75 -194,12" id="svg_2"/>
+ </g>
+</svg>

+ 21 - 0
SketchAssistant/WhiteTests/test_input_files/whitelisted/path2.svg

@@ -0,0 +1,21 @@
+fsfwefafaefcSC
+F
+S
+FSFewFAHBfAg
+<DSFVSF>
+<GSG FS02MAFfm="Fmseikf" />
+source: https://www.w3schools.com/
+<svg height="600" width="1200">
+  <path id="lineAB" d="M 100 350 l 150 -300" stroke="red"
+  stroke-width="3" fill="none" />
+  <path id="lineBC" d="M 250 50 l 150 300" stroke="red"
+  stroke-width="3" fill="none" />
+  <path d="M 100 350 q 150 -300 300 0 z M 175 200 l 150 0" stroke="blue"
+  stroke-width="5" fill="none" />
+  <path d="M 100 100 a 60 60 0 0 0 100 0 Z"
+      fill="yellow" stroke="blue" stroke-width="5" />
+  <path d="M 100 200 A 150 120 45 1 0 200 300"
+      fill="yellow" stroke="blue" stroke-width="5" />
+  <path d="M200,300 Q400,50 600,300 t400,0"
+        fill="none" stroke="red" stroke-width="5"  />
+</svg>

BIN
SketchAssistant/optitrack_setup.ttp