OmagOFFICE 2.1g4 :

- correzioni a gestione angolo da colore (non verificava se curva poteva avere angolo di fianco).
This commit is contained in:
Dario Sassi
2019-07-17 16:19:39 +00:00
parent f08e04f2b8
commit dfeef80783
2 changed files with 71 additions and 81 deletions
+69 -79
View File
@@ -354,45 +354,30 @@ Public Class SideEntityControlVM
EgtSetColor(TextLayer, New Color3d(0, 0, 0))
End If
Dim LastLine As Integer = EgtGetLastInGroup(LoopId)
Dim PrevLine As Integer = EgtGetLastInGroup(LoopId)
Dim CurrLine As Integer = EgtGetFirstInGroup(LoopId)
Dim NextLine As Integer = EgtGetNext(CurrLine)
' Creo indice per numerare le entità in ImportPage
Dim nEntityIndex As Integer = 1
' Ciclo che verifica se possibile inclinare la linea corrente fino alla penultima
While NextLine <> GDB_ID.NULL
While CurrLine <> GDB_ID.NULL
Dim NextLine As Integer = EgtGetNext(CurrLine)
If NextLine = GDB_ID.NULL Then NextLine = EgtGetFirstInGroup( LoopId)
If m_Mode = ModeOpt.SIDEANGLE Then
If VerifyIsSideAnglePossible(LastLine, CurrLine, NextLine) Then
If VerifyIsSideAnglePossible(PrevLine, CurrLine, NextLine) Then
' Aggiungo il lato alla lista di quelli inclinabili e ne azzero l'inclinazione
AddSideAngle(CurrLine, TextLayer, dBBoxRad, nEntityIndex)
nEntityIndex += 1
End If
Else
If VerifyIsSideDripPossible(LastLine, CurrLine, NextLine) Then
If VerifyIsSideDripPossible(PrevLine, CurrLine, NextLine) Then
' Aggiungo il lato alla lista di quelli su cui è possibile mettere il gocciolatoio
AddDripSide(CurrLine, TextLayer, dBBoxRad, nEntityIndex)
nEntityIndex += 1
End If
End If
LastLine = CurrLine
CurrLine = NextLine
NextLine = EgtGetNext(CurrLine)
PrevLine = CurrLine
CurrLine = EgtGetNext(CurrLine)
End While
' Verifico ultima linea
NextLine = EgtGetFirstInGroup(LoopId)
If m_Mode = ModeOpt.SIDEANGLE Then
If VerifyIsSideAnglePossible(LastLine, CurrLine, NextLine) Then
' Aggiungo il lato alla lista di quelli inclinabili e ne azzero l'inclinazione
AddSideAngle(CurrLine, TextLayer, dBBoxRad, nEntityIndex)
nEntityIndex += 1
End If
Else
If VerifyIsSideDripPossible(LastLine, CurrLine, NextLine) Then
' Aggiungo il lato alla lista di quelli su cui è possibile mettere il gocciolatoio
AddDripSide(CurrLine, TextLayer, dBBoxRad, nEntityIndex)
nEntityIndex += 1
End If
End If
' Se non ci sono lati su cui operare, messaggio utente
If LoopId <> GDB_ID.NULL Then
@@ -443,61 +428,6 @@ Public Class SideEntityControlVM
'End If
End Sub
' Funzione che verifica se la linea corrente è inclinabile in base al tipo della precedente e successiva
Private Function VerifyIsSideAnglePossible(LastLine As Integer, CurrLine As Integer, NextLine As Integer) As Boolean
' Verifico se CurrLine è una linea
If EgtGetType(CurrLine) <> GDB_TY.CRV_LINE Then
Return False
End If
' Verifico se curva precedente mi permette di inclinare
Dim bLastOk As Boolean = False
If EgtGetType(LastLine) = GDB_TY.CRV_LINE Then
bLastOk = True
ElseIf EgtGetType(LastLine) = GDB_TY.CRV_ARC Then
' Ricavo direzione finale linea precedente
Dim vtLastEnd As Vector3d
EgtEndVector(LastLine, vtLastEnd)
' Ricavo direzione iniziale linea corrente
Dim vtCurrStart As Vector3d
EgtStartVector(CurrLine, vtCurrStart)
' Confronto direzioni per vedere se sono tangenti
' calcolo differenza dei vettori
Dim vtDiff As Vector3d = vtLastEnd - vtCurrStart
' verifico che sia nulla o quasi
bLastOk = Not vtDiff.IsSmall()
Else
EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc")
End If
' Verifico se curva successiva mi permette di inclinare
Dim bNextOk As Boolean = False
If EgtGetType(NextLine) = GDB_TY.CRV_LINE Then
bNextOk = True
ElseIf EgtGetType(NextLine) = GDB_TY.CRV_ARC Then
' Ricavo direzione finale linea corrente
Dim vtCurrEnd As Vector3d
EgtEndVector(CurrLine, vtCurrEnd)
' Ricavo direzione iniziale linea successiva
Dim vtNextStart As Vector3d
EgtStartVector(NextLine, vtNextStart)
' Confronto direzioni per vedere se sono tangenti
' calcolo differenza dei vettori
Dim vtDiff As Vector3d = vtCurrEnd - vtNextStart
' verifico che sia nulla o quasi
bNextOk = Not vtDiff.IsSmall()
Else
EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc")
End If
' Se entrambe me lo permettono restituisco vero
If bLastOk And bNextOk Then
Return True
End If
Return False
End Function
' Funzione che verifica se alla linea corrente è associabile un canalino
Private Function VerifyIsSideDripPossible(LastLine As Integer, CurrLine As Integer, NextLine As Integer) As Boolean
' Verifico se CurrLine è una linea
@@ -860,6 +790,62 @@ Public Class SideEntityControlVM
End While
End Sub
' Funzione che verifica se la linea corrente è inclinabile in base al tipo della precedente e successiva
Shared Function VerifyIsSideAnglePossible(LastLine As Integer, CurrLine As Integer, NextLine As Integer) As Boolean
' Verifico se CurrLine è una linea
If EgtGetType(CurrLine) <> GDB_TY.CRV_LINE Then
Return False
End If
' Delta angolare limite per tangenza
Const DELTA_ANG_TG As Double = 5.0
' Verifico se curva precedente mi permette di inclinare
Dim bLastOk As Boolean = False
If EgtGetType(LastLine) = GDB_TY.CRV_LINE Then
bLastOk = True
ElseIf EgtGetType(LastLine) = GDB_TY.CRV_ARC Then
' Ricavo direzione finale linea precedente
Dim vtLastEnd As Vector3d
EgtEndVector(LastLine, vtLastEnd)
' Ricavo direzione iniziale linea corrente
Dim vtCurrStart As Vector3d
EgtStartVector(CurrLine, vtCurrStart)
' Confronto direzioni per vedere se sono tangenti
Dim dAngDeg As Double = GetAngle( vtLastEnd, vtCurrStart)
' verifico se l'angolo è significativo
bLastOk = ( dAngDeg > DELTA_ANG_TG)
Else
EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc")
End If
' Verifico se curva successiva mi permette di inclinare
Dim bNextOk As Boolean = False
If EgtGetType(NextLine) = GDB_TY.CRV_LINE Then
bNextOk = True
ElseIf EgtGetType(NextLine) = GDB_TY.CRV_ARC Then
' Ricavo direzione finale linea corrente
Dim vtCurrEnd As Vector3d
EgtEndVector(CurrLine, vtCurrEnd)
' Ricavo direzione iniziale linea successiva
Dim vtNextStart As Vector3d
EgtStartVector(NextLine, vtNextStart)
' Confronto direzioni per vedere se sono tangenti
Dim dAngDeg As Double = GetAngle( vtCurrEnd, vtNextStart)
' verifico se l'angolo è significativo
bNextOk = ( dAngDeg > DELTA_ANG_TG)
Else
EgtOutLog("Error in Compo Outloop: found an entity that is not a line or a arc")
End If
' Se entrambe me lo permettono restituisco vero
If bLastOk And bNextOk Then
Return True
End If
Return False
End Function
Shared Function AdjustAsTrfParSides( PartId As Integer) As Boolean
' Recupero il loop esterno
Dim LoopId As Integer = EgtGetFirstNameInGroup(PartId, NAME_OUTLOOP)
@@ -956,9 +942,12 @@ Public Class SideEntityControlVM
Dim LoopId As Integer = EgtGetFirstNameInGroup(PartId, NAME_OUTLOOP)
While LoopId <> GDB_ID.NULL
' Ciclo sulle curve
Dim PrevId As Integer = EgtGetLastInGroup( LoopId)
Dim EntId As Integer = EgtGetFirstInGroup( LoopId)
While EntId <> GDB_ID.NULL
If EgtGetType(EntId) = GDB_TY.CRV_LINE Then
Dim NextId As Integer = EgtGetNext( EntId)
If NextId = GDB_ID.NULL Then NextId = EgtGetFirstInGroup( LoopId)
If VerifyIsSideAnglePossible( PrevId, EntId, NextId) Then
Dim colEnt As Color3d
If EgtGetColor( EntId, colEnt) Then
Dim dAng As Double
@@ -970,6 +959,7 @@ Public Class SideEntityControlVM
End If
End If
End If
PrevId = EntId
EntId = EgtGetNext( EntId)
End While
If bOutLoop then