diff --git a/EgtInterface.vb b/EgtInterface.vb index 55e0d83..05fc2ff 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -6,6 +6,14 @@ Structure Point3d Dim x, y, z As Double End Structure +Structure Vector3d + Dim x, y, z As Double +End Structure + +Structure Color + Dim R, G, B, A As Integer +End Structure + #If PLATFORM = "x64" Then #If DEBUG Then Const EgtIntDll As String = "EgtInterfaceD64.dll" @@ -263,6 +271,18 @@ End Function Public Shared Function EgtRemoveInfo(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sKey As String) As Boolean End Function +'GeomDb Obj selection + +Public Shared Function EgtIsSelectedObj(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +End Function + + +Public Shared Function EgtSelectObj(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +End Function + + +Public Shared Function EgtDeselectObj(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +End Function 'Scene @@ -276,12 +296,27 @@ Public Shared Function EgtSetBackground(ByVal nCtx As Integer, ByVal nTopRed As Optional ByVal bRedraw As Boolean = True) As Boolean End Function + +Public Shared Function EgtResize(ByVal nCtx As Integer, ByVal nW As Integer, ByVal nH As Integer) As Boolean +End Function + Public Shared Function EgtDraw(ByVal nCtx As Integer) As Boolean End Function -Public Shared Function EgtResize(ByVal nCtx As Integer, ByVal nW As Integer, ByVal nH As Integer) As Boolean +Private Shared Function EgtSelect(ByVal nCtx As Integer, ByVal nWinX As Integer, ByVal nWinY As Integer, ByVal nSelW As Integer, ByVal nSelH As Integer, ByRef nSel As Integer) As Boolean +End Function +Public Shared Function EgtSelect(ByVal nCtx As Integer, ByVal Curr As Point, ByVal nSelW As Integer, ByVal nSelH As Integer, ByRef nSel As Integer) As Boolean + Return EgtSelect(nCtx, Curr.X, Curr.Y, nSelW, nSelH, nSel) +End Function + + +Public Shared Function EgtGetFirstSelectedObj(ByVal nGseCtx As Integer) As Integer +End Function + + +Public Shared Function EgtGetNextSelectedObj(ByVal nGseCtx As Integer) As Integer End Function @@ -303,6 +338,14 @@ Public Shared Function EgtZoomOnPoint(ByVal nCtx As Integer, ByVal Curr As Point Return EgtZoomOnPoint(nCtx, Curr.X, Curr.Y, dCoeff, bRedraw) End Function + +Public Shared Function EgtSetGeoLine(ByVal nCtx As Integer, ByVal ptP1 As Point3d, ByVal ptP2 As Point3d, Optional ByVal bRedraw As Boolean = True) As Boolean +End Function + + +Public Shared Function EgtResetGeoLine(ByVal nCtx As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean +End Function + Private Shared Function EgtSetWinRect(ByVal nCtx As Integer, ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean End Function @@ -448,5 +491,10 @@ Public Const CT_ISO_SW As Integer = 7 Public Const CT_ISO_SE As Integer = 8 Public Const CT_ISO_NE As Integer = 9 Public Const CT_ISO_NW As Integer = 10 +'Costanti : TIPO SNAP POINT +Public Const SP_END As Integer = 0 +Public Const SP_MID As Integer = 1 +Public Const SP_CENTER As Integer = 2 +Public Const SP_NEAR As Integer = 3 End Class diff --git a/EgtUILib.vbproj b/EgtUILib.vbproj index 1a36183..3291592 100644 --- a/EgtUILib.vbproj +++ b/EgtUILib.vbproj @@ -287,6 +287,12 @@ UserControl + + SelectMulti.vb + + + Form + tsLookFrom.vb @@ -326,6 +332,9 @@ My.Resources Designer + + SelectMulti.vb + @@ -404,6 +413,9 @@ + + + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\Dll32\EgtUILib.dll diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 84b6cd1..467ed73 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -42,5 +42,5 @@ Imports System.Runtime.InteropServices ' È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build ' utilizzando l'asterisco (*) come descritto di seguito: - - + + diff --git a/Resources/Select.cur b/Resources/Select.cur new file mode 100644 index 0000000..eec3c5a Binary files /dev/null and b/Resources/Select.cur differ diff --git a/Scene.vb b/Scene.vb index 68b05d6..fff9df9 100644 --- a/Scene.vb +++ b/Scene.vb @@ -54,7 +54,7 @@ Public Class Scene m_nBackBotRed = 40 m_nBackBotGreen = 44 m_nBackBotBlue = 48 - Cursor = New Cursor(Me.GetType(), "Pointer.cur") + Cursor = New Cursor(Me.GetType(), "Select.cur") End Sub '---- Initials -------- @@ -117,6 +117,7 @@ Public Class Scene End Sub '---- Events ---------- + Public Event OnMouseSelected(ByVal sender As Object, ByVal nId As Integer) Public Event OnMouseDownScene(ByVal sender As Object) Public Event OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Public Event OnNewProject(ByVal sender As Object) @@ -138,7 +139,32 @@ Public Class Scene End Sub Protected Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs) - If e.Button = Windows.Forms.MouseButtons.Middle Then + If e.Button = Windows.Forms.MouseButtons.Left Then + If m_nStatus = ST.NULL Then + Cursor = New Cursor(Me.GetType(), "Select.cur") + Dim nSel As Integer + EgtSelect(m_nGseContext, e.Location, 13, 13, nSel) + If nSel = 1 Then + Dim nId = EgtGetFirstSelectedObj(m_nGseContext) + If nId <> GDB_ID_NULL Then + RaiseEvent OnMouseSelected(Me, nId) + End If + ElseIf nSel > 1 Then + Dim MselDlg As New SelectMulti + MselDlg.SetContext(m_nGseContext) + MselDlg.StartPosition = System.Windows.Forms.FormStartPosition.Manual + Dim ptScreen As Point = PointToScreen(e.Location) + ptScreen.Offset(10, 0) + MselDlg.Location = ptScreen + If MselDlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then + Dim nId = MselDlg.GetId() + If nId <> GDB_ID_NULL Then + RaiseEvent OnMouseSelected(Me, nId) + End If + End If + End If + End If + ElseIf e.Button = Windows.Forms.MouseButtons.Middle Then If (Control.ModifierKeys And Keys.Shift) = Keys.Shift Then m_nStatus = ST.ZOOMWIN Cursor = New Cursor(Me.GetType(), "ZoomWin.cur") @@ -165,7 +191,7 @@ Public Class Scene End If If m_nStatus <> ST.NULL Then m_nStatus = ST.NULL - Cursor = New Cursor(Me.GetType(), "Pointer.cur") + Cursor = New Cursor(Me.GetType(), "Select.cur") End If Else MyBase.OnMouseUp(e) @@ -191,11 +217,14 @@ Public Class Scene m_PrevPoint = e.Location Else m_nStatus = ST.NULL - Cursor = New Cursor(Me.GetType(), "Pointer.cur") + Cursor = New Cursor(Me.GetType(), "Select.cur") End If Else MyBase.OnMouseMove(e) End If + If m_nStatus = ST.NULL Then + Cursor = New Cursor(Me.GetType(), "Select.cur") + End If End Sub Protected Overrides Sub OnMouseWheel(e As System.Windows.Forms.MouseEventArgs) diff --git a/SelectMulti.Designer.vb b/SelectMulti.Designer.vb new file mode 100644 index 0000000..9b7b9d3 --- /dev/null +++ b/SelectMulti.Designer.vb @@ -0,0 +1,69 @@ + _ +Partial Class SelectMulti + Inherits System.Windows.Forms.Form + + 'Form esegue l'override del metodo Dispose per pulire l'elenco dei componenti. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Richiesto da Progettazione Windows Form + Private components As System.ComponentModel.IContainer + + 'NOTA: la procedura che segue è richiesta da Progettazione Windows Form + 'Può essere modificata in Progettazione Windows Form. + 'Non modificarla nell'editor del codice. + _ + Private Sub InitializeComponent() + Me.ListBox1 = New System.Windows.Forms.ListBox() + Me.OK_Button = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'ListBox1 + ' + Me.ListBox1.Dock = System.Windows.Forms.DockStyle.Top + Me.ListBox1.FormattingEnabled = True + Me.ListBox1.Location = New System.Drawing.Point(0, 0) + Me.ListBox1.Name = "ListBox1" + Me.ListBox1.Size = New System.Drawing.Size(88, 134) + Me.ListBox1.TabIndex = 1 + ' + 'OK_Button + ' + Me.OK_Button.Location = New System.Drawing.Point(9, 141) + Me.OK_Button.Name = "OK_Button" + Me.OK_Button.Size = New System.Drawing.Size(72, 20) + Me.OK_Button.TabIndex = 2 + Me.OK_Button.Text = "Ok" + Me.OK_Button.UseVisualStyleBackColor = True + ' + 'SelectMulti + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(88, 165) + Me.Controls.Add(Me.OK_Button) + Me.Controls.Add(Me.ListBox1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.MaximizeBox = False + Me.MaximumSize = New System.Drawing.Size(94, 194) + Me.MinimizeBox = False + Me.MinimumSize = New System.Drawing.Size(94, 194) + Me.Name = "SelectMulti" + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "MultiSel" + Me.ResumeLayout(False) + +End Sub + Friend WithEvents ListBox1 As System.Windows.Forms.ListBox + Friend WithEvents OK_Button As System.Windows.Forms.Button + +End Class diff --git a/SelectMulti.resx b/SelectMulti.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/SelectMulti.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SelectMulti.vb b/SelectMulti.vb new file mode 100644 index 0000000..100e8b0 --- /dev/null +++ b/SelectMulti.vb @@ -0,0 +1,55 @@ +Imports System.Windows.Forms +Imports EgtUILib.EgtInterface + +Public Class SelectMulti + + Dim m_nGseContext As Integer + Dim m_nCurrEnt As Integer + + Private Sub SelectMulti_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load + ListBox1.BeginUpdate() + Dim nId = EgtGetFirstSelectedObj(m_nGseContext) + While nId <> GDB_ID_NULL + Dim sTitle As String = String.Empty + EgtGetTitle(m_nGseContext, nId, sTitle) + If EgtIsSelectedObj(m_nGseContext, nId) Then + sTitle += "*" + End If + sTitle += " (" & nId & ")" + ListBox1.Items.Add(sTitle) + nId = EgtGetNextSelectedObj(m_nGseContext) + End While + ListBox1.EndUpdate() + m_nCurrEnt = GDB_ID_NULL + ListBox1.SelectedIndex = 0 + End Sub + + Private Sub SelectMulti_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed + EgtResetMark(m_nGseContext, m_nCurrEnt) + EgtDraw(m_nGseContext) + End Sub + + Public Sub SetContext(ByVal nGseContext As Integer) + m_nGseContext = nGseContext + End Sub + + Public Function GetId() As Integer + Return m_nCurrEnt + End Function + + Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click + Me.DialogResult = System.Windows.Forms.DialogResult.OK + Me.Close() + End Sub + + Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged + Dim curItem As String = ListBox1.SelectedItem.ToString() + Dim nIni As Integer = curItem.LastIndexOf("(") + Dim nFin As Integer = curItem.LastIndexOf(")") + Dim sNbr As String = curItem.Substring(nIni + 1, nFin - nIni - 1) + EgtResetMark(m_nGseContext, m_nCurrEnt) + m_nCurrEnt = CInt(sNbr) + EgtSetMark(m_nGseContext, m_nCurrEnt) + EgtDraw(m_nGseContext) + End Sub +End Class