개정판 8018a77a
issue #480: 라인 인식
Change-Id: I2d2ca98700073ef7a3fd8020f931dc64e81ace31
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
681 | 681 |
|
682 | 682 |
self.show_item_properties(self._item) |
683 | 683 |
|
684 |
pt = self._item.startPoint()
|
|
684 |
pt = self._item.start_point()
|
|
685 | 685 |
key_item = QTableWidgetItem(self.tr("Start")) |
686 | 686 |
key_item.setFlags(Qt.ItemIsEnabled) |
687 |
#key_item.setBackground(Qt.lightGray) |
|
687 |
# key_item.setBackground(Qt.lightGray)
|
|
688 | 688 |
self.setItem(3, 1, key_item) |
689 | 689 |
self.setItem(3, 3, QTableWidgetItem('({},{})'.format(pt[0], pt[1]))) |
690 |
pt = self._item.endPoint()
|
|
690 |
pt = self._item.end_point()
|
|
691 | 691 |
key_item = QTableWidgetItem(self.tr("End")) |
692 | 692 |
key_item.setFlags(Qt.ItemIsEnabled) |
693 |
#key_item.setBackground(Qt.lightGray) |
|
693 |
# key_item.setBackground(Qt.lightGray)
|
|
694 | 694 |
self.setItem(4, 1, key_item) |
695 | 695 |
self.setItem(4, 3, QTableWidgetItem('({},{})'.format(pt[0], pt[1]))) |
696 | 696 |
|
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1729 | 1729 |
if items: |
1730 | 1730 |
lineItem.connect_if_possible(items[-1], 5) |
1731 | 1731 |
else: |
1732 |
pt = lineItem.startPoint()
|
|
1732 |
pt = lineItem.start_point()
|
|
1733 | 1733 |
selected = [item for item in self.graphicsView.scene().items(QPointF(pt[0], pt[1])) if |
1734 | 1734 |
type(item) is QEngineeringConnectorItem or type(item) is QEngineeringLineItem] |
1735 | 1735 |
if selected and selected[0] is not lineItem: |
... | ... | |
1742 | 1742 |
self.graphicsView.scene().addItem(lineItem) |
1743 | 1743 |
app_doc_data.lines.append(lineItem) |
1744 | 1744 |
|
1745 |
pt = items[-1].endPoint()
|
|
1745 |
pt = items[-1].end_point()
|
|
1746 | 1746 |
selected = [item for item in self.graphicsView.scene().items(QPointF(pt[0], pt[1])) if |
1747 |
(type(item) is QEngineeringConnectorItem and item.parent is not items[-1]) or |
|
1748 |
type(item) is QEngineeringLineItem]
|
|
1747 |
(type(item) is QEngineeringConnectorItem and item.parentItem() is not items[-1]) or
|
|
1748 |
(type(item) is QEngineeringLineItem and item is not items[-1])]
|
|
1749 | 1749 |
if selected and selected[0] is not items[-1]: |
1750 | 1750 |
if type(selected[0]) is QEngineeringConnectorItem: |
1751 | 1751 |
items[-1].connect_if_possible(selected[0].parent, 5) |
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
333 | 333 |
length = items[0].length() * 0.5 |
334 | 334 |
dir = items[0].perpendicular() |
335 | 335 |
if self.parent.isHorizontal(): |
336 |
start = [event.scenePos().x() - dir[0] * length, self.parent.startPoint()[1] - dir[1] * length]
|
|
337 |
end = [event.scenePos().x() + dir[0] * length, self.parent.startPoint()[1] + dir[1] * length]
|
|
336 |
start = [event.scenePos().x() - dir[0] * length, self.parent.start_point()[1] - dir[1] * length]
|
|
337 |
end = [event.scenePos().x() + dir[0] * length, self.parent.start_point()[1] + dir[1] * length]
|
|
338 | 338 |
else: |
339 |
start = [self.parent.startPoint()[0] - dir[0] * length, event.scenePos().y() - dir[1] * length]
|
|
340 |
end = [self.parent.startPoint()[0] + dir[0] * length, event.scenePos().y() + dir[1] * length]
|
|
339 |
start = [self.parent.start_point()[0] - dir[0] * length, event.scenePos().y() - dir[1] * length]
|
|
340 |
end = [self.parent.start_point()[0] + dir[0] * length, event.scenePos().y() + dir[1] * length]
|
|
341 | 341 |
|
342 | 342 |
pt = items[0].intersection([start, end]) |
343 | 343 |
if (pt is not None) and (type(pt) == shapely.geometry.point.Point): |
... | ... | |
410 | 410 |
(issubclass(type(item), SymbolSvgItem) or issubclass(type(item), |
411 | 411 |
QEngineeringTextItem) or issubclass( |
412 | 412 |
type(item), QEngineeringLineItem) or type(item) is QEngineeringConnectorItem)] |
413 |
## highlight underitem
|
|
413 |
# highlight underitem |
|
414 | 414 |
if len(items) > 0: |
415 | 415 |
if not hasattr(self, '_underItem') or self._underItem is not items[0]: |
416 | 416 |
if hasattr(self, '_underItem') and self._underItem is not None: |
... | ... | |
421 | 421 |
elif hasattr(self, '_underItem') and self._underItem is not None: |
422 | 422 |
self._underItem.hoverLeaveEvent(event) |
423 | 423 |
self._underItem = None |
424 |
## up to here
|
|
424 |
# up to here |
|
425 | 425 |
|
426 | 426 |
if items and self.parent not in items and type(items[0]) is QEngineeringLineItem: |
427 | 427 |
length = items[0].length() * 0.5 |
428 | 428 |
dir = items[0].perpendicular() |
429 | 429 |
if self.parent.isHorizontal(): |
430 |
start = [event.scenePos().x() - dir[0] * length, self.parent.startPoint()[1] - dir[1] * length]
|
|
431 |
end = [event.scenePos().x() + dir[0] * length, self.parent.startPoint()[1] + dir[1] * length]
|
|
430 |
start = [event.scenePos().x() - dir[0] * length, self.parent.start_point()[1] - dir[1] * length]
|
|
431 |
end = [event.scenePos().x() + dir[0] * length, self.parent.start_point()[1] + dir[1] * length]
|
|
432 | 432 |
else: |
433 |
start = [self.parent.startPoint()[0] - dir[0] * length, event.scenePos().y() - dir[1] * length]
|
|
434 |
end = [self.parent.startPoint()[0] + dir[0] * length, event.scenePos().y() + dir[1] * length]
|
|
433 |
start = [self.parent.start_point()[0] - dir[0] * length, event.scenePos().y() - dir[1] * length]
|
|
434 |
end = [self.parent.start_point()[0] + dir[0] * length, event.scenePos().y() + dir[1] * length]
|
|
435 | 435 |
|
436 | 436 |
pt = items[0].intersection([start, end]) |
437 | 437 |
if (pt is not None) and (type(pt) == shapely.geometry.point.Point): |
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
284 | 284 |
@date 2018.04.16 |
285 | 285 |
''' |
286 | 286 |
|
287 |
def startPoint(self):
|
|
287 |
def start_point(self):
|
|
288 | 288 |
at = self.line().p1() |
289 | 289 |
return (at.x(), at.y()) |
290 | 290 |
|
... | ... | |
294 | 294 |
@date 2018.04.16 |
295 | 295 |
''' |
296 | 296 |
|
297 |
def endPoint(self):
|
|
297 |
def end_point(self):
|
|
298 | 298 |
at = self.line().p2() |
299 | 299 |
return (at.x(), at.y()) |
300 | 300 |
|
... | ... | |
315 | 315 |
def distanceTo(self, pt): |
316 | 316 |
from shapely.geometry import Point, LineString |
317 | 317 |
|
318 |
startPt = self.startPoint()
|
|
319 |
endPt = self.endPoint()
|
|
318 |
startPt = self.start_point()
|
|
319 |
endPt = self.end_point()
|
|
320 | 320 |
line = LineString([(startPt[0], startPt[1]), (endPt[0], endPt[1])]) |
321 | 321 |
dist = line.distance(Point(pt[0], pt[1])) |
322 | 322 |
|
... | ... | |
331 | 331 |
def perpendicular(self): |
332 | 332 |
import math |
333 | 333 |
|
334 |
dx = self.endPoint()[0] - self.startPoint()[0]
|
|
335 |
dy = self.endPoint()[1] - self.startPoint()[1]
|
|
334 |
dx = self.end_point()[0] - self.start_point()[0]
|
|
335 |
dy = self.end_point()[1] - self.start_point()[1]
|
|
336 | 336 |
dx, dy = -dy, dx |
337 | 337 |
length = math.sqrt(dx * dx + dy * dy) |
338 | 338 |
dx /= length |
... | ... | |
349 | 349 |
def angle(self): |
350 | 350 |
import math |
351 | 351 |
|
352 |
startPt = self.startPoint()
|
|
353 |
endPt = self.endPoint()
|
|
352 |
startPt = self.start_point()
|
|
353 |
endPt = self.end_point()
|
|
354 | 354 |
dx = endPt[0] - startPt[0] |
355 | 355 |
dy = endPt[1] - startPt[1] |
356 | 356 |
dot = self.dotProduct((1, 0), (dx, dy)) |
... | ... | |
366 | 366 |
def length(self): |
367 | 367 |
import math |
368 | 368 |
|
369 |
startPt = self.startPoint()
|
|
370 |
endPt = self.endPoint()
|
|
369 |
startPt = self.start_point()
|
|
370 |
endPt = self.end_point()
|
|
371 | 371 |
dx = endPt[0] - startPt[0] |
372 | 372 |
dy = endPt[1] - startPt[1] |
373 | 373 |
return math.sqrt(dx * dx + dy * dy) |
... | ... | |
381 | 381 |
def isHorizontal(self): |
382 | 382 |
import math |
383 | 383 |
|
384 |
startPt = self.startPoint()
|
|
385 |
endPt = self.endPoint()
|
|
384 |
startPt = self.start_point()
|
|
385 |
endPt = self.end_point()
|
|
386 | 386 |
dx = endPt[0] - startPt[0] |
387 | 387 |
dy = endPt[1] - startPt[1] |
388 | 388 |
|
... | ... | |
397 | 397 |
def isVertical(self): |
398 | 398 |
import math |
399 | 399 |
|
400 |
startPt = self.startPoint()
|
|
401 |
endPt = self.endPoint()
|
|
400 |
startPt = self.start_point()
|
|
401 |
endPt = self.end_point()
|
|
402 | 402 |
dx = endPt[0] - startPt[0] |
403 | 403 |
dy = endPt[1] - startPt[1] |
404 | 404 |
|
... | ... | |
416 | 416 |
import math |
417 | 417 |
from shapely.geometry import Point, LineString |
418 | 418 |
|
419 |
startPt = self.startPoint()
|
|
420 |
endPt = self.endPoint()
|
|
419 |
startPt = self.start_point()
|
|
420 |
endPt = self.end_point()
|
|
421 | 421 |
dx = endPt[0] - startPt[0] |
422 | 422 |
dy = endPt[1] - startPt[1] |
423 | 423 |
length = math.sqrt(dx * dx + dy * dy) |
... | ... | |
443 | 443 |
import math |
444 | 444 |
|
445 | 445 |
try: |
446 |
vectors = [(self.endPoint()[0] - self.startPoint()[0], self.endPoint()[1] - self.startPoint()[1]),
|
|
447 |
(rhs.endPoint()[0] - rhs.startPoint()[0], rhs.endPoint()[1] - rhs.startPoint()[1])]
|
|
446 |
vectors = [(self.end_point()[0] - self.start_point()[0], self.end_point()[1] - self.start_point()[1]),
|
|
447 |
(rhs.end_point()[0] - rhs.start_Point()[0], rhs.end_point()[1] - rhs.start_point()[1])]
|
|
448 | 448 |
angle = self.getAngle(rhs) |
449 | 449 |
if (angle == 0) or (angle == math.pi): return True |
450 | 450 |
except ZeroDivisionError: |
... | ... | |
465 | 465 |
from EngineeringConnectorItem import QEngineeringConnectorItem |
466 | 466 |
|
467 | 467 |
if type(item) is QEngineeringLineItem: |
468 |
startPt = item.startPoint()
|
|
469 |
endPt = item.endPoint()
|
|
468 |
startPt = item.start_point()
|
|
469 |
endPt = item.end_point()
|
|
470 | 470 |
|
471 | 471 |
dx = endPt[0] - startPt[0] |
472 | 472 |
dy = endPt[1] - startPt[1] |
... | ... | |
481 | 481 |
|
482 | 482 |
return (pt is not None) and (type(pt) == shapely.geometry.point.Point) |
483 | 483 |
elif type(item) is QEngineeringConnectorItem: |
484 |
start_pt = self.startPoint()
|
|
485 |
end_pt = self.endPoint()
|
|
484 |
start_pt = self.start_point()
|
|
485 |
end_pt = self.end_point()
|
|
486 | 486 |
|
487 | 487 |
lhs = [end_pt[0] - start_pt[0], end_pt[1] - start_pt[1]] |
488 | 488 |
length = math.sqrt(lhs[0] * lhs[0] + lhs[1] * lhs[1]) |
... | ... | |
527 | 527 |
from SymbolSvgItem import SymbolSvgItem |
528 | 528 |
|
529 | 529 |
# line의 Point 정의 |
530 |
startPoint = self.startPoint()
|
|
531 |
endPoint = self.endPoint()
|
|
530 |
startPoint = self.start_point()
|
|
531 |
endPoint = self.end_point()
|
|
532 | 532 |
|
533 | 533 |
if item is not None and type(item) is QEngineeringLineItem: |
534 |
pts = [item.startPoint(), item.endPoint()]
|
|
534 |
pts = [item.start_point(), item.end_point()]
|
|
535 | 535 |
selected = startPoint if self._selectedIndex == 0 else endPoint if self._selectedIndex else [] |
536 | 536 |
|
537 | 537 |
if selected: |
... | ... | |
571 | 571 |
def arrangeVertexOrder(self, arranged): |
572 | 572 |
import math |
573 | 573 |
|
574 |
lhs = [arranged.startPoint(), arranged.endPoint()]
|
|
575 |
rhs = [self.startPoint(), self.endPoint()]
|
|
574 |
lhs = [arranged.start_point(), arranged.end_point()]
|
|
575 |
rhs = [self.start_point(), self.end_point()]
|
|
576 | 576 |
|
577 | 577 |
index = 0 |
578 | 578 |
indexed = 0 |
... | ... | |
614 | 614 |
type(line.connectors[0].connectedItem), SymbolSvgItem)) or ( |
615 | 615 |
line.connectors[1].connectedItem is not None and issubclass( |
616 | 616 |
type(line.connectors[1].connectedItem), SymbolSvgItem)) |
617 |
return (flag and (math.fabs(self.startPoint()[1] - line.startPoint()[1]) < toler))
|
|
617 |
return flag and (math.fabs(self.start_point()[1] - line.start_point()[1]) < toler)
|
|
618 | 618 |
elif self.isVertical() and line.isVertical(): |
619 | 619 |
flag = (line.connectors[0].connectedItem is not None and issubclass( |
620 | 620 |
type(line.connectors[0].connectedItem), SymbolSvgItem)) or ( |
621 | 621 |
line.connectors[1].connectedItem is not None and issubclass( |
622 | 622 |
type(line.connectors[1].connectedItem), SymbolSvgItem)) |
623 |
return (flag and (math.fabs(self.startPoint()[0] - line.startPoint()[0]) < toler))
|
|
623 |
return flag and (math.fabs(self.start_point()[0] - line.start_point()[0]) < toler)
|
|
624 | 624 |
|
625 | 625 |
return False |
626 | 626 |
|
... | ... | |
629 | 629 |
import math |
630 | 630 |
|
631 | 631 |
try: |
632 |
dx = self.endPoint()[0] - self.startPoint()[0]
|
|
633 |
dy = self.endPoint()[1] - self.startPoint()[1]
|
|
632 |
dx = self.end_point()[0] - self.start_point()[0]
|
|
633 |
dy = self.end_point()[1] - self.start_point()[1]
|
|
634 | 634 |
lineLength = math.sqrt(dx * dx + dy * dy) |
635 | 635 |
|
636 |
dx = pt.x - self.startPoint()[0]
|
|
637 |
dy = pt.y - self.startPoint()[1]
|
|
636 |
dx = pt.x - self.start_point()[0]
|
|
637 |
dy = pt.y - self.start_point()[1]
|
|
638 | 638 |
length = math.sqrt(dx * dx + dy * dy) |
639 | 639 |
if length > lineLength: |
640 | 640 |
return True |
641 | 641 |
|
642 |
dx = pt.x - self.endPoint()[0]
|
|
643 |
dy = pt.y - self.endPoint()[1]
|
|
642 |
dx = pt.x - self.end_point()[0]
|
|
643 |
dy = pt.y - self.end_point()[1]
|
|
644 | 644 |
length = math.sqrt(dx * dx + dy * dy) |
645 | 645 |
if length > lineLength: |
646 | 646 |
return True |
... | ... | |
672 | 672 |
|
673 | 673 |
res = [] |
674 | 674 |
|
675 |
start_pt = self.startPoint()
|
|
676 |
end_pt = self.endPoint()
|
|
675 |
start_pt = self.start_point()
|
|
676 |
end_pt = self.end_point()
|
|
677 | 677 |
|
678 | 678 |
try: |
679 | 679 |
if issubclass(type(obj), SymbolSvgItem): |
... | ... | |
713 | 713 |
res.append(start_pt) |
714 | 714 |
res.append(obj.connectors[i].center()) |
715 | 715 |
elif type(obj) is QEngineeringLineItem: |
716 |
_startPt = obj.startPoint()
|
|
717 |
_endPt = obj.endPoint()
|
|
716 |
_startPt = obj.start_point()
|
|
717 |
_endPt = obj.end_point()
|
|
718 | 718 |
if obj.connectors[0].connectedItem is None and self.distanceTo(_startPt) < toler: |
719 | 719 |
if self.connectors[0].connectedItem is None and \ |
720 | 720 |
(Point(start_pt[0], start_pt[1]).distance(Point(_startPt[0], _startPt[1])) < toler): |
... | ... | |
883 | 883 |
docData = AppDocData.instance() |
884 | 884 |
area = docData.getArea('Drawing') |
885 | 885 |
|
886 |
startPt = self.startPoint()
|
|
887 |
endPt = self.endPoint()
|
|
886 |
startPt = self.start_point()
|
|
887 |
endPt = self.end_point()
|
|
888 | 888 |
length = self.length() |
889 | 889 |
direction = [(endPt[0] - startPt[0]) / length, (endPt[1] - startPt[1]) / length] |
890 | 890 |
|
... | ... | |
1028 | 1028 |
-angle, Point(0, 0), use_radians=True) |
1029 | 1029 |
#symbol.connectors[i].sceneConnectPoint = (origin.x + rotatedPt.x, origin.y + rotatedPt.y) |
1030 | 1030 |
|
1031 |
dx1 = symbol.connectors[0].center()[0] - self.startPoint()[0]
|
|
1032 |
dy1 = symbol.connectors[0].center()[1] - self.startPoint()[1]
|
|
1031 |
dx1 = symbol.connectors[0].center()[0] - self.start_point()[0]
|
|
1032 |
dy1 = symbol.connectors[0].center()[1] - self.start_point()[1]
|
|
1033 | 1033 |
length1 = math.sqrt(dx1 * dx1 + dy1 * dy1) |
1034 |
dx2 = symbol.connectors[1].center()[0] - self.startPoint()[0]
|
|
1035 |
dy2 = symbol.connectors[1].center()[1] - self.startPoint()[1]
|
|
1034 |
dx2 = symbol.connectors[1].center()[0] - self.start_point()[0]
|
|
1035 |
dy2 = symbol.connectors[1].center()[1] - self.start_point()[1]
|
|
1036 | 1036 |
length2 = math.sqrt(dx2 * dx2 + dy2 * dy2) |
1037 | 1037 |
|
1038 | 1038 |
if length1 < length2: |
1039 |
processLine = QEngineeringLineItem([symbol.connectors[1].center(), self.endPoint()])
|
|
1039 |
processLine = QEngineeringLineItem([symbol.connectors[1].center(), self.end_point()])
|
|
1040 | 1040 |
processLine.connectors[0].connectedItem = symbol |
1041 | 1041 |
processLine.connectors[1].connectedItem = self.connectors[1].connectedItem |
1042 | 1042 |
self.scene().addItem(processLine) |
... | ... | |
1049 | 1049 |
symbol.connectors[0].connectedItem = self |
1050 | 1050 |
symbol.connectors[1].connectedItem = processLine |
1051 | 1051 |
else: |
1052 |
processLine = QEngineeringLineItem([symbol.connectors[0].center(), self.endPoint()])
|
|
1052 |
processLine = QEngineeringLineItem([symbol.connectors[0].center(), self.end_point()])
|
|
1053 | 1053 |
processLine.connectors[0].connectedItem = symbol |
1054 | 1054 |
processLine.connectors[1].connectedItem = self.connectors[1].connectedItem |
1055 | 1055 |
self.scene().addItem(processLine) |
... | ... | |
1123 | 1123 |
symbol.connectors[1].connectedItem |
1124 | 1124 |
|
1125 | 1125 |
pts = [] |
1126 |
pts.append(self.startPoint())
|
|
1127 |
pts.append(self.endPoint())
|
|
1128 |
pts.append(connected.startPoint())
|
|
1129 |
pts.append(connected.endPoint())
|
|
1126 |
pts.append(self.start_point())
|
|
1127 |
pts.append(self.end_point())
|
|
1128 |
pts.append(connected.start_point())
|
|
1129 |
pts.append(connected.end_point())
|
|
1130 | 1130 |
|
1131 | 1131 |
self.scene().removeItem(connected) |
1132 | 1132 |
|
... | ... | |
1426 | 1426 |
def drawToImage(self, img, color, thickness): |
1427 | 1427 |
"""write recognized lines to image""" |
1428 | 1428 |
try: |
1429 |
ptStart = self.startPoint()
|
|
1430 |
ptEnd = self.endPoint()
|
|
1429 |
ptStart = self.start_point()
|
|
1430 |
ptEnd = self.end_point()
|
|
1431 | 1431 |
cv2.line(img, (round(ptStart[0]), round(ptStart[1])), (round(ptEnd[0]), round(ptEnd[1])), color, thickness) |
1432 | 1432 |
# up to here |
1433 | 1433 |
except Exception as ex: |
... | ... | |
1595 | 1595 |
uidNode.text = str(self.uid) |
1596 | 1596 |
node.append(uidNode) |
1597 | 1597 |
|
1598 |
startPt = self.startPoint()
|
|
1599 |
endPt = self.endPoint()
|
|
1598 |
startPt = self.start_point()
|
|
1599 |
endPt = self.end_point()
|
|
1600 | 1600 |
|
1601 | 1601 |
startNode = Element('STARTPOINT') |
1602 | 1602 |
startNode.text = '{},{}'.format(startPt[0], startPt[1]) |
... | ... | |
1696 | 1696 |
|
1697 | 1697 |
polyline = Element('polyline') |
1698 | 1698 |
polyline.attrib['fill'] = 'none' |
1699 |
start_pt = self.startPoint()
|
|
1700 |
end_pt = self.endPoint()
|
|
1699 |
start_pt = self.start_point()
|
|
1700 |
end_pt = self.end_point()
|
|
1701 | 1701 |
polyline.attrib['points'] = f"{start_pt[0]},{start_pt[1]} " \ |
1702 | 1702 |
f"{end_pt[0]},{end_pt[1]}" |
1703 | 1703 |
node.append(polyline) |
... | ... | |
1919 | 1919 |
|
1920 | 1920 |
if event.buttons() == Qt.LeftButton: |
1921 | 1921 |
pos = event.scenePos() |
1922 |
ptStart = self.startPoint()
|
|
1922 |
ptStart = self.start_point()
|
|
1923 | 1923 |
dx = ptStart[0] - pos.x() |
1924 | 1924 |
dy = ptStart[1] - pos.y() |
1925 | 1925 |
if math.sqrt(dx * dx + dy * dy) < 10: |
1926 | 1926 |
self._selectedIndex = 0 |
1927 | 1927 |
return |
1928 | 1928 |
|
1929 |
ptEnd = self.endPoint()
|
|
1929 |
ptEnd = self.end_point()
|
|
1930 | 1930 |
dx = ptEnd[0] - pos.x() |
1931 | 1931 |
dy = ptEnd[1] - pos.y() |
1932 | 1932 |
if math.sqrt(dx * dx + dy * dy) < 10: |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
760 | 760 |
res = [] |
761 | 761 |
try: |
762 | 762 |
if type(obj) is QEngineeringLineItem: |
763 |
startPt = obj.startPoint()
|
|
764 |
endPt = obj.endPoint()
|
|
763 |
startPt = obj.start_point()
|
|
764 |
endPt = obj.end_point()
|
|
765 | 765 |
for i in range(len(self.connectors)): |
766 | 766 |
if (Point(startPt[0], startPt[1]).distance(Point(self.connectors[i].center()[0], |
767 | 767 |
self.connectors[i].center()[1])) < toler): |
DTI_PID/DTI_PID/XmlGenerator.py | ||
---|---|---|
382 | 382 |
# uuidNode = Element(LLINE_UUID) |
383 | 383 |
# uuidNode.text = line.uid |
384 | 384 |
startPointNode = Element(LLINE_START_POINT_NODE_NAME) |
385 |
startPointNode.text = str(line.startPoint()[0]) + "," + str(line.startPoint()[1])
|
|
385 |
startPointNode.text = str(line.start_point()[0]) + "," + str(line.start_point()[1])
|
|
386 | 386 |
endPointNode = Element(LLINE_END_POINT_NODE_NAME) |
387 |
endPointNode.text = str(line.endPoint()[0]) + "," + str(line.endPoint()[1])
|
|
387 |
endPointNode.text = str(line.end_point()[0]) + "," + str(line.end_point()[1])
|
|
388 | 388 |
# lineInfoNode.append(uuidNode) |
389 | 389 |
lineInfoNode.append(startPointNode) |
390 | 390 |
lineInfoNode.append(endPointNode) |
내보내기 Unified diff