Class PositionMonitor

All Implemented Interfaces:
chemaxon.marvin.space.UsableObject

@PublicAPI 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
  • Field Details

    • position

      protected float[] position
  • Constructor Details

    • PositionMonitor

      public PositionMonitor()
      Creates a new instance of PositionMonitor
  • Method Details

    • 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