88 |
88 |
SplashScreenManager.ShowForm(typeof(SPPIDSplashScreen), true, true);
|
89 |
89 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetParent, (IntPtr)radApp.HWnd);
|
90 |
90 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText);
|
91 |
|
|
|
91 |
|
92 |
92 |
// Equipment Modeling
|
93 |
93 |
RunEquipmentModeling();
|
94 |
|
|
95 |
94 |
// Symbol Modeling
|
96 |
95 |
RunSymbolModeling();
|
97 |
|
|
98 |
96 |
// LineRun Line Modeling
|
99 |
97 |
RunLineModeling();
|
100 |
|
|
101 |
98 |
// Branch Line Modeling
|
102 |
99 |
RunBranchLineModeling();
|
103 |
|
|
104 |
100 |
// Clear Attribute
|
105 |
101 |
RunClearValueInconsistancy();
|
106 |
|
|
107 |
102 |
// EndBreak Modeling
|
108 |
103 |
RunEndBreakModeling();
|
109 |
|
|
110 |
104 |
// SpecBreak Modeling
|
111 |
105 |
RunSpecBreakModeling();
|
112 |
|
|
113 |
106 |
// Join SameConnector
|
114 |
107 |
RunJoinRunForSameConnector();
|
115 |
|
|
116 |
108 |
// Check FlowDirection
|
117 |
109 |
RunFlowDirection();
|
118 |
|
|
119 |
|
//// LineNumber Modeling
|
120 |
|
//RunLineNumberModeling();
|
121 |
|
|
122 |
|
//// FlowMark Modeling
|
123 |
|
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Flow Mark Modeling");
|
124 |
|
//foreach (var item in document.LINES)
|
125 |
|
// try
|
126 |
|
// {
|
127 |
|
// FlowMarkModeling(item);
|
128 |
|
// }
|
129 |
|
// catch (Exception ex)
|
130 |
|
// {
|
131 |
|
// Log.Write("Error in FlowMarkModeling");
|
132 |
|
// Log.Write("UID : " + item.UID);
|
133 |
|
// Log.Write(ex.Message);
|
134 |
|
// Log.Write(ex.StackTrace);
|
135 |
|
// }
|
136 |
|
|
137 |
|
|
138 |
|
//// Note Symbol Modeling
|
139 |
|
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Note Symbol Modeling");
|
140 |
|
//foreach (var item in document.SYMBOLS)
|
141 |
|
// try
|
142 |
|
// {
|
143 |
|
// NoteSymbolModeling(item);
|
144 |
|
// }
|
145 |
|
// catch (Exception ex)
|
146 |
|
// {
|
147 |
|
// Log.Write("Error in NoteSymbolModeling");
|
148 |
|
// Log.Write("UID : " + item.UID);
|
149 |
|
// Log.Write(ex.Message);
|
150 |
|
// Log.Write(ex.StackTrace);
|
151 |
|
// }
|
152 |
|
|
153 |
|
|
154 |
|
//// Note Modeling
|
155 |
|
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Notes Modeling");
|
156 |
|
//foreach (var item in document.NOTES)
|
157 |
|
// try
|
158 |
|
// {
|
159 |
|
// NoteModeling(item);
|
160 |
|
// }
|
161 |
|
// catch (Exception ex)
|
162 |
|
// {
|
163 |
|
// Log.Write("Error in NoteModeling");
|
164 |
|
// Log.Write("UID : " + item.UID);
|
165 |
|
// Log.Write(ex.Message);
|
166 |
|
// Log.Write(ex.StackTrace);
|
167 |
|
// }
|
168 |
|
|
169 |
|
//// Text Modeling
|
170 |
|
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Texts Modeling");
|
171 |
|
//foreach (var item in document.TEXTINFOS)
|
172 |
|
// try
|
173 |
|
// {
|
174 |
|
// TextModeling(item);
|
175 |
|
// }
|
176 |
|
// catch (Exception ex)
|
177 |
|
// {
|
178 |
|
// Log.Write("Error in TextModeling");
|
179 |
|
// Log.Write("UID : " + item.UID);
|
180 |
|
// Log.Write(ex.Message);
|
181 |
|
// Log.Write(ex.StackTrace);
|
182 |
|
// }
|
183 |
|
|
184 |
|
//// Input LineNumber Attribute
|
185 |
|
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set LineNumbers Attribute");
|
186 |
|
//foreach (var item in document.LINENUMBERS)
|
187 |
|
// try
|
188 |
|
// {
|
189 |
|
// InputLineNumberAttribute(item);
|
190 |
|
// }
|
191 |
|
// catch (Exception ex)
|
192 |
|
// {
|
193 |
|
// Log.Write("Error in InputLineNumberAttribute");
|
194 |
|
// Log.Write("UID : " + item.UID);
|
195 |
|
// Log.Write(ex.Message);
|
196 |
|
// Log.Write(ex.StackTrace);
|
197 |
|
// }
|
198 |
|
|
199 |
|
//// Input Symbol Attribute
|
200 |
|
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set Symbols Attribute");
|
201 |
|
//foreach (var item in document.SYMBOLS)
|
202 |
|
// try
|
203 |
|
// {
|
204 |
|
// InputSymbolAttribute(item, item.ATTRIBUTES);
|
205 |
|
// }
|
206 |
|
// catch (Exception ex)
|
207 |
|
// {
|
208 |
|
// Log.Write("Error in InputSymbolAttribute");
|
209 |
|
// Log.Write("UID : " + item.UID);
|
210 |
|
// Log.Write(ex.Message);
|
211 |
|
// Log.Write(ex.StackTrace);
|
212 |
|
// }
|
213 |
|
|
214 |
|
//// Input SpecBreak Attribute
|
215 |
|
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set Symbols Attribute");
|
216 |
|
//foreach (var item in document.SpecBreaks)
|
217 |
|
// try
|
218 |
|
// {
|
219 |
|
// InputSpecBreakAttribute(item);
|
220 |
|
// }
|
221 |
|
// catch (Exception ex)
|
222 |
|
// {
|
223 |
|
// Log.Write("Error in InputSpecBreakAttribute");
|
224 |
|
// Log.Write("UID : " + item.UID);
|
225 |
|
// Log.Write(ex.Message);
|
226 |
|
// Log.Write(ex.StackTrace);
|
227 |
|
// }
|
228 |
|
|
229 |
|
//// Label Symbol Modeling
|
230 |
|
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Labels Modeling");
|
231 |
|
//foreach (var item in document.SYMBOLS)
|
232 |
|
// try
|
233 |
|
// {
|
234 |
|
// LabelSymbolModeling(item);
|
235 |
|
// }
|
236 |
|
// catch (Exception ex)
|
237 |
|
// {
|
238 |
|
// Log.Write("Error in LabelSymbolModeling");
|
239 |
|
// Log.Write("UID : " + item.UID);
|
240 |
|
// Log.Write(ex.Message);
|
241 |
|
// Log.Write(ex.StackTrace);
|
242 |
|
// }
|
|
110 |
// Note Modeling
|
|
111 |
RunNoteModeling();
|
|
112 |
// Text Modeling
|
|
113 |
RunTextModeling();
|
|
114 |
// Input LineNumber Attribute
|
|
115 |
RunInputLineNumberAttribute();
|
|
116 |
// Input Symbol Attribute
|
|
117 |
RunInputSymbolAttribute();
|
|
118 |
// Input SpecBreak Attribute
|
|
119 |
RunInputSpecBreakAttribute();
|
|
120 |
// Label Symbol Modeling
|
|
121 |
RunLabelSymbolModeling();
|
|
122 |
|
243 |
123 |
|
244 |
124 |
//// LineRun Line Join
|
245 |
125 |
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Join LineRuns");
|
... | ... | |
307 |
187 |
}
|
308 |
188 |
private void RunEquipmentModeling()
|
309 |
189 |
{
|
310 |
|
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Equipments Modeling");
|
311 |
190 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.Equipments.Count);
|
|
191 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Equipments Modeling");
|
312 |
192 |
foreach (Equipment item in document.Equipments)
|
313 |
193 |
{
|
314 |
194 |
try
|
... | ... | |
327 |
207 |
}
|
328 |
208 |
private void RunSymbolModeling()
|
329 |
209 |
{
|
330 |
|
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Symbol Modeling");
|
331 |
210 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count);
|
|
211 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Symbol Modeling");
|
332 |
212 |
prioritySymbols = GetPrioritySymbol();
|
333 |
213 |
foreach (var item in prioritySymbols)
|
334 |
214 |
{
|
... | ... | |
347 |
227 |
}
|
348 |
228 |
private void RunLineModeling()
|
349 |
229 |
{
|
350 |
|
SetPriorityLine();
|
351 |
|
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling");
|
352 |
230 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count);
|
|
231 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling");
|
|
232 |
SetPriorityLine();
|
353 |
233 |
foreach (var item in document.LINES)
|
354 |
234 |
{
|
355 |
235 |
try
|
... | ... | |
368 |
248 |
}
|
369 |
249 |
private void RunBranchLineModeling()
|
370 |
250 |
{
|
371 |
|
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Branch Lines Modeling");
|
372 |
251 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, NewBranchLines.Count);
|
|
252 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Branch Lines Modeling");
|
373 |
253 |
int branchCount = NewBranchLines.Count;
|
374 |
254 |
while (NewBranchLines.Count > 0)
|
375 |
255 |
{
|
... | ... | |
391 |
271 |
}
|
392 |
272 |
private void RunClearValueInconsistancy()
|
393 |
273 |
{
|
394 |
|
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, 1);
|
395 |
|
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Clear Attribute");
|
396 |
|
|
|
274 |
int count = 1;
|
397 |
275 |
bool loop = true;
|
398 |
276 |
while (loop)
|
399 |
277 |
{
|
... | ... | |
410 |
288 |
relationships.Collect(dataSource, Filter: filter);
|
411 |
289 |
|
412 |
290 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, relationships.Count);
|
|
291 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Clear Inconsistent Property Value - " + count);
|
413 |
292 |
foreach (LMRelationship relationship in relationships)
|
414 |
293 |
{
|
415 |
294 |
foreach (LMInconsistency inconsistency in relationship.Inconsistencies)
|
... | ... | |
482 |
361 |
ReleaseCOMObjects(filter);
|
483 |
362 |
ReleaseCOMObjects(criterion);
|
484 |
363 |
ReleaseCOMObjects(relationships);
|
|
364 |
count++;
|
485 |
365 |
}
|
486 |
366 |
|
487 |
367 |
#region 예전 방식
|
... | ... | |
703 |
583 |
SetFlowDirectionByLine(modelId);
|
704 |
584 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
705 |
585 |
}
|
706 |
|
}
|
707 |
586 |
|
708 |
|
private void SetFlowDirectionByLine(string lineModelItemID)
|
709 |
|
{
|
710 |
|
LMModelItem modelItem = dataSource.GetModelItem(lineModelItemID);
|
711 |
|
if (modelItem != null && modelItem.get_ItemStatus() == "Active")
|
|
587 |
void SetFlowDirectionByLine(string lineModelItemID)
|
712 |
588 |
{
|
713 |
|
LMAAttribute attribute = modelItem.Attributes["FlowDirection"];
|
714 |
|
if (attribute != null && !DBNull.Value.Equals(attribute.get_Value()))
|
|
589 |
LMModelItem modelItem = dataSource.GetModelItem(lineModelItemID);
|
|
590 |
if (modelItem != null && modelItem.get_ItemStatus() == "Active")
|
715 |
591 |
{
|
716 |
|
string sFlowDirection = attribute.get_Value().ToString();
|
717 |
|
foreach (LMRepresentation rep in modelItem.Representations)
|
|
592 |
LMAAttribute attribute = modelItem.Attributes["FlowDirection"];
|
|
593 |
if (attribute != null && !DBNull.Value.Equals(attribute.get_Value()))
|
718 |
594 |
{
|
719 |
|
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active")
|
|
595 |
string sFlowDirection = attribute.get_Value().ToString();
|
|
596 |
foreach (LMRepresentation rep in modelItem.Representations)
|
720 |
597 |
{
|
721 |
|
LMConnector connector = dataSource.GetConnector(rep.Id);
|
|
598 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active")
|
|
599 |
{
|
|
600 |
LMConnector connector = dataSource.GetConnector(rep.Id);
|
722 |
601 |
|
723 |
|
foreach (LMRelationship relationship in connector.Relation1Relationships)
|
724 |
|
SetSymbolFlowDirectionByRelationShip(relationship, connector, sFlowDirection);
|
725 |
|
foreach (LMRelationship relationship in connector.Relation2Relationships)
|
726 |
|
SetSymbolFlowDirectionByRelationShip(relationship, connector, sFlowDirection);
|
|
602 |
foreach (LMRelationship relationship in connector.Relation1Relationships)
|
|
603 |
SetSymbolFlowDirectionByRelationShip(relationship, connector, sFlowDirection);
|
|
604 |
foreach (LMRelationship relationship in connector.Relation2Relationships)
|
|
605 |
SetSymbolFlowDirectionByRelationShip(relationship, connector, sFlowDirection);
|
727 |
606 |
|
728 |
|
ReleaseCOMObjects(connector);
|
|
607 |
ReleaseCOMObjects(connector);
|
|
608 |
}
|
729 |
609 |
}
|
730 |
610 |
}
|
|
611 |
ReleaseCOMObjects(modelItem);
|
731 |
612 |
}
|
732 |
|
ReleaseCOMObjects(modelItem);
|
733 |
|
}
|
734 |
613 |
|
735 |
|
void SetSymbolFlowDirectionByRelationShip(LMRelationship relationship, LMConnector connector, string sFlowDirection)
|
736 |
|
{
|
737 |
|
// Item2가 Symbol
|
738 |
|
if (!DBNull.Value.Equals(relationship.Item1RepresentationID) && relationship.Item1RepresentationID == connector.Id &&
|
739 |
|
relationship.Item2RepresentationObject != null && relationship.Item2RepresentationObject.get_RepresentationType() == "Symbol")
|
|
614 |
void SetSymbolFlowDirectionByRelationShip(LMRelationship relationship, LMConnector connector, string sFlowDirection)
|
740 |
615 |
{
|
741 |
|
int symbolIndex = Convert.ToInt32(relationship.get_Item2Location());
|
742 |
|
int lineIndex = Convert.ToInt32(relationship.get_Item1Location());
|
743 |
|
LMModelItem symbolModelItem = relationship.Item2RepresentationObject.ModelItemObject;
|
|
616 |
// Item2가 Symbol
|
|
617 |
if (!DBNull.Value.Equals(relationship.Item1RepresentationID) && relationship.Item1RepresentationID == connector.Id &&
|
|
618 |
relationship.Item2RepresentationObject != null && relationship.Item2RepresentationObject.get_RepresentationType() == "Symbol")
|
|
619 |
{
|
|
620 |
int symbolIndex = Convert.ToInt32(relationship.get_Item2Location());
|
|
621 |
int lineIndex = Convert.ToInt32(relationship.get_Item1Location());
|
|
622 |
LMModelItem symbolModelItem = relationship.Item2RepresentationObject.ModelItemObject;
|
744 |
623 |
|
745 |
|
SetSymbolFlowDirection(lineIndex, symbolIndex, sFlowDirection, symbolModelItem);
|
|
624 |
SetSymbolFlowDirection(lineIndex, symbolIndex, sFlowDirection, symbolModelItem);
|
746 |
625 |
|
747 |
|
symbolModelItem.Commit();
|
748 |
|
ReleaseCOMObjects(symbolModelItem);
|
749 |
|
}
|
750 |
|
// Item1이 Symbol
|
751 |
|
else if (!DBNull.Value.Equals(relationship.Item2RepresentationID) && relationship.Item2RepresentationID == connector.Id &&
|
752 |
|
relationship.Item1RepresentationObject != null && relationship.Item1RepresentationObject.get_RepresentationType() == "Symbol")
|
753 |
|
{
|
754 |
|
int symbolIndex = Convert.ToInt32(relationship.get_Item1Location());
|
755 |
|
int lineIndex = Convert.ToInt32(relationship.get_Item2Location());
|
756 |
|
LMModelItem symbolModelItem = relationship.Item1RepresentationObject.ModelItemObject;
|
|
626 |
symbolModelItem.Commit();
|
|
627 |
ReleaseCOMObjects(symbolModelItem);
|
|
628 |
}
|
|
629 |
// Item1이 Symbol
|
|
630 |
else if (!DBNull.Value.Equals(relationship.Item2RepresentationID) && relationship.Item2RepresentationID == connector.Id &&
|
|
631 |
relationship.Item1RepresentationObject != null && relationship.Item1RepresentationObject.get_RepresentationType() == "Symbol")
|
|
632 |
{
|
|
633 |
int symbolIndex = Convert.ToInt32(relationship.get_Item1Location());
|
|
634 |
int lineIndex = Convert.ToInt32(relationship.get_Item2Location());
|
|
635 |
LMModelItem symbolModelItem = relationship.Item1RepresentationObject.ModelItemObject;
|
757 |
636 |
|
758 |
|
SetSymbolFlowDirection(lineIndex, symbolIndex, sFlowDirection, symbolModelItem);
|
|
637 |
SetSymbolFlowDirection(lineIndex, symbolIndex, sFlowDirection, symbolModelItem);
|
759 |
638 |
|
760 |
|
symbolModelItem.Commit();
|
761 |
|
ReleaseCOMObjects(symbolModelItem);
|
|
639 |
symbolModelItem.Commit();
|
|
640 |
ReleaseCOMObjects(symbolModelItem);
|
|
641 |
}
|
762 |
642 |
}
|
763 |
|
}
|
764 |
643 |
|
765 |
|
void SetSymbolFlowDirection(int lineIndex, int symbolIndex, string sFlowDirection, LMModelItem symbolModelItem)
|
766 |
|
{
|
767 |
|
string attrName = "PipingPoint" + symbolIndex + ".FlowDirection";
|
768 |
|
LMAAttribute attribute = symbolModelItem.Attributes[attrName];
|
769 |
|
if (attribute != null)
|
|
644 |
void SetSymbolFlowDirection(int lineIndex, int symbolIndex, string sFlowDirection, LMModelItem symbolModelItem)
|
770 |
645 |
{
|
771 |
|
if (lineIndex == 0 && sFlowDirection == "End 1 is upstream (Inlet)")
|
772 |
|
attribute.set_Value("End 1 is downstream (Outlet)");
|
773 |
|
else if (lineIndex == 0 && sFlowDirection == "End 1 is downstream (Outlet)")
|
774 |
|
attribute.set_Value("End 1 is upstream (Inlet)");
|
775 |
|
else if (lineIndex == 1 && sFlowDirection == "End 1 is upstream (Inlet)")
|
776 |
|
attribute.set_Value("End 1 is upstream (Inlet)");
|
777 |
|
else if (lineIndex == 1 && sFlowDirection == "End 1 is downstream (Outlet)")
|
778 |
|
attribute.set_Value("End 1 is downstream (Outlet)");
|
|
646 |
string attrName = "PipingPoint" + symbolIndex + ".FlowDirection";
|
|
647 |
LMAAttribute attribute = symbolModelItem.Attributes[attrName];
|
|
648 |
if (attribute != null)
|
|
649 |
{
|
|
650 |
if (lineIndex == 0 && sFlowDirection == "End 1 is upstream (Inlet)")
|
|
651 |
attribute.set_Value("End 1 is downstream (Outlet)");
|
|
652 |
else if (lineIndex == 0 && sFlowDirection == "End 1 is downstream (Outlet)")
|
|
653 |
attribute.set_Value("End 1 is upstream (Inlet)");
|
|
654 |
else if (lineIndex == 1 && sFlowDirection == "End 1 is upstream (Inlet)")
|
|
655 |
attribute.set_Value("End 1 is upstream (Inlet)");
|
|
656 |
else if (lineIndex == 1 && sFlowDirection == "End 1 is downstream (Outlet)")
|
|
657 |
attribute.set_Value("End 1 is downstream (Outlet)");
|
|
658 |
}
|
779 |
659 |
}
|
780 |
660 |
}
|
781 |
661 |
}
|
782 |
|
|
783 |
|
private void RunLineNumberModeling()
|
|
662 |
private void RunNoteModeling()
|
784 |
663 |
{
|
785 |
|
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "LineNumbers Modeling");
|
|
664 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count);
|
|
665 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Notes Modeling");
|
|
666 |
foreach (var item in document.NOTES)
|
|
667 |
try
|
|
668 |
{
|
|
669 |
NoteModeling(item);
|
|
670 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
|
671 |
}
|
|
672 |
catch (Exception ex)
|
|
673 |
{
|
|
674 |
Log.Write("Error in NoteModeling");
|
|
675 |
Log.Write("UID : " + item.UID);
|
|
676 |
Log.Write(ex.Message);
|
|
677 |
Log.Write(ex.StackTrace);
|
|
678 |
}
|
|
679 |
}
|
|
680 |
private void RunTextModeling()
|
|
681 |
{
|
|
682 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.TEXTINFOS.Count);
|
|
683 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Texts Modeling");
|
|
684 |
foreach (var item in document.TEXTINFOS)
|
|
685 |
try
|
|
686 |
{
|
|
687 |
TextModeling(item);
|
|
688 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
|
689 |
}
|
|
690 |
catch (Exception ex)
|
|
691 |
{
|
|
692 |
Log.Write("Error in TextModeling");
|
|
693 |
Log.Write("UID : " + item.UID);
|
|
694 |
Log.Write(ex.Message);
|
|
695 |
Log.Write(ex.StackTrace);
|
|
696 |
}
|
|
697 |
}
|
|
698 |
private void RunInputLineNumberAttribute()
|
|
699 |
{
|
|
700 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINENUMBERS.Count);
|
|
701 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set LineNumbers Attribute");
|
786 |
702 |
foreach (var item in document.LINENUMBERS)
|
787 |
703 |
try
|
788 |
704 |
{
|
789 |
|
LineNumberModeling(item);
|
|
705 |
InputLineNumberAttribute(item);
|
|
706 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
790 |
707 |
}
|
791 |
708 |
catch (Exception ex)
|
792 |
709 |
{
|
793 |
|
Log.Write("Error in LineNumberModeling");
|
|
710 |
Log.Write("Error in InputLineNumberAttribute");
|
|
711 |
Log.Write("UID : " + item.UID);
|
|
712 |
Log.Write(ex.Message);
|
|
713 |
Log.Write(ex.StackTrace);
|
|
714 |
}
|
|
715 |
}
|
|
716 |
private void RunInputSymbolAttribute()
|
|
717 |
{
|
|
718 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count);
|
|
719 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set Symbols Attribute");
|
|
720 |
foreach (var item in document.SYMBOLS)
|
|
721 |
try
|
|
722 |
{
|
|
723 |
InputSymbolAttribute(item, item.ATTRIBUTES);
|
|
724 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
|
725 |
}
|
|
726 |
catch (Exception ex)
|
|
727 |
{
|
|
728 |
Log.Write("Error in InputSymbolAttribute");
|
|
729 |
Log.Write("UID : " + item.UID);
|
|
730 |
Log.Write(ex.Message);
|
|
731 |
Log.Write(ex.StackTrace);
|
|
732 |
}
|
|
733 |
}
|
|
734 |
private void RunInputSpecBreakAttribute()
|
|
735 |
{
|
|
736 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count);
|
|
737 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set Symbols Attribute");
|
|
738 |
foreach (var item in document.SpecBreaks)
|
|
739 |
try
|
|
740 |
{
|
|
741 |
InputSpecBreakAttribute(item);
|
|
742 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
|
743 |
}
|
|
744 |
catch (Exception ex)
|
|
745 |
{
|
|
746 |
Log.Write("Error in InputSpecBreakAttribute");
|
|
747 |
Log.Write("UID : " + item.UID);
|
|
748 |
Log.Write(ex.Message);
|
|
749 |
Log.Write(ex.StackTrace);
|
|
750 |
}
|
|
751 |
}
|
|
752 |
private void RunLabelSymbolModeling()
|
|
753 |
{
|
|
754 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count);
|
|
755 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Labels Modeling");
|
|
756 |
foreach (var item in document.SYMBOLS)
|
|
757 |
try
|
|
758 |
{
|
|
759 |
LabelSymbolModeling(item);
|
|
760 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
|
761 |
}
|
|
762 |
catch (Exception ex)
|
|
763 |
{
|
|
764 |
Log.Write("Error in LabelSymbolModeling");
|
794 |
765 |
Log.Write("UID : " + item.UID);
|
795 |
766 |
Log.Write(ex.Message);
|
796 |
767 |
Log.Write(ex.StackTrace);
|
... | ... | |
945 |
916 |
if (_LMSymbol != null && _TargetItem != null)
|
946 |
917 |
{
|
947 |
918 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id;
|
948 |
|
LMConnector reModelingConnector = FindBreakLineTarget(symbol, targetSymbol);
|
949 |
919 |
|
950 |
|
if (reModelingConnector != null)
|
951 |
|
ReModelingLMConnector(reModelingConnector);
|
|
920 |
if (SPPIDUtil.IsSegmentLine(document, symbol, targetSymbol))
|
|
921 |
{
|
|
922 |
LMConnector reModelingConnector = FindBreakLineTarget(symbol, targetSymbol);
|
|
923 |
if (reModelingConnector != null)
|
|
924 |
ReModelingLMConnector(reModelingConnector);
|
|
925 |
}
|
952 |
926 |
}
|
953 |
927 |
|
954 |
928 |
ReleaseCOMObjects(_TargetItem);
|
... | ... | |
961 |
935 |
_LMSymbol.Commit();
|
962 |
936 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id;
|
963 |
937 |
symbol.SPPID.ModelItemID = _LMSymbol.ModelItemID;
|
964 |
|
symbol.SPPID.GraphicOID = _LMSymbol.get_GraphicOID();
|
|
938 |
symbol.SPPID.GraphicOID = _LMSymbol.get_GraphicOID().ToString();
|
965 |
939 |
|
966 |
940 |
foreach (var item in symbol.ChildSymbols)
|
967 |
941 |
CreateChildSymbol(item, _LMSymbol);
|
... | ... | |
1281 |
1255 |
// Target Item에 Label의 Attribute Input
|
1282 |
1256 |
InputSymbolAttribute(targetItem, symbol.ATTRIBUTES);
|
1283 |
1257 |
|
1284 |
|
string OID = _LMLabelPresist.get_GraphicOID();
|
|
1258 |
string OID = _LMLabelPresist.get_GraphicOID().ToString();
|
1285 |
1259 |
DependencyObject dependency = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID] as DependencyObject;
|
1286 |
1260 |
if (dependency != null)
|
1287 |
1261 |
{
|
... | ... | |
1413 |
1387 |
{
|
1414 |
1388 |
_LMSymbol.Commit();
|
1415 |
1389 |
equipment.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id;
|
1416 |
|
equipment.SPPID.GraphicOID = _LMSymbol.get_GraphicOID();
|
|
1390 |
equipment.SPPID.GraphicOID = _LMSymbol.get_GraphicOID().ToString();
|
1417 |
1391 |
ReleaseCOMObjects(_LMSymbol);
|
1418 |
1392 |
}
|
1419 |
1393 |
|
... | ... | |
1626 |
1600 |
ReleaseCOMObjects(_LMSymbol);
|
1627 |
1601 |
}
|
1628 |
1602 |
|
1629 |
|
private void NewLineModeling(Line line, bool isBranchModeling = false, Tuple<LMConnector, bool, bool> reModelingInfo = null)
|
|
1603 |
private void NewLineModeling(Line line, bool isBranchModeling = false)
|
1630 |
1604 |
{
|
1631 |
1605 |
if (!string.IsNullOrEmpty(line.SPPID.ModelItemId) || (NewBranchLines.Contains(line) && !isBranchModeling))
|
1632 |
1606 |
return;
|
... | ... | |
1642 |
1616 |
NewBranchLines.Add(groupLine);
|
1643 |
1617 |
continue;
|
1644 |
1618 |
}
|
1645 |
|
|
1646 |
1619 |
_LMAItem _LMAItem = _placement.PIDCreateItem(groupLine.SPPID.MAPPINGNAME);
|
1647 |
1620 |
LMSymbol _LMSymbolStart = null;
|
1648 |
1621 |
LMSymbol _LMSymbolEnd = null;
|
... | ... | |
1719 |
1692 |
|
1720 |
1693 |
if (bRemodelingStart || bRemodelingEnd)
|
1721 |
1694 |
ReModelingLine(groupLine, _lMConnector, _LMSymbolStart, _LMSymbolEnd, bRemodelingStart, bRemodelingEnd);
|
1722 |
|
|
|
1695 |
|
|
1696 |
FlowMarkModeling(groupLine);
|
|
1697 |
LineNumberModeling(groupLine);
|
|
1698 |
|
1723 |
1699 |
ReleaseCOMObjects(_lMConnector);
|
1724 |
1700 |
}
|
1725 |
1701 |
|
... | ... | |
1757 |
1733 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active")
|
1758 |
1734 |
{
|
1759 |
1735 |
LMConnector _LMConnector = dataSource.GetConnector(rep.Id);
|
1760 |
|
dynamic OID = rep.get_GraphicOID();
|
|
1736 |
dynamic OID = rep.get_GraphicOID().ToString();
|
1761 |
1737 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
|
1762 |
1738 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
|
1763 |
1739 |
int verticesCount = lineStringGeometry.VertexCount;
|
... | ... | |
1997 |
1973 |
#endregion
|
1998 |
1974 |
_LMAItem _LMAItem = _placement.PIDCreateItem(symbolPath);
|
1999 |
1975 |
LMConnector newConnector = null;
|
2000 |
|
dynamic OID = prevLMConnector.get_GraphicOID();
|
|
1976 |
dynamic OID = prevLMConnector.get_GraphicOID().ToString();
|
2001 |
1977 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
|
2002 |
1978 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
|
2003 |
1979 |
int verticesCount = lineStringGeometry.VertexCount;
|
... | ... | |
2229 |
2205 |
endBreak.SPPID.RepresentationId = _LmLabelPersist.AsLMRepresentation().Id;
|
2230 |
2206 |
if (_LmLabelPersist.ModelItemObject != null)
|
2231 |
2207 |
endBreak.SPPID.ModelItemID = _LmLabelPersist.ModelItemID;
|
2232 |
|
endBreak.SPPID.GraphicOID = _LmLabelPersist.get_GraphicOID();
|
|
2208 |
endBreak.SPPID.GraphicOID = _LmLabelPersist.get_GraphicOID().ToString();
|
2233 |
2209 |
ReleaseCOMObjects(_LmLabelPersist);
|
2234 |
2210 |
}
|
2235 |
2211 |
ReleaseCOMObjects(targetLMConnector);
|
... | ... | |
2252 |
2228 |
#endregion
|
2253 |
2229 |
|
2254 |
2230 |
LMConnector newConnector = null;
|
2255 |
|
dynamic OID = connector.get_GraphicOID();
|
|
2231 |
dynamic OID = connector.get_GraphicOID().ToString();
|
2256 |
2232 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
|
2257 |
2233 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
|
2258 |
2234 |
int verticesCount = lineStringGeometry.VertexCount;
|
... | ... | |
2270 |
2246 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem1SymbolObject, x, y);
|
2271 |
2247 |
placeRunInputs.AddSymbolTarget(connector.ConnectItem2SymbolObject, x, y);
|
2272 |
2248 |
|
|
2249 |
string flowDirection = string.Empty;
|
|
2250 |
LMAAttribute flowAttribute = connector.ModelItemObject.Attributes["FlowDirection"];
|
|
2251 |
if (flowAttribute != null && !DBNull.Value.Equals(flowAttribute.get_Value()))
|
|
2252 |
flowDirection = flowAttribute.get_Value().ToString();
|
|
2253 |
|
2273 |
2254 |
_placement.PIDRemovePlacement(connector.AsLMRepresentation());
|
2274 |
2255 |
newConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs);
|
2275 |
2256 |
ZeroLengthSymbolToSymbolModelItemID.Add(newConnector.ModelItemID);
|
|
2257 |
if (!string.IsNullOrEmpty(flowDirection))
|
|
2258 |
newConnector.ModelItemObject.Attributes["FlowDirection"].set_Value(flowDirection);
|
2276 |
2259 |
}
|
2277 |
2260 |
else
|
2278 |
2261 |
{
|
... | ... | |
2349 |
2332 |
specBreak.SPPID.RepresentationId = _LmLabelPersist.AsLMRepresentation().Id;
|
2350 |
2333 |
if (_LmLabelPersist.ModelItemObject != null)
|
2351 |
2334 |
specBreak.SPPID.ModelItemID = _LmLabelPersist.ModelItemID;
|
2352 |
|
specBreak.SPPID.GraphicOID = _LmLabelPersist.get_GraphicOID();
|
|
2335 |
specBreak.SPPID.GraphicOID = _LmLabelPersist.get_GraphicOID().ToString();
|
2353 |
2336 |
ReleaseCOMObjects(_LmLabelPersist);
|
2354 |
2337 |
}
|
2355 |
2338 |
}
|
... | ... | |
2651 |
2634 |
{
|
2652 |
2635 |
LMConnector _LMConnector = dataSource.GetConnector(rep.Id);
|
2653 |
2636 |
connectorVertices.Add(_LMConnector, new List<double[]>());
|
2654 |
|
dynamic OID = rep.get_GraphicOID();
|
|
2637 |
dynamic OID = rep.get_GraphicOID().ToString();
|
2655 |
2638 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
|
2656 |
2639 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
|
2657 |
2640 |
int verticesCount = lineStringGeometry.VertexCount;
|
... | ... | |
2662 |
2645 |
double x = 0;
|
2663 |
2646 |
double y = 0;
|
2664 |
2647 |
lineStringGeometry.GetVertex(i + 1, ref x, ref y);
|
2665 |
|
connectorVertices[_LMConnector].Add(new double[] { Math.Round(x, 10), Math.Round(y, 10) });
|
|
2648 |
connectorVertices[_LMConnector].Add(new double[] { x, y });
|
2666 |
2649 |
}
|
2667 |
2650 |
}
|
2668 |
2651 |
}
|
... | ... | |
2673 |
2656 |
return connectorVertices;
|
2674 |
2657 |
}
|
2675 |
2658 |
|
|
2659 |
private List<double[]> GetConnectorVertices(LMConnector connector)
|
|
2660 |
{
|
|
2661 |
List<double[]> vertices = new List<double[]>();
|
|
2662 |
dynamic OID = connector.get_GraphicOID().ToString();
|
|
2663 |
DependencyObject drawingObject = radApp.ActiveDocument.ActiveSheet.DrawingObjects[OID];
|
|
2664 |
Ingr.RAD2D.LineStringGeometry2d lineStringGeometry = drawingObject.GetGeometry() as Ingr.RAD2D.LineStringGeometry2d;
|
|
2665 |
int verticesCount = lineStringGeometry.VertexCount;
|
|
2666 |
double[] value = null;
|
|
2667 |
lineStringGeometry.GetVertices(ref verticesCount, ref value);
|
|
2668 |
for (int i = 0; i < verticesCount; i++)
|
|
2669 |
{
|
|
2670 |
double x = 0;
|
|
2671 |
double y = 0;
|
|
2672 |
lineStringGeometry.GetVertex(i + 1, ref x, ref y);
|
|
2673 |
vertices.Add(new double[] { x, y });
|
|
2674 |
}
|
|
2675 |
return vertices;
|
|
2676 |
}
|
|
2677 |
|
2676 |
2678 |
/// <summary>
|
2677 |
2679 |
/// 좌표로 PipeRun의 Connector중에 어느 Connector에 가까운지/붙을지 가져오는 메서드 - 조건에 안맞아서 못찾을시 제일 가까운 점으로 가져오는 방식
|
2678 |
2680 |
/// </summary>
|
... | ... | |
3028 |
3030 |
/// Line Number Symbol을 실제로 Modeling하는 메서드
|
3029 |
3031 |
/// </summary>
|
3030 |
3032 |
/// <param name="lineNumber"></param>
|
3031 |
|
private void LineNumberModeling(LineNumber lineNumber)
|
|
3033 |
private void LineNumberModeling(Line line)
|
3032 |
3034 |
{
|
3033 |
|
object obj = SPPIDUtil.FindObjectByUID(document, lineNumber.CONNLINE);
|
3034 |
|
if (obj != null)
|
|
3035 |
LineNumber lineNumber = document.LINENUMBERS.Find(x => x.CONNLINE == line.UID);
|
|
3036 |
if (lineNumber != null)
|
3035 |
3037 |
{
|
3036 |
|
Line line = obj as Line;
|
3037 |
|
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(line.SPPID.ModelItemId);
|
3038 |
|
LMConnector connectedLMConnector = FindTargetLMConnectorForLabel(connectorVertices, lineNumber.SPPID.ORIGINAL_X, lineNumber.SPPID.ORIGINAL_Y);
|
|
3038 |
LMConnector connectedLMConnector = GetLMConnectorOnlyOne(line.SPPID.ModelItemId);
|
3039 |
3039 |
if (connectedLMConnector != null)
|
3040 |
3040 |
{
|
3041 |
3041 |
double x = 0;
|
... | ... | |
3045 |
3045 |
Array points = new double[] { 0, x, y };
|
3046 |
3046 |
LMLabelPersist _LmLabelPresist = _placement.PIDPlaceLabel(lineNumber.SPPID.MAPPINGNAME, ref points, Rotation: lineNumber.ANGLE, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: false);
|
3047 |
3047 |
|
3048 |
|
foreach (var item in connectorVertices)
|
3049 |
|
ReleaseCOMObjects(item.Key);
|
3050 |
3048 |
if (_LmLabelPresist != null)
|
3051 |
3049 |
{
|
3052 |
3050 |
_LmLabelPresist.Commit();
|
3053 |
3051 |
lineNumber.SPPID.RepresentationId = _LmLabelPresist.AsLMRepresentation().Id;
|
3054 |
3052 |
ReleaseCOMObjects(_LmLabelPresist);
|
3055 |
3053 |
}
|
3056 |
|
else
|
3057 |
|
{
|
3058 |
|
|
3059 |
|
}
|
3060 |
3054 |
}
|
3061 |
3055 |
}
|
3062 |
3056 |
}
|
3063 |
|
|
3064 |
3057 |
/// <summary>
|
3065 |
3058 |
/// Flow Mark Modeling
|
3066 |
3059 |
/// </summary>
|
... | ... | |
3069 |
3062 |
{
|
3070 |
3063 |
if (line.FLOWMARK && !string.IsNullOrEmpty(line.SPPID.ModelItemId) && !string.IsNullOrEmpty(_ETCSetting.FlowMarkSymbolPath))
|
3071 |
3064 |
{
|
3072 |
|
SlopeType targetSlopeType = SPPIDUtil.CalcSlope(line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y);
|
3073 |
|
string mappingPath = _ETCSetting.FlowMarkSymbolPath;
|
3074 |
|
double percent = line.FLOWMARK_PERCENT;
|
3075 |
|
double tempX = 0;
|
3076 |
|
double tempY = 0;
|
3077 |
|
|
3078 |
|
double gapX;
|
3079 |
|
double gapY;
|
3080 |
|
// ID2 기준의 Gap을 구함
|
3081 |
|
if (percent == 0)
|
3082 |
|
{
|
3083 |
|
gapX = 0;
|
3084 |
|
gapY = 0;
|
3085 |
|
}
|
3086 |
|
else
|
3087 |
|
{
|
3088 |
|
gapX = Math.Abs(line.SPPID.START_X - line.SPPID.END_X) / 100 * percent;
|
3089 |
|
gapY = Math.Abs(line.SPPID.START_Y - line.SPPID.END_Y) / 100 * percent;
|
3090 |
|
}
|
3091 |
|
|
3092 |
|
if (line.SPPID.START_X < line.SPPID.END_X)
|
3093 |
|
tempX = line.SPPID.START_X + gapX;
|
3094 |
|
else
|
3095 |
|
tempX = line.SPPID.START_X - gapX;
|
3096 |
|
|
3097 |
|
if (line.SPPID.START_Y < line.SPPID.END_Y)
|
3098 |
|
tempY = line.SPPID.START_Y + gapY;
|
3099 |
|
else
|
3100 |
|
tempY = line.SPPID.START_Y - gapY;
|
3101 |
|
|
3102 |
|
|
3103 |
|
|
3104 |
|
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(line.SPPID.ModelItemId);
|
3105 |
|
LMConnector _TargetItem = null;
|
3106 |
|
double distance = double.MaxValue;
|
3107 |
|
double[] startPoint = null;
|
3108 |
|
double[] endPoint = null;
|
3109 |
|
// ID2의 기준 Gap으로 제일 가까운 Line 찾음(Slope도 같은조건)
|
3110 |
|
foreach (var item in connectorVertices)
|
3111 |
|
{
|
3112 |
|
for (int i = 0; i < item.Value.Count - 1; i++)
|
3113 |
|
{
|
3114 |
|
List<double[]> points = item.Value;
|
3115 |
|
double[] point1 = points[i];
|
3116 |
|
double[] point2 = points[i + 1];
|
3117 |
|
|
3118 |
|
SlopeType slopeType = SPPIDUtil.CalcSlope(point1[0], point1[1], point2[0], point2[1]);
|
3119 |
|
if (slopeType == targetSlopeType)
|
3120 |
|
{
|
3121 |
|
double result = SPPIDUtil.CalcPointToPointdDistance(point1[0], point1[1], tempX, tempY);
|
3122 |
|
if (result < distance)
|
3123 |
|
{
|
3124 |
|
distance = result;
|
3125 |
|
_TargetItem = item.Key;
|
3126 |
|
|
3127 |
|
startPoint = point1;
|
3128 |
|
endPoint = point2;
|
3129 |
|
}
|
3130 |
|
|
3131 |
|
result = SPPIDUtil.CalcPointToPointdDistance(point2[0], point2[1], tempX, tempY);
|
3132 |
|
if (result < distance)
|
3133 |
|
{
|
3134 |
|
distance = result;
|
3135 |
|
_TargetItem = item.Key;
|
3136 |
|
|
3137 |
|
startPoint = point1;
|
3138 |
|
endPoint = point2;
|
3139 |
|
}
|
3140 |
|
}
|
3141 |
|
}
|
3142 |
|
}
|
3143 |
|
|
3144 |
|
if (_TargetItem != null)
|
|
3065 |
LMConnector connector = GetLMConnectorOnlyOne(line.SPPID.ModelItemId);
|
|
3066 |
if (connector != null)
|
3145 |
3067 |
{
|
3146 |
|
double x = 0;
|
3147 |
|
double y = 0;
|
3148 |
|
double angle = 0;
|
3149 |
|
// SPPID 기준의 Gap으로 실 좌표를 구함
|
3150 |
|
if (percent == 0)
|
3151 |
|
{
|
3152 |
|
gapX = 0;
|
3153 |
|
gapY = 0;
|
3154 |
|
}
|
3155 |
|
else
|
3156 |
|
{
|
3157 |
|
gapX = Math.Abs(startPoint[0] - endPoint[0]) / 100 * percent;
|
3158 |
|
gapY = Math.Abs(startPoint[1] - endPoint[1]) / 100 * percent;
|
3159 |
|
}
|
3160 |
|
|
3161 |
|
if (startPoint[0] < endPoint[0])
|
3162 |
|
x = startPoint[0] + gapX;
|
3163 |
|
else
|
3164 |
|
x = startPoint[0] - gapX;
|
3165 |
|
|
3166 |
|
if (startPoint[1] < endPoint[1])
|
3167 |
|
y = startPoint[1] + gapY;
|
3168 |
|
else
|
3169 |
|
y = startPoint[1] - gapY;
|
3170 |
|
|
3171 |
|
if (targetSlopeType == SlopeType.HORIZONTAL)
|
3172 |
|
{
|
3173 |
|
if (startPoint[0] < endPoint[0])
|
3174 |
|
angle = 0;
|
3175 |
|
else
|
3176 |
|
angle = Math.PI;
|
3177 |
|
}
|
3178 |
|
// 90 270
|
3179 |
|
else if (targetSlopeType == SlopeType.VERTICAL)
|
3180 |
|
{
|
3181 |
|
if (startPoint[1] < endPoint[1])
|
3182 |
|
angle = 90 * Math.PI / 180;
|
3183 |
|
else
|
3184 |
|
angle = 270 * Math.PI / 180;
|
3185 |
|
}
|
3186 |
|
|
3187 |
|
LMSymbol _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: 0, Rotation: angle, TargetItem: _TargetItem);
|
3188 |
|
|
3189 |
|
if (_LMSymbol != null)
|
3190 |
|
{
|
3191 |
|
ReleaseCOMObjects(_LMSymbol);
|
3192 |
|
}
|
3193 |
|
|
|
3068 |
string mappingPath = _ETCSetting.FlowMarkSymbolPath;
|
|
3069 |
List<double[]> vertices = GetConnectorVertices(connector);
|
|
3070 |
vertices = vertices.FindAll(x => x[0] > 0 && x[1] > 0);
|
|
3071 |
double[] point = vertices[vertices.Count - 1];
|
|
3072 |
Array array = new double[] { 0, point[0], point[1] };
|
|
3073 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mappingPath, ref array, LabeledItem: connector.AsLMRepresentation());
|
|
3074 |
if (_LMLabelPersist != null)
|
|
3075 |
ReleaseCOMObjects(_LMLabelPersist);
|
3194 |
3076 |
}
|
3195 |
|
|
3196 |
|
foreach (var item in connectorVertices)
|
3197 |
|
ReleaseCOMObjects(item.Key);
|
3198 |
3077 |
}
|
3199 |
3078 |
}
|
3200 |
3079 |
|
... | ... | |
3208 |
3087 |
{
|
3209 |
3088 |
foreach (var item in run.RUNITEMS)
|
3210 |
3089 |
{
|
3211 |
|
if (item.GetType() == typeof(Symbol))
|
3212 |
|
{
|
3213 |
|
Symbol symbol = item as Symbol;
|
3214 |
|
LMSymbol _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
|
3215 |
|
if (_LMSymbol != null)
|
3216 |
|
{
|
3217 |
|
LMModelItem _LMModelItem = _LMSymbol.ModelItemObject;
|
3218 |
|
|
3219 |
|
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active")
|
3220 |
|
{
|
3221 |
|
foreach (var attribute in lineNumber.ATTRIBUTES)
|
3222 |
|
{
|
3223 |
|
LineNumberMapping mapping = document.LineNumberMappings.Find(x => x.UID == attribute.UID);
|
3224 |
|
if (mapping != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
|
3225 |
|
{
|
3226 |
|
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[mapping.SPPIDATTRIBUTENAME];
|
3227 |
|
if (_LMAAttribute != null)
|
3228 |
|
{
|
3229 |
|
if (DBNull.Value.Equals(_LMAAttribute.get_Value()))
|
3230 |
|
_LMAAttribute.set_Value(attribute.VALUE);
|
3231 |
|
else if (_LMAAttribute.get_Value() != attribute.VALUE)
|
3232 |
|
_LMAAttribute.set_Value(attribute.VALUE);
|
3233 |
|
}
|
3234 |
|
}
|
3235 |
|
}
|
3236 |
|
_LMModelItem.Commit();
|
3237 |
|
}
|
3238 |
|
if (_LMModelItem != null)
|
3239 |
|
ReleaseCOMObjects(_LMModelItem);
|
3240 |
|
}
|
3241 |
|
if (_LMSymbol != null)
|
3242 |
|
ReleaseCOMObjects(_LMSymbol);
|
3243 |
|
}
|
3244 |
|
else if (item.GetType() == typeof(Line))
|
|
3090 |
//if (item.GetType() == typeof(Symbol))
|
|
3091 |
//{
|
|
3092 |
// Symbol symbol = item as Symbol;
|
|
3093 |
// LMSymbol _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
|
|
3094 |
// if (_LMSymbol != null)
|
|
3095 |
// {
|
|
3096 |
// LMModelItem _LMModelItem = _LMSymbol.ModelItemObject;
|
|
3097 |
|
|
3098 |
// if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active")
|
|
3099 |
// {
|
|
3100 |
// foreach (var attribute in lineNumber.ATTRIBUTES)
|
|
3101 |
// {
|
|
3102 |
// LineNumberMapping mapping = document.LineNumberMappings.Find(x => x.UID == attribute.UID);
|
|
3103 |
// if (mapping != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
|
|
3104 |
// {
|
|
3105 |
// LMAAttribute _LMAAttribute = _LMModelItem.Attributes[mapping.SPPIDATTRIBUTENAME];
|
|
3106 |
// if (_LMAAttribute != null)
|
|
3107 |
// {
|
|
3108 |
// if (DBNull.Value.Equals(_LMAAttribute.get_Value()))
|
|
3109 |
// _LMAAttribute.set_Value(attribute.VALUE);
|
|
3110 |
// else if (_LMAAttribute.get_Value() != attribute.VALUE)
|
|
3111 |
// _LMAAttribute.set_Value(attribute.VALUE);
|
|
3112 |
// }
|
|
3113 |
// }
|
|
3114 |
// }
|
|
3115 |
// _LMModelItem.Commit();
|
|
3116 |
// }
|
|
3117 |
// if (_LMModelItem != null)
|
|
3118 |
// ReleaseCOMObjects(_LMModelItem);
|
|
3119 |
// }
|
|
3120 |
// if (_LMSymbol != null)
|
|
3121 |
// ReleaseCOMObjects(_LMSymbol);
|
|
3122 |
//}
|
|
3123 |
//else
|
|
3124 |
if (item.GetType() == typeof(Line))
|
3245 |
3125 |
{
|
3246 |
3126 |
Line line = item as Line;
|
3247 |
3127 |
if (line != null)
|
... | ... | |
3269 |
3149 |
}
|
3270 |
3150 |
if (_LMModelItem != null)
|
3271 |
3151 |
ReleaseCOMObjects(_LMModelItem);
|
|
3152 |
|
|
3153 |
break;
|
3272 |
3154 |
}
|
3273 |
3155 |
}
|
3274 |
3156 |
}
|
... | ... | |
3648 |
3530 |
}
|
3649 |
3531 |
|
3650 |
3532 |
/// <summary>
|
3651 |
|
/// Note Symbol Modeling
|
3652 |
|
/// </summary>
|
3653 |
|
/// <param name="symbol"></param>
|
3654 |
|
private void NoteSymbolModeling(Symbol symbol)
|
3655 |
|
{
|
3656 |
|
if (symbol.TYPE == "Notes")
|
3657 |
|
{
|
3658 |
|
string mappingPath = symbol.SPPID.MAPPINGNAME;
|
3659 |
|
double x = symbol.SPPID.ORIGINAL_X;
|
3660 |
|
double y = symbol.SPPID.ORIGINAL_Y;
|
3661 |
|
int mirror = 0;
|
3662 |
|
double angle = symbol.ANGLE;
|
3663 |
|
|
3664 |
|
LMSymbol _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle);
|
3665 |
|
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id;
|
3666 |
|
symbol.SPPID.ModelItemID = _LMSymbol.ModelItemID;
|
3667 |
|
|
3668 |
|
ReleaseCOMObjects(_LMSymbol);
|
3669 |
|
|
3670 |
|
InputSymbolAttribute(symbol, symbol.ATTRIBUTES);
|
3671 |
|
}
|
3672 |
|
}
|
3673 |
|
|
3674 |
|
/// <summary>
|
3675 |
3533 |
/// Label의 좌표를 구하는 메서드(ID2 기준의 좌표 -> SPPID 좌표)
|
3676 |
3534 |
/// </summary>
|
3677 |
3535 |
/// <param name="x"></param>
|