Examples of SimpleFeature


Examples of org.opengis.feature.simple.SimpleFeature

                    featureBuilder.add(s.stopName);
                    featureBuilder.add(s.stopCode);
                    featureBuilder.add(s.stopDesc);
                    featureBuilder.add(s.gtfsStopId);
                    featureBuilder.add(s.agency.name);
                    SimpleFeature feature = featureBuilder.buildFeature(null);
                    collection.add(feature)
              }
            }
            else if(gisExport.type.equals(GisUploadType.ROUTES))
            {
              dataStore.createSchema(ROUTE_TYPE);
              featureBuilder = new SimpleFeatureBuilder(ROUTE_TYPE);
             
                List<Route> routes = Route.find("agency in (:ids)").bind("ids", gisExport.agencies).fetch();
             
                // check for duplicates

                // HashMap<String, Boolean> existingRoutes = new HashMap<String,Boolean>();
               
              for(Route r : routes)
              {
//                String routeId = r.routeLongName + "_" + r.routeDesc + "_ " + r.phone.id;
//               
//                if(existingRoutes.containsKey(routeId))
//                  continue;
//                else
//                  existingRoutes.put(routeId, true);
               
               
                List<TripPattern> patterns = TripPattern.find("route = ?", r).fetch();
                for(TripPattern tp : patterns)
                  {
                  if(tp.shape == null)
                    continue;
               
                  featureBuilder.add(tp.shape.shape);
                  featureBuilder.add(tp.name);
                  featureBuilder.add(r.routeShortName);
                      featureBuilder.add(r.routeLongName);
                      featureBuilder.add(r.routeDesc);
                     
                      if(r.routeType != null)
                        featureBuilder.add(r.routeType.toString());
                      else
                        featureBuilder.add("");
                     
                      featureBuilder.add(r.routeUrl);
                      featureBuilder.add(r.routeColor);
                      featureBuilder.add(r.routeTextColor);
                      featureBuilder.add(r.agency.name);
                      SimpleFeature feature = featureBuilder.buildFeature(null);
                      collection.add(feature)
                  }
              }
            }
            else
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

        List<Geometry> geoms = new ArrayList<Geometry>();
        SimpleFeatureIterator featureIterator = featureCollection.features();

        while( featureIterator.hasNext() ) {
            SimpleFeature feature = featureIterator.next();
            Geometry geometry = (Geometry) feature.getDefaultGeometry();
            geoms.add(geometry.reverse());

        }

        GeometryFactory factory = new GeometryFactory();
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

        return attribute;
    }

    public void modify( Object element, String property, Object value ) {
        Item item=(Item) element;
        SimpleFeature feature=(SimpleFeature) item.getData();
        Object oldValue=feature.getAttribute(property);
        if( oldValue==null ){
            if( value==null )
                return;
            else
                makeModification(feature, layer, property, value, item);
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

                            }
                            getContext().sendASyncCommand(
                                    getContext().getSelectionFactory().createNoSelectCommand());
                            return;
                        }
                        SimpleFeature feature = iter.next();
                        getContext().sendASyncCommand(
                                getContext().getEditFactory().createSetEditFeatureCommand(feature,
                                        selectedLayer));
                        getContext().sendASyncCommand(
                                getContext().getSelectionFactory().createFIDSelectCommand(
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

            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

Examples of org.opengis.feature.simple.SimpleFeature

                        // wether to do a full table scan
                        // bounds = new ReferencedEnvelope(new Envelope(),crs);
                        // as a last resort do the full scan
                      FeatureIterator<SimpleFeature> r = fs.getFeatures().features();
                        try{
                        SimpleFeature f = r.next();

                        bounds = new ReferencedEnvelope(new Envelope(), crs);
                        bounds.init(f.getBounds());
                        for( ; r.hasNext(); ) {
                            f = r.next();
                            bounds.include(f.getBounds());
                        }
                        }finally{
                            r.close();
                        }
                    }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

     *
     * @param selection
     */
    public void showLocation( Object selection ){
        // selection should be an Feture (of some sort)
        SimpleFeature feature = (SimpleFeature) selection;
        Geometry geom = (Geometry) feature.getDefaultGeometry();
        Point point = geom.getCentroid();
       
        IMap imap = ApplicationGIS.getActiveMap();
        if( imap == ApplicationGIS.NO_MAP ) return;
       
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

    */
   protected IBaseLabelProvider createLabelProvider() {
       return new LabelProvider(){
           public String getText( Object element ) {
               if( element instanceof SimpleFeature ){
                   SimpleFeature feature = (SimpleFeature) element;
                   return feature.getID();
               }
               return super.getText(element);
            }
       };
   }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

        //       
        // final SimpleFeature newFeature = SimpleFeatureBuilder.build(type, attrs, "newFeature"
        // + new Random().nextInt());

        String proposedFid = "newFeature"+"newFeature" + new Random().nextInt();
        final SimpleFeature newFeature = SimpleFeatureBuilder.template(type, proposedFid );

        Class geomType = type.getGeometryDescriptor().getType().getBinding();
        Geometry geom = GeometryBuilder.create().safeCreateGeometry(geomType, coordinates);
        newFeature.setDefaultGeometry(geom);
        fid = newFeature.getID();

        SimpleFeature feature = new AdaptableFeature(newFeature, editLayer);
       
        runFeatureCreationInterceptors(feature);

        map.getEditManagerInternal().addFeature(newFeature, (Layer) editLayer);
    }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

        transform(coordCRS, destinationCRS, coordinates);
        Object[] attrs = new Object[type.getAttributeCount()];
        for( int i = 0; i < attrs.length; i++ ) {
            attrs[i] = setDefaultValue(type.getDescriptor(i));
        }
        final SimpleFeature newFeature = SimpleFeatureBuilder.build(type,attrs,null);
        // Class geomType = type.getDefaultGeometry().getType();

        T geom = GeometryBuilder.create().safeCreateGeometry(geomType, coordinates);
        newFeature.setDefaultGeometry(geom);

        return newFeature;
    }
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.