개정판 f71d5768
dev issue #1229 : ID2 Drawing -> Aveva Drawing 좌표 변환
Change-Id: If758fe416e28f2b1aca8ab2bd51a4ead3ff6a028
DTI_PID/APIDConverter/Model/PlantItem/Document.cs | ||
---|---|---|
540 | 540 |
{ |
541 | 541 |
item.Aveva = new AvevaLineInfo(); |
542 | 542 |
item.Aveva.Name = (string)rows[0]["APID_SYMBOL"]; |
543 |
item.Aveva.Start_X = item.Start_X; |
|
544 |
item.Aveva.Start_Y = SIZE_HEIGHT - item.Start_Y; |
|
545 |
item.Aveva.End_X = item.End_X; |
|
546 |
item.Aveva.End_Y = SIZE_HEIGHT - item.End_Y; |
|
543 |
double startX = item.Start_X; |
|
544 |
double startY = SIZE_HEIGHT - item.Start_Y; |
|
545 |
double endX = item.End_X; |
|
546 |
double endY = SIZE_HEIGHT - item.End_Y; |
|
547 |
|
|
548 |
ConvertAvevaPoint(ref startX, ref startY); |
|
549 |
ConvertAvevaPoint(ref endX, ref endY); |
|
550 |
|
|
551 |
item.Aveva.Start_X = startX; |
|
552 |
item.Aveva.Start_Y = startY; |
|
553 |
item.Aveva.End_X = endX; |
|
554 |
item.Aveva.End_Y = endY; |
|
547 | 555 |
|
548 | 556 |
if (!DBNull.Value.Equals(rows[0]["DATA1"])) |
549 | 557 |
{ |
... | ... | |
563 | 571 |
if (rows.Length == 1 && !DBNull.Value.Equals(rows[0]["APID_SYMBOL"]) && !string.IsNullOrEmpty((string)rows[0]["APID_SYMBOL"])) |
564 | 572 |
{ |
565 | 573 |
item.Aveva = new AvevaSymbolInfo(); |
566 |
item.Aveva.X = item.X; |
|
567 |
item.Aveva.Y = SIZE_HEIGHT - item.Y; |
|
574 |
double x = item.X; |
|
575 |
double y = SIZE_HEIGHT - item.Y; |
|
576 |
|
|
577 |
ConvertAvevaPoint(ref x, ref y); |
|
578 |
|
|
579 |
item.Aveva.X = x; |
|
580 |
item.Aveva.Y = y; |
|
581 |
|
|
568 | 582 |
item.Aveva.FullName = (string)rows[0]["APID_SYMBOL"]; |
569 | 583 |
string[] split = item.Aveva.FullName.Split(new char[] { '\\' }); |
570 | 584 |
item.Aveva.Name = split[split.Length - 1]; |
... | ... | |
576 | 590 |
return result; |
577 | 591 |
} |
578 | 592 |
|
593 |
private void ConvertAvevaPoint(ref double x, ref double y) |
|
594 |
{ |
|
595 |
decimal drawingSizeWidth = Convert.ToDecimal(Properties.Settings.Default.DrawingX); |
|
596 |
decimal drawingSizeHeight = Convert.ToDecimal(Properties.Settings.Default.DrawingY); |
|
597 |
decimal id2Width = Convert.ToDecimal(SIZE_WIDTH); |
|
598 |
decimal id2Height = Convert.ToDecimal(SIZE_HEIGHT); |
|
599 |
|
|
600 |
x = Convert.ToDouble(drawingSizeWidth / id2Width * Convert.ToDecimal(x)); |
|
601 |
y = Convert.ToDouble(drawingSizeHeight / id2Height * Convert.ToDecimal(y)); |
|
602 |
} |
|
603 |
|
|
579 | 604 |
#endregion |
580 | 605 |
} |
581 | 606 |
} |
내보내기 Unified diff