Package org.opengis.feature

Examples of org.opengis.feature.Feature


    public void testMergeWithPolygonAutoMerge() throws Exception {
        String polyId = "polyId";
        String polygonTypeSpec = "poly:Polygon:srid=4326";
        SimpleFeatureType polygonType = DataUtilities.createType("http://geogig.polygon",
                "polygons", polygonTypeSpec);
        Feature polygonOriginal = feature(polygonType, polyId,
                "POLYGON((0 0,1 0,2 0,3 0,4 0,5 0,5 1,4 1,3 1,2 1,1 1,1 0,0 0))");
        insertAndAdd(polygonOriginal);
        geogig.command(CommitOp.class).call();
        geogig.command(BranchCreateOp.class).setName("TestBranch").call();
        Feature polygonMaster = feature(polygonType, polyId,
                "POLYGON((0 0,1 0,2 0.2,3 0.2,4 0,5 0,5 1,4 1,3 1,2 1,1 1,1 0,0 0))");
        insertAndAdd(polygonMaster);
        geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("TestBranch").call();
        Feature polygonBranch = feature(polygonType, polyId,
                "POLYGON((0 0,1 0,2 0,3 0,4 0,5 0,5 1,4 1,3 0.8,2 0.8,1 1,1 0,0 0))");
        insertAndAdd(polygonBranch);
        geogig.command(CommitOp.class).call();

        geogig.command(CheckoutOp.class).setSource("master").call();
        Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
        geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();

        Optional<RevFeature> feature = repo.command(RevObjectParse.class)
                .setRefSpec("WORK_HEAD:polygons/polyId").call(RevFeature.class);
        assertTrue(feature.isPresent());
        RevFeature merged = feature.get();
        Feature expected = feature(polygonType, polyId,
                "POLYGON((0 0,1 0,2 0.2,3 0.2,4 0,5 0,5 1,4 1,3 0.8,2 0.8,1 1,1 0,0 0))");
        assertEquals(expected.getProperty("poly").getValue(), merged.getValues().get(0).get());
    }
View Full Code Here


        // |
        // o - master - HEAD - Points 1 modifiedB
        insertAndAdd(points1);
        geogig.command(CommitOp.class).call();
        geogig.command(BranchCreateOp.class).setName("TestBranch").call();
        Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000),
                "POINT(1 1)");
        insertAndAdd(points1Modified);
        geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("TestBranch").call();
        Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_1", new Integer(2000),
                "POINT(1 1)");
        insertAndAdd(points1ModifiedB);
        insertAndAdd(points2);
        geogig.command(CommitOp.class).call();

        geogig.command(CheckoutOp.class).setSource("master").call();
        Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
        geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();

        String path = appendChild(pointsName, points1.getIdentifier().getID());

        Optional<RevFeature> feature = repo.command(RevObjectParse.class)
                .setRefSpec(/*
                             * mergeCommit. getId ().toString () + ":" +
                             */"WORK_HEAD" + ":" + path).call(RevFeature.class);
        assertTrue(feature.isPresent());

        Feature mergedFeature = feature(pointsType, idP1, "StringProp1_2", new Integer(2000),
                "POINT(1 1)");
        RevFeature expected = RevFeatureBuilder.build(mergedFeature);
        assertEquals(expected, feature.get());

    }
View Full Code Here

        geogig.command(BranchCreateOp.class).setName("branch2").call();
        geogig.command(BranchCreateOp.class).setName("branch3").call();
        geogig.command(BranchCreateOp.class).setName("branch4").call();
        geogig.command(BranchCreateOp.class).setName("branch5").call();
        geogig.command(BranchCreateOp.class).setName("branch6").call();
        Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000),
                "POINT(1 1)");
        insertAndAdd(points1Modified);
        geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("branch1").call();
        insertAndAdd(points2);
        RevCommit branch1 = geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("branch2").call();
        insertAndAdd(points3);
        RevCommit branch2 = geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("branch3").call();
        insertAndAdd(lines1);
        RevCommit branch3 = geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("branch4").call();
        insertAndAdd(lines2);
        RevCommit branch4 = geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("branch5").call();
        insertAndAdd(lines3);
        RevCommit branch5 = geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("branch6").call();
        Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000),
                "POINT(1 1)");
        insertAndAdd(points1ModifiedB);
        RevCommit branch6 = geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource("master").call();
        MergeOp mergeOp = geogig.command(MergeOp.class)
