Class Monitor

  • All Implemented Interfaces:
    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.
    Marvin 4.0.2
    • 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

      • 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.
        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.
        receiveNotificationOnCoordinateChange in class GraphicComponent
        gc - component changing coordinates
      • 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
        isVisible in class GraphicComponent
        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
        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.
        hasTransparentPart in class GraphicComponent
        will the component draw with transparency