Class TimeDomainRen

java.lang.Object
pl.polsl.rtsa.controller.TimeDomainRen

public class TimeDomainRen extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    private static final javafx.scene.paint.Color
     
    private static final javafx.scene.paint.Color
     
    private final CursorOverlay
     
    private static final javafx.scene.paint.Color
     
    private static final int
     
    private static final javafx.scene.paint.Color
     
    private static final int
     
    (package private) static final double
     
    (package private) static final double
     
    (package private) static final double
     
    (package private) static final double
     
    private boolean
     
    private static final javafx.scene.paint.Color
     
    private static final javafx.scene.paint.Color
     
    private static final javafx.scene.paint.Color
     
    private final double[]
     
    private final double[]
     
    private static final javafx.scene.paint.Color
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static double
    clamp(double v, double lo, double hi)
    Clamps v to the range [lo, hi].
    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).
    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.
    private void
    drawBorder(javafx.scene.canvas.GraphicsContext gc, double pw, double ph)
    Draws the plot-area border rectangle.
    void
    drawEmpty(javafx.scene.canvas.GraphicsContext gc, double w, double h)
    Draw an empty canvas with grid and placeholder text.
    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.
    private void
    drawPlaceholder(javafx.scene.canvas.GraphicsContext gc, double pw, double ph, String text)
    Draws centred placeholder text when no signal data is available.
    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 most MAX_POINTS screen points.
    void
    setShowGrid(boolean show)
    Toggles grid-line rendering.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      private final CursorOverlay cursorOverlay
    • showGrid

      private boolean showGrid
  • Constructor Details

    • TimeDomainRen

      public TimeDomainRen()
  • Method Details

    • setShowGrid

      public void setShowGrid(boolean show)
      Toggles grid-line rendering.
      Parameters:
      show - true to draw grid lines, false to 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 most MAX_POINTS screen 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 context
      pw - plot width (px)
      ph - plot height (px)
      text - the message to display
    • clamp

      private static double clamp(double v, double lo, double hi)
      Clamps v to the range [lo, hi].