개정판 5e79f8c1
인식된 심볼 연결 정보가 누락된 문제 수정
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
32 | 32 |
@history 2018.04.26 Jeongwoo docDatalineNos = self.lineNos, Not For loop |
33 | 33 |
humkyung 2018.05.08 add flow arrow |
34 | 34 |
Jeongwoo 2018.05.14 Add [runs] on Primary/Secondary Line - Need to modify Secondary Line |
35 |
Jeongwoo 2018.05.15 Make Comments [lineno.conns[0].owner = lineno] |
|
35 | 36 |
''' |
36 | 37 |
def execute(self, toler=50): |
37 | 38 |
from QEngineeringLineItem import QEngineeringLineItem |
... | ... | |
63 | 64 |
# find primary lines |
64 | 65 |
for lineno in docData.lineNos: |
65 | 66 |
if 1 == len(lineno.conns): |
66 |
lineno.conns[0].owner = lineno # set conns's owner to line no |
|
67 |
#lineno.conns[0].owner = lineno # set conns's owner to line no
|
|
67 | 68 |
connectedItems = self.findConnectedObjects(lineno.conns[0], toler=10) |
68 | 69 |
for item in connectedItems: item.owner = lineno # set item's owner |
69 | 70 |
|
DTI_PID/DTI_PID/Shapes/QEngineeringLineItem.py | ||
---|---|---|
236 | 236 |
@author humkyung |
237 | 237 |
@date 2018.04.16 |
238 | 238 |
@history humkyung 2018.05.08 check if line is possible to be connected |
239 |
Jeongwoo 2018.05.15 Split if-statement and Connect each symbol and line |
|
239 | 240 |
''' |
240 | 241 |
def connectIfPossible(self, obj, toler): |
241 | 242 |
from shapely.geometry import Point |
242 | 243 |
from SymbolSvgItem import SymbolSvgItem |
243 | 244 |
res = [] |
244 | 245 |
|
245 |
startPt = self.startPoint() |
|
246 |
startPt = self.startPoint()
|
|
246 | 247 |
endPt = self.endPoint() |
247 | 248 |
|
248 | 249 |
if issubclass(type(obj), SymbolSvgItem): |
249 |
for pt in obj.connPts: |
|
250 |
for i in range(len(obj.connPts)): |
|
251 |
pt = obj.connPts[i] |
|
252 |
if len(obj.conns) <= i: obj.conns.append(None) |
|
253 |
|
|
250 | 254 |
if (self.conns[0] is None) and (Point(startPt[0], startPt[1]).distance(Point(pt[0], pt[1])) < toler): |
251 | 255 |
self.conns[0] = obj |
256 |
obj.conns[i] = self |
|
252 | 257 |
res.append(obj) |
253 | 258 |
if (self.conns[1] is None) and (Point(endPt[0], endPt[1]).distance(Point(pt[0], pt[1])) < toler): |
254 |
self.conns[1] = obj |
|
259 |
self.conns[1] = obj |
|
260 |
obj.conns[i] = self |
|
255 | 261 |
res.append(obj) |
256 | 262 |
elif type(obj) is QEngineeringLineItem: |
257 | 263 |
_startPt = obj.startPoint() |
258 | 264 |
_endPt = obj.endPoint() |
259 |
if((Point(startPt[0], startPt[1]).distance(Point(_startPt[0], _startPt[1])) < toler) or |
|
260 |
(Point(startPt[0], startPt[1]).distance(Point(_endPt[0], _endPt[1])) < toler)): |
|
265 |
if((Point(startPt[0], startPt[1]).distance(Point(_startPt[0], _startPt[1])) < toler)): |
|
266 |
self.conns[0] = obj |
|
267 |
obj.conns[0] = self |
|
268 |
res.append(obj) |
|
269 |
if ((Point(startPt[0], startPt[1]).distance(Point(_endPt[0], _endPt[1])) < toler)): |
|
261 | 270 |
self.conns[0] = obj |
271 |
obj.conns[1] = self |
|
272 |
res.append(obj) |
|
273 |
|
|
274 |
if((Point(endPt[0], endPt[1]).distance(Point(_startPt[0], _startPt[1])) < toler)): |
|
275 |
self.conns[1] = obj |
|
276 |
obj.conns[0] = self |
|
262 | 277 |
res.append(obj) |
263 | 278 |
|
264 |
if((Point(endPt[0], endPt[1]).distance(Point(_startPt[0], _startPt[1])) < toler) or |
|
265 |
(Point(endPt[0], endPt[1]).distance(Point(_endPt[0], _endPt[1])) < toler)): |
|
279 |
if ((Point(endPt[0], endPt[1]).distance(Point(_endPt[0], _endPt[1])) < toler)): |
|
266 | 280 |
self.conns[1] = obj |
281 |
obj.conns[1] = self |
|
267 | 282 |
res.append(obj) |
268 | 283 |
|
269 | 284 |
return res |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
132 | 132 |
@author humkyung |
133 | 133 |
@date 2018.04.16 |
134 | 134 |
@history humkyung 2018.05.08 check if symbol is possible to be connected |
135 |
Jeongwoo 2018.05.15 Connect each symbol and line |
|
135 | 136 |
''' |
136 | 137 |
def connectIfPossible(self, obj, toler=10): |
137 | 138 |
from shapely.geometry import Point |
... | ... | |
146 | 147 |
|
147 | 148 |
if (self.conns[i] is None) and (Point(startPt[0], startPt[1]).distance(Point(self.connPts[i][0], self.connPts[i][1])) < toler): |
148 | 149 |
self.conns[i] = obj |
150 |
obj.conns[0] = self |
|
149 | 151 |
res.append(obj) |
150 | 152 |
if (self.conns[i] is None) and (Point(endPt[0], endPt[1]).distance(Point(self.connPts[i][0], self.connPts[i][1])) < toler): |
151 | 153 |
self.conns[i] = obj |
154 |
obj.conns[1] = self |
|
152 | 155 |
res.append(obj) |
153 | 156 |
elif issubclass(type(obj), SymbolSvgItem): |
154 | 157 |
for i in range(len(self.connPts)): |
... | ... | |
158 | 161 |
_pt = Point(obj.connPts[j][0], obj.connPts[j][1]) |
159 | 162 |
if (self.conns[i] is None) and (_pt.distance(Point(self.connPts[i][0], self.connPts[i][1])) < toler): |
160 | 163 |
self.conns[i] = obj |
164 |
obj.conns[j] = self |
|
161 | 165 |
res.append(obj) |
162 | 166 |
|
163 | 167 |
return res |
내보내기 Unified diff