public class OverlayTransform extends DataTransform implements TransformListener
Modifier and Type | Field and Description |
---|---|
protected static RealType |
ALPHA_TYPE
MathType for alpha color mappings.
|
protected static RealType |
BLUE_TYPE
MathType for blue color mappings.
|
protected Vector |
clipboard
Clipboard stores overlays grabbed with the copy function.
|
protected int[] |
clipboardPos
Dimensional position of overlays stored in the clipboard.
|
protected OverlayWidget |
controls
Controls for creating overlays.
|
protected boolean |
drawText
Whether to draw text.
|
protected FontMetrics |
fontMetrics
Font metrics for the current font.
|
protected static RealType |
GREEN_TYPE
MathType for green color mappings.
|
protected String |
lastToolType
Type of last tool used.
|
protected boolean |
mouseDownLeft
Whether left mouse button is currently being pressed.
|
protected boolean |
mouseDownRight
Whether right mouse button is currently being pressed.
|
protected static String |
NOT_APPLICABLE
String indicating a given field is not applicable to an overlay.
|
protected Vector[] |
overlays
List of overlays for each dimensional position.
|
protected int[] |
pos
Current dimensional position.
|
protected static RealTupleType |
RANGE_TUPLE
Overlay range type.
|
protected static RealType |
RED_TYPE
MathType for red color mappings.
|
protected TransientSelectBox |
selectBox
Transient Select Box, if active.
|
protected TupleType |
textRangeTuple
Overlay range type for text overlays.
|
protected TextType |
textType
MathType for Text mappings.
|
protected boolean |
toolChanged
Whether last tool has changed.
|
Constructor and Description |
---|
OverlayTransform(DataTransform parent,
String name)
Creates an overlay object for the given transform.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(OverlayObject obj)
Adds an overlay object at the current dimensional position.
|
void |
addObject(OverlayObject obj,
int[] pos)
Adds an overlay object at the given dimensional position.
|
void |
addTSB(TransientSelectBox tsb)
Adds a transient selection box.
|
protected void |
configureOverlay(OverlayObject obj)
Configures the given overlay to match the current settings.
|
void |
copySelectedObjects()
Copies selected overlay objects at the current dimensional position to the
clipboard.
|
void |
copySelectedObjects(int[] pos)
Copies selected overlay objects at the given dimensional position to the
clipboard.
|
void |
discard()
Called when this object is being discarded in favor of another object with
a matching state.
|
void |
displayChanged(DisplayEvent e)
Responds to mouse gestures with appropriate overlay interaction.
|
String |
distributeObjects()
Distributes one object per dimensional position linearly between the
position of the overlay currently on the clipboard, and the one selected at
the current dimensional position.
|
String |
distributeObjects(int[] pos)
Distributes one object per dimensional position linearly between the
position of the overlay currently on the clipboard, and the one selected at
the given dimensional position.
|
loci.poi.hssf.usermodel.HSSFWorkbook |
exportOverlays()
Exports the overlays as .xls to the given output file.
|
String |
getCacheId(int[] pos,
boolean global)
Gets a string id uniquely describing this data transform at the given
dimensional position, for the purposes of thumbnail caching.
|
JComponent |
getControls()
Gets associated GUI controls for this transform.
|
Data |
getData(TransformLink link,
int[] pos,
int dim,
DataCache cache)
Retrieves the data corresponding to the given dimensional position, for the
given display dimensionality.
|
RealTupleType |
getDomainType()
Gets domain type (XY).
|
FontMetrics |
getFontMetrics()
Gets font metrics for the current font.
|
OverlayObject[] |
getObjects()
Gets the overlay objects at the current dimensional position.
|
OverlayObject[] |
getObjects(int[] pos)
Gets the overlay objects at the given dimensional position.
|
int[] |
getPos()
Gets transform's current dimensional position.
|
TupleType |
getRangeType()
Gets range type (RGB).
|
int |
getScalingValue()
Gets a scaling value suitable for computing an overlay size or picking
threshold.
|
int |
getScalingValueX()
Gets a scaling value along the X axis, suitable for computing an overlay
width or picking threshold.
|
int |
getScalingValueY()
Gets a scaling value along the Y axis, suitable for computing an overlay
height or picking threshold.
|
ScalarMap[] |
getSuggestedMaps()
Retrieves a set of mappings for displaying this transform effectively.
|
TupleType |
getTextRangeType()
Gets range type for text overlays (R, G, B, text).
|
Tuple |
getTextRangeValue(String text,
float r,
float g,
float b,
float a)
Constructs a range value with the given component values.
|
boolean |
hasToolChanged()
Gets whether the current tool has changed since last mouse gesture.
|
void |
initState(Dynamic dyn)
Modifies this object's state to match that of the given object.
|
boolean |
isCompatible(Dynamic dyn)
Tests whether the given dynamic object can be used as an argument to
initState, for initializing this dynamic object.
|
boolean |
isImmediate()
Overlay transforms are rendered immediately, due to frequent user
interaction.
|
static boolean |
isParentRequired()
Indicates whether this transform type requires a parent transform.
|
boolean |
isTextDrawn()
Gets whether text is drawn.
|
boolean |
isValidDimension(int dim)
Gets whether this transform provides data of the given dimensionality.
|
static boolean |
isValidParent(DataTransform data)
Indicates whether this transform type would accept the given transform as
its parent transform.
|
void |
loadOverlays(BufferedReader in)
Reads the overlays from the given reader.
|
protected static RealTupleType |
makeRangeTuple()
Constructs the overlay range type for most overlays.
|
static DataTransform |
makeTransform(DataManager dm)
Creates a new set of overlays, with user interaction.
|
boolean |
matches(Dynamic dyn)
Tests whether two dynamic objects are equivalent.
|
void |
pasteObjects()
Pastes copied objects at the current dimensional position.
|
void |
pasteObjects(int[] pos)
Pastes copied objects at the given dimensional position.
|
protected void |
releaseLeft(DisplayEvent e,
DisplayImpl display,
OverlayTool tool)
Helper method that handles left mouse button releases.
|
void |
removeObject(OverlayObject obj)
Removes an overlay object at the current dimensional position.
|
void |
removeObject(OverlayObject obj,
int[] pos)
Removes an overlay object at the given dimensional position.
|
void |
removeSelectedObjects()
Removes selected overlay objects at the current dimensional position.
|
void |
removeSelectedObjects(int[] pos)
Removes selected overlay objects at the given dimensional position.
|
void |
removeTSB()
Removes transient selection box.
|
void |
saveOverlays(PrintWriter out)
Writes the overlays to the given writer.
|
void |
setFont(Font font)
Sets the font used for text overlays.
|
void |
setPos(int[] pos)
Sets transform's current dimensional position.
|
void |
setTextDrawn(boolean value)
Whether text is drawn.
|
void |
transformChanged(TransformEvent e)
Called when parent data transform's parameters are updated.
|
protected void |
updatePosition(DisplayImpl display)
Updates the dimensional position based on the current state of the given
display.
|
addTransformListener, canDisplay2D, canDisplay3D, getDimTypes, getFont, getHTMLDescription, getLabels, getLengths, getName, getParent, getThumbHandler, getTransformId, getUnitDescription, makeLabels, notifyListeners, removeTransformListener, restoreState, saveState, toString
protected static final RealType RED_TYPE
protected static final RealType GREEN_TYPE
protected static final RealType BLUE_TYPE
protected static final RealType ALPHA_TYPE
protected static final RealTupleType RANGE_TUPLE
protected static final String NOT_APPLICABLE
protected OverlayWidget controls
protected Vector[] overlays
protected int[] pos
protected TextType textType
protected TupleType textRangeTuple
protected boolean mouseDownLeft
protected boolean mouseDownRight
protected FontMetrics fontMetrics
protected boolean drawText
protected Vector clipboard
protected int[] clipboardPos
protected TransientSelectBox selectBox
protected String lastToolType
protected boolean toolChanged
public OverlayTransform(DataTransform parent, String name)
protected static RealTupleType makeRangeTuple()
public void addObject(OverlayObject obj)
public void addObject(OverlayObject obj, int[] pos)
public void removeObject(OverlayObject obj)
public void removeObject(OverlayObject obj, int[] pos)
public void removeSelectedObjects()
public void addTSB(TransientSelectBox tsb)
public void removeTSB()
public void removeSelectedObjects(int[] pos)
public void copySelectedObjects()
public void copySelectedObjects(int[] pos)
public void pasteObjects()
public void pasteObjects(int[] pos)
public String distributeObjects()
public String distributeObjects(int[] pos)
public OverlayObject[] getObjects()
public OverlayObject[] getObjects(int[] pos)
public void setPos(int[] pos)
public int[] getPos()
public void loadOverlays(BufferedReader in) throws IOException
IOException
public void saveOverlays(PrintWriter out)
public loci.poi.hssf.usermodel.HSSFWorkbook exportOverlays()
public RealTupleType getDomainType()
public TupleType getRangeType()
public TupleType getTextRangeType()
public Tuple getTextRangeValue(String text, float r, float g, float b, float a)
public int getScalingValue()
public int getScalingValueX()
public int getScalingValueY()
public FontMetrics getFontMetrics()
public void setTextDrawn(boolean value)
public boolean isTextDrawn()
public boolean hasToolChanged()
public static DataTransform makeTransform(DataManager dm)
public static boolean isValidParent(DataTransform data)
public static boolean isParentRequired()
public Data getData(TransformLink link, int[] pos, int dim, DataCache cache)
getData
in class DataTransform
public boolean isValidDimension(int dim)
isValidDimension
in class DataTransform
public ScalarMap[] getSuggestedMaps()
getSuggestedMaps
in class DataTransform
public String getCacheId(int[] pos, boolean global)
getCacheId
in class DataTransform
public boolean isImmediate()
isImmediate
in class DataTransform
public JComponent getControls()
getControls
in class DataTransform
public void setFont(Font font)
setFont
in class DataTransform
public void displayChanged(DisplayEvent e)
displayChanged
in class DataTransform
public boolean matches(Dynamic dyn)
matches
in interface Dynamic
matches
in class DataTransform
public boolean isCompatible(Dynamic dyn)
isCompatible
in interface Dynamic
isCompatible
in class DataTransform
public void initState(Dynamic dyn)
initState
in interface Dynamic
initState
in class DataTransform
public void discard()
discard
in interface Dynamic
discard
in class DataTransform
public void transformChanged(TransformEvent e)
transformChanged
in interface TransformListener
protected void configureOverlay(OverlayObject obj)
protected void updatePosition(DisplayImpl display)
protected void releaseLeft(DisplayEvent e, DisplayImpl display, OverlayTool tool)
Copyright © 2015–2022 SciJava. All rights reserved.