Пример #1
0
        private void parseFrameFileIndexAndPathnameTables(java.nio.ByteBuffer buffer)
        {
            int theSectionOffset = buffer.position();
            Hashtable <Integer, String> pathnames = new Hashtable <Integer, String>();

            for (int i = 0; i < this.numOfFrameFileIndexRecords; i++)
            {
                this.frameFileIndexTable.add(new RPFFrameFileIndexRecord(buffer));
            }

            for (int i = 0; i < this.numOfPathnameRecords; i++)
            {
                int relOffset = buffer.position() - theSectionOffset;
                int len       = NITFSUtil.getUShort(buffer);
                pathnames.put(relOffset, NITFSUtil.getString(buffer, len));
            }

            if (0 < this.frameFileIndexTable.size() && 0 < pathnames.size())
            { // update pathname field in every RPFFrameFileIndexRecord
                foreach (RPFFrameFileIndexRecord rec in this.frameFileIndexTable)
                {
                    int offset = (int)rec.getPathnameRecordOffset();
                    if (pathnames.containsKey(offset))
                    {
                        rec.setPathname(pathnames.get(offset));
                    }
                    else
                    {
                        throw new NITFSRuntimeException("NITFSReader.CorrespondingPathnameWasNotFound");
                    }
                }
            }
        }
Пример #2
0
 private void parseRPFColorOffsetRecord(java.nio.ByteBuffer buffer)
 {
     this.tableID               = NITFSUtil.getUShort(buffer);
     this.numOfColorRecords     = NITFSUtil.getUInt(buffer);
     this.colorElementLength    = NITFSUtil.getByteAsShort(buffer);
     this.histogramRecordLength = NITFSUtil.getUShort(buffer);
     this.colorTableOffset      = NITFSUtil.getUInt(buffer);
     this.histogramTableOffset  = NITFSUtil.getUInt(buffer);
 }
Пример #3
0
        public RPFBoundingRectangleSection(ByteBuffer buffer)
        {
            // [ bounding rectangle section subheader ]
            this.tableOffset     = NITFSUtil.getUInt(buffer);
            this.numberOfRecords = NITFSUtil.getUShort(buffer);
            this.recordLength    = NITFSUtil.getUShort(buffer);

            parseBoundsRecords(buffer);
        }
Пример #4
0
//    public ArrayList<String> getPathnameTable()
//    {
//        return pathnameTable;
//    }

        public RPFFrameFileIndexSection(java.nio.ByteBuffer buffer)
        {
            // [ frame file index section subheader ]
            this.highestSecurityClassification = NITFSUtil.getString(buffer, 1);
            this.frameFileIndexTableOffset     = NITFSUtil.getUInt(buffer);
            this.numOfFrameFileIndexRecords    = NITFSUtil.getUInt(buffer);
            this.numOfPathnameRecords          = NITFSUtil.getUShort(buffer);
            this.frameFileIndexRecordLength    = NITFSUtil.getUShort(buffer);

            this.parseFrameFileIndexAndPathnameTables(buffer);
        }
Пример #5
0
            private String pathname; // this field is not part of the NITFS spec

            public RPFFrameFileIndexRecord(java.nio.ByteBuffer buffer)
            {
                this.boundaryRectangleRecordNumber = NITFSUtil.getUShort(buffer);
                this.frameLocationRowNumber        = NITFSUtil.getUShort(buffer);
                this.frameLocationColumnNumber     = NITFSUtil.getUShort(buffer);
                this.pathnameRecordOffset          = NITFSUtil.getUInt(buffer);
                this.frameFileName       = NITFSUtil.getString(buffer, 12);
                this.geoLocation         = NITFSUtil.getString(buffer, 6);
                this.securityClass       = NITFSUtil.getString(buffer, 1);
                this.securityCountryCode = NITFSUtil.getString(buffer, 2);
                this.securityReleaseMark = NITFSUtil.getString(buffer, 2);
                this.pathname            = "";
            }
Пример #6
0
 private void parseImageDescriptionSubheader(java.nio.ByteBuffer buffer)
 {
     this.numOfSpectralGroups                 = NITFSUtil.getUShort(buffer);
     this.numOfSubframeTables                 = NITFSUtil.getUShort(buffer);
     this.numOfSpectralBandTables             = NITFSUtil.getUShort(buffer);
     this.numOfSpectralBandLinesPerImageRow   = NITFSUtil.getUShort(buffer);
     this.numOfSubframesInEastWestDirection   = NITFSUtil.getUShort(buffer);
     this.numOfSubframesInNorthSouthDirection = NITFSUtil.getUShort(buffer);
     this.numOfOutputColumnsPerSubframe       = NITFSUtil.getUInt(buffer);
     this.numOfOutputRowsPerSubframe          = NITFSUtil.getUInt(buffer);
     this.subframeMaskTableOffset             = NITFSUtil.getUInt(buffer);
     this.transparencyMaskTableOffset         = NITFSUtil.getUInt(buffer);
 }
Пример #7
0
        private void parseColormapSubSection(java.nio.ByteBuffer buffer)
        {
            buffer.position(this.componentLocationTable.getColormapSubsectionLocation());

            this.colormapOffsetTableOffset           = NITFSUtil.getUInt(buffer);
            this.colormapGrayscaleOffsetRecordLength = NITFSUtil.getUShort(buffer);
            // read color / grayscale AND histogram records; builds a ColorMap (LUT)
            if (0 < this.numOfColorGrayscaleOffsetRecords)
            {
                rpfColorMaps = new RPFColorMap[this.numOfColorGrayscaleOffsetRecords];
                for (int i = 0; i < this.numOfColorGrayscaleOffsetRecords; i++)
                {
                    rpfColorMaps[i] = new RPFColorMap(buffer, this.componentLocationTable.getColormapSubsectionLocation());
                }
            }
            else
            {
                throw new NITFSRuntimeException("NITFSReader.InvalidNumberOfRPFColorGrayscaleRecords");
            }
        }
Пример #8
0
        public RPFLocationSection(java.nio.ByteBuffer buffer)
        {
            this.locationSectionLength         = NITFSUtil.getUShort(buffer);
            this.componentLocationTableOffset  = NITFSUtil.getUInt(buffer);
            this.numOfComponentLocationRecords = NITFSUtil.getUShort(buffer);
            this.componentLocationRecordLength = NITFSUtil.getUShort(buffer);
            this.componentAggregateLength      = NITFSUtil.getUInt(buffer);

            if (this.numOfComponentLocationRecords < 2)
            {
                throw new NITFSRuntimeException("NITFSReader:InvalidNumberOfComponentLocationRecords");
            }

            for (int i = 0; i < this.numOfComponentLocationRecords; i++)
            {
                int id = NITFSUtil.getUShort(buffer);
                table.put(id, new ComponentLocationRecord(id,
                                                          NITFSUtil.getUInt(buffer), // read uint:4 as "length"
                                                          NITFSUtil.getUInt(buffer)  // read uint:4 as "location"
                                                          ));
            }
        }
Пример #9
0
 public RelatedImagesSection(java.nio.ByteBuffer buffer)
 {
     this.relatedImageDescriptionTableOffset  = NITFSUtil.getUInt(buffer);
     this.numOfRelatedImageDescriptionRecords = NITFSUtil.getUShort(buffer);
     this.relatedImageDescriptionRecordLength = NITFSUtil.getUShort(buffer);
 }