本文整理汇总了Java中org.geotools.feature.IllegalAttributeException类的典型用法代码示例。如果您正苦于以下问题:Java IllegalAttributeException类的具体用法?Java IllegalAttributeException怎么用?Java IllegalAttributeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IllegalAttributeException类属于org.geotools.feature包,在下文中一共展示了IllegalAttributeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
public Feature next() throws IOException, IllegalAttributeException,
NoSuchElementException {
if (!closed) {
used = true;
final OXFFeature f = it.next();
// convert oxffeature to geotoolsfeature and return
if (f == null) {
throw new IllegalAttributeException("Feature is null");
}
Feature f2 = OXFFeatureConverter.convert(f);
if (SOSConfigurationRegistry.getInstance().getWorkaroundState(((URL)params.get(SOSDataStoreFactory.URL_SERVICE.key)).toExternalForm(), EastingFirstWorkaroundDesc.identifier)){
// EastingFirstWorkaroundDesc eastingFirstWorkaroundDesc = (EastingFirstWorkaroundDesc)GeneralConfigurationRegistry.getInstance().getWorkarounds().get(EastingFirstWorkaroundDesc.identifier);
// OXFSamplingPointType umgedreht
EastingFirstWorkaroundDesc.workaround(f2);
}
return f2;
} else {
throw new IOException("Reader closed");
}
}
示例2: duplicate
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
@Override
public Object duplicate(final Object src) throws IllegalAttributeException {
try {
if (src instanceof Duplicatable) {
return ((Duplicatable) src).duplicate();
} else if (src instanceof String[]) {
return (src);
} else if (src instanceof ITime) {
return TimeFactory.createTime(((ITime) src)
.toISO8601FormatWithMillies());
} else if (src instanceof java.util.List) {
return OXFFeatureConverter.cloneList((List)src);
} else {
return super.duplicate(src);
}
} catch (final IllegalAttributeException e) {
LOGGER
.error("Could not duplicate " + src + " -> Returning null",
e);
}
return null;
}
示例3: setAttribute
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void setAttribute(final int position, final Object val)
throws IllegalAttributeException, ArrayIndexOutOfBoundsException {
if (position == 0 && val instanceof List) {
final List<Feature> nw = (List<Feature>) val;
if (!FeatureState.isFeatures(nw)) {
return;
}
contents.clear();
for (final Iterator<Feature> i = nw.iterator(); i.hasNext();) {
final Feature feature = i.next();
feature.setParent(this);
contents.put(feature.getID(), feature);
}
fireChange(nw, 0);
}
}
示例4: reader
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
@Override
public FeatureReader reader() throws IOException {
final FeatureIterator iterator = features();
return new FeatureReader() {
public FeatureType getFeatureType() {
return getSchema();
}
public Feature next() throws IOException,
IllegalAttributeException, NoSuchElementException {
return iterator.next();
}
public boolean hasNext() throws IOException {
return iterator.hasNext();
}
public void close() throws IOException {
SOSFeatureCollection.this.close(iterator);
}
};
}
示例5: collection
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
@Override
public FeatureCollection collection() throws IOException {
final FeatureCollection copy = new SOSFeatureCollection(null,
featureType);
final List<Feature> list = new ArrayList<Feature>(contents.size());
for (final FeatureIterator iterator = features(); iterator.hasNext();) {
final Feature feature = iterator.next();
Feature duplicate;
try {
duplicate = feature.getFeatureType().duplicate(feature);
} catch (final IllegalAttributeException e) {
throw new DataSourceException("Unable to copy "
+ feature.getID(), e);
}
list.add(duplicate);
}
copy.addAll(list);
return copy;
}
示例6: setAttribute
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
/**
* Sets the attribute at position to val.
*
* @param position
* the index of the attribute to set.
* @param val
* the new value to give the attribute at position.
*
* @throws IllegalAttributeException
* if the passed in val does not validate against the
* AttributeType at that position.
*/
public void setAttribute(final int position, Object val)
throws IllegalAttributeException {
final AttributeType type = schema.getAttributeType(position);
try {
if ((val == null) && !type.isNillable()) {
val = type.createDefaultValue();
}
final Object parsed = type.parse(val);
type.validate(parsed);
setAttributeValue(position, parsed);
} catch (final IllegalArgumentException iae) {
throw new IllegalAttributeException(type, val, iae);
}
}
示例7: setAttributes
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
/**
* Sets all attributes for this feature, passed as an array. All attributes
* are checked for validity before adding.
*
* @param attributes
* All feature attributes.
*
* @throws IllegalAttributeException
* Passed attributes do not match feature type.
*/
public void setAttributes(final Object[] attributes)
throws IllegalAttributeException {
// the passed in attributes were null, lets make that a null array
Object[] newAtts = attributes;
if (attributes == null) {
newAtts = new Object[this.attributes.length];
}
if (newAtts.length != this.attributes.length) {
throw new IllegalAttributeException(
"Wrong number of attributes expected "
+ schema.getAttributeCount() + " got "
+ newAtts.length);
}
for (int i = 0, ii = newAtts.length; i < ii; i++) {
setAttribute(i, newAtts[i]);
}
}
示例8: duplicate
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
public Feature duplicate(final Feature original)
throws IllegalAttributeException {
if (original == null) {
return null;
}
final FeatureType featureType = original.getFeatureType();
if (!featureType.equals(this)) {
throw new IllegalAttributeException("Feature type " + featureType
+ " does not match " + this);
}
final String id = original.getID();
final int numAtts = featureType.getAttributeCount();
final Object attributes[] = new Object[numAtts];
for (int i = 0; i < numAtts; i++) {
final AttributeType curAttType = getAttributeType(i);
attributes[i] = curAttType.duplicate(original.getAttribute(i));
}
return featureType.create(attributes, id);
}
示例9: convert
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
public static List<Feature> convert(final List<OXFFeature> inList) throws IllegalAttributeException{
List<Feature> outList = new ArrayList<Feature>();
for (OXFFeature f : inList){
outList.add(convert(f));
}
return outList;
}
示例10: SOSFeature
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
/**
* @param schema
* @param attributes
* @param featureID
* @throws IllegalAttributeException
* @throws NullPointerException
*/
public SOSFeature(final SOSFeatureType schema, final Object[] attributes,
final String featureID) throws IllegalAttributeException,
NullPointerException {
if (schema == null) {
throw new NullPointerException("schema");
}
this.schema = schema;
this.featureId = (featureID == null) ? defaultID() : featureID;
this.attributes = new Object[schema.getAttributeCount()];
setAttributes(attributes);
}
示例11: setDefaultGeometry
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
/**
* Modifies the geometry.
*
* @param geometry
* All feature attributes.
*
* @throws IllegalAttributeException
* if the feature does not have a geometry.
*/
public void setDefaultGeometry(final Geometry geometry)
throws IllegalAttributeException {
final int idx = schema.defaultGeomIdx;
if (idx < 0) {
throw new IllegalAttributeException(
"Feature does not have geometry");
}
attributes[idx] = geometry;
bounds = null;
}
示例12: toComplex
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
public Feature toComplex() {
try {
return new ComplexWrapper(this);
} catch (final IllegalAttributeException iae) {
throw new RuntimeException("the impossible has happened: ", iae);
}
}
示例13: WPSInputLayer
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
/**
*
* @param layerName name of the inputLayer
* @param selectedFeaturesOnly
* @throws IOException
* @throws IllegalAttributeException
*/
public WPSInputLayer(String layerName, ProcessMode pm) throws IOException, IllegalAttributeException {
this.layerName = layerName;
this.processMode = pm;
if(processMode.compareTo(ProcessMode.SELECTED_FEATURES) == 0){
this.features = UdigHelper.getFeaturesOfLayer(layerName);
}
else {
this.features = UdigHelper.getFeaturesOfLayer(layerName);
}
}
示例14: getSelectedFeaturesByValue
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
public static FeatureCollection getSelectedFeaturesByValue(String layerName) throws IOException, IllegalAttributeException {
ILayer layer = getLayerForName(layerName);
Query query = new DefaultQuery(layer.getSchema().getTypeName(), layer.getFilter());
FeatureSource featureSource = layer.getResource(FeatureSource.class, null);
featureSource.getFeatures(query);
FeatureCollection featureCollection = featureSource.getFeatures(query);
return cloneFeatureCollection(featureCollection);
}
示例15: cloneFeatureCollection
import org.geotools.feature.IllegalAttributeException; //导入依赖的package包/类
public static FeatureCollection cloneFeatureCollection(FeatureCollection collection) throws IllegalAttributeException{
FeatureCollection clonedFeatureCollection = new TempFeatureCollection(collection.getID(), (SimpleFeatureType) collection.getSchema());
//clonedFeatureCollection.setDefaultGeometry(collection.getDefaultGeometry());
Iterator iter = collection.iterator();
while(iter.hasNext()) {
SimpleFeature defaultFeature = (SimpleFeature) iter.next();
SimpleFeature clonedFeature = SimpleFeatureBuilder.copy(defaultFeature);
;
clonedFeatureCollection.add(clonedFeature);
}
return clonedFeatureCollection;
}