프로젝트

일반

사용자정보

개정판 29485992

ID29485992bbfecad99735e6fc93588ef7a6f54bef
상위 ca2cc9e9
하위 0a7f879c

백흠경이(가) 5년 이상 전에 추가함

rename DTI_PID to HYTOS

Change-Id: I7558a2ee0ec25a57331d53e824489ccfd67fba9e

차이점 보기:

DTI_PID/BaseModel/App.config
1
<?xml version="1.0" encoding="utf-8"?>
2
<configuration>
3
  <configSections>
4
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6
  </configSections>
7
  <entityFramework>
8
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
9
      <parameters>
10
        <parameter value="mssqllocaldb" />
11
      </parameters>
12
    </defaultConnectionFactory>
13
    <providers>
14
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
15
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
16
    </providers>
17
  </entityFramework>
18
  
19
<system.data>
20
    <DbProviderFactories>
21
      <remove invariant="System.Data.SQLite.EF6" />
22
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
23
    <remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
24
  </system.data></configuration>
DTI_PID/BaseModel/BaseModel.csproj
1
<?xml version="1.0" encoding="utf-8"?>
2
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
  <PropertyGroup>
5
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
    <ProjectGuid>{BEEC4A21-BD63-40D2-B745-027B19241A70}</ProjectGuid>
8
    <OutputType>Library</OutputType>
9
    <AppDesignerFolder>Properties</AppDesignerFolder>
10
    <RootNamespace>Converter.BaseModel</RootNamespace>
11
    <AssemblyName>BaseModel</AssemblyName>
12
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
13
    <FileAlignment>512</FileAlignment>
14
    <Deterministic>true</Deterministic>
15
    <NuGetPackageImportStamp>
16
    </NuGetPackageImportStamp>
17
  </PropertyGroup>
18
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19
    <DebugSymbols>true</DebugSymbols>
20
    <DebugType>full</DebugType>
21
    <Optimize>false</Optimize>
22
    <OutputPath>bin\Debug\</OutputPath>
23
    <DefineConstants>DEBUG;TRACE</DefineConstants>
24
    <ErrorReport>prompt</ErrorReport>
25
    <WarningLevel>4</WarningLevel>
26
  </PropertyGroup>
27
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28
    <DebugType>pdbonly</DebugType>
29
    <Optimize>true</Optimize>
30
    <OutputPath>bin\Release\</OutputPath>
31
    <DefineConstants>TRACE</DefineConstants>
32
    <ErrorReport>prompt</ErrorReport>
33
    <WarningLevel>4</WarningLevel>
34
  </PropertyGroup>
35
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
36
    <DebugSymbols>true</DebugSymbols>
37
    <OutputPath>..\SPPIDConverterDll\</OutputPath>
38
    <DefineConstants>DEBUG;TRACE</DefineConstants>
39
    <DebugType>full</DebugType>
40
    <PlatformTarget>x86</PlatformTarget>
41
    <ErrorReport>prompt</ErrorReport>
42
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
43
  </PropertyGroup>
44
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
45
    <OutputPath>bin\x86\Release\</OutputPath>
46
    <DefineConstants>TRACE</DefineConstants>
47
    <Optimize>true</Optimize>
48
    <DebugType>pdbonly</DebugType>
49
    <PlatformTarget>x86</PlatformTarget>
50
    <ErrorReport>prompt</ErrorReport>
51
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
52
  </PropertyGroup>
53
  <ItemGroup>
54
    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
55
      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
56
    </Reference>
57
    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
58
      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
59
    </Reference>
60
    <Reference Include="System" />
61
    <Reference Include="System.ComponentModel.DataAnnotations" />
62
    <Reference Include="System.Core" />
63
    <Reference Include="System.Data.SQLite, Version=1.0.111.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
64
      <HintPath>..\packages\System.Data.SQLite.Core.1.0.111.0\lib\net46\System.Data.SQLite.dll</HintPath>
65
    </Reference>
66
    <Reference Include="System.Data.SQLite.EF6, Version=1.0.111.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
67
      <HintPath>..\packages\System.Data.SQLite.EF6.1.0.111.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
68
    </Reference>
69
    <Reference Include="System.Data.SQLite.Linq, Version=1.0.111.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
70
      <HintPath>..\packages\System.Data.SQLite.Linq.1.0.111.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
71
    </Reference>
72
    <Reference Include="System.Windows.Forms" />
73
    <Reference Include="System.Xml.Linq" />
74
    <Reference Include="System.Data.DataSetExtensions" />
75
    <Reference Include="Microsoft.CSharp" />
76
    <Reference Include="System.Data" />
77
    <Reference Include="System.Net.Http" />
78
    <Reference Include="System.Xml" />
79
  </ItemGroup>
80
  <ItemGroup>
81
    <Compile Include="Model\ChildSymbol.cs" />
82
    <Compile Include="Model\Equipment.cs" />
83
    <Compile Include="Model\SPPID\SPPIDLabelLocationInfo.cs" />
84
    <Compile Include="Model\TrimLine.cs" />
85
    <Compile Include="Model\Other\Association.cs" />
86
    <Compile Include="Model\Other\Attribute.cs" />
87
    <Compile Include="Model\Other\Connector.cs" />
88
    <Compile Include="Model\Other\LineNumberRun.cs" />
89
    <Compile Include="Model\Other\Property.cs" />
90
    <Compile Include="Model\SPPID\SPPIDLineInfo.cs" />
91
    <Compile Include="Model\SPPID\SPPIDSymbolInfo.cs" />
92
    <Compile Include="Model\EndBreak.cs" />
93
    <Compile Include="Project_DB.cs" />
94
    <Compile Include="Project_Info.cs" />
95
    <Compile Include="Model\Document.cs" />
96
    <Compile Include="Model\Line.cs" />
97
    <Compile Include="Model\LineNumber.cs" />
98
    <Compile Include="Model\Note.cs" />
99
    <Compile Include="Properties\AssemblyInfo.cs" />
100
    <Compile Include="Model\Symbol.cs" />
101
    <Compile Include="Model\Text.cs" />
102
  </ItemGroup>
103
  <ItemGroup>
104
    <None Include="App.config" />
105
    <None Include="packages.config" />
106
  </ItemGroup>
107
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
108
  <Import Project="..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets')" />
109
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
110
    <PropertyGroup>
111
      <ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
112
    </PropertyGroup>
113
    <Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets'))" />
114
  </Target>
