Examples of BinaryBufferedFile


Examples of com.bbn.openmap.io.BinaryBufferedFile

            // create one in memory.
            entries = SpatialIndex.MemoryIndex.create(shpFileName);
            return entries;
        }

        BinaryBufferedFile ssx = new BinaryBufferedFile(ssxFileName);

        ssx.byteOrder(false);
        ssx.seek(100); // skip the file header

        LatLonPoint llp = null;
        if (dataTransform != null) {
            llp = new LatLonPoint();
        }

        while (true) {
            int result = ssx.read(ixRecord, 0, SPATIAL_INDEX_RECORD_LENGTH);
            if (result <= 0) {
                break;// EOF
            } else {
                double xmin = readLEDouble(ixRecord, 8);
                double ymin = readLEDouble(ixRecord, 16);
                double xmax = readLEDouble(ixRecord, 24);
                double ymax = readLEDouble(ixRecord, 32);
                int byteOffset = readBEInt(ixRecord, 0) * 2;

                if (dataTransform != null) {
                    dataTransform.inverse(xmin, ymin, llp);
                    xmin = llp.getLongitude();
                    ymin = llp.getLatitude();
                    dataTransform.inverse(xmax, ymax, llp);
                    xmax = llp.getLongitude();
                    ymax = llp.getLatitude();
                }

                if (Debug.debugging("spatialindexdetail")) {
                    Debug.output("  " + xmin + ", " + ymin + "\n  " + xmax
                            + ", " + ymax);
                }

                Entry entry = new Entry(xmin, ymin, xmax, ymax, byteOffset);
                entries.add(entry);

                if (bounds != null) {
                    bounds.addPoint(xmin, ymin);
                    bounds.addPoint(xmax, ymax);
                }
            }
        }

        ssx.close();

        return entries;

    }
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

        if (shpFileName == null) {
            return;
        }

        BinaryBufferedFile ssx = new BinaryBufferedFile(ssx(shpFileName));
        ssx.seek(100); // skip the file header
        while (true) {
            int result = ssx.read(ixRecord, 0, SPATIAL_INDEX_RECORD_LENGTH);
            // if (result == -1) {
            if (result <= 0) {
                // Debug.output("Processed " + recNum + " records");
                break;// EOF
            } else {
                recNum++;
                int offset = readBEInt(ixRecord, 0);
                int length = readBEInt(ixRecord, 4);
                Debug.output("Record "
                        + recNum
                        + ": "
                        + offset
                        + ", "
                        + length
                        + (showBounds ? ("; " + readLEDouble(ixRecord, 8)
                                + ", " + readLEDouble(ixRecord, 16) + ", "
                                + readLEDouble(ixRecord, 24) + ", " + readLEDouble(ixRecord,
                                32))
                                : ""));
            }
        }
        ssx.close();
    }
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

        dataBuffer = null;

        try {

            // treat as buffered binary
            BinaryBufferedFile binFile = new BinaryBufferedFile(fileName);
            binFile.byteOrder(true);

            // set width/height
            bufferWidth = etopoWidths[resIdx];
            bufferHeight = etopoHeights[resIdx];

            int spacer = 1;

            // don't know why I have to do this, but there seems to be
            // a wrapping thing going on with different data sets.
            switch (minuteSpacing) {
            case (2):
                spacer = 1 + this.spacer;
                break;
            case (5):
                spacer = 0 + this.spacer;
                break;
            default:
                spacer = 1 + this.spacer;
            }

            // allocate storage
            dataBuffer = new short[(bufferWidth + spacer) * bufferHeight];

            // read data
            for (int i = 0; i < bufferWidth * bufferHeight; i++)
                dataBuffer[i] = binFile.readShort();

            // done
            binFile.close();

            // This is important for image creation.
            bufferWidth += spacer;

        } catch (FileNotFoundException e) {
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

     * @throws FormatException
     * @throws IOException
     */
    protected DbfHandler createDbfHandler(String dbfFileName)
            throws FormatException, IOException {
        BinaryBufferedFile bbf = new BinaryBufferedFile(dbfFileName);
        return new DbfHandler(bbf);
    }
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

        }

        File file = new File(args[0]);
        BinaryFile binFile = null;
        try {
            binFile = new BinaryBufferedFile(file);
        } catch (FileNotFoundException e) {
            Debug.error("RpfHeader: file " + args[0] + " not found");
            System.exit(1);
        } catch (IOException ioe) {
            Debug.error("RpfHeader: File IO Error while handling colortable:\n"
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

        String lowerCaseVersion = parentDir + "/" + LITTLE_RPF_TOC_FILE_NAME;

        try {

            if (BinaryFile.exists(upperCaseVersion)) {
                binFile = new BinaryBufferedFile(upperCaseVersion);
                aTocFilePath = upperCaseVersion;
            } else if (BinaryFile.exists(lowerCaseVersion)) {
                binFile = new BinaryBufferedFile(lowerCaseVersion);
                aTocFilePath = lowerCaseVersion;
            }

            if (binFile == null)
                return false;
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

     * not.
     */
    protected void loadFrameInformation(RpfTocEntry rpfTocEntry) {
        try {
            if (binFile == null && aTocFilePath != null) {
                binFile = new BinaryBufferedFile(aTocFilePath);
                binFile.byteOrder(aTocByteOrder);
                readFrameInformation(binFile, rpfTocEntry);
                binFile.close();
                binFile = null;
            }
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

                spatialIndex = SpatialIndex.locateAndSetShapeData(shapeFileName);
            String dbfFileName = SpatialIndex.dbf(shapeFileName);

            try {
                if (BinaryFile.exists(dbfFileName)) {
                    BinaryBufferedFile bbf = new BinaryBufferedFile(dbfFileName);
                    DbfHandler dbfh = new DbfHandler(bbf);
                    dbfh.setProperties(realPrefix, props);
                    spatialIndex.setDbf(dbfh);
            }
            } catch (FormatException fe) {
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

    // Debug.message("gc", "RpfFrame: getting GC'd");
    // }

    protected boolean initFile(String framePath) {
        try {
            BinaryFile binFile = new BinaryBufferedFile(framePath);
            read(binFile);
            binFile.close();
        } catch (FileNotFoundException e) {
            Debug.error("RpfFrame: file " + framePath + " not found");
            valid = false;
        } catch (IOException ioe) {
            Debug.error("RpfFrame: File IO Error while handling NITF header:\n"
View Full Code Here

Examples of com.bbn.openmap.io.BinaryBufferedFile

     * at loadtime.
     */
    public static Color[] getColors(String framePath, RpfColortable ct) {
        BinaryFile binFile = null;
        try {
            binFile = new BinaryBufferedFile(framePath);
            // binFile = new BinaryFile(framePath);
            RpfFileSections rfs = new RpfFileSections();
            RpfHeader head = new RpfHeader();

            head.read(binFile);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.