All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.gov.nasa.worldwind.formats.rpf.RPFBoundingRectangleSection Maven / Gradle / Ivy

Go to download

World Wind is a collection of components that interactively display 3D geographic information within Java applications or applets.

There is a newer version: 2.0.0-986
Show newest version
/*
 * Copyright (C) 2012 United States Government as represented by the Administrator of the
 * National Aeronautics and Space Administration.
 * All Rights Reserved.
 */
package gov.nasa.worldwind.formats.rpf;

import gov.nasa.worldwind.formats.nitfs.NITFSUtil;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

/**
 * @author brownrigg
 * @version $Id: RPFBoundingRectangleSection.java 1171 2013-02-11 21:45:02Z dcollins $
 */

public class RPFBoundingRectangleSection {

    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);
    }

    public List getBoundingRecords() {
        return bndRectRecords;
    }

    private void parseBoundsRecords(ByteBuffer buffer) {
        for (int i=0; i this.lrLon) ? this.urLon : this.lrLon;
        }

        public double getMaxLat() {
            return (this.ulLat > this.urLat) ? this.ulLat : this.urLat;
        }

        public RPFBoundingRectangleRecord(ByteBuffer buffer) {
            this.dataType = NITFSUtil.getString(buffer, 5);
            this.compressionRatio = NITFSUtil.getString(buffer, 5);
            this.scale = NITFSUtil.getString(buffer, 12);
            this.zone = NITFSUtil.getString(buffer, 1);
            this.producer = NITFSUtil.getString(buffer, 5);
            this.ulLat = buffer.getDouble();
            this.ulLon = buffer.getDouble();
            this.llLat = buffer.getDouble();
            this.llLon = buffer.getDouble();
            this.urLat = buffer.getDouble();
            this.urLon = buffer.getDouble();
            this.lrLat = buffer.getDouble();
            this.lrLon = buffer.getDouble();
            this.nsRes = buffer.getDouble();
            this.ewRes = buffer.getDouble();
            this.latInterval = buffer.getDouble();
            this.lonInterval = buffer.getDouble();
            this.numFramesNS = NITFSUtil.getUInt(buffer);
            this.numFramesEW = NITFSUtil.getUInt(buffer);
        }

        private String dataType;
        private String compressionRatio;
        private String scale;
        private String zone;
        private String producer;
        private double ulLat;
        private double ulLon;
        private double llLat;
        private double llLon;
        private double urLat;
        private double urLon;
        private double lrLat;
        private double lrLon;
        private double nsRes;
        private double ewRes;
        private double latInterval;
        private double lonInterval;
        private long   numFramesNS;
        private long   numFramesEW;
    }

    private long tableOffset;
    private int numberOfRecords;
    private int recordLength;
    private ArrayList bndRectRecords =
            new ArrayList();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy