Exemplo n.º 1
0
        protected VPFFeature createCompoundSimpleFeature(VPFFeatureClass featureClass, VPFRecord featureRow,
                                                         VPFBufferedRecordData joinTable, Iterable <String> attributeKeys)
        {
            // Feature has a direct 1:* relation to the primitive table through a join table.

            // Query the number of primitives which match the feature.
            Object o = this.getPrimitiveIds(featureClass, featureRow, joinTable, null, true);

            if (o == null || !(o is Integer))
            {
                return(null);
            }

            int numPrimitives = (Integer)o;

            if (numPrimitives < 1)
            {
                return(null);
            }

            // Gather the actual primitive ids matching the feature.
            int[]          primitiveIds = new int[numPrimitives];
            VPFBoundingBox bounds       = (VPFBoundingBox)this.getPrimitiveIds(featureClass, featureRow, joinTable, primitiveIds,
                                                                               false);

            return(this.createFeature(featureClass, featureRow, attributeKeys, bounds, primitiveIds));
        }
Exemplo n.º 2
0
        public static VPFFeatureClass[] readFeatureClasses(VPFCoverage coverage, FileFilter featureTableFilter)
        {
            if (coverage == null)
            {
                String message = Logging.getMessage("nullValue.CoverageIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (featureTableFilter == null)
            {
                String message = Logging.getMessage("nullValue.FilterIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            VPFFeatureClassSchema[] schemas = coverage.getFeatureClasses(featureTableFilter);
            VPFFeatureClass[]       cls     = new VPFFeatureClass[schemas.length];

            VPFFeatureClassFactory factory = new VPFBasicFeatureClassFactory();

            for (int i = 0; i < schemas.length; i++)
            {
                cls[i] = factory.createFromSchema(coverage, schemas[i]);
            }

            return(cls);
        }
Exemplo n.º 3
0
        protected VPFFeature createSimpleFeature(VPFFeatureClass featureClass, VPFRecord featureRow,
                                                 Iterable <String> attributeKeys)
        {
            // Feature has a direct 1:1 relation to the primitive table.

            if (this.tile != null && !matchesTile(featureRow, this.tile))
            {
                return(null);
            }

            VPFRelation featureToPrimitive = this.getFeatureToPrimitiveRelation(featureClass);

            if (featureToPrimitive == null)
            {
                return(null);
            }

            int primitiveId = asInt(featureRow.getValue(featureToPrimitive.getTable1Key()));

            VPFPrimitiveData.PrimitiveInfo primitiveInfo = this.primitiveData.getPrimitiveInfo(
                featureToPrimitive.getTable2(), primitiveId);

            return(this.createFeature(featureClass, featureRow, attributeKeys, primitiveInfo.getBounds(),
                                      new int[] { primitiveId }));
        }
Exemplo n.º 4
0
        //**************************************************************//
        //********************  Simple Feature Assembly  ***************//
        //**************************************************************//

        protected Collection <? extends VPFFeature> doCreateSimpleFeatures(VPFFeatureClass featureClass)
        {
            if (this.primitiveData == null)
            {
                String message = Logging.getMessage("VPF.NoPrimitiveData");
                Logging.logger().severe(message);
                throw new IllegalStateException(message);
            }

            ArrayList <VPFFeature> results = new ArrayList <VPFFeature>();

            VPFBufferedRecordData featureTable = this.createFeatureTable(featureClass);

            if (featureTable == null)
            {
                return(null);
            }

            VPFBufferedRecordData joinTable     = this.createJoinTable(featureClass);
            Iterable <String>     attributeKeys = this.getFeatureAttributeKeys(featureTable);

            foreach (VPFRecord featureRow in featureTable)
            {
                VPFFeature feature = this.doCreateSimpleFeature(featureClass, featureRow, joinTable, attributeKeys);
                if (feature != null)
                {
                    results.add(feature);
                }
            }

            return(results);
        }
Exemplo n.º 5
0
        protected VPFFeature createFeature(VPFFeatureClass featureClass, VPFRecord featureRow,
                                           Iterable <String> attributeKeys,
                                           VPFBoundingBox bounds, int[] primitiveIds)
        {
            VPFFeature feature = new VPFFeature(featureClass, featureRow.getId(), bounds, primitiveIds);

            this.setFeatureAttributes(featureRow, attributeKeys, feature);

            return(feature);
        }
Exemplo n.º 6
0
        public Collection <? extends VPFFeature> createComplexFeatures(VPFFeatureClass featureClass)
        {
            if (featureClass == null)
            {
                String message = Logging.getMessage("nullValue.FeatureClassIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            return(this.doCreateComplexFeatures(featureClass));
        }
Exemplo n.º 7
0
 protected VPFFeature doCreateSimpleFeature(VPFFeatureClass featureClass, VPFRecord featureRow,
                                            VPFBufferedRecordData joinTable, Iterable <String> attributeKeys)
 {
     if (joinTable != null)
     {
         return(this.createCompoundSimpleFeature(featureClass, featureRow, joinTable, attributeKeys));
     }
     else
     {
         return(this.createSimpleFeature(featureClass, featureRow, attributeKeys));
     }
 }
Exemplo n.º 8
0
        public VPFFeature(VPFFeatureClass featureClass, int id, VPFBoundingBox bounds, int[] primitiveIds)
        {
            if (featureClass == null)
            {
                String message = Logging.getMessage("nullValue.FeatureClassIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            if (bounds == null)
            {
                String message = Logging.getMessage("nullValue.BoundingBoxIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            this.featureClass = featureClass;
            this.id           = id;
            this.bounds       = bounds;
            this.primitiveIds = primitiveIds;
        }
Exemplo n.º 9
0
        public override bool Equals(Object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }

            VPFFeatureClass that = (VPFFeatureClass)o;

            if (this.coverage != null ? !this.coverage.getFilePath().Equals(that.coverage.getFilePath())
            : that.coverage != null)
            {
                return(false);
            }
            if (this.schema != null ? !this.schema.Equals(that.schema) : that.schema != null)
            {
                return(false);
            }
            if (!Arrays.Equals(this.relations, that.relations))
            {
                return(false);
            }
            if (this.joinTableName != null ? !this.joinTableName.Equals(that.joinTableName) : that.joinTableName != null)
            {
                return(false);
            }
            //noinspection RedundantIfStatement
            if (this.primitiveTableName != null ? !this.primitiveTableName.Equals(that.primitiveTableName)
            : that.primitiveTableName != null)
            {
                return(false);
            }

            return(true);
        }