⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tileportrayal.java

📁 MASON代表多主体邻里或网络仿真(Multi-Agent Simulator of Neighborhoods or Networks)。它是乔治梅森大学用Java开发的离散事件多主体仿真核心库
💻 JAVA
字号:
package sim.portrayal3d.grid.quad;import sim.util.gui.*;import sim.portrayal3d.grid.*;/** * A QuadPortrayal which describes locations as the center of a square in a grid (like tiles on the floor, * each tile corresponding to a location on the grid).   */public class TilePortrayal extends QuadPortrayal    {    public float[] tmpCoords;    public float[] tmpColor;            public TilePortrayal(ColorMap colorDispenser)        {        this(colorDispenser,0);        }    public TilePortrayal(ColorMap colorDispenser, float zScale)        {        super(colorDispenser, zScale);        tmpCoords = new float[12];        tmpColor = new float[4];        }            public void setData(ValueGridCellInfo gridCell, float[] coordinates, float[] colors, int quadIndex,                        int gridWidth, int gridHeight)        {        int x = gridCell.x;        int y = gridCell.y;        float value = (float)gridCell.value();        colorDispenser.getColor(value).getComponents(tmpColor);        value*=zScale;                for(int i=0;i <4;i++)             System.arraycopy(tmpColor, 0, colors, (quadIndex*4+i)*3, 3);  // 3 color values -- alpha transparency doesn't work here :-(        int offset = quadIndex*12;         coordinates[offset+0] = x - 0.5f;        coordinates[offset+1] = y- 0.5f;        coordinates[offset+2] = value;        coordinates[offset+3] = x + 0.5f;        coordinates[offset+4] = y - 0.5f;        coordinates[offset+5] = value;        coordinates[offset+6] = x + 0.5f;        coordinates[offset+7] = y + 0.5f;        coordinates[offset+8] = value;        coordinates[offset+9] = x - 0.5f;        coordinates[offset+10]= y + 0.5f;        coordinates[offset+11]= value;        }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -