84863dc5d5
- gestione visibilita' entita' in importazione - eliminazione marcatura pezzo selezionato - correzione su cancellazione pezzo
262 lines
9.8 KiB
VB.net
262 lines
9.8 KiB
VB.net
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Module GeomEntityColors
|
|
|
|
Public Enum LayerType As Integer
|
|
PRINTPART = 1
|
|
'REFERENCE = 2
|
|
MACHSTART = 3
|
|
RIBS = 4
|
|
SHELLNUMBERS = 5
|
|
AUXSOLIDS = 6
|
|
OTHERS = 7
|
|
ALL = 10
|
|
End Enum
|
|
|
|
Private m_c3Print As Color3d
|
|
Public ReadOnly Property c3Print As Color3d
|
|
Get
|
|
Dim c3Temp As Color3d
|
|
If Not GetMainPrivateProfileColor(S_COLORS, K_CLR_PRINTPART, c3Temp) Then
|
|
c3Temp.FromColor(System.Drawing.Color.Aqua)
|
|
End If
|
|
Return c3Temp
|
|
End Get
|
|
End Property
|
|
|
|
Private m_c3MachStart As Color3d
|
|
Public ReadOnly Property c3MachStart As Color3d
|
|
Get
|
|
Dim c3Temp As Color3d
|
|
If Not GetMainPrivateProfileColor(S_COLORS, K_CLR_MACHSTART, c3Temp) Then
|
|
c3Temp.FromColor(System.Drawing.Color.Red)
|
|
End If
|
|
Return c3Temp
|
|
End Get
|
|
End Property
|
|
|
|
Private m_c3Rib As Color3d
|
|
Public ReadOnly Property c3Rib As Color3d
|
|
Get
|
|
Dim c3Temp As Color3d
|
|
If Not GetMainPrivateProfileColor(S_COLORS, K_CLR_RIBS, c3Temp) Then
|
|
c3Temp.FromColor(System.Drawing.Color.MediumOrchid)
|
|
End If
|
|
Return c3Temp
|
|
End Get
|
|
End Property
|
|
|
|
Private m_c3ShellNumber As Color3d
|
|
Public ReadOnly Property c3ShellNumber As Color3d
|
|
Get
|
|
Dim c3Temp As Color3d
|
|
If Not GetMainPrivateProfileColor(S_COLORS, K_CLR_SHELLNUMBERS, c3Temp) Then
|
|
c3Temp.FromColor(System.Drawing.Color.Lime)
|
|
End If
|
|
Return c3Temp
|
|
End Get
|
|
End Property
|
|
|
|
Private m_c3AuxSolids As Color3d
|
|
Public ReadOnly Property c3AuxSolids As Color3d
|
|
Get
|
|
Dim c3Temp As Color3d
|
|
If Not GetMainPrivateProfileColor(S_COLORS, K_CLR_AUXSOLIDS, c3Temp) Then
|
|
c3Temp.FromColor(System.Drawing.Color.DarkGoldenrod)
|
|
End If
|
|
Return c3Temp
|
|
End Get
|
|
End Property
|
|
|
|
Private m_c3Others As Color3d
|
|
Public ReadOnly Property c3Others As Color3d
|
|
Get
|
|
Dim c3Temp As Color3d
|
|
If Not GetMainPrivateProfileColor(S_COLORS, K_CLR_OTHERS, c3Temp) Then
|
|
c3Temp.FromColor(System.Drawing.Color.LightGray)
|
|
End If
|
|
Return c3Temp
|
|
End Get
|
|
End Property
|
|
|
|
Sub New()
|
|
' imposto colori superfici
|
|
m_c3Print.FromColor(System.Drawing.Color.Aqua)
|
|
GetMainPrivateProfileColor(S_COLORS, K_CLR_PRINTPART, m_c3Print)
|
|
m_c3MachStart.FromColor(System.Drawing.Color.Red)
|
|
GetMainPrivateProfileColor(S_COLORS, K_CLR_MACHSTART, m_c3MachStart)
|
|
m_c3Rib.FromColor(System.Drawing.Color.MediumOrchid)
|
|
GetMainPrivateProfileColor(S_COLORS, K_CLR_RIBS, m_c3Rib)
|
|
m_c3ShellNumber.FromColor(System.Drawing.Color.Lime)
|
|
GetMainPrivateProfileColor(S_COLORS, K_CLR_SHELLNUMBERS, m_c3ShellNumber)
|
|
m_c3AuxSolids.FromColor(System.Drawing.Color.DarkGoldenrod)
|
|
GetMainPrivateProfileColor(S_COLORS, K_CLR_AUXSOLIDS, m_c3AuxSolids)
|
|
m_c3Others.FromColor(System.Drawing.Color.LightGray)
|
|
GetMainPrivateProfileColor(S_COLORS, K_CLR_OTHERS, m_c3Others)
|
|
End Sub
|
|
|
|
Friend Sub SetColor(Type As LayerType, c3Color As Color3d)
|
|
Dim c3Temp As Color3d
|
|
Dim sIniKey As String = ""
|
|
Select Case Type
|
|
Case LayerType.PRINTPART
|
|
c3Temp = c3Print
|
|
sIniKey = K_CLR_PRINTPART
|
|
Case LayerType.RIBS
|
|
c3Temp = c3Rib
|
|
sIniKey = K_CLR_RIBS
|
|
Case LayerType.SHELLNUMBERS
|
|
c3Temp = c3ShellNumber
|
|
sIniKey = K_CLR_SHELLNUMBERS
|
|
Case LayerType.AUXSOLIDS
|
|
c3Temp = c3AuxSolids
|
|
sIniKey = K_CLR_AUXSOLIDS
|
|
Case LayerType.MACHSTART
|
|
c3Temp = c3MachStart
|
|
sIniKey = K_CLR_MACHSTART
|
|
Case LayerType.OTHERS
|
|
c3Temp = c3Others
|
|
sIniKey = K_CLR_OTHERS
|
|
End Select
|
|
c3Temp.R = c3Color.R
|
|
c3Temp.G = c3Color.G
|
|
c3Temp.B = c3Color.B
|
|
WritePrivateProfileColor(S_COLORS, sIniKey, c3Temp)
|
|
UpdateColors(Type)
|
|
End Sub
|
|
Friend Function GetColor(Type As LayerType) As Color3d
|
|
Dim sIniKey As String = ""
|
|
Select Case Type
|
|
Case LayerType.PRINTPART
|
|
Return c3Print
|
|
Case LayerType.RIBS
|
|
Return c3Rib
|
|
Case LayerType.SHELLNUMBERS
|
|
Return c3ShellNumber
|
|
Case LayerType.AUXSOLIDS
|
|
Return c3AuxSolids
|
|
Case LayerType.MACHSTART
|
|
Return c3MachStart
|
|
Case LayerType.OTHERS
|
|
Return c3Others
|
|
End Select
|
|
End Function
|
|
Friend Sub SetAlpha(Type As LayerType, dAlpha As Double)
|
|
Dim c3Temp As Color3d = c3Print
|
|
Dim sIniKey As String = ""
|
|
Select Case Type
|
|
Case LayerType.PRINTPART
|
|
c3Temp = c3Print
|
|
sIniKey = K_CLR_PRINTPART
|
|
Case LayerType.RIBS
|
|
c3Temp = c3Rib
|
|
sIniKey = K_CLR_RIBS
|
|
Case LayerType.SHELLNUMBERS
|
|
c3Temp = c3ShellNumber
|
|
sIniKey = K_CLR_SHELLNUMBERS
|
|
Case LayerType.AUXSOLIDS
|
|
c3Temp = c3AuxSolids
|
|
sIniKey = K_CLR_AUXSOLIDS
|
|
Case LayerType.MACHSTART
|
|
c3Temp = c3MachStart
|
|
sIniKey = K_CLR_MACHSTART
|
|
Case LayerType.OTHERS
|
|
c3Temp = c3Others
|
|
sIniKey = K_CLR_OTHERS
|
|
End Select
|
|
c3Temp.A = dAlpha
|
|
WritePrivateProfileColor(S_COLORS, sIniKey, c3Temp)
|
|
UpdateColors(Type)
|
|
End Sub
|
|
|
|
Public Function WritePrivateProfileColor(IpAppName As String, IpKeyName As String, ByRef Color As Color3d) As Boolean
|
|
Dim sColor As String = Color.R & "," & Color.G & "," & Color.B & "," & Color.A
|
|
Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, sColor, m_sIniFile)
|
|
End Function
|
|
|
|
Sub UpdateColors(Type As LayerType)
|
|
Dim nPartId As Integer = EgtGetFirstPart()
|
|
While nPartId <> GDB_ID.NULL
|
|
Dim nIsOnTable As Integer = 0
|
|
If Not EgtGetInfo(nPartId, "PartOnTable", nIsOnTable) OrElse nIsOnTable <> 1 Then
|
|
nPartId = EgtGetNextPart(nPartId)
|
|
Continue While
|
|
End If
|
|
' Disabilito segnalazione modificato
|
|
Dim DisableMgr As New DisableModifiedMgr
|
|
' rimuovo eventuali colori da entita' e li assegno ai layer
|
|
If Type = LayerType.PRINTPART OrElse Type = LayerType.ALL Then
|
|
Dim nPrintPartLayerId As Integer = EgtGetFirstNameInGroup(nPartId, PRINT_SOLID)
|
|
Dim nPrintPartEntityId = EgtGetFirstInGroup(nPrintPartLayerId)
|
|
While nPrintPartEntityId <> GDB_ID.NULL
|
|
EgtResetColor(nPrintPartEntityId)
|
|
nPrintPartEntityId = EgtGetNext(nPrintPartEntityId)
|
|
End While
|
|
EgtSetColor(nPrintPartLayerId, GeomEntityColors.c3Print)
|
|
End If
|
|
If Type = LayerType.RIBS OrElse Type = LayerType.ALL Then
|
|
Dim nRibsLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_RIBS)
|
|
Dim nRibsEntityId = EgtGetFirstInGroup(nRibsLayerId)
|
|
While nRibsEntityId <> GDB_ID.NULL
|
|
EgtResetColor(nRibsEntityId)
|
|
nRibsEntityId = EgtGetNext(nRibsEntityId)
|
|
End While
|
|
EgtSetColor(nRibsLayerId, GeomEntityColors.c3Rib)
|
|
End If
|
|
If Type = LayerType.SHELLNUMBERS OrElse Type = LayerType.ALL Then
|
|
Dim nShellNumberLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_SHELL_NBR)
|
|
Dim nShellNumberEntityId = EgtGetFirstInGroup(nShellNumberLayerId)
|
|
While nShellNumberEntityId <> GDB_ID.NULL
|
|
EgtResetColor(nShellNumberEntityId)
|
|
nShellNumberEntityId = EgtGetNext(nShellNumberEntityId)
|
|
End While
|
|
EgtSetColor(nShellNumberLayerId, GeomEntityColors.c3ShellNumber)
|
|
End If
|
|
If Type = LayerType.AUXSOLIDS OrElse Type = LayerType.ALL Then
|
|
Dim nAuxSolidsLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_AUX_SOLIDS)
|
|
Dim nAuxSolidsEntityId = EgtGetFirstInGroup(nAuxSolidsLayerId)
|
|
While nAuxSolidsEntityId <> GDB_ID.NULL
|
|
EgtResetColor(nAuxSolidsEntityId)
|
|
nAuxSolidsEntityId = EgtGetNext(nAuxSolidsEntityId)
|
|
End While
|
|
EgtSetColor(nAuxSolidsLayerId, GeomEntityColors.c3AuxSolids)
|
|
End If
|
|
If Type = LayerType.MACHSTART OrElse Type = LayerType.ALL Then
|
|
Dim nMachStartLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_MACH_START)
|
|
Dim nMachStartEntityId = EgtGetFirstInGroup(nMachStartLayerId)
|
|
While nMachStartEntityId <> GDB_ID.NULL
|
|
EgtResetColor(nMachStartEntityId)
|
|
nMachStartEntityId = EgtGetNext(nMachStartEntityId)
|
|
End While
|
|
EgtSetColor(nMachStartLayerId, GeomEntityColors.c3MachStart)
|
|
End If
|
|
If Type = LayerType.OTHERS OrElse Type = LayerType.ALL Then
|
|
Dim nOthersLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_OTHERS)
|
|
Dim nOthersEntityId = EgtGetFirstInGroup(nOthersLayerId)
|
|
While nOthersEntityId <> GDB_ID.NULL
|
|
EgtResetColor(nOthersEntityId)
|
|
nOthersEntityId = EgtGetNext(nOthersEntityId)
|
|
End While
|
|
EgtSetColor(nOthersLayerId, GeomEntityColors.c3Others)
|
|
End If
|
|
' Ripristino stato segnalazione modifica
|
|
DisableMgr.ReEnable()
|
|
nPartId = EgtGetNextPart(nPartId)
|
|
End While
|
|
' se in import, aggiorno anche i pezzi di import
|
|
If Map.refTopPanelVM.SelPage = Pages.IMPORT Then
|
|
For Each ImportPart In Map.refManagePartPanelVM.ManagerPartList
|
|
Dim Layer As ManagePart_Layer = ImportPart.LayerList.FirstOrDefault(Function(x) x.Type = Type)
|
|
If Not IsNothing(Layer) Then
|
|
For Each Entity In Layer.EntityList
|
|
EgtSetColor(Entity.nId, GetColor(Type))
|
|
Next
|
|
End If
|
|
Next
|
|
End If
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
End Module
|