115
</Project>
DTI_PID/BaseModel/Model/ChildSymbol.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 Converter.BaseModel
8
{
9
    public class ChildSymbol
10
    {
11
        private int _ParentAt;
12
        private string _Direction;
13
        private string _NAME;
14
        private List<ChildSymbol> _ChildSymbols = new List<ChildSymbol>();
15
        private List<Connector> _Connectors = new List<Connector>();
16
        private SPPIDSymbolInfo _SPPID;
17

  
18
        public string NAME { get => _NAME; set => _NAME = value; }
19
        public List<ChildSymbol> ChildSymbols { get => _ChildSymbols; set => _ChildSymbols = value; }
20
        public int ParentAt { get => _ParentAt; set => _ParentAt = value; }
21
        public string Direction { get => _Direction; set => _Direction = value; }
22
        public List<Connector> Connectors { get => _Connectors; set => _Connectors = value; }
23
        public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; }
24
    }
25
}
DTI_PID/BaseModel/Model/Document.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using System.IO;
7
using System.Xml.Linq;
8
using System.Windows.Forms;
9

  
10
namespace Converter.BaseModel
11
{
12
    public class Document
13
    {
14
        private string _DWGNAME;
15
        private string _SIZE;
16
        private double _SIZE_WIDTH;
17
        private double _SIZE_HEIGHT;
18
        private List<Symbol> _SYMBOLS = new List<Symbol>();
19
        private List<Text> _TEXTINFOS = new List<Text>();
20
        private List<Note> _NOTES = new List<Note>();
21
        private List<Line> _LINES = new List<Line>();
22
        private List<LineNumber> _LINENUMBERS = new List<LineNumber>();
23
        private List<TrimLine> _TRIMLINES = new List<TrimLine>();
24
        private List<EndBreak> _EndBreaks = new List<EndBreak>();
25
        private List<Equipment> _Equipments = new List<Equipment>();
26
        private bool _Enable;
27

  
28
        public bool Enable { get { return _Enable; } }
29

  
30
        public List<Symbol> SYMBOLS { get => _SYMBOLS; set => _SYMBOLS = value; }
31
        public List<Text> TEXTINFOS { get => _TEXTINFOS; set => _TEXTINFOS = value; }
32
        public List<Note> NOTES { get => _NOTES; set => _NOTES = value; }
33
        public List<Line> LINES { get => _LINES; set => _LINES = value; }
34
        public List<LineNumber> LINENUMBERS { get => _LINENUMBERS; set => _LINENUMBERS = value; }
35
        public List<EndBreak> EndBreaks { get => _EndBreaks; set => _EndBreaks = value; }
36
        public List<Equipment> Equipments { get => _Equipments; set => _Equipments = value; }
37
        public string DWGNAME { get => _DWGNAME; set => _DWGNAME = value; }
38
        public string SIZE
39
        {
40
            get
41
            {
42
                return _SIZE;
43
            }
44
            set
45
            {
46
                _SIZE = value;
47
                string[] pointArr = _SIZE.Split(new char[] { ',' });
48
                if (pointArr.Length == 2)
49
                {
50
                    _SIZE_WIDTH = Convert.ToDouble(pointArr[0]);
51
                    _SIZE_HEIGHT = Convert.ToDouble(pointArr[1]);
52
                }
53
            }
54
        }
55
        public double SIZE_WIDTH { get => _SIZE_WIDTH; }
56
        public double SIZE_HEIGHT { get => _SIZE_HEIGHT; }
57
        public List<TrimLine> TRIMLINES { get => _TRIMLINES; set => _TRIMLINES = value; }
58

  
59
        public Document(string xmlPath)
60
        {
61
            try
62
            {
63
                XElement xml = XElement.Load(xmlPath);
64
                DWGNAME = xml.Element("DWGNAME").Value;
65
                SIZE = xml.Element("SIZE").Value;
66

  
67
                SetText(xml.Element("TEXTINFOS"));
68
                SetNote(xml.Element("NOTES"));
69
                SetSymbol(xml.Element("SYMBOLS"));
70
                SetLine(xml.Element("LINEINFOS"));
71
                SetLineNumber(xml.Element("LINENOS"));
72
                SetTrimLine(xml.Element("TRIMLINENOS"));
73

  
74
                _Enable = true;
75
            }
76
            catch (Exception ex)
77
            {
78
                _Enable = false;
79
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
80
            }
81
        }
82

  
83
        #region READ XML
84
        private void SetSymbol(XElement node)
85
        {
86
            foreach (XElement item in node.Elements("SYMBOL"))
87
            {
88
                string sType = item.Element("TYPE").Value;
89
                if (sType == "Segment Breaks")
90
                {
91
                    continue;
92
                }
93
                else if (sType == "End Break")
94
                {
95
                    EndBreak endBreak = new EndBreak()
96
                    {
97
                        UID = item.Element("UID").Value,
98
                        DBUID = item.Element("DBUID").Value,
99
                        NAME = item.Element("NAME").Value,
100
                        TYPE = item.Element("TYPE").Value,
101
                        OWNER = item.Element("OWNER").Value,
102
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
103
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
104
                        LOCATION = item.Element("LOCATION").Value,
105
                        SIZE = item.Element("SIZE").Value,
106
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
107
                        PARENT = item.Element("PARENT").Value,
108
                        CHILD = item.Element("CHILD").Value,
109
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
110
                        AREA = item.Element("AREA").Value,
111
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
112
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
113
                    };
114
                    SetAssociations(item.Element("ASSOCIATIONS"), endBreak.ASSOCIATIONS);
115
                    SetSymbolConnectors(item.Element("CONNECTORS"), endBreak.CONNECTORS, endBreak.CONNECTIONPOINT);
116
                    SetProperties(item.Element("PROPERTIES"), endBreak.PROPERTIES);
117
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), endBreak.ATTRIBUTES);
118

  
119
                    EndBreaks.Add(endBreak);
120
                }
121
                else if (sType == "Black Box System" ||
122
                    sType == "GGO_Equipment" ||
123
                    sType == "Heat Transfer Equipment" ||
124
                    sType == "Mechanical" ||
125
                    sType == "Other Equipment" ||
126
                    sType == "Vessels")
127
                {
128
                    Equipment equipment = new Equipment()
129
                    {
130
                        UID = item.Element("UID").Value,
131
                        DBUID = item.Element("DBUID").Value,
132
                        NAME = item.Element("NAME").Value,
133
                        TYPE = item.Element("TYPE").Value,
134
                        OWNER = item.Element("OWNER").Value,
135
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
136
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
137
                        LOCATION = item.Element("LOCATION").Value,
138
                        SIZE = item.Element("SIZE").Value,
139
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
140
                        PARENT = item.Element("PARENT").Value,
141
                        CHILD = item.Element("CHILD").Value,
142
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
143
                        AREA = item.Element("AREA").Value,
144
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
145
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
146
                    };
147
                    SetAssociations(item.Element("ASSOCIATIONS"), equipment.ASSOCIATIONS);
148
                    SetSymbolConnectors(item.Element("CONNECTORS"), equipment.CONNECTORS, equipment.CONNECTIONPOINT);
149
                    SetProperties(item.Element("PROPERTIES"), equipment.PROPERTIES);
150
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), equipment.ATTRIBUTES);
151

  
152
                    Equipments.Add(equipment);
153
                }
154
                else
155
                {
156
                    Symbol symbol = new Symbol()
157
                    {
158
                        UID = item.Element("UID").Value,
159
                        DBUID = item.Element("DBUID").Value,
160
                        NAME = item.Element("NAME").Value,
161
                        TYPE = item.Element("TYPE").Value,
162
                        OWNER = item.Element("OWNER").Value,
163
                        ORIGINALPOINT = item.Element("ORIGINALPOINT").Value,
164
                        CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value,
165
                        LOCATION = item.Element("LOCATION").Value,
166
                        SIZE = item.Element("SIZE").Value,
167
                        ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
168
                        PARENT = item.Element("PARENT").Value,
169
                        CHILD = item.Element("CHILD").Value,
170
                        HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value,
171
                        AREA = item.Element("AREA").Value,
172
                        FLIP = Convert.ToInt32(item.Element("FLIP").Value),
173
                        CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value)
174
                    };
175

  
176
                    SetAssociations(item.Element("ASSOCIATIONS"), symbol.ASSOCIATIONS);
177
                    SetSymbolConnectors(item.Element("CONNECTORS"), symbol.CONNECTORS, symbol.CONNECTIONPOINT);
178
                    SetProperties(item.Element("PROPERTIES"), symbol.PROPERTIES);
179
                    SetAttributes(item.Element("SYMBOLATTRIBUTES"), symbol.ATTRIBUTES);
180
                    SetChildSymbol(symbol);
181

  
182
                    SYMBOLS.Add(symbol);
183
                }
184
            }
185
        }
186

  
187
        private void SetLine(XElement node)
188
        {
189
            foreach (XElement item in node.Elements("LINE"))
190
            {
191
                Line line = new Line()
192
                {
193
                    OWNER = item.Attribute("OWNER").Value,
194
                    UID = item.Element("UID").Value,
195
                    STARTPOINT = item.Element("STARTPOINT").Value,
196
                    ENDPOINT = item.Element("ENDPOINT").Value,
197
                    TYPE = item.Element("TYPE").Value,
198
                    TYPEUID = item.Element("TYPE").Attribute("TYPEUID").Value,
199
                    AREA = item.Element("AREA").Value,
200
                    THICKNESS = item.Element("THICKNESS").Value,
201
                };
202
                SetConnectors(item.Element("CONNECTORS"), line.CONNECTORS);
203
                LINES.Add(line);
204
            }
205
        }
206

  
207
        private void SetLineNumber(XElement node)
208
        {
209
            foreach (XElement item in node.Elements("LINE_NO"))
210
            {
211
                LineNumber lineNumber = new LineNumber()
212
                {
213
                    UID = item.Element("UID").Value,
214
                    TEXT = item.Element("TEXT").Value,
215
                    LOCATION = item.Element("LOCATION").Value,
216
                    WIDTH = item.Element("WIDTH").Value,
217
                    HEIGHT = item.Element("HEIGHT").Value,
218
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
219
                    AREA = item.Element("AREA").Value,
220
                    CONNLINE = item.Element("CONNLINE").Value,
221
                    SCENE = item.Element("SCENE").Value
222
                };
223
                SetLineNumberRuns(item, lineNumber.RUNS);
224
                SetProperties(item.Element("PROPERTIES"), lineNumber.PROPERTIES);
225
                SetAttributes(item, lineNumber.ATTRIBUTES);
226
                LINENUMBERS.Add(lineNumber);
227
            }
228
        }
229

  
230
        private void SetText(XElement node)
231
        {
232
            foreach (XElement item in node.Elements("ATTRIBUTE"))
233
            {
234
                Text text = new Text()
235
                {
236
                    UID = item.Element("UID").Value,
237
                    OWNER = item.Element("OWNER").Value,
238
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
239
                    NAME = item.Element("NAME").Value,
240
                    LOCATION = item.Element("LOCATION").Value,
241
                    VALUE = item.Element("VALUE").Value,
242
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
243
                    WIDTH = item.Element("WIDTH").Value,
244
                    HEIGHT = item.Element("HEIGHT").Value,
245
                    AREA = item.Element("AREA").Value,
246
                    SCENE = item.Element("SCENE").Value
247
                };
248

  
249
                TEXTINFOS.Add(text);
250
            }
251
        }
252

  
253
        private void SetNote(XElement node)
254
        {
255
            foreach (XElement item in node.Elements("ATTRIBUTE"))
256
            {
257
                Note note = new Note()
258
                {
259
                    UID = item.Element("UID").Value,
260
                    ATTRIBUTEVALUE = item.Element("ATTRIBUTEVALUE").Value,
261
                    NAME = item.Element("NAME").Value,
262
                    LOCATION = item.Element("LOCATION").Value,
263
                    VALUE = item.Element("VALUE").Value,
264
                    ANGLE = Convert.ToDouble(item.Element("ANGLE").Value),
265
                    WIDTH = item.Element("WIDTH").Value,
266
                    HEIGHT = item.Element("HEIGHT").Value,
267
                    AREA = item.Element("AREA").Value,
268
                    SCENE = item.Element("SCENE").Value
269
                };
270

  
271
                NOTES.Add(note);
272
            }
273
        }
274

  
275
        private void SetTrimLine(XElement node)
276
        {
277
            foreach (XElement item in node.Elements("TRIM_LINE_NO"))
278
            {
279
                TrimLine trimLine = new TrimLine()
280
                {
281
                    UID = item.Element("UID").Value,
282
                };
283
                SetLineNumberRuns(item, trimLine.RUNS);
284
                TRIMLINES.Add(trimLine);
285
            }
286
        }
287

  
288
        private void SetAssociations(XElement node, List<Association> associations)
289
        {
290
            foreach (XElement item in node.Elements("ASSOCIATION"))
291
            {
292
                Association association = new Association()
293
                {
294
                    TYPE = item.Attribute("TYPE").Value,
295
                    VALUE = item.Value
296
                };
297

  
298
                Text text = _TEXTINFOS.Find(x => x.UID == association.VALUE);
299
                if (text != null)
300
                    text.ASSOCIATION = true;
301

  
302
                associations.Add(association);
303
            }
304
        }
305

  
306
        private void SetConnectors(XElement node, List<Connector> connectors)
307
        {
308
            foreach (XElement item in node.Elements("CONNECTOR"))
309
            {
310
                connectors.Add(new Connector()
311
                {
312
                    UID = item.Attribute("UID").Value,
313
                    CONNECTED_AT = Convert.ToInt32(item.Attribute("CONNECTED_AT").Value),
314
                    CONNECTEDITEM = item.Element("CONNECTEDITEM").Value,
315
                    CONNECTPOINT = item.Element("CONNECTPOINT").Value,
316
                    SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value,
317
                });
318
            }
319
        }
320

  
321
        private void SetSymbolConnectors(XElement node, List<Connector> connectors, string CONNECTIONPOINT)
322
        {
323
            foreach (XElement item in node.Elements("CONNECTOR"))
324
            {
325
                connectors.Add(new Connector()
326
                {
327
                    UID = item.Attribute("UID").Value,
328
                    CONNECTED_AT = Convert.ToInt32(item.Attribute("CONNECTED_AT").Value),
329
                    CONNECTEDITEM = item.Element("CONNECTEDITEM").Value,
330
                    CONNECTPOINT = item.Element("CONNECTPOINT").Value,
331
                    SCENECONNECTPOINT = item.Element("SCENECONNECTPOINT").Value,
332
                });
333
            }
334
        }
335

  
336
        private void SetProperties(XElement node, List<Property> properties)
337
        {
338
            foreach (XElement item in node.Elements("PROPERTY"))
339
            {
340
                properties.Add(new Property()
341
                {
342
                    UID = item.Attribute("UID").Value,
343
                    LENGTH = item.Attribute("Length").Value,
344
                    EXPRESSION = item.Attribute("Expression").Value,
345
                    DISPLAYATTRIBUTE = item.Attribute("DisplayAttribute").Value,
346
                    ATTRIBUTETYPE = item.Attribute("AttributeType").Value,
347
                    ATTRIBUTE = item.Attribute("Attribute").Value,
348
                    VALUE = item.Value
349
                });
350
            }
351
        }
352

  
353
        private void SetAttributes(XElement node, List<Attribute> attributes)
354
        {
355
            foreach (XElement item in node.Elements("ATTRIBUTE"))
356
            {
357
                attributes.Add(new Attribute()
358
                {
359
                    UID = item.Attribute("UID").Value,
360
                    LENGTH = item.Attribute("Length").Value,
361
                    EXPRESSION = item.Attribute("Expression").Value,
362
                    DISPLAYATTRIBUTE = item.Attribute("DisplayAttribute").Value,
363
                    ATTRIBUTETYPE = item.Attribute("AttributeType").Value,
364
                    ATTRIBUTE = item.Attribute("Attribute").Value,
365
                    ATTRAT = item.Attribute("AttrAt").Value,
366
                    VALUE = item.Value
367
                });
368
            }
369
        }
370

  
371
        private void SetLineNumberRuns(XElement node, List<LineRun> lineNumberRuns)
372
        {
373
            foreach (XElement item in node.Elements("RUN"))
374
            {
375
                LineRun run = new LineRun()
376
                {
377
                    TYPE = item.Attribute("TYPE").Value
378
                };
379

  
380
                foreach (XElement element in item.Elements())
381
                {
382
                    if (element.Name == "SYMBOL")
383
                    {
384
                        Symbol symbol = GetSymbolByUID(element.Element("UID").Value);
385
                        if (symbol == null)
386
                            throw new Exception(element.Element("UID").Value);
387
                        run.RUNITEMS.Add(symbol);
388
                    }
389
                    else if (element.Name == "LINE")
390
                    {
391
                        Line line = GetLineByUID(element.Element("UID").Value);
392
                        if (line == null)
393
                            throw new Exception(element.Element("UID").Value);
394
                        run.RUNITEMS.Add(line);
395
                    }
396
                }
397
                lineNumberRuns.Add(run);
398
            }
399
        }
400

  
401
        private void SetChildSymbol(Symbol symbol)
402
        {
403
            List<ChildSymbol> childList = new List<ChildSymbol>();
404
            if (!string.IsNullOrEmpty(symbol.CHILD) && symbol.CHILD != "None")
405
            {
406
                string[] childArray = symbol.CHILD.Split(new char[] { '/' });
407
                foreach (string sChild in childArray)
408
                {
409
                    string[] sChildInfo = sChild.Split(new char[] { ',' });
410
                    childList.Add(new ChildSymbol()
411
                    {
412
                        ParentAt = Convert.ToInt32(sChildInfo[0]),
413
                        Direction = sChildInfo[1],
414
                        NAME = sChildInfo[2]
415
                    });
416
                }
417

  
418
                foreach (ChildSymbol child in childList)
419
                {
420
                    if (child.ParentAt == 0)
421
                        symbol.ChildSymbols.Add(child);
422
                    else
423
                        childList[child.ParentAt - 1].ChildSymbols.Add(child);
424
                }
425
            }
426
            if (!string.IsNullOrEmpty(symbol.CONNECTIONPOINT) && symbol.CONNECTIONPOINT != "None")
427
            {
428
                // 현재 부모 Symbol에 자식 Connector까지 들어가 있음
429
                string[] connectionArray = symbol.CONNECTIONPOINT.Split(new char[] { '/' });
430
                string[] array = symbol.CONNECTIONPOINT.Split(new char[] { '/' });
431
                for (int i = 0; i < array.Length; i++)
432
                {
433
                    string[] arrConn = array[i].Split(new char[] { ',' });
434
                    int connIndex = Convert.ToInt32(arrConn[3]);
435
                    if (connIndex != 0)
436
                    {
437
                        childList[connIndex - 1].Connectors.Add(symbol.CONNECTORS[i]);
438
                        symbol.CONNECTORS[i].Index = connIndex;
439
                    }
440
                }
441
            }
442
        }
