Package org.opengis.feature.simple

Examples of org.opengis.feature.simple.SimpleFeatureType


     * @return
     */
    @SuppressWarnings("unchecked")
    private Query createQuery( ILayer sourceLayer, Filter filter, Layer targetLayer,
            Map<String, String> queryAttributes ) {
        SimpleFeatureType sourceSchema = sourceLayer.getSchema();
        SimpleFeatureType targetSchema = targetLayer.getSchema();
        // Maps type names to type names since we are ignoring case

        queryAttributes.putAll(FeatureUtils.createAttributeMapping(sourceSchema, targetSchema));
        Set<String> properties = new HashSet(queryAttributes.values());
        return new DefaultQuery(sourceSchema.getName().getLocalPart(), filter, properties
View Full Code Here


*/
public class DefaultValueFeatureInterceptor implements FeatureInterceptor {

    public void run( Feature feature ) {
        if( feature instanceof SimpleFeature ){
            SimpleFeatureType type = (SimpleFeatureType) feature.getType();
            SimpleFeature simpleFeature = (SimpleFeature) feature;
            for( int i = 0; i < type.getAttributeCount(); i++ ) {
                if( simpleFeature.getAttribute(i) == null ){
                    Object value = toDefaultValue(type.getDescriptor(i));
                    simpleFeature.setAttribute(i, value );
                }
            }
        }
        else {
View Full Code Here

                    0));
        }
        Style style = getStyle(styleBlackboard, featureSource);
        layers = new Layer[1];
        CoordinateReferenceSystem layerCRS = layer.getCRS();
        SimpleFeatureType schema = featureSource.getSchema();
       
        // Original Query provided by Layer.getFilter() as adjusted by selection and edit filter
        Query query = getContext().getFeatureQuery();
        if( styleBlackboard.contains(ProjectBlackboardConstants.LAYER__STYLE_FILTER)){
            if( query == null ){
                query = new Query( schema.getTypeName() );
            }
            // Additional Filter provided as Style used to reduce onscreen clutter
            FilterStyle filterStyle = (FilterStyle) styleBlackboard.get(ProjectBlackboardConstants.LAYER__STYLE_FILTER);
            Filter styleFilter = filterStyle.toFilter(schema);
            if( styleFilter != Filter.INCLUDE ){
                Filter queryFilter = query.getFilter();
                if( queryFilter == Filter.INCLUDE ){
                    query.setFilter( styleFilter );
                }
                else {
                    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
                    Filter combinedFilter = ff.and(styleFilter, queryFilter);
                    query.setFilter( combinedFilter );
                }
            }
        }

        CoordinateReferenceSystem dataCRS = schema.getCoordinateReferenceSystem();
        if (!layerCRS.equals(dataCRS)) {
            // need to force the coordinate reference system to match the layer definition
            FeatureLayer featureLayer = new FeatureLayer(featureSource, style, layer.getName()); //$NON-NLS-1$
            if( query == null ){
                query = new Query(schema.getTypeName());
            }
            query.setCoordinateSystem(layerCRS);
            featureLayer.setQuery(query);
            // double check the implementation is respecting our layer CRS
            FeatureCollection<SimpleFeatureType, SimpleFeature> features = featureSource.getFeatures( query );
View Full Code Here

                .getFeatureSource(wfsResource.typename);
       
        writable = featureSource instanceof FeatureStore;

        ResourceInfo resourceInfo = featureSource.getInfo();
        SimpleFeatureType ft = null;
        try {
            ft = ds.getSchema(wfsResource.typename);
        } catch (Exception crippled) {
            // unable to handle the describe feature type response for this
            // typeName
            if (WfsPlugin.getDefault().isDebugging()) {
                crippled.printStackTrace();
            }
        }
        bounds = resourceInfo.getBounds();
       
        // relax bounds for wfs ...
        // bounds = ReferencedEnvelopeCache.getReferencedEnvelope( crs );
       
        description = resourceInfo.getDescription();
        title = resourceInfo.getTitle();

        crs = resourceInfo.getCRS();
        if (crs == null && ft != null) {
            crs = ft.getCoordinateReferenceSystem();
        }
       
        name = wfsResource.typename;
        schema = resourceInfo.getSchema();
        if (schema == null) {
            try {
                if (ft != null) {
                    schema = new URI(ft.getName().getNamespaceURI());
                } else {
                    schema = wfsResource.parent.getID().toURI();
                }
            } catch (URISyntaxException e) {
                schema = null;
View Full Code Here

        typeRefsList.add("*"); //$NON-NLS-1$
        layerNamesList.add("*"); //$NON-NLS-1$
       
        for (int i = 0; i < allLayers.length; i++) {
            ILayer thisLayer = (ILayer) allLayers[i];
            SimpleFeatureType schema = thisLayer.getSchema();
            if( schema==null )
                continue;
           
            String dsID = schema.getName().getNamespaceURI();
            String typeName = thisLayer.getName();
           
            if(dsID == null || typeName == null)
              continue;
           
View Full Code Here

        FilterFactory2 factory = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
        if (!layer.hasResource(FeatureSource.class))
            return Filter.EXCLUDE;
        try {

            SimpleFeatureType schema = layer.getSchema();
            Name geom = getGeometryAttDescriptor(schema).getName();

            Filter bboxFilter = factory.bbox(factory.property(geom), boundingBox);

            return bboxFilter;
View Full Code Here

    if(geom != null){
      // a geometry was set
      return geom;
    } else {
      // make the union
      SimpleFeatureType type = layer.getSchema();
      final Class<?> expectedGeometryType = type.getGeometryDescriptor()
          .getType().getBinding();
     
      Geometry union;
     
      synchronized(sourceFeatures){
View Full Code Here

    /*
     * (non-Javadoc) Method declared on AttributeField.
     */
    protected void doLoadDefault() {
        if (textField != null) {
            SimpleFeatureType schema = getFeature().getFeatureType();
            AttributeDescriptor descriptor = schema.getDescriptor(getAttributeName());
            Object value = descriptor.getDefaultValue();
            Integer thenumber = Converters.convert(value, Integer.class);
            textField.setText("" + thenumber); //$NON-NLS-1$
        }
        valueChanged();
View Full Code Here

    /*
     * (non-Javadoc) Method declared on AttributeField.
     */
    protected void doStore() {

        SimpleFeatureType schema = getFeature().getFeatureType();
        AttributeDescriptor descriptor = schema.getDescriptor(getAttributeName());
        Object value = Converters.convert(textField, descriptor.getType().getBinding());
        getFeature().setAttribute(getAttributeName(), value);

    }
View Full Code Here

    public void testSelectionTransfering() throws Exception{
        Display display=Display.getCurrent();
        Clipboard cp=new Clipboard(display);
        SimpleFeature[] features = UDIGTestUtil.createDefaultTestFeatures("test", 1); //$NON-NLS-1$
        FilterFactory factory= CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        SimpleFeatureType featureType = features[0].getFeatureType();
        BoundingBox bounds = features[0].getBounds();
        CoordinateReferenceSystem crs= featureType.getCoordinateReferenceSystem();
    BBOX filter = factory.bbox(featureType.getGeometryDescriptor().getName().getLocalPart(), bounds.getMinX(),
            bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY(), CRS.lookupIdentifier(crs, false));
        cp.setContents(new Object[]{filter},new Transfer[]{UDigByteAndLocalTransfer.getInstance()});
        assertSame(filter, cp.getContents(UDigByteAndLocalTransfer.getInstance()));

//        cp.setContents(new Object[]{filter},new Transfer[]{FilterTextTransfer.getInstance()});
View Full Code Here

TOP

Related Classes of org.opengis.feature.simple.SimpleFeatureType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.