本文整理了Java中org.geotools.feature.Feature.getFeatureType()
方法的一些代码示例,展示了Feature.getFeatureType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getFeatureType()
方法的具体详情如下:
包路径:org.geotools.feature.Feature
类名称:Feature
方法名:getFeatureType
[英]Gets a reference to the schema for this feature.
[中]获取对此功能的架构的引用。
代码示例来源:origin: org.geotools/gt2-main
public FeatureType getFeatureType() {
return features[0].getFeatureType();
}
代码示例来源:origin: org.geotools/gt2-main
/**
* Create a new instance.
*
* @param featuresArg an of features. <b>All features must be of the same FeatureType</b>
*/
public CollectionFeatureReader(Feature[] featuresArg) {
assert featuresArg.length > 0;
this.features = Arrays.asList(featuresArg).iterator();
type = featuresArg[0].getFeatureType();
}
代码示例来源:origin: org.geotools/gt2-main
/**
* Like contain but based on match rather than equals
*
* @param array DOCUMENT ME!
* @param expected DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
boolean containsLax(Feature[] array, Feature expected) {
if ((array == null) || (array.length == 0)) {
return false;
}
FeatureType type = expected.getFeatureType();
for (int i = 0; i < array.length; i++) {
if (match(array[i], expected)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.geotools/gt2-main
/**
* Sends sax for the ending of a feature.
*
* @param f DOCUMENT ME!
*
* @throws RuntimeException DOCUMENT ME!
*/
public void endFeature(Feature f) {
try {
String name = f.getFeatureType().getTypeName();
if (currentPrefix != null) {
name = currentPrefix + ":" + name;
}
contentHandler.endElement("", "", name);
contentHandler.endElement("", "", memberString);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.geotools/gt2-cql
/**
* @return {@link Boolean#TRUE} if the <code>feature</code>'s
* {@link FeatureType} contains an attribute named as the property
* name passed as this function argument, {@link Boolean#FALSE}
* otherwise.
*/
public Object evaluate(Feature feature) {
String propName = getPropertyName();
AttributeType attributeType = feature.getFeatureType().getAttributeType(propName);
return Boolean.valueOf(attributeType != null);
}
代码示例来源:origin: org.geotools/gt2-xml-gml3
public Element encode(Object object, Document document, Element value)
throws Exception {
Feature feature = (Feature) object;
FeatureType featureType = feature.getFeatureType();
String namespace = featureType.getNamespace().toString();
String typeName = featureType.getTypeName();
Element encoding = document.createElementNS(namespace, typeName);
encoding.setAttributeNS(GML.NAMESPACE, "id", feature.getID());
return encoding;
}
代码示例来源:origin: org.geotools/gt2-main
protected boolean add(Feature feature, boolean fire) {
// This cast is neccessary to keep with the contract of Set!
if( feature == null ) return false; // cannot add null!
final String ID = feature.getID();
if( ID == null ) return false; // ID is required!
if( contents.containsKey( ID ) ) return false; // feature all ready present
if ( childType==null ){
childType=feature.getFeatureType();
}else{
if( !feature.getFeatureType().equals(childType) )
Logging.getLogger("org.geotools.feature.collections").warning("Feature Collection contains a heterogeneous" +
" mix of features");
}
//TODO check inheritance with FeatureType here!!!
contents.put( ID, feature );
if(fire) {
fireChange(feature, CollectionEvent.FEATURES_ADDED);
}
return true;
}
代码示例来源:origin: org.geoserver/wfsv
public boolean canHandle(Object object) {
try {
if (!(object instanceof Feature)
|| object instanceof FeatureCollection)
return false;
Feature f = (Feature) object;
FeatureTypeInfo info = catalog.getFeatureTypeInfo(f
.getFeatureType().getTypeName(), f.getFeatureType()
.getNamespace().toString());
return info != null
&& info.getFeatureSource() instanceof VersioningFeatureSource;
} catch (Exception e) {
LOGGER
.log(
Level.FINE,
"Error occurred trying to determine versioning status of a feature type",
e);
return false;
}
}
代码示例来源:origin: org.geotools/gt2-main
private void addFeatureInternal(Feature feature) {
if (feature == null) {
throw new IllegalArgumentException("Provided Feature is empty");
}
FeatureType featureType;
featureType = feature.getFeatureType();
String typeName = featureType.getTypeName();
Map featuresMap;
if (!memory.containsKey(typeName)) {
try {
createSchema(featureType);
} catch (IOException e) {
// this should not of happened ?!?
// only happens if typeNames is taken and
// we just checked
}
}
featuresMap = (Map) memory.get(typeName);
featuresMap.put(feature.getID(), feature);
}
代码示例来源:origin: org.geotools/gt2-demo-property
public void remove() throws IOException {
if( live == null){
throw new IOException( "No current feature to remove");
}
if( origional != null ){
store.listenerManager.fireFeaturesRemoved(live.getFeatureType().getTypeName(), Transaction.AUTO_COMMIT,
origional.getBounds(), false);
}
origional = null;
live = null; // prevent live and remove from being written out
}
public void close() throws IOException {
代码示例来源:origin: org.geotools.demo/gt2-demo-property
public void remove() throws IOException {
if( live == null){
throw new IOException( "No current feature to remove");
}
if( origional != null ){
store.listenerManager.fireFeaturesRemoved(live.getFeatureType().getTypeName(), Transaction.AUTO_COMMIT,
origional.getBounds(), false);
}
origional = null;
live = null; // prevent live and remove from being written out
}
public void close() throws IOException {
代码示例来源:origin: org.geotools/gt2-xml-core
public String[] getPropertyNames(Object object) {
Feature feature = (Feature) object;
FeatureType featureType = feature.getFeatureType();
//set is ok because jxpath ignores order
String[] propertyNames = new String[featureType.getAttributeCount()];
for (int i = 0; i < propertyNames.length; i++) {
propertyNames[i] = featureType.getAttributeType(i).getLocalName();
}
return propertyNames;
}
代码示例来源:origin: org.geotools/gt2-xml-xsd
public String[] getPropertyNames(Object object) {
Feature feature = (Feature) object;
FeatureType featureType = feature.getFeatureType();
//set is ok because jxpath ignores order
String[] propertyNames = new String[ featureType.getAttributeCount() ];
for ( int i = 0; i < propertyNames.length; i++ ) {
propertyNames[ i ] = featureType.getAttributeType( i ).getName();
}
return propertyNames;
}
代码示例来源:origin: org.geotools/gt2-xml-xsd
/**
* Returns the qname with prefix as <code>null</code>, and local part the name of the
* feature attribute.
*/
public QName getName() {
return index != -1 ?
new QName( null, feature.getFeatureType().getAttributeType( index ).getName() ) :
new QName( null, "fid" );
}
代码示例来源:origin: org.geotools/gt2-xml-core
/**
* Returns the qname with prefix as <code>null</code>, and local part the name of the
* feature attribute.
*/
public QName getName() {
return (index != -1)
? new QName(null, feature.getFeatureType().getAttributeType(index).getLocalName())
: new QName(null, "fid");
}
代码示例来源:origin: org.geotools/gt2-main
public FeatureCollection collection() throws IOException {
FeatureCollection copy = new DefaultFeatureCollection( null, featureType );
List list = new ArrayList( contents.size() );
for( FeatureIterator iterator = features(); iterator.hasNext(); ){
Feature feature = iterator.next();
Feature duplicate;
try {
duplicate = feature.getFeatureType().duplicate( feature );
} catch (IllegalAttributeException e) {
throw new DataSourceException( "Unable to copy "+feature.getID(), e );
}
list.add( duplicate );
}
copy.addAll( list );
return copy;
}
代码示例来源:origin: org.geotools/gt2-main
public Feature duplicate(Feature original) throws IllegalAttributeException{
if( original == null ) return null;
FeatureType featureType = original.getFeatureType();
if (!featureType.equals(this)) {
throw new IllegalAttributeException("Feature type " + featureType
+ " does not match " + this);
}
String id = original.getID();
int numAtts = featureType.getAttributeCount();
Object attributes[] = new Object[numAtts];
for (int i = 0; i < numAtts; i++) {
AttributeType curAttType = getAttributeType(i);
attributes[i] = curAttType.duplicate(original.getAttribute(i));
}
return featureType.create(attributes, id );
}
/**
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Gets the name of a specified column.
*
* @param col the index of the column to get the name of.
* @return the name of {@code col}.
*
* @todo Just gets first feature type - should use typed feature
* collection. Revisit when we have FeatureDocument.
*/
public String getColumnName(int col) {
if (featureTable==null || featureTable.isEmpty()) {
return null;
}
Feature firstFeature = featureTable.features().next();
FeatureType firstType = firstFeature.getFeatureType();
return firstType.getAttributeType(col).getName();
}
代码示例来源: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-main
public void fireChanged( Feature before, Feature after, Transaction transaction ){
String typeName = after.getFeatureType().getTypeName();
Envelope bounds = new Envelope();
bounds.expandToInclude( before.getBounds() );
bounds.expandToInclude( after.getBounds() );
listenerManager.fireFeaturesChanged( typeName, transaction, bounds, false );
}
//
内容来源于网络,如有侵权,请联系作者删除!