chemaxon.marvin.space.monitor
Class PositionMonitor

java.lang.Object
  extended by chemaxon.marvin.space.GraphicComponent
      extended by chemaxon.marvin.space.monitor.Monitor
          extended by chemaxon.marvin.space.monitor.PositionMonitor
All Implemented Interfaces:
chemaxon.marvin.space.UsableObject

public class PositionMonitor
extends Monitor

Monitors a specific location in the space and has a control that can change the coordinates of the monitored elements with a transformation. The specific location is the center of the transformation.

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

Field Summary
protected  float[] position
           
 
Fields inherited from class chemaxon.marvin.space.monitor.Monitor
control, mode, selectedItemCoordinates, selectedItems, selectionPointer
 
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
PositionMonitor()
          Creates a new instance of PositionMonitor
 
Method Summary
 void control(int z)
          Causes the monitor's controll to take action with 1 parameter.
 void control(int x, int y)
          Causes the monitor's controll to take action with 2 parameters.
 void draw()
          Draws nothing.
 void draw2DPart()
          Draws the Control of the PositionMonitor.
 GraphicComponent getComponent()
          Returns the GraphicComponent of the only selected item.
 Control getControl()
          Returns the control of this monitor.
 void getCoordinates(ComponentElement item, float[] c)
          Returns the coordinates of the selected item.
 void getCoordinates(float[] c)
          Returns the coordinates of the selected item.
 int getPosition()
          Returns the monitor's position.
 boolean has2DPart()
          Returns true, because the Control is always drawn in plane.
 boolean isVisible(ComponentElement item)
          Returns true, because a PositionMonitor cannot be hidden.
 double locateObject(int x, int y)
          Pickes the control in x, y position.
 int maximumItemCount()
          Returns 1, because this is the maximun number of selected elements.
 void refresh()
          The monitor refreshes its coordinates from the selected item's coordinates.
 void selectItem(ComponentElement item)
          Parameter item will be the selected item of the monitor.
 void selectItem(GraphicComponent gc)
          The given component will be the selected item of the monitor.
 void setControl(Control control)
          Sets the control of the monitor, and the center of the control to the center of the monitor.
 void setPosition(float[] position)
          Sets the monitor's position
 void setPosition(float x, float y, float z)
          Sets the monitor's position
 
Methods inherited from class chemaxon.marvin.space.monitor.Monitor
clear, getSelectedElements, hasControl, hasInvisibleItem, hasTransparentPart, isFull, isVisible, onRemoveGraphicComponent, pickedIndicator, receiveNotificationOnCoordinateChange, receiveNotificationOnInvisibility, receiveNotificationOnVisibility, refersTo, unSelect
 
Methods inherited from class chemaxon.marvin.space.GraphicComponent
addDrawProperties, associate, drawBoundingBox, drawCoordinateAxes, drawSelection, drawTransparentPart, exclusiveSelection, exclusiveSelection, extendSelection, extendSelection, fadeSelected, fadeUnselected, getAssociatedComponents, getBoundingBox, getBoundingSphereRadius, getCell, getColor, getComponentElement, getDescription, getDescription, getDrawProperties, getDrawProperty, getGraphicComponent, getId, getLabelInformation, getLabelInformation, getName, getRenderingQuality, getUsableObject, getZCoordinateTo2DPart, glColor, hasSelectedElements, hideSelected, hideUnselected, invertSelection, invertSelection, isControllable, isGraphicComponent, isSelected, isSelected, 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

position

protected float[] position
Constructor Detail

PositionMonitor

public PositionMonitor()
Creates a new instance of PositionMonitor

Method Detail

selectItem

public void selectItem(ComponentElement item)
Parameter item will be the selected item of the monitor. A PositionMonitor can have only one selected item. Also sets the monitor's position to the coordinates of the item.

Overrides:
selectItem in class Monitor

selectItem

public void selectItem(GraphicComponent gc)
The given component will be the selected item of the monitor. A PositionMonitor can have only one selected item. Also sets the monitor's position to the coordinates of the component.


getComponent

public GraphicComponent getComponent()
Returns the GraphicComponent of the only selected item.


refresh

public void refresh()
The monitor refreshes its coordinates from the selected item's coordinates.


getCoordinates

public void getCoordinates(float[] c)
Returns the coordinates of the selected item.

Overrides:
getCoordinates in class GraphicComponent
Parameters:
c - allocated array where coordinates will be put

getCoordinates

public void getCoordinates(ComponentElement item,
                           float[] c)
Returns the coordinates of the selected item.

Overrides:
getCoordinates in class GraphicComponent
Parameters:
item - specific part of the component
c - allocated array where coordinates will be put

maximumItemCount

public int maximumItemCount()
Returns 1, because this is the maximun number of selected elements.

Specified by:
maximumItemCount in class Monitor

getPosition

public int getPosition()
Returns the monitor's position. It is the same as the coordinates of its selected item.


setPosition

public void setPosition(float x,
                        float y,
                        float z)
Sets the monitor's position


setPosition

public void setPosition(float[] position)
Sets the monitor's position


isVisible

public boolean isVisible(ComponentElement item)
Returns true, because a PositionMonitor cannot be hidden. (just destroyed)

Overrides:
isVisible in class GraphicComponent
Parameters:
item - part of the component
Returns:
visibility of the part of the component

draw

public void draw()
Draws nothing.

Overrides:
draw in class GraphicComponent

draw2DPart

public void draw2DPart()
Draws the Control of the PositionMonitor.

Overrides:
draw2DPart in class GraphicComponent

has2DPart

public boolean has2DPart()
Returns true, because the Control is always drawn in plane.

Overrides:
has2DPart in class GraphicComponent
Returns:
will the component draw in plane

getControl

public Control getControl()
Returns the control of this monitor. It can be an instance of Global/Local Orientation/Location Controls.


setControl

public void setControl(Control control)
Sets the control of the monitor, and the center of the control to the center of the monitor.


control

public void control(int x,
                    int y)
Causes the monitor's controll to take action with 2 parameters. Parameters indicate mouse motion in x, y directions.


control

public void control(int z)
Causes the monitor's controll to take action with 1 parameter. Parameter indicates mouse motion in one (x or y) direction.


locateObject

public double locateObject(int x,
                           int y)
Pickes the control in x, y position.

Overrides:
locateObject in class GraphicComponent
Parameters:
x - window coordinate of the mouse
y - window coordinate of the mouse
Returns:
z coordinate of the nearest picked object