443
        #endregion
444

  
445
        public Symbol GetSymbolByUID(string uid)
446
        {
447
            return SYMBOLS.Find(x => x.UID == uid);
448
        }
449

  
450
        public Line GetLineByUID(string uid)
451
        {
452
            return LINES.Find(x => x.UID == uid);
453
        }
454
    }
455
}
DTI_PID/BaseModel/Model/EndBreak.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 Converter.BaseModel
8
{
9
    public class EndBreak : Symbol
10
    {
11
        
12
    }
13
}
DTI_PID/BaseModel/Model/Equipment.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 Converter.BaseModel
8
{
9
    public class Equipment : Symbol
10
    {
11
        
12
    }
13
}
DTI_PID/BaseModel/Model/Line.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 Converter.BaseModel
8
{
9
    public class Line
10
    {
11
        private string _OWNER;
12
        private string _UID;
13
        private string _TYPEUID;
14
        private string _STARTPOINT;
15
        private string _ENDPOINT;
16
        private string _TYPE;
17
        private string _AREA;
18
        private string _THICKNESS;
19
        private List<Connector> _CONNECTORS = new List<Connector>();
20
        private SPPIDLineInfo _SPPID;
21

  
22
        public string OWNER { get => _OWNER; set => _OWNER = value; }
23
        public string UID { get => _UID; set => _UID = value; }
24
        public string STARTPOINT { get => _STARTPOINT; set => _STARTPOINT = value; }
25
        public string ENDPOINT { get => _ENDPOINT; set => _ENDPOINT = value; }
26
        public string TYPE { get => _TYPE; set => _TYPE = value; }
27
        public string AREA { get => _AREA; set => _AREA = value; }
28
        public string THICKNESS { get => _THICKNESS; set => _THICKNESS = value; }
29
        public List<Connector> CONNECTORS { get => _CONNECTORS; set => _CONNECTORS = value; }
30
        public string TYPEUID { get => _TYPEUID; set => _TYPEUID = value; }
31
        public SPPIDLineInfo SPPID { get => _SPPID; set => _SPPID = value; }
32
    }
33
}
DTI_PID/BaseModel/Model/LineNumber.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 Converter.BaseModel
8
{
9
    public class LineNumber
10
    {
11
        private string _UID;
12
        private string _TEXT;
13
        private string _LOCATION;
14
        private string _WIDTH;
15
        private string _HEIGHT;
16
        private double _ANGLE;
17
        private string _AREA;
18
        private string _CONNLINE;
19
        private string _SCENE;
20
        private List<LineRun> _RUNS = new List<LineRun>();
21
        private List<Property> _PROPERTIES = new List<Property>();
22
        private List<Attribute> _ATTRIBUTES = new List<Attribute>();
23
        private SPPIDSymbolInfo _SPPID;
24
        public string UID { get => _UID; set => _UID = value; }
25
        public string TEXT { get => _TEXT; set => _TEXT = value; }
26
        public string LOCATION { get => _LOCATION; set => _LOCATION = value; }
27
        public string WIDTH { get => _WIDTH; set => _WIDTH = value; }
28
        public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; }
29
        public double ANGLE
30
        {
31
            get
32
            {
33
                return _ANGLE;
34
            }
35
            set
36
            {
37
                if (value == 1.57)
38
                    value = 90 * Math.PI / 180;
39
                else if (value == 3.14)
40
                    value = Math.PI;
41
                else if (value == 4.71)
42
                    value = 270 * Math.PI / 180;
43

  
44
                _ANGLE = value;
45
            }
46
        }
47
        public string AREA { get => _AREA; set => _AREA = value; }
48
        public List<LineRun> RUNS { get => _RUNS; set => _RUNS = value; }
49
        public List<Property> PROPERTIES { get => _PROPERTIES; set => _PROPERTIES = value; }
50
        public List<Attribute> ATTRIBUTES { get => _ATTRIBUTES; set => _ATTRIBUTES = value; }
51
        public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; }
52
        public string CONNLINE { get => _CONNLINE; set => _CONNLINE = value; }
53

  
54
        public string SCENE
55
        {
56
            get
57
            {
58
                return _SCENE;
59
            }
60
            set
61
            {
62
                string[] split = value.Split(',');
63
                X1 = Convert.ToDouble(split[0]);
64
                Y1 = Convert.ToDouble(split[1]);
65
                X2 = X1 + Convert.ToDouble(split[2]);
66
                Y2 = Y1 + Convert.ToDouble(split[3]);
67
            }
68
        }
69
        public double X1 { get; set; }
70
        public double X2 { get; set; }
71
        public double Y1 { get; set; }
72
        public double Y2 { get; set; }
73

  
74
        public SPPIDLabelLocationInfo SPPIDLabelLocation { get; set; }
75
    }
76
}
DTI_PID/BaseModel/Model/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 Converter.BaseModel
8
{
9
    public class Note
10
    {
11
        private string _UID;
12
        private string _ATTRIBUTEVALUE;
13
        private string _NAME;
14
        private string _LOCATION;
15
        private string _VALUE;
16
        private double _ANGLE;
17
        private string _WIDTH;
18
        private string _HEIGHT;
19
        private string _AREA;
20
        private string _SCENE;
21
        private SPPIDSymbolInfo _SPPID;
22

  
23
        public string UID { get => _UID; set => _UID = value; }
24
        public string ATTRIBUTEVALUE { get => _ATTRIBUTEVALUE; set => _ATTRIBUTEVALUE = value; }
25
        public string NAME { get => _NAME; set => _NAME = value; }
26
        public string LOCATION { get => _LOCATION; set => _LOCATION = value; }
27
        public string VALUE { get => _VALUE; set => _VALUE = value; }
28
        public double ANGLE
29
        {
30
            get
31
            {
32
                return _ANGLE;
33
            }
34
            set
35
            {
36
                if (value == 1.57)
37
                    value = 90 * Math.PI / 180;
38
                else if (value == 3.14)
39
                    value = Math.PI;
40
                else if (value == 4.71)
41
                    value = 270 * Math.PI / 180;
42

  
43
                _ANGLE = value;
44
            }
45
        }
46
        public string WIDTH { get => _WIDTH; set => _WIDTH = value; }
47
        public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; }
48
        public string AREA { get => _AREA; set => _AREA = value; }
49
        public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; }
