프로젝트

일반

사용자정보

개정판 7e561f5b

ID7e561f5bb4ec624569225f4d0ff691290719b6f6
상위 b73a62df
하위 31433f25, 6bd19e4f, cb364170

gaqhf 이(가) 6년 이상 전에 추가함

dev issue #620: merge primary line

차이점 보기:

DTI_PID/SPPIDConverter/Drawing.vb
316 316
    Private _CURRENTPOINTMODEINDEX As String
317 317

  
318 318
    Private _LINENUMBER As LineNumber
319

  
319
    Private _ENABLE As Boolean = True
320 320

  
321 321
    Public Property NAME As String
322 322
        Get
......
443 443
            _LINENUMBER = value
444 444
        End Set
445 445
    End Property
446

  
447
    Public Property ENABLE As Boolean
448
        Get
449
            Return _ENABLE
450
        End Get
451
        Set(value As Boolean)
452
            _ENABLE = value
453
        End Set
454
    End Property
446 455
End Class
447 456

  
448 457
Public Class Line
......
454 463
    Private _CONNECTORS As List(Of Connector)
455 464

  
456 465
    Private _LINENUMBER As LineNumber
466
    Private _ENABLE As Boolean = True
467

  
468
    Private _LMCONNECTOR_MODELID As String
469

  
457 470

  
471
    Private _START_X As Double
472
    Private _START_Y As Double
473
    Private _END_X As Double
474
    Private _END_Y As Double
475

  
476
    ''DrawPrimaryLines
458 477
    Public Property STARTPOINT As String
459 478
        Get
460 479
            Return _STARTPOINT
461 480
        End Get
462 481
        Set(value As String)
463 482
            _STARTPOINT = value
483
            Main.ConvertPointBystring(_STARTPOINT, _START_X, _START_Y)
484
            Main.ConvertPointByImage(_START_X, _START_Y, Main._IMG_X, Main._IMG_Y)
464 485
        End Set
465 486
    End Property
466 487

  
......
470 491
        End Get
471 492
        Set(value As String)
472 493
            _ENDPOINT = value
494
            Main.ConvertPointBystring(_ENDPOINT, _END_X, _END_Y)
495
            Main.ConvertPointByImage(_END_X, _END_Y, Main._IMG_X, Main._IMG_Y)
473 496
        End Set
474 497
    End Property
475 498

  
......
517 540
            _LINENUMBER = value
518 541
        End Set
519 542
    End Property
543

  
544
    Public Property START_X As Double
545
        Get
546
            Return _START_X
547
        End Get
548
        Set(value As Double)
549
            _START_X = value
550
        End Set
551
    End Property
552

  
553
    Public Property START_Y As Double
554
        Get
555
            Return _START_Y
556
        End Get
557
        Set(value As Double)
558
            _START_Y = value
559
        End Set
560
    End Property
561

  
562
    Public Property END_X As Double
563
        Get
564
            Return _END_X
565
        End Get
566
        Set(value As Double)
567
            _END_X = value
568
        End Set
569
    End Property
570

  
571
    Public Property END_Y As Double
572
        Get
573
            Return _END_Y
574
        End Get
575
        Set(value As Double)
576
            _END_Y = value
577
        End Set
578
    End Property
579

  
580
    Public Property ENABLE As Boolean
581
        Get
582
            Return _ENABLE
583
        End Get
584
        Set(value As Boolean)
585
            _ENABLE = value
586
        End Set
587
    End Property
588

  
589
    Public Property LMCONNECTOR_MODELID As String
590
        Get
591
            Return _LMCONNECTOR_MODELID
592
        End Get
593
        Set(value As String)
594
            _LMCONNECTOR_MODELID = value
595
        End Set
596
    End Property
520 597
End Class
521 598

  
522 599
Public Class LineNumber
DTI_PID/SPPIDConverter/Main.vb
22 22
    Dim _DWG_Y = 0.617 '0.585 '0.8 '
23 23
    'Dim _DWG_X = 0.842 '0.695 '1 '
