2020-06-25 17:52:30 +00:00
|
|
|
# NanoVNASaver
|
|
|
|
#
|
|
|
|
# A python program to view and export Touchstone data from a NanoVNA
|
2022-05-14 09:00:34 +00:00
|
|
|
# Copyright (C) 2019, 2020 Rune B. Broberg
|
|
|
|
# Copyright (C) 2020ff NanoVNA-Saver Authors
|
2019-09-01 21:13:21 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-09-22 11:42:05 +00:00
|
|
|
import logging
|
2020-05-18 18:58:18 +00:00
|
|
|
from PyQt5 import QtGui, QtCore
|
2019-09-01 21:13:21 +00:00
|
|
|
|
2021-07-06 15:01:20 +00:00
|
|
|
from NanoVNASaver.Charts.Chart import Chart
|
|
|
|
from NanoVNASaver.Charts.Square import SquareChart
|
2019-09-29 14:34:50 +00:00
|
|
|
|
2020-05-18 18:58:18 +00:00
|
|
|
logger = logging.getLogger(__name__)
|
2019-09-07 06:13:39 +00:00
|
|
|
|
|
|
|
|
2019-09-19 12:15:47 +00:00
|
|
|
class PolarChart(SquareChart):
|
2019-09-07 06:13:39 +00:00
|
|
|
def drawChart(self, qp: QtGui.QPainter):
|
2022-05-14 09:00:34 +00:00
|
|
|
center_x = int(self.width()/2)
|
|
|
|
center_y = int(self.height()/2)
|
|
|
|
width_2 = int(self.dim.width / 2)
|
|
|
|
height_2 = int(self.dim.height / 2)
|
|
|
|
width_45 = width_2 * 0.7071
|
|
|
|
height_45 = height_2 * 0.7071
|
|
|
|
|
2021-07-06 15:01:20 +00:00
|
|
|
qp.setPen(QtGui.QPen(Chart.color.text))
|
2019-09-07 06:13:39 +00:00
|
|
|
qp.drawText(3, 15, self.name)
|
2021-07-06 15:01:20 +00:00
|
|
|
qp.setPen(QtGui.QPen(Chart.color.foreground))
|
2019-12-12 14:16:37 +00:00
|
|
|
|
2022-05-14 09:00:34 +00:00
|
|
|
qp.drawEllipse(QtCore.QPoint(center_x, center_y), width_2, height_2)
|
|
|
|
qp.drawEllipse(QtCore.QPoint(center_x, center_y),
|
|
|
|
width_2 // 2, height_2 // 2)
|
2019-09-07 09:43:06 +00:00
|
|
|
|
2022-05-14 09:00:34 +00:00
|
|
|
qp.drawLine(center_x - width_2, center_y, center_x + width_2, center_y)
|
|
|
|
qp.drawLine(center_x, center_y - height_2,
|
|
|
|
center_x, center_y + height_2)
|
2019-09-12 12:30:50 +00:00
|
|
|
|
2022-05-14 09:00:34 +00:00
|
|
|
qp.drawLine(center_x + width_45, center_y + height_45,
|
|
|
|
center_x - width_45, center_y - height_45)
|
|
|
|
qp.drawLine(center_x + width_45, center_y - height_45,
|
|
|
|
center_x - width_45, center_y + height_45)
|
2019-09-12 12:30:50 +00:00
|
|
|
|
2022-05-14 09:00:34 +00:00
|
|
|
self.drawTitle(qp)
|