Examples of SimpleFeatureType


Examples of org.opengis.feature.simple.SimpleFeatureType

        && ((r.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator);
  }

  private FeatureCollection<SimpleFeatureType, SimpleFeature> createCollection(List<InternalFeature> features,
      VectorLayer layer, CoordinateReferenceSystem mapCrs, Style style) {
    SimpleFeatureType type = createFeatureType(layer, mapCrs);
    ListFeatureCollection result = new ListFeatureCollection(type);
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
    StyleAttributeExtractor extractor = new StyleAttributeExtractor();
    style.accept(extractor);
    Set<String> styleAttributeNames = extractor.getAttributeNameSet();
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

  protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    Object ff = model.get(RestController.FEATURE_COLLECTION);
    VectorLayerInfo info = (VectorLayerInfo) model.get(RestController.VECTOR_LAYER_INFO);
    List<String> attrs = (List<String>) model.get(RestController.ATTRIBUTES);
    SimpleFeatureType sft = convertorService.toSimpleFeatureType(info, attrs);
    response.setContentType(getContentType());
    if (Collection.class.isAssignableFrom(ff.getClass())) {
      Collection<InternalFeature> features = (Collection<InternalFeature>) ff;
      FeatureCollection<SimpleFeatureType, SimpleFeature> coll = new MemoryFeatureCollection(sft);
      for (InternalFeature feature : features) {
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

    securityManager.clearSecurityContext();
  }

  @Test
  public void testLayerBeanstoSimpleFeatureType() throws LayerException {
    SimpleFeatureType type = service.toSimpleFeatureType(layer.getLayerInfo());
    Assert.assertEquals("org.geomajas.layer.bean.FeatureBean", type.getName().getLocalPart());
    AttributeType doubleType = type.getType("doubleAttr");
    Assert.assertEquals(Double.class, doubleType.getBinding());
    Assert.assertEquals("doubleAttr", doubleType.getName().getLocalPart());
  }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

    Assert.assertEquals("doubleAttr", doubleType.getName().getLocalPart());
  }

  @Test
  public void testLayerBeansToSimpleFeature() throws GeomajasException {
    SimpleFeatureType type = service.toSimpleFeatureType(layer.getLayerInfo());
    List<InternalFeature> features = vectorLayerService.getFeatures("beans", null, filterService
        .createFidFilter(new String[] {"1"}), null, VectorLayerService.FEATURE_INCLUDE_ALL);
    Assert.assertEquals(1, features.size());
    SimpleFeature feature = service.toSimpleFeature(features.get(0), type);
    Assert.assertEquals("bean1", feature.getAttribute(0));
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

      params.put("create spatial index", Boolean.TRUE);
     
      ShapefileDataStore dataStore = (ShapefileDataStore)dataStoreFactory.createNewDataStore(params);
      dataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84);

          SimpleFeatureType STOP_TYPE = DataUtilities.createType(
                    "Stop",                
                    "location:Point:srid=4326," +
                    "name:String," +
                    "code:String," +
                    "desc:String," +
                    "id:String," +
                    "agency:String"    
            );
         
          SimpleFeatureType ROUTE_TYPE = DataUtilities.createType(
                    "Route",                   // <- the name for our feature type
                    "route:LineString:srid=4326," +
                    "patternName:String," +
                    "shortName:String," +
                    "longName:String," +
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

                    //searchWidget.setToolTipText(null);
                    Filter filter = (Filter) org.geotools.filter.text.cql2.CQL.toFilter( txt );
                    //updateLayerFilter( filter );
                   
                    FeatureSource<SimpleFeatureType, SimpleFeature> source = layer.getResource(FeatureSource.class, ProgressManager.instance().get());
                    SimpleFeatureType schema=source.getSchema();              
                    //FilterFactory fac=CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
                    //final List<String> queryAtts = obtainQueryAttributesForFeatureTable(schema);
                   
                    Set<String> required = (Set<String>) filter.accept( new FilterAttributeExtractor(), null );
                    String[] names = required.toArray( new String[ required.size()]);
                    final DefaultQuery query=new DefaultQuery(schema.getName().getLocalPart(), filter, names );
                   
                    FeatureCollection<SimpleFeatureType, SimpleFeature> features;
                    features = source.getFeatures( query ); // we just want the FeatureID no attributes needed
                   
                    //features = source.getFeatures( filter );
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

                }
                return;
            }
            // okay now we will do a query for everything in the added or modified bounds
            FeatureSource<SimpleFeatureType, SimpleFeature> source = notifierLayer.getResource(FeatureSource.class, ProgressManager.instance().get());
            SimpleFeatureType schema=source.getSchema();
           
            FilterFactory fac=CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
            final List<String> queryAtts = obtainQueryAttributesForFeatureTable(schema);
            final DefaultQuery query=new DefaultQuery(schema.getName().getLocalPart(), Filter.EXCLUDE, queryAtts.toArray(new String[0]));

            String name = schema.getGeometryDescriptor().getName().getLocalPart();
      // add new features
            if( addedBounds!=null ){
              double minx=addedBounds.getMinX();
        double miny=addedBounds.getMinY();
        double maxx=addedBounds.getMaxX();
        double maxy=addedBounds.getMaxY();
        String srs=CRS.lookupIdentifier(schema.getCoordinateReferenceSystem(), false);
        BBOX bboxFilter = fac.bbox(name, minx, miny, maxx, maxy, srs);
       
                query.setFilter(bboxFilter);
                FeatureCollection<SimpleFeatureType, SimpleFeature>  features = source.getFeatures(query);
                this.table.update(features);
            }
            // update modified features
            if( modifiedBounds!=null ){
              double minx=modifiedBounds.getMinX();
        double miny=modifiedBounds.getMinY();
        double maxx=modifiedBounds.getMaxX();
        double maxy=modifiedBounds.getMaxY();
        String srs=CRS.lookupIdentifier(schema.getCoordinateReferenceSystem(), false);
        BBOX bboxFilter = fac.bbox(name, minx, miny, maxx, maxy, srs);

                query.setFilter(bboxFilter);
                FeatureCollection<SimpleFeatureType, SimpleFeature>  features = source.getFeatures(query);
                this.table.update(features);
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

                composite.getFinalizerCommands().add(new SetEditingFlag(false));
                layer.getMap().sendCommandASync(composite);
            }
        };
       
        final SimpleFeatureType schema = notifierLayer.getSchema();
        Filter filter = Filter.INCLUDE;
        final  FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = notifierLayer.getResource(FeatureSource.class, null);
        final List<String> queryAtts = obtainQueryAttributesForFeatureTable(schema);

        //if the filter action is true, filter our results by the AOI service
        if(isAOIFilter()){
            filter = addAOIFilter(filter, schema.getCoordinateReferenceSystem());
        }
        final Query query = new DefaultQuery(schema.getName().getLocalPart(), filter, queryAtts.toArray(new String[0]));
        FeatureCollection<SimpleFeatureType, SimpleFeature>  featuresF = featureSource.getFeatures(query);       
        final FeatureCollection<SimpleFeatureType, SimpleFeature>  features = featuresF;
       
        Display.getDefault().asyncExec(new Runnable(){
            public void run() {
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

    }
    return bounds;
  }

  public CoordinateReferenceSystem getCRS() {
    SimpleFeatureType ft = getFeatureType();
    if(ft == null) {
      return DefaultGeographicCRS.WGS84;
    }
   
    return ft.getGeometryDescriptor().getCoordinateReferenceSystem();
  }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeatureType

  public String getName() {
    return owner.typename;
  }

  public URI getSchema() {
    SimpleFeatureType ft = getFeatureType();
    if (ft == null) return null;
   
    try {
      Name typeName = ft.getName();
      if (typeName.getNamespaceURI() != null) {
        return new URI(ft.getName().getNamespaceURI());
      } else {
        return null; // should probably be GML?
      }
    } catch (URISyntaxException e) {
      return null;
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.