org.geotools.feature.Feature.getNumberOfAttributes()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.geotools.feature.Feature.getNumberOfAttributes()方法的一些代码示例,展示了Feature.getNumberOfAttributes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getNumberOfAttributes()方法的具体详情如下:
包路径:org.geotools.feature.Feature
类名称:Feature
方法名:getNumberOfAttributes

Feature.getNumberOfAttributes介绍

[英]Get the number of attributes this feature has. This is NOT simply a convenience method for calling getFeatureType().getNumberOfAttributes(). This is the same as calling getAttributes(null).length. This represents the number of actual attribute values in the feature, and may differ from the number of AttributeTypes defined in the FeatureType based on the multiplicity of the AttributeTypes.
[中]获取此功能具有的属性数。这不仅仅是调用getFeatureType()的方便方法。getNumberOfAttributes()。这与调用getAttributes(null)相同。长这表示要素中实际属性值的数量,可能不同于基于属性类型的多重性在FeatureType中定义的属性类型的数量。

代码示例

代码示例来源:origin: org.geotools/gt2-xml-core

public int getLength() {
  return feature.getNumberOfAttributes();
}

代码示例来源:origin: org.geotools/gt2-xml-core

public boolean setPosition(int position) {
  this.position = position;
  return position <= feature.getNumberOfAttributes();
}

代码示例来源:origin: org.geotools/gt2-xml-xsd

public boolean setPosition(int position) {
  this.position = position;
  return position <= feature.getNumberOfAttributes();
}

代码示例来源:origin: org.geotools/gt2-xml-xsd

public int getLength() {
  return feature.getNumberOfAttributes();
}

代码示例来源:origin: org.geotools/gt2-widgets-swing

/**
 * The number of columns in the feature table. Note: for the moment, this is
 * determined by the first feature.
 *
 * @return the number of columns in this feature table.
 *
 * @todo Just gets first feature type - should use typed feature
 *       collection.  Revisit when we have FeatureDocument.
 */
public int getColumnCount() {
  if (featureTable==null || featureTable.isEmpty()) {
    return 0;
  }
  return featureTable.features().next().getNumberOfAttributes();
}

代码示例来源:origin: org.geotools/gt2-demo-property

private void writeImplementation( Feature f ) throws IOException{
  writer.next();
  writer.writeFeatureID( f.getID() );        
  for( int i=0; i<f.getNumberOfAttributes(); i++){
    writer.write( i, f.getAttribute( i ));
  }   
}
public Feature next() throws IOException {

代码示例来源:origin: org.geotools.demo/gt2-demo-property

private void writeImplementation( Feature f ) throws IOException{
  writer.next();
  writer.writeFeatureID( f.getID() );        
  for( int i=0; i<f.getNumberOfAttributes(); i++){
    writer.write( i, f.getAttribute( i ));
  }   
}
public Feature next() throws IOException {

代码示例来源:origin: org.geotools/gt2-postgis-versioned

this.state = UPDATED;
List changedAttributes = new ArrayList();
for (int i = 0; i < oldFeature.getNumberOfAttributes(); i++) {
  String attName = oldFeature.getFeatureType().getAttributeType(i).getName();
  Object toAttribute = newFeature.getAttribute(attName);

代码示例来源:origin: org.geotools/gt2-jdbc

+ " SET ");
for (int i = 0; i < current.getNumberOfAttributes(); i++) {
  Object currAtt = current.getAttribute(i);
  Object liveAtt = live.getAttribute(i);

代码示例来源:origin: org.geotools/gt2-main

public void handleFeatureReader(FeatureReader reader)
  throws IOException {
  try {
    while (reader.hasNext() && running) {
      Feature f = reader.next();
      handleFeature(f);
      FeatureType t = f.getFeatureType();
      for (int i = 0, ii = f.getNumberOfAttributes(); i < ii;
          i++) {
        handleAttribute(t.getAttributeType(i), f.getAttribute(i));
      }
      endFeature(f);
    }
  } catch (Exception ioe) {
    throw new RuntimeException("Error reading Features", ioe);
  } finally {
    if (reader != null) {
      LOGGER.finer("closing reader " + reader);
      reader.close();
    }
  }
}

代码示例来源:origin: org.geotools/gt2-jdbc

protected void doUpdate(Feature live, Feature current)
  throws IOException, SQLException {
  try {
    // Can we create for array getAttributes more efficiently?
    for (int i = 0; i < current.getNumberOfAttributes(); i++) {
      Object currAtt = current.getAttribute(i);
      Object liveAtt = live.getAttribute(i);
      if ((live == null)
          || !DataUtilities.attributesEqual(liveAtt, currAtt)) {
        if (LOGGER.isLoggable(Level.INFO)) {
          LOGGER.info("modifying att# " + i + " to " + currAtt);
        }
        queryData.write(i, currAtt);
      }
    }
  } catch (IOException ioe) {
    String message = "problem modifying row";
    if (queryData.getTransaction() != Transaction.AUTO_COMMIT) {
      queryData.getTransaction().rollback();
      message += "(transaction canceled)";
    }
    throw ioe;
  }
  queryData.updateRow();
}

代码示例来源:origin: org.geotools/gt2-main

public void handleFeatureIterator(FeatureIterator iterator)
  throws IOException {
  try {
    while (iterator.hasNext() && running) {
      Feature f = iterator.next();
      handleFeature(f);
      FeatureType t = f.getFeatureType();
      for (int i = 0, ii = f.getNumberOfAttributes(); i < ii;
          i++) {
        handleAttribute(t.getAttributeType(i), f.getAttribute(i));
      }
      endFeature(f);
    }
  } catch (Exception ioe) {
    throw new RuntimeException("Error reading Features", ioe);
  } finally {
    if (iterator != null) {
      LOGGER.finer("closing reader " + iterator);
      iterator.close();
    }
  }
}

代码示例来源:origin: org.geotools/gt2-main

for (int i = 0, ii = feature1.getNumberOfAttributes(); i < ii; i++) {
  Object otherAtt = feature2.getAttribute(i);

代码示例来源:origin: org.geotools/gt2-jdbc

new Object[temp.getNumberOfAttributes()]), null);

代码示例来源:origin: org.geotools/gt2-jdbc

for (int i = 0; i < current.getNumberOfAttributes(); i++) {
  Object currAtt = current.getAttribute(i);
  String attName = current.getFeatureType().getAttributeType(i).getName();

代码示例来源:origin: org.geotools/gt2-postgis-versioned

for (int i = 0; i < liveFeature.getNumberOfAttributes(); i++) {
  AttributeType at = liveFeature.getFeatureType().getAttributeType(i);
  Object newValue = liveFeature.getAttribute(at.getName());
for (int i = 0; i < liveFeature.getNumberOfAttributes(); i++) {
  AttributeType at = liveFeature.getFeatureType().getAttributeType(i);
  oldFeature.setAttribute(at.getName(), liveFeature.getAttribute(at.getName()));
for (int i = 0; i < liveFeature.getNumberOfAttributes(); i++) {
  AttributeType at = liveFeature.getFeatureType().getAttributeType(i);
  newFeature.setAttribute(at.getName(), liveFeature.getAttribute(at.getName()));

相关文章