프로젝트

일반

사용자정보

개정판 0a8db7fe

ID0a8db7fef4d5640cf9c9419816e10f865ccba7b6
상위 ac9c01e1
하위 2f3651f9, 6503fec8

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

dev issue #1225 : Text, Note Model

Change-Id: I1aedecf82b1a68773708b2ce01076e30b4bfabc5

차이점 보기:

DTI_PID/APIDConverter/AVEVA.PID.CustomizationUtility_ACAD2018_x64.csproj
142 142
    <Reference Include="WindowsBase" />
143 143
  </ItemGroup>
144 144
  <ItemGroup>
145
    <Compile Include="Model\PlantItem\Note.cs" />
145 146
    <Compile Include="Model\PlantItem\Text.cs" />
146 147
    <Compile Include="Utils\AccessPropertyForm.cs" />
147 148
    <Compile Include="APIDConverterExplorer.cs">
DTI_PID/APIDConverter/AutoModeling.cs
159 159
        }
160 160
        private void RunTextModeling()
161 161
        {
162
            //SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.text.Count);
163
            //SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetStep, "Line Modeling");
164
            //foreach (var item in document.LINES)
165
            //{
166
            //    if (item.Aveva.Handle == 0)
167
            //        LineModeling(item);
168

  
169
            //    SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null);
170
            //}
162
            SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.Texts.Count);
163
            SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetStep, "Text Modeling");
164
            foreach (var item in document.Texts)
165
            {
166

  
167
                SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null);
168
            }
171 169
        }
172 170
        #endregion
173 171

  
DTI_PID/APIDConverter/Model/PlantItem/Document.cs
24 24
        private List<EndBreak> _EndBreaks = new List<EndBreak>();
25 25
        private List<SpecBreak> _SpecBreaks = new List<SpecBreak>();
26 26
        private List<Equipment> _Equipments = new List<Equipment>();
27
        private List<Text> _Texts = new List<Text>();
28
        private List<Note> _Notes = new List<Note>();
27 29
        private List<OPC> _OPCs = new List<OPC>();
28 30
        private bool _Enable;
29 31
        private bool _Validation;
......
72 74
        public bool MappingValidation { get => _MappingValidation; set => _MappingValidation = value; }
73 75
        public string UID { get => _UID; set => _UID = value; }
74 76
        public List<OPC> OPCs { get => _OPCs; set => _OPCs = value; }
77
        public List<Text> Texts { get => _Texts; set => _Texts = value; }
78
        public List<Note> Notes { get => _Notes; set => _Notes = value; }
75 79

  
76 80
        StringBuilder validationStringBuilder = new StringBuilder();
77 81

  
......
94 98
                    validationStringBuilder.AppendLine("Drawing Name : " + DWGNAME);
95 99
                    validationStringBuilder.AppendLine("");
96 100

  
101
                    SetText(xml.Element("TEXTINFOS"));
102
                    SetNote(xml.Element("NOTES"));
97 103
                    SetSymbol(xml.Element("SYMBOLS"));
98 104
                    SetLine(xml.Element("LINEINFOS"));
99 105
                    SetLineNumber(xml.Element("LINENOS"));
......
534 540
                }
535 541
            }
536 542
        }
543

  
544
        private void SetText(XElement node)
545
        {
546
            foreach (XElement item in node.Elements("ATTRIBUTE"))
547
            {
548
                Text text = new Text()
549
                {
550
                    UID = item.Element("UID").Value,
551
                    OWNER = item.Element("OWNER").Value,
552
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
553
                    NAME = item.Element("NAME").Value,
554
                    LOCATION = item.Element("LOCATION").Value,
555
                    VALUE = item.Element("VALUE").Value,
556
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
557
                    WIDTH = item.Element("WIDTH").Value,
558
                    HEIGHT = item.Element("HEIGHT").Value,
559
                    AREA = item.Element("AREA").Value,
560
                    SCENE = item.Element("SCENE").Value
561
                };
562

  
563
                Texts.Add(text);
564
            }
565
        }
