本文整理汇总了Java中org.opengis.feature.Property类的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于org.opengis.feature包,在下文中一共展示了Property类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromSimpleFeature
import org.opengis.feature.Property; //导入依赖的package包/类
public static GeoInfo fromSimpleFeature(SimpleFeature feature) {
GeoInfo that = new GeoInfo();
for (Property p: feature.getProperties()) {
if (p.getName().toString().equals("NAME"))
that.name = p.getValue().toString();
if (p.getName().toString().equals("STATE"))
that.state = p.getValue().toString();
if (p.getName().toString().equals("COUNTY"))
that.county = p.getValue().toString();
if (p.getName().toString().equals("CITY"))
that.city = p.getValue().toString();
}
that.multiPolygon = (MultiPolygon) feature.getDefaultGeometry();
return that;
}
示例2: printResults
import org.opengis.feature.Property; //导入依赖的package包/类
/**
* Iterates through the given iterator and prints out the properties (attributes) for each entry.
*
* @param iterator
*/
private static void printResults(FeatureIterator iterator, String... attributes) {
if (iterator.hasNext()) {
System.out.println("Results:");
} else {
System.out.println("No results");
}
int n = 0;
while (iterator.hasNext()) {
Feature feature = iterator.next();
StringBuilder result = new StringBuilder();
result.append(++n);
for (String attribute : attributes) {
Property property = feature.getProperty(attribute);
result.append("|")
.append(property.getName())
.append('=')
.append(property.getValue());
}
System.out.println(result.toString());
}
System.out.println();
}
示例3: GamaGisGeometry
import org.opengis.feature.Property; //导入依赖的package包/类
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());
}
}
}
}
示例4: getValueAt
import org.opengis.feature.Property; //导入依赖的package包/类
@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;
}
示例5: getPropertyRaw
import org.opengis.feature.Property; //导入依赖的package包/类
/** get a raw property */
public Object getPropertyRaw (String key) {
if (extraFields != null) {
String ret = extraFields.get(key);
if (ret != null) {
return ret;
}
}
Property prop = feat.getProperty(key);
if (prop == null) {
return null;
}
Object val = prop.getValue();
return val;
}
示例6: shouldSha1Property
import org.opengis.feature.Property; //导入依赖的package包/类
private boolean shouldSha1Property(Property p) {
String localName = p.getName().getLocalPart();
if (m_attributesToInclude.contains(localName)) {
return true;
}
if (m_attributesToInclude.contains("-" + localName)) {
return false;
}
if (m_attributesToInclude.contains("-all")) { // deprecated
return true;
}
if (m_attributesToInclude.contains("*")) {
return true;
}
LOGGER.log(Level.FINER, "Skipping: {0}", localName);
return false;
}
示例7: visitItem
import org.opengis.feature.Property; //导入依赖的package包/类
@Override
public void visitItem(final Object o)
{
final PreparedFeature preparedFeature = (PreparedFeature) o;
if (preparedFeature.preparedGeometry.contains(m_point))
{
m_found = true;
for (final ColumnInterface column : m_columnList)
{
final Property property = preparedFeature.feature.getProperty(column.getQualifier());
if (property != null)
{
column.setWeight(column.toDouble(property.getValue()));
}
}
}
}
示例8: readParameters
import org.opengis.feature.Property; //导入依赖的package包/类
private static void readParameters(Map<String, ShapeFileParameter> params,
SimpleFeature feature) {
for (Property property : feature.getProperties()) {
if (!(property.getValue() instanceof Number))
continue;
if (property.getName() == null)
continue;
String name = property.getName().toString();
double value = ((Number) property.getValue()).doubleValue();
ShapeFileParameter param = params.get(name);
if (param == null) {
param = new ShapeFileParameter();
param.name = name;
param.max = value;
param.min = value;
params.put(name, param);
} else {
param.max = Math.max(param.max, value);
param.min = Math.min(param.min, value);
}
}
}
示例9: printFeature
import org.opengis.feature.Property; //导入依赖的package包/类
public static void printFeature(SimpleFeature f) {
Iterator<Property> props = f.getProperties().iterator();
int propCount = f.getAttributeCount();
System.out.print("fid:" + f.getID());
for (int i = 0; i < propCount; i++) {
Name propName = props.next().getName();
System.out.print(" | " + propName + ":" + f.getAttribute(propName));
}
System.out.println();
}
示例10: appendResult
import org.opengis.feature.Property; //导入依赖的package包/类
/**
* Append the property to the result
*
* @param string
* @param property
*/
private static void appendResult(StringBuilder string, Property property) {
if (property != null) {
string.append("|")
.append(property.getName())
.append('=')
.append(property.getValue());
}
}
示例11: addFeaturesToEncoder
import org.opengis.feature.Property; //导入依赖的package包/类
/**
* Adds all features to the encoder and prepares it before. So geometries are removed from the attribute map and
* the geometry is transformed to the target tile local system
*
* @param featureCollectionStyleMap the feature collection map to be encoded and its refering style
*/
private void addFeaturesToEncoder(Map<FeatureCollection,Style> featureCollectionStyleMap, double scaleDenominator) {
for (FeatureCollection featureCollection : featureCollectionStyleMap.keySet()) {
String layerName = featureCollection.getSchema().getName().getLocalPart();
Style featureStyle = featureCollectionStyleMap.get(featureCollection);
try (FeatureIterator<SimpleFeature> it = featureCollection.features()) {
while (it.hasNext()) {
SimpleFeature feature = null;
try {
feature = it.next();
Collection<Property> propertiesList = feature.getProperties();
Map<String, Object> attributeMap = new HashMap<>();
for (Property property : propertiesList) {
if (!(property.getValue() instanceof Geometry)) {
attributeMap.put(property.getName().toString(), property.getValue());
}
}
//Process GeometryTransformations in Symbolizers. It is possible to render the same geometry
//with more than one symbolizer. Therefore a list is returned.
List<Geometry> geometryList = processSymbolizers(featureStyle, feature, scaleDenominator);
for (Geometry geometry : geometryList) {
geometry = transFormGeometry(geometry);
this.vectorTileEncoder.addFeature(layerName, attributeMap, geometry);
}
} catch (IllegalStateException ex) {
LOGGER.warning(ex.getMessage());
}
}
}
}
}
示例12: report
import org.opengis.feature.Property; //导入依赖的package包/类
/**
* Write the feature attribute names and values to a {@code JTextReporter}
*
* @param layerName
* name of the map layer that contains this feature
* @param feature
* the feature to report on
*/
private void report(final String layerName, final Feature feature) {
createReporter();
final Collection<Property> props = feature.getProperties();
String valueStr = null;
final StringBuilder sb = new StringBuilder();
sb.append(layerName);
sb.append("\n");
for (final Property prop : props) {
String name = prop.getName().getLocalPart();
final Object value = prop.getValue();
if (value instanceof Geometry) {
name = " Geometry";
valueStr = value.getClass().getSimpleName();
} else {
valueStr = value.toString();
}
sb.append(name);
sb.append(":");
sb.append(valueStr);
sb.append("\n\n");
}
reporter.append(sb.toString());
}
示例13: testLoadDbfFile
import org.opengis.feature.Property; //导入依赖的package包/类
/**
* Test correctness of .dbf parser
* @throws IOException
*/
@Test
public void testLoadDbfFile() throws IOException{
String inputLocation = getShapeFilePath("dbf");
// load shape with geotool.shapefile
FeatureCollection<SimpleFeatureType, SimpleFeature> collection = loadFeatures(inputLocation);
FeatureIterator<SimpleFeature> features = collection.features();
ArrayList<String> featureTexts = new ArrayList<String>();
while(features.hasNext()){
SimpleFeature feature = features.next();
String attr = "";
int i = 0;
for (Property property : feature.getProperties()) {
if(i == 0){
i++;
continue;
}
if(i > 1) attr += "\t";
attr += String.valueOf(property.getValue());
i++;
}
featureTexts.add(attr);
}
final Iterator<String> featureIterator = featureTexts.iterator();
for (Geometry geometry : ShapefileReader.readToGeometryRDD(sc, inputLocation).collect()) {
Assert.assertEquals(featureIterator.next(), geometry.getUserData());
}
}
示例14: getHTMLDescription
import org.opengis.feature.Property; //导入依赖的package包/类
private String getHTMLDescription(SimpleFeature simpleFeature) {
StringBuilder str = new StringBuilder();
for (Property property : simpleFeature.getProperties()) {
if (property.getName().toString() != GEOM) {
str.append("<b>" + property.getName() + "</b>: ");
if (property.getValue() != null)
str.append(property.getValue().toString() + " <br />");
else
str.append(" <br />");
}
}
return str.toString();
}
示例15: parseField
import org.opengis.feature.Property; //导入依赖的package包/类
private static double parseField(String diss_fld, Feature diss)
throws Exception {
double mag;
if(diss_fld.equals("::area::")){
mag = ((Geometry)diss.getDefaultGeometryProperty().getValue()).getArea();
} else {
Property magProp = diss.getProperty(diss_fld);
if(magProp==null){
String propStrings = "";
Collection<Property> props = diss.getProperties();
for( Property prop : props ){
propStrings += " "+prop.getName();
}
throw new Exception("Property '"+diss_fld+"' not found. Options are:"+propStrings+"." );
}
Class<?> cls = magProp.getType().getBinding();
Object propVal = diss.getProperty( diss_fld ).getValue();
if(propVal==null){
return 0;
}
if(cls.equals(Long.class)){
mag = (Long)propVal;
} else if(cls.equals(Integer.class)){
mag = (Integer)propVal;
} else if(cls.equals(Double.class)){
mag = (Double)propVal;
} else if(cls.equals(Float.class)){
mag = (Float)propVal;
} else {
throw new Exception( "Diss property has unkown type "+cls );
}
}
return mag;
}