static FeatureType buildFeatureType() { List<PropertyType> pts = new LinkedList<PropertyType>(); pts.add( new SimplePropertyType( new QName( "http://www.deegree.org/app", "value", "app" ), 0, -1, DECIMAL, null, null ) ); FeatureType featureType = new GenericFeatureType( new QName( "http://www.deegree.org/app", "data", "app" ), pts, false ); // needed to get the back reference to the schema into the featureType (it's a strange mechanism indeed) new GenericAppSchema( new FeatureType[] { featureType }, null, null, null, null, null ); return featureType; }
@Override public GeometryPropertyType getDefaultGeometryPropertyDeclaration() { for ( PropertyType pt : getPropertyDeclarations() ) { if ( pt instanceof GeometryPropertyType ) { return (GeometryPropertyType) pt; } } return null; }
@Override public Feature newFeatureInstance( String fid, List<Property> props, ExtraProps extraProps ) { return super.newFeature( fid, props, extraProps ); }
ftNameToFt.put( ft.getName(), ft ); ( (GenericFeatureType) ft ).setSchema( this ); appNamespaces.add( ft.getName().getNamespaceURI() );
private void buildFeatureTypeAndMapping( TableName table, QName ftName, FIDMapping fidMapping, List<JAXBElement<? extends AbstractParticleJAXB>> propDecls ) throws FeatureStoreException, SQLException { List<PropertyType> pts = new ArrayList<PropertyType>(); List<Mapping> mappings = new ArrayList<Mapping>(); for ( JAXBElement<? extends AbstractParticleJAXB> propDeclEl : propDecls ) { AbstractParticleJAXB propDecl = propDeclEl.getValue(); Pair<PropertyType, Mapping> pt = buildPropertyAndMapping( table, propDecl, ftName.getPrefix(), ftName.getNamespaceURI() ); pts.add( pt.first ); mappings.add( pt.second ); } FeatureType ft = new GenericFeatureType( ftName, pts, false ); ftNameToFt.put( ftName, ft ); FeatureTypeMapping ftMapping = new FeatureTypeMapping( ftName, table, fidMapping, mappings ); ftNameToMapping.put( ftName, ftMapping ); }
for ( PropertyType pt : featureType.getPropertyDeclarations() ) { if ( pt instanceof GeometryPropertyType ) { byte[] bs = rs.getBytes( pt.getName().getLocalPart() );
@Override public Feature newFeatureInstance( String fid, List<Property> props, ExtraProps extraProps ) { return newFeature( fid, props, extraProps ); }
private void process( TableName table, QName ftName, FIDMapping fidMapping, List<JAXBElement<? extends AbstractPropertyJAXB>> propDecls ) throws FeatureStoreException, SQLException { List<PropertyType> pts = new ArrayList<PropertyType>(); List<Mapping> mappings = new ArrayList<Mapping>(); for ( JAXBElement<? extends AbstractPropertyJAXB> propDeclEl : propDecls ) { AbstractPropertyJAXB propDecl = propDeclEl.getValue(); Pair<PropertyType, Mapping> pt = process( table, propDecl ); pts.add( pt.first ); mappings.add( pt.second ); } FeatureType ft = new GenericFeatureType( ftName, pts, false ); ftNameToFt.put( ftName, ft ); FeatureTypeMapping ftMapping = new FeatureTypeMapping( ftName, table, fidMapping, mappings ); ftNameToMapping.put( ftName, ftMapping ); }
private static FeatureCollection readESRICollection( XMLStreamReader reader, String idPrefix ) throws XMLStreamException { GenericFeatureCollection col = new GenericFeatureCollection(); int count = 0; nextElement( reader ); while ( reader.isStartElement() && reader.getLocalName().equals( "FIELDS" ) ) { List<PropertyType> props = new ArrayList<PropertyType>( reader.getAttributeCount() ); List<Property> propValues = new ArrayList<Property>( reader.getAttributeCount() ); for ( int i = 0; i < reader.getAttributeCount(); ++i ) { String name = reader.getAttributeLocalName( i ); name = name.substring( name.lastIndexOf( "." ) + 1 ); String value = reader.getAttributeValue( i ); SimplePropertyType tp = new SimplePropertyType( new QName( name ), 0, 1, STRING, null, null ); propValues.add( new SimpleProperty( tp, value ) ); props.add( tp ); } GenericFeatureType ft = new GenericFeatureType( new QName( "feature" ), props, false ); col.add( new GenericFeature( ft, idPrefix + "_esri_" + ++count, propValues, null ) ); skipElement( reader ); nextElement( reader ); } LOG.debug( "Found {} features.", col.size() ); return col; }
private static FeatureCollection readMyWMSCollection( XMLStreamReader reader ) throws XMLStreamException { GenericFeatureCollection col = new GenericFeatureCollection(); nextElement( reader ); while ( reader.isStartElement() && reader.getLocalName().equals( "query_layer" ) ) { String ftName = reader.getAttributeValue( null, "name" ); int count = 0; nextElement( reader ); while ( reader.isStartElement() && reader.getLocalName().equals( "object" ) ) { List<PropertyType> props = new ArrayList<PropertyType>(); List<Property> propValues = new ArrayList<Property>(); nextElement( reader ); while ( !( reader.isEndElement() && reader.getLocalName().equals( "object" ) ) ) { String name = reader.getLocalName(); String value = reader.getElementText(); SimplePropertyType tp = new SimplePropertyType( new QName( name ), 0, 1, STRING, null, null ); propValues.add( new SimpleProperty( tp, value ) ); props.add( tp ); nextElement( reader ); } GenericFeatureType ft = new GenericFeatureType( new QName( ftName ), props, false ); col.add( new GenericFeature( ft, "ftName_" + ++count, propValues, null ) ); nextElement( reader ); } nextElement( reader ); } return col; }
nextElement( reader ); GenericFeatureType ft = new GenericFeatureType( new QName( ftName ), props, false ); col.add( new GenericFeature( ft, "ftName_" + ++count, propValues, null ) ); nextElement( reader );
FeatureType ft = new GenericFeatureType( ftName, pts, false ); ftNameToFt.put( ftName, ft );
return new GenericFeatureType( ftName, ps, false ); } catch ( SQLException e ) { LOG.info( "A DB error occurred: '{}'.", e.getLocalizedMessage() );
FeatureType ft = new GenericFeatureType( ftName, pts, false ); ftNameToFt.put( ftName, ft );
ftName.getPrefix() ), 0, 1, null, null, shp.getGeometryType(), DIM_2_OR_3, BOTH ); ft = new GenericFeatureType( ftName, Collections.<PropertyType> singletonList( geomProp ), false );
featureType = new GenericFeatureType( ftName, types, false );
private FeatureType buildFeatureType( XSElementDeclaration elDecl ) { final GMLObjectType type = objectTypeFactory.build( elDecl ); final List<XSElementDeclaration> fcDecls = gmlSchema.getFeatureCollectionElementDeclarations( null, false ); if ( fcDecls.contains( elDecl ) ) { return new GenericFeatureCollectionType( type.getName(), type.getPropertyDeclarations(), elDecl.getAbstract() ); } return new GenericFeatureType( type.getName(), type.getPropertyDeclarations(), elDecl.getAbstract() ); }