566

  
567
        private void SetNote(XElement node)
568
        {
569
            foreach (XElement item in node.Elements("ATTRIBUTE"))
570
            {
571
                Note note = new Note()
572
                {
573
                    UID = item.Element("UID").Value,
574
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
575
                    NAME = item.Element("NAME").Value,
576
                    LOCATION = item.Element("LOCATION").Value,
577
                    VALUE = item.Element("VALUE").Value,
578
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
579
                    WIDTH = item.Element("WIDTH").Value,
580
                    HEIGHT = item.Element("HEIGHT").Value,
581
                    AREA = item.Element("AREA").Value,
582
                    SCENE = item.Element("SCENE").Value,
583
                    OWNER = item.Element("OWNER").Value
584
                };
585

  
586
                Notes.Add(note);
587
            }
588
        }
537 589
        #endregion
538 590

  
539 591
        public void SetAllConnectors()
DTI_PID/APIDConverter/Model/PlantItem/Note.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6

  
7
namespace AVEVA.PID.CustomizationUtility.Model
8
{
9
    public class Note
10
    {
11
        private string _UID;
12
        private string _OWNER;
13
        private string _ATTRIBUTEVALUE;
14
        private string _NAME;
15
        private string _LOCATION;
16
        private double _LOCATION_X;
17
        private double _LOCATION_Y;
18
        public double LOCATION_X { get { return _LOCATION_X; } }
19
        public double LOCATION_Y { get { return _LOCATION_Y; } }
20
        private string _VALUE;
21
        private double _ANGLE;
22
        private string _WIDTH;
23
        private string _HEIGHT;
24
        private string _AREA;
25
        private string _SCENE;
26

  
27
        public string UID { get => _UID; set => _UID = value; }
28
        public string ATTRIBUTEVALUE { get => _ATTRIBUTEVALUE; set => _ATTRIBUTEVALUE = value; }
29
        public string NAME { get => _NAME; set => _NAME = value; }
30
        public string LOCATION
31
        {
32
            get
33
            {
34
                return _LOCATION;
35
            }
36
            set
37
            {
38
                _LOCATION = value;
39
                double x = 0;
40
                double y = 0;
41
                APIDUtils.ConvertPointBystring(_LOCATION, ref x, ref y);
42
                _LOCATION_X = x;
43
                _LOCATION_Y = y;
44
            }
45
        }
46
        public string VALUE { get => _VALUE; set => _VALUE = value; }
47
        public double ANGLE
48
        {
49
            get
50
            {
51
                return _ANGLE;
52
            }
53
            set
54
            {
55
                double gap = 0.05;
56
                if (value < gap)
57
                    value = 0;
58
                else if (1.57 - gap < value && value < 1.57 + gap)
59
                    value = 90 * Math.PI / 180;
60
                else if (3.14 - gap < value && value < 3.14 + gap)
61
                    value = Math.PI;
62
                else if (4.71 - gap < value && value < 4.71 + gap)
63
                    value = 270 * Math.PI / 180;
64

  
65
                _ANGLE = value;
66
            }
67
        }
68
        public string WIDTH { get => _WIDTH; set => _WIDTH = value; }
69
        public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; }
70
        public string AREA { get => _AREA; set => _AREA = value; }
71

  
72
        public string SCENE
73
        {
74
            get
75
            {
76
                return _SCENE;
77
            }
78
            set
79
            {
80
                string[] split = value.Split(',');
81
                X1 = Convert.ToDouble(split[0]);
82
                Y1 = Convert.ToDouble(split[1]);
83
                X2 = X1 + Convert.ToDouble(split[2]);
84
                Y2 = Y1 + Convert.ToDouble(split[3]);
85
            }
86
        }
87
        public double X1 { get; set; }
88
        public double X2 { get; set; }
89
        public double Y1 { get; set; }
90
        public double Y2 { get; set; }
91
        public string OWNER { get => _OWNER; set => _OWNER = value; }
92
    }
93
}

내보내기 Unified diff

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