개정판 c3c6d1a6
fixed some bugs
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
484 | 484 |
res.append(obj) |
485 | 485 |
except Exception as ex: |
486 | 486 |
from App import App |
487 |
from AppDocData import MessageType |
|
487 | 488 |
|
488 | 489 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
489 | 490 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
... | ... | |
849 | 850 |
QGraphicsLineItem.paint(self, painter, option, widget) |
850 | 851 |
|
851 | 852 |
## draw direction mark |
852 |
SIZE = 20
|
|
853 |
SIZE = 30
|
|
853 | 854 |
|
854 |
ptStart = self.startPoint() |
|
855 |
ptEnd = self.endPoint() |
|
856 |
_dir = [(ptEnd[0] - ptStart[0])/self.length(), (ptEnd[1] - ptStart[1])/self.length()] |
|
857 |
perpendicular = (-_dir[1], _dir[0]) |
|
858 |
|
|
859 |
polygon = QPolygonF() |
|
860 |
polygon.append(QPointF(ptEnd[0] - _dir[0]*SIZE + perpendicular[0]*SIZE*0.25, |
|
861 |
ptEnd[1] - _dir[1]*SIZE + perpendicular[1]*SIZE*0.25)) |
|
862 |
polygon.append(QPointF(ptEnd[0] - _dir[0]*SIZE - perpendicular[0]*SIZE*0.25, |
|
863 |
ptEnd[1] - _dir[1]*SIZE - perpendicular[1]*SIZE*0.25)) |
|
864 |
polygon.append(QPointF(ptEnd[0], ptEnd[1])) |
|
865 |
polygon.append(polygon[0]) |
|
866 |
|
|
867 |
_pen = self.pen() |
|
868 |
_pen.setWidth(1) |
|
869 |
painter.setPen(_pen) |
|
855 |
length = self.length() |
|
856 |
if length > 0: |
|
857 |
ptStart = self.startPoint() |
|
858 |
ptEnd = self.endPoint() |
|
870 | 859 |
|
871 |
painter.drawConvexPolygon(polygon) |
|
860 |
_dir = [(ptEnd[0] - ptStart[0])/self.length(), (ptEnd[1] - ptStart[1])/self.length()] |
|
861 |
perpendicular = (-_dir[1], _dir[0]) |
|
862 |
|
|
863 |
polygon = QPolygonF() |
|
864 |
polygon.append(QPointF(ptEnd[0] - _dir[0]*SIZE + perpendicular[0]*SIZE*0.25, |
|
865 |
ptEnd[1] - _dir[1]*SIZE + perpendicular[1]*SIZE*0.25)) |
|
866 |
polygon.append(QPointF(ptEnd[0] - _dir[0]*SIZE - perpendicular[0]*SIZE*0.25, |
|
867 |
ptEnd[1] - _dir[1]*SIZE - perpendicular[1]*SIZE*0.25)) |
|
868 |
polygon.append(QPointF(ptEnd[0], ptEnd[1])) |
|
869 |
polygon.append(polygon[0]) |
|
870 |
|
|
871 |
_pen = self.pen() |
|
872 |
_pen.setWidth(1) |
|
873 |
painter.setPen(_pen) |
|
874 |
painter.setBrush(QBrush(_pen.color())) |
|
875 |
painter.drawConvexPolygon(polygon) |
|
872 | 876 |
## up to here |
873 | 877 |
|
874 | 878 |
''' |
DTI_PID/DTI_PID/Shapes/EngineeringUnknownItem.py | ||
---|---|---|
15 | 15 |
|
16 | 16 |
from EngineeringPolylineItem import QEngineeringPolylineItem |
17 | 17 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
18 |
from AppDocData import AppDocData
|
|
18 |
from AppDocData import *
|
|
19 | 19 |
from QEngineeringAbstractItem import QEngineeringAbstractItem |
20 | 20 |
|
21 | 21 |
class QEngineeringUnknownItem(QEngineeringPolylineItem, QEngineeringAbstractItem): |
내보내기 Unified diff