Class Canvas

    • Constructor Detail

      • Canvas

        public Canvas()
        Canvas constructor. Sets initial scale and the offset to the center of the canvas.
    • Method Detail

      • centerOffset

        public void centerOffset()
      • clear

        public void clear()
        Clears all maps containing the rendered items.
      • paintComponent

        protected void paintComponent​(Graphics g)
        Rendering all the items on the canvas.
        Overrides:
        paintComponent in class JComponent
        Parameters:
        g - graphics to render the items with
      • render

        public void render​(Iterable<DiscreteGene> chromosome)
        Render a single chromosome as a series of points connected with lines.
        Parameters:
        chromosome - chromosome to render
      • renderRays

        public void renderRays​(int amount)
        Render the rays from the origin.
        Parameters:
        amount - amount of rays to render
      • renderTreasures

        public void renderTreasures​(Iterable<DiscreteGene> treasures)
        Render the treasure points as red crosses.
        Parameters:
        treasures - list of treasure points
      • enqueue

        public void enqueue​(String text,
                            Point2D position,
                            Style style)
        Enqueue text to be rendered soon.
        Parameters:
        text - text to enqueue
        position - position of the text
        style - style of the rendered text
      • enqueue

        public void enqueue​(Point2D point,
                            Style style)
        Enqueue a point to be rendered soon.
        Parameters:
        point - point to enqueue
        style - style of the rendered point
      • enqueue

        public void enqueue​(Shape shape,
                            Style style)
        Enqueue a shape to be rendered soon.
        Parameters:
        shape - shape to enqueue
        style - style of the rendered shape
      • getMaxDistanceVisible

        public double getMaxDistanceVisible()
        The max distance visible is the maximal distance between the coordinate systems origin and one of the four canvas boundary edges. This distance is given in a coordinate- logical/unscaled way.
        Returns:
        maximal distance visible by canvas
      • getPoints

        public HashMap<Point2D,​Style> getPoints()
        Points to be rendered on the canvas.
      • getShapes

        public HashMap<Shape,​Style> getShapes()
        Shapes to be rendered on the canvas.
      • getPopover

        public JLabel getPopover()
        Label to display string data without rendering it on the canvas.
      • setRays

        public void setRays​(int rays)
        Amount of rays to display.