diff --git a/CompoWindow/CompoParamPage/CompoParamPageVM.vb b/CompoWindow/CompoParamPage/CompoParamPageVM.vb index 0688733..8f0c073 100644 --- a/CompoWindow/CompoParamPage/CompoParamPageVM.vb +++ b/CompoWindow/CompoParamPage/CompoParamPageVM.vb @@ -771,6 +771,8 @@ Public Class CompoParamPageVM CompoWindowMap.refCompoSceneHostV.CompoScene, SideEntityControlVM.ModeOpt.ALZANDFRONT) SideEntityControl = New SideEntityControlV(m_SideEntityControlVM) + + 'DataContext(CompoWindowMap.refCompoListPageVM.SideEntityControl).ReLoadSideAnglePage(SideEntityControlVM.CallingWindowOpt.COMPO) EgtDraw() End Sub @@ -888,9 +890,9 @@ Public Class CompoParamPageVM CompoWindowMap.refCompoSceneHostV.SelectedLayer = GDB_ID.NULL ' Attivo layer delle misure Dim PartId As Integer = EgtGetFirstPart() - EgtSetStatus(EgtGetFirstNameInGroup(PartId, COMPO_LAYER_AUX), GDB_ST.ON_) - EgtSetStatus(EgtGetFirstNameInGroup(PartId, COMPO_LAYER_QUOTATURE), GDB_ST.ON_) - EgtSetStatus(EgtGetFirstNameInGroup(PartId, COMPO_LAYER_ETICHETTE), GDB_ST.ON_) + EgtSetStatus(EgtGetFirstNameInGroup(PartId, COMPO_LAYER_AUX), GDB_ST.OFF) + EgtSetStatus(EgtGetFirstNameInGroup(PartId, COMPO_LAYER_QUOTATURE), GDB_ST.OFF) + EgtSetStatus(EgtGetFirstNameInGroup(PartId, COMPO_LAYER_ETICHETTE), GDB_ST.OFF) EgtZoom(ZM.ALL) CompoWindowMap.refCompoWindowVM.m_bSelAlzAndFront = False ' aggiorno la lista dei parametri da visualizzare a schermo diff --git a/SideEntityControl/SideEntityControlV.xaml b/SideEntityControl/SideEntityControlV.xaml index 9fb760b..14215cb 100644 --- a/SideEntityControl/SideEntityControlV.xaml +++ b/SideEntityControl/SideEntityControlV.xaml @@ -125,7 +125,7 @@ - + 10 * EPS_SMALL Then sText += "; " & LenToString(SideEntity.dSideHeel, 1) AddTextToLine(sText, Entity.nTextId, Entity.nGeomId, 20, dBBoxRad, True) Next - ' Altrimenti modalità gocciolatoio + ElseIf m_Mode = ModeOpt.ALZANDFRONT Then + AlzAndFrontEntity.m_Parameter1 = m_Parameter1 + AlzAndFrontEntity.m_dParameter2a = m_dParameter2a + AlzAndFrontEntity.m_Parameter2b = m_Parameter2b + ' Per ogni entità, creo testo con nome e angolo di inclinazione + For Each Entity In m_SideEntityList + Dim SideEntity As AlzAndFrontEntity = TryCast(Entity, AlzAndFrontEntity) + Dim sText As String = Entity.sEntityName '& " = " & DoubleToString(SideEntity.dSideAngle, 1) & "°" + 'If SideEntity.dSideHeel > 10 * EPS_SMALL Then sText += "; " & LenToString(SideEntity.dSideHeel, 1) + AddTextToLine(sText, Entity.nTextId, Entity.nGeomId, 20, dBBoxRad, True) + Next + LoadCurrentCompo() + ' Altrimenti modalità gocciolatoio Else ' Per ogni entità creo testo con nome For Each Entity In m_SideEntityList @@ -562,7 +618,16 @@ Public Class SideEntityControlVM nOtherIndex += 1 End If ElseIf m_Mode = ModeOpt.FILOTOP Then - + ' --- ??? --- + ElseIf m_Mode = ModeOpt.ALZANDFRONT Then + If VerifySideAnglePossible(PrevLine, CurrLine, NextLine, bOutLoop) Then + ' Aggiungo il lato alla lista di quelli inclinabili e ne azzero l'inclinazione + AddAlzAndFront(CurrLine, TextLayer, dBBoxRad, nEntityIndex) + nEntityIndex += 1 + Else + EgtSetName(CurrLine, "B" & nOtherIndex.ToString()) + nOtherIndex += 1 + End If Else If VerifyIsSideDripPossible(PrevLine, CurrLine, NextLine) Then ' Aggiungo il lato alla lista di quelli su cui è possibile mettere il gocciolatoio @@ -664,6 +729,29 @@ Public Class SideEntityControlVM AddTextToLine(sText, TextLayer, CurrLine, 20, dBBoxRad, True) End Sub + Private Sub AddAlzAndFront(CurrLine As Integer, TextLayer As Integer, dBBoxRad As Double, nEntityIndex As Integer) + ' Imposto nome del lato + EgtSetName(CurrLine, "A" & nEntityIndex.ToString()) + Dim sEntityName As String = String.Empty + EgtGetName(CurrLine, sEntityName) + Dim NewEntity As AlzAndFrontEntity = Nothing + NewEntity = New AlzAndFrontEntity(CurrLine, sEntityName, TextLayer, ModeOpt.ALZANDFRONT) + Dim sInfo As String = "0" + EgtGetInfo(CurrLine, "AF", sInfo) + If sInfo = "1" Then + NewEntity.bIsCheckedAlz = True + ElseIf sInfo = "2" Then + NewEntity.bIsCheckedFront = True + Else + NewEntity.bIsCheckedAlz = False + NewEntity.bIsCheckedFront = False + End If + EgtSetInfo(NewEntity.nGeomId, "IsModify", 0) + m_SideEntityList.Add(NewEntity) + NotifyPropertyChanged("Legenda_Visibility") + AddTextToLine("A" & CurrLine.ToString, TextLayer, CurrLine, 20, dBBoxRad, True) + End Sub + ' Funzione che gestisce le operazioni sull'entità con gocciolatoio Private Sub AddDripSide(CurrLine As Integer, TextLayer As Integer, dBBoxRad As Double, nEntityIndex As Integer) ' Imposto nome del lato @@ -1435,6 +1523,107 @@ Public Class SideEntityControlVM End While End Sub + '---------------------- GESTIONE ALZATIENE E FRONTALINI ---------------------- + Shared Sub LoadCurrentCompo() + Dim m_dBBoxRad As Double = 0.5 * Point3d.DistXY(EstCalc.GetRawPtMin, EstCalc.GetRawPtMax) + Dim m_dH As Double = 0.05 * m_dBBoxRad + + ' !! ATTENZIONE !! : per problemi di spazio è stata spenta la text per stampare i messaggi (ma potrebbe servire?) + ' Pulisco l'ambiente lua + EgtLuaResetGlobVar("CMP") + EgtLuaResetGlobVar("CMP_Draw") + + Dim nCompoName As Integer + Dim sCompoFile As String = "" + Dim sCompoImage As String = "" + + ' recupero il nome del direttorio + Dim sCompoDir As String = String.Empty + GetMainPrivateProfileString("Alz&Front", K_COMPODIR, "", sCompoDir) + ' leggo le info inserite nel campo "Alz&Front" + Dim CItem As CompoItem = CompoWindowMap.refCompoListPageVM.GetPrivateProfileCompo("Alz&Front", "Alz&Front") + nCompoName = CItem.Index + sCompoFile = CItem.LuaPath + sCompoImage = CItem.ImagePath + 'Dim sCompoImageSource As ImageSource + + ' Costruisco path completa del componente + Dim sPath = sCompoDir & "\" & sCompoFile + ' Carico il file + EgtLuaExecFile(sPath) + + ' carico la lista di variabili + Dim dVal As Double + If StringToLen(AlzAndFrontEntity.m_dParameter2a.ToString, dVal) Then + EgtLuaSetGlobNumVar("CMP.A_Height", dVal) + End If + If StringToLen(AlzAndFrontEntity.m_Parameter2b.ToString, dVal) Then + EgtLuaSetGlobNumVar("CMP.F_Height", dVal) + End If + If StringToLen("0", dVal) Then + EgtLuaSetGlobNumVar("CMP.A_DeltaAng", dVal) + End If + If StringToLen("0", dVal) Then + EgtLuaSetGlobNumVar("CMP.F_DeltaAng", dVal) + End If + ' deve essere imposta sempre la dimensione della lastra + If StringToLen(AlzAndFrontEntity.m_Parameter1.ToString, dVal) Then + EgtLuaSetGlobNumVar("CMP.ThicknessRaw", dVal) + End If + ' parametri per la scrittura dei caratteri + EgtLuaSetGlobNumVar("CMP.BBoxRad", m_dBBoxRad) + EgtLuaSetGlobNumVar("CMP.HeightText", m_dH) + + + Dim sMsg As String = String.Empty + ' eseguo la funzione per il disegno della componente (CMP_Draw) + If Not EgtLuaExecLine("CMP_Draw" & "(true)") Then + sMsg = "Error in component execution" + 'm_bDrawOk = False + Else + EgtLuaGetGlobStringVar("CMP" & ".MSG", sMsg) + Dim nErr As Integer = 0 + EgtLuaGetGlobIntVar("CMP" & ".ERR", nErr) + 'm_bDrawOk = (nErr = 0) + End If + ' aggiorno la grafica + EgtZoom(ZM.ALL) + End Sub + + Shared Sub RefreshEntity(bIsAlz As Boolean, bIsChecked As Boolean, GeneralSideEntity As SideEntity) + + Dim Loacl_AlzFrontEntity As AlzAndFrontEntity = Nothing + Try + Loacl_AlzFrontEntity = DirectCast(GeneralSideEntity, AlzAndFrontEntity) + Catch ex As Exception + Return + End Try + If bIsAlz Then + If bIsChecked Then + Loacl_AlzFrontEntity.Type = ModeAlzAndFront.ALZATINA + Else + Loacl_AlzFrontEntity.Type = ModeAlzAndFront.NONE + End If + Else + If bIsChecked Then + Loacl_AlzFrontEntity.Type = ModeAlzAndFront.FRONTALINO + Else + Loacl_AlzFrontEntity.Type = ModeAlzAndFront.NONE + End If + End If + Select Case Loacl_AlzFrontEntity.Type + Case SideEntityControlVM.ModeAlzAndFront.NONE + EgtSetInfo(Loacl_AlzFrontEntity.nGeomId, INFO_ALZFRONT, 0) + Case SideEntityControlVM.ModeAlzAndFront.ALZATINA + EgtSetInfo(Loacl_AlzFrontEntity.nGeomId, INFO_ALZFRONT, 1) + Case SideEntityControlVM.ModeAlzAndFront.FRONTALINO + EgtSetInfo(Loacl_AlzFrontEntity.nGeomId, INFO_ALZFRONT, 2) + End Select + EgtSetInfo(Loacl_AlzFrontEntity.nGeomId, "IsModify", 1) + ' questa funzione deve essere lanciata al termine di ogno selezione o modifica dei parametri di dimensione + LoadCurrentCompo() + End Sub + #End Region ' METHODS End Class @@ -1541,6 +1730,7 @@ Public MustInherit Class SideEntity Else m_bIsCheckedAlz = False End If + SideEntityControlVM.RefreshEntity(True, value, Me) NotifyPropertyChanged("bIsCheckedAlz") NotifyPropertyChanged("bIsCheckedFront") End Set @@ -1558,6 +1748,7 @@ Public MustInherit Class SideEntity Else m_bIsCheckedFront = False End If + SideEntityControlVM.RefreshEntity(False, value, Me) NotifyPropertyChanged("bIsCheckedAlz") NotifyPropertyChanged("bIsCheckedFront") End Set @@ -1590,6 +1781,7 @@ Friend Class SideAngleEntity Friend Shared m_Parameter1 As Double Friend Shared m_Parameter2 As Double Friend Shared m_Parameter2a As Integer + Friend Shared m_dParameter2a As Double Friend Shared m_Parameter2b As Double Friend Shared m_ModifySideAngle As Action(Of String, Double) Friend Shared m_ModifySideHeel As Action(Of String, Double) @@ -2005,130 +2197,129 @@ Friend Class AlzAndFrontEntity Friend Shared m_Parameter1 As Double Friend Shared m_Parameter2 As Double Friend Shared m_Parameter2a As Integer + Friend Shared m_dParameter2a As Double Friend Shared m_Parameter2b As Double Friend Shared m_ModifySideAngle As Action(Of String, Double) Friend Shared m_ModifySideHeel As Action(Of String, Double) Friend Shared m_RefreshSideAngleText As Action - Private m_dSideAngle As Double - Public Property GrphSideAngle As String - Get - Return DoubleToString(m_dSideAngle, 2) - End Get - Set(value As String) - Dim dVal As Double = 0 - If Not String.IsNullOrWhiteSpace(value) Then StringToDouble(value, dVal) - If dVal <> m_dSideAngle Then - ' Assegno controllando i limiti - If dVal < -m_dMaxSideAng Then - m_dSideAngle = -m_dMaxSideAng - NotifyPropertyChanged("GrphSideAngle") - ElseIf dVal > m_dMaxSideAng Then - m_dSideAngle = m_dMaxSideAng - NotifyPropertyChanged("GrphSideAngle") - Else - m_dSideAngle = dVal - End If - ' Lo modifico nella geometria e nella lista inclinazioni - m_ModifySideAngle(sEntityName, dSideAngle) - ' Aggiorno tutti i testi - m_RefreshSideAngleText() - End If - End Set - End Property - Public Property dSideAngle As Double - Get - Return m_dSideAngle - End Get - Set(value As Double) - ' Assegno controllando i limiti - If value < -m_dMaxSideAng Then - m_dSideAngle = -m_dMaxSideAng - ElseIf value > m_dMaxSideAng Then - m_dSideAngle = m_dMaxSideAng - Else - m_dSideAngle = value - End If - End Set - End Property + 'Private m_dSideAngle As Double + 'Public Property GrphSideAngle As String + ' Get + ' Return DoubleToString(m_dSideAngle, 2) + ' End Get + ' Set(value As String) + ' Dim dVal As Double = 0 + ' If Not String.IsNullOrWhiteSpace(value) Then StringToDouble(value, dVal) + ' If dVal <> m_dSideAngle Then + ' ' Assegno controllando i limiti + ' If dVal < -m_dMaxSideAng Then + ' m_dSideAngle = -m_dMaxSideAng + ' NotifyPropertyChanged("GrphSideAngle") + ' ElseIf dVal > m_dMaxSideAng Then + ' m_dSideAngle = m_dMaxSideAng + ' NotifyPropertyChanged("GrphSideAngle") + ' Else + ' m_dSideAngle = dVal + ' End If + ' ' Lo modifico nella geometria e nella lista inclinazioni + ' m_ModifySideAngle(sEntityName, dSideAngle) + ' ' Aggiorno tutti i testi + ' m_RefreshSideAngleText() + ' End If + ' End Set + 'End Property + 'Public Property dSideAngle As Double + ' Get + ' Return m_dSideAngle + ' End Get + ' Set(value As Double) + ' ' Assegno controllando i limiti + ' If value < -m_dMaxSideAng Then + ' m_dSideAngle = -m_dMaxSideAng + ' ElseIf value > m_dMaxSideAng Then + ' m_dSideAngle = m_dMaxSideAng + ' Else + ' m_dSideAngle = value + ' End If + ' End Set + 'End Property - Private m_dSideHeel As Double - Public Property GrphSideHeel As String - Get - Return LenToString(m_dSideHeel, 2) - End Get - Set(value As String) - Dim dVal As Double = 0 - If Not String.IsNullOrWhiteSpace(value) Then StringToLen(value, dVal) - If Math.Abs(dVal - m_dSideHeel) > EPS_SMALL Then - ' Verifico stia nei limiti - If dVal < 0 Then - m_dSideHeel = 0 - NotifyPropertyChanged("GrphSideHeel") - Else - m_dSideHeel = dVal - End If - ' Lo modifico nella geometria e nella lista inclinazioni - m_ModifySideHeel(sEntityName, dSideHeel) - ' Aggiorno tutti i testi - m_RefreshSideAngleText() - End If - End Set - End Property - Public Property dSideHeel As Double - Get - Return m_dSideHeel - End Get - Set(value As Double) - ' Verifico stia nei limiti - If value < 0 Then - m_dSideHeel = 0 - Else - m_dSideHeel = value - End If - End Set - End Property + 'Private m_dSideHeel As Double + 'Public Property GrphSideHeel As String + ' Get + ' Return LenToString(m_dSideHeel, 2) + ' End Get + ' Set(value As String) + ' Dim dVal As Double = 0 + ' If Not String.IsNullOrWhiteSpace(value) Then StringToLen(value, dVal) + ' If Math.Abs(dVal - m_dSideHeel) > EPS_SMALL Then + ' ' Verifico stia nei limiti + ' If dVal < 0 Then + ' m_dSideHeel = 0 + ' NotifyPropertyChanged("GrphSideHeel") + ' Else + ' m_dSideHeel = dVal + ' End If + ' ' Lo modifico nella geometria e nella lista inclinazioni + ' m_ModifySideHeel(sEntityName, dSideHeel) + ' ' Aggiorno tutti i testi + ' m_RefreshSideAngleText() + ' End If + ' End Set + 'End Property + 'Public Property dSideHeel As Double + ' Get + ' Return m_dSideHeel + ' End Get + ' Set(value As Double) + ' ' Verifico stia nei limiti + ' If value < 0 Then + ' m_dSideHeel = 0 + ' Else + ' m_dSideHeel = value + ' End If + ' End Set + 'End Property Public Overrides Property bIsChecked As Boolean Get - Return Not m_dSideAngle = 0 + Return False End Get Set(value As Boolean) - If value Then - m_dSideAngle = m_Parameter1 - m_dSideHeel = m_Parameter2 - Else - m_dSideAngle = 0 - m_dSideHeel = 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 = "A" & nCurrSide.ToString() - ' Lo modifico nella geometria e nella lista inclinazioni - m_ModifySideAngle(sEntityName, m_dSideAngle) - m_ModifySideHeel(sEntityName, m_dSideHeel) - ' Aggiorno tutti i testi - m_RefreshSideAngleText() + 'If value Then + ' m_dSideAngle = m_Parameter1 + ' m_dSideHeel = m_Parameter2 + 'Else + ' m_dSideAngle = 0 + ' m_dSideHeel = 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 = "A" & nCurrSide.ToString() + '' Lo modifico nella geometria e nella lista inclinazioni + 'm_ModifySideAngle(sEntityName, m_dSideAngle) + 'm_ModifySideHeel(sEntityName, m_dSideHeel) + '' Aggiorno tutti i testi + 'm_RefreshSideAngleText() NotifyPropertyChanged("bIsChecked") End Set End Property - Sub New(nId As Integer, sEntityName As String, nTextId As Integer, dSideAngle As Double, dSideHeel As Double, Mode As SideEntityControlVM.ModeOpt) + Private m_Type As SideEntityControlVM.ModeAlzAndFront = SideEntityControlVM.ModeAlzAndFront.NONE + Public Property Type As SideEntityControlVM.ModeAlzAndFront + Get + Return m_Type + End Get + Set(value As SideEntityControlVM.ModeAlzAndFront) + m_Type = value + End Set + End Property + + Sub New(nId As Integer, sEntityName As String, nTextId As Integer, Mode As SideEntityControlVM.ModeOpt) MyBase.New(nId, sEntityName, nTextId, Mode) - m_dSideAngle = dSideAngle - m_dSideHeel = dSideHeel + 'm_dSideAngle = dSideAngle + 'm_dSideHeel = dSideHeel End Sub - Friend Shared Function FindEntity(sEntityName As String, EntityList As ObservableCollection(Of SideEntity)) As SideAngleEntity - If IsNothing(EntityList) Then - Return Nothing - End If - For Each Entity In EntityList - If Entity.sEntityName = sEntityName Then - Return DirectCast(Entity, SideAngleEntity) - End If - Next - Return Nothing - End Function - End Class