개정판 59dac246
add stream no text item
Change-Id: I44df9c4a37899b24984df38f409297c1f1ace2bf
HYTOS/HYTOS/Shapes/EngineeringStreamNoTextItem.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
""" This is engineering stream no text item module """ |
|
3 |
|
|
4 |
import os.path |
|
5 |
import sys |
|
6 |
import copy |
|
7 |
try: |
|
8 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR, QRect |
|
9 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen, QTransform, QFont |
|
10 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem, QGraphicsTextItem |
|
11 |
except ImportError: |
|
12 |
try: |
|
13 |
from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR, QRect |
|
14 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QFont |
|
15 |
except ImportError: |
|
16 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
|
17 |
|
|
18 |
from AppDocData import AppDocData,MessageType |
|
19 |
|
|
20 |
class QEngineeringStreamNoTextItem(QGraphicsTextItem): |
|
21 |
""" This is engineering stream no text item class """ |
|
22 |
|
|
23 |
def __init__(self, text, parent=None): |
|
24 |
import uuid |
|
25 |
|
|
26 |
QGraphicsTextItem.__init__(self, text, parent) |
|
27 |
self.type = 'STREAM NO' |
|
28 |
|
|
29 |
font = QFont('Arial', 15) |
|
30 |
font.setPointSizeF(5) |
|
31 |
self.setFont(font) |
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py | ||
---|---|---|
1 | 1 |
# coding: utf-8 |
2 |
""" |
|
3 |
This is Polyline item module |
|
4 |
""" |
|
2 |
""" This is stream line item module """ |
|
5 | 3 |
|
6 | 4 |
import sys |
7 | 5 |
import os.path |
8 | 6 |
import copy |
7 |
import numpy as np |
|
8 |
|
|
9 | 9 |
try: |
10 | 10 |
from PyQt5.QtCore import * |
11 | 11 |
from PyQt5.QtGui import * |
... | ... | |
19 | 19 |
from EngineeringAbstractItem import QEngineeringAbstractItem |
20 | 20 |
|
21 | 21 |
class QEngineeringStreamlineItem(QGraphicsPathItem, QEngineeringAbstractItem): |
22 |
""" This is EngineeringPolylineItem Class """
|
|
22 |
""" This is EngineeringStreamlineItem Class """
|
|
23 | 23 |
|
24 | 24 |
ARROW_SIZE = 10 |
25 | 25 |
ZVALUE = 100 |
... | ... | |
32 | 32 |
''' |
33 | 33 |
def __init__(self, uid=None, parent=None): |
34 | 34 |
import uuid |
35 |
from EngineeringStreamNoTextItem import QEngineeringStreamNoTextItem |
|
35 | 36 |
|
36 | 37 |
try: |
37 | 38 |
QGraphicsPathItem.__init__(self, parent) |
... | ... | |
46 | 47 |
self._pt = None |
47 | 48 |
self.setPen(QPen(Qt.blue, 1, Qt.SolidLine)) # set default pen |
48 | 49 |
|
50 |
self._stream_no = QEngineeringStreamNoTextItem('<0>', self) |
|
51 |
|
|
49 | 52 |
self.transfer = Transfer() |
50 | 53 |
self.transfer.onRemoved.connect(self.on_item_removed) |
51 | 54 |
self.setZValue(QEngineeringStreamlineItem.ZVALUE) |
... | ... | |
151 | 154 |
@date 2018.04.23 |
152 | 155 |
''' |
153 | 156 |
def __buildItem(self): |
157 |
import math |
|
158 |
|
|
154 | 159 |
path = QPainterPath() |
155 | 160 |
path.moveTo(self._vertices[0][0], self._vertices[0][1]) |
161 |
|
|
162 |
max_length = 0 |
|
163 |
max_length_line = [None, None] |
|
156 | 164 |
for i in range(1, len(self._vertices)): |
157 | 165 |
path.lineTo(self._vertices[i][0], self._vertices[i][1]) |
166 |
dx = self._vertices[i][0] - self._vertices[i-1][0] |
|
167 |
dy = self._vertices[i][1] - self._vertices[i-1][1] |
|
168 |
if dx*dx + dy*dy > max_length: |
|
169 |
max_length = dx*dx + dy*dy |
|
170 |
max_length_line[0] = self._vertices[i-1] |
|
171 |
max_length_line[1] = self._vertices[i] |
|
172 |
|
|
158 | 173 |
self.setPath(path) |
159 | 174 |
self.isCreated = True |
160 | 175 |
|
176 |
if max_length_line[0] is not None and max_length_line[1] is not None: |
|
177 |
x = (max_length_line[0][0] + max_length_line[1][0] - self._stream_no.textWidth())*0.5 |
|
178 |
y = (max_length_line[0][1] + max_length_line[1][1])*0.5 |
|
179 |
self._stream_no.setPos(QPointF(x, y)) |
|
180 |
dx = max_length_line[0][0] - max_length_line[1][0] |
|
181 |
dy = max_length_line[0][1] - max_length_line[1][1] |
|
182 |
self._stream_no.setRotation(90) if abs(dy) > abs(dx) else self._stream_no.setRotation(0) |
|
183 |
|
|
161 | 184 |
''' |
162 | 185 |
@brief return bouding rectangle of polyline |
163 | 186 |
@author humkyung |
build.bat | ||
---|---|---|
25 | 25 |
|
26 | 26 |
REM deploy artifacts |
27 | 27 |
..\curl.exe -uadmin:dof1073# -X PUT "http://www.devdoftech.co.kr:9081/artifactory/HYTOS/Setup/HYTOS-%1.msi" -T ".\Setup\HYTOS-%1.msi" |
28 |
IF %ERRORLEVEL% NEQ 0 goto :ERROR |
|
28 | 29 |
|
29 | 30 |
:EOF |
30 | 31 |
ECHO process completed |
내보내기 Unified diff