@@ -98,26 +98,32 @@ Common.ESPARGOSApplication {
9898 Layout .fillHeight : true
9999 spacing: 20
100100
101- // Combined constellation diagram for L and R antenna feeds
102- Item {
103- id: chartFeedsContainer
104- Layout .fillWidth : true
101+ // Left third: constellation diagrams stacked vertically
102+ ColumnLayout {
105103 Layout .fillHeight : true
106- Layout .minimumWidth : 300
107- Layout .minimumHeight : 300
108-
109- ChartView {
110- id: chartFeeds
111- title: " Antenna Feeds (L/R)"
112- titleColor: textColor
113- width: Math .min (parent .width , parent .height )
114- height: Math .min (parent .width , parent .height )
115- anchors .centerIn : parent
116- antialiasing: true
117- backgroundColor: " #1a252e"
118- legend .visible : true
119- legend .labelColor : textColor
120- legend .alignment : Qt .AlignBottom
104+ Layout .preferredWidth : parent .width / 3
105+ Layout .maximumWidth : parent .width / 3
106+ spacing: 10
107+
108+ // Combined constellation diagram for L and R antenna feeds
109+ Item {
110+ id: chartFeedsContainer
111+ Layout .fillWidth : true
112+ Layout .fillHeight : true
113+ Layout .minimumHeight : 200
114+
115+ ChartView {
116+ id: chartFeeds
117+ title: " Antenna Feeds (L/R)"
118+ titleColor: textColor
119+ width: Math .min (parent .width , parent .height )
120+ height: Math .min (parent .width , parent .height )
121+ anchors .centerIn : parent
122+ antialiasing: true
123+ backgroundColor: " #1a252e"
124+ legend .visible : true
125+ legend .labelColor : textColor
126+ legend .alignment : Qt .AlignBottom
121127
122128 ValueAxis {
123129 id: axisXFeeds
@@ -167,28 +173,27 @@ Common.ESPARGOSApplication {
167173 borderWidth: 1
168174 }
169175 }
170- }
176+ }
171177
172- // Combined constellation diagram for H and V (linear polarization)
173- Item {
174- id: chartLinearContainer
175- Layout .fillWidth : true
176- Layout .fillHeight : true
177- Layout .minimumWidth : 300
178- Layout .minimumHeight : 300
179-
180- ChartView {
181- id: chartLinear
182- title: " Linear Polarization (H/V)"
183- titleColor: textColor
184- width: Math .min (parent .width , parent .height )
185- height: Math .min (parent .width , parent .height )
186- anchors .centerIn : parent
187- antialiasing: true
188- backgroundColor: " #1a252e"
189- legend .visible : true
190- legend .labelColor : textColor
191- legend .alignment : Qt .AlignBottom
178+ // Combined constellation diagram for H and V (linear polarization)
179+ Item {
180+ id: chartLinearContainer
181+ Layout .fillWidth : true
182+ Layout .fillHeight : true
183+ Layout .minimumHeight : 200
184+
185+ ChartView {
186+ id: chartLinear
187+ title: " Linear Polarization (H/V)"
188+ titleColor: textColor
189+ width: Math .min (parent .width , parent .height )
190+ height: Math .min (parent .width , parent .height )
191+ anchors .centerIn : parent
192+ antialiasing: true
193+ backgroundColor: " #1a252e"
194+ legend .visible : true
195+ legend .labelColor : textColor
196+ legend .alignment : Qt .AlignBottom
192197
193198 ValueAxis {
194199 id: axisXLinear
@@ -237,6 +242,104 @@ Common.ESPARGOSApplication {
237242 borderColor: " #ff9896"
238243 borderWidth: 1
239244 }
245+ }
246+ }
247+ }
248+
249+ // Right two-thirds: polarization ellipse visualization
250+ Item {
251+ id: circleContainer
252+ Layout .fillHeight : true
253+ Layout .fillWidth : true
254+ Layout .preferredWidth : parent .width * 2 / 3
255+
256+ // Store ellipse points and rotation direction from backend
257+ property var ellipsePoints: []
258+ property int rotationDirection: 0 // 1=CCW, -1=CW, 0=linear
259+
260+ Canvas {
261+ id: polarizationCanvas
262+ width: Math .min (parent .width , parent .height ) * 0.95
263+ height: width
264+ anchors .centerIn : parent
265+
266+ onPaint: {
267+ var ctx = getContext (" 2d" )
268+ ctx .reset ()
269+
270+ var centerX = width / 2
271+ var centerY = height / 2
272+ var scale = width / 2 * 0.9 // Leave some margin
273+
274+ // Draw reference circle (unit circle)
275+ ctx .strokeStyle = " #444444"
276+ ctx .lineWidth = 1
277+ ctx .beginPath ()
278+ ctx .arc (centerX, centerY, scale, 0 , 2 * Math .PI )
279+ ctx .stroke ()
280+
281+ // Draw axes
282+ ctx .strokeStyle = " #666666"
283+ ctx .lineWidth = 1
284+ ctx .beginPath ()
285+ ctx .moveTo (centerX - scale, centerY)
286+ ctx .lineTo (centerX + scale, centerY)
287+ ctx .moveTo (centerX, centerY - scale)
288+ ctx .lineTo (centerX, centerY + scale)
289+ ctx .stroke ()
290+
291+ // Draw polarization ellipse
292+ var points = circleContainer .ellipsePoints
293+ var rotDir = circleContainer .rotationDirection
294+ if (points .length > 0 ) {
295+ ctx .strokeStyle = " #ffffff"
296+ ctx .lineWidth = 3
297+ ctx .beginPath ()
298+ ctx .moveTo (centerX + points[0 ][0 ] * scale, centerY - points[0 ][1 ] * scale)
299+ for (var i = 1 ; i < points .length ; i++ ) {
300+ ctx .lineTo (centerX + points[i][0 ] * scale, centerY - points[i][1 ] * scale)
301+ }
302+ ctx .closePath ()
303+ ctx .stroke ()
304+
305+ // Draw arrow to indicate rotation direction (if not linear)
306+ if (rotDir !== 0 && points .length > 10 ) {
307+ // Pick a point along the ellipse (around 25% of the way)
308+ var arrowIdx = Math .floor (points .length / 4 )
309+ var arrowX = centerX + points[arrowIdx][0 ] * scale
310+ var arrowY = centerY - points[arrowIdx][1 ] * scale
311+
312+ // Compute tangent direction from adjacent points
313+ var prevIdx = arrowIdx - 1
314+ var nextIdx = arrowIdx + 1
315+ var dx = (points[nextIdx][0 ] - points[prevIdx][0 ]) * scale
316+ var dy = - (points[nextIdx][1 ] - points[prevIdx][1 ]) * scale // Flip Y
317+
318+ // Normalize tangent
319+ var tangentLen = Math .sqrt (dx * dx + dy * dy)
320+ if (tangentLen > 0 ) {
321+ dx = dx / tangentLen
322+ dy = dy / tangentLen
323+ }
324+
325+ // Arrow size
326+ var arrowSize = 15
327+
328+ // Perpendicular to tangent
329+ var perpX = - dy
330+ var perpY = dx
331+
332+ // Draw arrowhead
333+ ctx .fillStyle = " #ffffff"
334+ ctx .beginPath ()
335+ ctx .moveTo (arrowX + dx * arrowSize, arrowY + dy * arrowSize)
336+ ctx .lineTo (arrowX - dx * arrowSize * 0.5 + perpX * arrowSize * 0.5 , arrowY - dy * arrowSize * 0.5 + perpY * arrowSize * 0.5 )
337+ ctx .lineTo (arrowX - dx * arrowSize * 0.5 - perpX * arrowSize * 0.5 , arrowY - dy * arrowSize * 0.5 - perpY * arrowSize * 0.5 )
338+ ctx .closePath ()
339+ ctx .fill ()
340+ }
341+ }
342+ }
240343 }
241344 }
242345 }
@@ -288,6 +391,12 @@ Common.ESPARGOSApplication {
288391 scatterV .append (linearVPoints[l][0 ], linearVPoints[l][1 ])
289392 }
290393 }
394+
395+ function onUpdatePolarizationEllipse (ellipsePoints , rotationDirection ) {
396+ circleContainer .ellipsePoints = ellipsePoints
397+ circleContainer .rotationDirection = rotationDirection
398+ polarizationCanvas .requestPaint ()
399+ }
291400 }
292401 }
293402 }
0 commit comments