Examples of RevFeature


Examples of org.locationtech.geogig.api.RevFeature

            DepthSearch depthSearch = new DepthSearch(indexDb);
            Optional<NodeRef> noderef = depthSearch.find(workTree.getTree(), path);
            RevFeatureType oldRevFeatureType = command(RevObjectParse.class)
                    .setObjectId(noderef.get().getMetadataId()).call(RevFeatureType.class).get();
            String refSpec = Ref.WORK_HEAD + ":" + path;
            RevFeature feature = command(RevObjectParse.class).setRefSpec(refSpec)
                    .call(RevFeature.class).get();

            RevFeatureType newRevFeatureType = getFeatureType(diff, feature, oldRevFeatureType);
            ImmutableList<Optional<Object>> values = feature.getValues();
            ImmutableList<PropertyDescriptor> oldDescriptors = oldRevFeatureType
                    .sortedDescriptors();
            ImmutableList<PropertyDescriptor> newDescriptors = newRevFeatureType
                    .sortedDescriptors();
            SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

            Iterator<RevObject> objects = Iterators.transform(fiterator,
                    new Function<Feature, RevObject>() {
                        @Override
                        public RevFeature apply(final Feature feature) {
                            final RevFeature revFeature = RevFeatureBuilder.build(feature);

                            ObjectId id = revFeature.getId();
                            String name = feature.getIdentifier().getID();
                            BoundingBox bounds = feature.getBounds();
                            FeatureType type = feature.getType();

                            builder.putFeature(id, name, bounds, type);
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

     *        points to a feature instead of other type
     * @param featureType the destination feature type
     * @return a feature with the passed feature type and data taken from the input feature
     */
    private Feature alter(NodeRef node, RevFeatureType featureType) {
        RevFeature oldFeature = command(RevObjectParse.class).setObjectId(node.objectId())
                .call(RevFeature.class).get();
        RevFeatureType oldFeatureType;
        oldFeatureType = command(RevObjectParse.class).setObjectId(node.getMetadataId())
                .call(RevFeatureType.class).get();
        ImmutableList<PropertyDescriptor> oldAttributes = oldFeatureType.sortedDescriptors();
        ImmutableList<PropertyDescriptor> newAttributes = featureType.sortedDescriptors();
        ImmutableList<Optional<Object>> oldValues = oldFeature.getValues();
        List<Optional<Object>> newValues = Lists.newArrayList();
        for (int i = 0; i < newAttributes.size(); i++) {
            int idx = oldAttributes.indexOf(newAttributes.get(i));
            if (idx != -1) {
                Optional<Object> oldValue = oldValues.get(idx);
                newValues.add(oldValue);
            } 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

Examples of org.locationtech.geogig.api.RevFeature

     * @param contentId the {@link ObjectId} of the feature to get
     * @return the {@link RevFeature} that was found in the object database
     */
    public RevFeature getFeature(final ObjectId contentId) {

        RevFeature revFeature = objectDatabase().getFeature(contentId);

        return revFeature;
    }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

            @Override
            @Nullable
            public ChangeContainer apply(@Nullable DiffEntry diff) {
                NodeRef ref = diff.changeType().equals(ChangeType.REMOVED) ? diff.getOldObject()
                        : diff.getNewObject();
                RevFeature revFeature = command(RevObjectParse.class).setObjectId(ref.objectId())
                        .call(RevFeature.class).get();
                RevFeatureType revFeatureType = command(RevObjectParse.class)
                        .setObjectId(ref.getMetadataId()).call(RevFeatureType.class).get();
                SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(
                        (SimpleFeatureType) revFeatureType.type());
                ImmutableList<PropertyDescriptor> descriptors = revFeatureType.sortedDescriptors();
                ImmutableList<Optional<Object>> values = revFeature.getValues();
                for (int i = 0; i < descriptors.size(); i++) {
                    PropertyDescriptor descriptor = descriptors.get(i);
                    Optional<Object> value = values.get(i);
                    featureBuilder.set(descriptor.getName(), value.orNull());
                }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        testFeatureReadWrite(feature1_1);
    }

    protected void testFeatureReadWrite(Feature feature) throws Exception {

        RevFeature newFeature = RevFeatureBuilder.build(feature);
        ObjectWriter<RevFeature> writer = factory.<RevFeature> createObjectWriter(TYPE.FEATURE);

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        writer.write(newFeature, output);

        byte[] data = output.toByteArray();
        assertTrue(data.length > 0);

        ObjectReader<RevFeature> reader = factory.<RevFeature> createObjectReader(TYPE.FEATURE);
        ByteArrayInputStream input = new ByteArrayInputStream(data);
        RevFeature feat = reader.read(newFeature.getId(), input);

        assertNotNull(feat);
        assertEquals(newFeature.getValues().size(), feat.getValues().size());

        for (int i = 0; i < newFeature.getValues().size(); i++) {
            assertEquals(newFeature.getValues().get(i).orNull(), feat.getValues().get(i).orNull());
        }

    }
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        DiffFeature diffFeature = command(DiffFeature.class);

        while (!report.isComplete()) {
            if (!log.hasNext()) {
                String refSpec = commit.getId().toString() + ":" + path;
                RevFeature feature = revObjectParse.setRefSpec(refSpec).call(RevFeature.class)
                        .get();
                report.setFirstVersion(feature, commit);
                break;
            }
            RevCommit commitB = log.next();
            Iterator<DiffEntry> diffs = diffOp.setNewVersion(commit.getId())
                    .setOldVersion(commitB.getId()).setReportTrees(false).call();

            while (diffs.hasNext()) {
                DiffEntry diff = diffs.next();
                if (path.equals(diff.newPath())) {
                    if (diff.isAdd()) {
                        String refSpec = commit.getId().toString() + ":" + path;
                        RevFeature feature = revObjectParse.setRefSpec(refSpec)
                                .call(RevFeature.class).get();
                        report.setFirstVersion(feature, commit);
                        break;
                    }
                    FeatureDiff featureDiff = diffFeature
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        Iterator<DiffEntry> diffs = diffOp.call();
        List<Feature> list = Lists.newArrayList();
        while (diffs.hasNext()) {
            DiffEntry diff = diffs.next();
            if (!diff.changeType().equals(ChangeType.REMOVED) || !noDeletions) {
                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);
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

        Iterator<DiffEntry> diffs = repository.workingTree().getUnstaged(path);
        List<Feature> list = Lists.newArrayList();
        while (diffs.hasNext()) {
            DiffEntry diff = diffs.next();
            if (!diff.changeType().equals(ChangeType.REMOVED) || !noDeletions) {
                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);
View Full Code Here

Examples of org.locationtech.geogig.api.RevFeature

                this.fidIndex = fidIndex;
            }

            @Override
            public SimpleFeature apply(RevObject obj) {
                final RevFeature revFeature = (RevFeature) obj;
                final ObjectId id = obj.getId();
                List<String> list = fidIndex.get(id);
                final String fid = list.remove(0);

                Feature feature = featureBuilder.build(fid, revFeature);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.