videowall-pc-user 5 anos atrás
pai
commit
cb7a849633

+ 0 - 0
Neues Textdokument.txt


BIN
SketchAssistant/NPTrackingTools.dll


BIN
SketchAssistant/SketchAssistant/optitrack_setup.ttp


+ 1 - 1
SketchAssistant/SketchAssistantWPF/MVP_Model.cs

@@ -380,7 +380,7 @@ namespace SketchAssistantWPF
         {
 			if(inDrawingMode)
 			{
-				if (connector.Init(@"optitracak_setup.ttp"))
+				if (connector.Init(@"C:\Users\videowall-pc-user\Documents\BP-SketchAssistant\SketchAssistant\optitrack_setup.ttp"))
 				{
 					connector.StartTracking(programPresenter.PassOptiTrackMessage);
 				}

+ 3 - 2
SketchAssistant/SketchAssistantWPF/MVP_Presenter.cs

@@ -359,8 +359,9 @@ namespace SketchAssistantWPF
 			float x = frame.Trackables[0].X;
 			float y = frame.Trackables[0].Y;
 			float z = frame.Trackables[0].Z;
-			programView.SetOptiTrackText("X: " + x + "Y: " + y + "Z: " + z);
-		}
+            MessageBox.Show(x.ToString());
+            //programView.SetOptiTrackText("X: ");// + x + "Y: " + y + "Z: " + z);
+        }
 
 		/*************************/
 		/*** HELPING FUNCTIONS ***/

+ 10 - 16
SketchAssistant/SketchAssistantWPF/MainWindow.xaml

@@ -1,9 +1,9 @@
 <Window x:Class="SketchAssistantWPF.MainWindow"
-        xmlns:local="clr-namespace:SketchAssistantWPF"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:SketchAssistantWPF"
         mc:Ignorable="d"
         Title="Sketch Assistant" Height="612" Width="914" SizeChanged="Window_SizeChanged">
     <Grid>
@@ -26,17 +26,12 @@
         <ToolBar x:Name="MenuToolbar" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="0" Background="LightGray">
             <Menu Background="LightGray">
                 <MenuItem x:Name="LoadMenuButton" Header="Load">
-                    <MenuItem x:Name="SVGMenuButton" Header="Load SVG File" Click="MenuItem_Click"/>
+                    <MenuItem Header="Load SVG File" Click="MenuItem_Click"/>
                 </MenuItem>
                 <MenuItem x:Name="EditMenuButton" Header="Edit">
-                    <MenuItem x:Name="CanvasMenuButton" Header="New Canvas" Click="CanvasButton_Click"/>
-                    <MenuItem x:Name="UndoMenuButton" Header="Undo" Click="UndoButton_Click"/>
-                    <MenuItem x:Name="RedoMenuButton" Header="Redo" Click="RedoButton_Click"/>
-                    <MenuItem x:Name="DebugMode" Header="Debug Input">
-                        <MenuItem x:Name="DebugOne" Header="Debug 1" Click="DebugOne_Click"/>
-                        <MenuItem x:Name="DebugTwo" Header="Debug 2" Click="DebugTwo_Click"/>
-                        <MenuItem x:Name="DebugThree" Header="Debug 3" Click="DebugThree_Click"/>
-                    </MenuItem>
+                    <MenuItem Header="New Canvas" Click="CanvasButton_Click"/>
+                    <MenuItem Header="Undo" Click="UndoButton_Click"/>
+                    <MenuItem Header="Redo" Click="RedoButton_Click"/>
                 </MenuItem>
             </Menu>
         </ToolBar>
@@ -86,7 +81,7 @@
                     </Rectangle.Fill>
                 </Rectangle>
             </ToggleButton>
-            <ToggleButton x:Name="DeleteButton" ToolTip="Enter Deletion Mode" Click="DeleteButton_Click">
+            <ToggleButton x:Name="DeleteButton" ToolTip="Enter Deletion Mode" Click="DeleteButton_Click" >
                 <Rectangle Width="30" Height="30">
                     <Rectangle.Fill>
                         <DrawingBrush>
@@ -128,7 +123,7 @@
                     </Rectangle.Fill>
                 </Rectangle>
             </ToggleButton>