View Full Code Here

        }
    }

    @Test
    public void testRemovalFixesConflict() throws Exception {
        Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000),
                "POINT(1 1)");
        Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000),
                "POINT(1 1)");
        insertAndAdd(points1);
        geogig.command(CommitOp.class).call();
        geogig.command(BranchCreateOp.class).setName("TestBranch").call();
        insertAndAdd(points1Modified);
View Full Code Here

        assertEquals(idL1, unstaged.get(1).newName());
    }

    @Test
    public void testInsertionAndAdditionFixesConflict() throws Exception {
        Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000),
                "POINT(1 1)");
        Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000),
                "POINT(1 1)");
        insertAndAdd(points1);
        geogig.command(CommitOp.class).call();
        geogig.command(BranchCreateOp.class).setName("TestBranch").call();
        insertAndAdd(points1Modified);
View Full Code Here

        assertFalse(ref.isPresent());
    }

    @Test
    public void testAdditionFixesConflict() throws Exception {
        Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000),
                "POINT(1 1)");
        Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000),
                "POINT(1 1)");
        insertAndAdd(points1);
        geogig.command(CommitOp.class).call();
        geogig.command(BranchCreateOp.class).setName("TestBranch").call();
        insertAndAdd(points1Modified);
View Full Code Here

        geogig.command(CommitOp.class).call();

        // create branch1, checkout and add a commit
        geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("branch1").call();
        insert(points2);
        Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000),
                "POINT(1 1)");
        insertAndAdd(points1Modified);
        geogig.command(AddOp.class).call();
        RevCommit branchCommit = geogig.command(CommitOp.class).call();
        geogig.command(CheckoutOp.class).setSource(Ref.MASTER).call();
        Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000),
                "POINT(1 1)");
        insert(points1ModifiedB);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).call();
        try {
            geogig.command(CherryPickOp.class)
                    .setCommit(Suppliers.ofInstance(branchCommit.getId())).call();
        } catch (IllegalStateException e) {
            assertTrue(e.getMessage().contains("conflict in Points/Points.1"));
        }
        Optional<Ref> cherrypickHead = geogig.command(RefParse.class).setName(Ref.CHERRY_PICK_HEAD)
                .call();
        assertTrue(cherrypickHead.isPresent());
        // check that unconflicted changes are in index and working tree
        Optional<RevObject> pts2 = geogig.command(RevObjectParse.class)
                .setRefSpec(Ref.WORK_HEAD + ":" + NodeRef.appendChild(pointsName, idP2)).call();
        assertTrue(pts2.isPresent());
        assertEquals(RevFeatureBuilder.build(points2), pts2.get());
        pts2 = geogig.command(RevObjectParse.class)
                .setRefSpec(Ref.STAGE_HEAD + ":" + NodeRef.appendChild(pointsName, idP2)).call();
        assertTrue(pts2.isPresent());
        assertEquals(RevFeatureBuilder.build(points2), pts2.get());
        // solve and commit
        Feature points1Solved = feature(pointsType, idP1, "StringProp1_2", new Integer(2000),
                "POINT(1 1)");
        insert(points1Solved);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setCommit(branchCommit).call();
        Optional<RevObject> ptsSolved = geogig.command(RevObjectParse.class)
View Full Code Here

    public void testCreatePatch() throws Exception {
        insertAndAdd(points1, points2);
        geogig.command(CommitOp.class).setAll(true).call();

        final String featureId = points1.getIdentifier().getID();
        final Feature modifiedFeature = feature((SimpleFeatureType) points1.getType(), featureId,
                "changedProp", new Integer(1500), "POINT (2 2)");
        insert(modifiedFeature);
        insert(points3);
        delete(points2);
View Full Code Here

    public void testCreatePatchUsingIndex() throws Exception {
        insertAndAdd(points1, points2);
        geogig.command(CommitOp.class).setAll(true).call();

        final String featureId = points1.getIdentifier().getID();
        final Feature modifiedFeature = feature((SimpleFeatureType) points1.getType(), featureId,
                "changedProp", new Integer(1500), null);

        insertAndAdd(modifiedFeature);
        insertAndAdd(points3);
        deleteAndAdd(points2);
View Full Code Here

                                property.getValue());
                    } else {
                        builder.set(property.getName(), property.getValue());
                    }
                }
                Feature modifiedFeature = builder.buildFeature(feature.getIdentifier().getID());
                return Optional.fromNullable(modifiedFeature);
            }

        };
View Full Code Here

TOP

Related Classes of org.opengis.feature.Feature

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.