50

  
51
        public string SCENE
52
        {
53
            get
54
            {
55
                return _SCENE;
56
            }
57
            set
58
            {
59
                string[] split = value.Split(',');
60
                X1 = Convert.ToDouble(split[0]);
61
                Y1 = Convert.ToDouble(split[1]);
62
                X2 = X1 + Convert.ToDouble(split[2]);
63
                Y2 = Y1 + Convert.ToDouble(split[3]);
64
            }
65
        }
66
        public double X1 { get; set; }
67
        public double X2 { get; set; }
68
        public double Y1 { get; set; }
69
        public double Y2 { get; set; }
70
        public SPPIDLabelLocationInfo SPPIDLabelLocation { get; set; }
71
    }
72
}
DTI_PID/BaseModel/Model/Other/Association.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 Converter.BaseModel
8
{
9
    public class Association
10
    {
11
        private string _TYPE;
12
        private string _VALUE;
13

  
14
        public string TYPE { get => _TYPE; set => _TYPE = value; }
15
        public string VALUE { get => _VALUE; set => _VALUE = value; }
16
    }
17
}
DTI_PID/BaseModel/Model/Other/Attribute.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 Converter.BaseModel
8
{
9
    public class Attribute
10
    {
11
        private string _UID;
12
        private string _LENGTH;
13
        private string _EXPRESSION;
14
        private string _DISPLAYATTRIBUTE;
15
        private string _ATTRIBUTETYPE;
16
        private string _ATTRIBUTE;
17
        private string _VALUE;
18
        private string _ATTRAT;
19

  
20
        public string UID { get => _UID; set => _UID = value; }
21
        public string LENGTH { get => _LENGTH; set => _LENGTH = value; }
22
        public string EXPRESSION { get => _EXPRESSION; set => _EXPRESSION = value; }
23
        public string DISPLAYATTRIBUTE { get => _DISPLAYATTRIBUTE; set => _DISPLAYATTRIBUTE = value; }
24
        public string ATTRIBUTETYPE { get => _ATTRIBUTETYPE; set => _ATTRIBUTETYPE = value; }
25
        public string ATTRIBUTE { get => _ATTRIBUTE; set => _ATTRIBUTE = value; }
26
        public string VALUE { get => _VALUE; set => _VALUE = value; }
27
        public string ATTRAT { get => _ATTRAT; set => _ATTRAT = value; }
28
    }
29
}
DTI_PID/BaseModel/Model/Other/Connector.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 Converter.BaseModel
8
{
9
    public class Connector
10
    {
11
        private string _UID;
12
        private int _CONNECTED_AT;
13
        private string _CONNECTEDITEM;
14
        private string _CONNECTPOINT;
15
        private string _SCENECONNECTPOINT;
16

  
17
        public string UID { get => _UID; set => _UID = value; }
18
        public int CONNECTED_AT { get => _CONNECTED_AT; set => _CONNECTED_AT = value; }
19
        public string CONNECTEDITEM { get => _CONNECTEDITEM; set => _CONNECTEDITEM = value; }
20
        public string CONNECTPOINT { get => _CONNECTPOINT; set => _CONNECTPOINT = value; }
21
        public string SCENECONNECTPOINT { get => _SCENECONNECTPOINT; set => _SCENECONNECTPOINT = value; }
22

  
23
        public int Index { get; set; }
24
    }
25
}
DTI_PID/BaseModel/Model/Other/LineNumberRun.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 Converter.BaseModel
8
{
9
    public class LineRun
10
    {
11
        private string _TYPE;
12
        private List<object> _RUNITEMS = new List<object>();
13

  
14
        public string TYPE { get => _TYPE; set => _TYPE = value; }
15
        public List<object> RUNITEMS { get => _RUNITEMS; set => _RUNITEMS = value; }
16
    }
17
}
DTI_PID/BaseModel/Model/Other/Property.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 Converter.BaseModel
8
{
9
    public class Property
10
    {
11
        private string _UID;
12
        private string _LENGTH;
13
        private string _EXPRESSION;
14
        private string _DISPLAYATTRIBUTE;
15
        private string _ATTRIBUTETYPE;
16
        private string _ATTRIBUTE;
17
        private string _VALUE;
18

  
19
        public string UID { get => _UID; set => _UID = value; }
20
        public string LENGTH { get => _LENGTH; set => _LENGTH = value; }
21
        public string EXPRESSION { get => _EXPRESSION; set => _EXPRESSION = value; }
22
        public string DISPLAYATTRIBUTE { get => _DISPLAYATTRIBUTE; set => _DISPLAYATTRIBUTE = value; }
23
        public string ATTRIBUTETYPE { get => _ATTRIBUTETYPE; set => _ATTRIBUTETYPE = value; }
24
        public string ATTRIBUTE { get => _ATTRIBUTE; set => _ATTRIBUTE = value; }
25
        public string VALUE { get => _VALUE; set => _VALUE = value; }
26
    }
27
}
DTI_PID/BaseModel/Model/SPPID/SPPIDLabelLocationInfo.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 Converter.BaseModel
8
{
9
    public class SPPIDLabelLocationInfo
10
    {
11
        public double X1 { get; set; }
12
        public double X2 { get; set; }
13
        public double Y1 { get; set; }
14
        public double Y2 { get; set; }
15
    }
16
}
DTI_PID/BaseModel/Model/SPPID/SPPIDLineInfo.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6

  
7

  
8
namespace Converter.BaseModel
9
{
10
    public class SPPIDLineInfo
11
    {
12
        public string MAPPINGNAME { get; set; }
13
        public double START_X { get; set; }
14
        public double START_Y { get; set; }
15
        public double END_X { get; set; }
16
        public double END_Y { get; set; }
17
        public string ModelItemId { get; set; }
18
    }
19
}
DTI_PID/BaseModel/Model/SPPID/SPPIDSymbolInfo.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 Converter.BaseModel
8
{
9
    public class SPPIDSymbolInfo
10
    {
11
        public string MAPPINGNAME { get; set; }
12
        public double ORIGINAL_X { get; set; }
13
        public double ORIGINAL_Y { get; set; }
14
        public string RepresentationId { get; set; }
15
    }
16
}
DTI_PID/BaseModel/Model/Symbol.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 Converter.BaseModel
8
{
9
    public class Symbol
10
    {
11
        private string _UID;
12
        private string _DBUID;
13
        private string _NAME;
14
        private List<Association> _ASSOCIATIONS = new List<Association>();
15
        private string _TYPE;
16
        private string _OWNER;
17
        private string _ORIGINALPOINT;
18
        private List<Connector> _CONNECTOR = new List<Connector>();
19
        private string _CONNECTIONPOINT;
20
        private string _LOCATION;
21
        private string _SIZE;
22
        private double _ANGLE;
23
        private string _PARENT;
24
        private string _CHILD;
25
        private string _HASINSTRUMENTLABEL;
26
        private string _AREA;
27
        private int _FLIP;
28
        private List<Property> _PROPERTIES = new List<Property>();
29
        private List<Attribute> _ATTRIBUTES = new List<Attribute>();
30
        private int _CURRENTPOINTMODEINDEX;
31
        private List<ChildSymbol> _ChildSymbols = new List<ChildSymbol>();
32
        private SPPIDSymbolInfo _SPPID;
33

  
34
        public string UID { get => _UID; set => _UID = value; }
35
        public string NAME { get => _NAME; set => _NAME = value; }
36
        public List<Association> ASSOCIATIONS { get => _ASSOCIATIONS; set => _ASSOCIATIONS = value; }
37
        public string TYPE { get => _TYPE; set => _TYPE = value; }
38
        public string OWNER { get => _OWNER; set => _OWNER = value; }
39
        public string ORIGINALPOINT { get => _ORIGINALPOINT; set => _ORIGINALPOINT = value; }
40
        public List<Connector> CONNECTORS { get => _CONNECTOR; set => _CONNECTOR = value; }
41
        public string CONNECTIONPOINT { get => _CONNECTIONPOINT; set => _CONNECTIONPOINT = value; }
42
        public string LOCATION { get => _LOCATION; set => _LOCATION = value; }
43
        public string SIZE { get => _SIZE; set => _SIZE = value; }
44
        public double ANGLE
45
        {
46
            get
47
            {
48
                return _ANGLE;
49
            }
50
            set
51
            {
52
                if (value == 1.57)
53
                    value = 90 * Math.PI / 180;
54
                else if (value == 3.14)
55
                    value = Math.PI;
56
                else if (value == 4.71)
57
                    value = 270 * Math.PI / 180;
58

  
59
                _ANGLE = value;
60
            }
61
        }
62
        public string PARENT { get => _PARENT; set => _PARENT = value; }
63
        public string CHILD { get => _CHILD; set => _CHILD = value; }
64
        public string HASINSTRUMENTLABEL { get => _HASINSTRUMENTLABEL; set => _HASINSTRUMENTLABEL = value; }
65
        public string AREA { get => _AREA; set => _AREA = value; }
66
        public int FLIP { get => _FLIP; set => _FLIP = value; }
67
        public List<Property> PROPERTIES { get => _PROPERTIES; set => _PROPERTIES = value; }
68
        public List<Attribute> ATTRIBUTES { get => _ATTRIBUTES; set => _ATTRIBUTES = value; }
69
        public int CURRENTPOINTMODEINDEX { get => _CURRENTPOINTMODEINDEX; set => _CURRENTPOINTMODEINDEX = value; }
70
        public List<ChildSymbol> ChildSymbols { get => _ChildSymbols; set => _ChildSymbols = value; }
71
        public string DBUID { get => _DBUID; set => _DBUID = value; }
72
        public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; }
73
    }
