Class ScrollingImageSegmenter

java.lang.Object
dataPlotsFX.clickPlotFX.ScrollingImageSegmenter

public abstract class ScrollingImageSegmenter extends Object
A method to quickly plot data units on the display

A list of writable images is stored in memory. These record the UID of the data unit that has been painted and repainting of the data unit does not occur unless a specific clear() function is called. TODO - better description needed.

Author:
Jamie Macaulay
  • Field Details

    • millisPerPixel

      public double millisPerPixel
      The number of seconds each pixel represents.
  • Constructor Details

    • ScrollingImageSegmenter

      public ScrollingImageSegmenter(double minY, double maxY)
      Create a new scrolling 2D segmented.
  • Method Details

    • setYMinMax

      public void setYMinMax(double minY, double maxY)
      Set the minimum and maximum y values of the writable image (what is stored in memory).
      Parameters:
      minY - - the minimum y value of the writable image.
      maxY - - the maximum y value of the writable image
    • resetImageBuffer

      public void resetImageBuffer()
      Reset the buffer so that all images are cleared all data units must redraw.
    • getMillisePerPixel

      public double getMillisePerPixel()
      Return the number of milliseconds each width pixel corresponds to
      Returns:
      the number of milliseconds per pixel.
    • getImageSegmentEnd

      public long getImageSegmentEnd()
      Get the location of the last image.
      Returns:
      the location of the last image.
    • getImageMillisTime

      public long getImageMillisTime(double pixel)
      Get the image millis time for a given pixel. This
      Parameters:
      pixel - - pixels form start of the first image segment in the buffer
    • getImagePixelTime

      public double getImagePixelTime(long timeMillis)
      Get the image pixel time for a given millis. This is the total pixels form the first image segment in the buffer.
      Parameters:
      timeMillis - - the time in millis.
    • getImageXPixels

      public double getImageXPixels(double timeMillis, ScrollingImageSegmenter.WritableImageSegment writiableImage)
      Get the number of X pixels into an image that the time in millis represents
      Parameters:
      timeMillis - - the time in milliseconds
      Returns:
      - the number of x pixels into the image segment;
    • getImageYPixels

      public int getImageYPixels(double value, ScrollingImageSegmenter.WritableImageSegment writiableImage)
      Get the number of X pixels into an image that the time in millis represents
      Parameters:
      value - - the y value in any units
      Returns:
      - the number of y pixels into the image segment;
    • bufferCheck

      public boolean bufferCheck(double starttime, double secondsWidth)
      Check the writable images and remove fringe images if necessary.
      Returns:
      true if some images have been deleted from memory.
    • drawADataUnit

      public abstract void drawADataUnit(javafx.scene.canvas.GraphicsContext g, PamDataUnit pamDataUnit, ScrollingImageSegmenter.WritableImageSegment writableImage, TDProjectorFX tdProjector, double scrollStart)
      Draw the data unit onto a writable image segment.
      Parameters:
      g - - the graphics context the image will be drawn onto
      pamDataUnit - - the data unit.
      writableImage - - the writable image
      tdProjector - - the TD projector for the display
      scrollStart - - the start of the display in milliseconds
    • getPath2D

      public abstract Path2D getPath2D(PamDataUnit pamDataUnit, ScrollingImageSegmenter.WritableImageSegment writableImage, TDProjectorFX tdProjector, double scrollStart)
      Get the polygon for the detection. This allows it to be selected by markers.
      Parameters:
      pamDataUnit - - the data unit.
      writableImage - - the writable image
      tdProjector - - the TD projector for the display
      scrollStart - - the start of the display in milliseconds
      g - - the graphics context the image will be drawn onto
    • drawDataUnit

      public Path2D drawDataUnit(javafx.scene.canvas.GraphicsContext g, PamDataUnit pamDataUnit, TDProjectorFX tdProjector, double scrollStart)
      Draw the spectrogram on the
      Parameters:
      g - - the graphics context.
      pamDataUnit - - the pamDataUnit.
      tC - - the time to plot in seconds form the start of the display.
      Returns:
      the Path2D of the click.
    • paintImages

      public void paintImages(javafx.scene.canvas.GraphicsContext g, TDProjectorFX tdProjector, double scrollStart, long tm)
      Paint the images.
      Parameters:
      g - - the graphics context.
      tdProjector - - the projector of the graph.
      scrollStart - - the start of the display in millis.
      tm - - the repaint time in millis.
    • getImageSegments

      Get the image segments.
      Returns:
      the image segments
    • getMaxY

      public double getMaxY()
      Get the maximum y value. This the y value that the top of the image segments correspond to.
      Returns:
      the max y value.
    • getMinY

      public double getMinY()
      Get the minimum y value. This the y value that the bottom of the image segments correspond to.
      Returns:
      the max y value.