24 24
    'Dim _DWG_Y = 0.614 '0.585 '0.8 '
25
    Dim _IMG_X = 0
26
    Dim _IMG_Y = 0
25
    Public _IMG_X = 0
26
    Public _IMG_Y = 0
27 27
    Dim _Unit As String
28 28
    'Drawing 전역변수
29 29
    Dim _objPIDADrawing As Object
......
958 958
        Return oLineno_list
959 959
    End Function
960 960

  
961
    Private Sub ConvertPointByImage(ByRef dX As Double, ByRef dY As Double, ByVal dDwgX As Double, ByVal dDwgY As Double)
961
    Public Sub ConvertPointByImage(ByRef dX As Double, ByRef dY As Double, ByVal dDwgX As Double, ByVal dDwgY As Double)
962 962

  
963 963
        Dim calcx As Double = 0
964 964
        Dim calcy As Double = 0
......
1165 1165
        Next
1166 1166
        Return Nothing
1167 1167
    End Function
1168
    Private Function ConvertPointBystring(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean
1168
    Public Function ConvertPointBystring(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean
1169 1169
        Try
1170 1170
            Dim opointstr As String() = Split(sPoint, ",")
1171 1171
            If (opointstr.Length > 1) Then
......
2859 2859
        End Try
2860 2860
    End Sub
2861 2861

  
2862
    Private Sub GetPrimaryLineInNode(ByVal list As List(Of Line), ByVal node As TreeNode)
2863

  
2864
        If node.Tag IsNot Nothing Then
2865
            If TypeOf node.Tag Is Line Then
2866
                Dim line As Line = node.Tag
2867
                If line.TYPE = "Primary" And node.Checked Then
2868
                    list.Add(line)
2869
                End If
2870
            End If
2871
        End If
2872

  
2873
        For Each child As TreeNode In node.Nodes()
2874
            GetPrimaryLineInNode(list, child)
2875
        Next
2876
    End Sub
2877

  
2878
    Private Function FindBranchLine(ByVal lines As List(Of Line)) As List(Of Line)
2879
        Dim branchLines As List(Of Line) = New List(Of Line)
2880

  
2881
        For Each line As Line In lines
2882
            For Each conn As Connector In line.CONNECTORS
2883
                If String.IsNullOrEmpty(conn.CONNECTEDITEM) = False Then
2884
                    Dim connLine = FindLineByUID(lines, conn.CONNECTEDITEM)
2885

  
2886
                    If connLine IsNot Nothing Then
2887
                        If connLine.CONNECTORS(0).CONNECTEDITEM <> line.UID And connLine.CONNECTORS(1).CONNECTEDITEM <> line.UID Then
2888
                            branchLines.Add(line)
2889
                        End If
2890
                    End If
2891

  
2892
                End If
2893
            Next
2894
        Next
2895

  
2896
        Return branchLines
2897
    End Function
2898

  
2899
    Private Function FindLineByUID(ByVal lines As List(Of Line), ByVal uid As String) As Line
2900
        For Each line As Line In lines
2901
            If line.UID = uid Then
2902
                Return line
2903
            End If
2904
        Next
2905

  
2906
        Return Nothing
2907
    End Function
2908

  
2909

  
2910
    Private Function FindSymbolByUID(ByVal symbols As List(Of Symbol), ByVal uid As String) As Symbol
2911
        For Each symbol As Symbol In symbols
2912
            If symbol.UID = uid Then
2913
                Return symbol
2914
            End If
2915
        Next
2916

  
2917
        Return Nothing
2918
    End Function
2919

  
2920
    Private Function IsHorizontal(ByVal line As Line)
2921
        If line.END_X - line.START_X = 0 Then
2922
            Return False
2923
        Else
2924
            Dim angle = Math.Atan(Math.Abs(line.END_Y - line.START_Y) / Math.Abs(line.END_X - line.START_X)) * 180 / Math.PI
2925
            If angle < 10 Then
2926
                Return True
2927
            Else
2928
                Return False
2929
            End If
2930
        End If
2931
    End Function
2932

  
2933
    Private Sub FindConnectPrimaryLine(ByVal drawing As Drawing, ByVal primaryLines As List(Of Line), ByVal branchLines As List(Of Line), ByVal shape As Object, ByRef groupLine As List(Of Line))
2934

  
2935
        If TypeOf (shape) Is Line Then
2936
            Dim _line As Line = shape
2937

  
2938
            For Each conn As Connector In _line.CONNECTORS
2939
                Dim symbol As Symbol = FindSymbolByUID(drawing.SYMBOLS, conn.CONNECTEDITEM)
2940
                Dim line As Line = FindLineByUID(primaryLines, conn.CONNECTEDITEM)
2941

  
2942
                If line IsNot Nothing Then
2943
                    If line.ENABLE And line.TYPE = "Primary" And branchLines.Contains(line) = False Then
2944
                        line.ENABLE = False
2945
                        groupLine.Add(line)
2946
                        FindConnectPrimaryLine(drawing, primaryLines, branchLines, line, groupLine)
2947
                    End If
2948

  
2949
                ElseIf symbol IsNot Nothing Then
2950
                    If symbol.ENABLE Then
2951
                        symbol.ENABLE = False
2952
                        FindConnectPrimaryLine(drawing, primaryLines, branchLines, symbol, groupLine)
2953
                    End If
2954
                End If
2955
            Next
2956

  
2957
        ElseIf TypeOf (shape) Is Symbol Then
2958
            Dim _symbol As Symbol = shape
2959

  
2960
            For Each conn As Connector In _symbol.CONNECTORS
2961
                Dim symbol As Symbol = FindSymbolByUID(drawing.SYMBOLS, conn.CONNECTEDITEM)
2962
                Dim line As Line = FindLineByUID(primaryLines, conn.CONNECTEDITEM)
2963

  
2964
                If line IsNot Nothing Then
2965
                    If line.ENABLE And line.TYPE = "Primary" And branchLines.Contains(line) = False Then
2966
                        line.ENABLE = False
2967
                        groupLine.Add(line)
2968
                        FindConnectPrimaryLine(drawing, primaryLines, branchLines, line, groupLine)
2969
                        Exit For
2970
                    End If
2971
                ElseIf symbol IsNot Nothing Then
2972
                    If symbol.ENABLE Then
2973
                        symbol.ENABLE = False
2974
                        FindConnectPrimaryLine(drawing, primaryLines, branchLines, symbol, groupLine)
2975
                    End If
2976
                End If
2977
            Next
2978

  
2979
        End If
2980

  
2981
    End Sub
2982

  
2983
    Private Function GetPrimaryGroup(ByVal drawing As Drawing, ByVal primaryLines As List(Of Line), ByVal branchLines As List(Of Line)) As List(Of List(Of Line))
2984
        Dim result As List(Of List(Of Line)) = New List(Of List(Of Line))
2985

  
2986
        For Each line As Line In primaryLines
2987
            'If line.ENABLE And line.TYPE = "Primary" And IsHorizontal(line) Then
2988
            If line.ENABLE And line.TYPE = "Primary" Then
2989
                If branchLines.Contains(line) = False Then
2990
                    Dim forwardGroupLine As List(Of Line) = New List(Of Line)
2991
                    Dim reverseGroupLine As List(Of Line) = New List(Of Line)
2992
                    line.ENABLE = False
2993

  
2994
                    Dim _symbol As Symbol = FindSymbolByUID(drawing.SYMBOLS, line.CONNECTORS(0).CONNECTEDITEM)
2995
                    Dim _line As Line = FindLineByUID(primaryLines, line.CONNECTORS(0).CONNECTEDITEM)
2996
                    If _line IsNot Nothing Then
2997
                        If branchLines.Contains(_line) = False Then
2998
                            _line.ENABLE = False
2999
                            forwardGroupLine.Add(_line)
3000
                            FindConnectPrimaryLine(drawing, primaryLines, branchLines, _line, forwardGroupLine)
3001
                        End If
3002
                    ElseIf _symbol IsNot Nothing Then
3003
                        _symbol.ENABLE = False
3004
                        FindConnectPrimaryLine(drawing, primaryLines, branchLines, _symbol, forwardGroupLine)
3005
                    End If
3006

  
3007
                    _symbol = FindSymbolByUID(drawing.SYMBOLS, line.CONNECTORS(1).CONNECTEDITEM)
3008
                    _line = FindLineByUID(primaryLines, line.CONNECTORS(1).CONNECTEDITEM)
3009
                    If _line IsNot Nothing Then
3010
                        If branchLines.Contains(_line) = False Then
3011
                            _line.ENABLE = False
3012
                            reverseGroupLine.Add(_line)
3013
                            FindConnectPrimaryLine(drawing, primaryLines, branchLines, _line, reverseGroupLine)
3014
                        End If
3015
                    ElseIf _symbol IsNot Nothing Then
3016
                        _symbol.ENABLE = False
3017
                        FindConnectPrimaryLine(drawing, primaryLines, branchLines, _symbol, reverseGroupLine)
3018
                    End If
3019

  
3020
                    reverseGroupLine.Reverse()
3021
                    reverseGroupLine.Add(line)
3022
                    reverseGroupLine.AddRange(forwardGroupLine)
3023

  
3024
                    result.Add(reverseGroupLine)
3025
                    'DrawPrimaryGroupLine(GetGroupPoint(reverseGroupLine))
3026
                End If
3027
            End If
3028
        Next
3029

  
3030
        Return result
3031
    End Function
3032

  
3033
    Private Function DrawPrimaryGroupLine(ByVal points As List(Of Pointd)) As LMConnector
3034
        Try
3035
            Dim objPlacement As Placement = New Placement
3036
            Dim objItem As LMAItem
3037
            Dim objConnector As LMConnector
3038
            Dim objInputs As PlaceRunInputs = New PlaceRunInputs
3039
            objItem = objPlacement.PIDCreateItem(GetPipeType("Primary"))
3040

  
3041
            For Each point As Pointd In points
3042
                objInputs.AddPoint(point.X, point.Y)
3043
            Next
3044
            objConnector = objPlacement.PIDPlaceRun(objItem, objInputs)
3045

  
3046
            Return objConnector
3047
        Catch ex As Exception
3048
            Return Nothing
3049
        End Try
3050

  
3051
    End Function
3052

  
3053
    Private Sub PrimaryPipeModeling()
3054

  
3055
        Try
3056
            For Each oDrwing As TreeNode In Tree_Result.Nodes
3057
                For Each oDwgNode As TreeNode In oDrwing.Nodes
3058
                    Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text)
3059
                    Dim CDrawing As Drawing = GetDrawing(sDwgName)
3060

  
3061
                    '' Primary Line만 가져옴
3062
                    Dim primaryLineList As List(Of Line) = New List(Of Line)
3063
                    GetPrimaryLineInNode(primaryLineList, oDwgNode)
3064

  
3065
                    '' Branch Line 가져옴
3066
                    Dim branchLines As List(Of Line) = FindBranchLine(primaryLineList)
3067

  
3068
                    '' primary Line Group
3069
                    Dim primaryGroup As List(Of List(Of Line)) = GetPrimaryGroup(CDrawing, primaryLineList, branchLines)
3070
                    For Each group As List(Of Line) In primaryGroup
3071
                        Dim points As List(Of Pointd) = GetGroupPoint(group)
3072

  
3073
                        '' 각자의 Line의 합쳐진 LMConnector 설정
3074
                        Dim lmConnector As LMConnector = DrawPrimaryGroupLine(points)
3075
                        For Each line As Line In group
3076
                            line.LMCONNECTOR_MODELID = lmConnector.ModelItemID
3077
                        Next
3078
                    Next
3079

  
3080

  
3081

  
3082

  
3083

  
3084

  
3085

  
3086

  
3087

  
3088

  
3089
                    Debug.WriteLine(primaryGroup.Count.ToString)
3090

  
3091
                    Return
3092

  
3093
                    If CDrawing IsNot Nothing Then
3094

  
3095

  
3096
                        ''
3097
                        Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode)
