개정판 fb2d9638
dev issue #1006 : VendorPackageModeling 완료
Change-Id: I20455e3c36c0cc0cfebc37932f6a5aa0ba8cca11
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
88 | 88 |
Log.Write("Start Modeling"); |
89 | 89 |
SplashScreenManager.ShowForm(typeof(SPPIDSplashScreen), true, true); |
90 | 90 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetParent, (IntPtr)radApp.HWnd); |
91 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 22);
|
|
91 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 23);
|
|
92 | 92 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText); |
93 | 93 |
|
94 |
// VendorPackage Modeling |
|
95 |
RunVendorPackageModeling(); |
|
94 | 96 |
// Equipment Modeling |
95 | 97 |
RunEquipmentModeling(); |
96 | 98 |
// Symbol Modeling |
... | ... | |
182 | 184 |
} |
183 | 185 |
} |
184 | 186 |
|
187 |
private void RunVendorPackageModeling() |
|
188 |
{ |
|
189 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.VendorPackages.Count); |
|
190 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "VendorPackages Modeling"); |
|
191 |
foreach (VendorPackage item in document.VendorPackages) |
|
192 |
{ |
|
193 |
try |
|
194 |
{ |
|
195 |
VendorPackageModeling(item); |
|
196 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
197 |
} |
|
198 |
catch (Exception ex) |
|
199 |
{ |
|
200 |
Log.Write("Error in RunVendorPackageModeling"); |
|
201 |
Log.Write("UID : " + item.UID); |
|
202 |
Log.Write(ex.Message); |
|
203 |
Log.Write(ex.StackTrace); |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
185 | 207 |
private void RunEquipmentModeling() |
186 | 208 |
{ |
187 | 209 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.Equipments.Count); |
... | ... | |
1811 | 1833 |
if (connector != null) |
1812 | 1834 |
{ |
1813 | 1835 |
Equipment connEquipment = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM) as Equipment; |
1836 |
VendorPackage connVendorPackage = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM) as VendorPackage; |
|
1814 | 1837 |
if (connEquipment != null) |
1815 | 1838 |
{ |
1816 | 1839 |
if (string.IsNullOrEmpty(connEquipment.SPPID.RepresentationId)) |
... | ... | |
1820 | 1843 |
{ |
1821 | 1844 |
targetItem = dataSource.GetSymbol(connEquipment.SPPID.RepresentationId); |
1822 | 1845 |
if (targetItem != null) |
1823 |
{ |
|
1824 | 1846 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle, TargetItem: targetItem); |
1825 |
} |
|
1826 | 1847 |
else |
1827 |
{ |
|
1828 | 1848 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle); |
1829 |
} |
|
1830 | 1849 |
} |
1831 | 1850 |
else |
1832 | 1851 |
{ |
1833 | 1852 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle); |
1834 | 1853 |
} |
1835 | 1854 |
} |
1855 |
else if (connVendorPackage != null) |
|
1856 |
{ |
|
1857 |
if (!string.IsNullOrEmpty(connVendorPackage.SPPID.RepresentationId)) |
|
1858 |
{ |
|
1859 |
targetItem = dataSource.GetSymbol(connVendorPackage.SPPID.RepresentationId); |
|
1860 |
if (targetItem != null) |
|
1861 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle, TargetItem: targetItem); |
|
1862 |
else |
|
1863 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle); |
|
1864 |
} |
|
1865 |
} |
|
1836 | 1866 |
else |
1837 | 1867 |
{ |
1838 | 1868 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle); |
... | ... | |
1859 | 1889 |
ReleaseCOMObjects(_LMSymbol); |
1860 | 1890 |
} |
1861 | 1891 |
|
1892 |
private void VendorPackageModeling(VendorPackage vendorPackage) |
|
1893 |
{ |
|
1894 |
ETCSetting setting = ETCSetting.GetInstance(); |
|
1895 |
if (!string.IsNullOrEmpty(setting.VendorPackageSymbolPath)) |
|
1896 |
{ |
|
1897 |
string symbolPath = setting.VendorPackageSymbolPath; |
|
1898 |
double x = vendorPackage.SPPID.ORIGINAL_X; |
|
1899 |
double y = vendorPackage.SPPID.ORIGINAL_Y; |
|
1900 |
|
|
1901 |
LMSymbol symbol = _placement.PIDPlaceSymbol(symbolPath, x, y); |
|
1902 |
if (symbol != null) |
|
1903 |
{ |
|
1904 |
symbol.Commit(); |
|
1905 |
vendorPackage.SPPID.RepresentationId = symbol.AsLMRepresentation().Id; |
|
1906 |
} |
|
1907 |
|
|
1908 |
ReleaseCOMObjects(symbol); |
|
1909 |
symbol = null; |
|
1910 |
} |
|
1911 |
} |
|
1912 |
|
|
1862 | 1913 |
/// <summary> |
1863 | 1914 |
/// 첫 진입점 |
1864 | 1915 |
/// </summary> |
DTI_PID/SPPIDConverter/BaseModel/Document.cs | ||
---|---|---|
27 | 27 |
private List<EndBreak> _EndBreaks = new List<EndBreak>(); |
28 | 28 |
private List<SpecBreak> _SpecBreaks = new List<SpecBreak>(); |
29 | 29 |
private List<Equipment> _Equipments = new List<Equipment>(); |
30 |
private List<VendorPackage> _VendorPackages = new List<VendorPackage>(); |
|
30 | 31 |
private bool _Enable; |
31 | 32 |
private bool _Validation; |
32 | 33 |
private bool _MappingValidation; |
... | ... | |
44 | 45 |
public List<EndBreak> EndBreaks { get => _EndBreaks; set => _EndBreaks = value; } |
45 | 46 |
public List<SpecBreak> SpecBreaks { get => _SpecBreaks; set => _SpecBreaks = value; } |
46 | 47 |
public List<Equipment> Equipments { get => _Equipments; set => _Equipments = value; } |
48 |
public List<VendorPackage> VendorPackages { get => _VendorPackages; set => _VendorPackages = value; } |
|
47 | 49 |
public string DWGNAME { get => _DWGNAME; set => _DWGNAME = value; } |
48 | 50 |
public string SIZE |
49 | 51 |
{ |
... | ... | |
96 | 98 |
SetLine(xml.Element("LINEINFOS")); |
97 | 99 |
SetLineNumber(xml.Element("LINENOS")); |
98 | 100 |
SetTrimLine(xml.Element("TRIMLINENOS")); |
101 |
SetVendorPackage(xml.Element("VENDORS")); |
|
99 | 102 |
|
100 | 103 |
SetAllConnectors(); |
101 | 104 |
Enable = true; |
... | ... | |
359 | 362 |
} |
360 | 363 |
} |
361 | 364 |
|
365 |
private void SetVendorPackage(XElement node) |
|
366 |
{ |
|
367 |
foreach (XElement item in node.Elements("VENDOR")) |
|
368 |
{ |
|
369 |
VendorPackage vendorPackage = new VendorPackage() |
|
370 |
{ |
|
371 |
UID = item.Element("UID").Value, |
|
372 |
AREA = item.Element("AREA").Value, |
|
373 |
POINT = item.Element("POINT").Value |
|
374 |
}; |
|
375 |
_VendorPackages.Add(vendorPackage); |
|
376 |
} |
|
377 |
} |
|
378 |
|
|
362 | 379 |
private void SetAssociations(XElement node, List<Association> associations) |
363 | 380 |
{ |
364 | 381 |
foreach (XElement item in node.Elements("ASSOCIATION")) |
DTI_PID/SPPIDConverter/BaseModel/VendorPackage.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using Converter.SPPID.Util; |
|
7 |
|
|
8 |
namespace Converter.BaseModel |
|
9 |
{ |
|
10 |
public class VendorPackage |
|
11 |
{ |
|
12 |
string _UID; |
|
13 |
string _AREA; |
|
14 |
string _POINT; |
|
15 |
public List<double[]> POINTS; |
|
16 |
|
|
17 |
private SPPIDSymbolInfo _SPPID = new SPPIDSymbolInfo(); |
|
18 |
|
|
19 |
public double[] CenterPoint; |
|
20 |
public string UID { get => _UID; set => _UID = value; } |
|
21 |
public string AREA { get => _AREA; set => _AREA = value; } |
|
22 |
public string POINT |
|
23 |
{ |
|
24 |
get { return _POINT; } |
|
25 |
set |
|
26 |
{ |
|
27 |
_POINT = value; |
|
28 |
string[] split = _POINT.Split(new char[] { '/' }); |
|
29 |
POINTS = new List<double[]>(); |
|
30 |
double allX = 0; |
|
31 |
double allY = 0; |
|
32 |
|
|
33 |
foreach (var item in split) |
|
34 |
{ |
|
35 |
string[] sPoint = item.Split(new char[] { ',' }); |
|
36 |
POINTS.Add(new double[] { Convert.ToDouble(sPoint[0]), Convert.ToDouble(sPoint[1]) }); |
|
37 |
allX += Convert.ToDouble(sPoint[0]); |
|
38 |
allY += Convert.ToDouble(sPoint[1]); |
|
39 |
} |
|
40 |
|
|
41 |
CenterPoint = new double[] { allX / POINTS.Count, allY / POINTS.Count }; |
|
42 |
} |
|
43 |
} |
|
44 |
public SPPIDSymbolInfo SPPID { get => _SPPID; set => _SPPID = value; } |
|
45 |
} |
|
46 |
} |
DTI_PID/SPPIDConverter/DB/Project_DB.cs | ||
---|---|---|
1698 | 1698 |
{ |
1699 | 1699 |
cmd.Parameters.Clear(); |
1700 | 1700 |
cmd.CommandText = string.Format(@" |
1701 |
IF EXISTS (SELECT * FROM {0} WHERE UID = '{1}') |
|
1701 |
IF EXISTS (SELECT * FROM {0} WHERE ID2_DRAWING_UID = '{1}')
|
|
1702 | 1702 |
UPDATE {0} SET PATH = @PATH, DRAWINGNUMBER = @DRAWINGNUMBER, DRAWINGNAME = @DRAWINGNAME WHERE ID2_DRAWING_UID = @ID2_DRAWING_UID |
1703 | 1703 |
ELSE |
1704 | 1704 |
INSERT INTO {0} (ID2_DRAWING_UID, PATH, DRAWINGNUMBER, DRAWINGNAME) VALUES (@ID2_DRAWING_UID, @PATH, @DRAWINGNUMBER, @DRAWINGNAME)", SPPID_DRAWING_INFO, document.UID); |
DTI_PID/SPPIDConverter/SPPIDConverter.csproj | ||
---|---|---|
130 | 130 |
</ItemGroup> |
131 | 131 |
<ItemGroup> |
132 | 132 |
<Compile Include="AutoModeling.cs" /> |
133 |
<Compile Include="BaseModel\VendorPackage.cs" /> |
|
133 | 134 |
<Compile Include="Form\ID2DBSetting.cs"> |
134 | 135 |
<SubType>Form</SubType> |
135 | 136 |
</Compile> |
DTI_PID/SPPIDConverter/SPPIDModel/SPPID_Document.cs | ||
---|---|---|
223 | 223 |
item.SPPIDLabelLocation.X2 = Math.Max(x1, x2); |
224 | 224 |
item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2); |
225 | 225 |
} |
226 |
|
|
227 |
foreach (var item in VendorPackages) |
|
228 |
{ |
|
229 |
double x = item.CenterPoint[0]; |
|
230 |
double y = item.CenterPoint[1]; |
|
231 |
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY); |
|
232 |
item.SPPID.ORIGINAL_X = x; |
|
233 |
item.SPPID.ORIGINAL_Y = y; |
|
234 |
} |
|
226 | 235 |
} |
227 | 236 |
|
228 | 237 |
/// <summary> |
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs | ||
---|---|---|
326 | 326 |
if (item.UID == UID) |
327 | 327 |
return item; |
328 | 328 |
} |
329 |
|
|
330 |
foreach (VendorPackage item in document.VendorPackages) |
|
331 |
{ |
|
332 |
if (item.UID == UID) |
|
333 |
return item; |
|
334 |
} |
|
329 | 335 |
} |
330 | 336 |
|
331 | 337 |
return null; |
내보내기 Unified diff