Browse Source

Added color options

Martin Edlund (Laptop) 5 years ago
parent
commit
7220499631

+ 6 - 0
SketchAssistant/SketchAssistantWPF/MVP_Model.cs

@@ -310,6 +310,12 @@ namespace SketchAssistantWPF
                 Console.WriteLine(correctedPoint.X + "," + correctedPoint.Y);
             }
             
+            if(optiTrackZ < -1 * WARNING_ZONE_BOUNDARY)
+                programPresenter.SetOverlayColor("optipoint", Brushes.Red);
+            else if(optiTrackZ > WARNING_ZONE_BOUNDARY)
+                programPresenter.SetOverlayColor("optipoint", Brushes.Yellow);
+            else
+                programPresenter.SetOverlayColor("optipoint", Brushes.Green)
             
             currentOptiCursorPosition = correctedPoint;
             programPresenter.MoveOptiPoint(currentOptiCursorPosition);

+ 19 - 0
SketchAssistant/SketchAssistantWPF/MVP_Presenter.cs

@@ -493,6 +493,25 @@ namespace SketchAssistantWPF
             }
         }
 
+        /// <summary>
+        /// Change the color of an overlay item.
+        /// </summary>
+        /// <param name="name">The name of the item in the overlay dictionary</param>
+        /// <param name="color">The color of the item</param>
+        public void SetOverlayColor(String name, Brush color)
+        {
+            Shape shape = new Ellipse();
+            if(((MainWindow)programView).OverlayDictionary.ContainsKey(name))
+            {
+                shape = ((MainWindow)programView).OverlayDictionary[name];
+                
+                if(name.Substring(0, 7).Equals("dotLine"))
+                    shape.Stroke = color;
+                else
+                    shape.Fill = color;
+            }
+        }
+
         /// <summary>
         /// Change the properties of an overlay item.
         /// </summary>