개정판 d864290f
issue #000: flow mark fixing
Change-Id: I3baf2a32cea06f47ff427b5f4df4bc03a418cc8a
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
138 | 138 |
import math |
139 | 139 |
from EngineeringLineItem import QEngineeringLineItem |
140 | 140 |
|
141 |
allowed_error = 0.09 |
|
141 |
allowed_error_radian = 0.09
|
|
142 | 142 |
|
143 | 143 |
try: |
144 | 144 |
for run in self.runs: |
145 | 145 |
pre = None |
146 |
preDir = None |
|
147 | 146 |
preRadian = None |
148 | 147 |
for item in run.items: |
149 | 148 |
if pre is None and type(item) is QEngineeringLineItem and (item._lineType == 'Primary' or item._lineType == 'Secondary') and item.length() > minLength: |
... | ... | |
151 | 150 |
start = item.line().p1() |
152 | 151 |
end = item.line().p2() |
153 | 152 |
_dir = [(end.x() - start.x())/item.length(), (end.y() - start.y())/item.length()] |
154 |
radian = math.atan2(_dir[0], _dir[1]) - math.pi / 2 |
|
155 |
preDir = _dir |
|
153 |
radian = math.atan2(_dir[1], _dir[0]) - math.pi / 2 |
|
156 | 154 |
preRadian = radian if radian >= 0 else radian + 2 * math.pi |
157 | 155 |
preRadian = abs(preRadian - math.pi) |
158 |
continue |
|
156 |
|
|
159 | 157 |
elif pre and type(item) is QEngineeringLineItem and (item._lineType == 'Primary' or item._lineType == 'Secondary'): |
160 | 158 |
start = item.line().p1() |
161 | 159 |
end = item.line().p2() |
162 | 160 |
_dir = [(end.x() - start.x())/item.length(), (end.y() - start.y())/item.length()] |
163 |
radian = math.atan2(_dir[0], _dir[1]) - math.pi / 2
|
|
161 |
radian = math.atan2(_dir[1], _dir[0]) - math.pi / 2
|
|
164 | 162 |
currRadian = radian if radian >= 0 else radian + 2 * math.pi |
165 | 163 |
currRadian = abs(currRadian - math.pi) |
166 |
if abs(currRadian - preRadian) > allowed_error: |
|
164 |
if abs(currRadian - preRadian) > allowed_error_radian:
|
|
167 | 165 |
# insert flow mark at pre line |
168 | 166 |
if pre.length() > minLength: |
169 | 167 |
#if str(pre.uid) == '62edfbe5-29fd-49af-840b-6dce051e04d1': |
... | ... | |
174 | 172 |
pre.update_arrow() |
175 | 173 |
|
176 | 174 |
pre = item |
177 |
preDir = _dir |
|
178 | 175 |
preRadian = currRadian |
179 | 176 |
|
180 | 177 |
if pre and type(item) is QEngineeringLineItem and (item._lineType == 'Primary' or item._lineType == 'Secondary') and item.length() > minLength: |
내보내기 Unified diff