org.opengis.feature.Property Java Examples

The following examples show how to use org.opengis.feature.Property. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GamaGisGeometry.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
public GamaGisGeometry(final Geometry g, final Feature feature) {
	super(g);
	if (feature != null) {
		// We filter out the geometries (already loaded before)
		for (final Property p : feature.getProperties()) {
			if (!(p.getType() instanceof GeometryType)) {
				final String type = p.getDescriptor().getType().getBinding().getSimpleName();
				if ("String".equals(type)) {
					String val = (String) p.getValue();
					if (val != null && ((val.startsWith("'") && val.endsWith("'")) || (val.startsWith("\"") && val.endsWith("\""))))
						val = val.substring(1, val.length() - 1);
					setAttribute(p.getName().getLocalPart(), val);

				} else
					setAttribute(p.getName().getLocalPart(), p.getValue());
			}
		}
	}
}
 
Example #2
Source File: ScatterPlotTableModel.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
    if (columnIndex == 0) {
        return rowIndex + 1;
    } else if (columnIndex == 1) {
        return computedDatas[rowIndex].x;
    } else if (columnIndex == 2) {
        return computedDatas[rowIndex].y;
    } else if (columnIndex == 3) {
        return computedDatas[rowIndex].lat;
    } else if (columnIndex == 4) {
        return computedDatas[rowIndex].lon;
    } else if (columnIndex == 5) {
        return computedDatas[rowIndex].rasterMean;
    } else if (columnIndex == 6) {
        return computedDatas[rowIndex].rasterSigma;
    } else if (columnIndex == 7) {
        return computedDatas[rowIndex].correlativeData;
    } else if (columnIndex < getColumnCount()) {
        final Collection<Property> propColl = computedDatas[rowIndex].featureProperties;
        final Property[] properties = propColl.toArray(new Property[propColl.size()]);
        final Integer propertyIndex = propertyIndices.get(columnIndex);
        return properties[propertyIndex].getValue();
    }
    return null;
}
 
Example #3
Source File: BandFeatureIterator.java    From geowave with Apache License 2.0 6 votes vote down vote up
@Override
public Iterator<SimpleFeature> apply(final SimpleFeature scene) {
  if (scene == null) {
    return Collections.emptyIterator();
  }
  final String entityId = scene.getID();
  final List<SimpleFeature> bands = new ArrayList<>();

  for (final String bandId : scene.getAttribute(
      SceneFeatureIterator.BANDS_ATTRIBUTE_NAME).toString().split(";")) {
    final SimpleFeature band = featureBuilder.buildFeature(entityId + "_" + bandId);

    for (final Property property : scene.getProperties()) {
      band.setAttribute(property.getName(), property.getValue());
    }
    band.setAttribute(BAND_ATTRIBUTE_NAME, bandId);

    bands.add(band);
  }
  return bands.iterator();
}
 
Example #4
Source File: ScatterPlotTableModel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
public ScatterPlotTableModel(String rasterName, String correlativDataName, ScatterPlotPanel.ComputedData[] computedDatas) {

        this.computedDatas = computedDatas;
        colNames = new ArrayList<>();
        colNames.add("pixel_no");
        colNames.add("pixel_x");
        colNames.add("pixel_y");
        colNames.add("latitude");
        colNames.add("longitude");
        colNames.add(rasterName + "_mean");
        colNames.add(rasterName + "_sigma");
        colNames.add(correlativDataName + REF_SUFFIX);

        final int colStart = 8;
        propertyIndices = new HashMap<>();

        int validPropertyCount = 0;
        final Collection<Property> props = computedDatas[0].featureProperties;
        final Property[] properties = props.toArray(new Property[props.size()]);
        for (int i = 0; i < properties.length; i++) {
            final String name = properties[i].getName().toString();
            if (!correlativDataName.equals(name)) {
                colNames.add(name + REF_SUFFIX);
                propertyIndices.put(colStart + validPropertyCount, i);
                validPropertyCount++;
            }
        }
    }
 
Example #5
Source File: ProfileDataTableModel.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
public ProfileDataTableModel(String sampleName,
                             TransectProfileData profileData,
                             ProfilePlotPanel.DataSourceConfig dataSourceConfig) {

    this.profileData = profileData;

    pointDataIndexes = new int[profileData.getNumPixels()];
    Arrays.fill(pointDataIndexes, -1);
    int[] shapeVertexIndexes = profileData.getShapeVertexIndexes();
    for (int i = 0; i < shapeVertexIndexes.length; i++) {
        int shapeVertexIndex = shapeVertexIndexes[i];
        pointDataIndexes[shapeVertexIndex] = i;
    }

    computeInBetweenPoints = dataSourceConfig.computeInBetweenPoints;

    final String corrDataName;
    if (dataSourceConfig.pointDataSource != null && dataSourceConfig.dataField != null) {
        corrDataName = dataSourceConfig.dataField.getLocalName();
        features = dataSourceConfig.pointDataSource.getFeatureCollection().toArray(new SimpleFeature[0]);
        dataFieldIndex = dataSourceConfig.pointDataSource.getFeatureType().indexOf(corrDataName);
    } else {
        corrDataName = "";
        features = null;
        dataFieldIndex = -1;
    }

    columnNames = new ArrayList<String>();
    columnNames.add("pixel_no");
    columnNames.add("pixel_x");
    columnNames.add("pixel_y");
    columnNames.add("latitude");
    columnNames.add("longitude");
    columnNames.add(sampleName + "_mean");
    columnNames.add(sampleName + "_sigma");
    columnNames.add(corrDataName.trim().length() == 0 ? "" : corrDataName + REF_SUFFIX);

    propertyIndices = new HashMap<Integer, Integer>();
    if (features != null && features.length > 0) {
        final int colStart = 8;

        int validPropertyCount = 0;
        final Collection<Property> props = features[0].getProperties();
        final Property[] properties = props.toArray(new Property[props.size()]);
        for (int i = 0; i < properties.length; i++) {
            Property property = properties[i];
            final String name = property.getName().toString();
            if (!corrDataName.equals(name)) {
                columnNames.add(name + REF_SUFFIX);
                propertyIndices.put(colStart + validPropertyCount, i);
                validPropertyCount++;
            }
        }
    }
}
 
Example #6
Source File: SimpleFeatureWrapper.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(final Collection<Property> values) {
  simpleFeature.setValue(values);
}
 
Example #7
Source File: SimpleFeatureWrapper.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Collection<? extends Property> getValue() {
  return simpleFeature.getValue();
}
 
Example #8
Source File: SimpleFeatureWrapper.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Collection<Property> getProperties(final Name name) {
  return simpleFeature.getProperties(name);
}
 
Example #9
Source File: SimpleFeatureWrapper.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Property getProperty(final Name name) {
  return simpleFeature.getProperty(name);
}
 
Example #10
Source File: SimpleFeatureWrapper.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Collection<Property> getProperties(final String name) {
  return simpleFeature.getProperties(name);
}
 
Example #11
Source File: SimpleFeatureWrapper.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Collection<Property> getProperties() {
  return simpleFeature.getProperties();
}
 
Example #12
Source File: SimpleFeatureWrapper.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Property getProperty(final String name) {
  return simpleFeature.getProperty(name);
}