CSJ2K.j2k.ModuleSpec.rotate90 C# (CSharp) Method

rotate90() public method

Rotate the ModuleSpec instance by 90 degrees (this modifies only tile and tile-component specifications).
public rotate90 ( Coord anT ) : void
anT Coord
return void
        public virtual void rotate90(Coord anT)
        {
            // Rotate specValType
            byte[][] tmpsvt = new byte[nTiles][];
            int ax, ay;
            Coord bnT = new Coord(anT.y, anT.x);
            for (int by = 0; by < bnT.y; by++)
            {
                for (int bx = 0; bx < bnT.x; bx++)
                {
                    ay = bx;
                    ax = bnT.y - by - 1;
                    tmpsvt[ay * anT.x + ax] = specValType[by * bnT.x + bx];
                }
            }
            specValType = tmpsvt;

            // Rotate tileDef
            if (tileDef != null)
            {
                System.Object[] tmptd = new System.Object[nTiles];
                for (int by = 0; by < bnT.y; by++)
                {
                    for (int bx = 0; bx < bnT.x; bx++)
                    {
                        ay = bx;
                        ax = bnT.y - by - 1;
                        tmptd[ay * anT.x + ax] = tileDef[by * bnT.x + bx];
                    }
                }
                tileDef = tmptd;
            }

            // Rotate tileCompVal
            if (tileCompVal != null && tileCompVal.Count > 0)
            {
                System.Collections.Generic.Dictionary<System.String, System.Object> tmptcv = new Dictionary<string, object>();
                System.String tmpKey;
                System.Object tmpVal;
                int btIdx, atIdx;
                int i1, i2;
                int bx, by;
                //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
                for (System.Collections.IEnumerator e = tileCompVal.Keys.GetEnumerator(); e.MoveNext(); )
                {
                    //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
                    tmpKey = ((System.String) e.Current);
                    tmpVal = tileCompVal[tmpKey];
                    i1 = tmpKey.IndexOf('t');
                    i2 = tmpKey.IndexOf('c');
                    btIdx = (System.Int32.Parse(tmpKey.Substring(i1 + 1, (i2) - (i1 + 1))));
                    bx = btIdx % bnT.x;
                    by = btIdx / bnT.x;
                    ay = bx;
                    ax = bnT.y - by - 1;
                    atIdx = ax + ay * anT.x;
                    tmptcv["t" + atIdx + tmpKey.Substring(i2)] = tmpVal;
                }
                tileCompVal = tmptcv;
            }
        }