3098
                        Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode)
3099

  
3100
                        'PipeModeling
3101
                        For Each oNode As TreeNode In oDwgNode.Nodes
3102
                            Dim iItemcnt As Integer = 0
3103
                            Dim sNodeUid As String = oNode.Name
3104
                            Dim oPipeRun_Dt As DataTable = PipeRun_Dt()
3105
                            Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid)
3106
                            PipeLineModeling(CLineNo, oNode)
3107
                            Dim CTrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid)
3108
                            PipeLineModeling(CTrimLineNo, oNode)
3109
                        Next
3110

  
3111
                        'Instrument Modeling
3112
                        For Each oNode As TreeNode In oDwgNode.Nodes
3113
                            Dim iItemcnt As Integer = 0
3114
                            Dim sNodeUid As String = oNode.Name
3115
                            Dim oPipeRun_Dt As DataTable = PipeRun_Dt()
3116
                            Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid)
3117
                            InstrumentSymbolModeling(CLineNo, oNode)
3118
                            Dim CTrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid)
3119
                            InstrumentSymbolModeling(CTrimLineNo, oNode)
3120
                        Next
3121

  
3122
                        'Instrument Line Modeling
3123
                        For Each oNode As TreeNode In oDwgNode.Nodes
3124
                            Dim iItemcnt As Integer = 0
