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)); }
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); }
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 })); }
//**************************************************************// //******************** 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); }
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); }
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)); }
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)); } }
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; }
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); }