本文整理汇总了Python中bus.Bus.scalemapLoopupWaypoint方法的典型用法代码示例。如果您正苦于以下问题:Python Bus.scalemapLoopupWaypoint方法的具体用法?Python Bus.scalemapLoopupWaypoint怎么用?Python Bus.scalemapLoopupWaypoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bus.Bus
的用法示例。
在下文中一共展示了Bus.scalemapLoopupWaypoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Window
# 需要导入模块: from bus import Bus [as 别名]
# 或者: from bus.Bus import scalemapLoopupWaypoint [as 别名]
#.........这里部分代码省略.........
self.bus.locateBus()
self.mouse=None
self.timer=QtCore.QTimer()
self.timer.timeout.connect(self.doWork)
self.timer.start(8000)
def showMessage(self,message):
icon = QtGui.QSystemTrayIcon.MessageIcon()
#icon=QtGui.QSystemTrayIcon.Information
self.trayIcon.showMessage(
u'bus coming',message, icon,2000)
def mousePressEvent(self, event):
self.mouse=event.pos()
self.update()
def paintEvent(self,event):
qp=QtGui.QPainter()
qp.begin(self)
self.drawDetails(event,qp)
qp.end()
def drawDetails(self,event,qp):
if len(self.bus.shape)==0:
return
size=self.size()
w=size.width()
h=size.height()
wid=min(h,w/self.bus.xfactor)
margine=int(wid*0.05)
if self.mouse!=None:
t=self.mouse.toTuple()
qp.setPen(QtGui.QColor(168,34,3))
qp.setFont(QtGui.QFont('Decorative', 10))
qp.drawText(event.rect(), QtCore.Qt.AlignTop, "Offset: %s. Stop: %s"% (str(self.bus.scalemapLoopupWaypoint(margine,wid,t)),self.bus.scalemapLoopupStopName(margine,wid,t)))
monitorl=self.bus.busoffset-self.bus.backward
if monitorl<0:
monitorl+=len(self.bus.route)
monitorr=self.bus.busoffset+self.bus.forward
if monitorr>len(self.bus.route):
monitorr-=len(self.bus.route)
pen = QtGui.QPen(QtCore.Qt.black, 2, QtCore.Qt.SolidLine)
qp.setPen(pen)
for i in range(len(self.bus.route)-1):
if i>=monitorl and i<monitorr:
continue
if (i>=monitorl or i<monitorr ) and monitorl>monitorr:
continue
cordi=self.bus.route[i]
nx,ny=self.bus.scalemap(margine,wid,cordi)
cordi2=self.bus.route[i+1]
nx2,ny2=self.bus.scalemap(margine,wid,cordi2)
qp.drawLine(nx,ny,nx2,ny2)
#print nx,ny,nx2,ny2
pen = QtGui.QPen(QtCore.Qt.green, 2, QtCore.Qt.SolidLine)
qp.setPen(pen)
if monitorl<monitorr:
for i in range(monitorl,monitorr):
cordi=self.bus.route[i]
nx,ny=self.bus.scalemap(margine,wid,cordi)
cordi2=self.bus.route[i+1]
nx2,ny2=self.bus.scalemap(margine,wid,cordi2)
qp.drawLine(nx,ny,nx2,ny2)
else:
for i in range(0,monitorr):
cordi=self.bus.route[i]
nx,ny=self.bus.scalemap(margine,wid,cordi)