74
}
DTI_PID/BaseModel/Model/Text.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 Converter.BaseModel
8
{
9
    public class Text
10
    {
11
        private string _UID;
12
        private string _OWNER;
13
        private string _ATTRIBUTEVALUE;
14
        private string _NAME;
15
        private string _LOCATION;
16
        private string _VALUE;
17
        private double _ANGLE;
18
        private string _WIDTH;
19
        private string _HEIGHT;
20
        private string _AREA;
21
        private string _SCENE;
22
        private SPPIDSymbolInfo _SPPID;
23
        private bool _ASSOCIATION;
24

  
25
        public string UID { get => _UID; set => _UID = value; }
26
        public string ATTRIBUTEVALUE { get => _ATTRIBUTEVALUE; set => _ATTRIBUTEVALUE = value; }
27
        public string NAME { get => _NAME; set => _NAME = value; }
28
        public string LOCATION { get => _LOCATION; set => _LOCATION = value; }
29
        public string VALUE { get => _VALUE; set => _VALUE = value; }
30
        public double ANGLE
31
        {
32
            get
33
            {
34
                return _ANGLE;
35
            }
36
            set
37
            {
38
                if (value == 1.57)
39
                    value = 90 * Math.PI / 180;
40
                else if (value == 3.14)
41
                    value = Math.PI;
42
                else if (value == 4.71)
43
                    value = 270 * Math.PI / 180;
44

  
45
                _ANGLE = value;
46
            }
47
        }
48
        public string WIDTH { get => _WIDTH; set => _WIDTH = value; }
49
        public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; }
50
        public string AREA { get => _AREA; set => _AREA = value; }
51
        public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; }
52
        public bool ASSOCIATION { get => _ASSOCIATION; set => _ASSOCIATION = value; }
53
        public string OWNER { get => _OWNER; set => _OWNER = value; }
54

  
55
        public string SCENE
56
        {
57
            get
58
            {
59
                return _SCENE;
60
            }
61
            set
62
            {
63
                string[] split = value.Split(',');
64
                X1 = Convert.ToDouble(split[0]);
65
                Y1 = Convert.ToDouble(split[1]);
66
                X2 = X1 + Convert.ToDouble(split[2]);
67
                Y2 = Y1 + Convert.ToDouble(split[3]);
68
            }
69
        }
70
        public double X1 { get; set; }
71
        public double X2 { get; set; }
72
        public double Y1 { get; set; }
73
        public double Y2 { get; set; }
74
        public SPPIDLabelLocationInfo SPPIDLabelLocation { get; set; }
75
    }
