Imports System.Collections.ObjectModel Imports System.Collections.Specialized Imports System.Globalization Imports EgtUILib Imports EgtWPFLib5 Public Class StartMachPanelVM Inherits VMBase #Region "FIELDS & PROPERTIES" Public Enum StartMachTypes As Integer NULL = 0 POINT = 1 COMPO = 2 End Enum Private m_nPartId As Integer = GDB_ID.NULL Private m_nStartMachLayerId As Integer = GDB_ID.NULL Friend ReadOnly Property nStartMachLayerId As Integer Get Return m_nStartMachLayerId End Get End Property Private m_StartList As New ObservableCollection(Of StartEntity) Public ReadOnly Property StartList As ObservableCollection(Of StartEntity) Get Return m_StartList End Get End Property Private m_SelStart As StartEntity Public Property SelStart As StartEntity Get Return m_SelStart End Get Set(value As StartEntity) m_SelStart = value EgtDeselectAll() If Not IsNothing(value) Then EgtSelectObj(value.nId) ' aggiorno visibilita' bottoni edit NotifyPropertyChanged(NameOf(Compo_Visibility)) ' aggiorno campi di testo posizione NotifyPropertyChanged(NameOf(sXPos)) NotifyPropertyChanged(NameOf(sYPos)) NotifyPropertyChanged(NameOf(sZPos)) End If EgtDraw() End Set End Property Public Property sXPos As String Get If Not IsNothing(m_SelStart) Then Dim ptReference As New Point3d EgtStartPoint(m_SelStart.nId, GDB_ID.ROOT, ptReference) Return LenToString(ptReference.x, 1) Else Return "" End If End Get Set(value As String) Dim ptReference As New Point3d EgtStartPoint(m_SelStart.nId, GDB_ID.ROOT, ptReference) Dim dNewXPos As Double = ptReference.x StringToLen(value, dNewXPos) If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then EgtMove(m_SelStart.nId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference, GDB_RT.GLOB) EgtDraw() Else NotifyPropertyChanged(NameOf(sXPos)) End If ' Imposto flag di ricalcolo slice EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True) End Set End Property Public Property sYPos As String Get If Not IsNothing(m_SelStart) Then Dim ptReference As New Point3d EgtStartPoint(m_SelStart.nId, GDB_ID.ROOT, ptReference) Return LenToString(ptReference.y, 1) Else Return "" End If End Get Set(value As String) Dim ptReference As New Point3d EgtStartPoint(m_SelStart.nId, GDB_ID.ROOT, ptReference) Dim dNewYPos As Double = ptReference.y StringToLen(value, dNewYPos) If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then EgtMove(m_SelStart.nId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference, GDB_RT.GLOB) EgtDraw() Else NotifyPropertyChanged(NameOf(sYPos)) End If ' Imposto flag di ricalcolo slice EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True) End Set End Property Public Property sZPos As String Get If Not IsNothing(m_SelStart) Then Dim ptReference As New Point3d EgtStartPoint(m_SelStart.nId, GDB_ID.ROOT, ptReference) Return LenToString(ptReference.z, 1) Else Return "" End If End Get Set(value As String) Dim ptReference As New Point3d EgtStartPoint(m_SelStart.nId, GDB_ID.ROOT, ptReference) Dim dNewZPos As Double = ptReference.z StringToLen(value, dNewZPos) If dNewZPos >= -1000 Then EgtMove(m_SelStart.nId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference, GDB_RT.GLOB) EgtDraw() Else NotifyPropertyChanged(NameOf(sZPos)) End If ' Imposto flag di ricalcolo slice EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True) End Set End Property Private m_RotAxes() As Boolean = {False, False, True} Public Property RotX As Boolean Get Return m_RotAxes(0) End Get Set(value As Boolean) m_RotAxes(0) = value End Set End Property Public Property RotY As Boolean Get Return m_RotAxes(1) End Get Set(value As Boolean) m_RotAxes(1) = value End Set End Property Public Property RotZ As Boolean Get Return m_RotAxes(2) End Get Set(value As Boolean) m_RotAxes(2) = value End Set End Property Public ReadOnly Property vtSelRotAxes As Vector3d Get If m_RotAxes(0) Then Return Vector3d.X_AX ElseIf m_RotAxes(1) Then Return Vector3d.Y_AX Else Return Vector3d.Z_AX End If End Get End Property Private m_sRotAngle As String Public Property sRotAngle As String Get Return m_sRotAngle End Get Set(value As String) Dim dNewAngle As Double = 0 If Not StringToLen(value, dNewAngle) Then m_sRotAngle = 0 NotifyPropertyChanged(NameOf(sRotAngle)) Return End If Dim b3PrintSolid As New BBox3d EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPartId, GDB_BB.STANDARD, b3PrintSolid) If EgtRotate(Map.refTopPanelVM.SelPart.nPartId, b3PrintSolid.Center, vtSelRotAxes, dNewAngle, GDB_RT.GLOB) Then EgtDraw() RefreshPos() m_sRotAngle = 0 NotifyPropertyChanged(NameOf(sRotAngle)) ' Imposto flag di ricalcolo slice EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True) Else m_sRotAngle = value End If End Set End Property Private m_bAdd_IsChecked As Boolean Public Property bAdd_IsChecked As Boolean Get Return m_bAdd_IsChecked End Get Set(value As Boolean) If Map.refSceneHostVM.MainController.GetStep = 0 Then m_bAdd_IsChecked = value If value Then m_bEdit_IsChecked = False m_bGrid_IsChecked = False m_bMove_IsChecked = False NotifyPropertyChanged(NameOf(bEdit_IsChecked)) NotifyPropertyChanged(NameOf(bGrid_IsChecked)) NotifyPropertyChanged(NameOf(bMove_IsChecked)) End If Else NotifyPropertyChanged(NameOf(bAdd_IsChecked)) End If End Set End Property Private m_bEdit_IsChecked As Boolean Public Property bEdit_IsChecked As Boolean Get Return m_bEdit_IsChecked End Get Set(value As Boolean) If Not IsNothing(m_SelStart) AndAlso Map.refSceneHostVM.MainController.GetStep = 0 Then m_bEdit_IsChecked = value If value Then m_bAdd_IsChecked = False m_bGrid_IsChecked = False m_bMove_IsChecked = False NotifyPropertyChanged(NameOf(bAdd_IsChecked)) NotifyPropertyChanged(NameOf(bGrid_IsChecked)) NotifyPropertyChanged(NameOf(bMove_IsChecked)) End If Else NotifyPropertyChanged(NameOf(bEdit_IsChecked)) End If End Set End Property Private m_bGrid_IsChecked As Boolean Public Property bGrid_IsChecked As Boolean Get Return m_bGrid_IsChecked End Get Set(value As Boolean) If Map.refSceneHostVM.MainController.GetStep = 0 Then m_bGrid_IsChecked = value If value Then m_bAdd_IsChecked = False m_bEdit_IsChecked = False m_bMove_IsChecked = False NotifyPropertyChanged(NameOf(bAdd_IsChecked)) NotifyPropertyChanged(NameOf(bEdit_IsChecked)) NotifyPropertyChanged(NameOf(bMove_IsChecked)) End If Else NotifyPropertyChanged(NameOf(bGrid_IsChecked)) End If End Set End Property Public ReadOnly Property bGrid_IsEnabled As Boolean Get Return Map.refMyStatusBarVM.bGridVisibility End Get End Property Private m_bMove_IsChecked As Boolean Public Property bMove_IsChecked As Boolean Get Return m_bMove_IsChecked End Get Set(value As Boolean) If Not IsNothing(m_SelStart) AndAlso Map.refSceneHostVM.MainController.GetStep = 0 Then m_bMove_IsChecked = value If value Then m_bAdd_IsChecked = False m_bEdit_IsChecked = False m_bGrid_IsChecked = False NotifyPropertyChanged(NameOf(bAdd_IsChecked)) NotifyPropertyChanged(NameOf(bEdit_IsChecked)) NotifyPropertyChanged(NameOf(bGrid_IsChecked)) End If Else NotifyPropertyChanged(NameOf(bMove_IsChecked)) End If End Set End Property Public ReadOnly Property Compo_Visibility As Visibility Get Return If(Not IsNothing(m_SelStart) AndAlso m_SelStart.Type = StartMachTypes.COMPO, Visibility.Visible, Visibility.Collapsed) End Get End Property ' riferimento griglia all'ingresso in questa pagina Private m_OriginalGridFrame As New Frame3d ' parametro che indica se e' in corso il disegno di un percorso Private m_bIsCreatingPath As Boolean = False Public ReadOnly Property bIsCreatingPath As Boolean Get Return m_bIsCreatingPath End Get End Property ' Definizione comandi Private m_cmdPoint As ICommand Private m_cmdLine2P As ICommand Private m_cmdModifyCurve As ICommand Private m_cmdAddPointCurve As ICommand Private m_cmdRemovePointCurve As ICommand Private m_cmdCPlaneTop As ICommand Private m_cmdCPlaneFront As ICommand Private m_cmdCPlaneRight As ICommand Private m_cmdCPlaneBack As ICommand Private m_cmdCPlaneLeft As ICommand Private m_cmdCPlaneBottom As ICommand Private m_cmdCPlaneView As ICommand Private m_cmdCPlaneElevation As ICommand Private m_cmdCPlaneOrigin As ICommand Private m_cmdCPlaneRotate As ICommand Private m_cmdCPlane3P As ICommand Private m_cmdCPlanePerpObj As ICommand Private m_cmdCPlaneObj As ICommand Private m_cmdDragMove As ICommand Private m_cmdDelete As ICommand #End Region ' FIELDS & PROPERTIES #Region "CONSTRUCTORS" Sub New() ' Creo riferimento a questa classe in EgtCAM5Map Map.SetRefStartMachPanelVM(Me) End Sub #End Region ' CONSTRUCTORS #Region "METHODS" Friend Sub Init() ' azzero indice StartEntity.ResetSharedIndex() ' fisso frame originale m_OriginalGridFrame = EgtGetGridFrame() ' recupero dati pezzo selezionato layer ed entita' m_nPartId = Map.refTopPanelVM.SelPart.nPartId m_nStartMachLayerId = Map.refTopPanelVM.SelPart.nMachStartLayerId 'recupero tutte le entita' di partenza m_StartList.Clear() Dim nStartMachId As Integer = EgtGetFirstInGroup(m_nStartMachLayerId) While nStartMachId <> GDB_ID.NULL Dim StartMachType As GDB_TY = EgtGetType(nStartMachId) Select Case StartMachType Case GDB_TY.GEO_POINT m_StartList.Add(New StartEntity(nStartMachId, StartMachTypes.POINT)) Case GDB_TY.CRV_COMPO m_StartList.Add(New StartEntity(nStartMachId, StartMachTypes.COMPO)) End Select nStartMachId = EgtGetNext(nStartMachId) End While If m_StartList.Count > 0 Then SelStart = m_StartList(0) NotifyPropertyChanged(NameOf(SelStart)) End If Map.refSceneHostVM.MainScene.SetStatusNull() End Sub Friend Sub Dispose() ' ripristino frame originale EgtSetGridFrame(m_OriginalGridFrame) EgtDeselectAll() EgtDraw() Map.refSceneHostVM.MainScene.SetStatusNull() End Sub Friend Sub RefreshPos() NotifyPropertyChanged(NameOf(sXPos)) NotifyPropertyChanged(NameOf(sYPos)) NotifyPropertyChanged(NameOf(sZPos)) End Sub Private Function InitCommand() As Boolean ' attivo modifiche su scena Map.refSceneHostVM.MainScene.ResetStatus() ' seleziono percorso corrente EgtDeselectAll() EgtSelectObj(m_SelStart.nId) Return True End Function Friend Sub UpdateUI() ' se attiva operazione in piu' passaggi, esco If Map.refSceneHostVM.MainController.GetContinue() Then Return Dim NewEntity As StartEntity = Nothing ' se finita creazione curva (è stata chiusa) If bIsCreatingPath Then m_bIsCreatingPath = False Dim nNewStartLayerId As Integer = EgtGetFirstNameInGroup(m_nPartId, LAY_NEWSTART) Dim nNewEntityId As Integer = EgtGetFirstInGroup(nNewStartLayerId) Dim NewGeomType As GDB_TY = EgtGetType(nNewEntityId) If NewGeomType = GDB_TY.GEO_POINT OrElse NewGeomType = GDB_TY.CRV_COMPO Then Dim NewEntityType As StartMachTypes Select Case NewGeomType Case GDB_TY.GEO_POINT NewEntityType = StartMachTypes.POINT Case GDB_TY.CRV_COMPO NewEntityType = StartMachTypes.COMPO End Select EgtSetName(nNewEntityId, START_GEOM) ' coloro l'entita' di rosso Dim c3Red As Color3d c3Red.FromColor(System.Drawing.Color.Red) EgtSetColor(nNewEntityId, c3Red) ' lo sposto nel layer degli start EgtRelocateGlob(nNewEntityId, m_nStartMachLayerId, GDB_POS.LAST_SON) ' lo aggiungo alla lista NewEntity = New StartEntity(nNewEntityId, NewEntityType) m_StartList.Add(NewEntity) ' cancello layer di disegno EgtErase(nNewStartLayerId) End If End If ' aggiorno posizione RefreshPos() ' se aggiunta entita' If Not IsNothing(NewEntity) Then SelStart = NewEntity NotifyPropertyChanged(NameOf(SelStart)) End If ' rimetto la selezione scena a null Map.refSceneHostVM.MainScene.SetStatusNull() End Sub Friend Sub OnExecCmdEnd(command As Controller.CMD) Select Case command Case Controller.CMD.LINE2P, Controller.CMD.DELETE, Controller.CMD.MODIFYCURVE, Controller.CMD.ADDPOINTCURVE, Controller.CMD.REMOVEPOINTCURVE, Controller.CMD.MOVE, Controller.CMD.ROTATE ' Imposto flag di ricalcolo slice EgtSetInfo(Map.refTopPanelVM.SelPart.nPartId, MAC_TORECALC_SLICE, True) End Select End Sub Friend Sub OnKeyDown(Key As Forms.Keys) If Key = Forms.Keys.Escape Then ' se attiva, disattivo griglia su oggetto If m_bCPlaneObj_IsActive Then m_bCPlaneObj_IsActive = False ResetCPlaneObjIsActive() ' ripristino selezioni precedenti For Each Id In Map.refShellNumberPanelVM.PrevSelObjs EgtSelectObj(Id) Next EgtDraw() ' rimetto la selezione scena a null Map.refSceneHostVM.MainScene.SetStatusNull() End If End If End Sub Friend Function OnMouseSelectingObj(nId As Integer) As Boolean Return EgtGetParent(nId) = m_nStartMachLayerId End Function Friend Sub SelStartFromId(nId) Dim SelStartEntity As StartEntity = m_StartList.FirstOrDefault(Function(x) x.nId = nId) If Not IsNothing(SelStartEntity) Then SelStart = SelStartEntity NotifyPropertyChanged(NameOf(SelStart)) End If End Sub #End Region ' METHODS #Region "COMMANDS" #Region "Point" ''' ''' Returns a command that do CPlaneTop. ''' Public ReadOnly Property Point_Command As ICommand Get If m_cmdPoint Is Nothing Then m_cmdPoint = New Command(AddressOf Point) End If Return m_cmdPoint End Get End Property ''' ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. ''' Public Sub Point(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Dim nNewStartLayerId As Integer = EgtGetFirstNameInGroup( m_nPartId, LAY_NEWSTART) If nNewStartLayerId = GDB_ID.NULL Then nNewStartLayerId = EgtCreateGroup(m_nPartId) EgtSetName(nNewStartLayerId, LAY_NEWSTART) End If EgtSetCurrPartLayer(m_nPartId, nNewStartLayerId) 'InitCommand(True) If Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.POINT) Then m_bIsCreatingPath = True End If End Sub #End Region ' Point #Region "Line2P" ''' ''' Returns a command that do CPlaneTop. ''' Public ReadOnly Property Line2P_Command As ICommand Get If m_cmdLine2P Is Nothing Then m_cmdLine2P = New Command(AddressOf Line2P) End If Return m_cmdLine2P End Get End Property ''' ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. ''' Public Sub Line2P(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Dim nNewStartLayerId As Integer = EgtGetFirstNameInGroup( m_nPartId, LAY_NEWSTART) If nNewStartLayerId = GDB_ID.NULL Then nNewStartLayerId = EgtCreateGroup(m_nPartId) EgtSetName(nNewStartLayerId, LAY_NEWSTART) End If EgtSetCurrPartLayer(m_nPartId, nNewStartLayerId) Map.refSceneHostVM.MainController.SetContinue() If Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.LINE2P) Then m_bIsCreatingPath = True End If End Sub #End Region ' Line2P #Region "ModifyCurve" ''' ''' Returns a command that do Linear Dimension. ''' Public ReadOnly Property ModifyCurve_Command As ICommand Get If m_cmdModifyCurve Is Nothing Then m_cmdModifyCurve = New Command(AddressOf ModifyCurve) End If Return m_cmdModifyCurve End Get End Property ''' ''' Execute the LinearDimension. This method is invoked by the LinDimCommand. ''' Public Sub ModifyCurve(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return InitCommand() Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.MODIFYCURVE) End Sub #End Region ' ModifyCurve #Region "AddPointCurve" ''' ''' Returns a command that do Linear Dimension. ''' Public ReadOnly Property AddPointCurve_Command As ICommand Get If m_cmdAddPointCurve Is Nothing Then m_cmdAddPointCurve = New Command(AddressOf AddPointCurve) End If Return m_cmdAddPointCurve End Get End Property ''' ''' Execute the LinearDimension. This method is invoked by the LinDimCommand. ''' Public Sub AddPointCurve(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return InitCommand() If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.CURVETOARC) Else Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.ADDPOINTCURVE) End If End Sub #End Region ' AddPointCurve #Region "RemovePointCurve" ''' ''' Returns a command that do Linear Dimension. ''' Public ReadOnly Property RemovePointCurve_Command As ICommand Get If m_cmdRemovePointCurve Is Nothing Then m_cmdRemovePointCurve = New Command(AddressOf RemovePointCurve) End If Return m_cmdRemovePointCurve End Get End Property ''' ''' Execute the LinearDimension. This method is invoked by the LinDimCommand. ''' Public Sub RemovePointCurve(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then InitCommand() Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.CURVETOLINE) Else InitCommand() Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.REMOVEPOINTCURVE) End If End Sub #End Region ' RemovePointCurve #Region "CPlaneTop" ''' ''' Returns a command that do CPlaneTop. ''' Public ReadOnly Property CPlaneTop_Command As ICommand Get If m_cmdCPlaneTop Is Nothing Then m_cmdCPlaneTop = New Command(AddressOf CPlaneTop) End If Return m_cmdCPlaneTop End Get End Property ''' ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. ''' Public Sub CPlaneTop(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.TOP) Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' CPlaneTop #Region "CPlaneFront" ''' ''' Returns a command that do CPlaneFront. ''' Public ReadOnly Property CPlaneFront_Command As ICommand Get If m_cmdCPlaneFront Is Nothing Then m_cmdCPlaneFront = New Command(AddressOf CPlaneFront) End If Return m_cmdCPlaneFront End Get End Property ''' ''' Execute the CPlaneFront. This method is invoked by the CPlaneFrontCommand. ''' Public Sub CPlaneFront(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.FRONT) Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' CPlaneFront #Region "CPlaneRight" ''' ''' Returns a command that do CPlaneRight. ''' Public ReadOnly Property CPlaneRight_Command As ICommand Get If m_cmdCPlaneRight Is Nothing Then m_cmdCPlaneRight = New Command(AddressOf CPlaneRight) End If Return m_cmdCPlaneRight End Get End Property ''' ''' Execute the CPlaneRight. This method is invoked by the CPlaneRightCommand. ''' Public Sub CPlaneRight(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.RIGHT) Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' CPlaneRight #Region "CPlaneBack" ''' ''' Returns a command that do CPlaneBack. ''' Public ReadOnly Property CPlaneBack_Command As ICommand Get If m_cmdCPlaneBack Is Nothing Then m_cmdCPlaneBack = New Command(AddressOf CPlaneBack) End If Return m_cmdCPlaneBack End Get End Property ''' ''' Execute the CPlaneBack. This method is invoked by the CPlaneBackCommand. ''' Public Sub CPlaneBack(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.BACK) Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' CPlaneBack #Region "CPlaneLeft" ''' ''' Returns a command that do CPlaneLeft. ''' Public ReadOnly Property CPlaneLeft_Command As ICommand Get If m_cmdCPlaneLeft Is Nothing Then m_cmdCPlaneLeft = New Command(AddressOf CPlaneLeft) End If Return m_cmdCPlaneLeft End Get End Property ''' ''' Execute the CPlaneLeft. This method is invoked by the CPlaneLeftCommand. ''' Public Sub CPlaneLeft(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.LEFT) Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' CPlaneLeft #Region "CPlaneBottom" ''' ''' Returns a command that do CPlaneBottom. ''' Public ReadOnly Property CPlaneBottom_Command As ICommand Get If m_cmdCPlaneBottom Is Nothing Then m_cmdCPlaneBottom = New Command(AddressOf CPlaneBottom) End If Return m_cmdCPlaneBottom End Get End Property ''' ''' Execute the CPlaneBottom. This method is invoked by the CPlaneBottomCommand. ''' Public Sub CPlaneBottom(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.BOTTOM) Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) End Sub #End Region ' CPlaneBottom #Region "CPlaneElevation" ''' ''' Returns a command that do CPlaneElevation. ''' Public ReadOnly Property CPlaneElevation_Command As ICommand Get If m_cmdCPlaneElevation Is Nothing Then m_cmdCPlaneElevation = New Command(AddressOf CPlaneElevation) End If Return m_cmdCPlaneElevation End Get End Property ''' ''' Execute the CPlaneElevation. This method is invoked by the CPlaneElevationCommand. ''' Public Sub CPlaneElevation(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID_ELEVATION) End Sub #End Region ' CPlaneElevation #Region "CPlaneOrigin" ''' ''' Returns a command that do CPlaneOrigin. ''' Public ReadOnly Property CPlaneOrigin_Command As ICommand Get If m_cmdCPlaneOrigin Is Nothing Then m_cmdCPlaneOrigin = New Command(AddressOf CPlaneOrigin) End If Return m_cmdCPlaneOrigin End Get End Property ''' ''' Execute the CPlaneOrigin. This method is invoked by the CPlaneOriginCommand. ''' Public Sub CPlaneOrigin(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID_ORIGIN) End Sub #End Region ' CPlaneOrigin #Region "CPlaneObj" Private m_bCPlaneObj_IsActive As Boolean = False Friend ReadOnly Property bCPlaneObj_IsActive As Boolean Get Return m_bCPlaneObj_IsActive End Get End Property Friend Sub ResetCPlaneObjIsActive() m_bCPlaneObj_IsActive = False End Sub Private m_PrevSelObjs As New List(Of Integer) Friend ReadOnly Property PrevSelObjs As List(Of Integer) Get Return m_PrevSelObjs End Get End Property ''' ''' Returns a command that do CPlanepObj. ''' Public ReadOnly Property CPlaneObj_Command As ICommand Get If m_cmdCPlaneObj Is Nothing Then m_cmdCPlaneObj = New Command(AddressOf CPlaneObj) End If Return m_cmdCPlaneObj End Get End Property ''' ''' Execute the CPlaneObj. This method is invoked by the CPlaneObjCommand. ''' Public Sub CPlaneObj(ByVal param As Object) If Map.refSceneHostVM.MainController.GetStep <> 0 Then Return ' salvo selezione precedente e deseleziono altri oggetti m_PrevSelObjs.Clear() Dim nSelObjId As Integer = EgtGetFirstSelectedObj() While nSelObjId <> GDB_ID.NULL m_PrevSelObjs.Add(nSelObjId) nSelObjId = EgtGetNextSelectedObj() End While EgtDeselectAll() m_bCPlaneObj_IsActive = True ' Map.refControllerInputPanelVM.PrepareInputBox("Grid from Selection", "Select the face of the object where to place the grid", "", False, False) End Sub #End Region ' CPlaneObj #Region "DragMove" Public ReadOnly Property DragMove_Command As ICommand Get If m_cmdDragMove Is Nothing Then m_cmdDragMove = New Command(AddressOf DragMove) End If Return m_cmdDragMove End Get End Property Public Sub DragMove() InitCommand() Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.MOVE) End Sub #End Region ' DragMove #Region "Delete" Public ReadOnly Property Delete_Command As ICommand Get If m_cmdDelete Is Nothing Then m_cmdDelete = New Command(AddressOf Delete) End If Return m_cmdDelete End Get End Property Public Sub Delete() If IsNothing(SelStart) Then Return If EgtErase(m_SelStart.nId) Then Dim nSelStartIndex As Integer = m_StartList.IndexOf(SelStart) m_StartList.Remove(SelStart) If nSelStartIndex < m_StartList.Count Then SelStart = m_StartList(nSelStartIndex) ElseIf m_StartList.Count > 0 Then SelStart = m_StartList(m_StartList.Count - 1) Else SelStart = Nothing End If NotifyPropertyChanged(NameOf(SelStart)) End If End Sub #End Region ' Delete #End Region ' COMMANDS End Class Public Class StartEntity Inherits VMBase Private Shared m_nSharedIndex As Integer = 0 Private ReadOnly Property nSharedIndex As Integer Get m_nSharedIndex += 1 Return m_nSharedIndex End Get End Property Friend Shared Sub ResetSharedIndex() m_nSharedIndex = 0 End Sub Private m_nId As Integer Public ReadOnly Property nId As Integer Get Return m_nId End Get End Property Private m_Type As StartMachPanelVM.StartMachTypes Public ReadOnly Property Type As StartMachPanelVM.StartMachTypes Get Return m_Type End Get End Property Private m_nIndex As Integer Public ReadOnly Property nIndex As Integer Get Return m_nIndex End Get End Property Public ReadOnly Property ghName As String Get Dim sType As String = "" Select Case m_Type Case StartMachPanelVM.StartMachTypes.POINT sType = "Point" Case StartMachPanelVM.StartMachTypes.COMPO sType = "Path" End Select Return String.Format("[{0}] {1}", {m_nIndex, sType}) End Get End Property Sub New(nId As Integer, Type As StartMachPanelVM.StartMachTypes) m_nId = nId m_Type = Type m_nIndex = nSharedIndex End Sub End Class