@@ -1021,37 +1021,12 @@ public bool CalcVisibility()
10211021 return true ;
10221022 }
10231023
1024- private List < ModellingNetworkArea > GetAreasInDirection ( List < ModellingNetworkArea > networkAreas , Direction direction )
1025- {
1026- List < ModellingNetworkArea > directionNetworkAreas = [ ] ;
1027-
1028- foreach ( ModellingNetworkArea area in networkAreas )
1029- {
1030- if ( direction == Direction . Source )
1031- {
1032- if ( ActConn . SourceAreas . Any ( w => w . Content . Id == area . Id ) || SrcAreasToAdd . Contains ( area ) )
1033- {
1034- directionNetworkAreas . Add ( area ) ;
1035- }
1036- }
1037- else if ( direction == Direction . Destination )
1038- {
1039- if ( ActConn . DestinationAreas . Any ( w => w . Content . Id == area . Id ) || DstAreasToAdd . Contains ( area ) )
1040- {
1041- directionNetworkAreas . Add ( area ) ;
1042- }
1043- }
1044- }
1045-
1046- return directionNetworkAreas ;
1047- }
1048-
1049- public bool IsAreaForbiddenInDirection ( List < ModellingNetworkArea > networkAreas , Direction direction )
1024+ public bool IsAreaForbiddenInDirection ( Direction direction )
10501025 {
10511026 return direction switch
10521027 {
1053- Direction . Source => ActConn . DestinationAreas . Count > 0 || GetAreasInDirection ( networkAreas , Direction . Destination ) . Count > 0 ,
1054- Direction . Destination => ActConn . SourceAreas . Count > 0 || GetAreasInDirection ( networkAreas , Direction . Source ) . Count > 0 ,
1028+ Direction . Source => ActConn . DestinationAreas . Count > 0 || DstAreasToAdd . Count > 0 ,
1029+ Direction . Destination => ActConn . SourceAreas . Count > 0 || SrcAreasToAdd . Count > 0 ,
10551030 _ => false ,
10561031 } ;
10571032 }
@@ -1079,7 +1054,7 @@ public bool NetworkAreaUseAllowed(List<ModellingNetworkArea> networkAreas, Direc
10791054 reason . Title = userConfig . GetText ( "edit_connection" ) ;
10801055 }
10811056
1082- if ( IsAreaForbiddenInDirection ( networkAreas , direction ) )
1057+ if ( IsAreaForbiddenInDirection ( direction ) )
10831058 {
10841059 reason . Text = userConfig . GetText ( "direction_contain_nwarea" ) ;
10851060 return false ;
0 commit comments