Class RendererBase

    • Constructor Detail

      • RendererBase

        public RendererBase​(GraphicsBase<?> graphics,
                            String name)
        Constructs a new renderer.
        Parameters:
        graphics - the graphics control where the renderer will be used
        name - the name of the renderer (useful for tooling)
    • Method Detail

      • snapSpaceX

        public double snapSpaceX​(double value)
        If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the horizontal direction, else returns the same value.
        Parameters:
        value - the space value to be snapped
        Returns:
        value rounded to nearest pixel
      • snapSpaceY

        public double snapSpaceY​(double value)
        If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the vertical direction, else returns the same value.
        Parameters:
        value - the space value to be snapped
        Returns:
        value rounded to nearest pixel
      • snapSizeX

        public double snapSizeX​(double value)
        If this renderer's snapToPixel property is true, returns a value ceiled to the nearest pixel in the horizontal direction, else returns the same value.
        Parameters:
        value - the size value to be snapped
        Returns:
        value ceiled to nearest pixel
      • snapSizeY

        public double snapSizeY​(double value)
        If this renderer's snapToPixel property is true, returns a value ceiled to the nearest pixel in the vertical direction, else returns the same value.
        Parameters:
        value - the size value to be snapped
        Returns:
        value ceiled to nearest pixel
      • snapPositionX

        public double snapPositionX​(double value)
        If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the horizontal direction, else returns the same value.
        Parameters:
        value - the position value to be snapped
        Returns:
        value rounded to nearest pixel
      • snapPositionY

        public double snapPositionY​(double value)
        If this renderer's snapToPixel property is true, returns a value rounded to the nearest pixel in the vertical direction, else returns the same value.
        Parameters:
        value - the position value to be snapped
        Returns:
        value rounded to nearest pixel
      • disableRedrawAfterPropertyChange

        protected final void disableRedrawAfterPropertyChange()
        Disables automatic redrawing of the graphics area when one of the observed properties changes. Useful for not going into infinite loops.
      • enableRedrawAfterPropertyChange

        protected final void enableRedrawAfterPropertyChange()
        Enabled automatic redrawing of the graphics area when one of the observed properties changes. Useful for not going into infinite loops.
      • redrawObservable

        protected void redrawObservable​(Observable observable)
        Registers the given observable as something that requires a redraw of the graphics area. E.g.: the stroke color has changed.
        Parameters:
        observable - the observable to monitor for changes
      • getName

        public final String getName()
      • getLocation

        protected final double getLocation​(Instant time,
                                           Canvas canvas)
        Calculates the x coordinate for the given time. This method only returns valid results when the renderers is used in a layout with horizontal orientation. It will not work in AgendaLayout.
        Parameters:
        time - the time for which to calculate the x coordinate
        Returns:
        the location of the given time point
        Since:
        1.0
        See Also:
        TimelineModel.calculateLocationForTime(Instant)
      • getTimeAt

        protected final Instant getTimeAt​(double location)
        Calculates the time at the given x coordinate. This method only returns valid results when the renderer is used in a layout with horizontal orientation. It will not work in AgendaLayout.
        Parameters:
        location - the location for which to return the time
        Returns:
        the time at the given x coordinate
        Since:
        1.0
        See Also:
        TimelineModel.calculateTimeForLocation(double)
      • isEnabled

        public final boolean isEnabled()
      • setEnabled

        public final void setEnabled​(boolean enabled)
      • setSnapToPixel

        public final void setSnapToPixel​(boolean snap)
      • isSnapToPixel

        public final boolean isSnapToPixel()
      • setAlpha

        public final void setAlpha​(double alpha)
      • getAlpha

        public final double getAlpha()