From 18426ab481d04db777dcdc12aaeac161095c0058 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 10 Oct 2014 06:44:14 +0000 Subject: [PATCH] TestEIn 1.5j1 : - aggiornamenti per selezione con mouse. --- EgtInterface.vb | 42 ++++++++++++- My Project/AssemblyInfo.vb | 4 +- Resources/Select.cur | Bin 0 -> 326 bytes Scene.vb | 32 ++++++++-- SelectMulti.Designer.vb | 69 +++++++++++++++++++++ SelectMulti.resx | 120 +++++++++++++++++++++++++++++++++++++ SelectMulti.vb | 55 +++++++++++++++++ TestEIn.vbproj | 10 ++++ 8 files changed, 325 insertions(+), 7 deletions(-) create mode 100644 Resources/Select.cur create mode 100644 SelectMulti.Designer.vb create mode 100644 SelectMulti.resx create mode 100644 SelectMulti.vb diff --git a/EgtInterface.vb b/EgtInterface.vb index a738015..05fc2ff 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -271,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 @@ -284,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 @@ -311,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 @@ -456,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/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index a2dbd9e..616a511 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -43,5 +43,5 @@ Imports System.Runtime.InteropServices ' utilizzando l'asterisco (*) come descritto di seguito: ' - - + + diff --git a/Resources/Select.cur b/Resources/Select.cur new file mode 100644 index 0000000000000000000000000000000000000000..eec3c5ae91a90efbfd57a03bc85f593620270e2d GIT binary patch literal 326 zcmZ{eK?;B{3@KQ4FFVpTe TZPA)FDmwE||CuT6RGqp2Wf6Q7 literal 0 HcmV?d00001 diff --git a/Scene.vb b/Scene.vb index fca971a..5950e79 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 -------- @@ -137,7 +137,31 @@ 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 + Dim nSel As Integer + EgtSelect(m_nGseContext, e.Location, 13, 13, nSel) + If nSel = 1 Then + Dim nId = EgtGetFirstSelectedObj(m_nGseContext) + If EgtIsSelectedObj(m_nGseContext, nId) Then + EgtDeselectObj(m_nGseContext, nId) + Else + EgtSelectObj(m_nGseContext, nId) + End If + EgtDraw(m_nGseContext) + ElseIf nSel > 1 Then + Dim MselDlg As New SelectMulti + MselDlg.SetContext(m_nGseContext) + If MselDlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then + Dim nId = MselDlg.GetId() + If EgtIsSelectedObj(m_nGseContext, nId) Then + EgtDeselectObj(m_nGseContext, nId) + Else + EgtSelectObj(m_nGseContext, nId) + End If + EgtDraw(m_nGseContext) + 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") @@ -163,7 +187,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) @@ -189,7 +213,7 @@ 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) 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..3ef53e2 --- /dev/null +++ b/SelectMulti.vb @@ -0,0 +1,55 @@ +Imports System.Windows.Forms +Imports TestEIn.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 diff --git a/TestEIn.vbproj b/TestEIn.vbproj index adf3d2e..3e469b9 100644 --- a/TestEIn.vbproj +++ b/TestEIn.vbproj @@ -153,6 +153,12 @@ Form + + SelectMulti.vb + + + Form + Form @@ -197,6 +203,9 @@ My.Resources Designer + + SelectMulti.vb + @@ -241,6 +250,7 @@ +