/** * Determine whether or not the value is a feature with target descriptor that is of the given * attribute descriptor. If it is, then it is a feature chained feature with only simple * content. * * @param descriptor The attribute descriptor * @param value value to check * @return true if the value is an arraylist containing a feature with the descriptor. */ @SuppressWarnings("unchecked") private boolean isFeatureChainedSimpleContent(AttributeDescriptor descriptor, Object value) { boolean isFeatureChainedSimpleContent = false; if (value != null) { if (value instanceof Collection) { Collection list = (Collection) value; if (!list.isEmpty()) { Object f = list.iterator().next(); if (f instanceof Feature) { Name featureName = ((Feature) f).getDescriptor().getName(); if (((Feature) f).getProperty(featureName) != null) { isFeatureChainedSimpleContent = true; } } } } } return isFeatureChainedSimpleContent; }
public void visit(Feature feature) { assertEquals(1, feature.getProperty("someAtt").getValue()); } },
sourceFeature.getProperty(jdbcMultipleValue.getSourceColumn()).getValue(); return candidates.get(sourceColumnValue);
attributes[i] = lrsMeasure; } else { attributes[i] = feature.getProperty(attbType.getName()).getValue();
attributes[i] = nearestBearing; } else { attributes[i] = feature.getProperty(attbType.getName()).getValue();
attributes[i] = multiLineString; } else { attributes[i] = feature.getProperty(attbType.getName()).getValue();
attributes[i] = nearestBearing; } else { attributes[i] = feature.getProperty(attbType.getName()).getValue();
attributes[i] = point; } else { attributes[i] = feature.getProperty(attbType.getName()).getValue();
if (!prefixGml || (f.getProperty("boundedBy") == null)) { writeBounds(f.getBounds());
/** * Helper method that tests that mappings files obtained through an hTTP request are correctly * handled, as well the included types and schemas. */ private void testHttpMapping(String mappingFileName) throws Exception { // instantiate a store for the mapping file AppSchemaDataAccess store = buildAppSchemaDataStore(mappingFileName); // check that a stations type is available assertThat(store.getTypeNames().length, is(1)); Name name = new NameImpl("http://www.stations.org/1.0", "Station"); assertThat(store.getTypeNames()[0], is(name)); // read the complex features FeatureIterator iterator = store.getFeatureSource(name).getFeatures().features(); List<Feature> features = new ArrayList<>(); while (iterator.hasNext()) { features.add(iterator.next()); } // three stations should be available assertThat(features.size(), is(3)); for (Feature feature : features) { // check that each station has at least a measurement Name measurements = new NameImpl("http://www.stations.org/1.0", "measurements"); Property property = feature.getProperty(measurements); assertThat(property.getValue(), instanceOf(List.class)); List values = (List) property.getValue(); assertThat(values.size() > 0, is(true)); } }
Feature feature = featureIterator.next(); Double featureFromMeasure = (Double) feature.getProperty(fromMeasureAttb).getValue(); Double featureToMeasure = (Double) feature.getProperty(toMeasureAttb).getValue(); LengthIndexedLine lengthIndexedLine = new LengthIndexedLine(
while (it.hasNext()) { Feature f = it.next(); Object val = f.getProperty(attribute).getValue(); if (val == null) { continue;
/** Test CategorizeFunction */ @Test public void testCategorizeFunction() { final Map<String, String> VALUE_MAP = new HashMap<String, String>() { { put("sc.1", "missing value"); put("sc.2", "a valid value"); put("sc.3", "a valid value"); } }; FeatureIterator<Feature> features = exCollection.features(); try { while (features.hasNext()) { Feature feature = features.next(); String fId = feature.getIdentifier().getID(); Property attribute = feature.getProperty("someAttribute"); // <OCQL>Categorize(getID(), 'missing value', 2, 'a valid value')</OCQL> assertEquals(attribute.getValue(), VALUE_MAP.get(fId)); } } finally { features.close(); } }
assertTrue(value instanceof FeatureImpl); Feature feature = (Feature) value; assertNotNull(feature.getProperty("someAttribute").getValue()); assertTrue(value instanceof FeatureImpl); Feature feature = (Feature) value; assertNotNull(feature.getProperty("someAttribute").getValue());
featureMap .get("mf.1") .getProperty(new NameImpl(GML.NAMESPACE, "name"))) .getProperty(new NameImpl("simpleContent")) .getValue()); featureMap .get("mf.2") .getProperty(new NameImpl(GML.NAMESPACE, "name"))) .getProperty(new NameImpl("simpleContent")) .getValue()); "mf." + i) .getProperty( new NameImpl( GSML,
if (firstFeature == null) firstFeature = feature; Double featureFromMeasure = (Double) feature.getProperty(fromMeasureAttb).getValue(); Double featureToMeasure = (Double) feature.getProperty(toMeasureAttb).getValue();
for (PropertyDescriptor desc : descriptors) { Name name = desc.getName(); Object value = f.getProperty(name).getValue();
.getLength(); Double featureFromMeasure = (Double) nearestFeature.getProperty(fromMeasureAttb).getValue(); Double featureToMeasure = (Double) nearestFeature.getProperty(toMeasureAttb).getValue(); double lrsMeasure = featureFromMeasure
@Override public void visit(Feature feature) { ComplexAttribute ca = (ComplexAttribute) feature.getProperty(property); String value = (String) ca.getProperty("value").getValue(); values.add(value); } }, null);
private Feature getLayerPropertyFromCollection( FeatureCollection<FeatureType, Feature> features) { // get the simple feature representing the layer publishing info Feature collection = DataUtilities.first(features); assertNotNull(collection); Property layerProperty = collection.getProperty(LAYER_NAME); assertThat(layerProperty, notNullValue()); final Feature layerValue = (Feature) layerProperty; return layerValue; }