/**
         * Returns true if the specified file is a Feature Table.
         *
         * @param file the file in question.
         *
         * @return true if the file should be accepted; false otherwise.
         *
         * @throws ArgumentException if the file is null.
         */
        public bool accept(java.io.File file)
        {
            if (file == null)
            {
                String msg = Logging.getMessage("nullValue.FileIsNull");
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

            return(VPFUtils.getFeatureTypeName(file.getName()) != null);
        }
Example #2
0
        public VPFFeatureClassSchema[] getFeatureClasses(FileFilter featureTableFilter)
        {
            if (featureTableFilter == null)
            {
                String message = Logging.getMessage("nullValue.FilterIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            // List the file names in the coverage directory matching the specified feature table file filter.
            String[] names = WWIO.listChildFilenames(new File(this.getFilePath()), featureTableFilter);
            if (names == null)
            {
                return(null);
            }

            int numFeatures = names.length;

            VPFFeatureClassSchema[] desc = new VPFFeatureClassSchema[numFeatures];

            for (int i = 0; i < numFeatures; i++)
            {
                String featureTableName = names[i];
                String className        = WWIO.replaceSuffix(featureTableName, "");
                String type             = null;

                // If the Feature Class Attriute Table is available, then use it to determine the feature type for the
                // specified class.
                if (this.featureClassAttributeTable != null)
                {
                    VPFRecord record = this.featureClassAttributeTable.getRecord("fclass", className);
                    if (record != null)
                    {
                        type = (String)record.getValue("type");
                    }
                }

                // Otherwise, determine the feature type is based on the feature table extension.
                if (type == null)
                {
                    type = VPFUtils.getFeatureTypeName(featureTableName);
                }

                desc[i] = new VPFFeatureClassSchema(className, VPFFeatureType.fromTypeName(type), featureTableName);
            }

            return(desc);
        }