chemaxon.marvin.space.monitor
Class Monitor

java.lang.Object
  extended by chemaxon.marvin.space.GraphicComponent
      extended by chemaxon.marvin.space.monitor.Monitor
All Implemented Interfaces:
chemaxon.marvin.space.UsableObject
Direct Known Subclasses:
Label, MeasurementMonitor, PositionMonitor

public abstract class Monitor
extends GraphicComponent

The Monitor is for "watching" something in the scene. The direct subclasses are MeasurementMonitor, PositionMonitor and Label.
A MeasurementMonitor watches some objects, and measures something between them.
A PositionMonitor is watching a location as a center of a transformation.
A Label is watching an object and describes it.

Since:
Marvin 4.0.2
Version:
MarvinSpace 1.0
Author:
Judit Papp

Field Summary
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
protected Monitor()
          Creates a new instance of Monitor.
 
Method Summary
 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, 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, setDrawProperties, setDrawProperty, setGL, setMotionMode, setName, setProgressBar, setRenderingQuality, setRotateMatrix, setVisible, showFaded, storeDrawProperty, toString, touchObject, translate, unSelect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
Constructor Detail

Monitor

protected Monitor()
Creates a new instance of Monitor. Initializes selectedItems with a maximum item count, and becames a GraphicComponent which does not modify the origin of the Cell it is in.

Method Detail

onRemoveGraphicComponent

public void onRemoveGraphicComponent()
Overrides:
onRemoveGraphicComponent in class GraphicComponent

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 class GraphicComponent
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 class GraphicComponent
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 class GraphicComponent
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 interface chemaxon.marvin.space.UsableObject
Overrides:
isVisible in class GraphicComponent
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 interface chemaxon.marvin.space.UsableObject
Overrides:
unSelect in class GraphicComponent

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. If locateObject() returns the same as pickedIndicator(), 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 class GraphicComponent
Returns:
will the component draw with transparency