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 |
|
|
public SPPID_Document(string xmlPath) : base(xmlPath)
|
15 |
|
|
{
|
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 |
4d2571ab
|
gaqhf
|
public DataTable SymbolTable { get; set; }
|
26 |
39a2a688
|
gaqhf
|
|
27 |
f1c9dbaa
|
gaqhf
|
public List<Group> GROUPS = new List<Group>();
|
28 |
5dfb8a24
|
gaqhf
|
|
29 |
bca86986
|
gaqhf
|
public string DrawingName { get; set; }
|
30 |
|
|
public string DrawingNumber { get; set; }
|
31 |
|
|
public string Unit { get; set; }
|
32 |
4314b3f3
|
gaqhf
|
public string Template { get; set; }
|
33 |
88bac50c
|
gaqhf
|
public string SPPID_DrawingNumber { get; set; }
|
34 |
|
|
public string SPPID_DrawingName { get; set; }
|
35 |
f947c634
|
gaqhf
|
|
36 |
|
|
public void SetSPPIDInfo()
|
37 |
|
|
{
|
38 |
|
|
foreach (var item in SYMBOLS)
|
39 |
|
|
{
|
40 |
39a2a688
|
gaqhf
|
if (item.SPPID == null)
|
41 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
42 |
4b4dbca9
|
gaqhf
|
|
43 |
|
|
foreach (var childSymbol in item.ChildSymbols)
|
44 |
|
|
{
|
45 |
|
|
if (childSymbol.SPPID == null)
|
46 |
|
|
childSymbol.SPPID = new SPPIDSymbolInfo();
|
47 |
|
|
SetChildSymbolSPPIDInfo(childSymbol);
|
48 |
|
|
}
|
49 |
39a2a688
|
gaqhf
|
}
|
50 |
|
|
|
51 |
|
|
foreach (var item in LINES)
|
52 |
|
|
{
|
53 |
|
|
if (item.SPPID == null)
|
54 |
|
|
item.SPPID = new SPPIDLineInfo();
|
55 |
1ba9c671
|
gaqhf
|
}
|
56 |
|
|
|
57 |
|
|
foreach (var item in Equipments)
|
58 |
|
|
{
|
59 |
|
|
if (item.SPPID == null)
|
60 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
foreach (var item in EndBreaks)
|
64 |
|
|
{
|
65 |
|
|
if (item.SPPID == null)
|
66 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
67 |
|
|
}
|
68 |
|
|
|
69 |
53c81765
|
gaqhf
|
foreach (var item in SpecBreaks)
|
70 |
|
|
{
|
71 |
|
|
if (item.SPPID == null)
|
72 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
73 |
|
|
}
|
74 |
|
|
|
75 |
1ba9c671
|
gaqhf
|
foreach (var item in LINENUMBERS)
|
76 |
|
|
{
|
77 |
|
|
if (item.SPPID == null)
|
78 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
foreach (var item in TEXTINFOS)
|
82 |
|
|
{
|
83 |
|
|
if (item.SPPID == null)
|
84 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
foreach (var item in NOTES)
|
88 |
|
|
{
|
89 |
|
|
if (item.SPPID == null)
|
90 |
|
|
item.SPPID = new SPPIDSymbolInfo();
|
91 |
|
|
}
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
public void SetSPPIDLocation(double SPPIDDocumentX, double SPPIDDocumentY)
|
95 |
|
|
{
|
96 |
|
|
foreach (var item in SYMBOLS)
|
97 |
|
|
{
|
98 |
|
|
double x = double.NaN;
|
99 |
|
|
double y = double.NaN;
|
100 |
|
|
SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
|
101 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
102 |
06b40010
|
gaqhf
|
|
103 |
1ba9c671
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
104 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
foreach (var item in LINES)
|
108 |
|
|
{
|
109 |
39a2a688
|
gaqhf
|
double x = double.NaN;
|
110 |
|
|
double y = double.NaN;
|
111 |
|
|
|
112 |
|
|
SPPIDUtil.ConvertPointBystring(item.STARTPOINT, ref x, ref y);
|
113 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
114 |
39a2a688
|
gaqhf
|
item.SPPID.START_X = x;
|
115 |
|
|
item.SPPID.START_Y = y;
|
116 |
|
|
|
117 |
|
|
SPPIDUtil.ConvertPointBystring(item.ENDPOINT, ref x, ref y);
|
118 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
119 |
39a2a688
|
gaqhf
|
item.SPPID.END_X = x;
|
120 |
|
|
item.SPPID.END_Y = y;
|
121 |
|
|
}
|
122 |
809a7640
|
gaqhf
|
|
123 |
|
|
foreach (var item in Equipments)
|
124 |
|
|
{
|
125 |
|
|
double x = double.NaN;
|
126 |
|
|
double y = double.NaN;
|
127 |
|
|
SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
|
128 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
129 |
06b40010
|
gaqhf
|
|
130 |
809a7640
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
131 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
132 |
|
|
}
|
133 |
3165c259
|
gaqhf
|
|
134 |
|
|
foreach (var item in EndBreaks)
|
135 |
|
|
{
|
136 |
|
|
double x = double.NaN;
|
137 |
|
|
double y = double.NaN;
|
138 |
|
|
SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
|
139 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
140 |
3165c259
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
141 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
142 |
|
|
}
|
143 |
10872260
|
gaqhf
|
|
144 |
53c81765
|
gaqhf
|
foreach (var item in SpecBreaks)
|
145 |
|
|
{
|
146 |
|
|
double x = double.NaN;
|
147 |
|
|
double y = double.NaN;
|
148 |
|
|
SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
|
149 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
150 |
|
|
|
151 |
|
|
item.SPPID.ORIGINAL_X = x;
|
152 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
153 |
|
|
}
|
154 |
|
|
|
155 |
10872260
|
gaqhf
|
foreach (var item in LINENUMBERS)
|
156 |
|
|
{
|
157 |
|
|
double x = double.NaN;
|
158 |
|
|
double y = double.NaN;
|
159 |
|
|
SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
|
160 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
161 |
10872260
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
162 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
163 |
1a3a74a8
|
gaqhf
|
|
164 |
|
|
item.SPPIDLabelLocation = new SPPIDLabelLocationInfo();
|
165 |
|
|
double x1 = item.X1;
|
166 |
|
|
double y1 = item.Y1;
|
167 |
|
|
double x2 = item.X2;
|
168 |
|
|
double y2 = item.Y2;
|
169 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
170 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
171 |
1a3a74a8
|
gaqhf
|
item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
|
172 |
|
|
item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
|
173 |
|
|
item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
|
174 |
|
|
item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2);
|
175 |
10872260
|
gaqhf
|
}
|
176 |
6b298450
|
gaqhf
|
|
177 |
|
|
foreach (var item in TEXTINFOS)
|
178 |
|
|
{
|
179 |
|
|
double x = double.NaN;
|
180 |
|
|
double y = double.NaN;
|
181 |
|
|
SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
|
182 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
183 |
6b298450
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
184 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
185 |
1a3a74a8
|
gaqhf
|
|
186 |
|
|
item.SPPIDLabelLocation = new SPPIDLabelLocationInfo();
|
187 |
|
|
double x1 = item.X1;
|
188 |
|
|
double y1 = item.Y1;
|
189 |
|
|
double x2 = item.X2;
|
190 |
|
|
double y2 = item.Y2;
|
191 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
192 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
193 |
1a3a74a8
|
gaqhf
|
item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
|
194 |
|
|
item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
|
195 |
|
|
item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
|
196 |
|
|
item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2);
|
197 |
6b298450
|
gaqhf
|
}
|
198 |
|
|
|
199 |
|
|
foreach (var item in NOTES)
|
200 |
|
|
{
|
201 |
|
|
double x = double.NaN;
|
202 |
|
|
double y = double.NaN;
|
203 |
|
|
SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
|
204 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
205 |
6b298450
|
gaqhf
|
item.SPPID.ORIGINAL_X = x;
|
206 |
|
|
item.SPPID.ORIGINAL_Y = y;
|
207 |
1a3a74a8
|
gaqhf
|
|
208 |
|
|
item.SPPIDLabelLocation = new SPPIDLabelLocationInfo();
|
209 |
|
|
double x1 = item.X1;
|
210 |
|
|
double y1 = item.Y1;
|
211 |
|
|
double x2 = item.X2;
|
212 |
|
|
double y2 = item.Y2;
|
213 |
1ba9c671
|
gaqhf
|
SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
214 |
|
|
SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
|
215 |
1a3a74a8
|
gaqhf
|
item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
|
216 |
|
|
item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
|
217 |
|
|
item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
|
218 |
|
|
item.SPPIDLabelLocation.Y2 = Math.Max(y1, y2);
|
219 |
6b298450
|
gaqhf
|
}
|
220 |
39a2a688
|
gaqhf
|
}
|
221 |
4b4dbca9
|
gaqhf
|
|
222 |
c01ce90b
|
gaqhf
|
/// <summary>
|
223 |
|
|
/// 좌표 보정
|
224 |
|
|
/// </summary>
|
225 |
|
|
public void CoordinateCorrection()
|
226 |
|
|
{
|
227 |
|
|
foreach (Symbol symbol in SYMBOLS)
|
228 |
|
|
{
|
229 |
|
|
if (!symbol.SPPID.IsCorrectionX)
|
230 |
|
|
{
|
231 |
|
|
List<object> group = new List<object>();
|
232 |
|
|
group.Add(symbol);
|
233 |
|
|
FindGroupBySymbolAndSlopeType(symbol, group, SlopeType.VERTICAL);
|
234 |
|
|
|
235 |
|
|
List<Symbol> groupSymbols = (from sym in @group
|
236 |
|
|
where sym.GetType() == typeof(Symbol)
|
237 |
|
|
select sym as Symbol).ToList();
|
238 |
|
|
|
239 |
|
|
// X 좌표만 보정
|
240 |
|
|
Symbol correctionSymbol = groupSymbols.Find(x => x.SPPID.IsCorrectionX);
|
241 |
|
|
double value = symbol.SPPID.ORIGINAL_X;
|
242 |
|
|
if (correctionSymbol == null)
|
243 |
|
|
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref value);
|
244 |
|
|
else
|
245 |
|
|
value = correctionSymbol.SPPID.ORIGINAL_X;
|
246 |
|
|
|
247 |
|
|
foreach (var item in groupSymbols)
|
248 |
|
|
{
|
249 |
|
|
item.SPPID.IsCorrectionX = true;
|
250 |
|
|
item.SPPID.ORIGINAL_X = value;
|
251 |
d9794a6c
|
gaqhf
|
item.SPPID.CorrectionX_GroupSymbols = groupSymbols;
|
252 |
c01ce90b
|
gaqhf
|
}
|
253 |
|
|
}
|
254 |
|
|
|
255 |
|
|
if (!symbol.SPPID.IsCorrectionY)
|
256 |
|
|
{
|
257 |
|
|
List<object> group = new List<object>();
|
258 |
|
|
group.Add(symbol);
|
259 |
|
|
FindGroupBySymbolAndSlopeType(symbol, group, SlopeType.HORIZONTAL);
|
260 |
|
|
|
261 |
|
|
List<Symbol> groupSymbols = (from sym in @group
|
262 |
|
|
where sym.GetType() == typeof(Symbol)
|
263 |
|
|
select sym as Symbol).ToList();
|
264 |
|
|
|
265 |
|
|
// Y 좌표만 보정
|
266 |
|
|
Symbol correctionSymbol = groupSymbols.Find(x => x.SPPID.IsCorrectionY);
|
267 |
|
|
double value = symbol.SPPID.ORIGINAL_Y;
|
268 |
|
|
if (correctionSymbol == null)
|
269 |
|
|
SPPIDUtil.ConvertGridPointOnlyOnePoint(ref value);
|
270 |
|
|
else
|
271 |
|
|
value = correctionSymbol.SPPID.ORIGINAL_Y;
|
272 |
|
|
|
273 |
|
|
foreach (var item in groupSymbols)
|
274 |
|
|
{
|
275 |
|
|
item.SPPID.IsCorrectionY = true;
|
276 |
|
|
item.SPPID.ORIGINAL_Y = value;
|
277 |
d9794a6c
|
gaqhf
|
item.SPPID.CorrectionY_GroupSymbols = groupSymbols;
|
278 |
c01ce90b
|
gaqhf
|
}
|
279 |
|
|
}
|
280 |
|
|
}
|
281 |
|
|
}
|
282 |
|
|
|
283 |
|
|
private void FindGroupBySymbolAndSlopeType(Symbol symbol, List<object> group, SlopeType searchType)
|
284 |
|
|
{
|
285 |
|
|
foreach (var connector in symbol.CONNECTORS)
|
286 |
|
|
{
|
287 |
|
|
object connectedItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM);
|
288 |
|
|
if (connectedItem != null && connectedItem.GetType() == typeof(Symbol))
|
289 |
|
|
{
|
290 |
|
|
Symbol connSymbol = connectedItem as Symbol;
|
291 |
|
|
SlopeType slopeType = SPPIDUtil.CalcSlope(symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y, connSymbol.SPPID.ORIGINAL_X, connSymbol.SPPID.ORIGINAL_Y);
|
292 |
|
|
if (slopeType == searchType)
|
293 |
|
|
{
|
294 |
|
|
if (!group.Contains(connSymbol))
|
295 |
|
|
{
|
296 |
|
|
group.Add(connSymbol);
|
297 |
|
|
FindGroupBySymbolAndSlopeType(connSymbol, group, searchType);
|
298 |
|
|
}
|
299 |
|
|
}
|
300 |
|
|
}
|
301 |
|
|
else if (connectedItem != null && connectedItem.GetType() == typeof(Line))
|
302 |
|
|
{
|
303 |
|
|
Line connLine = connectedItem as Line;
|
304 |
02480ac1
|
gaqhf
|
|
305 |
1ed39474
|
gaqhf
|
Connector otherConnector = connLine.CONNECTORS.Find(x => x.CONNECTEDITEM != symbol.UID);
|
306 |
|
|
|
307 |
02480ac1
|
gaqhf
|
double lineX = double.NaN;
|
308 |
|
|
double lineY = double.NaN;
|
309 |
|
|
// Symbol의 Connector ScenePoint
|
310 |
1ed39474
|
gaqhf
|
SPPIDUtil.ConvertPointBystring(otherConnector.SCENECONNECTPOINT, ref lineX, ref lineY);
|
311 |
02480ac1
|
gaqhf
|
double symbolX = double.NaN;
|
312 |
|
|
double symbolY = double.NaN;
|
313 |
|
|
SPPIDUtil.ConvertPointBystring(symbol.ORIGINALPOINT, ref symbolX, ref symbolY);
|
314 |
|
|
|
315 |
|
|
SlopeType slopeType = SPPIDUtil.CalcSlope(lineX, lineY, symbolX, symbolY);
|
316 |
c01ce90b
|
gaqhf
|
if (slopeType == searchType)
|
317 |
|
|
{
|
318 |
|
|
if (!group.Contains(connLine))
|
319 |
|
|
{
|
320 |
|
|
group.Add(connLine);
|
321 |
|
|
FindGroupByLineAndSlopeType(connLine, group, searchType);
|
322 |
|
|
}
|
323 |
|
|
}
|
324 |
|
|
}
|
325 |
|
|
}
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
private void FindGroupByLineAndSlopeType(Line Line, List<object> group, SlopeType searchType)
|
329 |
|
|
{
|
330 |
|
|
foreach (var connector in Line.CONNECTORS)
|
331 |
|
|
{
|
332 |
|
|
object connectedItem = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM);
|
333 |
|
|
if (connectedItem != null && connectedItem.GetType() == typeof(Symbol))
|
334 |
|
|
{
|
335 |
|
|
Symbol connSymbol = connectedItem as Symbol;
|
336 |
02480ac1
|
gaqhf
|
|
337 |
1ed39474
|
gaqhf
|
Connector otherConnector = Line.CONNECTORS.Find(x => x.CONNECTEDITEM != connSymbol.UID);
|
338 |
|
|
|
339 |
c01ce90b
|
gaqhf
|
double lineX = double.NaN;
|
340 |
|
|
double lineY = double.NaN;
|
341 |
02480ac1
|
gaqhf
|
// Line의 Connector ScenePoint
|
342 |
1ed39474
|
gaqhf
|
SPPIDUtil.ConvertPointBystring(otherConnector.SCENECONNECTPOINT, ref lineX, ref lineY);
|
343 |
c01ce90b
|
gaqhf
|
double symbolX = double.NaN;
|
344 |
|
|
double symbolY = double.NaN;
|
345 |
|
|
SPPIDUtil.ConvertPointBystring(connSymbol.ORIGINALPOINT, ref symbolX, ref symbolY);
|
346 |
|
|
|
347 |
|
|
SlopeType slopeType = SPPIDUtil.CalcSlope(lineX, lineY, symbolX, symbolY);
|
348 |
|
|
if (slopeType == searchType)
|
349 |
|
|
{
|
350 |
|
|
if (!group.Contains(connSymbol))
|
351 |
|
|
{
|
352 |
|
|
group.Add(connSymbol);
|
353 |
|
|
FindGroupBySymbolAndSlopeType(connSymbol, group, searchType);
|
354 |
|
|
}
|
355 |
|
|
}
|
356 |
|
|
}
|
357 |
|
|
else if (connectedItem != null && connectedItem.GetType() == typeof(Line))
|
358 |
|
|
{
|
359 |
|
|
Line connLine = connectedItem as Line;
|
360 |
|
|
SlopeType slopeType = SPPIDUtil.CalcSlope(connLine.SPPID.START_X, connLine.SPPID.START_Y, connLine.SPPID.END_X, connLine.SPPID.END_Y);
|
361 |
|
|
if (slopeType == searchType)
|
362 |
|
|
{
|
363 |
|
|
if (!group.Contains(connLine))
|
364 |
|
|
{
|
365 |
|
|
group.Add(connLine);
|
366 |
|
|
FindGroupByLineAndSlopeType(connLine, group, searchType);
|
367 |
|
|
}
|
368 |
|
|
}
|
369 |
|
|
}
|
370 |
|
|
}
|
371 |
|
|
}
|
372 |
|
|
|
373 |
4b4dbca9
|
gaqhf
|
private void SetChildSymbolSPPIDInfo(ChildSymbol item)
|
374 |
|
|
{
|
375 |
|
|
foreach (var childSymbol in item.ChildSymbols)
|
376 |
|
|
{
|
377 |
|
|
if (childSymbol.SPPID == null)
|
378 |
|
|
childSymbol.SPPID = new SPPIDSymbolInfo();
|
379 |
|
|
SetChildSymbolSPPIDInfo(childSymbol);
|
380 |
|
|
}
|
381 |
|
|
}
|
382 |
|
|
|
383 |
39a2a688
|
gaqhf
|
public bool SetSPPIDMapping()
|
384 |
|
|
{
|
385 |
|
|
foreach (var item in SYMBOLS)
|
386 |
|
|
{
|
387 |
|
|
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID);
|
388 |
|
|
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null;
|
389 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
390 |
|
|
return false;
|
391 |
4b4dbca9
|
gaqhf
|
|
392 |
|
|
foreach (var childSymbol in item.ChildSymbols)
|
393 |
|
|
{
|
394 |
|
|
ChildSymbolMapping childMapping = ChildSymbolMappings.Find(x => x.UID == childSymbol.NAME);
|
395 |
|
|
childSymbol.SPPID.MAPPINGNAME = childMapping != null ? childMapping.SPPIDSYMBOLNAME : null;
|
396 |
|
|
if (string.IsNullOrEmpty(childSymbol.SPPID.MAPPINGNAME) || !SetChildSymbolMapping(childSymbol))
|
397 |
|
|
return false;
|
398 |
|
|
}
|
399 |
39a2a688
|
gaqhf
|
}
|
400 |
|
|
|
401 |
|
|
foreach (var item in LINES)
|
402 |
|
|
{
|
403 |
|
|
LineMapping mapping = LineMappings.Find(x => x.UID == item.TYPEUID);
|
404 |
|
|
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null;
|
405 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
406 |
|
|
return false;
|
407 |
f947c634
|
gaqhf
|
}
|
408 |
|
|
|
409 |
809a7640
|
gaqhf
|
foreach (var item in Equipments)
|
410 |
|
|
{
|
411 |
|
|
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID);
|
412 |
|
|
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null;
|
413 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
414 |
|
|
return false;
|
415 |
|
|
}
|
416 |
|
|
|
417 |
3165c259
|
gaqhf
|
foreach (var item in EndBreaks)
|
418 |
|
|
{
|
419 |
|
|
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID);
|
420 |
|
|
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null;
|
421 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
422 |
|
|
return false;
|
423 |
|
|
}
|
424 |
|
|
|
425 |
10872260
|
gaqhf
|
foreach (var item in LINENUMBERS)
|
426 |
|
|
{
|
427 |
|
|
if (LineNumberMappings.Count > 0)
|
428 |
|
|
item.SPPID.MAPPINGNAME = LineNumberMappings[0].SPPIDSYMBOLNAME;
|
429 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
430 |
|
|
return false;
|
431 |
|
|
}
|
432 |
|
|
|
433 |
6b298450
|
gaqhf
|
ETCSetting etc = ETCSetting.GetInstance();
|
434 |
|
|
foreach (var item in NOTES)
|
435 |
|
|
{
|
436 |
|
|
item.SPPID.MAPPINGNAME = etc.NoteSymbolPath;
|
437 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
438 |
|
|
return false;
|
439 |
|
|
}
|
440 |
|
|
|
441 |
|
|
foreach (var item in TEXTINFOS)
|
442 |
|
|
{
|
443 |
|
|
item.SPPID.MAPPINGNAME = etc.TextSymbolPath;
|
444 |
|
|
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME))
|
445 |
|
|
return false;
|
446 |
|
|
}
|
447 |
4b4dbca9
|
gaqhf
|
|
448 |
39a2a688
|
gaqhf
|
return true;
|
449 |
f947c634
|
gaqhf
|
}
|
450 |
5dfb8a24
|
gaqhf
|
|
451 |
4b4dbca9
|
gaqhf
|
private bool SetChildSymbolMapping(ChildSymbol item)
|
452 |
|
|
{
|
453 |
|
|
foreach (var childSymbol in item.ChildSymbols)
|
454 |
|
|
{
|
455 |
|
|
ChildSymbolMapping childMapping = ChildSymbolMappings.Find(x => x.UID == childSymbol.NAME);
|
456 |
|
|
childSymbol.SPPID.MAPPINGNAME = childMapping != null ? childMapping.SPPIDSYMBOLNAME : null;
|
457 |
|
|
if (string.IsNullOrEmpty(childSymbol.SPPID.MAPPINGNAME))
|
458 |
|
|
return false;
|
459 |
|
|
else
|
460 |
|
|
return SetChildSymbolMapping(childSymbol);
|
461 |
|
|
}
|
462 |
|
|
|
463 |
|
|
return true;
|
464 |
|
|
}
|
465 |
bca86986
|
gaqhf
|
}
|
466 |
|
|
} |