java.lang.Object
pl.polsl.rtsa.controller.CursorOverlay
Draws interactive cursor overlays on the time-domain plot.
Features:
- Dashed crosshair lines at cursor position
- Snap-to-signal: red dot when the cursor is close to the waveform
- Tooltip with precise time and voltage values
- Coordinate math matches
TimeDomainRenexactly
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final javafx.scene.paint.Colorprivate static final javafx.scene.paint.Colorprivate static final doubleprivate static final javafx.scene.paint.Colorprivate static final javafx.scene.paint.Color -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddrawCrosshair(javafx.scene.canvas.GraphicsContext gc, double x, double y, double ml, double mt, double pw, double ph) Draws a dashed crosshair (horizontal + vertical) through the given point.voiddrawTimeDomain(javafx.scene.canvas.GraphicsContext gc, double[] samples, double vMin, double vMax, double tStart, double tEnd, double sampleRate, double pw, double ph, double ml, double mt, double cx, double cy) Draw cursor overlay on the time-domain canvas.private voiddrawTooltip(javafx.scene.canvas.GraphicsContext gc, double x, double y, double ml, double mt, double pw, double ph, String line1, String line2) Draws a semi-transparent tooltip box with two text lines, clamped inside the plot area.
-
Field Details
-
CROSSHAIR_COLOR
private static final javafx.scene.paint.Color CROSSHAIR_COLOR -
DOT_COLOR
private static final javafx.scene.paint.Color DOT_COLOR -
TOOLTIP_BG
private static final javafx.scene.paint.Color TOOLTIP_BG -
TOOLTIP_TEXT
private static final javafx.scene.paint.Color TOOLTIP_TEXT -
SNAP_DISTANCE
private static final double SNAP_DISTANCE- See Also:
-
-
Constructor Details
-
CursorOverlay
public CursorOverlay()
-
-
Method Details
-
drawTimeDomain
public void drawTimeDomain(javafx.scene.canvas.GraphicsContext gc, double[] samples, double vMin, double vMax, double tStart, double tEnd, double sampleRate, double pw, double ph, double ml, double mt, double cx, double cy) Draw cursor overlay on the time-domain canvas.- Parameters:
gc- graphics context (same as the canvas being drawn on)samples- voltage samplesvMin- /vMax visible voltage range (V)tStart- /tEnd visible time range (s)sampleRate- sampling rate (Hz)pw- plot-area width (px, excluding margins)ph- plot-area height (px, excluding margins)ml- left margin (px)mt- top margin (px)cx- cursor X in canvas coordinatescy- cursor Y in canvas coordinates
-
drawCrosshair
private void drawCrosshair(javafx.scene.canvas.GraphicsContext gc, double x, double y, double ml, double mt, double pw, double ph) Draws a dashed crosshair (horizontal + vertical) through the given point.- Parameters:
gc- graphics contextx- crosshair centre X (canvas coordinates)y- crosshair centre Y (canvas coordinates)ml- left margin (px)mt- top margin (px)pw- plot width (px)ph- plot height (px)
-
drawTooltip
private void drawTooltip(javafx.scene.canvas.GraphicsContext gc, double x, double y, double ml, double mt, double pw, double ph, String line1, String line2) Draws a semi-transparent tooltip box with two text lines, clamped inside the plot area.- Parameters:
gc- graphics contextx- anchor X positiony- anchor Y positionml- left margin (px)mt- top margin (px)pw- plot width (px)ph- plot height (px)line1- first text line (e.g. time)line2- second text line (e.g. voltage)
-