3125
                            Dim sNodeUid As String = oNode.Name
3126
                            Dim oPipeRun_Dt As DataTable = PipeRun_Dt()
3127
                            Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid)
3128
                            InstumentLineModeling(CLineNo, oNode)
3129
                            Dim CTrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid)
3130
                            InstumentLineModeling(CTrimLineNo, oNode)
3131
                        Next
3132

  
3133
                        'Symbol Modeling
3134
                        For Each oNode As TreeNode In oDwgNode.Nodes
3135
                            Dim iItemcnt As Integer = 0
3136
                            Dim sNodeUid As String = oNode.Name
3137
                            Dim oPipeRun_Dt As DataTable = PipeRun_Dt()
3138
                            Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid)
3139
                            PipeSymbolModeling(CLineNo, oNode)
3140
                            Dim CTrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid)
3141
                            PipeSymbolModeling(CTrimLineNo, oNode)
3142
                        Next
3143
                    End If
3144
                Next
3145
            Next
3146
        Catch ex As Exception
3147

  
3148
        End Try
3149

  
3150
    End Sub
3151

  
3152
    Structure Pointd
3153
        Public X As Double
3154
        Public Y As Double
3155
    End Structure
3156

  
3157
    Private Function GetGroupPoint(ByVal group As List(Of Line)) As List(Of Pointd)
