개정판 7a8645c9
dev issue #1229 : text, note modeling
Change-Id: I67bf903df65b6940447b62777565d3c0918d2f52
DTI_PID/APIDConverter/AutoModeling.cs | ||
---|---|---|
172 | 172 |
{ |
173 | 173 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.Notes.Count); |
174 | 174 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetStep, "Note Modeling"); |
175 |
foreach (var item in document.Texts)
|
|
175 |
foreach (var item in document.Notes)
|
|
176 | 176 |
{ |
177 |
TextModeling(item);
|
|
177 |
NoteModeling(item);
|
|
178 | 178 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null); |
179 | 179 |
} |
180 | 180 |
} |
... | ... | |
248 | 248 |
if (text.Aveva.LabelType == LabelType.SingleText) |
249 | 249 |
DrawText(text.Aveva.X, text.Aveva.Y, text.Aveva.Height, text.VALUE); |
250 | 250 |
else if (text.Aveva.LabelType == LabelType.MultiText) |
251 |
DrawMultiLineText(text.Aveva.X, text.Aveva.Y, text.Aveva.Width, text.VALUE); |
|
251 |
{ |
|
252 |
string[] valueArray = text.VALUE.Split(new string[] { "\n" }, StringSplitOptions.None); |
|
253 |
List<string> values = new List<string>(); |
|
254 |
for (int i = 0; i < valueArray.Length; i++) |
|
255 |
values.Insert(0, valueArray[i]); |
|
256 |
|
|
257 |
for (int i = 0; i < values.Count; i++) |
|
258 |
{ |
|
259 |
double x = text.Aveva.X; |
|
260 |
double y = text.Aveva.Y; |
|
261 |
int heightIndex = i; |
|
262 |
|
|
263 |
if (text.TextAngle == TextAngle.Degree0 || text.TextAngle == TextAngle.Degree180) |
|
264 |
y = y + text.Aveva.Height * i; |
|
265 |
else if (text.TextAngle == TextAngle.Degree90 || text.TextAngle == TextAngle.Degree270) |
|
266 |
x = x + text.Aveva.Height * i; |
|
267 |
|
|
268 |
DrawText(x, y, text.Aveva.Height, values[i]); |
|
269 |
} |
|
270 |
} |
|
271 |
|
|
252 | 272 |
|
253 | 273 |
} |
254 | 274 |
private void NoteModeling(Model.Note note) |
... | ... | |
259 | 279 |
if (note.Aveva.LabelType == LabelType.SingleNote) |
260 | 280 |
DrawText(note.Aveva.X, note.Aveva.Y, note.Aveva.Height, note.VALUE); |
261 | 281 |
else if (note.Aveva.LabelType == LabelType.MultiNote) |
262 |
DrawMultiLineText(note.Aveva.X, note.Aveva.Y, note.Aveva.Width, note.VALUE); |
|
282 |
{ |
|
283 |
string[] valueArray = note.VALUE.Split(new string[] { "\n" }, StringSplitOptions.None); |
|
284 |
List<string> values = new List<string>(); |
|
285 |
for (int i = 0; i < valueArray.Length; i++) |
|
286 |
values.Insert(0, valueArray[i]); |
|
287 |
|
|
288 |
for (int i = 0; i < values.Count; i++) |
|
289 |
{ |
|
290 |
double x = note.Aveva.X; |
|
291 |
double y = note.Aveva.Y; |
|
292 |
int heightIndex = i; |
|
293 |
|
|
294 |
if (note.TextAngle == TextAngle.Degree0 || note.TextAngle == TextAngle.Degree180) |
|
295 |
y = y + note.Aveva.Height * i; |
|
296 |
else if (note.TextAngle == TextAngle.Degree90 || note.TextAngle == TextAngle.Degree270) |
|
297 |
x = x + note.Aveva.Height * i; |
|
263 | 298 |
|
299 |
DrawText(x, y, note.Aveva.Height, values[i]); |
|
300 |
} |
|
301 |
} |
|
264 | 302 |
} |
265 | 303 |
#endregion |
266 | 304 |
|
DTI_PID/APIDConverter/Model/PlantItem/Document.cs | ||
---|---|---|
743 | 743 |
foreach (var item in Texts) |
744 | 744 |
{ |
745 | 745 |
item.Aveva = new AvevaLabelInfo(); |
746 |
|
|
747 |
if (item.VALUE.Contains("\n")) |
|
748 |
{ |
|
749 |
double x = item.X1; |
|
750 |
double y = SIZE_HEIGHT - item.Y1; |
|
751 |
ConvertAvevaPoint(ref x, ref y); |
|
752 |
item.Aveva.X = x; |
|
753 |
item.Aveva.Y = y; |
|
754 | 746 |
|
755 |
if (item.TextAngle == TextAngle.Degree0 || item.TextAngle == TextAngle.Degree180) |
|
756 |
{ |
|
757 |
double height = Math.Abs(item.Y1 - item.Y2); |
|
758 |
ConvertAvevaPointY(ref height); |
|
759 |
item.Aveva.Width = height; |
|
760 |
} |
|
761 |
else if (item.TextAngle == TextAngle.Degree90 || item.TextAngle == TextAngle.Degree270) |
|
762 |
{ |
|
763 |
double height = Math.Abs(item.X1 - item.X2); |
|
764 |
ConvertAvevaPointX(ref height); |
|
765 |
item.Aveva.Width = height; |
|
766 |
} |
|
747 |
double x = item.X1; |
|
748 |
double y = SIZE_HEIGHT - item.Y2; |
|
749 |
ConvertAvevaPoint(ref x, ref y); |
|
750 |
item.Aveva.X = x; |
|
751 |
item.Aveva.Y = y; |
|
767 | 752 |
|
768 |
item.Aveva.LabelType = LabelType.MultiText; |
|
753 |
if (item.TextAngle == TextAngle.Degree0 || item.TextAngle == TextAngle.Degree180) |
|
754 |
{ |
|
755 |
double height = Math.Abs(item.Y1 - item.Y2); |
|
756 |
ConvertAvevaPointY(ref height); |
|
757 |
item.Aveva.Height = height; |
|
769 | 758 |
} |
770 |
else |
|
759 |
else if (item.TextAngle == TextAngle.Degree90 || item.TextAngle == TextAngle.Degree270)
|
|
771 | 760 |
{ |
772 |
double x = item.X1; |
|
773 |
double y = SIZE_HEIGHT - item.Y2; |
|
774 |
ConvertAvevaPoint(ref x, ref y); |
|
775 |
item.Aveva.X = x; |
|
776 |
item.Aveva.Y = y; |
|
777 |
|
|
778 |
if (item.TextAngle == TextAngle.Degree0 || item.TextAngle == TextAngle.Degree180) |
|
779 |
{ |
|
780 |
double height = Math.Abs(item.Y1 - item.Y2); |
|
781 |
ConvertAvevaPointY(ref height); |
|
782 |
item.Aveva.Height = height; |
|
783 |
} |
|
784 |
else if (item.TextAngle == TextAngle.Degree90 || item.TextAngle == TextAngle.Degree270) |
|
785 |
{ |
|
786 |
double height = Math.Abs(item.X1 - item.X2); |
|
787 |
ConvertAvevaPointX(ref height); |
|
788 |
item.Aveva.Height = height; |
|
789 |
} |
|
761 |
double height = Math.Abs(item.X1 - item.X2); |
|
762 |
ConvertAvevaPointX(ref height); |
|
763 |
item.Aveva.Height = height; |
|
764 |
} |
|
790 | 765 |
|
791 |
item.Aveva.LabelType = LabelType.SingleText; |
|
766 |
if (item.VALUE.Contains("\n")) |
|
767 |
{ |
|
768 |
item.Aveva.LabelType = LabelType.MultiText; |
|
769 |
int count = item.VALUE.Length - item.VALUE.Replace("\n", "").Length + 1; |
|
770 |
item.Aveva.Height = item.Aveva.Height / count; |
|
792 | 771 |
} |
793 |
|
|
772 |
else |
|
773 |
item.Aveva.LabelType = LabelType.SingleText; |
|
794 | 774 |
|
795 | 775 |
item.Aveva.Angle = RadianToDegree(item.ANGLE); |
796 | 776 |
} |
... | ... | |
798 | 778 |
{ |
799 | 779 |
item.Aveva = new AvevaLabelInfo(); |
800 | 780 |
|
801 |
if (item.VALUE.Contains(@"\n")) |
|
802 |
{ |
|
803 |
double x = item.X1; |
|
804 |
double y = SIZE_HEIGHT - item.Y1; |
|
805 |
ConvertAvevaPoint(ref x, ref y); |
|
806 |
item.Aveva.X = x; |
|
807 |
item.Aveva.Y = y; |
|
781 |
double x = item.X1; |
|
782 |
double y = SIZE_HEIGHT - item.Y2; |
|
783 |
ConvertAvevaPoint(ref x, ref y); |
|
784 |
item.Aveva.X = x; |
|
785 |
item.Aveva.Y = y; |
|
808 | 786 |
|
809 |
if (item.TextAngle == TextAngle.Degree0 || item.TextAngle == TextAngle.Degree180)
|
|
810 |
{
|
|
811 |
double height = Math.Abs(item.Y1 - item.Y2);
|
|
812 |
ConvertAvevaPointY(ref height);
|
|
813 |
item.Aveva.Width = height;
|
|
814 |
}
|
|
815 |
else if (item.TextAngle == TextAngle.Degree90 || item.TextAngle == TextAngle.Degree270)
|
|
816 |
{
|
|
817 |
double height = Math.Abs(item.X1 - item.X2);
|
|
818 |
ConvertAvevaPointX(ref height);
|
|
819 |
item.Aveva.Width = height;
|
|
820 |
}
|
|
787 |
if (item.TextAngle == TextAngle.Degree0 || item.TextAngle == TextAngle.Degree180) |
|
788 |
{ |
|
789 |
double height = Math.Abs(item.Y1 - item.Y2); |
|
790 |
ConvertAvevaPointY(ref height); |
|
791 |
item.Aveva.Height = height;
|
|
792 |
} |
|
793 |
else if (item.TextAngle == TextAngle.Degree90 || item.TextAngle == TextAngle.Degree270) |
|
794 |
{ |
|
795 |
double height = Math.Abs(item.X1 - item.X2); |
|
796 |
ConvertAvevaPointX(ref height); |
|
797 |
item.Aveva.Height = height;
|
|
798 |
} |
|
821 | 799 |
|
800 |
if (item.VALUE.Contains(@"\n")) |
|
801 |
{ |
|
822 | 802 |
item.Aveva.LabelType = LabelType.MultiNote; |
803 |
int count = item.VALUE.Length - item.VALUE.Replace("\n", "").Length + 1; |
|
804 |
item.Aveva.Height = item.Aveva.Height / count; |
|
823 | 805 |
} |
824 | 806 |
else |
825 |
{ |
|
826 |
double x = item.X1; |
|
827 |
double y = SIZE_HEIGHT - item.Y2; |
|
828 |
ConvertAvevaPoint(ref x, ref y); |
|
829 |
item.Aveva.X = x; |
|
830 |
item.Aveva.Y = y; |
|
831 |
|
|
832 |
if (item.TextAngle == TextAngle.Degree0 || item.TextAngle == TextAngle.Degree180) |
|
833 |
{ |
|
834 |
double height = Math.Abs(item.Y1 - item.Y2); |
|
835 |
ConvertAvevaPointY(ref height); |
|
836 |
item.Aveva.Height = height; |
|
837 |
} |
|
838 |
else if (item.TextAngle == TextAngle.Degree90 || item.TextAngle == TextAngle.Degree270) |
|
839 |
{ |
|
840 |
double height = Math.Abs(item.X1 - item.X2); |
|
841 |
ConvertAvevaPointX(ref height); |
|
842 |
item.Aveva.Height = height; |
|
843 |
} |
|
844 |
|
|
845 | 807 |
item.Aveva.LabelType = LabelType.SingleNote; |
846 |
} |
|
847 | 808 |
|
848 | 809 |
item.Aveva.Angle = RadianToDegree(item.ANGLE); |
849 | 810 |
} |
DTI_PID/APIDConverter/Model/PlantItem/Other/AvevaLabelInfo.cs | ||
---|---|---|
22 | 22 |
public double X { get; set; } |
23 | 23 |
public double Y { get; set; } |
24 | 24 |
public double Height { get; set; } |
25 |
public double Width { get; set; } |
|
26 | 25 |
} |
27 | 26 |
} |
내보내기 Unified diff