프로젝트

일반

사용자정보

개정판 53344e2c

ID53344e2c5d6f2e02c97c12aea3109a50aaa23494
상위 a6a4853a
하위 378a7401, 016701e5

gaqhf 이(가) 약 5년 전에 추가함

dev issue #1230 : group line modeling

Change-Id: I7cae1eae82df7e03accabf6d84f64dba63f1b92a

차이점 보기:

DTI_PID/APIDConverter/AutoModeling.cs
84 84
        {
85 85
            foreach (var item in document.LINES)
86 86
            {
87
                LineModeling(item);
88

  
87
                if (item.Aveva.Handle == 0)
88
                    LineModeling(item);
89 89
            }
90 90
        }
91 91
        #endregion
......
93 93
        #region Modeling Method
94 94
        private void LineModeling(Model.Line line)
95 95
        {
96
            List<Model.Line> groupLine = new List<Model.Line>();
96 97
            List<string> points = new List<string>();
97
            points.Add(line.Aveva.Start_X + "," + line.Aveva.Start_Y);
98
            points.Add(line.Aveva.End_X + "," + line.Aveva.End_Y);
98
            GetConnectedGroupLine(line, null, groupLine);
99
            GetGroupLinePoints(groupLine, points);
99 100

  
101
            long handle = 0;
100 102
            if (line.Aveva.Type == Model.Type.Pipe)
101
                line.Aveva.Handle = DrawPipe(line.Aveva.Name, points);
103
                handle = DrawPipe(line.Aveva.Name, points);
102 104
            else if (line.Aveva.Type == Model.Type.Signal)
103
                line.Aveva.Handle = DrawSignal(line.Aveva.Name, points);
105
                handle = DrawSignal(line.Aveva.Name, points);
106

  
107
            foreach (var item in groupLine)
108
                item.Aveva.Handle = handle;
104 109
        }
105 110
        #endregion
106 111

  
......
171 176
            else
172 177
                return 0;
173 178
        }
174

  
175 179
        private long DrawSignal(string style, List<string> coordinates)
176 180
        {
177 181
            List<long> prevHandles = GetAllGroupHandles();
......
224 228
        }
225 229
        #endregion
226 230

  
231
        #region
227 232
        private List<long> GetAllGroupHandles()
228 233
        {
229 234
            List<long> handles = new List<long>();
......
239 244
            }
240 245
            return handles;
241 246
        }
242

  
243 247
        private ObjectId GetFirstPolyLine(long groupHandle)
244 248
        {
245 249
            ObjectId result = ObjectId.Null;
......
270 274

  
271 275
            return result;
272 276
        }
277
        private void GetConnectedGroupLine(Model.Line line, Model.Line prevLine, List<Model.Line> group)
278
        {
279
            if (!group.Contains(line))
280
            {
281
                if (prevLine != null && prevLine.CONNECTORS[0].ConnectedObject == line)
282
                    group.Insert(0, line);
283
                else if (prevLine != null && prevLine.CONNECTORS[1].ConnectedObject == line)
284
                    group.Add(line);
285
                else
286
                    group.Add(line);
287

  
288
                if (line.CONNECTORS[0].ConnectedObject != null &&
289
                    line.CONNECTORS[0].ConnectedObject.GetType() == typeof(Model.Line) &&
290
                    APIDUtils.IsConnectedLine(line.CONNECTORS[0].ConnectedObject as Model.Line, line))
291
                    GetConnectedGroupLine(line.CONNECTORS[0].ConnectedObject as Model.Line, line, group);
292
                if (line.CONNECTORS[1].ConnectedObject != null &&
293
                    line.CONNECTORS[1].ConnectedObject.GetType() == typeof(Model.Line) &&
294
                    APIDUtils.IsConnectedLine(line.CONNECTORS[1].ConnectedObject as Model.Line, line))
295
                    GetConnectedGroupLine(line.CONNECTORS[1].ConnectedObject as Model.Line, line, group);
296
            }
297
        }
298
        private void GetGroupLinePoints(List<Model.Line> groupLine, List<string> points)
299
        {
300
            for (int i = 0; i < groupLine.Count; i++)
301
            {
302
                Model.Line line = groupLine[i];
303
                points.Add(line.Aveva.Start_X + "," + line.Aveva.Start_Y);
304
                if (i == groupLine.Count - 1)
305
                    points.Add(line.Aveva.End_X + "," + line.Aveva.End_Y);
306
            }
307
        }
308
        #endregion
273 309

  
274 310
        #region Test Source
275 311
        public void test()
DTI_PID/APIDConverter/Model/PlantItem/Document.cs
540 540
                    item.Aveva = new AvevaLineInfo();
541 541
                    item.Aveva.Name = (string)rows[0]["APID_SYMBOL"];
542 542
                    item.Aveva.Start_X = item.Start_X;
543
                    item.Aveva.Start_Y = item.Start_Y;
543
                    item.Aveva.Start_Y = SIZE_HEIGHT - item.Start_Y;
544 544
                    item.Aveva.End_X = item.End_X;
545
                    item.Aveva.End_Y = item.End_Y;
545
                    item.Aveva.End_Y = SIZE_HEIGHT - item.End_Y;
546 546

  
547 547
                    if (!DBNull.Value.Equals(rows[0]["DATA1"]))
548 548
                    {
DTI_PID/APIDConverter/Utils/APIDUtils.cs
54 54

  
55 55
            return true;
56 56
        }
57
        public static bool IsConnectedLine(Line line1, Line line2)
58
        {
59
            bool result = false;
60

  
61
            if (line1.CONNECTORS.Find(x => x.ConnectedObject == line2) != null &&
62
                line2.CONNECTORS.Find(x => x.ConnectedObject == line1) != null)
63
                result = true;
64

  
65
            return result;
66
        }
57 67
        #endregion
58 68

  
59 69
        #region Only AVEVA

내보내기 Unified diff

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