3158

  
3159
        Dim resultLine As List(Of Tuple(Of Line, Boolean)) = New List(Of Tuple(Of Line, Boolean))
3160
        Dim _lines As List(Of Tuple(Of Line, Boolean)) = New List(Of Tuple(Of Line, Boolean))
3161
        For Each line As Line In group
3162
            Dim tuple As Tuple(Of Line, Boolean) = New Tuple(Of Line, Boolean)(line, IsHorizontal(line))
3163
            _lines.Add(tuple)
3164
        Next
3165

  
3166

  
3167
        For Each tuple As Tuple(Of Line, Boolean) In _lines
3168
            If resultLine.Count = 0 Then
3169
                resultLine.Add(tuple)
3170
            Else
3171
                Dim prevTuple As Tuple(Of Line, Boolean) = resultLine(resultLine.Count - 1)
3172

  
3173
                If prevTuple.Item2 = tuple.Item2 Then
3174
                    resultLine.Remove(prevTuple)
3175
                    resultLine.Add(mergeLine(tuple.Item1, prevTuple.Item1, tuple.Item2))
3176
                Else
3177
                    resultLine.Add(tuple)
3178
                End If
3179
            End If
3180
        Next
3181

  
3182
        Dim pointList As List(Of Pointd) = New List(Of Pointd)
