diff --git a/Controller.vb b/Controller.vb index 4054c3f..3545d02 100644 --- a/Controller.vb +++ b/Controller.vb @@ -197,9 +197,7 @@ Public Class Controller ' Metodi Public Function NewProject(Optional ByVal bCreatePart As Boolean = False) As Boolean ' gestisco eventuale file corrente modificato - If Not ManageModified() Then - Return False - End If + If Not ManageModified() Then Return False ' reset controller e scena ResetStatus() m_Scene.ResetStatus(False) @@ -229,9 +227,7 @@ Public Class Controller Public Function OpenProject(Optional ByVal sDir As String = "", Optional ByVal bWithDlg As Boolean = True) As Boolean ' gestisco eventuale file corrente modificato - If Not ManageModified() Then - Return False - End If + If Not ManageModified() Then Return False ' reset controller e scena ResetStatus() m_Scene.ResetStatus(False) @@ -251,9 +247,9 @@ Public Class Controller End If sFile = OpenFileDialog.FileName End If - 'Prima del caricamento + ' Prima del caricamento RaiseEvent OnOpeningProject(Me) - 'Caricamento del progetto + ' Caricamento del progetto m_Scene.Cursor = Cursors.WaitCursor EnableCommandLog() Dim bOk As Boolean = EgtOpenFile(sFile) @@ -557,6 +553,13 @@ Public Class Controller Return bOk End Function + Public Sub MouseSetObjFilterForSelect(bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) + EnableCommandLog() + EgtSetObjFilterForSelect(bZeroDim, bCurve, bSurf, bVolume, bExtra) + DisableCommandLog() + End Sub + Public Sub MouseSelectedAll() ' eseguo la selezione ed aggiorno EnableCommandLog() @@ -4297,8 +4300,11 @@ Public Class Controller ' recupero spessore dell'ultima entità selezionata Dim dThick As Double If EgtCurveThickness(EgtGetLastSelectedObj(), dThick) Then - SetInputBoxDouble(dThick, True) + m_dLast = dThick + Else + m_dLast = 0 End If + SetInputBoxDouble(m_dLast, True) RaiseEvent SetInputBoxCheck(False) Case 1 EnableCommandLog() diff --git a/EgtInterface.vb b/EgtInterface.vb index 7bf002d..9638df4 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -4806,6 +4806,23 @@ End Function '---------- GeomDb Obj Selection ----------------------------------------------- + +Private Function EgtSetObjFilterForSelect_32(bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) As Boolean +End Function + +Private Function EgtSetObjFilterForSelect_64(bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) As Boolean +End Function +Public Function EgtSetObjFilterForSelect(bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) As Boolean + If IntPtr.Size = 4 Then + Return EgtSetObjFilterForSelect_32(bZeroDim, bCurve, bSurf, bVolume, bExtra) + Else + Return EgtSetObjFilterForSelect_64(bZeroDim, bCurve, bSurf, bVolume, bExtra) + End If +End Function + Private Function EgtSelectObj_32(nId As Integer) As Boolean End Function @@ -8891,20 +8908,20 @@ Public Function EgtSelect(Curr As Point, nSelW As Integer, nSelH As Integer, End If End Function - -Private Function EgtSetObjFilterForSelect_32(bZeroDim As Boolean, bCurve As Boolean, + +Private Function EgtSetObjFilterForSelWin_32(bZeroDim As Boolean, bCurve As Boolean, bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) As Boolean End Function - -Private Function EgtSetObjFilterForSelect_64(bZeroDim As Boolean, bCurve As Boolean, + +Private Function EgtSetObjFilterForSelWin_64(bZeroDim As Boolean, bCurve As Boolean, bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) As Boolean End Function -Public Function EgtSetObjFilterForSelect(bZeroDim As Boolean, bCurve As Boolean, +Public Function EgtSetObjFilterForSelWin(bZeroDim As Boolean, bCurve As Boolean, bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) As Boolean If IntPtr.Size = 4 Then - Return EgtSetObjFilterForSelect_32(bZeroDim, bCurve, bSurf, bVolume, bExtra) + Return EgtSetObjFilterForSelWin_32(bZeroDim, bCurve, bSurf, bVolume, bExtra) Else - Return EgtSetObjFilterForSelect_64(bZeroDim, bCurve, bSurf, bVolume, bExtra) + Return EgtSetObjFilterForSelWin_64(bZeroDim, bCurve, bSurf, bVolume, bExtra) End If End Function diff --git a/Form1.vb b/Form1.vb index 2c02e18..611f465 100644 --- a/Form1.vb +++ b/Form1.vb @@ -268,6 +268,7 @@ Public Class Form1 m_MruScripts.Init(m_sIniFile, S_MRUSCRIPTS, 8) ' Apro progetto vuoto m_Controller.NewProject(True) + m_Controller.MouseSetObjFilterForSelect(True, True, True, True, True) ' Impostazione Testi e ToolTips SetMessages() ' Installo funzione gestione eventi per lua @@ -472,6 +473,11 @@ Public Class Form1 tsStatusCursorPos.Text = sCursorPos End Sub + Private Sub OnMouseSetObjFilterForSelect(sender As Object, bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) Handles Scene1.OnMouseSetObjFilterForSelect + m_Controller.MouseSetObjFilterForSelect(bZeroDim, bCurve, bSurf, bVolume, bExtra) + End Sub + Private Sub OnMouseSelectedAll(ByVal sender As Object) Handles Scene1.OnMouseSelectedAll m_Controller.MouseSelectedAll() End Sub @@ -480,6 +486,12 @@ Public Class Form1 m_Controller.MouseDeselectedAll() End Sub + 'Private Sub OnMouseSelectingObj(sender As Object, nId As Integer, ByRef bOk As Boolean) Handles Scene1.OnMouseSelectingObj + ' If EgtGetType(nId) = GDB_TY.CRV_LINE Then + ' bOk = False + ' End If + 'End Sub + Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles Scene1.OnMouseSelectedObj m_Controller.MouseSelectedObj(nId, bLast) End Sub @@ -1590,9 +1602,9 @@ Public Class Form1 Dim sName As String = String.Empty Dim sText As String = String.Empty If EgtGetName(nId, sName) Then - sText = sName + " (" + sTitle + " " + nId.ToString + ")" + sText = sName & " (" & sTitle & " " + nId.ToString & ")" Else - sText = sTitle + " " + nId.ToString + sText = sTitle & " " & nId.ToString End If Dim nImage As Integer = TypeToImageInObjTree(nType, nDepth) Dim CurrNod As TreeNode = CurrNodColl.Add(nId.ToString, sText, nImage, nImage) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 42bb006..1d75fa9 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -46,5 +46,5 @@ Imports System.Runtime.InteropServices ' utilizzando l'asterisco (*) come descritto di seguito: ' - - + + diff --git a/Scene.Designer.vb b/Scene.Designer.vb index 8dcb0a5..60ea9a0 100644 --- a/Scene.Designer.vb +++ b/Scene.Designer.vb @@ -45,7 +45,8 @@ Partial Class Scene Me.cmdPerpendicularPoint = New System.Windows.Forms.ToolStripMenuItem() Me.cmdMinDistPoint = New System.Windows.Forms.ToolStripMenuItem() Me.sepSelPnt1 = New System.Windows.Forms.ToolStripSeparator() - Me.cmdExcludeSurf = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdExcludeSurfFromSel = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdExcludeSurfFromSnap = New System.Windows.Forms.ToolStripMenuItem() Me.sepSelPnt2 = New System.Windows.Forms.ToolStripSeparator() Me.cmdStopDrag = New System.Windows.Forms.ToolStripMenuItem() Me.MenuScene.SuspendLayout() @@ -53,7 +54,7 @@ Partial Class Scene ' 'MenuScene ' - Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdSelectAll, Me.cmdDeselectAll, Me.sepSel1, Me.cmdWinSelect, Me.cmdSelectPart, Me.cmdSelectLayer, Me.cmdSelectPath, Me.cmdSelectPathAuto, Me.cmdRestartDrag, Me.cmdSketchPoint, Me.cmdGridPoint, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdCentroid, Me.cmdNearPoint, Me.cmdIntersectionPoint, Me.cmdTangentPoint, Me.cmdPerpendicularPoint, Me.cmdMinDistPoint, Me.sepSelPnt1, Me.cmdExcludeSurf, Me.sepSelPnt2, Me.cmdStopDrag}) + Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdSelectAll, Me.cmdDeselectAll, Me.sepSel1, Me.cmdWinSelect, Me.cmdSelectPart, Me.cmdSelectLayer, Me.cmdSelectPath, Me.cmdSelectPathAuto, Me.cmdRestartDrag, Me.cmdSketchPoint, Me.cmdGridPoint, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdCentroid, Me.cmdNearPoint, Me.cmdIntersectionPoint, Me.cmdTangentPoint, Me.cmdPerpendicularPoint, Me.cmdMinDistPoint, Me.sepSelPnt1, Me.cmdExcludeSurfFromSel, Me.cmdExcludeSurfFromSnap, Me.sepSelPnt2, Me.cmdStopDrag}) Me.MenuScene.Name = "ContextMenuStrip1" Me.MenuScene.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional Me.MenuScene.ShowCheckMargin = True @@ -197,11 +198,17 @@ Partial Class Scene Me.sepSelPnt1.Name = "sepSelPnt1" Me.sepSelPnt1.Size = New System.Drawing.Size(189, 6) ' - 'cmdExcludeSurf + 'cmdExcludeSurfFromSel ' - Me.cmdExcludeSurf.Name = "cmdExcludeSurf" - Me.cmdExcludeSurf.Size = New System.Drawing.Size(192, 22) - Me.cmdExcludeSurf.Text = "ExcludeSurf" + Me.cmdExcludeSurfFromSel.Name = "cmdExcludeSurfFromSel" + Me.cmdExcludeSurfFromSel.Size = New System.Drawing.Size(192, 22) + Me.cmdExcludeSurfFromSel.Text = "ExcludeSurfFromSel" + ' + 'cmdExcludeSurfFromSnap + ' + Me.cmdExcludeSurfFromSnap.Name = "cmdExcludeSurfFromSnap" + Me.cmdExcludeSurfFromSnap.Size = New System.Drawing.Size(192, 22) + Me.cmdExcludeSurfFromSnap.Text = "ExcludeSurfFromSnap" ' 'sepSelPnt2 ' @@ -247,9 +254,10 @@ End Sub Friend WithEvents cmdPerpendicularPoint As System.Windows.Forms.ToolStripMenuItem Friend WithEvents cmdMinDistPoint As System.Windows.Forms.ToolStripMenuItem Friend WithEvents cmdCentroid As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents cmdExcludeSurf As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdExcludeSurfFromSnap As System.Windows.Forms.ToolStripMenuItem Friend WithEvents sepSelPnt2 As System.Windows.Forms.ToolStripSeparator Friend WithEvents cmdSelectPath As System.Windows.Forms.ToolStripMenuItem Friend WithEvents cmdSelectPathAuto As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents cmdExcludeSurfFromSel As System.Windows.Forms.ToolStripMenuItem End Class diff --git a/Scene.vb b/Scene.vb index 6d28f77..11440f0 100644 --- a/Scene.vb +++ b/Scene.vb @@ -45,7 +45,17 @@ Public Class Scene Private m_nSnapType As SP = SP.PT_GRID ' tipo di snap in selezione punto Private m_bAlsoSelDir As Boolean = False ' abilita anche selezione direzione quando selezione punto Private m_bAlsoDragIntersForSnap As Boolean = False ' abilita intersezione con drag per snap a punto - Private m_bAlsoSurfForSelSnap As Boolean = False ' abilita anche le superfici come selezione e per snap a punto + Private m_bZeroDimForSel As Boolean = False ' abilita punti/vettori/frame per la selezione + Private m_bCurveForSel As Boolean = False ' abilita le curve per la selezione + Private m_bSurfForSel As Boolean = False ' abilita le superfici per la selezione + Private m_bVolumeForSel As Boolean = False ' abilita i solidi per la selezione + Private m_bExtraForSel As Boolean = False ' abilita testi/quote per la selezione + Private m_bZeroDimForSnap As Boolean = False ' abilita punti/vettori/frame per lo snap a punto + Private m_bCurveForSnap As Boolean = False ' abilita le curve per lo snap a punto + Private m_bSurfForSnap As Boolean = False ' abilita le superfici per lo snap a punto + Private m_bVolumeForSnap As Boolean = False ' abilita i solidi per lo snap a punto + Private m_bExtraForSnap As Boolean = False ' abilita testi/quote per lo snap a punto + Private m_bExcludeSurfInSelMenu As Boolean = False ' abilita visualizzazione voce Escudi superfici in menù contestuale Private m_PrevPoint As Point Private m_ptPrev As Point3d Private m_ptGrid As Point3d @@ -77,7 +87,17 @@ Public Class Scene m_nOldStatus = ST.SEL m_nSnapType = SP.PT_GRID m_bAlsoSelDir = False - m_bAlsoSurfForSelSnap = True + m_bZeroDimForSel = True + m_bCurveForSel = True + m_bSurfForSel = True + m_bVolumeForSel = True + m_bExtraForSel = True + m_bZeroDimForSnap = True + m_bCurveForSnap = True + m_bSurfForSnap = True + m_bVolumeForSnap = True + m_bExtraForSnap = True + m_bExcludeSurfInSelMenu = True m_PrevPoint = Point.Empty m_bGridCursorPos = False m_nDriver = 3 @@ -205,25 +225,28 @@ Public Class Scene End Sub '---- Events ---------- - Public Event OnMouseSelectedAll(ByVal sender As Object) - Public Event OnMouseDeselectedAll(ByVal sender As Object) - Public Event OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) - Public Event OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) - Public Event OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer) - Public Event OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean) - Public Event OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) - Public Event OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) - Public Event OnMouseDownScene(ByVal sender As Object, e As System.Windows.Forms.MouseEventArgs) - Public Event OnMouseUpScene(ByVal sender As Object, e As System.Windows.Forms.MouseEventArgs) - Public Event OnMouseMoveScene(ByVal sender As Object, e As System.Windows.Forms.MouseEventArgs) - Public Event OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) - Public Event OnShowDistance(ByVal sender As Object, ByVal sDistance As String) - Public Event OnCloseGetDist(ByVal sender As Object) - Public Event OnMouseDone(ByVal sender As Object) - Public Event OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) - Public Event OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) - Public Event OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) - Public Event OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bForced As Boolean) + Public Event OnMouseSetObjFilterForSelect(sender As Object, bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) + Public Event OnMouseSelectedAll(sender As Object) + Public Event OnMouseDeselectedAll(sender As Object) + Public Event OnMouseSelectedObj(sender As Object, nId As Integer, bLast As Boolean) + Public Event OnMouseSelectedPart(sender As Object, nId As Integer) + Public Event OnMouseSelectedLayer(sender As Object, nId As Integer) + Public Event OnMouseSelectedPath(sender As Object, nId As Integer, bHaltOnFork As Boolean) + Public Event OnMouseAnalyzed(sender As Object, nId As Integer) + Public Event OnMousePointFromSelection(sender As Object, nId As Integer, PtP As Point3d, nAux As Integer) + Public Event OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + Public Event OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + Public Event OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + Public Event OnCursorPos(sender As Object, sCursorPos As String) + Public Event OnShowDistance(sender As Object, sDistance As String) + Public Event OnCloseGetDist(sender As Object) + Public Event OnMouseDone(sender As Object) + Public Event OnMouseSelectedPoint(sender As Object, PtP As Point3d, nSep As SEP, nId As Integer) + Public Event OnMouseSelectedDir(sender As Object, VtDir As Vector3d) + Public Event OnMouseMoveSelPoint(sender As Object, PtP As Point3d) + Public Event OnChangedSnapPointType(sender As Object, nSpType As SP, bForced As Boolean) + Public Event OnMouseSelectingObj(sender As Object, nId As Integer, ByRef bOk As Boolean) '---- Mouse ----------- Private m_bSetFocusOnMove As Boolean = True @@ -250,7 +273,7 @@ Public Class Scene ' se stato SELPATH, SELPATHAUTO oppure SEL e premuto CONTROL ElseIf m_nStatus = ST.SELPATH Or m_nStatus = ST.SELPATHAUTO Or (m_nStatus = ST.SEL And (ModifierKeys And Keys.Control) = Keys.Control) Then - EgtSetObjFilterForSelect(False, True, False, False, False) ' abilito solo le curve + EgtSetObjFilterForSelWin(False, m_bCurveForSel, False, False, False) ' abilito solo le curve Dim nId As Integer = ChooseOneSelectedObj(e.Location) If nId <> GDB_ID.NULL Then RaiseEvent OnMouseSelectedPath(Me, nId, (m_nStatus <> ST.SELPATHAUTO)) @@ -263,7 +286,7 @@ Public Class Scene End If ' se stato SEL, SELPART, SELLAYER ElseIf m_nStatus = ST.SEL Or m_nStatus = ST.SELPART Or m_nStatus = ST.SELLAYER Then - EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSelSnap, True, True) + EgtSetObjFilterForSelWin(m_bZeroDimForSel, m_bCurveForSel, m_bSurfForSel, m_bVolumeForSel, m_bExtraForSel) Dim nId As Integer = ChooseOneSelectedObj(e.Location) If nId <> GDB_ID.NULL Then ' evento per entità selezionate @@ -300,14 +323,14 @@ Public Class Scene m_PrevPoint = e.Location ' se stato ANALYZE ElseIf m_nStatus = ST.ANALYZE Then - EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSelSnap, True, True) + EgtSetObjFilterForSelWin(m_bZeroDimForSel, m_bCurveForSel, m_bSurfForSel, m_bVolumeForSel, m_bExtraForSel) Dim nId As Integer = ChooseOneSelectedObj(e.Location) If nId <> GDB_ID.NULL Then RaiseEvent OnMouseAnalyzed(Me, nId) End If ' se stato GETDIST (primo punto per misura di distanza) ElseIf m_nStatus = ST.GETDIST Then - EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSelSnap, True, True) + EgtSetObjFilterForSelWin(m_bZeroDimForSnap, m_bCurveForSnap, m_bSurfForSnap, m_bVolumeForSnap, m_bExtraForSnap) If EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, m_ptPrev) Then ' salvo il punto di riferimento Dim ptWin As Point3d @@ -317,7 +340,7 @@ Public Class Scene End If ' se stato GETDIST2(secondo punto per misura di distanza) ElseIf m_nStatus = ST.GETDIST2 Then - EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSelSnap, True, True) + EgtSetObjFilterForSelWin(m_bZeroDimForSnap, m_bCurveForSnap, m_bSurfForSnap, m_bVolumeForSnap, m_bExtraForSnap) Dim ptSel As Point3d If EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, ptSel) Then ' disegno la linea (coordinate geo globali) @@ -343,7 +366,7 @@ Public Class Scene End If ' se stato selezione punto ElseIf m_nStatus = ST.SELPOINT Then - EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSelSnap, True, True) + EgtSetObjFilterForSelWin(m_bZeroDimForSnap, m_bCurveForSnap, m_bSurfForSnap, m_bVolumeForSnap, m_bExtraForSnap) If Not m_bDragOn Then ' rendo selezionabile gruppo di drag EgtUnselectableRemove(m_nDragGroup) @@ -449,7 +472,7 @@ Public Class Scene e.Button = Windows.Forms.MouseButtons.Middle Then If m_nStatus = ST.WINSEL Then EgtResetWinRect(True) - EgtSetObjFilterForSelect(True, True, m_bAlsoSurfForSelSnap, True, True) + EgtSetObjFilterForSelWin(m_bZeroDimForSel, m_bCurveForSel, m_bSurfForSel, m_bVolumeForSel, m_bExtraForSel) ' determino entità selezionate Dim Center As Point Center.X = 0.5 * (e.Location.X + m_PrevPoint.X) @@ -458,13 +481,17 @@ Public Class Scene Dim nW As Integer = Abs(e.Location.Y - m_PrevPoint.Y) Dim nSel As Integer EgtSelect(Center, nH, nW, nSel) - ' notifico per ogni entità selezionata + ' filtro custom e notifico per ogni entità selezionata Dim nLastId = GDB_ID.NULL Dim nId = EgtGetFirstObjInSelWin() While nId <> GDB_ID.NULL Dim nNextId = EgtGetNextObjInSelWin() - RaiseEvent OnMouseSelectedObj(Me, nId, (nNextId = GDB_ID.NULL)) - nLastId = nId + Dim bOk As Boolean = True + RaiseEvent OnMouseSelectingObj(Me, nId, bOk) + If bOk Then + RaiseEvent OnMouseSelectedObj(Me, nId, (nNextId = GDB_ID.NULL)) + nLastId = nId + End If nId = nNextId End While ' evento per posizione punto di selezione @@ -626,22 +653,33 @@ Public Class Scene End Sub Private Function ChooseOneSelectedObj(ByVal WinXY As Point) As Integer - Dim nId As Integer = GDB_ID.NULL + ' Fotografo entità nel mirino Dim nSel As Integer EgtSelect(WinXY, DIM_SEL, DIM_SEL, nSel) - If nSel = 1 Then - nId = EgtGetFirstObjInSelWin() - ElseIf nSel > 1 Then - Dim MselDlg As New SelectMulti + ' Filtro le entità nel mirino e le inserisco in lista + Dim vId As New List(Of Integer) + Dim nId = EgtGetFirstObjInSelWin() + While nId <> GDB_ID.NULL + Dim bOk As Boolean = True + RaiseEvent OnMouseSelectingObj(Me, nId, bOk) + If bOk Then vId.Add(nId) + nId = EgtGetNextObjInSelWin() + End While + ' Se una sola la ritorno + If vId.Count() = 1 Then + Return vId(0) + ' altrimenti faccio scegliere all'utente + ElseIf vId.Count() > 1 Then + Dim MselDlg As New SelectMulti(vId) MselDlg.StartPosition = System.Windows.Forms.FormStartPosition.Manual Dim ptScreen As Point = PointToScreen(WinXY) ptScreen.Offset(10, 0) MselDlg.Location = ptScreen If MselDlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then - nId = MselDlg.GetId() + Return MselDlg.GetId() End If End If - Return nId + Return GDB_ID.NULL End Function Private Sub ShowCursorPos(ByVal WinXY As Point) @@ -831,11 +869,11 @@ Public Class Scene i.Text = EgtMsg(1013) ' Select Path Auto i.Visible = True Case "sepSelPnt1" - i.Visible = True - Case "cmdExcludeSurf" + i.Visible = m_bExcludeSurfInSelMenu + Case "cmdExcludeSurfFromSel" i.Text = EgtMsg(1123) ' Exclude Surfaces - i.Visible = True - DirectCast(i, ToolStripMenuItem).Checked = Not m_bAlsoSurfForSelSnap + i.Visible = m_bExcludeSurfInSelMenu + DirectCast(i, ToolStripMenuItem).Checked = Not m_bSurfForSel Case Else i.Visible = False End Select @@ -905,10 +943,10 @@ Public Class Scene End If Case "sepSelPnt1" i.Visible = True - Case "cmdExcludeSurf" + Case "cmdExcludeSurfFromSnap" i.Text = EgtMsg(1123) ' Exclude Surfaces i.Visible = True - DirectCast(i, ToolStripMenuItem).Checked = Not m_bAlsoSurfForSelSnap + DirectCast(i, ToolStripMenuItem).Checked = Not m_bSurfForSnap Case "sepSelPnt2" i.Visible = (m_nStatus <> ST.GETDIST And m_nStatus <> ST.GETDIST2) Case "cmdStopDrag" @@ -992,8 +1030,12 @@ Public Class Scene m_nSnapType = SP.PT_MINDIST RaiseEvent OnChangedSnapPointType(Me, m_nSnapType, True) ' esclusione superfici da punto snap - ElseIf e.ClickedItem.Name = "cmdExcludeSurf" Then - m_bAlsoSurfForSelSnap = Not m_bAlsoSurfForSelSnap + ElseIf e.ClickedItem.Name = "cmdExcludeSurfFromSel" Then + m_bSurfForSel = Not m_bSurfForSel + RaiseEvent OnMouseSetObjFilterForSelect(Me, m_bZeroDimForSel, m_bCurveForSel, m_bSurfForSel, m_bVolumeForSel, m_bExtraForSel) + ' esclusione superfici da punto snap + ElseIf e.ClickedItem.Name = "cmdExcludeSurfFromSnap" Then + m_bSurfForSnap = Not m_bSurfForSnap ' Sospensione drag ElseIf e.ClickedItem.Name = "cmdStopDrag" Then m_bDragOn = False @@ -1149,7 +1191,7 @@ Public Class Scene EgtResetGeoTria(False) EgtResetWinRect(False) ' reset entità non selezionabili - EgtSetObjFilterForSelect(True, True, True, True, True) + EgtSetObjFilterForSelWin(True, True, True, True, True) EgtUnselectableClearAll() m_bAlsoDragIntersForSnap = False ' imposto lo stato @@ -1191,8 +1233,49 @@ Public Class Scene m_bAlsoDragIntersForSnap = bVal End Sub - Public Sub SetSurfForSelPoint(ByVal bVal As Boolean) - m_bAlsoSurfForSelSnap = bVal + Public Sub SetObjFilterForSel(bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) + m_bZeroDimForSel = bZeroDim + m_bCurveForSel = bCurve + m_bSurfForSel = bSurf + m_bVolumeForSel = bVolume + m_bExtraForSel = bExtra + EgtSetObjFilterForSelect(m_bZeroDimForSel, m_bCurveForSel, m_bSurfForSel, m_bVolumeForSel, m_bExtraForSel) + End Sub + + Public Sub GetObjFilterForSel(ByRef bZeroDim As Boolean, ByRef bCurve As Boolean, + ByRef bSurf As Boolean, ByRef bVolume As Boolean, ByRef bExtra As Boolean) + bZeroDim = m_bZeroDimForSel + bCurve = m_bCurveForSel + bSurf = m_bSurfForSel + bVolume = m_bVolumeForSel + bExtra = m_bExtraForSel + End Sub + + Public Sub SetObjFilterForSnap(bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) + m_bZeroDimForSnap = bZeroDim + m_bCurveForSnap = bCurve + m_bSurfForSnap = bSurf + m_bVolumeForSnap = bVolume + m_bExtraForSnap = bExtra + End Sub + + Public Sub GetObjFilterForSnap(ByRef bZeroDim As Boolean, ByRef bCurve As Boolean, + ByRef bSurf As Boolean, ByRef bVolume As Boolean, ByRef bExtra As Boolean) + bZeroDim = m_bZeroDimForSnap + bCurve = m_bCurveForSnap + bSurf = m_bSurfForSnap + bVolume = m_bVolumeForSnap + bExtra = m_bExtraForSnap + End Sub + + Public Sub SetShowExcludeSurfInSelMenu(bVal As Boolean) + m_bExcludeSurfInSelMenu = bVal + End Sub + + Public Sub GetShowExcludeSurfInSelMenu(ByRef bVal As Boolean) + bVal = m_bExcludeSurfInSelMenu End Sub '---- Drag Group ------ diff --git a/SelectMulti.vb b/SelectMulti.vb index b1fffbc..0e7a3f7 100644 --- a/SelectMulti.vb +++ b/SelectMulti.vb @@ -4,23 +4,35 @@ Imports TestEIn.EgtInterface Public Class SelectMulti + Dim m_vId As List(Of Integer) Dim m_nCurrEnt As Integer + Public Sub New(vId As List(Of Integer)) + ' This call is required by the designer. + InitializeComponent() + ' Assegno la lista di Id + m_vId = vId + End Sub + Private Sub SelectMulti_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load ListBox1.BeginUpdate() - 'Inserisco le entità nel mirino - Dim nId = EgtGetFirstObjInSelWin() - While nId <> GDB_ID.NULL - Dim sTitle As String = String.Empty - EgtGetTitle(nId, sTitle) - If EgtIsSelectedObj(nId) Then - sTitle += "*" - End If - sTitle += " (" & nId & ")" - Dim smItem As New SelMulItem(sTitle, nId) - ListBox1.Items.Add(smItem) - nId = EgtGetNextObjInSelWin() - End While + ' Inserisco le entità della lista + If Not IsNothing(m_vId) Then + For Each nId As Integer In m_vId + Dim bSel As Boolean = EgtIsSelectedObj(nId) + Dim sTitle As String = String.Empty + EgtGetTitle(nId, sTitle) + Dim sText As String = String.Empty + Dim sName As String = String.Empty + If EgtGetName(nId, sName) Then + sText = sName & If(bSel, "* (", " (") & sTitle & " " + nId.ToString & ")" + Else + sText = sTitle & If(bSel, "* ", " ") & nId.ToString + End If + Dim smItem As New SelMulItem(sText, nId) + ListBox1.Items.Add(smItem) + Next + End If 'Inserisco None per non selezionare alcunchè Dim smNone As New SelMulItem("None", GDB_ID.NULL) ListBox1.Items.Add(smNone)