示例#1
0
        public Sector computeFrameCoverage(int frameNumber)
        {
            int maxFrameNumber = maxFrameNumber(this.frameStructure.getLatitudinalFrames(),
                                                this.frameStructure.getLongitudinalFrames());

            if (frameNumber < 0 || frameNumber > maxFrameNumber)
            {
                String message = Logging.getMessage("generic.ArgumentOutOfRange", frameNumber);
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            int row = frameRow(frameNumber, this.frameStructure.getLongitudinalFrames());
            int col = frameColumn(frameNumber, row, this.frameStructure.getLongitudinalFrames());

            double zoneLat = RPFZone.isZoneInUpperHemisphere(this.zoneCode) ?
                             this.frameStructure.getEquatorwardExtent() : this.frameStructure.getPolewardExtent();
            double n = frameOriginLatitude(row, this.frameStructure.getNorthSouthPixelConstant(),
                                           this.frameStructure.getPixelRowsPerFrame(), zoneLat);
            double s = n - frameDeltaLatitude(this.frameStructure.getNorthSouthPixelConstant(),
                                              this.frameStructure.getPixelRowsPerFrame());

            double w = frameOriginLongitude(col, this.frameStructure.getEastWestPixelConstant(),
                                            this.frameStructure.getPixelRowsPerFrame());
            double e = w + frameDeltaLongitude(this.frameStructure.getEastWestPixelConstant(),
                                               this.frameStructure.getPixelRowsPerFrame());

            //e = normalizedDegreesLongitude(e);

            return(Sector.fromDegrees(s, n, w, e));
        }
示例#2
0
        static RPFPolarFrameTransform createPolarFrameTransform(char zoneCode, String rpfDataType, double resolution)
        {
            if (!RPFZone.isZoneCode(zoneCode))
            {
                String message = Logging.getMessage("RPFZone.UnknownZoneCode", zoneCode);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }
            if (rpfDataType == null || !RPFDataSeries.isRPFDataType(rpfDataType))
            {
                String message = Logging.getMessage("RPFDataSeries.UnkownDataType", rpfDataType);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }
            if (resolution < 0)
            {
                String message = Logging.getMessage("generic.ArgumentOutOfRange", rpfDataType);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }

            RPFPolarFrameStructure frameStructure = RPFPolarFrameStructure.computeStructure(
                zoneCode, rpfDataType, resolution);

            return(new RPFPolarFrameTransform(zoneCode, rpfDataType, resolution, frameStructure));
        }
        public static RPFNonpolarFrameStructure computeStructure(char zoneCode, String rpfDataType, double resolution)
        {
            if (!RPFZone.isZoneCode(zoneCode))
            {
                String message = Logging.getMessage("RPFZone.UnknownZoneCode", zoneCode);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }
            if (rpfDataType == null || !RPFDataSeries.isRPFDataType(rpfDataType))
            {
                String message = Logging.getMessage("RPFDataSeries.UnkownDataType", rpfDataType);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }
            if (resolution < 0)
            {
                String message = Logging.getMessage("generic.ArgumentOutOfRange", rpfDataType);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }

            // Constant zone properties.

            int ewPixelSpacingConst     = eastWestPixelSpacingConstant(zoneCode);
            int nsPixelSpacingConst     = northSouthPixelSpacingConstant();
            int equatorwardNominalBound = equatorwardNominalBoundary(zoneCode);
            int polewardNominalBound    = polewardNominalBoundary(zoneCode);

            // Scale/GSD specific zone properties.

            int nsPixelConst, ewPixelConst;

            if (RPFDataSeries.isCADRGDataType(rpfDataType))
            {
                nsPixelConst = northSouthPixelConstant_CADRG(nsPixelSpacingConst, resolution);
                ewPixelConst = eastWestPixelConstant_CADRG(ewPixelSpacingConst, resolution);
            }
            else if (RPFDataSeries.isCIBDataType(rpfDataType))
            {
                nsPixelConst = northSouthPixelConstant_CIB(nsPixelSpacingConst, resolution);
                ewPixelConst = eastWestPixelConstant_CIB(ewPixelSpacingConst, resolution);
            }
            else
            {
                nsPixelConst = -1;
                ewPixelConst = -1;
            }

            double polewardExtent    = polewardExtent(polewardNominalBound, nsPixelConst, PIXEL_ROWS_PER_FRAME);
            double equatorwardExtent = equatorwardExtent(equatorwardNominalBound, nsPixelConst, PIXEL_ROWS_PER_FRAME);

            int latFrames = latitudinalFrames(polewardExtent, equatorwardExtent, nsPixelConst, PIXEL_ROWS_PER_FRAME);
            int lonFrames = longitudinalFrames(ewPixelConst, PIXEL_ROWS_PER_FRAME);

            return(new RPFNonpolarFrameStructure(
                       nsPixelConst, ewPixelConst,
                       polewardExtent, equatorwardExtent,
                       latFrames, lonFrames));
        }
        static int eastWestPixelSpacingConstant(char zoneCode)
        {
            int index = RPFZone.indexFor(zoneCode) % 9;

            if (index < 0)
            {
                return(-1);
            }

            return(EAST_WEST_PIXEL_SPACING_CONSTANT[index]);
        }
        private static RPFFrameTransform newFrameTransform(char zoneCode, String rpfDataType, double resolution)
        {
            bool isNonpolarZone = !RPFZone.isPolarZone(zoneCode);

            if (isNonpolarZone)
            {
                return(RPFNonpolarFrameTransform.createNonpolarFrameTransform(zoneCode, rpfDataType, resolution));
            }
            else
            {
                return(RPFPolarFrameTransform.createPolarFrameTransform(zoneCode, rpfDataType, resolution));
            }
        }
        public static RPFPolarFrameStructure computeStructure(char zoneCode, String rpfDataType, double resolution)
        {
            if (!RPFZone.isZoneCode(zoneCode))
            {
                String message = Logging.getMessage("RPFZone.UnknownZoneCode", zoneCode);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }
            if (rpfDataType == null || !RPFDataSeries.isRPFDataType(rpfDataType))
            {
                String message = Logging.getMessage("RPFDataSeries.UnkownDataType", rpfDataType);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }
            if (resolution < 0)
            {
                String message = Logging.getMessage("generic.ArgumentOutOfRange", rpfDataType);
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }

            int nsPixelSpacingConst = northSouthPixelSpacingConstant();

            int polarPixelConst, polarFrames;

            if (RPFDataSeries.isCADRGDataType(rpfDataType))
            {
                polarPixelConst = polarPixelConstant_CADRG(nsPixelSpacingConst, resolution);
                polarFrames     = polarFrames_CADRG(polarPixelConst);
            }
            else if (RPFDataSeries.isCIBDataType(rpfDataType))
            {
                int nsPixelConst = northSouthPixelConstant_CIB(nsPixelSpacingConst, resolution);
                polarPixelConst = polarPixelConstant_CIB(nsPixelConst);
                polarFrames     = polarFrames_CIB(polarPixelConst);
            }
            else
            {
                polarPixelConst = -1;
                polarFrames     = -1;
            }

            double polewardExtent    = polewardExtent(polewardNominalBoundary(zoneCode));
            double equatorwardExtent = equatorwardExtent(equatorwardNominalBoundary(zoneCode));


            return(new RPFPolarFrameStructure(
                       polarPixelConst,
                       polewardExtent, equatorwardExtent,
                       polarFrames));
        }
        private static int nominalBoundary(char zoneCode, int[] boundaryArray)
        {
            int index = RPFZone.indexFor(zoneCode) % 9;

            if (index < 0)
            {
                return(-1);
            }

            if (!RPFZone.isZoneInUpperHemisphere(zoneCode))
            {
                return(0 - boundaryArray[index]);
            }
            return(boundaryArray[index]);
        }
示例#8
0
        public static bool isFilename(String str)
        {
            if (str == null)
            {
                String message = Logging.getMessage("nullValue.StringIsNull");
                Logging.logger().fine(message);
                throw new ArgumentException(message);
            }

            if (str.length() != FILENAME_LENGTH)
            {
                return(false);
            }

            char[] buffer = new char[FILENAME_LENGTH];
            str.getChars(0, 12, buffer, 0);

            if (!Base34Converter.isBase34(buffer, 0, 7))
            {
                return(false);
            }
            if (!RPFProducer.isProducerId(buffer[7]))
            {
                return(false);
            }
            if ('.' != buffer[8])
            {
                return(false);
            }
            String seriesCode = str.substring(9, 11);

            if (!RPFDataSeries.isDataSeriesCode(seriesCode))
            {
                return(false);
            }
            //noinspection RedundantIfStatement
            if (!RPFZone.isZoneCode(buffer[11]))
            {
                return(false);
            }

            return(true);
        }
示例#9
0
        public LatLon computeFrameOrigin(int frameNumber)
        {
            if (frameNumber < 0 || frameNumber > getMaximumFrameNumber())
            {
                String message = Logging.getMessage("generic.ArgumentOutOfRange", frameNumber);
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            int row = frameRow(frameNumber, this.frameStructure.getLongitudinalFrames());
            int col = frameColumn(frameNumber, row, this.frameStructure.getLongitudinalFrames());

            double zoneLat = RPFZone.isZoneInUpperHemisphere(this.zoneCode) ?
                             this.frameStructure.getEquatorwardExtent() : this.frameStructure.getPolewardExtent();
            double n = frameOriginLatitude(row, this.frameStructure.getNorthSouthPixelConstant(),
                                           this.frameStructure.getPixelRowsPerFrame(), zoneLat);
            double w = frameOriginLongitude(col, this.frameStructure.getEastWestPixelConstant(),
                                            this.frameStructure.getPixelRowsPerFrame());

            return(LatLon.fromDegrees(n, w));
        }