def getSymbolCoords(self, opts):
"""
Given a list of spot records, return an object representing the coordinates of that symbol within the atlas
"""
sourceRect = np.empty(len(opts), dtype=object)
keyi = None
sourceRecti = None
for i, rec in enumerate(opts):
key = (rec[3], rec[2], id(rec[4]), id(rec[5])) # TODO: use string indexes?
if key == keyi:
sourceRect[i] = sourceRecti
else:
try:
sourceRect[i] = self.symbolMap[key]
except KeyError:
newRectSrc = QtCore.QRectF()
newRectSrc.pen = rec['pen']
newRectSrc.brush = rec['brush']
self.symbolMap[key] = newRectSrc
self.atlasValid = False
sourceRect[i] = newRectSrc
keyi = key
sourceRecti = newRectSrc
return sourceRect
评论列表
文章目录