Examples of SimpleFeatureType


Examples of org.opengis.feature.simple.SimpleFeatureType

        // first create a query that restricts the attributes returned.  Since we just want the FID then we don't need
        // any attributes because that is not an attribute it part of the Feature itself.
        // also use the Layer.getFilter() method to return the selected features.
        // the new String[0] parameter indicates that we don't want any attributes.  We could have put an attribute/column
        // name to indicate the attributes that we want.
        SimpleFeatureType schema = layer.getSchema();
    String typeName = schema.getTypeName();
    Filter selected = layer.getFilter();
    Query query = new DefaultQuery(typeName, selected, Query.ALL_NAMES );
       
        FeatureSource<SimpleFeatureType,SimpleFeature> featureSource =
          layer.getResource(FeatureSource.class, new SubProgressMonitor(monitor, 1));
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

                    }
                }
               
                startLoading();
               
                SimpleFeatureType schema = newFeatures.getSchema();
                FeatureIterator<SimpleFeature> iter=newFeatures.features();
                try{
                    boolean featuresWereAdded=false;
                    while( iter.hasNext() ){
                        if( monitor.isCanceled() )
                            break;
                        SimpleFeature newValue = iter.next();
                        SimpleFeature oldValue = findFeature(newValue.getID());
                        if( oldValue==null ){
                            featuresWereAdded=true;
                            features.add(newValue);
                            lookup.put(newValue.getID(), newValue);
                        }else{
                            for( int i = 0; i < schema.getAttributeCount(); i++ ) {
                                oldValue.setAttribute(i, newValue.getAttribute(i));
                            }
                        }
                        loaded++;
                        updateMonitor(loaded+Messages.FeatureTableContentProvider_updatingFeatures);
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        // this method returns a string
        Vector<Hashtable<String,Object>> vec = (Vector<Hashtable<String,Object>>)geocoder.execute("geocode", params); //$NON-NLS-1$
        System.out.println("vec"+vec); //$NON-NLS-1$

        List<String> keys = keys( vec );
        SimpleFeatureType ADDRESS = createAddressType( keys );
       
        List<SimpleFeature> places = new ArrayList<SimpleFeature>( vec.size() );

        int count=1;
        for( Hashtable table : vec ){
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

            public void widgetSelected(SelectionEvent e) {
                String attributeName = attribute.getText();

                // populate values based on this attribute
                if (attributeName != null && getInput() != null && getInput().getSchema() != null) {
                    SimpleFeatureType schema = getInput().getSchema();
                    AttributeDescriptor descriptor = schema.getDescriptor(attributeName);

                    SortedSet<String> suggestedValues = generateSuggestedValues(descriptor);

                    value.removeAll();
                    if (suggestedValues.isEmpty()) {
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        attrValues[0] = "value0"; //$NON-NLS-1$
        attrValues[1] = "value1"; //$NON-NLS-1$
        attrValues[2] = "value2"; //$NON-NLS-1$
        attrValues[3] = "value3"; //$NON-NLS-1$

        SimpleFeatureType ft = DataUtilities.createType("myLineType", "*geom:LineString,name:String"); //$NON-NLS-1$ //$NON-NLS-2$
        ft = DataUtilities.createSubType(ft, null, DefaultEngineeringCRS.CARTESIAN_2D);
        SimpleFeature[] features = new SimpleFeature[4];
        // add lines
        features[0] = SimpleFeatureBuilder.build(ft,new Object[]{line[0], attrValues[0]}, Integer.toString(0));
        features[1] = SimpleFeatureBuilder.build(ft,new Object[]{line[1], attrValues[1]}, Integer.toString(1));
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

     *
     * @param element
     * @return 0 for a perfect match,
     */
    public int matches( Object element ) {
      SimpleFeatureType schema = null;
      if (element instanceof SimpleFeature) {
          schema = ((SimpleFeature) element).getFeatureType();
      } else if (element instanceof SimpleFeatureType) {
          schema = (SimpleFeatureType) element;
      } else if(element instanceof IAdaptable) {
        IAdaptable adaptable = (IAdaptable) element;
        if(adaptable.getAdapter(SimpleFeatureType.class) != null) {
          schema = (SimpleFeatureType) adaptable.getAdapter(SimpleFeatureType.class);
        } else if(adaptable.getAdapter(SimpleFeature.class) != null) {
          schema = ((SimpleFeature) adaptable.getAdapter(SimpleFeatureType.class)).getFeatureType();
        }
      }

        if (schema != null) {
            Name featureName = schema.getName();
            if (namespace != null) {

                if (namespace.compareTo(URI.create(featureName.getNamespaceURI())) == 0
                        && typeName.equals(featureName.getLocalPart())) {
                    return PERFECT;
                }
                return NO_MATCH;
            }
            if (attributes.length == 0) {
                return NO_MATCH;
            }
            int accuracy = 0;
            accuracy++;
            List<AttributeDescriptor> matched = new ArrayList<AttributeDescriptor>();
            // 1st pass check all named attributes are accounted for
            for( AttributeMatcher current : attributes ) {
                if (current.name == null) {
                    continue; // skip
                }
                AttributeDescriptor currentMatch = current.match(schema, matched);
                if (currentMatch == null) {
                    return NO_MATCH;
                }
                matched.add(currentMatch);
            }
            // section pass check unnamed attributes ... match default geometry type?
            for( AttributeMatcher current : attributes ) {
                if (current.name != null) {
                    continue;
                }
                accuracy++;

                AttributeDescriptor currentMatch = current.match(schema, matched);
                if (currentMatch == null) {
                    return NO_MATCH;
                }
                matched.add(currentMatch);
            }
            accuracy += schema.getAttributeCount() - matched.size();
            return accuracy;
        }
        return NO_MATCH;
    }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

    public void op( final Display display, Object target, IProgressMonitor monitor ) throws Exception {

        final ILayer layer = (ILayer) target;
        SimpleFeatureSource source = (SimpleFeatureSource) layer.getResource(FeatureSource.class, new NullProgressMonitor());

        SimpleFeatureType schema = source.getSchema();
        GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
        IViewportModel viewportModel = ApplicationGIS.getActiveMap().getViewportModel();
        ReferencedEnvelope bounds = viewportModel.getBounds();
        CoordinateReferenceSystem dataCrs = schema.getCoordinateReferenceSystem();
       
        ReferencedEnvelope newBounds = bounds.transform(dataCrs, true);
       
        String name = geometryDescriptor.getLocalName();
        Filter bboxFilter = getBboxFilter(name, newBounds);
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        // this is purposely no implemented
        return null;
    }

    public static Style createDefaultStyle( Layer layer ) {
        SimpleFeatureType schema = layer.getSchema();
        return createDefaultStyle(schema);
    }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

                for( Layer targetLayer : getMap().getLayersInternal() ){
                    //make hole filter for target layer
                    if( targetLayer == layer ){
                        continue; // skip the source layer (because that would be silly)
                    }
                    SimpleFeatureType targetType = targetLayer.getSchema();
                    if( targetType == null ){
                        // must be a grid coverage or something
                        continue;
                    }
                    String targetGeomName = targetType.getGeometryDescriptor().getLocalName();
   
                    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2( GeoTools.getDefaultHints() );
                    Filter cut= ff.not( ff.within( ff.property( targetGeomName ), ff.literal(hole) ) );
                   
                    //put it on style blackboard
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

                }
            }
            if (expression instanceof PropertyName) {
                PropertyName name = (PropertyName) expression;
                if( input != null && input.getSchema() != null ){
                    SimpleFeatureType schema = input.getSchema();
                    AttributeDescriptor descriptor = schema.getDescriptor(name.getPropertyName());
                    if (descriptor != null) {
                        Class<?> binding = descriptor.getType().getBinding();
                        if (Number.class.isAssignableFrom(binding)) {
                            return Appropriate.APPROPRIATE.getScore();
                        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.