Package org.opengis.feature.type

Examples of org.opengis.feature.type.PropertyDescriptor


            ArrayList<String> fields = new ArrayList<String>();
            Collection<PropertyDescriptor> propertyDescriptors = featureCollection
                .getSchema().getDescriptors();
            for (Iterator<PropertyDescriptor> itr = propertyDescriptors
                .iterator(); itr.hasNext();) {
              PropertyDescriptor propertyDescriptor = itr.next();
              String name = propertyDescriptor.getName()
                  .getLocalPart();
              if (!geometryField.equals(name)) {
                fields.add(name);
              }
            }
View Full Code Here


                    .sortedDescriptors();
            SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(
                    (SimpleFeatureType) newRevFeatureType.type());
            Map<Name, Optional<?>> attrs = Maps.newHashMap();
            for (int i = 0; i < oldDescriptors.size(); i++) {
                PropertyDescriptor descriptor = oldDescriptors.get(i);
                if (newDescriptors.contains(descriptor)) {
                    Optional<Object> value = values.get(i);
                    attrs.put(descriptor.getName(), value);
                }
            }
            Set<Entry<PropertyDescriptor, AttributeDiff>> featureDiffs = diff.getDiffs().entrySet();
            for (Iterator<Entry<PropertyDescriptor, AttributeDiff>> iterator = featureDiffs
                    .iterator(); iterator.hasNext();) {
View Full Code Here

                .hasNext();) {
            Entry<PropertyDescriptor, AttributeDiff> entry = iterator.next();
            if (entry.getValue().getType() == TYPE.REMOVED) {
                removed.add(entry.getKey().getName().getLocalPart());
            } else if (entry.getValue().getType() == TYPE.ADDED) {
                PropertyDescriptor pd = entry.getKey();
                added.add((AttributeDescriptor) pd);
            }
        }

        SimpleFeatureType sft = (SimpleFeatureType) oldRevFeatureType.type();
View Full Code Here

                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());
                }
                SimpleFeature feature = featureBuilder.buildFeature(ref.name());
                Entity entity = converter.toEntity(feature, id);
                EntityContainer container;
                if (entity instanceof Node) {
View Full Code Here

                            .setNewVersion(Suppliers.ofInstance(diff.getNewObject()))
                            .setOldVersion(Suppliers.ofInstance(diff.getOldObject())).call();
                    Map<PropertyDescriptor, AttributeDiff> attribDiffs = featureDiff.getDiffs();
                    Iterator<PropertyDescriptor> iter = attribDiffs.keySet().iterator();
                    while (iter.hasNext()) {
                        PropertyDescriptor key = iter.next();
                        Optional<?> value = attribDiffs.get(key).getNewValue();
                        String attribute = key.getName().toString();
                        report.addDiff(attribute, value, commit);
                    }
                }

            }
View Full Code Here

        Map<String, Integer> typeAttNameToRevTypeIndex = Maps.newHashMap();

        final GeometryDescriptor defaultGeometry = ((SimpleFeatureType) revType.type())
                .getGeometryDescriptor();
        for (int revFeatureIndex = 0; revFeatureIndex < sortedDescriptors.size(); revFeatureIndex++) {
            PropertyDescriptor prop = sortedDescriptors.get(revFeatureIndex);
            typeAttNameToRevTypeIndex.put(prop.getName().getLocalPart(),
                    Integer.valueOf(revFeatureIndex));

            if (prop.equals(defaultGeometry)) {
                typeAttNameToRevTypeIndex.put(null, Integer.valueOf(revFeatureIndex));
            }

        }
