Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureSource


                            schema = resource.resolve(SimpleFeatureType.class, monitor);
                        } catch (IOException e) {
                        }
                    }
                    if (resource.canResolve(SimpleFeatureSource.class)) {
                        SimpleFeatureSource featureSource;
                        try {
                            featureSource = resource.resolve(SimpleFeatureSource.class, monitor);
                            schema = featureSource != null ? featureSource.getSchema() : null;
                        } catch (IOException e) {
                        }
                    }
                    setSchema(schema);
                    Display display = getControl().getDisplay();
View Full Code Here


        if (adaptee.isAssignableFrom(IGeoResourceInfo.class))
            return adaptee.cast(createInfo(monitor));
        if (adaptee.isAssignableFrom(IGeoResource.class))
            return adaptee.cast(this);
        if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) {
            SimpleFeatureSource fs = parent.getDS().getFeatureSource( typename);
            if (fs instanceof SimpleFeatureStore){
                return adaptee.cast(fs);
            }
            if (adaptee.isAssignableFrom(SimpleFeatureSource.class)){
                return adaptee.cast(parent.getDS().getFeatureSource(typename));
View Full Code Here

      if (layer == null) return;
      if (style == null) return;
       
      if (layer.hasResource(FeatureSource.class)) {
        IGeoResource resource = layer.findGeoResource(FeatureSource.class);
        SimpleFeatureSource featureSource
          = resource.resolve(SimpleFeatureSource.class, m);
       
        if (featureSource != null) {
          //match up the feature type style name and the feature type name
          SimpleFeatureType type = featureSource.getSchema();
          FeatureTypeStyle fstyle = SLDs.featureTypeStyle(style,type);
          if (fstyle == null) {
            //force a name match
            List<FeatureTypeStyle> fstyles = style.featureTypeStyles();
            if (fstyles != null && !fstyles.isEmpty()) {
View Full Code Here

                return v.getCopy();
            }
        }
       
        if( resource.canResolve(FeatureSource.class) ){
            SimpleFeatureSource featureSource = null;
            try {
                featureSource = resource.resolve(SimpleFeatureSource.class, m);
            }
            catch (IOException e) {
                e.printStackTrace();
View Full Code Here

            return adaptee.cast(createInfo(monitor));

        if (adaptee.isAssignableFrom(SimpleFeatureSource.class)) {
            DataStore ds = parent.getDataStore(monitor);
            if (ds != null) {
                SimpleFeatureSource fs = ds.getFeatureSource(name);
                if (fs != null){
                    return adaptee.cast(fs);
                }
            }
        }
View Full Code Here

     * @return feature type
     */
    private SimpleFeatureType getSchema() {
        if (resource.canResolve(SimpleFeatureSource.class)) {
            try {
                final SimpleFeatureSource featureSource = resource.resolve(
                        SimpleFeatureSource.class, new NullProgressMonitor());
                return featureSource.getSchema();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
View Full Code Here

public class SelectAllFeaturesOp implements IOp {

    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();
       
View Full Code Here

                                .getHandle(), query.getMaxFeatures(), query
                                .getNamespace(), query.getPropertyNames(),
                                typeName);
                    }
                    // provide our own default view wrapper (will be required in GeoTools 2.7)
                    SimpleFeatureSource view = new DefaultView((SimpleFeatureSource) resource, query);
                   
                    // check that view is of the requested type
                    if (requestedType.isInstance(view)){
                        return view;
                    } else {
View Full Code Here

*/
public class ViewFeatureOrientation implements IOp {

    public void op( final Display display, Object target, IProgressMonitor monitor ) throws Exception {
        ILayer selectedLayer = (ILayer) target;
        SimpleFeatureSource featureSource = (SimpleFeatureSource) selectedLayer.getResource(FeatureSource.class,
                new SubProgressMonitor(monitor, 1));
        if (featureSource == null) {
            return;
        }
        GeometryDescriptor geometryDescriptor = featureSource.getSchema().getGeometryDescriptor();
        ReferencedEnvelope bounds = ApplicationGIS.getActiveMap().getViewportModel().getBounds();
        CoordinateReferenceSystem mapCrs = bounds.getCoordinateReferenceSystem();
       
        ReferencedEnvelope featureBounds = featureSource.getBounds();
        if (featureBounds == null || featureBounds.isNull()){
            return;
        }
        CoordinateReferenceSystem featureCrs = featureBounds.getCoordinateReferenceSystem();
        ReferencedEnvelope tBounds = bounds.transform(featureCrs, true);
       
        boolean crsEqual = CRS.equalsIgnoreMetadata(featureCrs, mapCrs);
        MathTransform mathTransform = CRS.findMathTransform(featureCrs, mapCrs, true);
       
        String name = geometryDescriptor.getLocalName();
        Filter bboxFilter = getBboxFilter(name, tBounds);
        SimpleFeatureCollection featureCollection = featureSource.getFeatures(bboxFilter);

        FeatureIterator<SimpleFeature> featureIterator = featureCollection.features();
        IViewportModel viewPort = ApplicationGIS.getActiveMap().getViewportModel();
        List<AbstractDrawCommand> commands = new ArrayList<AbstractDrawCommand>();
        while( featureIterator.hasNext() ) {
View Full Code Here

public class ReverseFeatureOrientation extends OperationUtils implements IOp {

    private int count = 0;
    public void op( final Display display, Object target, IProgressMonitor monitor ) throws Exception {
        ILayer selectedLayer = (ILayer) target;
        SimpleFeatureSource featureSource = (SimpleFeatureSource) selectedLayer.getResource(FeatureSource.class,
                new SubProgressMonitor(monitor, 1));
        if (featureSource == null) {
            return;
        }
        SimpleFeatureCollection featureCollection = featureSource.getFeatures(selectedLayer.getQuery(true));
        SimpleFeatureIterator featureIterator = featureCollection.features();
        EditCommandFactory cmdFactory = EditCommandFactory.getInstance();
        List<UndoableMapCommand> cmdList = new LinkedList<UndoableMapCommand>();
        count = 0;
        while( featureIterator.hasNext() ) {
View Full Code Here

TOP

Related Classes of org.geotools.data.simple.SimpleFeatureSource

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.