Exemple #1
0
        /// <summary> Changes the current tile, given the new indexes. An
        /// IllegalArgumentException is thrown if the indexes do not
        /// correspond to a valid tile.
        ///
        /// <P>This default implementation changes the tile in the source
        /// and re-initializes properly component transformation variables..
        ///
        /// </summary>
        /// <param name="x">The horizontal index of the tile.
        ///
        /// </param>
        /// <param name="y">The vertical index of the new tile.
        ///
        ///
        /// </param>
        public override void  setTile(int x, int y)
        {
            src.setTile(x, y);
            tIdx = TileIdx;             // index of the current tile

            // initializations
            if (((System.Int32)cts.getTileDef(tIdx)) == NONE)
            {
                transfType = NONE;
            }
            else
            {
                int nc  = src.NumComps > 3?3:src.NumComps;
                int rev = 0;
                for (int c = 0; c < nc; c++)
                {
                    rev += (wfs.isReversible(tIdx, c)?1:0);
                }
                if (rev == 3)
                {
                    // All WT are reversible
                    transfType = INV_RCT;
                }
                else if (rev == 0)
                {
                    // All WT irreversible
                    transfType = INV_ICT;
                }
                else
                {
                    // Error
                    throw new System.ArgumentException("Wavelet transformation and " + "component transformation" + " not coherent in tile" + tIdx);
                }
            }
        }
        /// <summary> Changes the current tile, given the new indexes. An
        /// IllegalArgumentException is thrown if the indexes do not
        /// correspond to a valid tile.
        ///
        /// <P>This default implementation changes the tile in the source
        /// and re-initializes properly component transformation variables..
        ///
        /// </summary>
        /// <param name="x">The horizontal index of the tile.
        ///
        /// </param>
        /// <param name="y">The vertical index of the new tile.
        ///
        /// </param>
        public override void  setTile(int x, int y)
        {
            src.setTile(x, y);
            tIdx = TileIdx;             // index of the current tile

            // initializations
            int cttype = 0;

            if (((System.Int32)cts.getTileDef(tIdx)) == InvCompTransf.NONE)
            {
                cttype = InvCompTransf.NONE;
            }
            else
            {
                int nc  = src.NumComps > 3?3:src.NumComps;
                int rev = 0;
                for (int c = 0; c < nc; c++)
                {
                    rev += (wfs.isReversible(tIdx, c)?1:0);
                }
                if (rev == 3)
                {
                    // All WT are reversible
                    cttype = InvCompTransf.INV_RCT;
                }
                else if (rev == 0)
                {
                    // All WT irreversible
                    cttype = InvCompTransf.INV_ICT;
                }
                else
                {
                    // Error
                    throw new System.ArgumentException("Wavelet transformation " + "and " + "component transformation" + " not coherent in tile" + tIdx);
                }
            }

            switch (cttype)
            {
            case InvCompTransf.NONE:
                rb = utrb;
                break;

            case InvCompTransf.INV_RCT:
                rb = InvCompTransf.calcMixedBitDepths(utrb, InvCompTransf.INV_RCT, null);
                break;

            case InvCompTransf.INV_ICT:
                rb = InvCompTransf.calcMixedBitDepths(utrb, InvCompTransf.INV_ICT, null);
                break;

            default:
                throw new System.ArgumentException("Non JPEG 2000 part I " + "component" + " transformation for tile: " + tIdx);
            }
        }