Beispiel #1
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));
        }
        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));
        }
Beispiel #4
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);
        }