Class VectorTrace

java.lang.Object
org.eclipse.draw2d.Figure
org.dawnsci.plotting.draw2d.swtxy.VectorTrace
All Implemented Interfaces:
ITrace, IVectorTrace, org.eclipse.draw2d.IFigure, org.eclipse.january.INameable

public class VectorTrace extends org.eclipse.draw2d.Figure implements IVectorTrace
An implementation of VectorTrace based on the draw2d Figure TODO Not curently implemented for rotated images. TODO No downsampling currently implemented.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure

    org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch

    Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure

    org.eclipse.draw2d.IFigure.NoInsets

    Nested classes/interfaces inherited from interface org.eclipse.dawnsci.plotting.api.trace.IVectorTrace

    IVectorTrace.ArrowConfiguration, IVectorTrace.ArrowHistogram, IVectorTrace.VectorNormalization
  • Field Summary

    Fields inherited from class org.eclipse.draw2d.Figure

    bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip

    Fields inherited from interface org.eclipse.draw2d.IFigure

    MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
  • Constructor Summary

    Constructors
    Constructor
    Description
    VectorTrace(String traceName)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called to release system resources.
    int[]
    Get the rgb values for the arrow color.
    Get the way the arrow pointing should be done.
    How to color the arrows
    org.eclipse.swt.graphics.PaletteData
    Instead of a fixed color the arrow may use a palette.
    List<org.eclipse.january.dataset.IDataset>
     
    int[]
    Get the rgb values for the circle color.
    org.eclipse.january.dataset.IDataset
    Call this method to return a plotted data set by this trace.
    The name of the original data that this trace was plotted from or null
    int
    The maximum size of the arrow in screen pixels.
     
    double[]
    Get the percentage threshold for clipping outliers in the magnitude
    int
    The rank of data plotted, 1 for XY, 2 for Image and surfaces, 3 for volumes.
    An object which may be set by API users to record information about the plot.
    Used when the values of the vectors are normalized to the maximum arrow size.
    void
    initialize(IAxis... axes)
    Initialize with given axes
    boolean
     
    boolean
    Is direction data in radians
    boolean
    True if user trace (normally is)
    boolean
    True if visible
    void
    paint(org.eclipse.draw2d.Graphics graphics)
    This figure simply paints the vectors.
    void
    setArrowColor(int... rgb)
    Set the rgb values for the arrow color.
    void
    Set the way the arrow pointing should be done.
    void
    How to color the arrows
    void
    setArrowPalette(org.eclipse.swt.graphics.PaletteData arrowPalette)
    Instead of a fixed color the arrow may use a palette.
    void
    setCircleColor(int... circleColor)
    Set the rgb values for the circle color.
    boolean
    setData(org.eclipse.january.dataset.IDataset vectors, List<org.eclipse.january.dataset.IDataset> axes)
    Call to set image data
    void
    setDataName(String dataName)
    The name of the original data that this trace was plotted from or null
    void
    setMaximumArrowSize(int maximumArrowSize)
    The maximum size of the arrow in screen pixels.
    void
     
    void
    setPercentageThreshold(double[] percentageThreshold)
    Set the percentage threshold for clipping outliers in the magnitude
    void
    setRadians(boolean isRadians)
    Set whether the direction data is radians (false for degrees)
    void
    setUserObject(Object userObject)
    An object which may be set by API users to record information about the plot.
    void
    setUserTrace(boolean userTrace)
    True if visible
    void
    Used when the values of the vectors are normalized to the maximum arrow size.
    void
    setVisible(boolean visible)
    True if visible

    Methods inherited from class org.eclipse.draw2d.Figure

    add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, layout, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.eclipse.dawnsci.plotting.api.trace.IVectorTrace

    repaint
  • Constructor Details

    • VectorTrace

      public VectorTrace(String traceName)
  • Method Details

    • initialize

      public void initialize(IAxis... axes)
      Description copied from interface: ITrace
      Initialize with given axes
      Specified by:
      initialize in interface ITrace
      Parameters:
      axes -
    • dispose

      public void dispose()
      Description copied from interface: ITrace
      Called to release system resources.
      Specified by:
      dispose in interface ITrace
    • paint

      public void paint(org.eclipse.draw2d.Graphics graphics)
      This figure simply paints the vectors. TODO Downsampling!
      Specified by:
      paint in interface org.eclipse.draw2d.IFigure
      Overrides:
      paint in class org.eclipse.draw2d.Figure
    • setData

      public boolean setData(org.eclipse.january.dataset.IDataset vectors, List<org.eclipse.january.dataset.IDataset> axes)
      Description copied from interface: IVectorTrace
      Call to set image data
      Specified by:
      setData in interface IVectorTrace
      Parameters:
      vectors - a 3D dataset [x,y,2] where the first two coordinates are the position in x and y and the third coordinate is a size two argument. This represents a magnitude and angle for the vector arrow.
      axes - or null.
      Returns:
      false if could not set data
    • getAxes

      public List<org.eclipse.january.dataset.IDataset> getAxes()
      Specified by:
      getAxes in interface IVectorTrace
      Returns:
      the axes used to look up the position which the vector should be drawn.
    • isVisible

      public boolean isVisible()
      Description copied from interface: ITrace
      True if visible
      Specified by:
      isVisible in interface org.eclipse.draw2d.IFigure
      Specified by:
      isVisible in interface ITrace
      Overrides:
      isVisible in class org.eclipse.draw2d.Figure
      Returns:
    • setVisible

      public void setVisible(boolean visible)
      Description copied from interface: ITrace
      True if visible
      Specified by:
      setVisible in interface org.eclipse.draw2d.IFigure
      Specified by:
      setVisible in interface ITrace
      Overrides:
      setVisible in class org.eclipse.draw2d.Figure
    • getName

      public String getName()
      Specified by:
      getName in interface org.eclipse.january.INameable
    • setName

      public void setName(String name)
      Specified by:
      setName in interface org.eclipse.january.INameable
    • getDataName

      public String getDataName()
      Description copied from interface: ITrace
      The name of the original data that this trace was plotted from or null
      Specified by:
      getDataName in interface ITrace
      Returns:
    • setDataName

      public void setDataName(String dataName)
      Description copied from interface: ITrace
      The name of the original data that this trace was plotted from or null
      Specified by:
      setDataName in interface ITrace
    • getData

      public org.eclipse.january.dataset.IDataset getData()
      Description copied from interface: ITrace
      Call this method to return a plotted data set by this trace. Different trace types will return different ranks from getData(). For ILineTrace it is 1D line data For IImageTrace it is a 2D image etc.
      Specified by:
      getData in interface ITrace
    • isUserTrace

      public boolean isUserTrace()
      Description copied from interface: ITrace
      True if user trace (normally is)
      Specified by:
      isUserTrace in interface ITrace
      Returns:
    • setUserTrace

      public void setUserTrace(boolean userTrace)
      Description copied from interface: ITrace
      True if visible
      Specified by:
      setUserTrace in interface ITrace
    • getUserObject

      public Object getUserObject()
      Description copied from interface: ITrace
      An object which may be set by API users to record information about the plot. Ideally avoid objects containing large data in this method.
      Specified by:
      getUserObject in interface ITrace
      Returns:
    • setUserObject

      public void setUserObject(Object userObject)
      Description copied from interface: ITrace
      An object which may be set by API users to record information about the plot. Ideally avoid objects containing large data in this method.
      Specified by:
      setUserObject in interface ITrace
    • is3DTrace

      public boolean is3DTrace()
      Specified by:
      is3DTrace in interface ITrace
      Returns:
      true if trace is plotted using a 3D viewer.
    • getRank

      public int getRank()
      Description copied from interface: ITrace
      The rank of data plotted, 1 for XY, 2 for Image and surfaces, 3 for volumes.
      Specified by:
      getRank in interface ITrace
      Returns:
    • setArrowColor

      public void setArrowColor(int... rgb)
      Description copied from interface: IVectorTrace
      Set the rgb values for the arrow color. By default the arrow is drawn black.
      Specified by:
      setArrowColor in interface IVectorTrace
      Parameters:
      rgb -
    • getArrowColor

      public int[] getArrowColor()
      Description copied from interface: IVectorTrace
      Get the rgb values for the arrow color. By default the arrow is drawn black.
      Specified by:
      getArrowColor in interface IVectorTrace
    • getVectorNormalization

      public IVectorTrace.VectorNormalization getVectorNormalization()
      Description copied from interface: IVectorTrace
      Used when the values of the vectors are normalized to the maximum arrow size.
      Specified by:
      getVectorNormalization in interface IVectorTrace
      Returns:
      VectorNormalizationType
    • setVectorNormalization

      public void setVectorNormalization(IVectorTrace.VectorNormalization vectorNormalizationType)
      Description copied from interface: IVectorTrace
      Used when the values of the vectors are normalized to the maximum arrow size.
      Specified by:
      setVectorNormalization in interface IVectorTrace
      Parameters:
      vectorNormalizationType -
    • getMaximumArrowSize

      public int getMaximumArrowSize()
      Description copied from interface: IVectorTrace
      The maximum size of the arrow in screen pixels. Default is 20.
      Specified by:
      getMaximumArrowSize in interface IVectorTrace
    • setMaximumArrowSize

      public void setMaximumArrowSize(int maximumArrowSize)
      Description copied from interface: IVectorTrace
      The maximum size of the arrow in screen pixels. Default is 20.
      Specified by:
      setMaximumArrowSize in interface IVectorTrace
      Parameters:
      maximumArrowSize -
    • getArrowConfiguration

      public IVectorTrace.ArrowConfiguration getArrowConfiguration()
      Description copied from interface: IVectorTrace
      Get the way the arrow pointing should be done.
      Specified by:
      getArrowConfiguration in interface IVectorTrace
    • setArrowConfiguration

      public void setArrowConfiguration(IVectorTrace.ArrowConfiguration arrowPosition)
      Description copied from interface: IVectorTrace
      Set the way the arrow pointing should be done.
      Specified by:
      setArrowConfiguration in interface IVectorTrace
      Parameters:
      arrowPosition -
    • getCircleColor

      public int[] getCircleColor()
      Description copied from interface: IVectorTrace
      Get the rgb values for the circle color. By default the circle is drawn black.
      Specified by:
      getCircleColor in interface IVectorTrace
    • setCircleColor

      public void setCircleColor(int... circleColor)
      Description copied from interface: IVectorTrace
      Set the rgb values for the circle color. By default the circle is drawn black.
      Specified by:
      setCircleColor in interface IVectorTrace
      Parameters:
      circleColor -
    • getArrowPalette

      public org.eclipse.swt.graphics.PaletteData getArrowPalette()
      Description copied from interface: IVectorTrace
      Instead of a fixed color the arrow may use a palette. If the palette is set the arrowColor is ignored providing the ArrowHistogram has been set to a non-fixed type.
      Specified by:
      getArrowPalette in interface IVectorTrace
    • setArrowPalette

      public void setArrowPalette(org.eclipse.swt.graphics.PaletteData arrowPalette)
      Description copied from interface: IVectorTrace
      Instead of a fixed color the arrow may use a palette. If the palette is set the arrowColor is ignored providing the ArrowHistogram has been set to a non-fixed type.
      Specified by:
      setArrowPalette in interface IVectorTrace
      Parameters:
      arrowPalette -
    • getArrowHistogram

      public IVectorTrace.ArrowHistogram getArrowHistogram()
      Description copied from interface: IVectorTrace
      How to color the arrows
      Specified by:
      getArrowHistogram in interface IVectorTrace
      Returns:
    • setArrowHistogram

      public void setArrowHistogram(IVectorTrace.ArrowHistogram arrowHistogram)
      Description copied from interface: IVectorTrace
      How to color the arrows
      Specified by:
      setArrowHistogram in interface IVectorTrace
    • getPercentageThreshold

      public double[] getPercentageThreshold()
      Description copied from interface: IVectorTrace
      Get the percentage threshold for clipping outliers in the magnitude
      Specified by:
      getPercentageThreshold in interface IVectorTrace
      Returns:
      percentages
    • setPercentageThreshold

      public void setPercentageThreshold(double[] percentageThreshold)
      Description copied from interface: IVectorTrace
      Set the percentage threshold for clipping outliers in the magnitude
      Specified by:
      setPercentageThreshold in interface IVectorTrace
    • isRadians

      public boolean isRadians()
      Description copied from interface: IVectorTrace
      Is direction data in radians
      Specified by:
      isRadians in interface IVectorTrace
      Returns:
    • setRadians

      public void setRadians(boolean isRadians)
      Description copied from interface: IVectorTrace
      Set whether the direction data is radians (false for degrees)
      Specified by:
      setRadians in interface IVectorTrace
      Parameters:
      isRadians -