Class SpreadSheetRowPointHitDetector
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.core.plot.AbstractHitDetector<H,P>
-
- adams.gui.visualization.core.plot.AbstractDistanceBasedHitDetector<List<SpreadSheetRowPoint>,String>
-
- adams.gui.visualization.spreadsheet.SpreadSheetRowPointHitDetector
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,HitDetector<List<SpreadSheetRowPoint>,String>
,Serializable
public class SpreadSheetRowPointHitDetector extends AbstractDistanceBasedHitDetector<List<SpreadSheetRowPoint>,String>
Detects selections of row points in the row panel.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SpreadSheetRowPanel
m_Owner
the owner of this detector.-
Fields inherited from class adams.gui.visualization.core.plot.AbstractDistanceBasedHitDetector
m_MinimumPixelDifference
-
Fields inherited from class adams.gui.visualization.core.plot.AbstractHitDetector
m_Debug, m_Enabled
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description SpreadSheetRowPointHitDetector(SpreadSheetRowPanel owner)
Initializes the hit detector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.protected int
findClosestAttributeIndex(SpreadSheetRow row, double x)
Returns the closest attribute index for the given x.protected int[]
findEnclosingAttributeIndices(SpreadSheetRow row, double x)
Determines the enclosing attribute indices for the given x value.protected SpreadSheetRowPoint
findSpreadSheetRowPoint(SpreadSheetRow inst, int index)
Returns the Row point at the specified position.SpreadSheetRowPanel
getOwner()
Returns the owner.String
globalInfo()
Returns a string describing the object.protected List<SpreadSheetRowPoint>
isHit(MouseEvent e)
Checks for a hit.protected String
processHit(MouseEvent e, List<SpreadSheetRowPoint> hit)
Performs the action when a hit is detected.-
Methods inherited from class adams.gui.visualization.core.plot.AbstractDistanceBasedHitDetector
defineOptions, distance, getDefaultMinimumPixelDifference, getMinimumPixelDifference, minimumPixelDifferenceDetectorTipText, setMinimumPixelDifference
-
Methods inherited from class adams.gui.visualization.core.plot.AbstractHitDetector
detect, getDebug, isEnabled, locate, setDebug, setEnabled
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Owner
protected SpreadSheetRowPanel m_Owner
the owner of this detector.
-
-
Constructor Detail
-
SpreadSheetRowPointHitDetector
public SpreadSheetRowPointHitDetector(SpreadSheetRowPanel owner)
Initializes the hit detector.- Parameters:
owner
- the panel that uses this detector
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
getOwner
public SpreadSheetRowPanel getOwner()
Returns the owner.- Returns:
- the owning panel
-
findEnclosingAttributeIndices
protected int[] findEnclosingAttributeIndices(SpreadSheetRow row, double x)
Determines the enclosing attribute indices for the given x value. If the given x happens to be an exact point, then this points will be stored at index 0. If no index could be determined, then -1 will be stored.- Parameters:
row
- the underlying rowx
- the x on the plot- Returns:
- the indices
-
findClosestAttributeIndex
protected int findClosestAttributeIndex(SpreadSheetRow row, double x)
Returns the closest attribute index for the given x.- Parameters:
row
- the underlying Rowx
- the x to get the index for- Returns:
- the index
-
findSpreadSheetRowPoint
protected SpreadSheetRowPoint findSpreadSheetRowPoint(SpreadSheetRow inst, int index)
Returns the Row point at the specified position.- Parameters:
inst
- the Row data structure to searchindex
- the attribute index (original dataset)- Returns:
- the RowPoint, null if not found
-
isHit
protected List<SpreadSheetRowPoint> isHit(MouseEvent e)
- Specified by:
isHit
in classAbstractHitDetector<List<SpreadSheetRowPoint>,String>
- Parameters:
e
- the MouseEvent (for coordinates)- Returns:
- the associated object with the hit, otherwise null
-
processHit
protected String processHit(MouseEvent e, List<SpreadSheetRowPoint> hit)
Performs the action when a hit is detected.- Specified by:
processHit
in classAbstractHitDetector<List<SpreadSheetRowPoint>,String>
- Parameters:
e
- the MouseEvent (for coordinates)hit
- the object that got determined by the hit- Returns:
- the generated appendix for the tiptext
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractHitDetector<List<SpreadSheetRowPoint>,String>
-
-