From fb1639e37fa07b55ae2f88158dd7065a37f9e3d1 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Thu, 10 Jun 2021 18:02:55 +0200 Subject: [PATCH 1/7] Gestione del pulsante "Indietro" nei compo Interni --- DrawImport/CompoDimensionUC.xaml.vb | 43 +++++++++++++++++---- DrawImport/DrawPageUC.xaml.vb | 15 +++++++ DrawImport/InternalComponentPageUC.xaml.vb | 22 ++++++++++- DrawImport/SecondaryComponentPageUC.xaml.vb | 3 ++ 4 files changed, 73 insertions(+), 10 deletions(-) diff --git a/DrawImport/CompoDimensionUC.xaml.vb b/DrawImport/CompoDimensionUC.xaml.vb index 877ae92..98d29a1 100644 --- a/DrawImport/CompoDimensionUC.xaml.vb +++ b/DrawImport/CompoDimensionUC.xaml.vb @@ -33,6 +33,17 @@ Public Class CompoDimensionUC ' Imposto questa come pagina correntemente visualizzata nella drawpage m_DrawPage.m_ActiveComponentPage = DrawPageUC.Pages.CompoDimension + ' se arrivo dalla pagina delle componenti interne allora esco (non devo ricalcolare i parametri) + If m_DrawPage.m_bBackFromInternalCompo Then + ShowInternalBtn(True) + ' Se componente interno visualizzo bottoni aggiungi rimuovi + ShowAddRemoveBtn(m_DrawPage.m_bInternalCompo) + ' Imposto contesto corrente e faccio uno ZoomAll della scena con il componente + EgtSetCurrentContext(m_MainWindow.m_DrawPageUC.DrawScene.GetCtx()) + EgtZoom(ZM.ALL) + Return + End If + ' Se componente interno disabilito il bottone di ok della drawpage If m_DrawPage.m_bInternalCompo Then m_DrawPage.OkBtn.IsEnabled = False @@ -58,6 +69,7 @@ Public Class CompoDimensionUC m_DrawPage.OkBtn.IsEnabled = True End Sub + ' rende visibile il bottone per inserire le componenti interne: solo nella pagine delle componenti Friend Sub ShowInternalBtn(value As Boolean) If value Then InternComponentBtn.Visibility = Windows.Visibility.Visible @@ -66,6 +78,7 @@ Public Class CompoDimensionUC End If End Sub + ' definisce se rendere visbile oppure no i bottone "Aggiungi" e "Rimuovi": presenti solo nella componenti interne Friend Sub ShowAddRemoveBtn(value As Boolean) If value Then m_DrawPage.SideAngleBtn.IsEnabled = False @@ -233,7 +246,18 @@ Public Class CompoDimensionUC m_DrawPage.UpdateView() End Sub + Public Sub CollapsedAllParam() + For i = 1 To NUM_VAR + GetNameEdit(i).Visibility = Visibility.Collapsed + GetValueEdit(i).Visibility = Visibility.Collapsed + Next + End Sub + +#Region "METHODS for InternalCompo" + + ' visualizzo la pagina per la selezione delle componenti interne Private Sub InternComponentBtn_Click(sender As Object, e As RoutedEventArgs) Handles InternComponentBtn.Click + m_DrawPage.m_bBackFromInternalCompo = False ' imposto contesto EgtSetCurrentContext(m_DrawPage.DrawScene.GetCtx()) ' Nascondo layer etichette e quotature @@ -248,6 +272,7 @@ Public Class CompoDimensionUC m_DrawPage.LeftButtonGrd.Children.Add(m_InternalCompoPage) End Sub + ' Bottone utilizzato per inserire le componenti interne Private Sub AddBtn_Click(sender As Object, e As RoutedEventArgs) Handles AddBtn.Click ' Se componente errato, non faccio alcunché If Not m_DrawPage.m_bDrawOk Then Return @@ -266,15 +291,10 @@ Public Class CompoDimensionUC End While End If ' Esco dalla pagina - m_DrawPage.VariablesGrd.Children.Remove(Me) - m_DrawPage.LeftButtonGrd.Children.Add(m_InternalCompoPage) - ' Reset componente - m_MainWindow.m_DrawPageUC.ResetCompoName() - ' Deseleziono oggetto corrente e aggiorno visualizzazione - EgtDeselectAll() - EgtDraw() + ExitInternalVariable() End Sub + ' annulla l'inserimento della componente corrente Private Sub CancelBtn_Click(sender As Object, e As RoutedEventArgs) Handles CancelBtn.Click ' Cancello layer con contorno errato Dim nId As Integer = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT), "ErrorLay") @@ -292,7 +312,13 @@ Public Class CompoDimensionUC Else m_DrawPage.m_bDrawOk = True End If - ' Sistemo interfaccia + ' Esco dalla pagina + ExitInternalVariable() + End Sub + + ' Esco dalla pagine delle variabili della componente interna: reimposto la pagina della componenti interne + Private Sub ExitInternalVariable() + ' Esco dalla pagina m_DrawPage.VariablesGrd.Children.Remove(Me) m_DrawPage.LeftButtonGrd.Children.Add(m_InternalCompoPage) ' Reset componente @@ -302,4 +328,5 @@ Public Class CompoDimensionUC EgtDraw() End Sub +#End Region ' METHODS for InternalCompo End Class diff --git a/DrawImport/DrawPageUC.xaml.vb b/DrawImport/DrawPageUC.xaml.vb index a6b3c9f..46041a6 100644 --- a/DrawImport/DrawPageUC.xaml.vb +++ b/DrawImport/DrawPageUC.xaml.vb @@ -32,6 +32,7 @@ Public Class DrawPageUC ' Variabile che indica se componenti interni o esterni Friend m_bInternalCompo As Boolean = False + Friend m_bBackFromInternalCompo As Boolean = False ' Properties Private m_sCompoDir As String = String.Empty @@ -40,6 +41,10 @@ Public Class DrawPageUC Friend m_bDrawOk As Boolean = False Private m_bFirst As Boolean = True + ' questa variabile serve per risalire al nome della componente che ospita i componenti interni att + Friend m_sMainCompo As String = String.Empty + + ' Trf Data Private m_bTrfData As Boolean = False Private m_TrfOrderCode As String = "" @@ -179,6 +184,7 @@ Public Class DrawPageUC End Sub + ' carico le impostazioni grafiche della scena (solo al primo avvio) Private Sub DrawPage_Loaded(sender As Object, e As RoutedEventArgs) If m_bFirst Then @@ -264,6 +270,7 @@ Public Class DrawPageUC m_sCsvName = "" End Sub + ' recupero il click sulla scena ed assegno il metodo a secondo della pagina aperta Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles DrawScene.OnMouseDownScene ' Si può selezionare solo con il tasto sinistro e se stato NULL If e.Button <> Windows.Forms.MouseButtons.Left Or Not DrawScene.IsStatusNull() Then Return @@ -497,6 +504,7 @@ Public Class DrawPageUC If sCompo = m_sCompoName Then Return End If + m_sCompoName = sCompo ' Pulisco l'ambiente lua ResetLuaVariables() @@ -858,6 +866,9 @@ Public Class DrawPageUC End Function Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click + m_bBackFromInternalCompo = False + m_bInternalCompo = False + m_SceneButtons.MeasureBtn.IsChecked = False ' se sto definendo un componente interno non posso uscire If m_ActiveComponentPage = Pages.CompoDimension And m_bInternalCompo Then Return @@ -884,7 +895,11 @@ Public Class DrawPageUC End Sub + ' esco dalla pagina corrente Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click + m_bBackFromInternalCompo = False + m_bInternalCompo = False + m_SceneButtons.MeasureBtn.IsChecked = False ' Elimino nome del componente precedente m_sCompoName = String.Empty diff --git a/DrawImport/InternalComponentPageUC.xaml.vb b/DrawImport/InternalComponentPageUC.xaml.vb index 6ac6312..45bec23 100644 --- a/DrawImport/InternalComponentPageUC.xaml.vb +++ b/DrawImport/InternalComponentPageUC.xaml.vb @@ -17,9 +17,10 @@ Public Class InternalComponentPageUC m_bIsFirstPage = True LoadPage() CurrentBtn = Nothing + ' bottone per selezionare la seconda pagina di componenti interni Compo9.SetValue(Grid.ColumnProperty, 0) Compo9.SetValue(Grid.ColumnSpanProperty, 2) - LabelCompo9.Text = EgtMsg(MSG_COMPONENTPAGEUC + 9) + LabelCompo9.Text = EgtMsg(MSG_COMPONENTPAGEUC + 9) ' Altri ImageCompo9.Visibility = Windows.Visibility.Hidden LabelCompo9.Visibility = Windows.Visibility.Visible ' Se i componenti interni sono più di 8 viene visualizzato il bottone "Altri" altrimenti no @@ -364,7 +365,24 @@ Public Class InternalComponentPageUC Private Sub BackBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackBtn.Click m_MainWindow.m_DrawPageUC.m_SceneButtons.MeasureBtn.IsChecked = False - m_MainWindow.m_DrawPageUC.BackBtn_Click(sender, e) + + ' torno alla pagina iniziale di selezione del piano (Compo) + 'm_MainWindow.m_DrawPageUC.BackBtn_Click(sender, e) + + '--------- NUOVA GESTIONE --------- + ' rimuovo l'elenco di bottoni per selezionare il tipo di componente interna + m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Remove(Me) + ' inserisco nella Grid VaribalsesGrid lo UeserControl per definire le dimensioni della componente + m_MainWindow.m_DrawPageUC.VariablesGrd.Children.Add(m_MainWindow.m_DrawPageUC.m_CompoDimension) + ' nascondo la lista dei parametri + m_MainWindow.m_DrawPageUC.m_CompoDimension.CollapsedAllParam() + ' sto uscendo dalla componente interna (quindi comunico il cambio di componente) + m_MainWindow.m_DrawPageUC.m_bInternalCompo = False + ' comunico che sto arrivando da una componente interna + m_MainWindow.m_DrawPageUC.m_bBackFromInternalCompo = True + + 'm_MainWindow.m_DrawPageUC.SelectedComponent(m_MainWindow.m_DrawPageUC.m_sMainCompo) + 'm_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.CompoDimension End Sub End Class diff --git a/DrawImport/SecondaryComponentPageUC.xaml.vb b/DrawImport/SecondaryComponentPageUC.xaml.vb index e20c999..45db614 100644 --- a/DrawImport/SecondaryComponentPageUC.xaml.vb +++ b/DrawImport/SecondaryComponentPageUC.xaml.vb @@ -14,6 +14,7 @@ Public Class SecondaryComponentPageUC ' Variabile che contiene il nome del componente selezionato Friend m_sCurrCompo As String = String.Empty + ' dopo aver definito la forma della componente definisco quali parametri usare per la sua definizione Private Sub SecondaryComponentPage_Loaded(sender As Object, e As RoutedEventArgs) m_MainComponentPage = m_MainWindow.m_DrawPageUC.m_MainComponentPage @@ -219,8 +220,10 @@ Public Class SecondaryComponentPageUC ' Carico componente m_MainWindow.m_DrawPageUC.SelectedComponent(sCompo) + m_MainWindow.m_DrawPageUC.m_sMainCompo = sCompo m_sCurrCompo = "Compo" & GetButtonNumber(CurrentBtn.Name) m_MainWindow.m_DrawPageUC.VariablesGrd.Children.Add(m_MainWindow.m_DrawPageUC.m_CompoDimension) + 'm_MainWindow.m_DrawPageUC.DimensionBtn.IsChecked = True m_MainWindow.m_DrawPageUC.SideAngleBtn.IsChecked = False m_MainWindow.m_DrawPageUC.FiloTopBtn.IsChecked = False From 4e79447e5987be368d161eb7ca868b6d476562dc Mon Sep 17 00:00:00 2001 From: NicolaP Date: Wed, 16 Jun 2021 20:44:10 +0200 Subject: [PATCH 2/7] Prototipo pagina Alz/Front --- DrawImport/AlzFrontUC.xaml | 210 +++++++++ DrawImport/AlzFrontUC.xaml.vb | 485 +++++++++++++++++++++ DrawImport/CompoDimensionUC.xaml | 18 +- DrawImport/CompoDimensionUC.xaml.vb | 45 +- DrawImport/DrawPageUC.xaml.vb | 31 +- DrawImport/InternalComponentPageUC.xaml.vb | 3 +- OmagCUT.vbproj | 7 + 7 files changed, 783 insertions(+), 16 deletions(-) create mode 100644 DrawImport/AlzFrontUC.xaml create mode 100644 DrawImport/AlzFrontUC.xaml.vb diff --git a/DrawImport/AlzFrontUC.xaml b/DrawImport/AlzFrontUC.xaml new file mode 100644 index 0000000..8d6f67f --- /dev/null +++ b/DrawImport/AlzFrontUC.xaml @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DrawImport/AlzFrontUC.xaml.vb b/DrawImport/AlzFrontUC.xaml.vb new file mode 100644 index 0000000..c75e05e --- /dev/null +++ b/DrawImport/AlzFrontUC.xaml.vb @@ -0,0 +1,485 @@ +Imports EgtUILib + +Public Class AlzFrontUC + ' Riferimento alla MainWindow + Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) + ' Riferimento alla pagina che ha aperto SideAngleUC + Private m_CallingPage As MainWindow.Pages + + ' Gestione pagine + Private Const MAX_LINES As Integer = 10 + ' lista dei lati, in cui indico il tipo di entità da associare + Private AlzFrontEntityList As New List(Of AlzFrontEntity) + + ' numero di lati presenti nella figura + Private m_nCount As Integer = 0 + ' numero di righe rese disponibili nella pagina -> m_nShow = min(m_nCount, MAX_LINE) + Private m_nShow As Integer = MAX_LINES + + ' layer per inserire le descrizione dei lati + Private m_AlzLayer As Integer + Private m_Frontlayer As Integer + Private m_dBBoxRad As Double + + Private Sub AlzFrontPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded + + m_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.AlzFront + + ' numero di elemnti presenti nella lista SideAngle/DripEntity + m_nCount = 0 + ' numero di righe rese disponibili nella pagina -> m_nShow = min(m_nCount, MAX_LINE) + m_nShow = 0 + + ' carico la lista dei lati della figura + InitSides() + ' aggiorno la visualizzazione delle TextBox e dei CheckBox + TxBlChBxView() + + ' nascondo il bottone Back della pagina Draw + m_MainWindow.m_DrawPageUC.BackBtn.Visibility = Visibility.Hidden + m_MainWindow.m_DrawPageUC.MessageGrid.Visibility = Visibility.Hidden + ' Abilito bottoni angoli di fianco e lavorazioni da sotto + m_MainWindow.m_DrawPageUC.SideAngleBtn.IsEnabled = m_MainWindow.m_DrawPageUC.bEnableSideAngle + m_MainWindow.m_DrawPageUC.FiloTopBtn.IsEnabled = m_MainWindow.m_CurrentMachine.bMilling + m_MainWindow.m_DrawPageUC.EngraveBtn.IsEnabled = True + m_MainWindow.m_DrawPageUC.DripCutBtn.IsEnabled = m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.UNDER_CUT) And + Not String.IsNullOrWhiteSpace(m_MainWindow.m_CurrentMachine.sCurrDripSaw) + + ' nome dei parametri condivisi + Parameter1TxBl.Text = "Altezza" + Parameter2TxBl.Text = "Delta angolo" + + EgtZoom(ZM.ALL) + End Sub + + ' carico la lista dei lati della figura corrente + Private Sub InitSides() + ' pulisco la lista dei lati + AlzFrontEntityList.Clear() + Dim PartId As Integer = GDB_ID.NULL + ' Id del loop eseterno + Dim LoopId As Integer = GDB_ID.NULL + + ' Imposto contesto corrente + EgtSetCurrentContext(m_MainWindow.m_DrawPageUC.DrawScene.GetCtx()) + ' Ricavo nome primo pezzo + PartId = EgtGetFirstPart() + ' Recupero nome layer con geometria di contorno (esterno o interno) del pezzo + LoopId = EgtGetFirstNameInGroup(EgtGetFirstPart(), NAME_OUTLOOP) + + 'Determino se loop esterno o interno + Dim sLoopName As String = "" + Dim bOutLoop As Boolean = (EgtGetName(LoopId, sLoopName) AndAlso sLoopName = NAME_OUTLOOP) + ' Calcolo dimensione ingombro Loop + Dim ptMin, ptMax As Point3d + EgtGetBBoxGlob(LoopId, GDB_BB.STANDARD, ptMin, ptMax) + ' utilizzato per definire la dimensione dei caratteri delle label per i lati + m_dBBoxRad = 0.5 * Point3d.DistXY(ptMin, ptMax) + + ' Creo layer per testi ALZATINE + m_AlzLayer = EgtGetFirstNameInGroup(PartId, "Alzatina") + If m_AlzLayer = GDB_ID.NULL And PartId <> GDB_ID.NULL Then + m_AlzLayer = EgtCreateGroup(PartId) + EgtSetName(m_AlzLayer, "Alzatina") + EgtSetColor(m_AlzLayer, New Color3d(0, 0, 0)) + End If + + ' Creo layer per testi FRONTALINI + m_Frontlayer = EgtGetFirstNameInGroup(PartId, "Frontalino") + If m_Frontlayer = GDB_ID.NULL And PartId <> GDB_ID.NULL Then + m_Frontlayer = EgtCreateGroup(PartId) + EgtSetName(m_Frontlayer, "Frontalino") + EgtSetColor(m_Frontlayer, New Color3d(0, 100, 0)) + End If + + ' Recupero Id della curva del Loop Esterno + Dim PrevLine As Integer = EgtGetLastInGroup(LoopId) + Dim CurrLine As Integer = EgtGetFirstInGroup(LoopId) + ' Creo indice per numerare le entità in ImportPage + Dim nEntityIndex As Integer = 1 + Dim nOtherIndex As Integer = 1 + + ' Ciclo che verifica se possibile inclinare la curva corrente o inserire un gocciolatoio + While CurrLine <> GDB_ID.NULL + Dim NextLine As Integer = EgtGetNext(CurrLine) + If NextLine = GDB_ID.NULL Then NextLine = EgtGetFirstInGroup(LoopId) + + If EgtGetType(CurrLine) = GDB_TY.CRV_LINE Then + ' Aggiungo il lato alla lista di quelli su cui è possibile mettere il gocciolatoio + Dim sNameCurrLine As String = String.Empty + EgtGetName(CurrLine, sNameCurrLine) + AlzFrontEntityList.Add(New AlzFrontEntity(sNameCurrLine, CurrLine)) + nEntityIndex += 1 + End If + + PrevLine = CurrLine + CurrLine = EgtGetNext(CurrLine) + End While + + ' Aggiorno numero di lati carciati + m_nCount = AlzFrontEntityList.Count() + ' Aggiorno numero item visualizzati nella pagina iniziale + m_nShow = Math.Min(m_nCount, MAX_LINES) + + ' Se non ci sono lati su cui operare, messaggio utente + If LoopId <> GDB_ID.NULL Then + If m_nCount = 0 Then + If m_CallingPage = MainWindow.Pages.Draw Then + m_MainWindow.m_DrawPageUC.MessageTxBx.Text = EgtMsg(MSG_DRAWPAGEUC + 7) ' Non ci sono lati modificabili + m_MainWindow.m_DrawPageUC.MessageBrd.Background = Application.Current.FindResource("OmagCut_Yellow") + Else + m_MainWindow.m_ImportPageUC.MessageTxBx.Text = EgtMsg(MSG_DRAWPAGEUC + 7) ' Non ci sono lati modificabili + m_MainWindow.m_ImportPageUC.MessageBrd.Background = Application.Current.FindResource("OmagCut_Yellow") + End If + Else + If m_CallingPage = MainWindow.Pages.Draw Then + m_MainWindow.m_DrawPageUC.MessageTxBx.Text = "" + m_MainWindow.m_DrawPageUC.MessageBrd.Background = Brushes.Transparent + Else + m_MainWindow.m_ImportPageUC.MessageTxBx.Text = "" + m_MainWindow.m_ImportPageUC.MessageBrd.Background = Brushes.Transparent + End If + End If + End If + + End Sub + + ' Imposto la visibilità degli oggetti nella pagina: qui eseguo l'impaginazione + Private Sub TxBlChBxView() + + If m_nCount = 0 Then + ' nascondo il nome delle colonne + SideAngleBl.Visibility = Windows.Visibility.Hidden + HeelBl.Visibility = Windows.Visibility.Hidden + Else + ' definisco il posizionamento del nome (Alz.) delle colonne all'interno della grigia + Grid.SetRow(SideAngleBl, MAX_LINES - m_nShow) + SideAngleBl.Text = "Alz." + SideAngleBl.Visibility = Windows.Visibility.Visible + ' definisco il posizionamento del nome (Front.) delle colonne all'interno della grigia + Grid.SetRow(HeelBl, MAX_LINES - m_nShow) + HeelBl.Text = "Front." + HeelBl.Visibility = Windows.Visibility.Visible + End If + + ' Lati visibili + For nI As Integer = 1 To m_nShow + Dim Index As Integer = MAX_LINES - m_nShow + nI + ' definisco la visibilità della label + GetTxBlFromIndex(Index).Visibility = Windows.Visibility.Visible + ' definisco il nome della label (se volessi associare direttamente il nome della linea dovrei riordinare la lista!) + GetTxBlFromIndex(Index).Text = "A" & nI.ToString + + GetChBxFromIndex(Index).Visibility = Windows.Visibility.Visible + ' aggiungo i campi per allungare e accorciare i lati + GetAngleTxBxFromIndex(Index).Visibility = Windows.Visibility.Visible + GetHeelTxBxFromIndex(Index).Visibility = Windows.Visibility.Visible + Next + + ' Lati nascosti: nascondo i lati partendo dall'alto (se ho 4 lati la prima TextBx disponibile è la settima -> 11-4 = 7 lati nascosti) + For Index As Integer = 1 To MAX_LINES - m_nShow + GetChBxFromIndex(Index).Visibility = Windows.Visibility.Hidden + GetAngleTxBxFromIndex(Index).Visibility = Windows.Visibility.Hidden + GetHeelTxBxFromIndex(Index).Visibility = Windows.Visibility.Hidden + GetTxBlFromIndex(Index).Visibility = Windows.Visibility.Hidden + + Next + End Sub + + ' Permette di aggiugere accanto alla linea passata + Friend Function AddTextToLine(sText As String, TextLayer As Integer, CurrLine As Integer, dDistance As Double, + dBBoxRad As Double, bTextExt As Boolean, Optional bRot As Boolean = False) As Integer + ' Calcolo altezza testo + Dim dH As Double = 0.05 * dBBoxRad + ' Creo testo + Dim nText As Integer = EgtCreateTextAdv(TextLayer, Point3d.ORIG(), 0, sText, "", 500, False, dH, 1, 0, INS_POS.MC) + ' Calcolo posizionamento + ' BBox del testo e suo centro + Dim ptMinBBox As Point3d + Dim ptMaxBBox As Point3d + EgtGetBBox(nText, GDB_BB.STANDARD, ptMinBBox, ptMaxBBox) + Dim ptMidBBox As Point3d + ptMidBBox = Point3d.Media(ptMinBBox, ptMaxBBox) + ' Punto medio della curva + Dim ptMid As Point3d + EgtMidPoint(CurrLine, nText, ptMid) + ' Versore sul punto medio della curva + Dim vtMid As Vector3d + EgtMidVector(CurrLine, nText, vtMid) + ' versore perpendicolare alla CurrLine che punta verso il testo + Dim vtOrto As New Vector3d(vtMid) + If bTextExt Then + vtOrto.Rotate(Vector3d.Z_AX(), -90) + Else + vtOrto.Rotate(Vector3d.Z_AX(), 90) + End If + ' eventuale rotazione del testo + Dim dRotAng As Double = 0 + If bRot Then + dRotAng = Math.Atan2(vtMid.y, vtMid.x) * 180 / Math.PI + Dim dSpecRotAng = dRotAng + If dSpecRotAng > 91 Then + dSpecRotAng -= 180 + ElseIf dSpecRotAng < -89 Then + dSpecRotAng += 180 + End If + EgtRotate(nText, Point3d.ORIG(), Vector3d.Z_AX(), dSpecRotAng) + End If + ' vettore dal centro del BBox all'estremo più vicino + Dim vtptExtptMC As Vector3d + If bRot Then + vtptExtptMC = New Vector3d(0, ptMidBBox.y - ptMinBBox.y, 0) + vtptExtptMC.Rotate(Vector3d.Z_AX(), dRotAng) + Else + If bTextExt Then + If vtMid.x > 0 Then + If vtMid.y > 0 Then + vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) + Else + vtptExtptMC = ptMidBBox - ptMaxBBox + End If + Else + If vtMid.y > 0 Then + vtptExtptMC = ptMidBBox - ptMinBBox + Else + vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) + End If + End If + Else + If vtMid.x > 0 Then + If vtMid.y > 0 Then + vtptExtptMC = ptMidBBox - New Point3d(ptMaxBBox.x, ptMinBBox.y, 0) + Else + vtptExtptMC = ptMidBBox - ptMinBBox + End If + Else + If vtMid.y > 0 Then + vtptExtptMC = ptMidBBox - ptMaxBBox + Else + vtptExtptMC = ptMidBBox - New Point3d(ptMinBBox.x, ptMaxBBox.y, 0) + End If + End If + End If + End If + ' Calcolo il centro del testo + Dim ptTextMC As Point3d = ptMid + vtOrto * (dDistance + (vtOrto * vtptExtptMC)) + EgtMove(nText, (ptTextMC - Point3d.ORIG())) + Return nText + End Function + +#Region "CHIAMATA ALLE TEXT/CHECK/LABEL" + Private Function GetChBxFromIndex(Index As Integer) As CheckBox + Select Case Index + Case 1 + Return A1 + Case 2 + Return A2 + Case 3 + Return A3 + Case 4 + Return A4 + Case 5 + Return A5 + Case 6 + Return A6 + Case 7 + Return A7 + Case 8 + Return A8 + Case 9 + Return A9 + Case Else + Return A10 + End Select + End Function + + Private Function GetAngleTxBxFromIndex(Index As Integer) As EgtWPFLib.EgtTextBox + Select Case Index + Case 1 + Return A1TxBx + Case 2 + Return A2TxBx + Case 3 + Return A3TxBx + Case 4 + Return A4TxBx + Case 5 + Return A5TxBx + Case 6 + Return A6TxBx + Case 7 + Return A7TxBx + Case 8 + Return A8TxBx + Case 9 + Return A9TxBx + Case Else + Return A10TxBx + End Select + End Function + + Private Function GetHeelTxBxFromIndex(Index As Integer) As EgtWPFLib.EgtTextBox + Select Case Index + Case 1 + Return H1TxBx + Case 2 + Return H2TxBx + Case 3 + Return H3TxBx + Case 4 + Return H4TxBx + Case 5 + Return H5TxBx + Case 6 + Return H6TxBx + Case 7 + Return H7TxBx + Case 8 + Return H8TxBx + Case 9 + Return H9TxBx + Case Else + Return H10TxBx + End Select + End Function + + Private Function GetTxBlFromIndex(Index As Integer) As TextBlock + Select Case Index + Case 1 + Return Entity1 + Case 2 + Return Entity2 + Case 3 + Return Entity3 + Case 4 + Return Entity4 + Case 5 + Return Entity5 + Case 6 + Return Entity6 + Case 7 + Return Entity7 + Case 8 + Return Entity8 + Case 9 + Return Entity9 + Case Else + Return Entity10 + End Select + End Function + +#End Region ' Chiamata elle Text/Check/Label + + ' Per gestire la selezione delle Alzatine (devo ancora definire la CheckBox: An) + Private Sub A_Checked(sender As Object, e As RoutedEventArgs) Handles A1.Checked, A2.Checked, A3.Checked, A4.Checked + ' recupero il nome della Check selezionata + Dim sChName As String = DirectCast(sender, CheckBox).Name + Dim sItems As String() = Split(sChName, "A") + Dim nIndex As Integer + If sItems.Count > 1 Then + nIndex = CInt(sItems(1)) + End If + Dim j As Integer = nIndex - (MAX_LINES - m_nShow) + AddTextToLine(AlzFrontEntityList(j).SideName, m_AlzLayer, AlzFrontEntityList(j).Id, 20, m_dBBoxRad, True) + + 'For j = 0 To AlzFrontEntityList.Count() - 1 + ' If AlzFrontEntityList(j).SideName = sChName Then + ' If sChName = "A1" Or sChName = "A3" Or sChName = "A5" Or sChName = "A7" Then + ' AddTextToLine(AlzFrontEntityList(j).SideName, m_AlzLayer, AlzFrontEntityList(j).Id, 20, m_dBBoxRad, True) + ' Else + ' AddTextToLine(AlzFrontEntityList(j).SideName, m_Frontlayer, AlzFrontEntityList(j).Id, 20, m_dBBoxRad, True) + ' End If + ' Exit For + ' End If + 'Next + + EgtDraw() + End Sub + + ' Per gestire la selezione dei Frontalini (devo ancora definire la CheckBox: Fn) + 'Private Sub F_Checked(sender As Object, e As RoutedEventArgs) Handles A1.Checked, A2.Checked, A3.Checked, A4.Checked, A5.Checked, A6.Checked, A7.Checked, A8.Checked + ' ' recupero il nome della Check selezionata + ' Dim sChName As String = DirectCast(sender, CheckBox).Name + + ' For j = 0 To AlzFrontEntityList.Count() - 1 + ' If AlzFrontEntityList(j).SideName = sChName Then + ' If sChName = "A1" Or sChName = "A3" Or sChName = "A5" Or sChName = "A7" Then + ' AddTextToLine(AlzFrontEntityList(j).SideName, m_AlzLayer, AlzFrontEntityList(j).Id, 20, m_dBBoxRad, True) + ' Else + ' AddTextToLine(AlzFrontEntityList(j).SideName, m_Frontlayer, AlzFrontEntityList(j).Id, 20, m_dBBoxRad, True) + ' End If + ' Exit For + ' End If + ' Next + + ' EgtDraw() + 'End Sub + + ' metodo utilizzato per tornare indietro alla pagina di selezione "CompoInterni/Alz&Front" + Private Sub BackBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackBtn.Click + m_MainWindow.m_DrawPageUC.m_SceneButtons.MeasureBtn.IsChecked = False + + ' torno alla pagina iniziale di selezione del piano (Compo) + 'm_MainWindow.m_DrawPageUC.BackBtn_Click(sender, e) + + '--------- NUOVA GESTIONE --------- + ' rimuovo l'elenco di bottoni per selezionare il tipo di componente interna + m_MainWindow.m_DrawPageUC.LeftButtonGrd.Children.Remove(Me) + ' inserisco nella Grid VaribalsesGrid lo UeserControl per definire le dimensioni della componente + m_MainWindow.m_DrawPageUC.VariablesGrd.Children.Add(m_MainWindow.m_DrawPageUC.m_CompoDimension) + ' nascondo la lista dei parametri + m_MainWindow.m_DrawPageUC.m_CompoDimension.CollapsedAllParam() + ' sto uscendo dalla componente interna (quindi comunico il cambio di componente) + m_MainWindow.m_DrawPageUC.m_bInternalCompo = False + ' comunico che sto arrivando da una componente interna + m_MainWindow.m_DrawPageUC.m_bBackFromInternalCompo = True + + 'm_MainWindow.m_DrawPageUC.SelectedComponent(m_MainWindow.m_DrawPageUC.m_sMainCompo) + 'm_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.CompoDimension + End Sub + +End Class + +Public Class AlzFrontEntity + Public Enum AlzFront + ALZATINA + FRONTALINO + End Enum + + Private m_SideName As String + Private m_Type As AlzFront + Private m_Id As Integer + + Public Property SideName As String + Get + Return m_SideName + End Get + Set(value As String) + m_SideName = value + End Set + End Property + + Public Property Type As AlzFront + Get + Return m_Type + End Get + Set(value As AlzFront) + m_Type = value + End Set + End Property + + Public Property Id As Integer + Get + Return m_Id + End Get + Set(value As Integer) + m_Id = value + End Set + End Property + + Sub New(Name As String, CurrId As Integer) + m_SideName = Name + m_Id = CurrId + End Sub + +End Class \ No newline at end of file diff --git a/DrawImport/CompoDimensionUC.xaml b/DrawImport/CompoDimensionUC.xaml index dcb6a28..02ee754 100644 --- a/DrawImport/CompoDimensionUC.xaml +++ b/DrawImport/CompoDimensionUC.xaml @@ -26,7 +26,7 @@ - + @@ -69,12 +69,18 @@ -