|
| 1 | +import QtQuick |
| 2 | +import QtQuick.Controls |
| 3 | + |
| 4 | +Rectangle { |
| 5 | + id: plot |
| 6 | + color: "#192329" |
| 7 | + radius: 6 |
| 8 | + property string title |
| 9 | + property string textureName |
| 10 | + property string axisLabel |
| 11 | + property real minimum: -70 |
| 12 | + property real maximum: 70 |
| 13 | + property real dataMinimum: minimum |
| 14 | + property real dataMaximum: maximum |
| 15 | + property real rangeMaximum: 15 |
| 16 | + property real floorDb: 12 |
| 17 | + property real spanDb: 12 |
| 18 | + property bool linearScale: true |
| 19 | + |
| 20 | + Label { |
| 21 | + anchors.top: parent.top |
| 22 | + anchors.topMargin: 18 |
| 23 | + anchors.horizontalCenter: parent.horizontalCenter |
| 24 | + text: plot.title |
| 25 | + font.pixelSize: 22 |
| 26 | + } |
| 27 | + Image { |
| 28 | + id: samples |
| 29 | + visible: false |
| 30 | + cache: false |
| 31 | + smooth: true |
| 32 | + source: "image://radar/" + plot.textureName + "/" + backend.revision |
| 33 | + } |
| 34 | + Item { |
| 35 | + id: chart |
| 36 | + anchors.fill: parent |
| 37 | + anchors.margins: 24 |
| 38 | + anchors.leftMargin: 76 |
| 39 | + anchors.topMargin: 64 |
| 40 | + anchors.bottomMargin: 74 |
| 41 | + ShaderEffect { |
| 42 | + objectName: "heatmapShader" |
| 43 | + anchors.fill: parent |
| 44 | + property var source: samples |
| 45 | + property real floorDb: plot.floorDb |
| 46 | + property real spanDb: plot.spanDb |
| 47 | + property real linearScale: plot.linearScale ? 1 : 0 |
| 48 | + property real xLow: (plot.minimum - plot.dataMinimum) / (plot.dataMaximum - plot.dataMinimum) |
| 49 | + property real xHigh: (plot.maximum - plot.dataMinimum) / (plot.dataMaximum - plot.dataMinimum) |
| 50 | + property real beamspacePeriod: backend.beamspacePeriod |
| 51 | + property real polar: 0 |
| 52 | + property real legend: 0 |
| 53 | + vertexShader: "heatmap.vert.qsb" |
| 54 | + fragmentShader: "heatmap.frag.qsb" |
| 55 | + } |
| 56 | + Repeater { |
| 57 | + model: 5 |
| 58 | + Item { |
| 59 | + required property int index |
| 60 | + x: index * chart.width / 4 |
| 61 | + height: chart.height |
| 62 | + Rectangle { width: 1; height: parent.height; color: "#24ffffff" } |
| 63 | + Label { |
| 64 | + anchors.top: parent.bottom |
| 65 | + anchors.topMargin: 10 |
| 66 | + anchors.horizontalCenter: parent.left |
| 67 | + text: (plot.minimum + index * (plot.maximum - plot.minimum) / 4).toFixed(plot.textureName === "doppler" ? 1 : 0) |
| 68 | + font.pixelSize: 15 |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + Repeater { |
| 73 | + model: 4 |
| 74 | + Item { |
| 75 | + required property int index |
| 76 | + y: (1 - index / 3) * chart.height |
| 77 | + width: chart.width |
| 78 | + Rectangle { height: 1; width: parent.width; color: "#24ffffff" } |
| 79 | + Label { |
| 80 | + anchors.right: parent.left |
| 81 | + anchors.rightMargin: 12 |
| 82 | + anchors.verticalCenter: parent.top |
| 83 | + text: (index * plot.rangeMaximum / 3).toFixed(0) |
| 84 | + font.pixelSize: 15 |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | + } |
| 89 | + Label { |
| 90 | + anchors.horizontalCenter: chart.horizontalCenter |
| 91 | + anchors.bottom: parent.bottom |
| 92 | + anchors.bottomMargin: 16 |
| 93 | + text: plot.axisLabel |
| 94 | + font.pixelSize: 16 |
| 95 | + } |
| 96 | + Label { |
| 97 | + x: 14 - width / 2 |
| 98 | + y: chart.y + (chart.height - height) / 2 |
| 99 | + rotation: -90 |
| 100 | + text: "Range relative to zero (m)" |
| 101 | + font.pixelSize: 16 |
| 102 | + } |
| 103 | +} |
0 commit comments