3183
        For Each tuple As Tuple(Of Line, Boolean) In resultLine
3184
            If pointList.Count = 0 Then
3185
                Dim line As Line = tuple.Item1
3186

  
3187
                Dim point1 As Pointd
3188
                point1.X = line.START_X
3189
                point1.Y = line.START_Y
3190

  
3191
                Dim point2 As Pointd
3192
                point2.X = line.END_X
3193
                point2.Y = line.END_Y
3194

  
3195
                pointList.Add(point1)
3196
                pointList.Add(point2)
3197
            Else
3198
                Dim line As Line = tuple.Item1
3199
                Dim isHorizontal As Boolean = tuple.Item2
3200

  
3201

  
3202
                Dim prevPoint1 As Pointd = pointList(pointList.Count - 2)
3203
                Dim prevPoint2 As Pointd = pointList(pointList.Count - 1)
3204
                Dim currPoint1 As Pointd = New Pointd()
3205
                currPoint1.X = line.START_X
3206
                currPoint1.Y = line.START_Y
3207
                Dim currPoint2 As Pointd = New Pointd()
3208
                currPoint2.X = line.END_X
3209
                currPoint2.Y = line.END_Y
3210

  
3211
                ''제일 작은 조합의 반대편 prevPoint를 넣어야함
3212
                Dim distance = CalcDistance(prevPoint1, currPoint1)
3213
                Dim prev = True
3214
                Dim curr = True
3215

  
3216
                If distance > CalcDistance(prevPoint1, currPoint2) Then
3217
                    distance = CalcDistance(prevPoint1, currPoint2)
3218
                    curr = False
3219
                End If
3220

  
3221
                If distance > CalcDistance(prevPoint2, currPoint1) Then
3222
                    distance = CalcDistance(prevPoint2, currPoint1)
3223
                    prev = False
3224
                    curr = True
3225
                End If
3226

  
3227
                If distance > CalcDistance(prevPoint2, currPoint2) Then
3228
                    distance = CalcDistance(prevPoint2, currPoint2)
3229
                    prev = False
3230
                    curr = False
3231
                End If
3232

  
3233
                pointList.RemoveAt(pointList.Count - 2)
3234
                pointList.RemoveAt(pointList.Count - 1)
3235

  
3236
                ' 지금은 수평 / 이전 수직
3237
                If isHorizontal Then
3238
                    If prev Then
3239
                        pointList.Add(prevPoint2)
3240

  
3241
                        If curr Then
3242
                            Dim newPoint As Pointd = New Pointd()
3243
                            newPoint.X = prevPoint2.X
3244
                            newPoint.Y = currPoint2.Y
3245
                            pointList.Add(newPoint)
3246

  
3247
                            pointList.Add(currPoint2)
3248
                        Else
3249
                            Dim newPoint As Pointd = New Pointd()
3250
                            newPoint.X = prevPoint2.X
3251
                            newPoint.Y = currPoint1.Y
3252
                            pointList.Add(newPoint)
3253

  
3254
                            pointList.Add(currPoint1)
3255
                        End If
3256
                    Else
3257
                        pointList.Add(prevPoint1)
3258

  
3259
                        If curr Then
3260
                            Dim newPoint As Pointd = New Pointd()
3261
                            newPoint.X = prevPoint1.X
3262
                            newPoint.Y = currPoint2.Y
3263
                            pointList.Add(newPoint)
3264

  
3265
                            pointList.Add(currPoint2)
3266
                        Else
3267
                            Dim newPoint As Pointd = New Pointd()
3268
                            newPoint.X = prevPoint1.X
3269
                            newPoint.Y = currPoint1.Y
