TestEIn 1.5j3 :

- unificati Scene, EgtInterface e GenInterface con EgtUILib
- modifiche a gestione mouse in Scene
- aggiunte funzioni in EgtInterface.
This commit is contained in:
Dario Sassi
2014-10-15 08:03:07 +00:00
parent 5270e46c5b
commit 3eb7aedd9e
12 changed files with 413 additions and 64 deletions
+152 -9
View File
@@ -4,14 +4,53 @@ Public Class EgtInterface
Structure Point3d
Dim x, y, z As Double
Sub New(ByVal dX As Double, ByVal dY As Double, ByVal dZ As Double)
x = dX
y = dY
z = dZ
End Sub
Shared Function Media(ByRef ptP1 As Point3d, ByRef ptP2 As Point3d) As Point3d
Dim ptMedia As New Point3d(0.5 * (ptP1.x + ptP2.x), 0.5 * (ptP1.y + ptP2.y), 0.5 * (ptP1.z + ptP2.z))
Return ptMedia
End Function
End Structure
Structure Vector3d
Dim x, y, z As Double
Sub New(ByVal dX As Double, ByVal dY As Double, ByVal dZ As Double)
x = dX
y = dY
z = dZ
End Sub
Shared Function FromPointDiff(ByRef ptP1 As Point3d, ByRef ptP2 As Point3d) As Vector3d
Dim vtV As New Vector3d
vtV.x = ptP1.x - ptP2.x
vtV.y = ptP1.y - ptP2.y
vtV.z = ptP1.z - ptP2.z
Return vtV
End Function
Shared Function X_AX() As Vector3d
Dim vtZ As New Vector3d(1, 0, 0)
Return vtZ
End Function
Shared Function Y_AX() As Vector3d
Dim vtZ As New Vector3d(0, 1, 0)
Return vtZ
End Function
Shared Function Z_AX() As Vector3d
Dim vtZ As New Vector3d(0, 0, 1)
Return vtZ
End Function
End Structure
Structure Color
Dim R, G, B, A As Integer
Sub New(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer, Optional ByVal nAlpha As Integer = 100)
R = nRed
G = nGreen
B = nBlue
A = nAlpha
End Sub
End Structure
#If PLATFORM = "x64" Then
@@ -28,8 +67,8 @@ Const EgtIntDll As String = "EgtInterfaceR32.dll"
#End If
#End If
'API
'General
'---------- General ------------------------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInit(ByVal nDebug As Integer, ByVal sLogFile As String) As Boolean
End Function
@@ -51,7 +90,7 @@ Public Shared Function EgtFreeMemory(ByVal sB As IntPtr) As Boolean
End Function
'GeomDB
'---------- GeomDb -------------------------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInitGeomDB() As Integer
End Function
@@ -97,7 +136,20 @@ Public Shared Function EgtExportStl(ByVal nCtx As Integer, ByVal nId As Integer,
End Function
'GeomDB Objects
'---------- GeomDb Objects Create ----------------------------------------------
'---------- GeomDb Objects Modify ----------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtFlipText(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtMirrorText(ByVal nCtx As Integer, ByVal nId As Integer, ByVal bOnL As Boolean) As Boolean
End Function
'---------- GeomDb Objects -----------------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtExistsObj(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Boolean
End Function
@@ -122,6 +174,16 @@ End Function
Public Shared Function EgtGetPrev(ByVal nCtx As Integer, ByVal nId As Integer) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetBBox(ByVal nCtx As Integer, ByVal nId As Integer, ByVal nFlag As Integer,
ByRef PtMin As Point3d, ByRef PtMax As Point3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetBBoxGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByVal nFlag As Integer,
ByRef PtMin As Point3d, ByRef PtMax As Point3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetType(ByVal nCtx As Integer, ByVal nId As Integer) As Integer
End Function
@@ -160,7 +222,7 @@ Public Shared Function EgtGeoObjDump(ByVal nCtx As Integer, ByVal nId As Integer
End Function
'GeomDB Obj attributes
'---------- GeomDb Obj Attributes ----------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetLevel(ByVal nCtx As Integer, ByVal nId As Integer, ByVal nLevel As Integer) As Boolean
End Function
@@ -271,7 +333,8 @@ 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
'---------- GeomDb Obj Selection -----------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtIsSelectedObj(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean
End Function
@@ -284,7 +347,83 @@ End Function
Public Shared Function EgtDeselectObj(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean
End Function
'Scene
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtDeselectAll(ByVal nCtx As Integer) As Boolean
End Function
'---------- GeomDb Obj Transform -----------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtMove(ByVal nCtx As Integer, ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtMoveGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtMoveGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtRotate(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtRotateGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtRotateGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtScale(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOrig As Point3d,
ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtScaleGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOrig As Point3d,
ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtScaleGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOrig As Point3d,
ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtMirror(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtMirrorGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtMirrorGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtShear(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d,
ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtShearGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d,
ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtShearGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d,
ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean
End Function
'---------- Scene --------------------------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInitScene(ByVal nCtx As Integer, ByVal hWnd As IntPtr, ByVal nDriver As Integer,
ByVal b2Buff As Boolean, ByVal nColorBits As Integer, ByVal nDepthBits As Integer) As Boolean
@@ -426,7 +565,7 @@ Public Shared Function EgtProjectPoint(ByVal nCtx As Integer, ByRef ptP As Point
End Function
'Tsc Executor
'---------- Tsc Executor -------------------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInitTscExec(ByVal nCtx As Integer) As Boolean
End Function
@@ -440,7 +579,7 @@ Public Shared Function EgtTscExecLine(ByVal nCtx As Integer, ByVal sLine As Stri
End Function
'LUA Executor
'---------- LUA Executor -------------------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtLuaSetContext(ByVal nCtx As Integer) As Boolean
End Function
@@ -528,5 +667,9 @@ 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
'Costanti : falg per BBOX
Public Const BBF_NONE As Integer = 0
Public Const BBF_ONLY_VISIBLE As Integer = 1
Public Const BBF_IGNORE_TEXT As Integer = 2
End Class
+51 -1
View File
@@ -27,6 +27,10 @@ Partial Class Form1
Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
Me.Scene1 = New TestEIn.Scene()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.btnMirror = New System.Windows.Forms.Button()
Me.btnRotM90 = New System.Windows.Forms.Button()
Me.btnRotP90 = New System.Windows.Forms.Button()
Me.chkAnalyze = New System.Windows.Forms.CheckBox()
Me.chkGetDist = New System.Windows.Forms.CheckBox()
Me.tboxCmd = New System.Windows.Forms.TextBox()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
@@ -93,6 +97,7 @@ Partial Class Form1
'Scene1
'
Me.Scene1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Scene1.Cursor = System.Windows.Forms.Cursors.Default
Me.Scene1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Scene1.Location = New System.Drawing.Point(209, 3)
Me.Scene1.Name = "Scene1"
@@ -101,6 +106,10 @@ Partial Class Form1
'
'Panel1
'
Me.Panel1.Controls.Add(Me.btnMirror)
Me.Panel1.Controls.Add(Me.btnRotM90)
Me.Panel1.Controls.Add(Me.btnRotP90)
Me.Panel1.Controls.Add(Me.chkAnalyze)
Me.Panel1.Controls.Add(Me.chkGetDist)
Me.Panel1.Controls.Add(Me.tboxCmd)
Me.Panel1.Controls.Add(Me.GroupBox1)
@@ -126,6 +135,43 @@ Partial Class Form1
Me.Panel1.Size = New System.Drawing.Size(195, 413)
Me.Panel1.TabIndex = 5
'
'btnMirror
'
Me.btnMirror.Location = New System.Drawing.Point(66, 250)
Me.btnMirror.Name = "btnMirror"
Me.btnMirror.Size = New System.Drawing.Size(59, 23)
Me.btnMirror.TabIndex = 28
Me.btnMirror.Text = "Mirror"
Me.btnMirror.UseVisualStyleBackColor = False
'
'btnRotM90
'
Me.btnRotM90.Location = New System.Drawing.Point(131, 250)
Me.btnRotM90.Name = "btnRotM90"
Me.btnRotM90.Size = New System.Drawing.Size(59, 23)
Me.btnRotM90.TabIndex = 27
Me.btnRotM90.Text = "Rot-90"
Me.btnRotM90.UseVisualStyleBackColor = False
'
'btnRotP90
'
Me.btnRotP90.Location = New System.Drawing.Point(3, 250)
Me.btnRotP90.Name = "btnRotP90"
Me.btnRotP90.Size = New System.Drawing.Size(59, 23)
Me.btnRotP90.TabIndex = 26
Me.btnRotP90.Text = "Rot+90"
Me.btnRotP90.UseVisualStyleBackColor = False
'
'chkAnalyze
'
Me.chkAnalyze.Appearance = System.Windows.Forms.Appearance.Button
Me.chkAnalyze.Location = New System.Drawing.Point(68, 97)
Me.chkAnalyze.Name = "chkAnalyze"
Me.chkAnalyze.Size = New System.Drawing.Size(60, 23)
Me.chkAnalyze.TabIndex = 25
Me.chkAnalyze.Text = "Analyze"
Me.chkAnalyze.UseVisualStyleBackColor = True
'
'chkGetDist
'
Me.chkGetDist.Appearance = System.Windows.Forms.Appearance.Button
@@ -372,7 +418,7 @@ Partial Class Form1
Me.ToolStripStatusOutput.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
Me.ToolStripStatusOutput.MergeIndex = 1
Me.ToolStripStatusOutput.Name = "ToolStripStatusOutput"
Me.ToolStripStatusOutput.Size = New System.Drawing.Size(44, 17)
Me.ToolStripStatusOutput.Size = New System.Drawing.Size(75, 17)
Me.ToolStripStatusOutput.Spring = True
Me.ToolStripStatusOutput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
@@ -546,5 +592,9 @@ End Sub
Friend WithEvents ToolStripStatusOutput As System.Windows.Forms.ToolStripStatusLabel
Friend WithEvents ToolStripStatusOnL As System.Windows.Forms.ToolStripStatusLabel
Friend WithEvents ToolStripStatusOnR As System.Windows.Forms.ToolStripStatusLabel
Friend WithEvents chkAnalyze As System.Windows.Forms.CheckBox
Friend WithEvents btnRotM90 As System.Windows.Forms.Button
Friend WithEvents btnRotP90 As System.Windows.Forms.Button
Friend WithEvents btnMirror As System.Windows.Forms.Button
End Class
+1 -1
View File
@@ -128,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADS
DAAAAk1TRnQBSQFMAgEBDAEAASgBAQEoAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
DAAAAk1TRnQBSQFMAgEBDAEAAUgBAQFIAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
+99 -6
View File
@@ -87,6 +87,19 @@ Public Class Form1
ToolStripStatusCursorPos.Text = sCursorPos
End Sub
Private Sub OnMouseSelected(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMouseSelected
If EgtIsSelectedObj(Scene1.GetCtx(), nId) Then
EgtDeselectObj(Scene1.GetCtx(), nId)
Else
EgtSelectObj(Scene1.GetCtx(), nId)
End If
EgtDraw(Scene1.GetCtx())
End Sub
Private Sub OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) Handles Scene1.OnMouseAnalyzed
SelectIdInObjTree(nId)
End Sub
Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles Scene1.OnShowDistance
ToolStripStatusOutput.Text = sDistance
End Sub
@@ -173,23 +186,34 @@ Public Class Form1
End Sub
Private Sub rbtWireFrame_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtWireFrame.CheckedChanged
EgtSetShowMode(Scene1.GetCtx, SM_WIREFRAME)
EgtSetShowMode(Scene1.GetCtx(), SM_WIREFRAME)
End Sub
Private Sub rbtHiddenLine_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtHiddenLine.CheckedChanged
EgtSetShowMode(Scene1.GetCtx, SM_HIDDENLINE)
EgtSetShowMode(Scene1.GetCtx(), SM_HIDDENLINE)
End Sub
Private Sub rbtShading_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtShading.CheckedChanged
EgtSetShowMode(Scene1.GetCtx, SM_SHADING)
EgtSetShowMode(Scene1.GetCtx(), SM_SHADING)
End Sub
Private Sub chkCurveDir_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkCurveDir.CheckedChanged
EgtSetShowCurveDirection(Scene1.GetCtx, chkCurveDir.Checked)
EgtSetShowCurveDirection(Scene1.GetCtx(), chkCurveDir.Checked)
End Sub
Private Sub chkAnalyze_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkAnalyze.CheckedChanged
If chkAnalyze.Checked Then
chkGetDist.Checked = False
Scene1.SetStatusAnalyze()
Else
Scene1.ResetStatusAnalyze()
SelectIdInObjTree(GDB_ID_NULL)
End If
End Sub
Private Sub chkGetDist_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkGetDist.CheckedChanged
If chkGetDist.Checked Then
chkAnalyze.Checked = False
Scene1.SetStatusGetDistance()
ToolStripStatusOutput.Text = " "
Else
@@ -234,7 +258,73 @@ Public Class Form1
EgtSetView(Scene1.GetCtx, CT_ISO_SW)
End Sub
'-------------------------------- Command Box ----------------------------------------------------
Private Sub btnRotP90_Click(sender As System.Object, e As System.EventArgs) Handles btnRotP90.Click
Rotate(Scene1.GetCtx(), 90)
' aggiorno visualizzazione
EgtZoom(Scene1.GetCtx(), ZM_ALL)
UpdateObjInObjTree(m_nOldIdTree)
End Sub
Private Sub btnRotM90_Click(sender As System.Object, e As System.EventArgs) Handles btnRotM90.Click
Rotate(Scene1.GetCtx(), -90)
' aggiorno visualizzazione
EgtZoom(Scene1.GetCtx(), ZM_ALL)
UpdateObjInObjTree(m_nOldIdTree)
End Sub
Private Sub Rotate(ByVal nCtx As Integer, ByVal dAngRotDeg As Double)
' indice del primo gruppo sotto la radice
Dim nId As Integer = EgtGetFirstInGroup(nCtx, GDB_ID_ROOT)
' recupero il box del gruppo in globale
Dim PtMinPre As New Point3d
Dim PtMaxPre As New Point3d
EgtGetBBoxGlob(nCtx, nId, BBF_IGNORE_TEXT, PtMinPre, PtMaxPre)
' ruoto attorno al punto minimo
EgtRotateGlob(nCtx, nId, PtMinPre, Vector3d.Z_AX, dAngRotDeg)
' calcolo nuovo box in globale
Dim PtMinPost As New Point3d
Dim PtMaxPost As New Point3d
EgtGetBBoxGlob(nCtx, nId, BBF_IGNORE_TEXT, PtMinPost, PtMaxPost)
' eseguo traslazione per riavere lo stesso punto minimo
Dim VtMove As Vector3d = Vector3d.FromPointDiff(PtMinPre, PtMinPost)
EgtMoveGlob(nCtx, nId, VtMove)
End Sub
Private Sub btnMirror_Click(sender As System.Object, e As System.EventArgs) Handles btnMirror.Click
' indice del primo gruppo sotto la radice
Dim nId As Integer = EgtGetFirstInGroup(Scene1.GetCtx(), GDB_ID_ROOT)
' recupero il box del gruppo in globale
Dim PtMin As New Point3d
Dim PtMax As New Point3d
EgtGetBBoxGlob(Scene1.GetCtx(), nId, BBF_IGNORE_TEXT, PtMin, PtMax)
Dim PtCen As Point3d = Point3d.Media(PtMin, PtMax)
' mirror rispetto a Y centrato nel box
EgtMirrorGlob(Scene1.GetCtx(), nId, PtCen, Vector3d.X_AX)
' sistemo gli eventuali testi
UnMirrorTexts(Scene1.GetCtx(), nId)
' aggiorno visualizzazione
EgtZoom(Scene1.GetCtx(), ZM_ALL)
UpdateObjInObjTree(m_nOldIdTree)
End Sub
Private Sub UnMirrorTexts(ByVal nCtx As Integer, ByVal nGroupId As Integer)
Dim nId As Integer = EgtGetFirstInGroup(nCtx, nGroupId)
While nId <> GDB_ID_NULL
'recupero il tipo di oggetto
Dim nType As Integer = EgtGetType(nCtx, nId)
'se gruppo
If nType = TY_GROUP Then
UnMirrorTexts(nCtx, nId)
' se testo
ElseIf nType = TY_EXT_TEXT Then
EgtMirrorText(nCtx, nId, True)
End If
' passo al successivo
nId = EgtGetNext(nCtx, nId)
End While
End Sub
'-------------------------------- Command Box ----------------------------------------------------
Private Sub tboxCmd_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles tboxCmd.KeyDown
If (e.KeyCode = Keys.Enter) Then
Dim nLine As Integer = tboxCmd.GetLineFromCharIndex(tboxCmd.GetFirstCharIndexOfCurrentLine)
@@ -354,6 +444,10 @@ Public Class Form1
If Not Int32.TryParse(e.Node.Name, nId) Then
Return
End If
UpdateObjInObjTree(nId)
End Sub
Private Sub UpdateObjInObjTree(ByVal nId As Integer)
' ripristino eventuale vecchio oggetto selezionato
RevertOldIdInObjTree()
' recupero il tipo del nuovo oggetto
@@ -406,7 +500,6 @@ Public Class Form1
End Function
Private Function SelectIdInObjTree(ByVal nId As Integer) As Boolean
Dim tNode() As TreeNode = TreeView1.Nodes.Find(nId.ToString, True)
If tNode.Length > 0 Then
TreeView1.SelectedNode = tNode(0)
+2 -2
View File
@@ -43,5 +43,5 @@ Imports System.Runtime.InteropServices
' utilizzando l'asterisco (*) come descritto di seguito:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.5.10.1")>
<Assembly: AssemblyFileVersion("1.5.10.1")>
<Assembly: AssemblyVersion("1.5.10.3")>
<Assembly: AssemblyFileVersion("1.5.10.3")>
Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

+19 -11
View File
@@ -23,21 +23,22 @@ Partial Class Scene
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.MenuScene = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.cmdEndPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdMidPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdCenterPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdNearPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.ContextMenuStrip1.SuspendLayout()
Me.cmdDeselectAll = New System.Windows.Forms.ToolStripMenuItem()
Me.MenuScene.SuspendLayout()
Me.SuspendLayout()
'
'ContextMenuStrip1
'MenuScene
'
Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdNearPoint})
Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
Me.ContextMenuStrip1.ShowCheckMargin = True
Me.ContextMenuStrip1.ShowImageMargin = False
Me.ContextMenuStrip1.Size = New System.Drawing.Size(153, 114)
Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdDeselectAll, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdNearPoint})
Me.MenuScene.Name = "ContextMenuStrip1"
Me.MenuScene.ShowCheckMargin = True
Me.MenuScene.ShowImageMargin = False
Me.MenuScene.Size = New System.Drawing.Size(153, 136)
'
'cmdEndPoint
'
@@ -63,20 +64,27 @@ Partial Class Scene
Me.cmdNearPoint.Size = New System.Drawing.Size(152, 22)
Me.cmdNearPoint.Text = "Near Point"
'
'cmdDeselectAll
'
Me.cmdDeselectAll.Name = "cmdDeselectAll"
Me.cmdDeselectAll.Size = New System.Drawing.Size(152, 22)
Me.cmdDeselectAll.Text = "Deselect All"
'
'Scene
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ContextMenuStrip = Me.ContextMenuStrip1
Me.ContextMenuStrip = Me.MenuScene
Me.Name = "Scene"
Me.ContextMenuStrip1.ResumeLayout(False)
Me.MenuScene.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
Friend WithEvents ContextMenuStrip1 As System.Windows.Forms.ContextMenuStrip
Friend WithEvents MenuScene As System.Windows.Forms.ContextMenuStrip
Friend WithEvents cmdEndPoint As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdMidPoint As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdCenterPoint As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdNearPoint As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdDeselectAll As System.Windows.Forms.ToolStripMenuItem
End Class
+1 -1
View File
@@ -117,7 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="MenuScene.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
+83 -29
View File
@@ -17,8 +17,9 @@ Public Class Scene
PAN = 1
ROT = 2
ZOOMWIN = 3
GETDIST = 4
GETDIST2 = 5
ANALYZE = 4
GETDIST = 5
GETDIST2 = 6
End Enum
Private m_nSnapType As Integer
Private m_PrevPoint As Point
@@ -64,7 +65,7 @@ Public Class Scene
m_nBackBotRed = 40
m_nBackBotGreen = 44
m_nBackBotBlue = 48
Cursor = New Cursor(Me.GetType(), "Select.cur")
Cursor = Cursors.Default
End Sub
'---- Initials --------
@@ -127,8 +128,12 @@ Public Class Scene
End Sub
'---- Events ----------
Public Event OnMouseSelected(ByVal sender As Object, ByVal nId As Integer)
Public Event OnMouseAnalyzed(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 OnShowDistance(ByVal sender As Object, ByVal sDistance As String)
Public Event OnCloseGetDist(ByVal sender As Object)
Public Event OnNewProject(ByVal sender As Object)
Public Event OnOpeningProject(ByVal sender As Object)
Public Event OnOpenProject(ByVal sender As Object, ByVal sFile As String)
@@ -149,7 +154,12 @@ Public Class Scene
Protected Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Left Then
If m_nStatus = ST.NULL Then
If m_nStatus = ST.NULL Or m_nStatus = ST.ANALYZE Then
If m_nStatus = ST.NULL Then
Cursor = New Cursor(Me.GetType(), "Select.cur")
Else
Cursor = New Cursor(Me.GetType(), "Analyze.cur")
End If
Dim nId As Integer = GDB_ID_NULL
Dim nSel As Integer
EgtSelect(m_nGseContext, e.Location, DIM_SEL, DIM_SEL, nSel)
@@ -167,14 +177,13 @@ Public Class Scene
End If
End If
If nId <> GDB_ID_NULL Then
If EgtIsSelectedObj(m_nGseContext, nId) Then
EgtDeselectObj(m_nGseContext, nId)
If m_nStatus = ST.NULL Then
RaiseEvent OnMouseSelected(Me, nId)
Else
EgtSelectObj(m_nGseContext, nId)
RaiseEvent OnMouseAnalyzed(Me, nId)
End If
EgtDraw(m_nGseContext)
End If
ElseIf m_nStatus = ST.GETDIST Then
ElseIf m_nStatus = ST.GETDIST Then
If EgtGetSelectedSnapPoint(m_nGseContext, m_nSnapType, e.Location.X, e.Location.Y, DIM_SEL, DIM_SEL, m_ptPrev) Then
' salvo il punto di riferimento
Dim ptWin As Point3d
@@ -203,23 +212,27 @@ Public Class Scene
sOut.Append(dZ.ToString("F4", CultureInfo.InvariantCulture))
' lancio l'evento per visualizzare la distanza
RaiseEvent OnShowDistance(Me, sOut.ToString())
'MessageBox.Show(sOut.ToString(), "Distance")
' annullo eventuale linea di misura e lo stato
'EgtResetGeoLine(m_nGseContext)
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
End If
ElseIf e.Button = Windows.Forms.MouseButtons.Middle Then
If (Control.ModifierKeys And Keys.Shift) = Keys.Shift Then
m_nOldStatus = IIf(m_nStatus = ST.GETDIST2, ST.GETDIST2, ST.NULL)
If m_nStatus = ST.ANALYZE Or m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Then
m_nOldStatus = m_nStatus
End If
m_nStatus = ST.ZOOMWIN
Cursor = New Cursor(Me.GetType(), "ZoomWin.cur")
ElseIf (Control.ModifierKeys And Keys.Control) = Keys.Control Then
m_nOldStatus = IIf(m_nStatus = ST.GETDIST2, ST.GETDIST2, ST.NULL)
If m_nStatus = ST.ANALYZE Or m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Then
m_nOldStatus = m_nStatus
End If
m_nStatus = ST.ROT
Cursor = New Cursor(Me.GetType(), "Rotate.cur")
Else
m_nOldStatus = IIf(m_nStatus = ST.GETDIST2, ST.GETDIST2, ST.NULL)
If m_nStatus = ST.ANALYZE Or m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Then
m_nOldStatus = m_nStatus
End If
m_nStatus = ST.PAN
Cursor = New Cursor(Me.GetType(), "Pan.cur")
End If
@@ -228,6 +241,7 @@ Public Class Scene
MyBase.OnMouseDown(e)
End If
Focus()
RaiseEvent OnMouseDownScene(Me)
End Sub
Protected Overrides Sub OnMouseUp(e As System.Windows.Forms.MouseEventArgs)
@@ -238,8 +252,11 @@ Public Class Scene
EgtZoomWin(m_nGseContext, m_PrevPoint, e.Location, True)
End If
' eventuale ripristino vecchio stato
If m_nOldStatus = ST.GETDIST2 Then
m_nStatus = ST.GETDIST2
If m_nOldStatus = ST.ANALYZE Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "Analyze.cur")
ElseIf m_nOldStatus = ST.GETDIST Or m_nOldStatus = ST.GETDIST2 Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "GetDist.cur")
' reset dello stato se non NULL
ElseIf m_nStatus <> ST.NULL Then
@@ -248,21 +265,36 @@ Public Class Scene
End If
' rilascio tasto destro
ElseIf e.Button = Windows.Forms.MouseButtons.Right Then
If m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Then
ContextMenuStrip1.Visible = True
For Each i As ToolStripMenuItem In ContextMenuStrip1.Items
If m_nStatus = ST.NULL Then
MenuScene.Visible = True
For Each i As ToolStripMenuItem In MenuScene.Items
If i.Name = "cmdDeselectAll" Then
i.Visible = True
Else
i.Visible = False
End If
Next
ElseIf m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Then
MenuScene.Visible = True
For Each i As ToolStripMenuItem In MenuScene.Items
If i.Name = "cmdEndPoint" Then
i.Visible = True
i.Checked = (m_nSnapType = SP_END)
ElseIf i.Name = "cmdMidPoint" Then
i.Visible = True
i.Checked = (m_nSnapType = SP_MID)
ElseIf i.Name = "cmdCenterPoint" Then
i.Visible = True
i.Checked = (m_nSnapType = SP_CENTER)
ElseIf i.Name = "cmdNearPoint" Then
i.Visible = True
i.Checked = (m_nSnapType = SP_NEAR)
Else
i.Visible = False
End If
Next
Else
ContextMenuStrip1.Visible = False
MenuScene.Visible = False
End If
' tutti gli altri casi
Else
@@ -298,6 +330,8 @@ Public Class Scene
Dim ptP As Point3d
EgtUnProjectPoint(m_nGseContext, e.Location, ptP)
EgtSetGeoLine(m_nGseContext, m_ptPrev, ptP)
ElseIf m_nStatus = ST.ANALYZE Then
Cursor = New Cursor(Me.GetType(), "Analyze.cur")
Else
MyBase.OnMouseMove(e)
End If
@@ -307,8 +341,8 @@ Public Class Scene
End Sub
Protected Overrides Sub OnMouseWheel(e As System.Windows.Forms.MouseEventArgs)
' devo essere nello stato NULL o GETDIST
If m_nStatus <> ST.NULL And m_nStatus <> ST.GETDIST And m_nStatus <> ST.GETDIST2 Then
' devo essere nello stato NULL o ANALYZE o GETDIST
If m_nStatus <> ST.NULL And m_nStatus <> ST.ANALYZE And m_nStatus <> ST.GETDIST And m_nStatus <> ST.GETDIST2 Then
Return
End If
' trascuro rotazioni molto piccole
@@ -357,9 +391,12 @@ Public Class Scene
RaiseEvent OnCursorPos(Me, sCursorPos.ToString)
End Sub
Private Sub ContextMenuStrip1_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ContextMenuStrip1.ItemClicked
Private Sub MenuScene_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles MenuScene.ItemClicked
If e.ClickedItem.Name = "cmdEndPoint" Then
If e.ClickedItem.Name = "cmdDeselectAll" Then
EgtDeselectAll(GetCtx())
EgtDraw(GetCtx())
ElseIf e.ClickedItem.Name = "cmdEndPoint" Then
m_nSnapType = SP_END
ElseIf e.ClickedItem.Name = "cmdMidPoint" Then
m_nSnapType = SP_MID
@@ -370,8 +407,7 @@ Public Class Scene
End If
End Sub
'---- Main Buttons ----
'---- Main Buttons ----
Public Function NewProject() As Boolean
Dim bOk As Boolean = EgtNewFile(m_nGseContext)
EgtZoom(m_nGseContext, ZM_ALL)
@@ -520,6 +556,7 @@ Public Class Scene
OpenFileDialog.Filter = "Lua commands(*.lua)|*.lua" &
"|Test commands(*.tsc)|*.tsc" &
"|All Files (*.*)|*.*"
OpenFileDialog.FilterIndex = 1
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
Return True
End If
@@ -554,17 +591,33 @@ Public Class Scene
Return bOk
End Function
'---- Set -------------
'---- Distance Operations -------------
Public Sub SetStatusGetDistance()
m_nStatus = ST.GETDIST
End Sub
Public Sub ResetStatusGetDistance()
If m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Then
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
EgtResetGeoLine(GetCtx())
RaiseEvent OnCloseGetDist(Me)
End Sub
'---- Analyze Operations -------------
Public Sub SetStatusAnalyze()
m_nStatus = ST.ANALYZE
End Sub
Public Sub ResetStatusAnalyze()
If m_nStatus = ST.ANALYZE Then
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
End Sub
'---- Zoom Buttons ----
'---- Zoom Buttons ----
Public Sub ZoomAll()
EgtZoom(m_nGseContext, ZM_ALL)
End Sub
@@ -614,4 +667,5 @@ Public Class Scene
Public Sub RightView()
EgtSetView(m_nGseContext, CT_RIGHT)
End Sub
End Class
+1
View File
@@ -48,6 +48,7 @@ Partial Class SelectMulti
'
'SelectMulti
'
Me.AcceptButton = Me.OK_Button
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None
Me.ClientSize = New System.Drawing.Size(104, 131)
Me.ControlBox = False
+1 -4
View File
@@ -54,10 +54,7 @@ Public Class SelectMulti
End Sub
Private Sub ListBox1_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
If e.KeyData = Keys.Return Then
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
ElseIf e.KeyData = Keys.Escape Then
If e.KeyData = Keys.Escape Then
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End If
+3
View File
@@ -257,6 +257,9 @@
<EmbeddedResource Include="Resources\GetDist.cur" />
<EmbeddedResource Include="Resources\TestEIn.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Analyze.cur" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\TestEIn\TestEInR32.exe