개정판 460d6abd
Overlap Update
DTI_PID/SPPIDConverter/Main.vb | ||
---|---|---|
452 | 452 |
Next |
453 | 453 |
|
454 | 454 |
Next |
455 |
'Line No Attribute |
|
456 |
For Each oAtrribute As Object In oLineNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
|
457 |
|
|
458 |
Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
|
459 |
Dim oEleObj As XElement |
|
460 |
Dim sUid As String |
|
461 |
Dim sName As String |
|
462 |
Dim sValue As String |
|
463 |
|
|
464 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
|
465 |
sUid = oEleObj.Value |
|
466 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
|
467 |
sName = oEleObj.Value |
|
468 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
|
469 |
sValue = oEleObj.Value |
|
470 |
|
|
471 |
oAddrow(_XML_ATTRIBUTE_UID) = sUid |
|
472 |
oAddrow(_XML_ATTRIBUTE_NAME) = sName |
|
473 |
oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
|
474 |
oAttribute_Dt.Rows.Add(oAddrow) |
|
475 |
Next |
|
476 |
|
|
477 |
|
|
455 | 478 |
CLineNo.Dt_Line = oLine_Dt |
456 | 479 |
CLineNo.Dt_Symbol = oSymbol_Dt |
457 | 480 |
CLineNo.Dt_Attribute = oAttribute_Dt |
... | ... | |
1308 | 1331 |
Dim sSystempath As String = oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
1309 | 1332 |
Dim sStartpoint As String = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
1310 | 1333 |
Dim sEndpoint As String = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
1334 |
Dim sPipeUid As String = oPipeRow(0)(_XML_LINE_UID).ToString() |
|
1335 |
|
|
1311 | 1336 |
ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
1312 | 1337 |
dStart_x = dOriginalStart_x |
1313 | 1338 |
dStart_y = dOriginalStart_y |
1314 |
ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
|
1339 |
|
|
1315 | 1340 |
If ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) Then |
1316 | 1341 |
dEnd_x = dOriginalEnd_x |
1317 | 1342 |
dEnd_y = dOriginalEnd_y |
1343 |
'//Overlap 보정 |
|
1344 |
If FindOverlapLine(oLine_Dt, sPipeUid, dStart_x, dStart_y, dEnd_x, dEnd_y) = False Then |
|
1345 |
'//떨어진 라인 보정 |
|
1346 |
Dim dSeperate_start_x As Double = dStart_x |
|
1347 |
Dim dSeperate_start_y As Double = dStart_y |
|
1348 |
Dim dSeperate_end_x As Double = dEnd_x |
|
1349 |
Dim dSeperate_end_y As Double = dEnd_y |
|
1350 |
CalcSperateLine(dSeperate_start_x, dSeperate_start_y, dSeperate_end_x, dSeperate_end_y) |
|
1351 |
If (FindOverlapLine(oLine_Dt, sPipeUid, dSeperate_start_x, dSeperate_start_y, dSeperate_end_x, dSeperate_end_y)) Then |
|
1352 |
dStart_x = dSeperate_start_x |
|
1353 |
dStart_y = dSeperate_start_y |
|
1354 |
dEnd_x = dSeperate_end_x |
|
1355 |
dEnd_y = dSeperate_end_y |
|
1356 |
End If |
|
1357 |
|
|
1358 |
End If |
|
1359 |
ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
|
1318 | 1360 |
ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
1319 | 1361 |
If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
1362 |
|
|
1320 | 1363 |
objInputs.AddPoint(dStart_x, dStart_y) |
1321 | 1364 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
1322 | 1365 |
objItem = _Placement.PIDCreateItem(sSystempath) |
... | ... | |
1371 | 1414 |
Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'") |
1372 | 1415 |
Dim oAttributeRow() As DataRow |
1373 | 1416 |
If oAttribute_Dt.Rows.Count > 0 Then |
1374 |
oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'")
|
|
1417 |
oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
|
1375 | 1418 |
End If |
1376 | 1419 |
|
1377 | 1420 |
If oSymbolRow.Length > 0 Then |
... | ... | |
1404 | 1447 |
Try |
1405 | 1448 |
If oAttributeRow.Length > 0 Then |
1406 | 1449 |
For Each oAttribute In oAttributeRow |
1407 |
Dim sPIDAttribute As String = oAttribute(0)(_XML_ATTRIBUTE_NAME).ToString()
|
|
1408 |
Dim sPIDValue As String = oAttribute(0)(_XML_ATTRIBUTE_VALUE).ToString()
|
|
1450 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
1451 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
1409 | 1452 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
1410 |
oInstrument.Attributes(0)(sSPPIDAttribute).Value = sPIDValue
|
|
1453 |
oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
1411 | 1454 |
Next |
1412 | 1455 |
oInstrument.Commit() |
1413 | 1456 |
End If |
... | ... | |
1480 | 1523 |
End Try |
1481 | 1524 |
End Function |
1482 | 1525 |
|
1526 |
Private Function FindOverlapLine(ByVal oLine_Dt As DataTable, ByVal sUid As String, ByRef dsx As Double, ByRef dsy As Double, |
|
1527 |
ByRef dex As Double, ByRef dey As Double) |
|
1528 |
Try |
|
1529 |
Dim bCheckOverlap As Boolean = False |
|
1530 |
|
|
1531 |
For Each oRow In oLine_Dt.Rows |
|
1532 |
|
|
1533 |
Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
|
1534 |
Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
|
1535 |
Dim sBUid As String = oRow(_XML_LINE_UID).ToString() |
|
1536 |
If sBUid <> sUid Then |
|
1537 |
Dim d기준s_x As Double = 0 |
|
1538 |
Dim d기준s_y As Double = 0 |
|
1539 |
Dim d기준e_x As Double = 0 |
|
1540 |
Dim d기준e_y As Double = 0 |
|
1541 |
ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
|
1542 |
ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
|
1543 |
|
|
1544 |
If (d기준s_x <= dsx And d기준e_x >= dex) And |
|
1545 |
d기준s_y <= dsy And d기준e_y >= dey Then |
|
1546 |
'겹쳐서 오버되는 길이가 오버되지 않는 길이의 10%미만일때 겹치는 y축좌표를 겹치는점까지 설정 |
|
1547 |
If dsy - d기준s_y > d기준e_y - dey Then |
|
1548 |
Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
|
1549 |
If dResultCalc < 10 Then |
|
1550 |
Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
|
1551 |
Dim dCalcY As Double = Math.Abs(d기준s_y - d기준e_y) |
|
1552 |
Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
|
1553 |
Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
|
1554 |
If dCalcStartY = 0 Then |
|
1555 |
dey = d기준e_y |
|
1556 |
Else |
|
1557 |
dey = dCalcStartY |
|
1558 |
End If |
|
1559 |
|
|
1560 |
End If |
|
1561 |
|
|
1562 |
Else |
|
1563 |
Dim dResultCalc As Double = ((dsy - d기준s_y) / (d기준e_y - dey)) * 100 |
|
1564 |
If dResultCalc < 10 Then |
|
1565 |
Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
|
1566 |
Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
|
1567 |
Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
|
1568 |
Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
|
1569 |
|
|
1570 |
If dCalcStartY = 0 Then |
|
1571 |
dsy = d기준s_y |
|
1572 |
Else |
|
1573 |
dsy = dCalcStartY |
|
1574 |
End If |
|
1575 |
|
|
1576 |
End If |
|
1577 |
|
|
1578 |
End If |
|
1579 |
bCheckOverlap = True |
|
1580 |
ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
|
1581 |
d기준s_y <= dey And d기준e_y >= dsy Then |
|
1582 |
'겹쳐서 오버되는 길이가 오버되지 않는 길이의 10%미만일때 겹치는 y축좌표를 겹치는점까지 설정 |
|
1583 |
If dey - d기준s_y > d기준e_y - dsy Then |
|
1584 |
Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
|
1585 |
If dResultCalc < 10 Then |
|
1586 |
Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
|
1587 |
Dim dCalcY As Double = Math.Abs(d기준s_y - d기준e_y) |
|
1588 |
Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
|
1589 |
Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
|
1590 |
If dCalcStartY = 0 Then |
|
1591 |
dey = d기준e_y |
|
1592 |
Else |
|
1593 |
dey = dCalcStartY |
|
1594 |
End If |
|
1595 |
|
|
1596 |
End If |
|
1597 |
|
|
1598 |
'겹쳐서 오버되는 길이가 오버되지 않는 길이의 10%미만일때 겹치는 y축좌표를 겹치는점까지 설정 |
|
1599 |
|
|
1600 |
Else |
|
1601 |
Dim dResultCalc As Double = ((dsy - d기준s_y) / (d기준e_y - dey)) * 100 |
|
1602 |
If dResultCalc < 10 Then |
|
1603 |
Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
|
1604 |
Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
|
1605 |
Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
|
1606 |
Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
|
1607 |
If dCalcStartY = 0 Then |
|
1608 |
dsy = d기준s_y |
|
1609 |
Else |
|
1610 |
dsy = dCalcStartY |
|
1611 |
End If |
|
1612 |
End If |
|
1613 |
|
|
1614 |
End If |
|
1615 |
bCheckOverlap = True |
|
1616 |
ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
|
1617 |
d기준s_y <= dey And d기준e_y >= dsy Then |
|
1618 |
|
|
1619 |
If dsx - d기준s_x > d기준e_x - dex Then |
|
1620 |
Dim dResultCalc As Double = ((d기준e_x - dex) / (dsx - d기준s_x)) * 100 |
|
1621 |
If dResultCalc < 10 Then |
|
1622 |
Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
|
1623 |
Dim dCalcY As Double = Math.Abs(d기준s_y - d기준e_y) |
|
1624 |
Dim dCalcStartY As Double = Math.Abs(dsy - d기준s_y) |
|
1625 |
Dim dCalcStartX As Double = (dCalcX * dCalcStartY) / dCalcY |
|
1626 |
If dCalcStartX = 0 Then |
|
1627 |
dex = d기준e_x |
|
1628 |
Else |
|
1629 |
dex = dCalcStartX |
|
1630 |
End If |
|
1631 |
End If |
|
1632 |
Else |
|
1633 |
Dim dResultCalc As Double = ((dsy - d기준s_y) / (d기준e_y - dey)) * 100 |
|
1634 |
If dResultCalc < 10 Then |
|
1635 |
Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
|
1636 |
Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
|
1637 |
Dim dCalcStartY As Double = Math.Abs(dsy - d기준s_y) |
|
1638 |
Dim dCalcStartX As Double = (dCalcX * dCalcStartY) / dCalcY |
|
1639 |
If dCalcStartX = 0 Then |
|
1640 |
dsx = d기준s_x |
|
1641 |
Else |
|
1642 |
dsx = dCalcStartX |
|
1643 |
End If |
|
1644 |
End If |
|
1645 |
|
|
1646 |
End If |
|
1647 |
|
|
1648 |
bCheckOverlap = True |
|
1649 |
ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
|
1650 |
d기준s_y <= dey And d기준e_y >= dsy Then |
|
1651 |
|
|
1652 |
If dex - d기준s_x > d기준e_x - dsx Then |
|
1653 |
Dim dResultCalc As Double = ((d기준e_x - dex) / (dsx - d기준s_x)) * 100 |
|
1654 |
If dResultCalc < 10 Then |
|
1655 |
Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
|
1656 |
Dim dCalcY As Double = Math.Abs(d기준s_y - d기준e_y) |
|
1657 |
Dim dCalcStartY As Double = Math.Abs(dsy - d기준s_y) |
|
1658 |
Dim dCalcStartX As Double = (dCalcX * dCalcStartY) / dCalcY |
|
1659 |
If dCalcStartX = 0 Then |
|
1660 |
dex = d기준e_x |
|
1661 |
Else |
|
1662 |
dex = dCalcStartX |
|
1663 |
End If |
|
1664 |
End If |
|
1665 |
Else |
|
1666 |
Dim dResultCalc As Double = ((dsy - d기준s_y) / (d기준e_y - dey)) * 100 |
|
1667 |
If dResultCalc < 10 Then |
|
1668 |
Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
|
1669 |
Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
|
1670 |
Dim dCalcStartY As Double = Math.Abs(dsy - d기준s_y) |
|
1671 |
Dim dCalcStartX As Double = (dCalcX * dCalcStartY) / dCalcY |
|
1672 |
If dCalcStartX = 0 Then |
|
1673 |
dsx = d기준s_x |
|
1674 |
Else |
|
1675 |
dsx = dCalcStartX |
|
1676 |
End If |
|
1677 |
End If |
|
1678 |
|
|
1679 |
End If |
|
1680 |
bCheckOverlap = True |
|
1681 |
End If |
|
1682 |
End If |
|
1683 |
Next |
|
1684 |
Return bCheckOverlap |
|
1685 |
Catch ex As Exception |
|
1686 |
Return False |
|
1687 |
End Try |
|
1688 |
|
|
1689 |
|
|
1690 |
End Function |
|
1691 |
|
|
1692 |
Private Sub CalcSperateLine(ByRef dStartX As Double, ByRef dStartY As Double, |
|
1693 |
ByRef dEndX As Double, ByRef dEndY As Double) |
|
1694 |
Try |
|
1695 |
Dim dRange As Double = 1 'Line 전체 길이의 1%씩 늘이기 |
|
1696 |
If Math.Abs(dStartX - dEndX) > Math.Abs(dStartY - dEndY) Then |
|
1697 |
Dim dCalc_x As Double = Math.Abs(dStartX - dEndX) / 100 |
|
1698 |
If dStartX > dEndX Then |
|
1699 |
dStartX = dStartX + dCalc_x |
|
1700 |
dEndX = dEndX - dCalc_x |
|
1701 |
Else |
|
1702 |
dEndX = dEndX + dCalc_x |
|
1703 |
dStartX = dStartX - dCalc_x |
|
1704 |
End If |
|
1705 |
Else |
|
1706 |
Dim dCalc_y As Double = Math.Abs(dStartY - dEndY) / 100 |
|
1707 |
If dStartY > dEndY Then |
|
1708 |
dStartY = dStartY + dCalc_y |
|
1709 |
dEndY = dEndY - dCalc_y |
|
1710 |
Else |
|
1711 |
dEndY = dEndY + dCalc_y |
|
1712 |
dStartY = dStartY - dCalc_y |
|
1713 |
End If |
|
1714 |
End If |
|
1715 |
|
|
1716 |
|
|
1717 |
|
|
1718 |
Catch ex As Exception |
|
1719 |
|
|
1720 |
End Try |
|
1721 |
|
|
1722 |
|
|
1723 |
End Sub |
|
1724 |
|
|
1483 | 1725 |
Private Function DrawLineNo(ByVal oPiperun As LMPipeRun, ByVal CLine_No As Line_no) As Boolean |
1484 | 1726 |
Try |
1485 | 1727 |
Dim oDatasource As Object = _Placement.PIDDataSource |
내보내기 Unified diff