-            <Button x:Name="UndoButton" ToolTip="Undo the last action" Click="UndoButton_Click">
+            <Button x:Name="UndoButton" ToolTip="Undo the last action" Click="UndoButton_Click" >
                 <Rectangle Width="30" Height="30">
                     <Rectangle.Fill>
                         <DrawingBrush>
@@ -175,11 +170,10 @@
                 </Rectangle>
             </Button>
         </ToolBar>
-        <local:CustomCanvas x:Name="LeftCanvas" Background="SlateGray" Grid.Column="2" Grid.Row="1" Height="auto" Grid.ColumnSpan="2"/>
+        <Canvas Name="LeftCanvas" Background="SlateGray" Grid.Column="2" Grid.Row="1" Height="auto" Grid.ColumnSpan="2"/>
         <Canvas Name="CanvasSeperator" Grid.Column="4" Grid.Row="1" Background="LightGray"/>
-        <local:CustomCanvas x:Name="RightCanvas" Background="SlateGray" Grid.Column="5" Grid.Row="1" Height="auto"
-            MouseDown="RightCanvas_MouseDown" MouseUp="RightCanvas_MouseUp" MouseMove="RightCanvas_MouseMove" Grid.ColumnSpan="2" MouseLeave="RightCanvas_MouseLeave" TouchLeave="RightCanvas_TouchLeave" />
-
+        <Canvas Name="RightCanvas" Background="SlateGray" Grid.Column="5" Grid.Row="1" Height="auto"
+            MouseDown="RightCanvas_MouseDown" MouseUp="RightCanvas_MouseUp" MouseMove="RightCanvas_MouseMove" Grid.ColumnSpan="2" MouseLeave="RightCanvas_MouseLeave"/>
 
         <DockPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="7">
             <StatusBar DockPanel.Dock="Bottom" Name="StatusBar"  Background="LightGray">

+ 25 - 2
SketchAssistant/SketchAssistantWPF/MainWindow.xaml.cs

@@ -1,4 +1,5 @@
 using Microsoft.Win32;
+using OptiTrack;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -40,7 +41,7 @@ namespace SketchAssistantWPF
             }
             if(!InDebugMode)
             {
-                DebugMode.Visibility = Visibility.Collapsed;
+//DebugMode.Visibility = Visibility.Collapsed;
             }
             ProgramPresenter = new MVP_Presenter(this);
             //  DispatcherTimer setup
@@ -49,9 +50,22 @@ namespace SketchAssistantWPF
             dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10);
             ProgramPresenter.Resize(new Tuple<int, int>((int)LeftCanvas.Width, (int)LeftCanvas.Height),
                 new Tuple<int, int>((int)RightCanvas.Width, (int)RightCanvas.Height));
+            OptiTrackConnector connector = new OptiTrackConnector();
+            if (connector.Init(@"C:\Users\etri\Desktop\bppp2\optitrack_setup.ttp"))
+            {
+                connector.StartTracking(handleTrackingResult);
+            }
+
         }
 
-        public enum ButtonState
+    private void handleTrackingResult(OptiTrack.Frame frame)
+    {
+            Console.WriteLine(frame.Markers.Length);
+    }
+
+    
+
+    public enum ButtonState
         {
             Enabled,
             Disabled,
@@ -372,6 +386,15 @@ namespace SketchAssistantWPF
             LastActionBox.Text = message;
         }
 
+        /// <summary>
+        /// Sets the contents of the last action taken indicator label.
+        /// </summary>
+        /// <param name="message">The new contents</param>
+        public void SetOptiTrackText(string message)
+        {
+            OptiTrackBox.Text = "test";
+        }
+
         /// <summary>
         /// Changes the states of a tool strip button.
         /// </summary>

BIN
SketchAssistant/SketchAssistantWPF/NPTrackingTools.dll


+ 8 - 0
SketchAssistant/SketchAssistantWPF/SketchAssistantWPF.csproj

@@ -119,6 +119,9 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <None Include="optitrack_setup.ttp">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -139,5 +142,10 @@
       <Install>false</Install>
     </BootstrapperPackage>
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="NPTrackingTools.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

BIN
SketchAssistant/SketchAssistantWPF/optitrack_setup.ttp


BIN
SketchAssistant/optitrack_setup.ttp