- aggiunta l'UC per la rotazione.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<UserControl x:Class="RotateV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:EgtStone3D"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel Name ="WinRotate" Orientation="Vertical" VerticalAlignment="Top">
|
||||
<Label Name="TopBar"
|
||||
Content="Seleziona l'asse di rotazione" HorizontalAlignment="Center"
|
||||
Width="Auto"/>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Name="Testo" Height="26"
|
||||
Foreground="Black"
|
||||
Margin="1,5,1,0"
|
||||
Text="Angolo"
|
||||
TextAlignment="Center"
|
||||
Grid.Column="0"
|
||||
IsEnabled="True"/>
|
||||
<TextBox Name="RotInputData" Height="26"
|
||||
Foreground="Black"
|
||||
Margin="1,5,1,0"
|
||||
Grid.Column="1"
|
||||
Text="0"
|
||||
HorizontalContentAlignment="Right"
|
||||
VerticalContentAlignment="Center"
|
||||
IsEnabled="False"/>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Name="Conferma"
|
||||
Grid.Column="0"
|
||||
Content="Conferma"/>
|
||||
<Button Name="Annulla"
|
||||
Grid.Column="1"
|
||||
Content="Annulla"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,24 @@
|
||||
Public Class RotateV
|
||||
Private RotateOperation As RotateVM
|
||||
Sub New()
|
||||
|
||||
' La chiamata è richiesta dalla finestra di progettazione.
|
||||
InitializeComponent()
|
||||
RotateOperation = New RotateVM
|
||||
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
|
||||
Dim PartSolidSel As PartSolidM = SolidManagerM.GetPartSolid(Map.refSceneHostV.m_nIdPart)
|
||||
If IsNothing(PartSolidSel) Then Annulla_click()
|
||||
PartSolidSel.ShowAxis()
|
||||
End Sub
|
||||
Private Sub Conferma_click() Handles Conferma.Click
|
||||
RotateOperation.Conferma(Me)
|
||||
End Sub
|
||||
|
||||
Private Sub Annulla_click() Handles Annulla.Click
|
||||
RotateOperation.Annulla(Me)
|
||||
End Sub
|
||||
|
||||
Public Sub AngText_Changed() Handles RotInputData.TextChanged
|
||||
If Not IsNothing(Map.refSceneButtonV.m_RotateUC) Then RotateOperation.AngText_Changed()
|
||||
End Sub
|
||||
End Class
|
||||
@@ -0,0 +1,35 @@
|
||||
Imports EgtUILib.EgtInterface
|
||||
|
||||
Public Class RotateVM
|
||||
Public Sub Conferma(RotateView As RotateV)
|
||||
Map.refSceneButtonV.RemoveRotateUC(RotateView)
|
||||
DirectCast(DirectCast(Map.refSceneButtonV.DataContext, SceneButtonVM).GetButton("Rotate"), _ToggleButton).IsChecked = False
|
||||
End Sub
|
||||
|
||||
Public Sub Annulla(RotateView As RotateV)
|
||||
Map.refSceneButtonV.RemoveRotateUC(RotateView)
|
||||
DirectCast(DirectCast(Map.refSceneButtonV.DataContext, SceneButtonVM).GetButton("Rotate"), _ToggleButton).IsChecked = False
|
||||
End Sub
|
||||
|
||||
Public Sub AngText_Changed()
|
||||
If Not DirectCast(DirectCast(Map.refSceneButtonV.DataContext, SceneButtonVM).GetButton("Rotate"), _ToggleButton).IsChecked Then Return
|
||||
Dim nId As Integer = Map.refSceneHostV.m_nIdPart
|
||||
If nId = GDB_ID.NULL Then Return
|
||||
Dim sAng As String = Map.refSceneButtonV.m_RotateUC.RotInputData.Text
|
||||
If String.IsNullOrEmpty(sAng) Then Return
|
||||
If Not IsNumeric(sAng) Then Return
|
||||
Dim dAng As Double = CDbl(sAng)
|
||||
If Map.refSceneHostV.m_dAngRot <> 0 Then
|
||||
ResetRotation(False, False)
|
||||
End If
|
||||
Dim PartSolidIdSel = SolidManagerM.GetPartSolid(nId)
|
||||
Dim vtDir As Vector3d
|
||||
Dim ptStart As Point3d
|
||||
If PartSolidIdSel.nIdLineAxisRotate = GDB_ID.NULL Then Return
|
||||
EgtStartPoint(PartSolidIdSel.nIdLineAxisRotate, GDB_ID.ROOT, ptStart)
|
||||
EgtStartVector(PartSolidIdSel.nIdLineAxisRotate, GDB_ID.ROOT, vtDir)
|
||||
SolidManagerM.Rotate(nId, ptStart, vtDir, dAng)
|
||||
|
||||
Map.refSceneHostV.m_dAngRot = dAng
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user