Class OverlayUtils


  • public class OverlayUtils
    extends Object
    Helps understanding how overlay is actually performed by JOGL2.
    • Constructor Detail

      • OverlayUtils

        public OverlayUtils()
    • Method Detail

      • drawCanvasAndViewportDiagonalComparison

        public static void drawCanvasAndViewportDiagonalComparison​(Chart chart,
                                                                   Graphics2D g2d)
      • drawPixel

        public static void drawPixel​(Graphics2D g2d,
                                     Color c,
                                     int x,
                                     int y,
                                     int width)
      • drawPixel

        public static void drawPixel​(Graphics2D g2d,
                                     Color c,
                                     int x,
                                     int y)
      • drawChartBorder

        public static void drawChartBorder​(Graphics2D g2d,
                                           Color c,
                                           Chart chart)
        This shows a strange behaviour in the Overlay: when trying to draw a rectangle based on the CANVAS size (i.e. the window size), the border occupies the CHART (i.e. its actual viewport).
      • drawDiagonal

        public static void drawDiagonal​(Graphics2D g2d,
                                        Color c,
                                        int wmax,
                                        int hmax,
                                        boolean sysout)
        Diagonal made of points from (0,0) to (wmax, hmax).
      • canvasToViewport

        protected IntegerCoord2d canvasToViewport​(MouseEvent e,
                                                  Rectangle viewport)
        Needed when wishing to adapt a coordinate relative to the canvas to the viewport frame. If the mouse does not stand on top of the viewport (meaning the viewport is smaller than the canvas), then the output coordinate is (-1,-1).
      • viewportToCanvas

        protected IntegerCoord2d viewportToCanvas​(Chart chart,
                                                  IntegerCoord2d input,
                                                  Rectangle viewport)
        Needed when wishing to display a coordinate relative to the viewport. Expect a coordinate in viewport frame to be converted to the canvas frame, since Overlay expect coordinates in the canvas frame and then stretch it to be displayed in viewport frame!
      • projectionStat

        protected void projectionStat​(PolygonArray[][] array)