Package chemaxon.marvin.space.monitor
Class Monitor
- java.lang.Object
-
- chemaxon.marvin.space.GraphicComponent
-
- chemaxon.marvin.space.monitor.Monitor
-
- All Implemented Interfaces:
chemaxon.marvin.space.UsableObject
- Direct Known Subclasses:
Label
,MeasurementMonitor
,PositionMonitor
@PublicAPI public abstract class Monitor extends GraphicComponent
TheMonitor
is for "watching" something in the scene. The direct subclasses areMeasurementMonitor
,PositionMonitor
andLabel
.
AMeasurementMonitor
watches some objects, and measures something between them.
APositionMonitor
is watching a location as a center of a transformation.
ALabel
is watching an object and describes it.- Since:
- Marvin 4.0.2
-
-
Field Summary
Fields Modifier and Type Field Description protected Control
control
protected int
mode
protected int[]
selectedItemCoordinates
protected ComponentElement[]
selectedItems
Storage of the items of monitoring.protected int
selectionPointer
Points to the next empty space in selectedItems.-
Fields inherited from class chemaxon.marvin.space.GraphicComponent
active, associatedComponents, boundingBox, color, COMPONENT_TYPE_ENTIRE, drawProperties, drawType, gl, glu, graphicCell, irm, modifiesOrigin, motionMode, mousex, mousey, name, pickedItem, RENDERING_QUALITY_HIGH, RENDERING_QUALITY_LOW, RENDERING_QUALITY_MEDIUM, renderingQuality, rm, uoid, visible
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Monitor()
Creates a new instance ofMonitor
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clear()
Deletes all items from selectedItems.ComponentElement[]
getSelectedElements()
Returns the set of the monitored items.boolean
hasControl()
Returns true if the monitor has a control.boolean
hasInvisibleItem()
Retruns true if any of the selected elements is hidden.boolean
hasTransparentPart()
In wire mode (now only this is available) monitors are drawn with blending enabled.boolean
isFull()
Returns true if the monitor is full and can measure.boolean
isVisible()
A monitor is visible if all of its selected components are visible, and it is not hidden explicitly.abstract int
maximumItemCount()
Returns the number of items necessary for monitoring.void
onRemoveGraphicComponent()
double
pickedIndicator()
Monitors do not really have z coordinate, they are the nearer to us.void
receiveNotificationOnCoordinateChange(GraphicComponent gc)
Gets notification from its selected components if their coordinates have been changed.void
receiveNotificationOnInvisibility(GraphicComponent gc)
If the component to that this monitor is assigned becomes hidden, this monitor will also behave so.void
receiveNotificationOnVisibility(GraphicComponent gc)
If the component to that this monitor is assigned becomes visible, this monitor will also behave so.boolean
refersTo(GraphicComponent component)
Retruns true if component is between the selected elements.void
selectItem(ComponentElement item)
Puts item to the selection.void
unSelect()
Sets the component not to be selected.-
Methods inherited from class chemaxon.marvin.space.GraphicComponent
addDrawProperties, associate, cleanup, draw, draw2DPart, drawBoundingBox, drawCoordinateAxes, drawSelection, drawTransparentPart, exclusiveSelection, exclusiveSelection, extendSelection, extendSelection, fadeSelected, fadeUnselected, getAssociatedComponents, getBoundingBox, getBoundingSphereRadius, getCell, getColor, getComponentElement, getCoordinates, getCoordinates, getDescription, getDescription, getDrawProperties, getDrawProperty, getGraphicComponent, getId, getLabelInformation, getLabelInformation, getName, getRenderingQuality, getUsableObject, getZCoordinateTo2DPart, glColor, has2DPart, hasSelectedElements, hideSelected, hideUnselected, invertSelection, invertSelection, isControllable, isGraphicComponent, isSelected, isSelected, isVisible, locateObject, notifyCoordinateChange, notifyInvisibility, notifySelection, notifyUnSelection, notifyVisibility, pickObject, projectVector, receiveNotificationOnSelection, receiveNotificationOnUnSelection, removeAssociation, resize, rotate, rotate, rotate, select, select, selectComponentElementsInside, setColor, setColor, setColor, setColor, setDrawProperties, setDrawProperty, setGL, setMotionMode, setName, setProgressBar, setRenderingQuality, setRotateMatrix, setVisible, showFaded, storeDrawProperty, toString, touchObject, translate, unSelect
-
-
-
-
Field Detail
-
selectedItems
protected ComponentElement[] selectedItems
Storage of the items of monitoring.
-
selectedItemCoordinates
protected int[] selectedItemCoordinates
-
selectionPointer
protected int selectionPointer
Points to the next empty space in selectedItems.
-
control
protected Control control
-
mode
protected int mode
-
-
Method Detail
-
onRemoveGraphicComponent
public void onRemoveGraphicComponent()
- Overrides:
onRemoveGraphicComponent
in classGraphicComponent
-
maximumItemCount
public abstract int maximumItemCount()
Returns the number of items necessary for monitoring. E.g. 2 for distance monitoring.
-
getSelectedElements
public ComponentElement[] getSelectedElements()
Returns the set of the monitored items.- Returns:
- identifiers of the monitored objects.
-
selectItem
public void selectItem(ComponentElement item)
Puts item to the selection.
-
receiveNotificationOnCoordinateChange
public void receiveNotificationOnCoordinateChange(GraphicComponent gc)
Gets notification from its selected components if their coordinates have been changed. A monitor should be refreshed then.- Overrides:
receiveNotificationOnCoordinateChange
in classGraphicComponent
- Parameters:
gc
- component changing coordinates
-
receiveNotificationOnVisibility
public void receiveNotificationOnVisibility(GraphicComponent gc)
If the component to that this monitor is assigned becomes visible, this monitor will also behave so.- Overrides:
receiveNotificationOnVisibility
in classGraphicComponent
- Parameters:
gc
-
-
receiveNotificationOnInvisibility
public void receiveNotificationOnInvisibility(GraphicComponent gc)
If the component to that this monitor is assigned becomes hidden, this monitor will also behave so.- Overrides:
receiveNotificationOnInvisibility
in classGraphicComponent
- Parameters:
gc
-
-
isFull
public boolean isFull()
Returns true if the monitor is full and can measure.
-
hasControl
public boolean hasControl()
Returns true if the monitor has a control. A monitor can have a control, but a control cannot exist without a monitor.
-
clear
public void clear()
Deletes all items from selectedItems.
-
isVisible
public boolean isVisible()
A monitor is visible if all of its selected components are visible, and it is not hidden explicitly.- Specified by:
isVisible
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
isVisible
in classGraphicComponent
- Returns:
- visibility of the component
-
hasInvisibleItem
public boolean hasInvisibleItem()
Retruns true if any of the selected elements is hidden. (This monitor won't be displayed then.)
-
refersTo
public boolean refersTo(GraphicComponent component)
Retruns true if component is between the selected elements.
-
unSelect
public void unSelect()
Sets the component not to be selected.- Specified by:
unSelect
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
unSelect
in classGraphicComponent
-
pickedIndicator
public double pickedIndicator()
Monitors do not really have z coordinate, they are the nearer to us. Apart from that in case of picking every component tells its z coordinate so we can tell which component is really picked (the nearest). This function returns a virtual z coordinate, which represents a very near object. IflocateObject()
returns the same aspickedIndicator()
, then we say that the monitor was picked.
-
hasTransparentPart
public boolean hasTransparentPart()
In wire mode (now only this is available) monitors are drawn with blending enabled.- Overrides:
hasTransparentPart
in classGraphicComponent
- Returns:
- will the component draw with transparency
-
-