View Full Code Here

            Ansi ansi = AnsiDecorator.newAnsi(console.getTerminal().isAnsiSupported());
            Set<Entry<PropertyDescriptor, AttributeDiff>> entries = diffs.entrySet();
            Iterator<Entry<PropertyDescriptor, AttributeDiff>> iter = entries.iterator();
            while (iter.hasNext()) {
                Entry<PropertyDescriptor, AttributeDiff> entry = iter.next();
                PropertyDescriptor pd = entry.getKey();
                AttributeDiff ad = entry.getValue();
                if (ad instanceof GeometryAttributeDiff
                        && ad.getType() == org.locationtech.geogig.api.plumbing.diff.AttributeDiff.TYPE.MODIFIED
                        && !noGeom) {
                    GeometryAttributeDiff gd = (GeometryAttributeDiff) ad;
                    ansi.fg(YELLOW);
                    ansi.a(pd.getName()).a(": ");
                    ansi.reset();
                    String text = gd.getDiff().getDiffCoordsString();
                    for (int i = 0; i < text.length(); i++) {
                        if (text.charAt(i) == '(') {
                            ansi.fg(GREEN);
                            ansi.a(text.charAt(i));
                        } else if (text.charAt(i) == '[') {
                            ansi.fg(RED);
                            ansi.a(text.charAt(i));
                        } else if (text.charAt(i) == ']' || text.charAt(i) == ')') {
                            ansi.a(text.charAt(i));
                            ansi.reset();
                        } else if (text.charAt(i) == LCSGeometryDiffImpl.INNER_RING_SEPARATOR
                                .charAt(0)
                                || text.charAt(i) == LCSGeometryDiffImpl.SUBGEOM_SEPARATOR
                                        .charAt(0)) {
                            ansi.fg(BLUE);
                            ansi.a(text.charAt(i));
                            ansi.reset();
                        } else {
                            ansi.a(text.charAt(i));
                        }
                    }
                    ansi.reset();
                    ansi.newline();
                } else {
                    ansi.fg(ad.getType() == org.locationtech.geogig.api.plumbing.diff.AttributeDiff.TYPE.ADDED ? GREEN
                            : (ad.getType() == org.locationtech.geogig.api.plumbing.diff.AttributeDiff.TYPE.REMOVED ? RED
                                    : YELLOW));
                    ansi.a(pd.getName()).a(": ").a(ad.toString());
                    ansi.reset();
                    ansi.newline();
                }
            }
            console.println(ansi.toString());
View Full Code Here

                    boolean ok = true;
                    for (Iterator<Entry<PropertyDescriptor, AttributeDiff>> iterator = attrDiffs
                            .iterator(); iterator.hasNext() && ok;) {
                        Entry<PropertyDescriptor, AttributeDiff> entry = iterator.next();
                        AttributeDiff attrDiff = entry.getValue();
                        PropertyDescriptor descriptor = entry.getKey();
                        switch (attrDiff.getType()) {
                        case ADDED:
                            if (descriptors.contains(descriptor)) {
                                ok = false;
                            }
View Full Code Here

        ImmutableList<Optional<Object>> valuesA = featureA.getValues();
        ImmutableList<Optional<Object>> valuesB = featureB.getValues();
        ImmutableList<Optional<Object>> valuesAncestor = ancestor.getValues();
        ImmutableList<PropertyDescriptor> descriptors = featureType.sortedDescriptors();
        for (int i = 0; i < descriptors.size(); i++) {
            PropertyDescriptor descriptor = descriptors.get(i);
            boolean isGeom = Geometry.class.isAssignableFrom(descriptor.getType().getBinding());
            Name name = descriptor.getName();
            Optional<Object> valueAncestor = valuesAncestor.get(i);
            Optional<Object> valueA = valuesA.get(i);
            Optional<Object> valueB = valuesB.get(i);
            if (!valueA.equals(valueAncestor)) {
                Optional<Object> merged = valueA;
View Full Code Here

            RevFeatureType newFeatureType = getFeatureTypeFromId(diff.getNewFeatureType()).get();
            ImmutableList<PropertyDescriptor> oldDescriptors = oldFeatureType.sortedDescriptors();
            ImmutableList<PropertyDescriptor> newDescriptors = newFeatureType.sortedDescriptors();
            BitSet updatedDescriptors = new BitSet(newDescriptors.size());
            for (int i = 0; i < oldDescriptors.size(); i++) {
                PropertyDescriptor oldDescriptor = oldDescriptors.get(i);
                int idx = newDescriptors.indexOf(oldDescriptor);
                if (idx != -1) {
                    updatedDescriptors.set(idx);
                } else {
                    Class<?> oldType = oldDescriptor.getType().getBinding();
                    sb.append("R\t" + oldDescriptors.get(i).getName().getLocalPart() + "["
                            + oldType.getName() + "]");
                }

            }
            updatedDescriptors.flip(0, updatedDescriptors.length());
            for (int i = updatedDescriptors.nextSetBit(0); i >= 0; i = updatedDescriptors
                    .nextSetBit(i + 1)) {
                PropertyDescriptor newDescriptor = newDescriptors.get(i);
                Class<?> oldType = newDescriptor.getType().getBinding();
                sb.append("A\t" + newDescriptors.get(i).getName().getLocalPart() + "["
                        + oldType.getName() + "]");
            }
        }
View Full Code Here

TOP

Related Classes of org.opengis.feature.type.PropertyDescriptor

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.