Examples of SimpleFeatureType


Examples of org.opengis.feature.simple.SimpleFeatureType

     * Prepairs the geometry (srsName and default geometry name) prior setAttributeCommand.
     *
     * @see org.locationtech.udig.project.internal.command.MapCommand#run()
     */
    public void run( IProgressMonitor monitor ) throws Exception {
        SimpleFeatureType schema = editLayer.get(monitor).getSchema();
        GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
        if (xpath.equals(DEFAULT)){
            xpath = geometryDescriptor.getName().getLocalPart();
        }
        Geometry geometry = (Geometry) value;
        if( geometry.getUserData() == null ){
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        addSelectionListener(table);
        if (features instanceof IAdaptable
                && ((IAdaptable) features).getAdapter(ICellModifier.class) != null) {

            IAdaptable adaptable = (IAdaptable) features;
            SimpleFeatureType schema = features.getSchema();
            int attributeCount = schema.getAttributeCount();
            setCellEditors(adaptable, attributeCount);

            setCellValidators(adaptable);
            addCellEditorListeners(adaptable);
            tableViewer.setCellModifier((ICellModifier) adaptable.getAdapter(ICellModifier.class));

            String[] properties = new String[attributeCount + 1];
            for( int i = 0; i < properties.length; i++ ) {
                if (i == 0)
                    properties[i] = FEATURE_ID_COLUMN_PROPERTY;
                else {
                    properties[i] = schema.getDescriptor(i - 1).getName().getLocalPart();
                }
            }
            tableViewer.setColumnProperties(properties);
        }
        if (contextMenu != null) {
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        }
    }

    private void setCellValidators( IAdaptable adaptable ) {
        CellEditor[] editors = tableViewer.getCellEditors();
        SimpleFeatureType schema = features.getSchema();
        // offset is usually 1 but if the number of validators==number of attributes then the offset
        // is 0
        // because the first column is the FID column which doesn't have a listener.
        int offset = 1;

        ICellEditorValidator[] validators = null;
        if (adaptable.getAdapter(ICellEditorValidator[].class) != null) {
            validators = (ICellEditorValidator[]) adaptable
                    .getAdapter(ICellEditorValidator[].class);
            int attributeCount = features.getSchema().getAttributeCount();
            if (validators.length < attributeCount) {
                UiPlugin.log(
                        "not enough cell editors for feature type so not used", new Exception()); //$NON-NLS-1$
                validators = null;
            } else if (validators.length == attributeCount) {
                offset = 0;
            }
        }

        for( int i = 0; i < editors.length - offset; i++ ) {
            CellEditor editor = editors[i + offset];
            if (editor == null)
                continue;
            if (validators != null && validators[i] != null)
                editor.setValidator(validators[i]);
            else
                editor.setValidator(new AttributeValidator(schema.getDescriptor(i), schema));
        }
    }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        }
    }

    @SuppressWarnings("unchecked")
    private void createCellEditors() {
        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;
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

            TableColumn column = new TableColumn(table, SWT.CENTER | SWT.BORDER);
            column.setText(Messages.FeatureTableControl_1);
            layout.addColumnData(new ColumnWeightData(1));
        } else {

            SimpleFeatureType schema = features.getSchema();

            TableColumn column = new TableColumn(table, SWT.CENTER | SWT.BORDER);
            column.setText("FID"); //$NON-NLS-1$
            layout.addColumnData(new ColumnWeightData(1, 150, true));
            column.setMoveable(true);

            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$
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

        }
        return pattern;
    }

    private boolean searchFeature( SimpleFeature feature, Pattern pattern, String[] attributes ) {
        SimpleFeatureType featureType = feature.getFeatureType();
        if (attributes == ALL) {
            for( int i = 0; i < featureType.getAttributeCount(); i++ ) {
                if (matches(pattern, feature.getAttribute(i))) {
                    selectionProvider.getSelectionFids().add(feature.getID());
                    return true;
                }
            }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

     */
    private SimpleFeature findFirstFeature( ILayer layer, ReferencedEnvelope bbox )
            throws Exception {

        FeatureSource<SimpleFeatureType, SimpleFeature> source = layer.getResource(FeatureSource.class, null);
        SimpleFeatureType type = source.getSchema();
        CoordinateReferenceSystem crs = layer.getCRS();

        if (!bbox.getCoordinateReferenceSystem().equals(crs)) {
            bbox = bbox.transform(crs, true);
        }
        FilterFactory2 factory = (FilterFactory2) CommonFactoryFinder.getFilterFactory(GeoTools
                .getDefaultHints());
        Geometry geom = new GeometryFactory().toGeometry(bbox);
        Intersects filter = factory.intersects(factory.property(type.getGeometryDescriptor()
                .getName()), factory.literal(geom));

        layer.getQuery(false);
        final FeatureCollection<SimpleFeatureType, SimpleFeature> results = source
                .getFeatures(filter);
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

            if( ids.add( object.getID().toString() ) ){
                IGeoResource resource = object.findGeoResource(FeatureStore.class);
                if( resource!=null )
                    CatalogPlugin.getDefault().getLocalCatalog().addCatalogListener(new ObjectPropertyCatalogListener(object, resource, isEvaluating, this));
            }
        SimpleFeatureType schema = object.getSchema();
        if (schema == null || schema.getGeometryDescriptor() == null)
            return false;

        try {

            Class< ? extends Object> declared = parseValue(value);
            Class< ? extends Object> type = schema.getGeometryDescriptor().getType().getBinding();
            return type.isAssignableFrom(declared);
        } catch (ClassNotFoundException e) {
            return false;
        }
        }finally{
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

      FeaturePanelPageContributor target) {
    /**
     * Get the contributor id from the ITabbedPropertySheetPageContributor
     * interface
     */
    SimpleFeatureType key = target.getSchema();
    CacheData data = (CacheData) idToCacheData.get(key);
    if (data == null) {
      data = new CacheData();
      data.registry = new FeaturePanelRegistry(key);
      data.references = new ArrayList(5);
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

  public void disposeRegistry(FeaturePanelPageContributor target) {
    /**
     * Get the contributor id from the ITabbedPropertySheetPageContributor
     * interface
     */
    SimpleFeatureType key = target.getSchema();
    CacheData data = (CacheData) idToCacheData.get(key);
    if (data != null) {
      data.references.remove(target);
      if (data.references.isEmpty()) {
        idToCacheData.remove(key);
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.