Skip to content

Commit

Permalink
3d tinker
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorgan001 committed Jun 16, 2020
1 parent f44e5cc commit 61671d5
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 50 deletions.
23 changes: 16 additions & 7 deletions GS.Server/Controls/Dialogs/AutoHomeDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d" >
xmlns:domain="clr-namespace:GS.Shared.Domain;assembly=GS.Shared"
mc:Ignorable="d" >
<GroupBox Header="{StaticResource btnAutoHome}" Margin="5" >
<StackPanel Orientation="Vertical">
<ProgressBar Value="{Binding AutoHomeProgressBar}" md:TransitionAssist.DisableTransitions="True" Height="10" Width="200" Foreground="{StaticResource SecondaryAccentBrush}" />
<StackPanel Orientation="Horizontal" Margin="0,5,0,0" IsEnabled="{Binding StartEnabled}">
<Label Content="{StaticResource msgAutoHomeLimit}" VerticalAlignment="Bottom"/>
<ComboBox md:HintAssist.Hint="{StaticResource cbhintAutoHomeLimit}" MinWidth="10" ToolTip="{StaticResource cbtipAutoHomeLimit}"
ItemsSource="{Binding AutoHomeLimits}" Style="{StaticResource MaterialDesignFloatingHintComboBox}">
<ComboBox.Text>
<Binding Path="AutoHomeLimit" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
</ComboBox.Text>
<ComboBox.SelectedItem>
<Binding Path="AutoHomeLimit" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<domain:NotEmptyValidationRule ValidatesOnTargetUpdated="True" />
</Binding.ValidationRules>
</Binding>
</ComboBox.SelectedItem>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
Expand All @@ -26,9 +31,13 @@
<Label Content="{StaticResource msgDecOffset}" VerticalAlignment="Bottom"/>
<ComboBox md:HintAssist.Hint="{StaticResource cbhintDecOffset}" MinWidth="10" ToolTip="{StaticResource cbhintDecOffset}"
ItemsSource="{Binding DecOffsets}" Style="{StaticResource MaterialDesignFloatingHintComboBox}">
<ComboBox.Text>
<Binding Path="DecOffset" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
</ComboBox.Text>
<ComboBox.SelectedItem>
<Binding Path="DecOffset" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<domain:NotEmptyValidationRule ValidatesOnTargetUpdated="True" />
</Binding.ValidationRules>
</Binding>
</ComboBox.SelectedItem>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
Expand Down
69 changes: 32 additions & 37 deletions GS.Server/Controls/HelixViewport3D.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,39 @@
<Grid.Background>
<ImageBrush ImageSource="{Binding ImageFile, Mode=OneWay, Converter={StaticResource NullImage}}" Stretch="UniformToFill" />
</Grid.Background>
<h:HelixViewport3D ShowCameraInfo="{Binding CameraVis, Mode=OneWay}" Background="Transparent" ShowViewCube="False"
<h:HelixViewport3D ShowCameraInfo="{Binding CameraVis}" Background="Transparent" ShowViewCube="False"
ViewCubeVerticalPosition="Top" ShowCameraTarget="False" >
<h:HelixViewport3D.Camera>
<PerspectiveCamera LookDirection="{Binding LookDirection}"
UpDirection="{Binding UpDirection}"
Position="{Binding Position}"
NearPlaneDistance="0.001"
FarPlaneDistance ="Infinity"
FieldOfView="60"/>
</h:HelixViewport3D.Camera>
<h:SunLight />
<h:GridLinesVisual3D Fill="Black" Width="1600" Length="1600" MajorDistance="200" MinorDistance="200" Thickness="2" Visible="True" />
<h:BoxVisual3D Height="50" Width="100" Length="50" Center="0,-50,500" Fill="Black" />
<h:BoxVisual3D Height="520" Width="50" Length="50" Center="0,0,265" Fill="Black" />
<h:HelixVisual3D Content="{Binding Model}">
<h:HelixVisual3D.Transform>
<Transform3DGroup>
<TranslateTransform3D OffsetX="1" OffsetY="0" OffsetZ="0" />
<RotateTransform3D CenterX="0" CenterY="-104" CenterZ="525">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="1 0 2000" Angle="{Binding XaxisOffset, Mode=OneWay}" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D CenterX="0" CenterY="-102" CenterZ="525">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0 1 0" Angle="{Binding YaxisOffset, Mode=OneWay}" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D CenterX="0" CenterY="-102" CenterZ="525">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="2000 0 1" Angle="{Binding ZaxisOffset, Mode=OneWay}" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<ScaleTransform3D ScaleX="1" ScaleY="1" ScaleZ="1" />
</Transform3DGroup>
</h:HelixVisual3D.Transform>
</h:HelixVisual3D>
<h:BoxVisual3D Height="0" Width="2000" Length="2000" Center="0,0,0" Fill="Transparent" BottomFace="False" BackMaterial="{Binding Compass, Mode=OneWay}" Material="{Binding Compass, Mode=OneWay}" />
<h:HelixViewport3D.Camera>
<PerspectiveCamera FieldOfView="60" LookDirection="{Binding LookDirection, Mode=TwoWay}" UpDirection="{Binding UpDirection, Mode=TwoWay}" Position="{Binding Position,Mode=TwoWay}"/>
</h:HelixViewport3D.Camera>
<h:SunLight />
<h:GridLinesVisual3D Fill="Black" Width="5000" Length="5000" MajorDistance="1000" MinorDistance="1000" Thickness="4" Visible="True" />
<h:BoxVisual3D Height="50" Width="100" Length="50" Center="0,-50,500" Fill="Black" />
<h:BoxVisual3D Height="520" Width="50" Length="50" Center="0,0,265" Fill="Black" />
<h:HelixVisual3D Content="{Binding Model}">
<h:HelixVisual3D.Transform>
<Transform3DGroup>
<TranslateTransform3D OffsetX="1" OffsetY="0" OffsetZ="0" />
<RotateTransform3D CenterX="0" CenterY="-104" CenterZ="525">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="1 0 2000" Angle="{Binding XaxisOffset}" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D CenterX="0" CenterY="-102" CenterZ="525">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0 1 0" Angle="{Binding YaxisOffset}" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D CenterX="0" CenterY="-102" CenterZ="525">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="2000 0 1" Angle="{Binding ZaxisOffset}" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<ScaleTransform3D ScaleX="1" ScaleY="1" ScaleZ="1" />
</Transform3DGroup>
</h:HelixVisual3D.Transform>
</h:HelixVisual3D>
<h:BoxVisual3D Height="0" Width="2000" Length="2000" Center="0,0,0" Fill="Transparent" BottomFace="False" BackMaterial="{Binding Compass, Mode=OneWay}" Material="{Binding Compass, Mode=OneWay}" />
</h:HelixViewport3D>
<Button Width="20" Height="20" Margin="5" ToolTip="{StaticResource btnOpenWin}" Command="{Binding OpenModelWindowCmd}" Style="{StaticResource MaterialDesignRaisedAccentButton}" VerticalAlignment="Top" HorizontalAlignment="Left" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" Visibility="{Binding ModelWinVisability, Converter={StaticResource BoolToVis}}">
<materialDesign:PackIcon Kind="OpenInNew" Margin="-14,-2,0,0" />
Expand Down
20 changes: 14 additions & 6 deletions GS.Server/Gps/GpsDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,27 @@
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,5,0,10">
<ComboBox md:HintAssist.Hint="{StaticResource cbhintGPSCom}" ItemsSource="{Binding ComPorts}" Style="{StaticResource MaterialDesignFloatingHintComboBox}">
<ComboBox.Text>
<Binding Path="GpsComPort" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" />
</ComboBox.Text>
<ComboBox.SelectedItem>
<Binding Path="GpsComPort" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<domain:NotEmptyValidationRule ValidatesOnTargetUpdated="True" />
</Binding.ValidationRules>
</Binding>
</ComboBox.SelectedItem>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
<ComboBox md:HintAssist.Hint="{StaticResource cbhintGPSBaud}" MinWidth="10" Margin="10,0,0,0" ItemsSource="{Binding Source={domain:EnumBindingSource {x:Type enums:SerialSpeed}}}" Style="{StaticResource MaterialDesignFloatingHintComboBox}">
<ComboBox.Text>
<Binding Path="GpsBaudRate" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" />
</ComboBox.Text>
<ComboBox.SelectedItem>
<Binding Path="GpsBaudRate" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<domain:NotEmptyValidationRule ValidatesOnTargetUpdated="True" />
</Binding.ValidationRules>
</Binding>
</ComboBox.SelectedItem>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
Expand Down
3 changes: 3 additions & 0 deletions GS.Server/Model3D/Model3DVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ public Point3D Position
get => _position;
set
{
if (_position == value) return;
_position = value;
OnPropertyChanged();
}
Expand All @@ -339,6 +340,7 @@ public Vector3D LookDirection
get => _lookDirection;
set
{
if (_lookDirection == value) return;
_lookDirection = value;
OnPropertyChanged();
}
Expand All @@ -350,6 +352,7 @@ public Vector3D UpDirection
get => _upDirection;
set
{
if (_upDirection == value) return;
_upDirection = value;
OnPropertyChanged();
}
Expand Down
3 changes: 3 additions & 0 deletions GS.Server/SkyTelescope/SkyTelescopeVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5849,6 +5849,7 @@ public Point3D Position
get => _position;
set
{
if (_position == value) return;
_position = value;
OnPropertyChanged();
}
Expand All @@ -5860,6 +5861,7 @@ public Vector3D LookDirection
get => _lookDirection;
set
{
if (_lookDirection == value) return;
_lookDirection = value;
OnPropertyChanged();
}
Expand All @@ -5871,6 +5873,7 @@ public Vector3D UpDirection
get => _upDirection;
set
{
if (_upDirection == value) return;
_upDirection = value;
OnPropertyChanged();
}
Expand Down
3 changes: 3 additions & 0 deletions GS.Server/Windows/ModelVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ public Point3D Position
get => _position;
set
{
if (_position == value) return;
_position = value;
OnPropertyChanged();
}
Expand All @@ -279,6 +280,7 @@ public Vector3D LookDirection
get => _lookDirection;
set
{
if (_lookDirection == value) return;
_lookDirection = value;
OnPropertyChanged();
}
Expand All @@ -290,6 +292,7 @@ public Vector3D UpDirection
get => _upDirection;
set
{
if (_upDirection == value) return;
_upDirection = value;
OnPropertyChanged();
}
Expand Down
39 changes: 39 additions & 0 deletions GS.Shared/Domain/DebugConverter .cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;

namespace GS.Shared.Domain
{
//Property="{Binding Value, Converter={namespace:DebugExtension}}"
public class DebugConverter : IValueConverter
{
public static readonly DebugConverter Instance = new DebugConverter();
private DebugConverter() { }

#region IValueConverter Members

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Debugger.Break();
return value; //Binding.DoNothing;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
Debugger.Break();
return value; //Binding.DoNothing;
}

#endregion
}

public class DebugExtension : MarkupExtension
{
public override object ProvideValue(IServiceProvider serviceProvider)
{
return DebugConverter.Instance;
}
}
}

0 comments on commit 61671d5

Please sign in to comment.