Class HexCellRenderer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected CellGeometry cellGeo
      The cell geometry used for rendering.
      protected MagellanContext context  
      protected GameData data
      The game data this renderer may use for additional information on what and how to render.
      protected java.awt.Graphics2D graphics
      The graphics object set by init() to draw on in the render() method.
      protected java.awt.Rectangle offset
      The pixel offset used to compensate the difference of axis origins between the graphics object and the map.
      protected java.util.Properties settings
      A Properties object used to retrieve and store preferences of this renderer.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected static javax.swing.JTextArea createDescriptionPanel​(java.lang.String text, java.awt.Component parent)  
      CellGeometry getCellGeometry()
      Returns the used cell geometry object.
      abstract java.lang.String getName()
      Returns a name for this renderer.
      abstract int getPlaneIndex()
      Returns the default rendering plane of the renderer.
      PreferencesAdapter getPreferencesAdapter()
      Returns a default preferences adapter telling the user that this renderer does not have modifiable preferences.
      void init​(GameData data, java.awt.Graphics g, java.awt.Rectangle offset)
      Initializes a rendering pass with the specified graphics object g used to paint on in subsequent calls to render() and the offset where to draw region 0, 0 on the graphics object.
      abstract void render​(java.lang.Object obj, boolean active, boolean selected)
      Renders the supplied object.
      void scale​(float scaleFactor)
      Scales the used cell geometry object.
      void setCellGeometry​(CellGeometry geo)
      Sets the used cell geometry object.
      java.lang.String toString()
      Returns a String representation of the renderer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • cellGeo

        protected CellGeometry cellGeo
        The cell geometry used for rendering.
      • settings

        protected java.util.Properties settings
        A Properties object used to retrieve and store preferences of this renderer.
      • data

        protected GameData data
        The game data this renderer may use for additional information on what and how to render.
      • graphics

        protected java.awt.Graphics2D graphics
        The graphics object set by init() to draw on in the render() method.
      • offset

        protected java.awt.Rectangle offset
        The pixel offset used to compensate the difference of axis origins between the graphics object and the map.
    • Constructor Detail

      • HexCellRenderer

        public HexCellRenderer​(CellGeometry geo,
                               MagellanContext context)
        A constructor assigning a cell geometry and settings.
    • Method Detail

      • init

        public void init​(GameData data,
                         java.awt.Graphics g,
                         java.awt.Rectangle offset)
        Initializes a rendering pass with the specified graphics object g used to paint on in subsequent calls to render() and the offset where to draw region 0, 0 on the graphics object.
        Specified by:
        init in interface MapCellRenderer
      • render

        public abstract void render​(java.lang.Object obj,
                                    boolean active,
                                    boolean selected)
        Description copied from interface: MapCellRenderer
        Renders the supplied object. The active and selected parameters influence how the object is drawn.
        Specified by:
        render in interface MapCellRenderer
        Parameters:
        obj - This object is going to be displayed (typically a region).
        active - Indicates if the object is the currently active object.
        selected - Indicates if the object is the currently selected.
        See Also:
        MapCellRenderer.render(java.lang.Object, boolean, boolean)
      • getName

        public abstract java.lang.String getName()
        Returns a name for this renderer. By default, the key "name" is looked up in the component dictionary and returned.
        Specified by:
        getName in interface MapCellRenderer
      • getPlaneIndex

        public abstract int getPlaneIndex()
        Returns the default rendering plane of the renderer. See the constants specified in com.eressea.swing.map.Mapper for possible values.
        Specified by:
        getPlaneIndex in interface MapCellRenderer
      • scale

        public void scale​(float scaleFactor)
        Scales the used cell geometry object.
        Specified by:
        scale in interface MapCellRenderer
        Parameters:
        scaleFactor - The new factor. Must be > 0.
        Throws:
        java.lang.IllegalArgumentException - if scaleFactor <= 0.
      • toString

        public java.lang.String toString()
        Returns a String representation of the renderer.
        Overrides:
        toString in class java.lang.Object
      • createDescriptionPanel

        protected static javax.swing.JTextArea createDescriptionPanel​(java.lang.String text,
                                                                      java.awt.Component parent)