java.lang.Object
pl.polsl.rtsa.controller.TimeDomainRen
Renders the time-domain oscilloscope view with:
- Grid lines at "nice" voltage and time intervals via
GridCalculator - Voltage (Y) and time (X) axis labels
- Zoom-aware rendering via explicit visible-range parameters
- Optional trigger threshold line
- Cursor overlay with snap-to-signal support via
CursorOverlay
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final javafx.scene.paint.Colorprivate static final javafx.scene.paint.Colorprivate final CursorOverlayprivate static final javafx.scene.paint.Colorprivate static final intprivate static final javafx.scene.paint.Colorprivate static final int(package private) static final double(package private) static final double(package private) static final double(package private) static final doubleprivate booleanprivate static final javafx.scene.paint.Colorprivate static final javafx.scene.paint.Colorprivate static final javafx.scene.paint.Colorprivate final double[]private final double[]private static final javafx.scene.paint.Color -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static doubleclamp(double v, double lo, double hi) Clampsvto the range [lo,hi].voiddraw(javafx.scene.canvas.GraphicsContext gc, double[] samples, double vMin, double vMax, double tStart, double tEnd, double sampleRate, double w, double h, boolean cursorOn, double cx, double cy) Draw without trigger line (backward compatible).voiddraw(javafx.scene.canvas.GraphicsContext gc, double[] samples, double vMin, double vMax, double tStart, double tEnd, double sampleRate, double w, double h, boolean cursorOn, double cx, double cy, boolean showTrigger, double triggerThreshold) Draw with optional trigger threshold line.private voiddrawBorder(javafx.scene.canvas.GraphicsContext gc, double pw, double ph) Draws the plot-area border rectangle.voiddrawEmpty(javafx.scene.canvas.GraphicsContext gc, double w, double h) Draw an empty canvas with grid and placeholder text.private voiddrawGrid(javafx.scene.canvas.GraphicsContext gc, double vMin, double vMax, double tStart, double tEnd, double pw, double ph) Draws voltage (Y) and time (X) grid lines with labels.private voiddrawPlaceholder(javafx.scene.canvas.GraphicsContext gc, double pw, double ph, String text) Draws centred placeholder text when no signal data is available.private voiddrawSignal(javafx.scene.canvas.GraphicsContext gc, double[] samples, double vMin, double vMax, double tStart, double tEnd, double sampleRate, double pw, double ph) Renders the voltage waveform polyline, downsampled to at mostMAX_POINTSscreen points.voidsetShowGrid(boolean show) Toggles grid-line rendering.
-
Field Details
-
ML
static final double ML- See Also:
-
MR
static final double MR- See Also:
-
MT
static final double MT- See Also:
-
MB
static final double MB- See Also:
-
MAX_POINTS
private static final int MAX_POINTS- See Also:
-
GRID_DIVISIONS
private static final int GRID_DIVISIONS- See Also:
-
BG_COLOR
private static final javafx.scene.paint.Color BG_COLOR -
GRID_COLOR
private static final javafx.scene.paint.Color GRID_COLOR -
AXIS_COLOR
private static final javafx.scene.paint.Color AXIS_COLOR -
LABEL_COLOR
private static final javafx.scene.paint.Color LABEL_COLOR -
ZERO_LINE_CLR
private static final javafx.scene.paint.Color ZERO_LINE_CLR -
SIGNAL_COLOR
private static final javafx.scene.paint.Color SIGNAL_COLOR -
TRIGGER_COLOR
private static final javafx.scene.paint.Color TRIGGER_COLOR -
TITLE_COLOR
private static final javafx.scene.paint.Color TITLE_COLOR -
xBuf
private final double[] xBuf -
yBuf
private final double[] yBuf -
cursorOverlay
-
showGrid
private boolean showGrid
-
-
Constructor Details
-
TimeDomainRen
public TimeDomainRen()
-
-
Method Details
-
setShowGrid
public void setShowGrid(boolean show) Toggles grid-line rendering.- Parameters:
show-trueto draw grid lines,falseto hide them
-
draw
public void draw(javafx.scene.canvas.GraphicsContext gc, double[] samples, double vMin, double vMax, double tStart, double tEnd, double sampleRate, double w, double h, boolean cursorOn, double cx, double cy) Draw without trigger line (backward compatible). -
draw
public void draw(javafx.scene.canvas.GraphicsContext gc, double[] samples, double vMin, double vMax, double tStart, double tEnd, double sampleRate, double w, double h, boolean cursorOn, double cx, double cy, boolean showTrigger, double triggerThreshold) Draw with optional trigger threshold line. -
drawEmpty
public void drawEmpty(javafx.scene.canvas.GraphicsContext gc, double w, double h) Draw an empty canvas with grid and placeholder text. Used when no data has been received yet. -
drawGrid
private void drawGrid(javafx.scene.canvas.GraphicsContext gc, double vMin, double vMax, double tStart, double tEnd, double pw, double ph) Draws voltage (Y) and time (X) grid lines with labels. -
drawBorder
private void drawBorder(javafx.scene.canvas.GraphicsContext gc, double pw, double ph) Draws the plot-area border rectangle. -
drawSignal
private void drawSignal(javafx.scene.canvas.GraphicsContext gc, double[] samples, double vMin, double vMax, double tStart, double tEnd, double sampleRate, double pw, double ph) Renders the voltage waveform polyline, downsampled to at mostMAX_POINTSscreen points. -
drawPlaceholder
private void drawPlaceholder(javafx.scene.canvas.GraphicsContext gc, double pw, double ph, String text) Draws centred placeholder text when no signal data is available.- Parameters:
gc- graphics contextpw- plot width (px)ph- plot height (px)text- the message to display
-
clamp
private static double clamp(double v, double lo, double hi) Clampsvto the range [lo,hi].
-