1aab4c7ec8
- aggiunta quotatura su hardware per report. - aggiunti parametri quotature nelle opzioni.
178 lines
5.6 KiB
VB.net
178 lines
5.6 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
|
|
Public Class InstrumentPanelVM
|
|
Inherits ViewBase
|
|
|
|
Implements INotifyPropertyChanged
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
#Region "ToolTip"
|
|
|
|
Public ReadOnly Property GetDistToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_GRIDVIEWPANEL + 18)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PrintHardwareToolTip As String
|
|
Get
|
|
Return "Save Image"
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' ToolTip
|
|
|
|
Private m_GetDistIsChecked As Boolean = True
|
|
Public Property GetDistIsChecked As Boolean
|
|
Get
|
|
GetDistance(m_GetDistIsChecked)
|
|
Return m_GetDistIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_GetDistIsChecked Then
|
|
m_GetDistIsChecked = value
|
|
NotifyPropertyChanged("GetDistIsChecked")
|
|
End If
|
|
|
|
End Set
|
|
End Property
|
|
|
|
' se il bottone è selezionato (true) allora misura, altrimenti no (false)
|
|
Public Sub GetDistance(bGetDistanceIsChecked As Boolean)
|
|
If bGetDistanceIsChecked Then
|
|
Map.refSceneManagerVM.ProjectScene.SetStatusGetDistance()
|
|
Else
|
|
Map.refSceneManagerVM.ProjectScene.ResetStatusGetDistance()
|
|
'Map.refSceneManagerVM.ProjectScene.SetStatusNull()
|
|
Dim rfStatusBarVM As StatusBarVM = Map.refStatusBarVM
|
|
rfStatusBarVM.StatusOutput = String.Empty
|
|
End If
|
|
End Sub
|
|
|
|
Private m_PrintHardwareVisibility As Visibility = Visibility.Collapsed
|
|
Public Property PrintHardwareVisibility As Visibility
|
|
Get
|
|
Return m_PrintHardwareVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_PrintHardwareVisibility = value
|
|
NotifyPropertyChanged("PrintHardwareVisibility")
|
|
End Set
|
|
End Property
|
|
|
|
#Region "Button state"
|
|
|
|
Private m_bLayerOk As Boolean = True
|
|
Public Property bLayerOk As Boolean
|
|
Get
|
|
Return m_bLayerOk
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_bLayerOk = value
|
|
NotifyPropertyChanged("bLayerOk")
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Button state
|
|
|
|
' Definizione comandi
|
|
Private m_cmdLinDim As ICommand
|
|
Private m_cmdPrintHardware As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "LinearDimensionCommand"
|
|
|
|
Public ReadOnly Property LinearDimensionCommand As ICommand
|
|
Get
|
|
If m_cmdLinDim Is Nothing Then
|
|
m_cmdLinDim = New Command(AddressOf LinearDimension)
|
|
End If
|
|
Return m_cmdLinDim
|
|
End Get
|
|
End Property
|
|
|
|
Private m_DimensioningLayer As Integer
|
|
|
|
Public Sub LinearDimension(ByVal param As Object)
|
|
GetDistIsChecked = False
|
|
Dim x As Integer = EgtSetCurrPartLayer(EgtGetFirstPart(), m_DimensioningLayer)
|
|
If EgtSetCurrPartLayer(1, m_DimensioningLayer) = 0 Then
|
|
Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.NEWLAYER)
|
|
m_DimensioningLayer = EgtGetCurrLayer()
|
|
'EgtSetColor(m_DimensioningLayer, "BLACK")
|
|
End If
|
|
Map.refSceneManagerVM.ProjectScene.SetStatusSelPoint()
|
|
If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then
|
|
Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.LINEARDIMENSION)
|
|
Else
|
|
Map.refSceneManagerVM.GetController.ExecuteCommand(Controller.CMD.ALIGNEDDIMENSION)
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' LinearDimensionCommand
|
|
|
|
#Region "PrintHardwareCommand"
|
|
|
|
Public ReadOnly Property PrintHardwareCommand As ICommand
|
|
Get
|
|
If m_cmdPrintHardware Is Nothing Then
|
|
m_cmdPrintHardware = New Command(AddressOf PrintHardware)
|
|
End If
|
|
Return m_cmdPrintHardware
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub PrintHardware()
|
|
If Map.refProjectManagerHardwareVM.IsModified Then
|
|
' Project must be saved before printing
|
|
MessageBox.Show(EgtMsg(50186), EgtMsg(50144), MessageBoxButton.OK, MessageBoxImage.Warning)
|
|
Return
|
|
End If
|
|
If IsNothing(Map.refHardwarePageVM.CurrHardware) OrElse IsNothing(Map.refHardwarePageVM.CurrHardware.SelTemplate) Then Return
|
|
Dim sCurrDir As String = Path.GetDirectoryName(Map.refHardwarePageVM.CurrHardware.CurrPath())
|
|
Dim sImageFile As String = sCurrDir & "\" & Path.GetFileNameWithoutExtension(Map.refHardwarePageVM.CurrHardware.CurrPath) & ".png"
|
|
ExportPngFromNge(sImageFile)
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
Public Function ExportPngFromNge(ByRef SPathImage As String) As Boolean
|
|
' Creo l'immagine da allegare
|
|
' Nascondo la tavola ed eseguo zoom su quello che rimane
|
|
' EgtZoom(ZM.ALL, True)
|
|
' Prendo l'immagine per la stampa
|
|
Dim colWhite As New Color3d(255, 255, 255)
|
|
Dim nImgW As Integer = 3000
|
|
Dim nImgH As Integer = 4000
|
|
Dim sPath As String = SPathImage
|
|
EgtSetLineAttribs(3)
|
|
If Not EgtGetImage(SM.HIDDENLINE, colWhite, colWhite, nImgW, nImgH, sPath) Then
|
|
' Error in creating the print image
|
|
EgtOutLog(EgtMsg(50181))
|
|
Return False
|
|
End If
|
|
EgtSetLineAttribs(1)
|
|
SPathImage = sPath
|
|
Return True
|
|
End Function
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
Map.SetRefInstrumentPanelVM(Me)
|
|
IniFile.m_ProjectSceneContext = Map.refSceneManagerVM.ProjectScene.GetCtx
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class |