Examples of AttributeDescriptor


Examples of org.opengis.feature.type.AttributeDescriptor

            } 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

Examples of org.opengis.feature.type.AttributeDescriptor

     * 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

Examples of org.opengis.feature.type.AttributeDescriptor

    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

Examples of org.opengis.feature.type.AttributeDescriptor

        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

Examples of org.opengis.feature.type.AttributeDescriptor

            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

Examples of org.opengis.feature.type.AttributeDescriptor

    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

Examples of org.opengis.feature.type.AttributeDescriptor

                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.type.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);
            }
View Full Code Here

Examples of org.opengis.feature.type.AttributeDescriptor

         * @return
         */
        public AttributeDescriptor match( SimpleFeatureType featureType,
                List<AttributeDescriptor> used ) {
            if (name != null) {
                AttributeDescriptor attr = featureType.getDescriptor(name);
                if (type == null || attr == null)
                    return null;
                if (type != attr.getType().getBinding())
                    return null;
                return attr;
            }
            for( int i = 0; i < featureType.getAttributeCount(); i++ ) {
                if (!used.contains(featureType.getDescriptor(i))) {
View Full Code Here

Examples of org.opengis.feature.type.AttributeDescriptor

        tableColumn.setText("FID"); //$NON-NLS-1$
        tableColumn.setWidth(100);

        if (fType != null) {
            for( int i = 0; i < fType.getAttributeCount(); i++ ) {
                AttributeDescriptor aType = fType.getDescriptor(i);
                if (table.getColumnCount() > i + 1) {
                    tableColumn = table.getColumn(i + 1);
                } else {
                    tableColumn = new TableColumn(table, SWT.CENTER | SWT.BORDER);
                }

                tableColumn.setText(aType.getLocalName());

                tableColumn.setWidth(100);
            }
            for( int i = fType.getAttributeCount() + 1; i < table.getColumnCount(); i++ ) {
                tableColumn = table.getColumn(i);
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.