From f37e051c7fb0c75f04d0d247cd3f3f5665bdb381 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Mon, 12 Jun 2017 15:24:18 +0000 Subject: [PATCH] OmagOFFICE : - Aggiunti angoli d'inclinazione per importazione dxf. --- .../CompoParamPage/CompoParamPageV.xaml | 4 +- DxfImportWindow/DxfImportSceneHostV.xaml.vb | 61 +++++++- DxfImportWindow/DxfImportWindowMap.vb | 45 ++++++ DxfImportWindow/DxfImportWindowV.xaml | 45 ++++-- DxfImportWindow/DxfImportWindowVM.vb | 145 ++++++++++++++++-- OmagOFFICE.vbproj | 1 + SideEntityControl/SideEntityControlVM.vb | 92 +++++++++-- 7 files changed, 354 insertions(+), 39 deletions(-) create mode 100644 DxfImportWindow/DxfImportWindowMap.vb diff --git a/CompoWindow/CompoParamPage/CompoParamPageV.xaml b/CompoWindow/CompoParamPage/CompoParamPageV.xaml index bf51cc1..9c58e41 100644 --- a/CompoWindow/CompoParamPage/CompoParamPageV.xaml +++ b/CompoWindow/CompoParamPage/CompoParamPageV.xaml @@ -12,10 +12,12 @@ Margin="0,0,0,5"> + Style="{StaticResource CompoWindow_ToggleButton}" + Margin="0,0,2.5,0"/> diff --git a/DxfImportWindow/DxfImportSceneHostV.xaml.vb b/DxfImportWindow/DxfImportSceneHostV.xaml.vb index 07451d3..a038108 100644 --- a/DxfImportWindow/DxfImportSceneHostV.xaml.vb +++ b/DxfImportWindow/DxfImportSceneHostV.xaml.vb @@ -3,11 +3,28 @@ Imports EgtWPFLib5 Public Class DxfImportSceneHostV + ' Variabilee che contiene l'entità selezionata + Friend m_nSelectedPart As Integer = GDB_ID.NULL + ' Evento che viene lanciato quando cambia il pezzo selezionato + Public Event SelectedPartChanged(ByVal nPartId As Integer) + ' Proprietà che lancia l'evento quando cambia il valore della variabile + Private Property nSelectedPart As Integer + Get + Return m_nSelectedPart + End Get + Set(value As Integer) + m_nSelectedPart = value + RaiseEvent SelectedPartChanged(value) + End Set + End Property + 'Variabile che contiene l'entità selezionata precedente + Friend m_PrevSelPart As Integer = GDB_ID.NULL + Sub New() ' This call is required by the designer. InitializeComponent() - ' Imposto riferimento - DxfImportWindowVM.m_refDxfImportSceneHostV = Me + ' Creo riferimento a questa classe in CompoWindowMap + DxfImportWindowMap.SetRefDxfImportSceneHostV(Me) ' Inizializzazione Scena PreInitializeScene() ImportDxfScene.Init() @@ -84,4 +101,44 @@ Public Class DxfImportSceneHostV EgtSetGridShow(bShowGrid, False) End Sub +#Region "EVENTS" + + Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles ImportDxfScene.OnMouseDownScene + ' Solo con il tasto sinistro e se stato NULL + If e.Button <> Windows.Forms.MouseButtons.Left Or Not ImportDxfScene.IsStatusNull() Then Return + If Not DxfImportWindowMap.refDxfImportWindowVM.VerifyIfSelectPart() Then Return + ' Verifico se selezionato indicativo di pezzo + EgtSetObjFilterForSelWin(True, True, True, True, True) + Dim nSel As Integer + EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel) + Dim nId As Integer = EgtGetFirstObjInSelWin() + While nId <> GDB_ID.NULL + ' Recupero l'identificativo del pezzo cui appartiene + Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId)) + If EgtIsPart(nPartId) Then + Dim nStat As Integer = GDB_ST.ON_ + EgtGetStatus(nPartId, nStat) + If nStat = GDB_ST.SEL Then + EgtDeselectObj(nPartId) + m_PrevSelPart = nSelectedPart + nSelectedPart = GDB_ID.NULL + Else + EgtDeselectAll() + EgtSelectObj(nPartId) + m_PrevSelPart = nSelectedPart + nSelectedPart = nPartId + End If + EgtDraw() + Exit While + End If + nId = EgtGetNextObjInSelWin() + End While + End Sub + + Private Sub Me_SelectedPartChanged(nPartId As Integer) Handles Me.SelectedPartChanged + DxfImportWindowMap.refDxfImportWindowVM.SelectedPartChanged() + End Sub + +#End Region ' EVENTS + End Class diff --git a/DxfImportWindow/DxfImportWindowMap.vb b/DxfImportWindow/DxfImportWindowMap.vb new file mode 100644 index 0000000..01269b6 --- /dev/null +++ b/DxfImportWindow/DxfImportWindowMap.vb @@ -0,0 +1,45 @@ +Friend Module DxfImportWindowMap + + Private m_refDxfImportWindowVM As DxfImportWindowVM + Private m_refDxfImportSceneHostV As DxfImportSceneHostV + +#Region "Get" + + Public ReadOnly Property refDxfImportWindowVM As DxfImportWindowVM + Get + Return m_refDxfImportWindowVM + End Get + End Property + + Public ReadOnly Property refDxfImportSceneHostV As DxfImportSceneHostV + Get + Return m_refDxfImportSceneHostV + End Get + End Property + +#End Region ' Get + +#Region "Set" + + Friend Function SetRefDxfImportSceneHostV(DxfImportSceneHostV As DxfImportSceneHostV) As Boolean + m_refDxfImportSceneHostV = DxfImportSceneHostV + Return Not IsNothing(m_refDxfImportSceneHostV) + End Function + +#End Region ' Set + +#Region "Init" + + Friend Function BeginInit(DxfImportWindowVM As DxfImportWindowVM) As Boolean + m_refDxfImportWindowVM = DxfImportWindowVM + Return Not IsNothing(m_refDxfImportWindowVM) + End Function + + Friend Function EndInit() As Boolean + ' Verifico se tutti i pezzi necessari sono stati caricati + Return Not IsNothing(m_refDxfImportWindowVM) AndAlso Not IsNothing(m_refDxfImportSceneHostV) + End Function + +#End Region ' Init + +End Module diff --git a/DxfImportWindow/DxfImportWindowV.xaml b/DxfImportWindow/DxfImportWindowV.xaml index d2a1d4a..7c1e9c6 100644 --- a/DxfImportWindow/DxfImportWindowV.xaml +++ b/DxfImportWindow/DxfImportWindowV.xaml @@ -10,14 +10,21 @@ - +