public Object createDefaultValue() { Object[] t = new Object[featureType.getAttributeCount()]; for(int i=0;i<t.length;i++) t[i] = null; try { return featureType.create(t); } catch (IllegalAttributeException e) { // do nothing return null; } }
public Object createDefaultValue() { Object[] t = new Object[featureType.getAttributeCount()]; for(int i=0;i<t.length;i++) t[i] = null; try { return featureType.create(t); } catch (IllegalAttributeException e) { // do nothing return null; } }
public Feature next() throws IOException { editFeature_ = null; try { editFeature_ = fType_.create(default_); } catch (final IllegalAttributeException _evt) { FuLog.error(_evt); } return editFeature_; }
/** * DOCUMENT ME! * * @param featureType DOCUMENT ME! * @param featureID DOCUMENT ME! * * @return DOCUMENT ME! * * @throws IllegalAttributeException DOCUMENT ME! */ public static Feature template(FeatureType featureType, String featureID) throws IllegalAttributeException { return featureType.create(defaultValues(featureType), featureID); }
/** * DOCUMENT ME! * * @param featureType DOCUMENT ME! * @param atts DOCUMENT ME! * * @return DOCUMENT ME! * * @throws IllegalAttributeException DOCUMENT ME! */ public static Feature template(FeatureType featureType, Object[] atts) throws IllegalAttributeException { return featureType.create(defaultValues(featureType, atts)); }
/** * DOCUMENT ME! * * @param featureType DOCUMENT ME! * @param featureID DOCUMENT ME! * @param atts DOCUMENT ME! * * @return DOCUMENT ME! * * @throws IllegalAttributeException DOCUMENT ME! */ public static Feature template(FeatureType featureType, String featureID, Object[] atts) throws IllegalAttributeException { return featureType.create(defaultValues(featureType, atts), featureID); }
public Object parse(Object value) throws IllegalArgumentException { if (value instanceof Feature) { return value; } if(value instanceof Object[]) try { return featureType.create((Object[])value); } catch (IllegalAttributeException e) { IllegalArgumentException ee = new IllegalArgumentException(e.getMessage()); ee.initCause(e); throw ee; } throw new IllegalArgumentException(getName()+" needs to parse an array of Objects"); }
/** * Constructs an empty feature to use as a Template for new content. * * <p> * We may move this functionality to FeatureType.create( null )? * </p> * * @param featureType Type of feature we wish to create * * @return A new Feature of type featureType * * @throws IllegalAttributeException if we could not create featureType * instance with acceptable default values */ public static Feature template(FeatureType featureType) throws IllegalAttributeException { return featureType.create(defaultValues(featureType)); }
public Object parse(Object value) throws IllegalArgumentException { if (value instanceof Feature) { return value; } if(value instanceof Object[]) try { return featureType.create((Object[])value); } catch (IllegalAttributeException e) { IllegalArgumentException ee = new IllegalArgumentException(e.getMessage()); ee.initCause(e); throw ee; } throw new IllegalArgumentException(getLocalName()+" needs to parse an array of Objects"); }
protected Feature readFeature(AttributeReader atts) throws IllegalAttributeException, IOException { for (int i = 0, ii = atts.getAttributeCount(); i < ii; i++) { attributes[i] = atts.read(i); } return schema.create(attributes); }
public Object next() { Feature next = (Feature) delegate.next(); String id = next.getID(); Object[] attributes = new Object[types.length]; String xpath; try { for (int i = 0; i < types.length; i++) { xpath = types[i].getName(); //attributes[i] = types[i].duplicate(next.getAttribute(xpath)); attributes[i] = next.getAttribute(xpath); } return target.create(attributes, id); } catch (IllegalAttributeException e) { throw new RuntimeException( e ); } }
/** * @see org.geotools.data.FeatureReader#next() */ public Feature next() throws IOException, IllegalAttributeException, NoSuchElementException { if (reader == null) { throw new IllegalStateException("Reader has already been closed"); } Feature next = reader.next(); if( schema==null ) return next; return schema.create(next.getAttributes(null), next.getID()); }
/** * DOCUMENT ME! * * @param type DOCUMENT ME! * @param fid DOCUMENT ME! * @param text DOCUMENT ME! * * @return DOCUMENT ME! * * @throws IllegalAttributeException DOCUMENT ME! */ public static Feature parse(FeatureType type, String fid, String[] text) throws IllegalAttributeException { Object[] attributes = new Object[text.length]; for (int i = 0; i < text.length; i++) { attributes[i] = type.getAttributeType(i).parse(text[i]); } return type.create(attributes, fid); }
/** * @see org.geotools.data.FeatureReader#next() */ public Object next() throws NoSuchElementException { if (reader == null) { throw new IllegalStateException("Reader has already been closed"); } Feature next = reader.next(); if( schema==null ) return next; try { return schema.create(next.getAttributes(null), next.getID()); } catch( IllegalAttributeException eep){ throw (IllegalStateException) new IllegalStateException(eep.getMessage()).initCause(eep ); } }
protected Feature readFeature(AttributeReader atts) throws IllegalAttributeException, IOException { //Seems like doing it here could be a bit expensive. //The other option from this is to have this constructed with two //attributeReaders, the FID one and real attributes one. Could then //have default FIDAttributeReader. String fid = fidReader.next(); for (int i = 0, ii = atts.getAttributeCount(); i < ii; i++) { attributes[i] = atts.read(i); } return schema.create(attributes, fid); }
public Feature next() throws IOException { try { if (originalFeature_ != null) { writeFeature(originalFeature_); // keep the original } if (innerReader_ != null && innerReader_.hasNext()) { originalFeature_ = innerReader_.next(); // ; editFeature_ = featureType_.duplicate(originalFeature_); } else { originalFeature_ = null; editFeature_ = featureType_.create(featureDefaults_); } return editFeature_; } catch (final Exception e) { throw new IOException(e.toString()); } }
private Feature createFeature() { if (default_ == null) { default_ = new Object[fcmd_.getAttributeCount()]; for (int i = 0; i < default_.length; i++) { default_[i] = fcmd_.getAttributeType(i).createDefaultValue(); } } try { return fcmd_.create(default_); } catch (final IllegalAttributeException _evt) { FuLog.error(_evt); } return null; }
Feature createFeature( FeatureType type, Record record, DbaseFileReader dbfreader, String id ) throws Exception { if (type.getAttributeCount() == 1) { return type.create(new Object[]{getGeom(record.shape(), type.getDefaultGeometry())}, id); } else { DbaseFileHeader header = dbfreader.getHeader(); Object[] all = dbfreader.readEntry(); Object[] values = new Object[type.getAttributeCount()]; for( int i = 0; i < (values.length - 1); i++ ) { values[i] = all[attributeIndexing[i]]; if (header.getFieldName(attributeIndexing[i]).equals(type.getAttributeType(i))) { System.out.println("ok"); } } values[values.length - 1] = getGeom(record.shape(), type.getDefaultGeometry()); return type.create(values, id); } }
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 ); } /**
public Feature next() throws IOException, IllegalAttributeException, NoSuchElementException { Feature feature = wrapped.next(); FeatureType featureType = wrapped.getFeatureType(); String id = feature.getID(); return featureType.create(feature .getAttributes(new Object[featureType.getAttributeCount()]), fidMapper .getUnversionedFid(id)); } }