diff --git a/ConstGen.vb b/ConstGen.vb index 76d97ca..47f67b8 100644 --- a/ConstGen.vb +++ b/ConstGen.vb @@ -161,13 +161,16 @@ Module ConstGen Public Const NAME_PREVIEW As String = "PV" ' Info in entità da tagliare per affondamento Public Const INFO_DEPTH As String = "Depth" + Public Const INFO_DEPTH2 As String = "Depth2" ' Info in entità da tagliare per taglio ristretto Public Const INFO_STRICT As String = "Strict" - ' Info in entità da tagliare per angolo di lato + ' Info in entità da tagliare per angolo di lato e tallone Public Const INFO_SIDE_ANGLE As String = "SideAng" Public Const INFO_OFFSET As String = "Offset" Public Const INFO_SIDE_ANGLE2 As String = "SideAng2" Public Const INFO_OFFSET2 As String = "Offset2" + Public Const INFO_HEEL As String = "Heel" + Public Const INFO_ORIG_SIDE_ANGLE As String = "OrigSideAng" ' Info in entità da tagliare per gocciolatoio Public Const INFO_HAVE_DRIP As String = "HaveDrip" ' Info in entità da tagliare per direzione che varia a seconda del tipo (una via o zigzag) diff --git a/NestPageUC.xaml.vb b/NestPageUC.xaml.vb index 3559820..a9c0a77 100644 --- a/NestPageUC.xaml.vb +++ b/NestPageUC.xaml.vb @@ -800,6 +800,8 @@ Public Class NestPageUC Public Function InsertOnePart(ByVal nId As Integer) As Boolean ' Se esiste grezzo e pezzo in parcheggio, lo metto nella tavola If m_nRawId <> GDB_ID.NULL AndAlso EgtIsPart(nId) Then + ' Sistemazioni per eventuali lati inclinati con tallone + AdjustPartSideAngleHeel(nId, m_b3Raw.DimZ()) ' Sistemazioni per eventuali lati esterni inclinati e/o offsettati EgtCalcFlatPartUpRegion(nId, True) EgtCalcFlatPartDownRegion(nId, m_b3Raw.DimZ()) @@ -852,6 +854,69 @@ Public Class NestPageUC Return False End Function + Private Function AdjustPartSideAngleHeel(nPartId As Integer, dTh As Double) As Boolean + ' Recupero entità del layer esterno e di quelli interni + Dim vEnt As New List(Of Integer) + Dim nEntId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(nPartId, NAME_OUTLOOP)) + While nEntId <> GDB_ID.NULL + vEnt.Add(nEntId) + nEntId = EgtGetNext(nEntId) + End While + Dim nLayId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_INLOOP) + While nLayId <> GDB_ID.NULL + nEntId = EgtGetFirstInGroup(nLayId) + While nEntId <> GDB_ID.NULL + vEnt.Add(nEntId) + nEntId = EgtGetNext(nEntId) + End While + nLayId = EgtGetNextName(nLayId, NAME_INLOOP) + End While + ' Aggiorno le entità con tallone e quelle con angolo esterno + Const AGG_DEPTH As Double = 2.0 + For Each nEnt As Integer In vEnt + ' Recupero eventuali tallone ed angolo originale + Dim dHeel As Double = 0 + Dim dSideAng As Double = 0 + EgtGetInfo(nEnt, INFO_HEEL, dHeel) + EgtGetInfo(nEnt, INFO_ORIG_SIDE_ANGLE, dSideAng) + If Math.Abs(dSideAng) > EPS_ANG_SMALL And dHeel > 10 * EPS_SMALL Then + ' Angolo esterno + If dSideAng > 0 Then + ' Se tallone inferiore a spessore + If dHeel < dTh - 10 * EPS_SMALL Then + EgtSetInfo(nEnt, INFO_SIDE_ANGLE, 0.0) + EgtSetInfo(nEnt, INFO_SIDE_ANGLE2, dSideAng) + EgtSetInfo(nEnt, INFO_OFFSET2, -(dTh - dHeel) * Math.Tan(dSideAng * Math.PI / 180)) + EgtSetInfo(nEnt, INFO_DEPTH2, (dTh - dHeel) + AGG_DEPTH) + ' altrimenti, tallone superiore a spessore -> non c'è taglio inclinato + Else + EgtSetInfo(nEnt, INFO_SIDE_ANGLE, 0.0) + EgtSetInfo(nEnt, INFO_SIDE_ANGLE2, 0.0) + EgtRemoveInfo(nEnt, INFO_OFFSET2) + EgtRemoveInfo(nEnt, INFO_DEPTH2) + End If + ' Angolo interno + Else + ' Se tallone inferiore a spessore + If dHeel < dTh - 10 * EPS_SMALL Then + EgtSetInfo(nEnt, INFO_OFFSET, dHeel * Math.Tan(-dSideAng * Math.PI / 180)) + EgtSetInfo(nEnt, INFO_SIDE_ANGLE2, 0.0) + EgtSetInfo(nEnt, INFO_DEPTH2, dHeel + AGG_DEPTH) + ' altrimenti, tallone superiore a spessore -> non c'è taglio inclinato + Else + EgtSetInfo(nEnt, INFO_SIDE_ANGLE, 0.0) + EgtRemoveInfo(nEnt, INFO_OFFSET) + EgtRemoveInfo(nEnt, INFO_SIDE_ANGLE2) + EgtRemoveInfo(nEnt, INFO_DEPTH2) + End If + End If + ElseIf dSideAng > EPS_ANG_SMALL Then + EgtSetInfo(nEnt, INFO_OFFSET, -dTh * Math.Tan(dSideAng * Math.PI / 180)) + End If + Next + Return True + End Function + Private Sub StorePartBtn_Click(sender As Object, e As RoutedEventArgs) Handles StorePartBtn.Click EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) ' Ciclo di parcheggio dei pezzi selezionati diff --git a/SideAngleUc.xaml b/SideAngleUc.xaml index 5fac30f..85522d6 100644 --- a/SideAngleUc.xaml +++ b/SideAngleUc.xaml @@ -11,7 +11,8 @@ - + + @@ -33,79 +34,99 @@ - - + + - + - + - + - + - + - + - + - + - + - - - - diff --git a/SideAngleUc.xaml.vb b/SideAngleUc.xaml.vb index d57f12c..c223e4d 100644 --- a/SideAngleUc.xaml.vb +++ b/SideAngleUc.xaml.vb @@ -37,67 +37,34 @@ Public Class SideAngleUC ' Imposto messaggi If m_Mode = ModeOpt.SIDEANGLE Then - Parameter1TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 9) ' Angolo - Else Parameter1TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 10) ' Offset Parameter2TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 11) ' Affondamento Parameter3TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 12) ' Accorciamento End If - If m_Mode = ModeOpt.SIDEANGLE Then - A1TxBx.Text = "0" - A2TxBx.Text = "0" - A3TxBx.Text = "0" - A4TxBx.Text = "0" - A5TxBx.Text = "0" - A6TxBx.Text = "0" - A7TxBx.Text = "0" - A8TxBx.Text = "0" - A9TxBx.Text = "0" - A10TxBx.Text = "0" - End If - If m_CallingPage = MainWindow.Pages.Draw Then ' Imposto questa come pagina correntemente visualizzata nella drawpage m_MainWindow.m_DrawPageUC.m_ActiveComponentPage = DrawPageUC.Pages.SideAngle ' Imposto contesto corrente EgtSetCurrentContext(m_MainWindow.m_DrawPageUC.DrawScene.GetCtx()) - ' Inizializzo - DeleteSideAngle() - ' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno) - InitSides() - ' Aggiorno testi nel disegno - RefreshSideAngleText() - ' Aggiorno check e valori - RefreshCheckAndValue() - ElseIf m_CallingPage = MainWindow.Pages.Import Then ' Imposto contesto corrente EgtSetCurrentContext(m_MainWindow.m_ImportPageUC.ImportScene.GetCtx()) - ' Inizializzo - DeleteSideAngle() - ' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno) - InitSides() - ' Aggiorno testi nel disegno - RefreshSideAngleText() - ' Aggiorno check e valori - RefreshCheckAndValue() End If + ' Inizializzo + DeleteSideAngle() + ' Inizializzo lati per angoli (ne compilo la lista e aggiungo la scritta nel disegno) + InitSides() + ' Aggiorno testi nel disegno + RefreshSideAngleText() + ' Aggiorno check e valori + RefreshCheckAndValue() - ' Gestisco Checkbox e nomi in base al numero di lati inclinabili - TxBlChBxView() ' Gestisco visualizzazione dei parametri If m_Mode = ModeOpt.SIDEANGLE Then - A1.Visibility = Windows.Visibility.Collapsed - A2.Visibility = Windows.Visibility.Collapsed - A3.Visibility = Windows.Visibility.Collapsed - A4.Visibility = Windows.Visibility.Collapsed - A5.Visibility = Windows.Visibility.Collapsed - A6.Visibility = Windows.Visibility.Collapsed - A7.Visibility = Windows.Visibility.Collapsed - A8.Visibility = Windows.Visibility.Collapsed - A9.Visibility = Windows.Visibility.Collapsed - A10.Visibility = Windows.Visibility.Collapsed + For Index As Integer = 1 To 10 + GetChBxFromIndex(Index).Visibility = Windows.Visibility.Collapsed + Next Parameter1TxBl.Visibility = Windows.Visibility.Hidden Parameter1TxBx.Visibility = Windows.Visibility.Hidden Parameter2TxBl.Visibility = Windows.Visibility.Hidden @@ -105,16 +72,10 @@ Public Class SideAngleUC Parameter3TxBl.Visibility = Windows.Visibility.Hidden Parameter3TxBx.Visibility = Windows.Visibility.Hidden Else - A1TxBx.Visibility = Windows.Visibility.Collapsed - A2TxBx.Visibility = Windows.Visibility.Collapsed - A3TxBx.Visibility = Windows.Visibility.Collapsed - A4TxBx.Visibility = Windows.Visibility.Collapsed - A5TxBx.Visibility = Windows.Visibility.Collapsed - A6TxBx.Visibility = Windows.Visibility.Collapsed - A7TxBx.Visibility = Windows.Visibility.Collapsed - A8TxBx.Visibility = Windows.Visibility.Collapsed - A9TxBx.Visibility = Windows.Visibility.Collapsed - A10TxBx.Visibility = Windows.Visibility.Collapsed + For Index As Integer = 1 To 10 + GetAngleTxBxFromIndex(Index).Visibility = Windows.Visibility.Collapsed + GetHeelTxBxFromIndex(Index).Visibility = Windows.Visibility.Collapsed + Next Parameter1TxBl.Visibility = Windows.Visibility.Visible Parameter1TxBx.Visibility = Windows.Visibility.Visible Parameter2TxBl.Visibility = Windows.Visibility.Visible @@ -123,12 +84,11 @@ Public Class SideAngleUC Parameter3TxBx.Visibility = Windows.Visibility.Visible End If + ' Gestisco Checkbox e nomi in base al numero di lati inclinabili + TxBlChBxView() + ' Aggiorno valori - If m_Mode = ModeOpt.SIDEANGLE Then - Dim sVal As String = String.Empty - GetPrivateProfileString(S_SIDES, K_SIDEANGLE, "45", sVal, m_MainWindow.GetIniFile()) - Parameter1TxBx.Text = sVal - Else + If m_Mode = ModeOpt.DRIP Then m_dDripOffset = GetPrivateProfileDouble(S_SIDES, K_DRIPOFFSET, 20, m_MainWindow.GetIniFile()) m_dDripDepth = GetPrivateProfileDouble(S_SIDES, K_DRIPDEPTH, 10, m_MainWindow.GetIniFile()) m_dDripShort = GetPrivateProfileDouble(S_SIDES, K_DRIPSHORT, 0, m_MainWindow.GetIniFile()) @@ -152,7 +112,8 @@ Public Class SideAngleUC ' Lati nascosti For Index As Integer = 1 To 10 - nCount If m_Mode = ModeOpt.SIDEANGLE Then - GetSideTxBxFromIndex(Index).Visibility = Windows.Visibility.Hidden + GetAngleTxBxFromIndex(Index).Visibility = Windows.Visibility.Hidden + GetHeelTxBxFromIndex(Index).Visibility = Windows.Visibility.Hidden Else GetChBxFromIndex(Index).Visibility = Windows.Visibility.Hidden End If @@ -162,7 +123,8 @@ Public Class SideAngleUC Dim TxBlIndex As Integer = 1 For Index As Integer = 10 - nCount + 1 To 10 If m_Mode = ModeOpt.SIDEANGLE Then - GetSideTxBxFromIndex(Index).Visibility = Windows.Visibility.Visible + GetAngleTxBxFromIndex(Index).Visibility = Windows.Visibility.Visible + GetHeelTxBxFromIndex(Index).Visibility = Windows.Visibility.Visible Else GetChBxFromIndex(Index).Visibility = Windows.Visibility.Visible End If @@ -199,7 +161,7 @@ Public Class SideAngleUC End Select End Function - Private Function GetSideTxBxFromIndex(Index As Integer) As EgtWPFLib.EgtTextBox + Private Function GetAngleTxBxFromIndex(Index As Integer) As EgtWPFLib.EgtTextBox Select Case Index Case 1 Return A1TxBx @@ -224,6 +186,31 @@ Public Class SideAngleUC 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 @@ -263,9 +250,7 @@ Public Class SideAngleUC ' Nessuna azione necessaria End If - If m_Mode = ModeOpt.SIDEANGLE Then - WritePrivateProfileString(S_SIDES, K_SIDEANGLE, Parameter1TxBx.Text, m_MainWindow.GetIniFile()) - Else + If m_Mode = ModeOpt.DRIP Then WritePrivateProfileString(S_SIDES, K_DRIPOFFSET, DoubleToString(m_dDripOffset, 3), m_MainWindow.GetIniFile()) WritePrivateProfileString(S_SIDES, K_DRIPDEPTH, DoubleToString(m_dDripDepth, 3), m_MainWindow.GetIniFile()) WritePrivateProfileString(S_SIDES, K_DRIPSHORT, DoubleToString(m_dDripShort, 3), m_MainWindow.GetIniFile()) @@ -277,9 +262,10 @@ Public Class SideAngleUC Private Sub RefreshCheckAndValue() For EntityIndex = 1 To m_SideAngleEntityList.Count Dim Entity As SideAngleEntity = m_SideAngleEntityList(EntityIndex - 1) - ' Creo testo con angolo di inclinazione + ' Creo testo con angolo di inclinazione e dimensione tallone Dim nTxBxIndex As Integer = 10 - m_SideAngleEntityList.Count + EntityIndex - GetSideTxBxFromIndex(nTxBxIndex).Text = DoubleToString(Entity.dSideAngle, 1) + GetAngleTxBxFromIndex(nTxBxIndex).Text = DoubleToString(Entity.dSideAngle, 1) + GetHeelTxBxFromIndex(nTxBxIndex).Text = LenToString(Entity.dSideHeel, 1) Next End Sub @@ -322,6 +308,7 @@ Public Class SideAngleUC ' Per ogni entità, creo testo con nome e angolo di inclinazione For Each Entity In m_SideAngleEntityList Dim sText As String = Entity.sEntityName & " = " & DoubleToString(Entity.dSideAngle, 1) & "°" + If Entity.dSideHeel > 10 * EPS_SMALL Then sText += "; " & LenToString(Entity.dSideHeel, 1) AddTextToLine(sText, Entity.nTextId, Entity.nGeomId, 20, dBBoxRad, True) Next ' Altrimenti modalità gocciolatoio @@ -431,33 +418,21 @@ Public Class SideAngleUC End If ' Aggiorno interfaccia - If m_CallingPage = MainWindow.Pages.Import Then - If m_Mode = ModeOpt.SIDEANGLE Then - For Each Entity In m_SideAngleEntityList - If Entity.dSideAngle <> 0 Then - Dim nI As Integer = 0 - StringToInt(Entity.sEntityName.Substring(1), nI) - CheckSide(nI) - End If - Next - Else - For Each Entity In m_DripEntityList - If Entity.bHaveDrip Then - Dim nI As Integer = 0 - StringToInt(Entity.sEntityName.Substring(1), nI) - CheckSide(nI) - End If - Next - End If + If m_Mode = ModeOpt.DRIP Then + For Each Entity In m_DripEntityList + If Entity.bHaveDrip Then + Dim nI As Integer = 0 + StringToInt(Entity.sEntityName.Substring(1), nI) + CheckSide(nI) + End If + Next End If End Sub 'Funzione che checka i lati Private Sub CheckSide(nIndex As Integer) ' Seleziono checkbox - If m_Mode = ModeOpt.SIDEANGLE Then - GetChBxFromIndex(10 - (m_SideAngleEntityList.Count - nIndex)).IsChecked = True - Else + If m_Mode = ModeOpt.DRIP Then GetChBxFromIndex(10 - (m_DripEntityList.Count - nIndex)).IsChecked = True End If End Sub @@ -533,12 +508,17 @@ Public Class SideAngleUC ' Ricavo angolo dell'entità Dim dSideAngleVal As Double If Not EgtGetInfo(CurrLine, INFO_SIDE_ANGLE, dSideAngleVal) Then dSideAngleVal = 0 + ' Ricavo tallone dell'entità + Dim dSideHeelVal As Double + If Not EgtGetInfo(CurrLine, INFO_HEEL, dSideHeelVal) Then dSideHeelVal = 0 ' Aggiungo entità all'elenco di quelle inclinabili Dim sEntityName As String = String.Empty EgtGetName(CurrLine, sEntityName) - m_SideAngleEntityList.Add(New SideAngleEntity(CurrLine, sEntityName, TextLayer, dSideAngleVal)) - ' Creo testo con angolo di inclinazione - AddTextToLine(sEntityName & " = " & DoubleToString(dSideAngleVal, 1) & "°", TextLayer, CurrLine, 20, dBBoxRad, True) + m_SideAngleEntityList.Add(New SideAngleEntity(CurrLine, sEntityName, TextLayer, dSideAngleVal, dSideHeelVal)) + ' Creo testo con angolo di inclinazione ed eventuale tallone + Dim sText As String = sEntityName & " = " & DoubleToString(dSideAngleVal, 1) & "°" + If dSideHeelVal > 10 * EPS_SMALL Then sText += "; " & LenToString(dSideHeelVal, 1) + AddTextToLine(sText, TextLayer, CurrLine, 20, dBBoxRad, True) End Sub ' Funzione che gestisce le operazioni sull'entità con gocciolatoio @@ -704,24 +684,7 @@ Public Class SideAngleUC Dim CurrCheckBox As CheckBox = e.Source - If m_Mode = ModeOpt.SIDEANGLE Then - ' Nuovo angolo di inclinazione - Dim dSideAngle As Double - ' Se checked lo imposto al valore letto dalla TxBx - If CurrCheckBox.IsChecked() Then - StringToDouble(Parameter1TxBx.Text, dSideAngle) - ' altrimenti lo imposto a zero - Else - dSideAngle = 0 - End If - ' Converto nome checkbox in nome elemento tenendo conto dello slittamento verso il basso - Dim nCurrSide As Integer = m_SideAngleEntityList.Count() - (10 - CInt(CurrCheckBox.Name.Substring(1))) - Dim sCurrSide As String = m_SideAngleEntityList(nCurrSide - 1).sEntityName - ' Lo modifico nella geometria e nella lista inclinazioni - ModifySideAngle(sCurrSide, dSideAngle) - ' Aggiorno tutti i testi - RefreshSideAngleText() - Else + If m_Mode = ModeOpt.DRIP Then ' Recupero stato entità Dim bVal As Boolean = CurrCheckBox.IsChecked() ' Converto nome checkbox in nome elemento tenendo conto dello slittamento verso il basso @@ -738,42 +701,82 @@ Public Class SideAngleUC SetSideAngleFromTxBx(1, A1TxBx) End Sub + Private Sub H1TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H1TxBx.EgtClosed + SetSideHeelFromTxBx(1, H1TxBx) + End Sub + Private Sub A2TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A2TxBx.EgtClosed SetSideAngleFromTxBx(2, A2TxBx) End Sub + Private Sub H2TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H2TxBx.EgtClosed + SetSideHeelFromTxBx(2, H2TxBx) + End Sub + Private Sub A3TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A3TxBx.EgtClosed SetSideAngleFromTxBx(3, A3TxBx) End Sub + Private Sub H3TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H3TxBx.EgtClosed + SetSideHeelFromTxBx(3, H3TxBx) + End Sub + Private Sub A4TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A4TxBx.EgtClosed SetSideAngleFromTxBx(4, A4TxBx) End Sub + Private Sub H4TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H4TxBx.EgtClosed + SetSideHeelFromTxBx(4, H4TxBx) + End Sub + Private Sub A5TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A5TxBx.EgtClosed SetSideAngleFromTxBx(5, A5TxBx) End Sub - Private Sub A6eTxBx_EgtClosed(sender As Object, e As EventArgs) Handles A6TxBx.EgtClosed + Private Sub H5TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H5TxBx.EgtClosed + SetSideHeelFromTxBx(5, H5TxBx) + End Sub + + Private Sub A6TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A6TxBx.EgtClosed SetSideAngleFromTxBx(6, A6TxBx) End Sub + Private Sub H6TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H6TxBx.EgtClosed + SetSideHeelFromTxBx(6, H6TxBx) + End Sub + Private Sub A7TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A7TxBx.EgtClosed SetSideAngleFromTxBx(7, A7TxBx) End Sub + Private Sub H7TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H7TxBx.EgtClosed + SetSideHeelFromTxBx(7, H7TxBx) + End Sub + Private Sub A8TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A8TxBx.EgtClosed SetSideAngleFromTxBx(8, A8TxBx) End Sub + Private Sub H8TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H8TxBx.EgtClosed + SetSideHeelFromTxBx(8, H8TxBx) + End Sub + Private Sub A9TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A9TxBx.EgtClosed SetSideAngleFromTxBx(9, A9TxBx) End Sub + Private Sub H9TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H9TxBx.EgtClosed + SetSideHeelFromTxBx(9, H9TxBx) + End Sub + Private Sub A10TxBx_EgtClosed(sender As Object, e As EventArgs) Handles A10TxBx.EgtClosed SetSideAngleFromTxBx(10, A10TxBx) End Sub + Private Sub H10TxBx_EgtClosed(sender As Object, e As EventArgs) Handles H10TxBx.EgtClosed + SetSideHeelFromTxBx(10, H10TxBx) + End Sub + Private Sub SetSideAngleFromTxBx(SideIndex As Integer, AngleTxBx As EgtWPFLib.EgtTextBox) ' Nuovo angolo di inclinazione Dim dSideAngle As Double @@ -815,6 +818,44 @@ Public Class SideAngleUC Return True End Function + Private Sub SetSideHeelFromTxBx(SideIndex As Integer, HeelTxBx As EgtWPFLib.EgtTextBox) + ' Nuovo tallone + Dim dSideHeel As Double + StringToLen(HeelTxBx.Text, dSideHeel) + ' Verifico stia nei limiti + If dSideHeel < 0 Then + dSideHeel = 0 + HeelTxBx.Text = "0" + End If + ' Converto nome checkbox in nome elemento tenendo conto dello slittamento verso il basso + Dim nCurrSide As Integer = m_SideAngleEntityList.Count() - (10 - SideIndex) + Dim sCurrSide As String = m_SideAngleEntityList(nCurrSide - 1).sEntityName + ' Lo modifico nella geometria e nella lista inclinazioni + ModifySideHeel(sCurrSide, dSideHeel) + ' Aggiorno tutti i testi + RefreshSideAngleText() + End Sub + + ' Funzione che modifica il tallone di un lato + Friend Function ModifySideHeel(sEntityName As String, dSideHeel As Double) As Boolean + ' Ricavo CurrEntity dal nome + Dim CurrEntity As SideAngleEntity = SideAngleEntity.FindEntity(sEntityName) + If IsNothing(CurrEntity) Then + EgtOutLog("Error in side angle definition: selected line not found in SideAngleList") + Return False + End If + ' Scrivo nuovo tallone nelle info + If dSideHeel > 10 * EPS_SMALL Then + EgtSetInfo(CurrEntity.nGeomId, INFO_HEEL, dSideHeel) + ' Cancello inclinazione nell'apposito campo info + Else + EgtRemoveInfo(CurrEntity.nGeomId, INFO_HEEL) + End If + ' Aggiorno lista entità con nuova inclinazione + CurrEntity.dSideHeel = dSideHeel + Return True + End Function + ' Funzione che modifica l'eventuale canalino di un lato Friend Function ModifyDrip(sEntityName As String, bVal As Boolean) As Boolean ' Ricavo CurrEntity dal nome @@ -840,29 +881,16 @@ Public Class SideAngleUC If m_Mode = ModeOpt.SIDEANGLE Then m_SideAngleEntityList.Clear() ' Annullo tutti i testi - A1TxBx.Text = String.Empty - A2TxBx.Text = String.Empty - A3TxBx.Text = String.Empty - A4TxBx.Text = String.Empty - A5TxBx.Text = String.Empty - A6TxBx.Text = String.Empty - A7TxBx.Text = String.Empty - A8TxBx.Text = String.Empty - A9TxBx.Text = String.Empty - A10TxBx.Text = String.Empty + For Index As Integer = 1 To 10 + GetAngleTxBxFromIndex(Index).Text = String.Empty + GetHeelTxBxFromIndex(Index).Text = String.Empty + Next Else m_DripEntityList.Clear() ' Annullo tutti i CheckBox - A1.IsChecked = False - A2.IsChecked = False - A3.IsChecked = False - A4.IsChecked = False - A5.IsChecked = False - A6.IsChecked = False - A7.IsChecked = False - A8.IsChecked = False - A9.IsChecked = False - A10.IsChecked = False + For Index As Integer = 1 To 10 + GetChBxFromIndex(Index).IsChecked = False + Next End If End Sub @@ -928,13 +956,15 @@ Public Class SideAngleUC While LineId <> GDB_ID.NULL Dim dSideAngle As Double = 0 Dim bSA As Boolean = EgtGetInfo(LineId, INFO_SIDE_ANGLE, dSideAngle) - Dim dSideAngle2 As Double = 0 - Dim bSA2 As Boolean = EgtGetInfo(LineId, INFO_SIDE_ANGLE2, dSideAngle2) - If Math.Abs(dSideAngle) > EPS_ANG_SMALL Or bSA2 Then + Dim dSideHeel As Double = 0 + Dim bSH As Boolean = EgtGetInfo(LineId, INFO_HEEL, dSideHeel) + If Math.Abs(dSideAngle) > EPS_ANG_SMALL Then ' Creo testo con angolo di inclinazione Dim sText As String = DoubleToString(dSideAngle, 1) & "°" - If bSA2 Then sText &= "; " & DoubleToString(dSideAngle2, 1) & "°" + If dSideHeel > 10 * EPS_SMALL Then sText &= "; " & LenToString(dSideHeel, 1) AddTextToLine(sText, TextLayId, LineId, 15, dBBoxRad, False, True) + ' Imposto angolo originale + EgtSetInfo(LineId, INFO_ORIG_SIDE_ANGLE, dSideAngle) End If LineId = EgtGetNext(LineId) End While @@ -956,6 +986,7 @@ Friend Class SideAngleEntity Private m_sEntityName As String Private m_nTextId As Integer Private m_dSideAngle As Double + Private m_dSideHeel As Double Public Property nGeomId As Integer Get @@ -987,11 +1018,21 @@ Friend Class SideAngleEntity End Set End Property - Sub New(nId As Integer, sEntityName As String, nTextId As Integer, dSideAngle As Double) + Public Property dSideHeel As Double + Get + Return m_dSideHeel + End Get + Set(value As Double) + m_dSideHeel = value + End Set + End Property + + Sub New(nId As Integer, sEntityName As String, nTextId As Integer, dSideAngle As Double, dSideHeel As Double) m_nGeomId = nId m_sEntityName = sEntityName m_nTextId = nTextId m_dSideAngle = dSideAngle + m_dSideHeel = dSideHeel End Sub Friend Shared Function FindEntity(sEntityName As String) As SideAngleEntity