Saner scrolling behavior and range labeling.
This commit is contained in:
parent
6e230a7d9e
commit
1eca043bac
@ -27,7 +27,7 @@ import threading
|
|||||||
import math
|
import math
|
||||||
import air_modes
|
import air_modes
|
||||||
from air_modes.exceptions import *
|
from air_modes.exceptions import *
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
# model has max range vs. azimuth in n-degree increments
|
# model has max range vs. azimuth in n-degree increments
|
||||||
# contains separate max range for a variety of altitudes so
|
# contains separate max range for a variety of altitudes so
|
||||||
@ -157,20 +157,22 @@ class az_map(QtGui.QWidget):
|
|||||||
def drawRangeRings(self, painter):
|
def drawRangeRings(self, painter):
|
||||||
painter.translate(self.width()/2, self.height()/2)
|
painter.translate(self.width()/2, self.height()/2)
|
||||||
#choose intelligent range step -- keep it between 3-5 rings
|
#choose intelligent range step -- keep it between 3-5 rings
|
||||||
rangestep = 25
|
rangestep = 100
|
||||||
while self.get_range() / rangestep > 5:
|
while self.get_range() / rangestep < 3:
|
||||||
rangestep *= 2
|
rangestep /= 2.0
|
||||||
for i in range(rangestep, self.get_range(), rangestep):
|
for i in np.arange(rangestep, self.get_range(), rangestep):
|
||||||
diameter = (float(i) / self.get_range()) * min(self.width(), self.height())
|
diameter = (float(i) / self.get_range()) * min(self.width(), self.height())
|
||||||
painter.setPen(az_map.ringpen)
|
painter.setPen(az_map.ringpen)
|
||||||
painter.drawEllipse(QtCore.QRectF(-diameter / 2.0,
|
painter.drawEllipse(QtCore.QRectF(-diameter / 2.0,
|
||||||
-diameter / 2.0, diameter, diameter))
|
-diameter / 2.0, diameter, diameter))
|
||||||
painter.setPen(QtGui.QColor(255,127,0,255))
|
painter.setPen(QtGui.QColor(255,127,0,255))
|
||||||
|
|
||||||
painter.drawText(0-50/2.0, diameter/2.0, 50, 30, QtCore.Qt.AlignHCenter,
|
painter.drawText(0-70/2.0, diameter/2.0, 70, 30, QtCore.Qt.AlignHCenter,
|
||||||
"%.0fnm" % i)
|
"%.1fnm" % i)
|
||||||
|
|
||||||
def setMaxRange(self, maxrange):
|
def setMaxRange(self, maxrange):
|
||||||
|
maxrange = max(3.25, maxrange)
|
||||||
|
maxrange = min(500., maxrange)
|
||||||
self.maxrange = maxrange
|
self.maxrange = maxrange
|
||||||
self.repaint()
|
self.repaint()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user