76
}
DTI_PID/BaseModel/Model/TrimLine.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 Converter.BaseModel
8
{
9
    public class TrimLine
10
    {
11
        private string _UID;
12
        private string _TEXT;
13
        private string _LOCATION;
14
        private string _WIDTH;
15
        private string _HEIGHT;
16
        private double _ANGLE;
17
        private string _AREA;
18
        private List<LineRun> _RUNS = new List<LineRun>();
19
        private List<Property> _PROPERTIES = new List<Property>();
20
        private List<Attribute> _ATTRIBUTES = new List<Attribute>();
21

  
22
        public string UID { get => _UID; set => _UID = value; }
23
        public string TEXT { get => _TEXT; set => _TEXT = value; }
24
        public string LOCATION { get => _LOCATION; set => _LOCATION = value; }
25
        public string WIDTH { get => _WIDTH; set => _WIDTH = value; }
26
        public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; }
27
        public double ANGLE { get => _ANGLE; set => _ANGLE = value; }
28
        public string AREA { get => _AREA; set => _AREA = value; }
29
        public List<LineRun> RUNS { get => _RUNS; set => _RUNS = value; }
30
        public List<Property> PROPERTIES { get => _PROPERTIES; set => _PROPERTIES = value; }
31
        public List<Attribute> ATTRIBUTES { get => _ATTRIBUTES; set => _ATTRIBUTES = value; }
32
    }
33
}
DTI_PID/BaseModel/Project_DB.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using System.Globalization;
7
using System.Data.SQLite;
8
using System.Data;
9

  
10
namespace Converter.BaseModel
11
{
12
    public class Project_DB
13
    {
14
        const string SPPID_DB_INFO_TABLE = "T_SPPID_CONNECTION_INFO";
15
        const string SPPID_SYMBOL_MAPPING_TABLE = "T_SPPID_SYMBOL_MAPPING";
16
        const string SPPID_ATTRIBUTE_MAPPING_TABLE = "T_SPPID_ATTRIBUTE_MAPPING";
17
        const string SPPID_ETC_SETTING_TABLE = "T_SPPID_ETC_SETTING_TABLE";
18
        const string SPPID_LABEL_LOCATION_TABLE = "T_SPPID_LABEL_LOCATION";
19

  
20
        const string LineProperties_TABLE = "LineProperties";
21
        const string LineTypes_TABLE = "LineTypes";
22
        const string SymbolType_TABLE = "SymbolType";
23
        const string SymbolAttribute_TABLE = "SymbolAttribute";
24
        const string Symbol_TABLE = "Symbol";
25

  
26
        public static bool ConnTestAndCreateTable()
27
        {
28
            bool result = false;
29
            Project_Info projectInfo = Project_Info.GetInstance();
30
            SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, @"Data Source = {0}", projectInfo.DBFilePath));
31
            try
32
            {
33
                connection.Open();
34
                if (connection.State == ConnectionState.Open)
35
                {
36
                    CreateTable(connection);
37
                    result = true;
38
                }
39
                connection.Close();
40
            }
41
            catch (Exception ex)
42
            {
43

  
44
            }
45
            finally
46
            {
47
                connection.Dispose();
48
            }
49

  
50
            return result;
51
        }
52

  
53
        public static bool SaveSPPID_DB_INFO(string jsonString)
54
        {
55
            Project_Info projectInfo = Project_Info.GetInstance();
56
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
57
            {
58

  
59
                try
60
                {
61
                    connection.Open();
62
                    using (SQLiteCommand cmd = connection.CreateCommand())
63
                    {
64
                        cmd.CommandText = string.Format("DELETE FROM {0}", SPPID_DB_INFO_TABLE);
65
                        cmd.ExecuteNonQuery();
66

  
67
                        cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString)", SPPID_DB_INFO_TABLE);
68
                        cmd.Parameters.AddWithValue("@jsonString", jsonString);
69
                        cmd.ExecuteNonQuery();
70
                    }
71
                    connection.Close();
72
                }
73
                catch (Exception ex)
74
                {
75
                    return false;
76
                }
77
                finally
78
                {
79
                    connection.Dispose();
80
                }
81
            }
82

  
83
            return true;
84
        }
85

  
86
        public static DataTable SelectSPPID_DB_INFO()
87
        {
88
            DataTable dt = new DataTable();
89
            Project_Info projectInfo = Project_Info.GetInstance();
90
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
91
            {
92
                try
93
                {
94
                    connection.Open();
95
                    using (SQLiteCommand cmd = connection.CreateCommand())
96
                    {
97
                        cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_DB_INFO_TABLE);
98
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
99
                            dt.Load(dr);
100
                    }
101
                    connection.Close();
102
                }
103
                catch (Exception ex)
104
                {
105

  
106
                }
107
                finally
108
                {
109
                    connection.Dispose();
110
                }
111
            }
112

  
113
            return dt;
114
        }
115

  
116
        public static bool SaveETCSetting(string jsonString)
117
        {
118
            Project_Info projectInfo = Project_Info.GetInstance();
119
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
120
            {
121

  
122
                try
123
                {
124
                    connection.Open();
125
                    using (SQLiteCommand cmd = connection.CreateCommand())
126
                    {
127
                        cmd.CommandText = string.Format("DELETE FROM {0}", SPPID_ETC_SETTING_TABLE);
128
                        cmd.ExecuteNonQuery();
129

  
130
                        cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString)", SPPID_ETC_SETTING_TABLE);
131
                        cmd.Parameters.AddWithValue("@jsonString", jsonString);
132
                        cmd.ExecuteNonQuery();
133
                    }
134
                    connection.Close();
135
                }
136
                catch (Exception ex)
137
                {
138
                    return false;
139
                }
140
                finally
141
                {
142
                    connection.Dispose();
143
                }
144
            }
145

  
146
            return true;
147
        }
148

  
149
        public static DataTable SelectETCSetting()
150
        {
151
            DataTable dt = new DataTable();
152
            Project_Info projectInfo = Project_Info.GetInstance();
153
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
154
            {
155
                try
156
                {
157
                    connection.Open();
158
                    using (SQLiteCommand cmd = connection.CreateCommand())
159
                    {
160
                        cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_ETC_SETTING_TABLE);
161
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
162
                            dt.Load(dr);
163
                    }
164
                    connection.Close();
165
                }
166
                catch (Exception ex)
167
                {
168

  
169
                }
170
                finally
171
                {
172
                    connection.Dispose();
173
                }
174
            }
175

  
176
            return dt;
177
        }
178

  
179
        private static void CreateTable(SQLiteConnection connection)
180
        {
181
            using (SQLiteCommand cmd = connection.CreateCommand())
182
            {
183
                cmd.CommandText = "SELECT NAME FROM sqlite_master WHERE type='table'";
184
                using (SQLiteDataReader dr = cmd.ExecuteReader())
185
                using (DataTable dt = new DataTable())
186
                {
187
                    dt.Load(dr);
188

  
189
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_DB_INFO_TABLE)).Length == 0)
190
                    {
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

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