Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.FeatureBuilder


            } else {
                newValues.add(Optional.absent());
            }
        }
        RevFeature newFeature = RevFeatureImpl.build(ImmutableList.copyOf(newValues));
        FeatureBuilder featureBuilder = new FeatureBuilder(featureType);
        Feature feature = featureBuilder.build(node.name(), newFeature);
        return feature;
    }
View Full Code Here


                                .setObjectId(newObject.getMetadataId()).call(RevFeatureType.class)
                                .get();
                        featureTypes.put(newObject.getMetadataId(), featureType);
                    }

                    FeatureBuilder featureBuilder = new FeatureBuilder(featureType);
                    Feature feature = featureBuilder.build(diffEntry.newObjectId().toString(),
                            (RevFeature) revObject);
                    String name = diffEntry.newPath();
                    patch.addAddedFeature(name, feature, featureType);
                } else if (revObject instanceof RevTree) {
                    ObjectId metadataId = diffEntry.getNewObject().getMetadataId();
                    if (!metadataId.isNull()) {
                        RevFeatureType featureType = command(RevObjectParse.class)
                                .setObjectId(metadataId).call(RevFeatureType.class).get();
                        patch.addAlteredTree(diffEntry);
                        patch.addFeatureType(featureType);
                    }
                }
            } else if (diffEntry.changeType() == ChangeType.REMOVED) {
                RevObject revObject = command(RevObjectParse.class)
                        .setObjectId(diffEntry.oldObjectId()).call().get();
                if (revObject instanceof RevFeature) {
                    RevFeatureType featureType;
                    if (featureTypes.containsKey(oldObject.getMetadataId())) {
                        featureType = featureTypes.get(oldObject.getMetadataId());
                    } else {
                        featureType = command(RevObjectParse.class)
                                .setObjectId(oldObject.getMetadataId()).call(RevFeatureType.class)
                                .get();
                        featureTypes.put(oldObject.getMetadataId(), featureType);
                    }

                    FeatureBuilder featureBuilder = new FeatureBuilder(featureType);
                    Feature feature = featureBuilder.build(diffEntry.oldObjectId().toString(),
                            (RevFeature) revObject);
                    String name = diffEntry.oldPath();
                    patch.addRemovedFeature(name, feature, featureType);
                } else if (revObject instanceof RevTree) {
                    ObjectId metadataId = diffEntry.getOldObject().getMetadataId();
View Full Code Here

                RevFeature revFeature = repository.command(RevObjectParse.class)
                        .setObjectId(diff.newObjectId()).call(RevFeature.class).get();
                RevFeatureType revFeatureType = repository.command(RevObjectParse.class)
                        .setObjectId(diff.getNewObject().getMetadataId())
                        .call(RevFeatureType.class).get();
                FeatureBuilder builder = new FeatureBuilder(revFeatureType);
                list.add(builder.build(diff.getNewObject().name(), revFeature));
            }
        }
        return list.toArray(new Feature[0]);
    }
View Full Code Here

                RevFeature revFeature = repository.command(RevObjectParse.class)
                        .setObjectId(diff.newObjectId()).call(RevFeature.class).get();
                RevFeatureType revFeatureType = repository.command(RevObjectParse.class)
                        .setObjectId(diff.getNewObject().getMetadataId())
                        .call(RevFeatureType.class).get();
                FeatureBuilder builder = new FeatureBuilder(revFeatureType);
                list.add(builder.build(diff.getNewObject().name(), revFeature));
            }
        }
        return list.toArray(new Feature[0]);
    }
View Full Code Here

        Optional<RevFeature> revFeature = repository.command(RevObjectParse.class)
                .setRefSpec(refSpec).call(RevFeature.class);
        if (revFeature.isPresent()) {
            RevFeatureType revFeatureType = repository.command(ResolveFeatureType.class)
                    .setRefSpec(refSpec).call().get();
            FeatureBuilder builder = new FeatureBuilder(revFeatureType);
            return builder.build(name, revFeature.get());
        } else {
            return null;
        }
    }
View Full Code Here

        Optional<RevFeature> revFeature = repository.command(RevObjectParse.class)
                .setRefSpec(refSpec).call(RevFeature.class);
        if (revFeature.isPresent()) {
            RevFeatureType revFeatureType = repository.command(ResolveFeatureType.class)
                    .setRefSpec(refSpec).call().get();
            FeatureBuilder builder = new FeatureBuilder(revFeatureType);
            return builder.build(name, revFeature.get());
        } else {
            return null;
        }
    }
View Full Code Here

        private final FeatureBuilder featureBuilder;

        // RevObjectParse parser = context.command(RevObjectParse.class);
        public FetchFunction(ObjectDatabase source, SimpleFeatureType schema) {
            this.featureBuilder = new FeatureBuilder(schema);
            this.source = source;
        }
View Full Code Here

            @Nullable
            public SimpleFeature apply(final NodeRef input) {
                final ObjectId metadataId = input.getMetadataId();
                final RevFeature revFeature = database.getFeature(input.objectId());

                FeatureBuilder featureBuilder = getBuilderFor(metadataId);
                Feature feature = featureBuilder.build(input.name(), revFeature);
                feature.getUserData().put(Hints.USE_PROVIDED_FID, true);
                feature.getUserData().put(RevFeature.class, revFeature);
                feature.getUserData().put(RevFeatureType.class, featureBuilder.getType());

                if (feature instanceof SimpleFeature) {
                    return (SimpleFeature) feature;
                }
                return null;
            }

            private FeatureBuilder getBuilderFor(final ObjectId metadataId) {
                FeatureBuilder featureBuilder = ftCache.get(metadataId);
                if (featureBuilder == null) {
                    RevFeatureType revFtype = database.getFeatureType(metadataId);
                    featureBuilder = new FeatureBuilder(revFtype);
                    ftCache.put(metadataId, featureBuilder);
                }
                return featureBuilder;
            }
        };
View Full Code Here

                    } else {
                        newValues.add(Optional.absent());
                    }
                }
                RevFeature newFeature = RevFeatureImpl.build(ImmutableList.copyOf(newValues));
                FeatureBuilder featureBuilder = new FeatureBuilder(targetType);
                SimpleFeature feature = (SimpleFeature) featureBuilder.build(input.getID(),
                        newFeature);
                return feature;
            }
        };
        return Iterators.transform(plainFeatures, alterFunction);
View Full Code Here

                                    break;
                                }
                            }

                            RevFeature revFeature = (RevFeature) feature.get();
                            FeatureBuilder builder = new FeatureBuilder(featureType);
                            GeogigSimpleFeature simpleFeature = (GeogigSimpleFeature) builder
                                    .build(revFeature.getId().toString(), revFeature);
                            change = new GeometryChange(simpleFeature, input.changeType(), path,
                                    crsCode);
                        }
                        return change;
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.FeatureBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.