Skip to content

Commit 23fb8ac

Browse files
committed
CUDiagram is ready for prd
1 parent 5d54c10 commit 23fb8ac

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

Code/Classes/08_CUDiagram.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Class CUClassGraphOptions {
6767
}
6868

6969
Class CUDiagram {
70-
[String]$GraphVizDocument
70+
$GraphVizDocument
7171
[Object[]]$Objects
7272
[CUClassGraphOptions]$Options
7373

Code/Functions/Private/Out-CUPSGraph.ps1

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Function Out-CUPSGraph {
4242
)
4343

4444
begin {
45-
Write-Verbose "Out-CUPSGraph -> BEGIN BLOCK..."
45+
4646
$AllGraphs = @()
4747
if(!(Get-Module -Name PSGraph)){
4848
#Module is not loaded
@@ -56,14 +56,16 @@ Function Out-CUPSGraph {
5656
}
5757

5858
process {
59-
Write-Verbose "Out-CUPSGraph -> PROCESS BLOCK..."
59+
6060
[System.Collections.ArrayList]$AllClasses = @()
61+
$inputObjectGrouped = $inputObject | Group Path
6162
#$Graph = Graph -Attributes @{splines='ortho'} -ScriptBlock {
6263
$Graph = Graph -ScriptBlock {
63-
foreach($obj in $inputObject){
64+
foreach($obj in $inputObjectGrouped){
6465
$CurrName = split-Path -leaf $obj.Name
65-
subgraph -Attributes @{label=($CurrName)} -ScriptBlock {
66-
Foreach( $Class in $obj ) {
66+
subgraph -Attributes @{label=($CurrName)} -ScriptBlock {
67+
68+
Foreach( $Class in $obj.group ) {
6769

6870
If($IgnoreCase){
6971
$RecordName = ConvertTo-TitleCase -String $Class.Name
@@ -181,7 +183,7 @@ Function Out-CUPSGraph {
181183
}#End SubGraph
182184

183185
## InHeritance
184-
Foreach ($class in ($Obj | where-Object IsInherited)){
186+
Foreach ($class in ($inputObjectGrouped.group | where-Object IsInherited)){
185187
If($IgnoreCase){
186188
$Parent = ConvertTo-TitleCase -String $Class.ParentClassName
187189
$Child = ConvertTo-TitleCase -String $Class.Name
@@ -190,7 +192,7 @@ Function Out-CUPSGraph {
190192
$Parent = $Class.ParentClassName
191193
$Child = $Class.Name
192194
}
193-
edge -From $Parent -To $Child -Attributes @{arrowhead="empty"}
195+
edge -From $Parent -To $Child -Attributes @{dir="back";arrowhead="empty"}
194196
}
195197

196198
##Composition
@@ -199,7 +201,7 @@ Function Out-CUPSGraph {
199201
Write-Verbose "Out-CUPSGraph -> ShowCoposition"
200202
#foreach class.Property.Type if in list of customClasses, then it is composition
201203
## replace brackets when property type is an array of type
202-
Foreach($ClassProperty in $obj.property){
204+
Foreach($ClassProperty in $obj.group.property){
203205
#if( $AllClasses -contains $ClassProperty.type ){
204206
if( $AllClasses -contains ($ClassProperty.type -replace '\[\]','') ){
205207
write-verbose "Out-CUPSGraph -> Composition relationship found:"
@@ -217,8 +219,7 @@ Function Out-CUPSGraph {
217219
}
218220

219221
end {
220-
Write-Verbose "Out-CUPSGraph -> END BLOCK..."
221-
Write-Verbose "Out-CUPSGraph -> END BLOCK: return graphs..."
222+
222223
Return $AlLGraphs
223224

224225

PSClassUtils/PSClassUtils.psm1

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Generated at 03/12/2019 08:24:26 by Stephane van Gulick
1+
#Generated at 03/13/2019 00:53:08 by Stephane van Gulick
22
#Needed for 07_CUInterfaceAuthor
33

44
using namespace System.Collections.Generic
@@ -489,7 +489,7 @@ Class CUClassGraphOptions {
489489
}
490490

491491
Class CUDiagram {
492-
[String]$GraphVizDocument
492+
$GraphVizDocument
493493
[Object[]]$Objects
494494
[CUClassGraphOptions]$Options
495495

@@ -778,7 +778,7 @@ Function Out-CUPSGraph {
778778
)
779779

780780
begin {
781-
Write-Verbose "Out-CUPSGraph -> BEGIN BLOCK..."
781+
782782
$AllGraphs = @()
783783
if(!(Get-Module -Name PSGraph)){
784784
#Module is not loaded
@@ -792,14 +792,16 @@ Function Out-CUPSGraph {
792792
}
793793

794794
process {
795-
Write-Verbose "Out-CUPSGraph -> PROCESS BLOCK..."
795+
796796
[System.Collections.ArrayList]$AllClasses = @()
797+
$inputObjectGrouped = $inputObject | Group Path
797798
#$Graph = Graph -Attributes @{splines='ortho'} -ScriptBlock {
798799
$Graph = Graph -ScriptBlock {
799-
foreach($obj in $inputObject){
800+
foreach($obj in $inputObjectGrouped){
800801
$CurrName = split-Path -leaf $obj.Name
801-
subgraph -Attributes @{label=($CurrName)} -ScriptBlock {
802-
Foreach( $Class in $obj ) {
802+
subgraph -Attributes @{label=($CurrName)} -ScriptBlock {
803+
804+
Foreach( $Class in $obj.group ) {
803805

804806
If($IgnoreCase){
805807
$RecordName = ConvertTo-TitleCase -String $Class.Name
@@ -917,7 +919,7 @@ Function Out-CUPSGraph {
917919
}#End SubGraph
918920

919921
## InHeritance
920-
Foreach ($class in ($Obj | where-Object IsInherited)){
922+
Foreach ($class in ($inputObjectGrouped.group | where-Object IsInherited)){
921923
If($IgnoreCase){
922924
$Parent = ConvertTo-TitleCase -String $Class.ParentClassName
923925
$Child = ConvertTo-TitleCase -String $Class.Name
@@ -926,7 +928,7 @@ Function Out-CUPSGraph {
926928
$Parent = $Class.ParentClassName
927929
$Child = $Class.Name
928930
}
929-
edge -From $Parent -To $Child -Attributes @{arrowhead="empty"}
931+
edge -From $Parent -To $Child -Attributes @{dir="back";arrowhead="empty"}
930932
}
931933

932934
##Composition
@@ -935,7 +937,7 @@ Function Out-CUPSGraph {
935937
Write-Verbose "Out-CUPSGraph -> ShowCoposition"
936938
#foreach class.Property.Type if in list of customClasses, then it is composition
937939
## replace brackets when property type is an array of type
938-
Foreach($ClassProperty in $obj.property){
940+
Foreach($ClassProperty in $obj.group.property){
939941
#if( $AllClasses -contains $ClassProperty.type ){
940942
if( $AllClasses -contains ($ClassProperty.type -replace '\[\]','') ){
941943
write-verbose "Out-CUPSGraph -> Composition relationship found:"
@@ -953,8 +955,7 @@ Function Out-CUPSGraph {
953955
}
954956

955957
end {
956-
Write-Verbose "Out-CUPSGraph -> END BLOCK..."
957-
Write-Verbose "Out-CUPSGraph -> END BLOCK: return graphs..."
958+
958959
Return $AlLGraphs
959960

960961

0 commit comments

Comments
 (0)