1 |
bca86986
|
gaqhf
|
using System;
|
2 |
|
|
using System.Collections.Generic;
|
3 |
|
|
using System.Linq;
|
4 |
|
|
using System.Text;
|
5 |
|
|
using System.Threading.Tasks;
|
6 |
f1c9dbaa
|
gaqhf
|
using System.Data;
|
7 |
bca86986
|
gaqhf
|
using Converter.BaseModel;
|
8 |
bca81f4c
|
gaqhf
|
using Converter.SPPID.Util;
|
9 |
bca86986
|
gaqhf
|
|
10 |
b8e2644e
|
gaqhf
|
namespace Converter.SPPID.Model
|
11 |
bca86986
|
gaqhf
|
{
|
12 |
|
|
public class SPPID_Document : Document
|
13 |
|
|
{
|
14 |
7e680366
|
gaqhf
|
public SPPID_Document(string xmlPath, DataTable ID2SymbolTypeDT) : base(xmlPath, ID2SymbolTypeDT)
|
15 |
bca86986
|
gaqhf
|
{
|
16 |
f1c9dbaa
|
gaqhf
|
|
17 |
bca86986
|
gaqhf
|
}
|
18 |
88365b05
|
gaqhf
|
|
19 |
39a2a688
|
gaqhf
|
public List<SymbolMapping> SymbolMappings;
|
20 |
4b4dbca9
|
gaqhf
|
public List<ChildSymbolMapping> ChildSymbolMappings;
|
21 |
39a2a688
|
gaqhf
|
public List<LineMapping> LineMappings;
|
22 |
|
|
public List<LineNumberMapping> LineNumberMappings;
|
23 |
1efc25a3
|
gaqhf
|
public List<AttributeMapping> AttributeMappings;
|
24 |
39a2a688
|
gaqhf
|
public ETCSetting ETCSetting;
|
25 |
7e680366
|
gaqhf
|
|
26 |
4d2571ab
|
gaqhf
|
public DataTable SymbolTable { get; set; }
|
27 |
39a2a688
|
gaqhf
|
|
28 |
f1c9dbaa
|
gaqhf
|
public List<Group> GROUPS = new List<Group>();
|
29 |
5dfb8a24
|
gaqhf
|
|
30 |
bca86986
|
gaqhf
|
public string DrawingName { get; set; }
|
31 |
|
|
public string DrawingNumber { get; set; }
|
32 |
|
|
public string Unit { get; set; }
|
33 |
4314b3f3
|
gaqhf
|
public string Template { get; set; }
|
34 |
88bac50c
|
gaqhf
|
public string SPPID_DrawingNumber { get; set; }
|
35 |
|
|
public string SPPID_DrawingName { get; set; }
|
36 |
4f0c0ed6
|
gaqhf
|
public string BulkAttributeName { get; set; }
|
37 |
f947c634
|
gaqhf
|
public void SetSPPIDInfo()
|
38 |
|
|
{
|
39 |
|
|
foreach (var item in SYMBOLS)
|
40 |
|
|
{
|
41 |
39a2a688
|
gaqhf
|
if (item.SPPID == null)
|
42 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
43 |
4b4dbca9
|
gaqhf
|
|
44 |
|
|
foreach (var childSymbol in item.ChildSymbols)
|
45 |
|
|
{
|
46 |
|
|
if (childSymbol.SPPID == null)
|
47 |
|
|
childSymbol.SPPID = new SPPIDSymbolInfo();
|
48 |
|
|
SetChildSymbolSPPIDInfo(childSymbol);
|
49 |
|
|
}
|
50 |
39a2a688
|
gaqhf
|
}
|
51 |
|
|
|
52 |
|
|
foreach (var item in LINES)
|
53 |
|
|
{
|
54 |
|
|
if (item.SPPID == null)
|
55 |
|
|
item.SPPID = new SPPIDLineInfo();
|
56 |
1ba9c671
|
gaqhf
|
}
|
57 |
|
|
|
58 |
|
|
foreach (var item in Equipments)
|
59 |
|
|
{
|
60 |
|
|
if (item.SPPID == null)
|
61 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
foreach (var item in EndBreaks)
|
65 |
|
|
{
|
66 |
|
|
if (item.SPPID == null)
|
67 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
68 |
|
|
}
|
69 |
|
|
|
70 |
53c81765
|
gaqhf
|
foreach (var item in SpecBreaks)
|
71 |
|
|
{
|
72 |
|
|
if (item.SPPID == null)
|
73 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
74 |
|
|
}
|
75 |
|
|
|
76 |
1ba9c671
|
gaqhf
|
foreach (var item in LINENUMBERS)
|
77 |
|
|
{
|
78 |
|
|
if (item.SPPID == null)
|
79 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
foreach (var item in TEXTINFOS)
|
83 |
|
|
{
|
84 |
|
|
if (item.SPPID == null)
|
85 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
foreach (var item in NOTES)
|
89 |
|
|
{
|
90 |
|
|
if (item.SPPID == null)
|
91 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
92 |
|
|
}
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
public void SetSPPIDLocation(double SPPIDDocumentX, double SPPIDDocumentY)
|
96 |
|
|
{
|
97 |
|
|
foreach (var item in SYMBOLS)
|
98 |
|
|
{
|
99 |
|
|
double x = double.NaN;
|
100 |
|
|
double y = double.NaN;
|
101 |
|
|
SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
|
102 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
103 |
06b40010
|
gaqhf
|
|
104 |
1ba9c671
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
105 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
foreach (var item in LINES)
|
109 |
|
|
{
|
110 |
a0e3dca4
|
gaqhf
|
double startX = double.NaN;
|
111 |
|
|
double startY = double.NaN;
|
112 |
39a2a688
|
gaqhf
|
|
113 |
a0e3dca4
|
gaqhf
|
SPPIDUtil.ConvertPointBystring(item.STARTPOINT, ref startX, ref startY);
|
114 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref startX, ref startY, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
115 |
|
|
item.SPPID.START_X = startX;
|
116 |
|
|
item.SPPID.START_Y = startY;
|
117 |
39a2a688
|
gaqhf
|
|
118 |
a0e3dca4
|
gaqhf
|
double endX = double.NaN;
|
119 |
|
|
double endY = double.NaN;
|
120 |
|
|
|
121 |
|
|
SPPIDUtil.ConvertPointBystring(item.ENDPOINT, ref endX, ref endY);
|
122 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref endX, ref endY, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
123 |
|
|
item.SPPID.END_X = endX;
|
124 |
|
|
item.SPPID.END_Y = endY;
|
125 |
|
|
|
126 |
|
|
item.SlopeType = SPPIDUtil.CalcSlope(startX, startY, endX, endY);
|
127 |
39a2a688
|
gaqhf
|
}
|
128 |
809a7640
|
gaqhf
|
|
129 |
|
|
foreach (var item in Equipments)
|
130 |
|
|
{
|
131 |
|
|
double x = double.NaN;
|
132 |
|
|
double y = double.NaN;
|
133 |
|
|
SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
|
134 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
135 |
06b40010
|
gaqhf
|
|
136 |
809a7640
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
137 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
138 |
|
|
}
|
139 |
3165c259
|
gaqhf
|
|
140 |
|
|
foreach (var item in EndBreaks)
|
141 |
|
|
{
|
142 |
|
|
double x = double.NaN;
|
143 |
|
|
double y = double.NaN;
|
144 |
|
|
SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
|
145 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
146 |
3165c259
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
147 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
148 |
|
|
}
|
149 |
10872260
|
gaqhf
|
|
150 |
53c81765
|
gaqhf
|
foreach (var item in SpecBreaks)
|
151 |
|
|
{
|
152 |
|
|
double x = double.NaN;
|
153 |
|
|
double y = double.NaN;
|
154 |
|
|
SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
|
155 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
156 |
|
|
|
157 |
|
|
item.SPPID.ORIGINAL_X = x;
|
158 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
159 |
|
|
}
|
160 |
|
|
|
161 |
10872260
|
gaqhf
|
foreach (var item in LINENUMBERS)
|
162 |
|
|
{
|
163 |
|
|
double x = double.NaN;
|
164 |
|
|
double y = double.NaN;
|
165 |
|
|
SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
|
166 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
167 |
10872260
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
168 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
169 |
1a3a74a8
|
gaqhf
|
|
170 |
|
|
item.SPPIDLabelLocation = new SPPIDLabelLocationInfo();
|
171 |
|
|
double x1 = item.X1;
|
172 |
|
|
double y1 = item.Y1;
|
173 |
|
|
double x2 = item.X2;
|
174 |
|
|
double y2 = item.Y2;
|
175 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
176 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
177 |
1a3a74a8
|
gaqhf
|
item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
|
178 |
|
|
item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
|
179 |
|
|
item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
|
180 |
|
|
item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2);
|
181 |
10872260
|
gaqhf
|
}
|
182 |
6b298450
|
gaqhf
|
|
183 |
|
|
foreach (var item in TEXTINFOS)
|
184 |
|
|
{
|
185 |
|
|
double x = double.NaN;
|
186 |
|
|
double y = double.NaN;
|
187 |
|
|
SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
|
188 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
189 |
6b298450
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
190 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
191 |
1a3a74a8
|
gaqhf
|
|
192 |
|
|
item.SPPIDLabelLocation = new SPPIDLabelLocationInfo();
|
193 |
|
|
double x1 = item.X1;
|
194 |
|
|
double y1 = item.Y1;
|
195 |
|
|
double x2 = item.X2;
|
196 |
|
|
double y2 = item.Y2;
|
197 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
198 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
199 |
1a3a74a8
|
gaqhf
|
item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
|
200 |
|
|
item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
|
201 |
|
|
item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
|
202 |
|
|
item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2);
|
203 |
6b298450
|
gaqhf
|
}
|
204 |
|
|
|
205 |
|
|
foreach (var item in NOTES)
|
206 |
|
|
{
|
207 |
|
|
double x = double.NaN;
|
208 |
|
|
double y = double.NaN;
|
209 |
|
|
SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
|
210 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
211 |
6b298450
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
212 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
213 |
1a3a74a8
|
gaqhf
|
|
214 |
|
|
item.SPPIDLabelLocation = new SPPIDLabelLocationInfo();
|
215 |
|
|
double x1 = item.X1;
|
216 |
|
|
double y1 = item.Y1;
|
217 |
|
|
double x2 = item.X2;
|
218 |
|
|
double y2 = item.Y2;
|
219 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
220 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
221 |
1a3a74a8
|
gaqhf
|
item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
|
222 |
|
|
item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
|
223 |
|
|
item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
|
224 |
|
|
item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2);
|
225 |
6b298450
|
gaqhf
|
}
|
226 |
fb2d9638
|
gaqhf
|
|
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 |
|
|
}
|
235 |
39a2a688
|
gaqhf
|
}
|
236 |
4b4dbca9
|
gaqhf
|
|
237 |
c01ce90b
|
gaqhf
|
/// <summary>
|
238 |
|
|
/// 좌표 보정
|
239 |
|
|
/// </summary>
|
240 |
|
|
public void CoordinateCorrection()
|
241 |
|
|
{
|
242 |
|
|
foreach (Symbol symbol in SYMBOLS)
|
243 |
|
|
{
|
244 |
|
|
if (!symbol.SPPID.IsCorrectionX)
|
245 |
|
|
{
|
246 |
|
|
List<object> group = new List<object>();
|
247 |
|
|
group.Add(symbol);
|
248 |
|
|
FindGroupBySymbolAndSlopeType(symbol, group, SlopeType.VERTICAL);
|
249 |
|
|
|
250 |
|
|
List<Symbol> groupSymbols = (from sym in @group
|
251 |
|
|
where sym.GetType() == typeof(Symbol)
|
252 |
|
|
select sym as Symbol).ToList();
|
253 |
|
|
|
254 |
|
|
// X 좌표만 보정
|
255 |
|
|
Symbol correctionSymbol = groupSymbols.Find(x => x.SPPID.IsCorrectionX);
|
256 |
|
|
double value = symbol.SPPID.ORIGINAL_X;
|
257 |
|
|
if (correctionSymbol == null)
|
258 |
|
|
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref value);
|
259 |
|
|
else
|
260 |
|
|
value = correctionSymbol.SPPID.ORIGINAL_X;
|
261 |
|
|
|
262 |
|
|
foreach (var item in groupSymbols)
|
263 |
|
|
{
|
264 |
|
|
item.SPPID.IsCorrectionX = true;
|
265 |
|
|
item.SPPID.ORIGINAL_X = value;
|
266 |
d9794a6c
|
gaqhf
|
item.SPPID.CorrectionX_GroupSymbols = groupSymbols;
|
267 |
c01ce90b
|
gaqhf
|
}
|
268 |
|
|
}
|
269 |
|
|
|
270 |
|
|
if (!symbol.SPPID.IsCorrectionY)
|
271 |
|
|
{
|
272 |
|
|
List<object> group = new List<object>();
|
273 |
|
|
group.Add(symbol);
|
274 |
|
|
FindGroupBySymbolAndSlopeType(symbol, group, SlopeType.HORIZONTAL);
|
275 |
|
|
|
276 |
|
|
List<Symbol> groupSymbols = (from sym in @group
|
277 |
|
|
where sym.GetType() == typeof(Symbol)
|
278 |
|
|
select sym as Symbol).ToList();
|
279 |
|
|
|
280 |
|
|
// Y 좌표만 보정
|
281 |
|
|
Symbol correctionSymbol = groupSymbols.Find(x => x.SPPID.IsCorrectionY);
|
282 |
|
|
double value = symbol.SPPID.ORIGINAL_Y;
|
283 |
|
|
if (correctionSymbol == null)
|
284 |
|
|
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref value);
|
285 |
|
|
else
|
286 |
|
|
value = correctionSymbol.SPPID.ORIGINAL_Y;
|
287 |
|
|
|
288 |
|
|
foreach (var item in groupSymbols)
|
289 |
|
|
{
|
290 |
|
|
item.SPPID.IsCorrectionY = true;
|
291 |
|
|
item.SPPID.ORIGINAL_Y = value;
|
292 |
d9794a6c
|
gaqhf
|
item.SPPID.CorrectionY_GroupSymbols = groupSymbols;
|
293 |
c01ce90b
|
gaqhf
|
}
|
294 |
|
|
}
|
295 |
|
|
}
|
296 |
a0e3dca4
|
gaqhf
|
|
297 |
|
|
foreach (Line line in LINES)
|
298 |
|
|
{
|
299 |
|
|
double tempX = line.SPPID.START_X;
|
300 |
|
|
double tempY = line.SPPID.START_Y;
|
301 |
|
|
SPPIDUtil.ConvertGridPoint(ref tempX, ref tempY);
|
302 |
|
|
line.SPPID.START_X = tempX;
|
303 |
|
|
line.SPPID.START_Y = tempY;
|
304 |
|
|
|
305 |
|
|
tempX = line.SPPID.END_X;
|
306 |
|
|
tempY = line.SPPID.END_Y;
|
307 |
|
|
SPPIDUtil.ConvertGridPoint(ref tempX, ref tempY);
|
308 |
|
|
line.SPPID.END_X = tempX;
|
309 |
|
|
line.SPPID.END_Y = tempY;
|
310 |
|
|
|
311 |
|
|
if (line.SlopeType == SlopeType.HORIZONTAL)
|
312 |
|
|
line.SPPID.END_Y = line.SPPID.START_Y;
|
313 |
|
|
else if (line.SlopeType == SlopeType.VERTICAL)
|
314 |
|
|
line.SPPID.END_X = line.SPPID.START_X;
|
315 |
|
|
}
|
316 |
c01ce90b
|
gaqhf
|
}
|
317 |
|
|
|
318 |
|
|
private void FindGroupBySymbolAndSlopeType(Symbol symbol, List<object> group, SlopeType searchType)
|
319 |
|
|
{
|
320 |
|
|
foreach (var connector in symbol.CONNECTORS)
|
321 |
|
|
{
|
322 |
|
|
object connectedItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM);
|
323 |
|
|
if (connectedItem != null && connectedItem.GetType() == typeof(Symbol))
|
324 |
|
|
{
|
325 |
|
|
Symbol connSymbol = connectedItem as Symbol;
|
326 |
|
|
SlopeType slopeType = SPPIDUtil.CalcSlope(symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y, connSymbol.SPPID.ORIGINAL_X, connSymbol.SPPID.ORIGINAL_Y);
|
327 |
|
|
if (slopeType == searchType)
|
328 |
|
|
{
|
329 |
|
|
if (!group.Contains(connSymbol))
|
330 |
|
|
{
|
331 |
|
|
group.Add(connSymbol);
|
332 |
|
|
FindGroupBySymbolAndSlopeType(connSymbol, group, searchType);
|
333 |
|
|
}
|
334 |
|
|
}
|
335 |
|
|
}
|
336 |
|
|
else if (connectedItem != null && connectedItem.GetType() == typeof(Line))
|
337 |
|
|
{
|
338 |
|
|
Line connLine = connectedItem as Line;
|
339 |
02480ac1
|
gaqhf
|
|
340 |
1ed39474
|
gaqhf
|
Connector otherConnector = connLine.CONNECTORS.Find(x => x.CONNECTEDITEM != symbol.UID);
|
341 |
f1a7faf9
|
gaqhf
|
int connectorIndex = connLine.CONNECTORS.IndexOf(otherConnector);
|
342 |
02480ac1
|
gaqhf
|
double lineX = double.NaN;
|
343 |
|
|
double lineY = double.NaN;
|
344 |
|
|
// Symbol의 Connector ScenePoint
|
345 |
f1a7faf9
|
gaqhf
|
SPPIDUtil.ConvertPointBystring(connectorIndex == 0 ? connLine.STARTPOINT : connLine.ENDPOINT, ref lineX, ref lineY);
|
346 |
02480ac1
|
gaqhf
|
double symbolX = double.NaN;
|
347 |
|
|
double symbolY = double.NaN;
|
348 |
|
|
SPPIDUtil.ConvertPointBystring(symbol.ORIGINALPOINT, ref symbolX, ref symbolY);
|
349 |
|
|
|
350 |
|
|
SlopeType slopeType = SPPIDUtil.CalcSlope(lineX, lineY, symbolX, symbolY);
|
351 |
c01ce90b
|
gaqhf
|
if (slopeType == searchType)
|
352 |
|
|
{
|
353 |
|
|
if (!group.Contains(connLine))
|
354 |
|
|
{
|
355 |
|
|
group.Add(connLine);
|
356 |
|
|
FindGroupByLineAndSlopeType(connLine, group, searchType);
|
357 |
|
|
}
|
358 |
|
|
}
|
359 |
|
|
}
|
360 |
|
|
}
|
361 |
|
|
}
|
362 |
|
|
|
363 |
f1a7faf9
|
gaqhf
|
private void FindGroupByLineAndSlopeType(Line line, List<object> group, SlopeType searchType)
|
364 |
c01ce90b
|
gaqhf
|
{
|
365 |
f1a7faf9
|
gaqhf
|
foreach (var connector in line.CONNECTORS)
|
366 |
c01ce90b
|
gaqhf
|
{
|
367 |
|
|
object connectedItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM);
|
368 |
|
|
if (connectedItem != null && connectedItem.GetType() == typeof(Symbol))
|
369 |
|
|
{
|
370 |
|
|
Symbol connSymbol = connectedItem as Symbol;
|
371 |
02480ac1
|
gaqhf
|
|
372 |
f1a7faf9
|
gaqhf
|
Connector otherConnector = line.CONNECTORS.Find(x => x.CONNECTEDITEM != connSymbol.UID);
|
373 |
|
|
int connectorIndex = line.CONNECTORS.IndexOf(otherConnector);
|
374 |
c01ce90b
|
gaqhf
|
double lineX = double.NaN;
|
375 |
|
|
double lineY = double.NaN;
|
376 |
02480ac1
|
gaqhf
|
// Line의 Connector ScenePoint
|
377 |
f1a7faf9
|
gaqhf
|
SPPIDUtil.ConvertPointBystring(connectorIndex == 0 ? line.STARTPOINT : line.ENDPOINT, ref lineX, ref lineY);
|
378 |
c01ce90b
|
gaqhf
|
double symbolX = double.NaN;
|
379 |
|
|
double symbolY = double.NaN;
|
380 |
|
|
SPPIDUtil.ConvertPointBystring(connSymbol.ORIGINALPOINT, ref symbolX, ref symbolY);
|
381 |
|
|
|
382 |
|
|
SlopeType slopeType = SPPIDUtil.CalcSlope(lineX, lineY, symbolX, symbolY);
|
383 |
|
|
if (slopeType == searchType)
|
384 |
|
|
{
|
385 |
|
|
if (!group.Contains(connSymbol))
|
386 |
|
|
{
|
387 |
|
|
group.Add(connSymbol);
|
388 |
|
|
FindGroupBySymbolAndSlopeType(connSymbol, group, searchType);
|
389 |
|
|
}
|
390 |
|
|
}
|
391 |
|
|
}
|
392 |
|
|
else if (connectedItem != null && connectedItem.GetType() == typeof(Line))
|
393 |
|
|
{
|
394 |
|
|
Line connLine = connectedItem as Line;
|
395 |
|
|
SlopeType slopeType = SPPIDUtil.CalcSlope(connLine.SPPID.START_X, connLine.SPPID.START_Y, connLine.SPPID.END_X, connLine.SPPID.END_Y);
|
396 |
|
|
if (slopeType == searchType)
|
397 |
|
|
{
|
398 |
|
|
if (!group.Contains(connLine))
|
399 |
|
|
{
|
400 |
|
|
group.Add(connLine);
|
401 |
|
|
FindGroupByLineAndSlopeType(connLine, group, searchType);
|
402 |
|
|
}
|
403 |
|
|
}
|
404 |
|
|
}
|
405 |
|
|
}
|
406 |
|
|
}
|
407 |
|
|
|
408 |
4b4dbca9
|
gaqhf
|
private void SetChildSymbolSPPIDInfo(ChildSymbol item)
|
409 |
|
|
{
|
410 |
|
|
foreach (var childSymbol in item.ChildSymbols)
|
411 |
|
|
{
|
412 |
|
|
if (childSymbol.SPPID == null)
|
413 |
|
|
childSymbol.SPPID = new SPPIDSymbolInfo();
|
414 |
|
|
SetChildSymbolSPPIDInfo(childSymbol);
|
415 |
|
|
}
|
416 |
|
|
}
|
417 |
|
|
|
418 |
39a2a688
|
gaqhf
|
public bool SetSPPIDMapping()
|
419 |
|
|
{
|
420 |
68e9394a
|
gaqhf
|
bool result = true;
|
421 |
|
|
StringBuilder sb = new StringBuilder();
|
422 |
39a2a688
|
gaqhf
|
foreach (var item in SYMBOLS)
|
423 |
|
|
{
|
424 |
|
|
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID);
|
425 |
|
|
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null;
|
426 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
427 |
68e9394a
|
gaqhf
|
{
|
428 |
|
|
result = false;
|
429 |
|
|
sb.AppendLine("Need Mapping Symbol Name : " + item.NAME);
|
430 |
|
|
}
|
431 |
|
|
|
432 |
4b4dbca9
|
gaqhf
|
|
433 |
|
|
foreach (var childSymbol in item.ChildSymbols)
|
434 |
|
|
{
|
435 |
|
|
ChildSymbolMapping childMapping = ChildSymbolMappings.Find(x => x.UID == childSymbol.NAME);
|
436 |
|
|
childSymbol.SPPID.MAPPINGNAME = childMapping != null ? childMapping.SPPIDSYMBOLNAME : null;
|
437 |
|
|
if (string.IsNullOrEmpty(childSymbol.SPPID.MAPPINGNAME) || !SetChildSymbolMapping(childSymbol))
|
438 |
68e9394a
|
gaqhf
|
{
|
439 |
|
|
result = false;
|
440 |
|
|
sb.AppendLine("Need Mapping Symbol Name : " + childSymbol.NAME);
|
441 |
|
|
}
|
442 |
4b4dbca9
|
gaqhf
|
}
|
443 |
39a2a688
|
gaqhf
|
}
|
444 |
|
|
|
445 |
|
|
foreach (var item in LINES)
|
446 |
|
|
{
|
447 |
|
|
LineMapping mapping = LineMappings.Find(x => x.UID == item.TYPEUID);
|
448 |
|
|
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null;
|
449 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
450 |
68e9394a
|
gaqhf
|
{
|
451 |
|
|
result = false;
|
452 |
|
|
sb.AppendLine("Need Mapping Line Type : " + item.TYPE);
|
453 |
|
|
}
|
454 |
f947c634
|
gaqhf
|
}
|
455 |
|
|
|
456 |
809a7640
|
gaqhf
|
foreach (var item in Equipments)
|
457 |
|
|
{
|
458 |
|
|
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID);
|
459 |
|
|
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null;
|
460 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
461 |
68e9394a
|
gaqhf
|
{
|
462 |
|
|
result = false;
|
463 |
|
|
sb.AppendLine("Need Mapping Symbol Name : " + item.NAME);
|
464 |
|
|
}
|
465 |
809a7640
|
gaqhf
|
}
|
466 |
|
|
|
467 |
3165c259
|
gaqhf
|
foreach (var item in EndBreaks)
|
468 |
|
|
{
|
469 |
|
|
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID);
|
470 |
|
|
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null;
|
471 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
472 |
68e9394a
|
gaqhf
|
{
|
473 |
|
|
result = false;
|
474 |
|
|
sb.AppendLine("Need Mapping Symbol Name : " + item.NAME);
|
475 |
|
|
}
|
476 |
3165c259
|
gaqhf
|
}
|
477 |
|
|
|
478 |
10872260
|
gaqhf
|
foreach (var item in LINENUMBERS)
|
479 |
|
|
{
|
480 |
|
|
if (LineNumberMappings.Count > 0)
|
481 |
|
|
item.SPPID.MAPPINGNAME = LineNumberMappings[0].SPPIDSYMBOLNAME;
|
482 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
483 |
68e9394a
|
gaqhf
|
{
|
484 |
|
|
result = false;
|
485 |
|
|
sb.AppendLine("Need Mapping LineNumber Mapping");
|
486 |
|
|
}
|
487 |
10872260
|
gaqhf
|
}
|
488 |
|
|
|
489 |
6b298450
|
gaqhf
|
ETCSetting etc = ETCSetting.GetInstance();
|
490 |
|
|
foreach (var item in NOTES)
|
491 |
|
|
{
|
492 |
|
|
item.SPPID.MAPPINGNAME = etc.NoteSymbolPath;
|
493 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
494 |
68e9394a
|
gaqhf
|
{
|
495 |
|
|
result = false;
|
496 |
|
|
sb.AppendLine("Need Mapping Note Mapping");
|
497 |
|
|
}
|
498 |
6b298450
|
gaqhf
|
}
|
499 |
|
|
|
500 |
|
|
foreach (var item in TEXTINFOS)
|
501 |
|
|
{
|
502 |
|
|
item.SPPID.MAPPINGNAME = etc.TextSymbolPath;
|
503 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
504 |
68e9394a
|
gaqhf
|
{
|
505 |
|
|
result = false;
|
506 |
|
|
sb.AppendLine("Need Mapping Text Mapping");
|
507 |
|
|
}
|
508 |
6b298450
|
gaqhf
|
}
|
509 |
4b4dbca9
|
gaqhf
|
|
510 |
68e9394a
|
gaqhf
|
if (!result)
|
511 |
|
|
ValidationMessage += sb.ToString();
|
512 |
5673a69f
|
gaqhf
|
else
|
513 |
|
|
MappingValidation = true;
|
514 |
68e9394a
|
gaqhf
|
|
515 |
|
|
return result;
|
516 |
f947c634
|
gaqhf
|
}
|
517 |
5dfb8a24
|
gaqhf
|
|
518 |
4b4dbca9
|
gaqhf
|
private bool SetChildSymbolMapping(ChildSymbol item)
|
519 |
|
|
{
|
520 |
6eea0b00
|
esham21
|
bool res = true;
|
521 |
|
|
|
522 |
4b4dbca9
|
gaqhf
|
foreach (var childSymbol in item.ChildSymbols)
|
523 |
|
|
{
|
524 |
|
|
ChildSymbolMapping childMapping = ChildSymbolMappings.Find(x => x.UID == childSymbol.NAME);
|
525 |
|
|
childSymbol.SPPID.MAPPINGNAME = childMapping != null ? childMapping.SPPIDSYMBOLNAME : null;
|
526 |
|
|
if (string.IsNullOrEmpty(childSymbol.SPPID.MAPPINGNAME))
|
527 |
|
|
return false;
|
528 |
|
|
else
|
529 |
6eea0b00
|
esham21
|
{
|
530 |
|
|
res = SetChildSymbolMapping(childSymbol);
|
531 |
|
|
if (!res)
|
532 |
|
|
return false;
|
533 |
|
|
}
|
534 |
4b4dbca9
|
gaqhf
|
}
|
535 |
|
|
|
536 |
6eea0b00
|
esham21
|
return res;
|
537 |
4b4dbca9
|
gaqhf
|
}
|
538 |
30ba9ae0
|
gaqhf
|
|
539 |
|
|
public void CheckModelingResult()
|
540 |
|
|
{
|
541 |
|
|
StringBuilder sb = new StringBuilder();
|
542 |
|
|
sb.AppendLine("Modeling Result");
|
543 |
c24d977b
|
gaqhf
|
int failSymbolCnt = 0;
|
544 |
|
|
int failLineCnt = 0;
|
545 |
8fbc78be
|
gaqhf
|
int failTextCnt = 0;
|
546 |
30ba9ae0
|
gaqhf
|
foreach (var item in Equipments)
|
547 |
|
|
{
|
548 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
549 |
c24d977b
|
gaqhf
|
{
|
550 |
30ba9ae0
|
gaqhf
|
sb.AppendLine("Fail Equipment Modeling UID : " + item.UID);
|
551 |
c24d977b
|
gaqhf
|
failSymbolCnt++;
|
552 |
|
|
}
|
553 |
30ba9ae0
|
gaqhf
|
}
|
554 |
|
|
foreach (var item in SYMBOLS)
|
555 |
|
|
{
|
556 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
557 |
c24d977b
|
gaqhf
|
{
|
558 |
30ba9ae0
|
gaqhf
|
sb.AppendLine("Fail Symbol Modeling UID : " + item.UID);
|
559 |
c24d977b
|
gaqhf
|
failSymbolCnt++;
|
560 |
|
|
}
|
561 |
30ba9ae0
|
gaqhf
|
foreach (var child in item.ChildSymbols)
|
562 |
|
|
{
|
563 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
564 |
|
|
{
|
565 |
|
|
sb.AppendLine("Fail Child Symbol Modeling UID : " + item.UID);
|
566 |
|
|
sb.AppendLine("Fail Child Symbol Name : " + child.NAME);
|
567 |
|
|
}
|
568 |
|
|
loop(child, item, sb);
|
569 |
|
|
}
|
570 |
|
|
}
|
571 |
|
|
foreach (var item in LINES)
|
572 |
|
|
{
|
573 |
|
|
if (string.IsNullOrEmpty(item.SPPID.ModelItemId))
|
574 |
c24d977b
|
gaqhf
|
{
|
575 |
30ba9ae0
|
gaqhf
|
sb.AppendLine("Fail Line Modeling UID : " + item.UID);
|
576 |
c24d977b
|
gaqhf
|
failLineCnt++;
|
577 |
|
|
}
|
578 |
30ba9ae0
|
gaqhf
|
}
|
579 |
|
|
foreach (var item in LINENUMBERS)
|
580 |
|
|
{
|
581 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
582 |
|
|
sb.AppendLine("Fail Line Number Modeling UID : " + item.UID);
|
583 |
|
|
}
|
584 |
|
|
foreach (var item in NOTES)
|
585 |
|
|
{
|
586 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
587 |
8fbc78be
|
gaqhf
|
{
|
588 |
30ba9ae0
|
gaqhf
|
sb.AppendLine("Fail Note Text Modeling UID : " + item.UID);
|
589 |
8fbc78be
|
gaqhf
|
failTextCnt++;
|
590 |
|
|
}
|
591 |
30ba9ae0
|
gaqhf
|
}
|
592 |
|
|
foreach (var item in TEXTINFOS)
|
593 |
|
|
{
|
594 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
595 |
8fbc78be
|
gaqhf
|
{
|
596 |
30ba9ae0
|
gaqhf
|
sb.AppendLine("Fail Text Modeling UID : " + item.UID);
|
597 |
8fbc78be
|
gaqhf
|
failTextCnt++;
|
598 |
|
|
}
|
599 |
30ba9ae0
|
gaqhf
|
}
|
600 |
|
|
foreach (var item in EndBreaks)
|
601 |
|
|
{
|
602 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
603 |
c24d977b
|
gaqhf
|
{
|
604 |
30ba9ae0
|
gaqhf
|
sb.AppendLine("Fail End Break Modeling UID : " + item.UID);
|
605 |
c24d977b
|
gaqhf
|
failSymbolCnt++;
|
606 |
|
|
}
|
607 |
30ba9ae0
|
gaqhf
|
}
|
608 |
|
|
foreach (var item in SpecBreaks)
|
609 |
|
|
{
|
610 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
611 |
c24d977b
|
gaqhf
|
{
|
612 |
30ba9ae0
|
gaqhf
|
sb.AppendLine("Fail SpecBreak Modeling UID : " + item.UID);
|
613 |
c24d977b
|
gaqhf
|
failSymbolCnt++;
|
614 |
|
|
}
|
615 |
30ba9ae0
|
gaqhf
|
}
|
616 |
|
|
sb.AppendLine("End Modeling Result");
|
617 |
fa24d104
|
gaqhf
|
Log.Write(sb.ToString());
|
618 |
c24d977b
|
gaqhf
|
|
619 |
|
|
int allSymbol = Equipments.Count + SYMBOLS.Count + EndBreaks.Count + SpecBreaks.Count;
|
620 |
97a6ee26
|
gaqhf
|
|
621 |
|
|
Log.Write("Success Symbol Modeling : " + (allSymbol - failSymbolCnt));
|
622 |
|
|
Log.Write("Fail Symbol Modeling : " + failSymbolCnt);
|
623 |
|
|
Log.Write("Success Line Modeling : " + (LINES.Count - failLineCnt));
|
624 |
|
|
Log.Write("Fail Line Modeling : " + failLineCnt);
|
625 |
8fbc78be
|
gaqhf
|
Log.Write("Success Text/Note Modeling : " + (TEXTINFOS.Count + NOTES.Count - failTextCnt));
|
626 |
|
|
Log.Write("Fail Text/Note Modeling : " + failTextCnt);
|
627 |
30ba9ae0
|
gaqhf
|
}
|
628 |
|
|
|
629 |
|
|
private void loop(ChildSymbol childLoop, Symbol item, StringBuilder sb)
|
630 |
|
|
{
|
631 |
|
|
foreach (var childLoopLoop in childLoop.ChildSymbols)
|
632 |
|
|
{
|
633 |
|
|
if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
|
634 |
|
|
{
|
635 |
|
|
sb.AppendLine("Fail Child Symbol Modeling UID : " + item.UID);
|
636 |
|
|
sb.AppendLine("Fail Child Symbol Name : " + childLoopLoop.NAME);
|
637 |
|
|
}
|
638 |
3c8e40a5
|
gaqhf
|
loop(childLoopLoop, item, sb);
|
639 |
30ba9ae0
|
gaqhf
|
}
|
640 |
|
|
}
|
641 |
bca86986
|
gaqhf
|
}
|
642 |
|
|
} |