Package org.opengis.feature.simple

Examples of org.opengis.feature.simple.SimpleFeature


                MultiLineString multiLineString = gF.createMultiLineString(new LineString[]{reprojectLineString});

                SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
                Object[] values = new Object[]{multiLineString, startDate, endDate, log.text};
                builder.addAll(values);
                SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + index++);

                newCollection.add(feature);
                pm.worked(1);
            }
            pm.done();

            ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory();
            Map<String, Serializable> params = new HashMap<String, Serializable>();
            params.put("url", outputLinesShapeFile.toURI().toURL());
            params.put("create spatial index", Boolean.TRUE);
            ShapefileDataStore dStore = (ShapefileDataStore) factory.createNewDataStore(params);
            dStore.createSchema(featureType);
            dStore.forceSchemaCRS(mapCrs);

            JGrassToolsPlugin.getDefault().writeToShapefile(dStore, newCollection);

            JGrassToolsPlugin.getDefault().addServiceToCatalogAndMap(outputLinesShapeFile.getAbsolutePath(), true, true,
                    new NullProgressMonitor());

        } catch (Exception e1) {
            JGrassToolsPlugin.log(e1.getLocalizedMessage(), e1);
            e1.printStackTrace();
        }
        /*
         * create the points shapefile
         */

        File outputPointsShapeFile = new File(outputFolderFile, "gpspoints.shp");

        b = new SimpleFeatureTypeBuilder();
        b.setName("geopaparazzinotes");
        b.setCRS(mapCrs);
        b.add("the_geom", Point.class);
        b.add("ALTIMETRY", String.class);
        b.add("DATE", String.class);
        featureType = b.buildFeatureType();

        try {
            MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);

            pm.beginTask("Import gps to points...", logsList.size());
            DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
            int index = 0;
            for( GpsLog log : logsList ) {
                List<GpsPoint> gpsPointList = log.points;
                for( GpsPoint gpsPoint : gpsPointList ) {
                    Coordinate c = new Coordinate(gpsPoint.lon, gpsPoint.lat);
                    Point point = gF.createPoint(c);

                    Point reprojectPoint = (Point) JTS.transform(point, transform);
                    Object[] values = new Object[]{reprojectPoint, String.valueOf(gpsPoint.altim), gpsPoint.utctime};

                    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
                    builder.addAll(values);
                    SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + index++);
                    newCollection.add(feature);
                }
                pm.worked(1);
            }
            pm.done();
View Full Code Here


                    String dateTime = dateString + timeString;
                    Object[] values = new Object[]{reprojectPoint, String.valueOf(altim), dateTime, azimuth, imageRelativePath};

                    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
                    builder.addAll(values);
                    SimpleFeature feature = builder.buildFeature(null);
                    newCollection.add(feature);
                }
                pm.worked(1);
            }
View Full Code Here

                            // as a last resort do the full scan
                            bounds = new ReferencedEnvelope(new Envelope(), crs);
                            FeatureIterator<SimpleFeature> iter = source.getFeatures().features();
                            try {
                                while( iter.hasNext() ) {
                                    SimpleFeature element = iter.next();
                                    if (bounds.isNull())
                                        bounds.init(element.getBounds());
                                    else
                                        bounds.include(element.getBounds());
                                }
                            } finally {
                                iter.close();
                            }
                        }
View Full Code Here

        if (isEditLayerLocked() && (layer != editLayerInternal && editLayerInternal != null)) {
            throw new IllegalArgumentException(
                    "Edit Layer is locked so argument 'layer' should be not be changed."); //$NON-NLS-1$
        }
        SimpleFeature value = getAdaptableFeature(feature, layer);
        SimpleFeature oldFeature = editFeature;
        if (editFeature != null) {
            editFeature = null;
        }
        if (value != null) {
            editFeature = value;
View Full Code Here

     * @throws IOException
     */
    @SuppressWarnings("unchecked")
    public void addFeature(final SimpleFeature feature, Layer layer) throws IOException {

        SimpleFeature adaptableFeature = feature;
        if (!(feature instanceof IAdaptable)) {
            adaptableFeature = new AdaptableFeature(feature, layer);
        }
        // TODO FeatureInterceptor

        final SimpleFeature finalFeature = adaptableFeature;
        // setEditFeature(feature, layer);

        FeatureStore<SimpleFeatureType, SimpleFeature> store = layer.getResource(
                FeatureStore.class, null);
        FeatureCollection<SimpleFeatureType, SimpleFeature> c = new org.geotools.feature.collection.AdaptorFeatureCollection(
View Full Code Here

            FeatureStore resource = editLayer.getResource(FeatureStore.class, null);
            Set<Identifier> fids = FeatureUtils.stringToId(filterFactory, getEditFeature().getID());
            Id filter = filterFactory.id(fids);
            FeatureIterator<SimpleFeature> features = resource.getFeatures(filter).features();
            if (features.hasNext()) {
                SimpleFeature feature = features.next();
                setEditFeature(feature, editLayer);
            } else {
                setEditFeature(null, editLayer);
            }
View Full Code Here

            owningFeatureTableControl.getViewer().replace(FeatureTableControl.LOADING, 0);
        } else {
            int resolvedIndex=index;
            if( owningFeatureTableControl.getViewer().getTable().getSortDirection()==SWT.UP )
                resolvedIndex=features.size()-index-1;
            SimpleFeature feature = features.get(resolvedIndex);
            owningFeatureTableControl.getViewer().replace(feature, index);
        }
    }
View Full Code Here

    public void assertInternallyConsistent(){
        if( features.size()!=lookup.size())
            throw new AssertionError("lookup table has "+lookup.size()+" features while feature list has "+features.size()+" features"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
       
        for( SimpleFeature feature : features ) {
            SimpleFeature lookupFeature = lookup.get(feature.getID());
            if( lookup==null ){
                throw new AssertionError("Lookup table is missing "+feature); //$NON-NLS-1$
            }
            if( lookupFeature!=feature )
                throw new AssertionError("Lookup table contains: "+lookupFeature+" while feature list contains"+feature+".  They are" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
View Full Code Here

            @SuppressWarnings("unchecked")
            public void run() {
                Collection<String> selectionFids = owningFeatureTableControl.getSelectionProvider().getSelectionFids();
               
                for( Iterator<SimpleFeature> iter = features.iterator(); iter.hasNext(); ) {
                    SimpleFeature feature =  iter.next();
                    if( selectionFids.contains(feature.getID()) ){
                        deletedFeatures.add(feature);
                        iter.remove();
                        lookup.remove(feature.getID());
                    }
                }
               
                selectionFids.clear();
                owningFeatureTableControl.getViewer().getTable().clearAll();
View Full Code Here

                        start = System.currentTimeMillis();
                        updateMonitor(i, monitorUpdate);
                    }
                    if (cancel())
                        return;
                    SimpleFeature next = iterator.next();
                    features.add(next);
                    lookup.put(next.getID(), next);
                    i++;
                }
            } catch (OutOfMemoryError error) {
                error(input, i + " " + Messages.FeatureTableContentProvider_outOfMemory, true); //$NON-NLS-1$
                UiPlugin.log("Out of memory error in table view", error); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.opengis.feature.simple.SimpleFeature

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.