/** * Gets the value of this attribute from the passed feature. * * @param feature Feature from which to extract attribute value. */ public Object evaluate(Feature feature) { return feature.getAttribute(attPath); }
/** * Implementation of Comparator. Calls compareAtts to perform the * actual comparison. * * @param o1 The first Feature. * @param o2 The second Feature * * @return A value indicating less than, equal, or greater than. */ public int compare(Object o1, Object o2) { Feature f1 = (Feature) o1; Feature f2 = (Feature) o2; return compareAtts(f1.getAttribute(idx), f2.getAttribute(idx)); }
/** * Implementation of Comparator. Calls compareAtts to perform the * actual comparison. * * @param o1 The first Feature. * @param o2 The second Feature * * @return A value indicating less than, equal, or greater than. */ public int compare(Object o1, Object o2) { Feature f1 = (Feature) o1; Feature f2 = (Feature) o2; return compareAtts(f1.getAttribute(name), f2.getAttribute(name)); }
/** * @see org.geotools.data.jdbc.fidmapper.FIDMapper#createID(java.sql.Connection, * org.geotools.feature.Feature, Statement) */ public String createID(Connection conn, Feature feature, Statement statement) throws IOException { String[] attValues = new String[colNames.length]; for (int i = 0; i < colNames.length; i++) { attValues[i] = feature.getAttribute(colNames[i]).toString(); } return getID(attValues); }
public Object getImmediateNode() { return index != -1 ? feature.getAttribute( index ) : feature.getID(); }
public Object getImmediateNode() { return (index != -1) ? feature.getAttribute(index) : feature.getID(); }
public Object getProperty(Object object, String property) { Feature feature = (Feature) object; Object value = feature.getAttribute(property(property)); if (value != null) { return value; } //check additional properties if ("fid".equals(property) || property.matches("(\\w+:)?id")) { return feature.getID(); } return null; }
public Object getProperty(Object object, String property) { Feature feature = (Feature) object; Object value = feature.getAttribute( property( property ) ); if ( value != null ) { return value; } //check additional properties if ( "fid".equals( property ) || property.matches( "(\\w+:)?id" ) ) { return feature.getID(); } return null; }
protected String toString(final Feature _f, final int _column) { Assert.isTrue(geomIndex_ != _column); final Object attribute = _f.getAttribute(_column); if (attribute == null) { return ""; } if (attribute instanceof Date) { return format((Date) attribute); } return attribute.toString(); }
public Object get(Object object, String xpath, Class target) { xpath = stripPrefix(xpath); if ( object instanceof Feature ) { return ((Feature) object).getAttribute( xpath ); } if ( object instanceof FeatureType ) { return ((FeatureType) object).getAttributeType( xpath ); } return null; }
public boolean canHandle(Object object, String xpath, Class target) { xpath = stripPrefix(xpath); if ( object instanceof Feature ) { return ((Feature) object).getAttribute( xpath ) != null; } if ( object instanceof FeatureType ) { return ((FeatureType) object).getAttributeType( xpath ) != null; } return false; }
private Object[] particleValue(Feature f, XSDParticle particle) { return new Object[] { particle, f.getAttribute(((XSDElementDeclaration) particle.getContent()).getName()) }; }
/** * Gets the value stored in a specified cell. In this case, {@code row}={@code Feature} * and {@code col}={@code Attribute}. * * @param row the row number. * @param col the column number. * @return the value in the specified cell. */ public Object getValueAt(final int row, final int col) { if (featureArray == null) { featureArray = (Feature[]) featureTable.toArray(new Feature[featureTable.size()]); } return featureArray[row].getAttribute(col); } }
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 ); } }
public String createID(Connection conn, Feature feature, Statement statement) throws IOException { if (feature.getAttribute(colNames[1]) == null) { try { String id = autoIncrementMapper.createID(conn, feature, statement); feature.setAttribute(colNames[1], new Long(id)); } catch (Exception e) { throw new DataSourceException("Could not generate key for the " + "unset primary key column " + colNames[1], e); } } return super.createID(conn, feature, statement); }
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 {
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 {
public String createID(Connection conn, Feature feature, Statement statement) throws IOException { if (colNames.length == 2 && feature.getAttribute(colNames[1]) == null) { try { feature.setAttribute(colNames[1], (new UID()).toString()); } catch (IllegalAttributeException e) { throw new DataSourceException("Could not generate key for the " + "unset primary key column " + colNames[0], e); } } return super.createID(conn, feature, statement); }
public void testGetFeatureStoreModifyFeatures2() throws IOException { FeatureStore road = (FeatureStore) data.getFeatureSource("ROAD"); AttributeType name = roadType.getAttributeType("NAME"); road.modifyFeatures(new AttributeType[] { name, }, new Object[] { "changed", }, rd1Filter); FeatureCollection results = road.getFeatures(rd1Filter); assertEquals("changed", results.features().next().getAttribute("NAME")); }
public void testGetFeatureStoreModifyFeatures1() throws IOException { FeatureStore road = (FeatureStore) data.getFeatureSource("ROAD"); AttributeType name = roadType.getAttributeType("NAME"); road.modifyFeatures(name, "changed", rd1Filter); FeatureCollection results = road.getFeatures(rd1Filter); assertEquals("changed", results.features().next().getAttribute("NAME")); }