Class Model

  • Direct Known Subclasses:
    CacheModel, EntityModel

    public abstract class Model
    extends java.lang.Object
    Created with IntelliJ IDEA. User: NotoriousPP Date: 10/31/2014 Time: 11:54 AM
    • Constructor Summary

      Constructors 
      Constructor Description
      Model()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Point calculateCenterPoint()
      Calculates the true center point of the model using its vertices.
      java.awt.geom.Area calculateModelArea()
      Calculates the model area using its vertices.
      void drawWireFrame​(java.awt.Graphics graphics)
      Draws wire frame of this object.
      boolean exists()
      Use to determine if this model is exist and is valid.
      Entity getEntity()
      Gets the entity object
      int getGridX()
      Gets grid X of this model.
      int getGridY()
      /** Gets grid Y of this model.
      java.awt.Shape getHullBounds()
      Gets hull bounds of this object with a default scale of 1.0F.
      java.awt.Shape getHullBounds​(float scale)
      Gets hull bounds of this object with a specified scale.
      int getIndicesCount()
      Get indices count.
      int[] getIndicesX()
      Get indices x.
      int[] getIndicesY()
      Get indices y.
      int[] getIndicesZ()
      Get indices z.
      int[] getOriginalX()
      Get original x.
      int[] getOriginalY()
      Get original y.
      int[] getOriginalZ()
      Get original z.
      int getTileHeight()
      Calculates the tile height for offset specified tile.
      int[][] getVectorSkin()
      Get vector skin.
      int getVertexCount()
      Get vertex count.
      int[][] getVertexMap()
      Get vertex locations stored in a 2D array (flat map) at the current grid location.
      int[][] getVertexMap​(int gridX, int gridY)
      Get vertex locations stored in a 2D array (flat map) at the specified grid location.
      int[][] getVertexMap​(int gridX, int gridY, boolean predictMovement)
      Get vertex locations stored in a 2D array (flat map) at the specified grid location.
      java.util.List<java.awt.Point> getVertexPoints()
      Gets model vertex points at the current set grid location.
      java.util.List<java.awt.Point> getVertexPoints​(int gridX, int gridY)
      Gets model vertex points at the specified grid location.
      int[] getVerticesX()
      Get vertices x.
      int[] getVerticesY()
      Get vertices y.
      int[] getVerticesZ()
      Get vertices z.
      java.util.Optional<Entity> getWrappedEntity()
      Gets wrapped entity object..
      void setEntity​(java.util.Optional<Entity> entity)
      Sets wrapped entity object.
      void setEntity​(Entity e)
      Set entity object
      void setGridLocation​(int gridX, int gridY)
      Sets grid location (x/y) of this model.
      void setGridX​(int gridX)
      Sets grid X.
      void setGridY​(int gridY)
      Sets grid Y.
      void setIndicesCount​(int indicesCount)
      Sets indices count.
      void setIndicesX​(int[] indicesX)
      Sets indices x.
      void setIndicesY​(int[] indicesY)
      Sets indices y.
      void setIndicesZ​(int[] indicesZ)
      Sets indices z.
      void setOriginalX​(int[] originalX)
      Sets original x.
      void setOriginalY​(int[] originalY)
      Sets original y.
      void setOriginalZ​(int[] originalZ)
      Sets original z.
      void setVectorSkin​(int[][] vectorSkin)
      Sets vector skin.
      void setVertexCount​(int verticesCount)
      Sets vertex count.
      void setVerticesX​(int[] verticesX)
      Sets vertices x.
      void setVerticesY​(int[] verticesY)
      Sets vertices y.
      void setVerticesZ​(int[] verticesZ)
      Sets vertices z.
      Model update​(Model model)
      Update model.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Model

        public Model()
    • Method Detail

      • calculateCenterPoint

        public java.awt.Point calculateCenterPoint()
        Calculates the true center point of the model using its vertices.
        Returns:
        the calculated true center point of the model if successful; otherwise a point located at [-1, -1] if failed.
      • calculateModelArea

        public java.awt.geom.Area calculateModelArea()
        Calculates the model area using its vertices.
        Returns:
        the calculated model area if successful; otherwise a empty Area.
      • getVertexPoints

        public java.util.List<java.awt.Point> getVertexPoints()
        Gets model vertex points at the current set grid location.
        Returns:
        the model vertex points located at the current grid location if successful; otherwise a empty list if failed.
      • getVertexPoints

        public java.util.List<java.awt.Point> getVertexPoints​(int gridX,
                                                              int gridY)
        Gets model vertex points at the specified grid location.
        Parameters:
        gridX - the grid x you wish to get the model vertices of.
        gridY - the grid y you wish to get the model vertices of.
        Returns:
        the model vertex points located at the specified grid location if successful; otherwise a empty list if failed.
      • getVertexMap

        public int[][] getVertexMap()
        Get vertex locations stored in a 2D array (flat map) at the current grid location.
        Returns:
        the vertex position map at the current grid location if successful, otherwise empty array if failed.
      • getVertexMap

        public int[][] getVertexMap​(int gridX,
                                    int gridY)
        Get vertex locations stored in a 2D array (flat map) at the specified grid location.
        Parameters:
        gridX - the grid x you wish to get the model vertices of.
        gridY - the grid y you wish to get the model vertices of.
        Returns:
        the vertex position map at the specified grid location if successful, otherwise empty array if failed.
      • getVertexMap

        public int[][] getVertexMap​(int gridX,
                                    int gridY,
                                    boolean predictMovement)
        Get vertex locations stored in a 2D array (flat map) at the specified grid location.
        Parameters:
        gridX - the grid x you wish to get the model vertices of.
        gridY - the grid y you wish to get the model vertices of.
        predictMovement - if true it will do small adjustments to the position of the model
        Returns:
        the vertex position map at the specified grid location if successful, otherwise empty array if failed.
      • getTileHeight

        public int getTileHeight()
        Calculates the tile height for offset specified tile.
        Returns:
        the calculated tile height.
      • getHullBounds

        public java.awt.Shape getHullBounds()
        Gets hull bounds of this object with a default scale of 1.0F.
        Returns:
        the hull bounds of this object scaled at 1.0F if successful; otherwise empty shape if failed..
      • getHullBounds

        public java.awt.Shape getHullBounds​(float scale)
        Gets hull bounds of this object with a specified scale.
        Parameters:
        scale - the scale of hull you wish to preform during calculation.
        Returns:
        the hull bounds of this object scaled to the specified value if successful; otherwise empty shape if failed..
      • drawWireFrame

        public void drawWireFrame​(java.awt.Graphics graphics)
        Draws wire frame of this object.
        Parameters:
        graphics - the current graphics instance used to draw the object.
      • getGridX

        public int getGridX()
        Gets grid X of this model.
        Returns:
        the X grid coordinate of this model
      • setGridX

        public void setGridX​(int gridX)
        Sets grid X.
        Parameters:
        gridX - the grid X
      • getGridY

        public int getGridY()
        /** Gets grid Y of this model.
        Returns:
        the Y grid coordinate of this model
      • setGridY

        public void setGridY​(int gridY)
        Sets grid Y.
        Parameters:
        gridY - the grid Y
      • setGridLocation

        public void setGridLocation​(int gridX,
                                    int gridY)
        Sets grid location (x/y) of this model.
        Parameters:
        gridX - the Y grid coordinate of this model
        gridY - the Y grid coordinate of this model
      • getVerticesX

        public int[] getVerticesX()
        Get vertices x.
        Returns:
        the int [ ]
      • setVerticesX

        public void setVerticesX​(int[] verticesX)
        Sets vertices x.
        Parameters:
        verticesX - the vertices x
      • getOriginalX

        public int[] getOriginalX()
        Get original x.
        Returns:
        the int [ ]
      • setOriginalX

        public void setOriginalX​(int[] originalX)
        Sets original x.
        Parameters:
        originalX - the original x
      • getVerticesY

        public int[] getVerticesY()
        Get vertices y.
        Returns:
        the int [ ]
      • setVerticesY

        public void setVerticesY​(int[] verticesY)
        Sets vertices y.
        Parameters:
        verticesY - the vertices y
      • getOriginalY

        public int[] getOriginalY()
        Get original y.
        Returns:
        the int [ ]
      • setOriginalY

        public void setOriginalY​(int[] originalY)
        Sets original y.
        Parameters:
        originalY - the original y
      • getVerticesZ

        public int[] getVerticesZ()
        Get vertices z.
        Returns:
        the int [ ]
      • setVerticesZ

        public void setVerticesZ​(int[] verticesZ)
        Sets vertices z.
        Parameters:
        verticesZ - the vertices z
      • getOriginalZ

        public int[] getOriginalZ()
        Get original z.
        Returns:
        the int [ ]
      • setOriginalZ

        public void setOriginalZ​(int[] originalZ)
        Sets original z.
        Parameters:
        originalZ - the original z
      • getIndicesX

        public int[] getIndicesX()
        Get indices x.
        Returns:
        the int [ ]
      • setIndicesX

        public void setIndicesX​(int[] indicesX)
        Sets indices x.
        Parameters:
        indicesX - the indices x
      • getIndicesY

        public int[] getIndicesY()
        Get indices y.
        Returns:
        the int [ ]
      • setIndicesY

        public void setIndicesY​(int[] indicesY)
        Sets indices y.
        Parameters:
        indicesY - the indices y
      • getIndicesZ

        public int[] getIndicesZ()
        Get indices z.
        Returns:
        the int [ ]
      • setIndicesZ

        public void setIndicesZ​(int[] indicesZ)
        Sets indices z.
        Parameters:
        indicesZ - the indices z
      • getVertexCount

        public int getVertexCount()
        Get vertex count.
        Returns:
        the int
      • setVertexCount

        public void setVertexCount​(int verticesCount)
        Sets vertex count.
        Parameters:
        verticesCount - the vertices count
      • getIndicesCount

        public int getIndicesCount()
        Get indices count.
        Returns:
        the int
      • setIndicesCount

        public void setIndicesCount​(int indicesCount)
        Sets indices count.
        Parameters:
        indicesCount - the indices count
      • getVectorSkin

        public int[][] getVectorSkin()
        Get vector skin.
        Returns:
        the int[][]
      • setVectorSkin

        public void setVectorSkin​(int[][] vectorSkin)
        Sets vector skin.
        Parameters:
        vectorSkin - the vector skin
      • getEntity

        public Entity getEntity()
        Gets the entity object
        Returns:
        the entity
      • setEntity

        public void setEntity​(Entity e)
        Set entity object
        Parameters:
        e - the values
      • setEntity

        public void setEntity​(java.util.Optional<Entity> entity)
        Sets wrapped entity object.
        Parameters:
        entity - the wrapped entity to set.
      • getWrappedEntity

        public java.util.Optional<Entity> getWrappedEntity()
        Gets wrapped entity object..
        Returns:
        the set wrapped entity object.
      • exists

        public boolean exists()
        Use to determine if this model is exist and is valid.
        Returns:
        true if this model is exists and is valid, otherwise false.
      • update

        public Model update​(Model model)
        Update model.
        Parameters:
        model - the model
        Returns:
        the model