Exemplo n.º 1
0
        private TilePartComponent[] DecodePackets(TilePartHeader tilePartHeader)
        {
            var tile = Image.Tiles[tilePartHeader.SOT.I_TileIndexNumber];

            var tilePart = new TilePart(tile, tilePartHeader);

            var tilePartComponents = new TilePartComponent[Image.Components.Length];

            for (var iComponent = 0; iComponent < Image.Components.Length; iComponent++)
            {
                var tileComponent = tile.TileComponents[iComponent];
                tilePartComponents[iComponent] = new TilePartComponent(tilePart, tileComponent);
            }

            var progressionOrder = tilePartHeader.COD.SG_ProgressionOrder;

            if (progressionOrder == ProgressionOrder.LayerResolutionComponentPosition)
            {
                DecodePacketsInLayerResolutionComponentPositionOrder(tilePartHeader, tilePartComponents);
            }
            else
            {
                throw NotSupported(progressionOrder);
            }

            return(tilePartComponents);
        }
Exemplo n.º 2
0
        private void DecodePacketsInLayerResolutionComponentPositionOrder(TilePartHeader tilePartHeader, TilePartComponent[] tilePartComponents)
        {
            var nLayers = tilePartHeader.COD.SG_NumberOfLayers;

            ThrowIf(nLayers != 1);

            var maxNDecompositionLevels = tilePartHeader.COC.Max(coc => coc.SP_NumberOfDecompositionLevels);

            for (var iLayer = 0; iLayer < nLayers; iLayer++)
            {
                for (var iResolution = 0; iResolution <= maxNDecompositionLevels; iResolution++)
                {
                    foreach (var tilePartComponent in tilePartComponents)
                    {
                        var resolutionLevel = tilePartComponent.ResolutionLevels[iResolution];
                        resolutionLevel.GetNPrecincts(out int nPrecinctsX, out int nPrecinctsY);
                        ThrowIf(nPrecinctsX != 1);
                        ThrowIf(nPrecinctsY != 1);
                        DecodePacket(iLayer, resolutionLevel);
                    }
                }
            }
        }