Package org.opengis.feature.type

Examples of org.opengis.feature.type.AttributeDescriptor


    private List<String> obtainQueryAttributesForFeatureTable( final SimpleFeatureType schema ) {
        final List<String> queryAtts=new ArrayList<String>();
       
        for( int i = 0; i < schema.getAttributeCount(); i++ ) {
            AttributeDescriptor attr = schema.getDescriptor(i);
            if( !(attr instanceof GeometryDescriptor) ){
                queryAtts.add(attr.getName().getLocalPart());
            }
        }
        return queryAtts;
    }
View Full Code Here


        SimpleFeatureType schema = features.getSchema();
        org.eclipse.jface.viewers.CellEditor[] editors = new org.eclipse.jface.viewers.CellEditor[schema
                .getAttributeCount() + 1];

        for( int i = 0; i < schema.getAttributeCount(); i++ ) {
            AttributeDescriptor aType = schema.getDescriptor(i);
            Class< ? extends Object> concreteType = aType.getType().getBinding();
            Composite control = (Composite) tableViewer.getControl();
            if (concreteType.isAssignableFrom(String.class)) {
                BasicTypeCellEditor textCellEditor = new BasicTypeCellEditor(control, String.class);
                editors[i + 1] = textCellEditor;
            } else if (concreteType.isAssignableFrom(Integer.class)) {
View Full Code Here

            column.addListener(SWT.Selection, new AttributeColumnSortListener(this,
                    FEATURE_ID_COLUMN_PROPERTY));

            for( int i = 0; i < schema.getAttributeCount(); i++ ) {
                AttributeDescriptor aType = schema.getDescriptor(i);
                column = new TableColumn(table, SWT.CENTER | SWT.BORDER);
                if (Geometry.class.isAssignableFrom(aType.getType().getBinding())) { // was
                                                                                     // aType.isGeometry()
                    // jg: wot is this maddness? jd: paul said so
                    column.setText("GEOMETRY"); //$NON-NLS-1$
                } else
                    column.setText(aType.getName().getLocalPart());

                layout.addColumnData(new ColumnWeightData(1, 100, true));
                column.setMoveable(true);

                column.addListener(SWT.Selection, new AttributeColumnSortListener(this, aType
                        .getName().getLocalPart()));
            }

        }
    }
View Full Code Here

            } else {
                // we have to look through all the source attributes looking for a geometry that
                // matches.
                boolean found = false;
                for( int i = 0; i < sourceSchema.getAttributeCount(); i++ ) {
                    AttributeDescriptor source = sourceSchema.getDescriptor(i);
                    if (defaultGeometry.getType().getBinding().isAssignableFrom(source.getType().getBinding())) {
                        queryAttributes.put(defaultGeometry.getName().getLocalPart(), source.getName().getLocalPart());
                        found = true;
                        break;
                    }
                }
                // ok so we're going to have to do some transformations. Match default geometries
View Full Code Here

     * Maps attributes with the same name and same types to each other.
     */
    @SuppressWarnings("unchecked")
    private static void performDirectMapping( SimpleFeatureType sourceSchema, SimpleFeatureType targetSchema, Map<String, String> queryAttributes ) {
        for( int i = 0; i < sourceSchema.getAttributeCount(); i++ ) {
            AttributeDescriptor source = sourceSchema.getDescriptor(i);
            for( int j = 0; j < targetSchema.getAttributeCount(); j++ ) {
                AttributeDescriptor target = targetSchema.getDescriptor(j);

                // don't worry about case of attribute name
                if (target.getName().getLocalPart().equalsIgnoreCase(source.getName().getLocalPart())
                        && target.getType().getBinding().isAssignableFrom(source.getType().getBinding())) {
                    queryAttributes.put(target.getName().getLocalPart(), source.getName().getLocalPart());
                }
            }
        }
    }
View Full Code Here

    private void loadWithAttributeTypes( StyleLayer selectedLayer ) {
        SimpleFeatureType featureType = selectedLayer.getSchema();
        if (featureType != null) {
            for( int i = 0; i < featureType.getAttributeCount(); i++ ) {
                AttributeDescriptor attributeType = featureType.getDescriptor(i);
                if (!(attributeType instanceof GeometryDescriptor)) { // don't include the geometry
                    if (isNumber(attributeType)) {
                        numericAttributeNames.add(attributeType.getName().getLocalPart());
                    } else if (isString(attributeType)) {
                        stringAttributeNames.add(attributeType.getName().getLocalPart());
                    }
                    allAttributeNames.add(attributeType.getName().getLocalPart());
                } else {
                    geometryPropertyName = attributeType.getName();
                }
            }
            // add none option
            numericAttributeNames.add(0, Utilities.NONE);
            allAttributeNames.add(0, Utilities.NONE);
View Full Code Here

        buf.append( type.getName().getNamespaceURI() );
        buf.append( ":" ); //$NON-NLS-1$
        buf.append( type.getName().getLocalPart() );
       
        for( int i=0; i<feature.getAttributeCount(); i++ ) {
            AttributeDescriptor attribute = type.getDescriptor( i );
            Object value = feature.getAttribute( i );
            buf.append( "\n" ); //$NON-NLS-1$
            buf.append( attribute.getName() );
            buf.append( " = " ); //$NON-NLS-1$
            if ( attribute instanceof GeometryDescriptor ) {
                buf.append( ((Geometry) value).getGeometryType() );
            }
            else {
View Full Code Here

            SimpleFeatureType schema = layer.getSchema();
            SummaryData schemaData=new SummaryData(Messages.LayerSummary_featureType, schema.getName().getLocalPart());
            SummaryData[] children=new SummaryData[schema.getAttributeCount()];
           
            for( int i = 0; i < children.length; i++ ) {
                AttributeDescriptor attributeType = schema.getDescriptor(i);
                children[i]=new SummaryData(attributeType.getLocalName(), attributeType.getType().getBinding().getSimpleName());
                children[i].setParent(schemaData);
                List<SummaryData> attTypeChildren=new ArrayList<SummaryData>();
                attTypeChildren.add(new SummaryData(Messages.LayerSummary_nillable, attributeType.isNillable()));
                attTypeChildren.get(0).setParent(children[i]);
                List<Filter> restrictions = attributeType.getType().getRestrictions();
                for (Filter filter : restrictions) {
                    SummaryData summaryData = new SummaryData(Messages.LayerSummary_restriction, filter);
                    attTypeChildren.add(summaryData);
                    summaryData.setParent(children[i]);
                }
                SummaryData summaryData = new SummaryData(Messages.LayerSummary_maxOccurs, attributeType.getMaxOccurs());
                attTypeChildren.add(summaryData);
                summaryData.setParent(children[i]);
                summaryData = new SummaryData(Messages.LayerSummary_minOccurs, attributeType.getMinOccurs());
                attTypeChildren.add(summaryData);
                summaryData.setParent(children[i]);

                children[i].setChildren(attTypeChildren.toArray(new SummaryData[0]));
            }
View Full Code Here

    public AttributeValidator( AttributeDescriptor attributeType, SimpleFeatureType featureType) {
        this.attributeDescriptor = attributeType;
        this.featureType=featureType;
        values=new Object[featureType.getAttributeCount()];
        for( int i = 0; i < featureType.getAttributeCount(); i++ ) {
            AttributeDescriptor attributeType2 = featureType.getDescriptor(i);
            if( attributeType2==attributeType ){
                this.indexof=i;
            }
            values[i]=attributeType2.getDefaultValue();
        }
    }
View Full Code Here

                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

TOP

Related Classes of org.opengis.feature.type.AttributeDescriptor

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.