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
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.IdentitySearchNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
org.eclipse.draw2d.IFigure.NoInsetsNested 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, toolTipFields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()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 arrowsorg.eclipse.swt.graphics.PaletteDataInstead of a fixed color the arrow may use a palette.List<org.eclipse.january.dataset.IDataset> getAxes()int[]Get the rgb values for the circle color.org.eclipse.january.dataset.IDatasetgetData()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 nullintThe maximum size of the arrow in screen pixels.getName()double[]Get the percentage threshold for clipping outliers in the magnitudeintgetRank()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.voidinitialize(IAxis... axes) Initialize with given axesbooleanbooleanIs direction data in radiansbooleanTrue if user trace (normally is)booleanTrue if visiblevoidpaint(org.eclipse.draw2d.Graphics graphics) This figure simply paints the vectors.voidsetArrowColor(int... rgb) Set the rgb values for the arrow color.voidsetArrowConfiguration(IVectorTrace.ArrowConfiguration arrowPosition) Set the way the arrow pointing should be done.voidsetArrowHistogram(IVectorTrace.ArrowHistogram arrowHistogram) How to color the arrowsvoidsetArrowPalette(org.eclipse.swt.graphics.PaletteData arrowPalette) Instead of a fixed color the arrow may use a palette.voidsetCircleColor(int... circleColor) Set the rgb values for the circle color.booleansetData(org.eclipse.january.dataset.IDataset vectors, List<org.eclipse.january.dataset.IDataset> axes) Call to set image datavoidsetDataName(String dataName) The name of the original data that this trace was plotted from or nullvoidsetMaximumArrowSize(int maximumArrowSize) The maximum size of the arrow in screen pixels.voidvoidsetPercentageThreshold(double[] percentageThreshold) Set the percentage threshold for clipping outliers in the magnitudevoidsetRadians(boolean isRadians) Set whether the direction data is radians (false for degrees)voidsetUserObject(Object userObject) An object which may be set by API users to record information about the plot.voidsetUserTrace(boolean userTrace) True if visiblevoidsetVectorNormalization(IVectorTrace.VectorNormalization vectorNormalizationType) Used when the values of the vectors are normalized to the maximum arrow size.voidsetVisible(boolean visible) True if visibleMethods 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, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.dawnsci.plotting.api.trace.IVectorTrace
repaint
-
Constructor Details
-
VectorTrace
-
-
Method Details
-
initialize
Description copied from interface:ITraceInitialize with given axes- Specified by:
initializein interfaceITrace- Parameters:
axes-
-
dispose
public void dispose()Description copied from interface:ITraceCalled to release system resources. -
paint
public void paint(org.eclipse.draw2d.Graphics graphics) This figure simply paints the vectors. TODO Downsampling!- Specified by:
paintin interfaceorg.eclipse.draw2d.IFigure- Overrides:
paintin classorg.eclipse.draw2d.Figure
-
setData
public boolean setData(org.eclipse.january.dataset.IDataset vectors, List<org.eclipse.january.dataset.IDataset> axes) Description copied from interface:IVectorTraceCall to set image data- Specified by:
setDatain interfaceIVectorTrace- 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
- Specified by:
getAxesin interfaceIVectorTrace- Returns:
- the axes used to look up the position which the vector should be drawn.
-
isVisible
public boolean isVisible()Description copied from interface:ITraceTrue if visible -
setVisible
public void setVisible(boolean visible) Description copied from interface:ITraceTrue if visible- Specified by:
setVisiblein interfaceorg.eclipse.draw2d.IFigure- Specified by:
setVisiblein interfaceITrace- Overrides:
setVisiblein classorg.eclipse.draw2d.Figure
-
getName
- Specified by:
getNamein interfaceorg.eclipse.january.INameable
-
setName
- Specified by:
setNamein interfaceorg.eclipse.january.INameable
-
getDataName
Description copied from interface:ITraceThe name of the original data that this trace was plotted from or null- Specified by:
getDataNamein interfaceITrace- Returns:
-
setDataName
Description copied from interface:ITraceThe name of the original data that this trace was plotted from or null- Specified by:
setDataNamein interfaceITrace
-
getData
public org.eclipse.january.dataset.IDataset getData()Description copied from interface:ITraceCall 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. -
isUserTrace
public boolean isUserTrace()Description copied from interface:ITraceTrue if user trace (normally is)- Specified by:
isUserTracein interfaceITrace- Returns:
-
setUserTrace
public void setUserTrace(boolean userTrace) Description copied from interface:ITraceTrue if visible- Specified by:
setUserTracein interfaceITrace
-
getUserObject
Description copied from interface:ITraceAn 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:
getUserObjectin interfaceITrace- Returns:
-
setUserObject
Description copied from interface:ITraceAn 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:
setUserObjectin interfaceITrace
-
is3DTrace
public boolean is3DTrace() -
getRank
public int getRank()Description copied from interface:ITraceThe rank of data plotted, 1 for XY, 2 for Image and surfaces, 3 for volumes. -
setArrowColor
public void setArrowColor(int... rgb) Description copied from interface:IVectorTraceSet the rgb values for the arrow color. By default the arrow is drawn black.- Specified by:
setArrowColorin interfaceIVectorTrace- Parameters:
rgb-
-
getArrowColor
public int[] getArrowColor()Description copied from interface:IVectorTraceGet the rgb values for the arrow color. By default the arrow is drawn black.- Specified by:
getArrowColorin interfaceIVectorTrace
-
getVectorNormalization
Description copied from interface:IVectorTraceUsed when the values of the vectors are normalized to the maximum arrow size.- Specified by:
getVectorNormalizationin interfaceIVectorTrace- Returns:
- VectorNormalizationType
-
setVectorNormalization
Description copied from interface:IVectorTraceUsed when the values of the vectors are normalized to the maximum arrow size.- Specified by:
setVectorNormalizationin interfaceIVectorTrace- Parameters:
vectorNormalizationType-
-
getMaximumArrowSize
public int getMaximumArrowSize()Description copied from interface:IVectorTraceThe maximum size of the arrow in screen pixels. Default is 20.- Specified by:
getMaximumArrowSizein interfaceIVectorTrace
-
setMaximumArrowSize
public void setMaximumArrowSize(int maximumArrowSize) Description copied from interface:IVectorTraceThe maximum size of the arrow in screen pixels. Default is 20.- Specified by:
setMaximumArrowSizein interfaceIVectorTrace- Parameters:
maximumArrowSize-
-
getArrowConfiguration
Description copied from interface:IVectorTraceGet the way the arrow pointing should be done.- Specified by:
getArrowConfigurationin interfaceIVectorTrace
-
setArrowConfiguration
Description copied from interface:IVectorTraceSet the way the arrow pointing should be done.- Specified by:
setArrowConfigurationin interfaceIVectorTrace- Parameters:
arrowPosition-
-
getCircleColor
public int[] getCircleColor()Description copied from interface:IVectorTraceGet the rgb values for the circle color. By default the circle is drawn black.- Specified by:
getCircleColorin interfaceIVectorTrace
-
setCircleColor
public void setCircleColor(int... circleColor) Description copied from interface:IVectorTraceSet the rgb values for the circle color. By default the circle is drawn black.- Specified by:
setCircleColorin interfaceIVectorTrace- Parameters:
circleColor-
-
getArrowPalette
public org.eclipse.swt.graphics.PaletteData getArrowPalette()Description copied from interface:IVectorTraceInstead 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:
getArrowPalettein interfaceIVectorTrace
-
setArrowPalette
public void setArrowPalette(org.eclipse.swt.graphics.PaletteData arrowPalette) Description copied from interface:IVectorTraceInstead 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:
setArrowPalettein interfaceIVectorTrace- Parameters:
arrowPalette-
-
getArrowHistogram
Description copied from interface:IVectorTraceHow to color the arrows- Specified by:
getArrowHistogramin interfaceIVectorTrace- Returns:
-
setArrowHistogram
Description copied from interface:IVectorTraceHow to color the arrows- Specified by:
setArrowHistogramin interfaceIVectorTrace
-
getPercentageThreshold
public double[] getPercentageThreshold()Description copied from interface:IVectorTraceGet the percentage threshold for clipping outliers in the magnitude- Specified by:
getPercentageThresholdin interfaceIVectorTrace- Returns:
- percentages
-
setPercentageThreshold
public void setPercentageThreshold(double[] percentageThreshold) Description copied from interface:IVectorTraceSet the percentage threshold for clipping outliers in the magnitude- Specified by:
setPercentageThresholdin interfaceIVectorTrace
-
isRadians
public boolean isRadians()Description copied from interface:IVectorTraceIs direction data in radians- Specified by:
isRadiansin interfaceIVectorTrace- Returns:
-
setRadians
public void setRadians(boolean isRadians) Description copied from interface:IVectorTraceSet whether the direction data is radians (false for degrees)- Specified by:
setRadiansin interfaceIVectorTrace- Parameters:
isRadians-
-