Package adams.gui.visualization.instance
Class InstancePointHitDetector
- 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<InstancePoint>,String>
-
- adams.gui.visualization.instance.InstancePointHitDetector
-
- All Implemented Interfaces:
adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.SizeOfHandler
,adams.gui.visualization.core.plot.HitDetector<List<InstancePoint>,String>
,Serializable
public class InstancePointHitDetector extends adams.gui.visualization.core.plot.AbstractDistanceBasedHitDetector<List<InstancePoint>,String>
Detects selections of instance points in the instance panel.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected InstancePanel
m_Owner
the owner of this detector.-
Fields inherited from class adams.gui.visualization.core.plot.AbstractDistanceBasedHitDetector
m_MinimumPixelDifference
-
-
Constructor Summary
Constructors Constructor Description InstancePointHitDetector(InstancePanel 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(Instance inst, double x)
Returns the closest attribute index for the given x.protected int[]
findEnclosingAttributeIndices(Instance inst, double x)
Determines the enclosing attribute indices for the given x value.protected InstancePoint
findInstancePoint(Instance inst, int index)
Returns the Instance point at the specified position.InstancePanel
getOwner()
Returns the owner.String
globalInfo()
Returns a string describing the object.protected List<InstancePoint>
isHit(MouseEvent e)
Checks for a hit.protected String
processHit(MouseEvent e, List<InstancePoint> 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
-
-
-
-
Field Detail
-
m_Owner
protected InstancePanel m_Owner
the owner of this detector.
-
-
Constructor Detail
-
InstancePointHitDetector
public InstancePointHitDetector(InstancePanel 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 interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
getOwner
public InstancePanel getOwner()
Returns the owner.- Returns:
- the owning panel
-
findEnclosingAttributeIndices
protected int[] findEnclosingAttributeIndices(Instance inst, 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:
inst
- the underlying instancex
- the x on the plot- Returns:
- the indices
-
findClosestAttributeIndex
protected int findClosestAttributeIndex(Instance inst, double x)
Returns the closest attribute index for the given x.- Parameters:
inst
- the underlying Instancex
- the x to get the index for- Returns:
- the index
-
findInstancePoint
protected InstancePoint findInstancePoint(Instance inst, int index)
Returns the Instance point at the specified position.- Parameters:
inst
- the Instance data structure to searchindex
- the attribute index (original dataset)- Returns:
- the InstancePoint, null if not found
-
isHit
protected List<InstancePoint> isHit(MouseEvent e)
- Specified by:
isHit
in classadams.gui.visualization.core.plot.AbstractHitDetector<List<InstancePoint>,String>
- Parameters:
e
- the MouseEvent (for coordinates)- Returns:
- the associated object with the hit, otherwise null
-
processHit
protected String processHit(MouseEvent e, List<InstancePoint> hit)
Performs the action when a hit is detected.- Specified by:
processHit
in classadams.gui.visualization.core.plot.AbstractHitDetector<List<InstancePoint>,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 interfaceadams.core.CleanUpHandler
- Overrides:
cleanUp
in classadams.gui.visualization.core.plot.AbstractHitDetector<List<InstancePoint>,String>
-
-