3270
                            pointList.Add(newPoint)
3271

  
3272
                            pointList.Add(currPoint1)
3273
                        End If
3274
                    End If
3275
                    '지금은 수직 / 이전 수평
3276
                Else
3277
                    If prev Then
3278
                        pointList.Add(prevPoint2)
3279

  
3280
                        If curr Then
3281
                            Dim newPoint As Pointd = New Pointd()
3282
                            newPoint.X = currPoint2.X
3283
                            newPoint.Y = prevPoint2.Y
3284
                            pointList.Add(newPoint)
3285

  
3286
                            pointList.Add(currPoint2)
3287
                        Else
3288
                            Dim newPoint As Pointd = New Pointd()
3289
                            newPoint.X = currPoint1.X
3290
                            newPoint.Y = prevPoint2.Y
3291
                            pointList.Add(newPoint)
3292

  
3293
                            pointList.Add(currPoint1)
3294
                        End If
3295
                    Else
3296
                        pointList.Add(prevPoint1)
3297

  
3298
                        If curr Then
3299
                            Dim newPoint As Pointd = New Pointd()
3300
                            newPoint.X = currPoint2.X
3301
                            newPoint.Y = prevPoint1.Y
3302
                            pointList.Add(newPoint)
3303

  
3304
                            pointList.Add(currPoint2)
3305
                        Else
3306
                            Dim newPoint As Pointd = New Pointd()
3307
                            newPoint.X = currPoint1.X
3308
                            newPoint.Y = prevPoint1.Y
3309
                            pointList.Add(newPoint)
3310

  
3311
                            pointList.Add(currPoint1)
3312
                        End If
3313
                    End If
3314
                End If
3315
            End If
3316
        Next
3317

  
3318

  
3319
        Return pointList
3320
    End Function
3321

  
3322
    Private Function CalcDistance(ByVal point1 As Pointd, ByVal point2 As Pointd) As Double
3323
        Return Math.Pow(Math.Sqrt(Math.Abs(point1.X - point2.X)) + Math.Sqrt(Math.Abs(point1.Y - point2.Y)), 0.5)
3324
    End Function
3325

  
3326
    Private Function mergeLine(line1 As Line, line2 As Line, isHorizontal As Boolean) As Tuple(Of Line, Boolean)
3327
        If isHorizontal Then
3328
            Dim min As Double = Math.Min(line1.START_X, Math.Min(line1.END_X, Math.Min(line2.START_X, line2.END_X)))
3329
            Dim max As Double = Math.Max(line1.START_X, Math.Max(line1.END_X, Math.Max(line2.START_X, line2.END_X)))
3330

  
3331
            Dim nLine As Line = New Line()
3332
            nLine.START_X = min
3333
            nLine.START_Y = line1.START_Y
3334
            nLine.END_X = max
3335
            nLine.END_Y = line1.START_Y
3336

  
3337
            Dim tuple As Tuple(Of Line, Boolean) = New Tuple(Of Line, Boolean)(nLine, isHorizontal)
3338
            Return tuple
3339
        Else
3340
            Dim min As Double = Math.Min(line1.START_Y, Math.Min(line1.END_Y, Math.Min(line2.START_Y, line2.END_Y)))
3341
            Dim max As Double = Math.Max(line1.START_Y, Math.Max(line1.END_Y, Math.Max(line2.START_Y, line2.END_Y)))
3342

  
3343
            Dim nLine As Line = New Line()
3344
            nLine.START_X = line1.START_X
3345
            nLine.START_Y = min
3346
            nLine.END_X = line1.START_X
3347
            nLine.END_Y = max
3348

  
3349
            Dim tuple As Tuple(Of Line, Boolean) = New Tuple(Of Line, Boolean)(nLine, isHorizontal)
3350
            Return tuple
3351
        End If
3352

  
3353
    End Function
2862 3354

  
2863 3355
    Private Sub FindNearPoint(ByVal oOPCSymbol As LMSymbol, ByRef dNear_x As Double, ByRef dNear_y As Double)
2864 3356
        Dim oConnectionPoints_x(4) As Double
......
5747 6239
            '2.Piping OPC
5748 6240
            '3.OPC 시작되는 Line
5749 6241

  
5750
            InitAutoRouting()
5751
            EquipmentModeling(oDwg_Dt)
5752
            PipingModeling()
6242
            'InitAutoRouting()
6243
            'EquipmentModeling(oDwg_Dt)
6244
            'PipingModeling()
6245

  
6246
            PrimaryPipeModeling()
5753 6247

  
5754 6248
            '   PipeLine_Fitting_Modeling()
5755 6249

  
......
5871 6365
            '' TreeView 구성 및 하위 아이템 상위 구성
5872 6366
            ' LIne Number
5873 6367
            For Each lineNo As LineNumber In oLineNos
5874
                oParentNode.Nodes.Add(lineNo.UID, lineNo.UID)
6368
                Dim node As TreeNode = New TreeNode(lineNo.UID)
6369
                node.Name = lineNo.UID
6370
                node.Tag = lineNo
6371

  
6372
                oParentNode.Nodes.Add(node)
5875 6373

  
5876 6374
                For Each uid In lineNo.SYMBOLRUNITEMS
5877 6375
                    SetSymbol_LineNumberByUID(oSymbols, lineNo, uid)
......
5885 6383
            ' Trim Line
5886 6384
            For index = 0 To oTrimLines.Count - 1
5887 6385
                Dim trimLine As LineNumber = oTrimLines(index)
5888
                oParentNode.Nodes.Add(trimLine.UID, "TrimLine" + index.ToString)
6386

  
6387
                Dim node As TreeNode = New TreeNode("TrimLine" + index.ToString)
6388
                node.Name = trimLine.UID
6389
                node.Tag = trimLine
6390

  
6391
                oParentNode.Nodes.Add(node)
5889 6392

  
5890 6393
                For Each uid In trimLine.SYMBOLRUNITEMS
5891 6394
                    SetSymbol_LineNumberByUID(oSymbols, trimLine, uid)
......
5897 6400
            Next
5898 6401
            ' symbol
5899 6402
            For Each symbol As Symbol In oSymbols
6403

  
6404
                Dim node As TreeNode = New TreeNode(symbol.TYPE)
6405
                node.Name = symbol.UID
6406
                node.Tag = symbol
6407

  
5900 6408
                If symbol.LINENUMBER IsNot Nothing Then
5901 6409
                    Dim nodeIndex As Integer = oParentNode.Nodes.IndexOfKey(symbol.LINENUMBER.UID)
5902
                    oParentNode.Nodes.Item(nodeIndex).Nodes.Add(symbol.UID, symbol.TYPE)
6410
                    oParentNode.Nodes.Item(nodeIndex).Nodes.Add(node)
5903 6411
                Else
5904
                    oParentNode.Nodes.Add(symbol.UID, symbol.TYPE)
6412
                    oParentNode.Nodes.Add(node)
5905 6413
                End If
5906 6414
            Next
5907 6415
            ' line
5908 6416
            For Each line As Line In oLines
6417

  
6418
                Dim node As TreeNode = New TreeNode(line.TYPE)
6419
                node.Name = line.UID
6420
                node.Tag = line
6421

  
5909 6422
                If line.LINENUMBER IsNot Nothing Then
5910 6423
                    Dim nodeIndex As Integer = oParentNode.Nodes.IndexOfKey(line.LINENUMBER.UID)
5911
                    oParentNode.Nodes.Item(nodeIndex).Nodes.Add(line.UID, line.TYPE)
6424
                    oParentNode.Nodes.Item(nodeIndex).Nodes.Add(node)
5912 6425
                Else
5913
                    oParentNode.Nodes.Add(line.UID, line.TYPE)
6426
                    oParentNode.Nodes.Add(node)
5914 6427
                End If
5915 6428
            Next
5916 6429

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)