Examples of SimpleFeature


Examples of org.opengis.feature.simple.SimpleFeature

    Assert.assertNotNull(created);
  }

  @Test
  public void testDelete() throws Exception {
    SimpleFeature f = (SimpleFeature) layer.read(LAYER_NAME + ".4"); // id always starts with layer id
    Assert.assertNotNull(f);
    layer.delete(LAYER_NAME + ".4"); // id always starts with layer id
    Assert.assertTrue(true);
  }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

        if (isWithInScale(rule, scaleDenominator)) {
          FeatureIterator<SimpleFeature> it;
          try {
            it = featureLayer.getSimpleFeatureSource().getFeatures().features();
            while (it.hasNext()) {
              SimpleFeature feature = it.next();
              if (rule.isElseFilter() || rule.getFilter() == null) {
                rules.add(rule);
                break;
              } else if (rule.getFilter().evaluate(feature)) {
                rules.add(rule);
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

  }

  public Object create(Object feature) throws LayerException {
    String id = featureModel.getId(feature);
    if (id != null && !features.containsKey(id)) {
      SimpleFeature realFeature = asFeature(feature);
      features.put(id, realFeature);
      return realFeature;
    }
    return null;
  }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

          geoService.getSridFromCrs(layerInfo.getCrs()), converterService);
      featureModel.setLayerInfo(layerInfo);
      FeatureCollection<SimpleFeatureType, SimpleFeature> col = getFeatureSource().getFeatures();
      FeatureIterator<SimpleFeature> iterator = col.features();
      while (iterator.hasNext()) {
        SimpleFeature feature = iterator.next();
        String id = featureModel.getId(feature);
        features.put(id, feature);
        int intId = Integer.parseInt(id.substring(id.lastIndexOf('.') + 1));
        if (intId > nextId) {
          nextId = intId;
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

  public Attribute getAttribute(Object feature, String name) throws LayerException {
    return convertAttribute(asFeature(feature).getAttribute(name), name);
  }

  public Map<String, Attribute> getAttributes(Object feature) throws LayerException {
    SimpleFeature f = asFeature(feature);
    HashMap<String, Attribute> attribs = new HashMap<String, Attribute>();
    for (AttributeInfo attributeInfo : attributeInfoMap.values()) {
      String name = attributeInfo.getName();
      attribs.put(name, convertAttribute(f.getAttribute(name), name));
    }
    return attribs;
  }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

  public String getGeometryAttributeName() throws LayerException {
    return getSchema().getGeometryDescriptor().getLocalName();
  }

  public String getId(Object feature) throws LayerException {
    SimpleFeature featureAsFeature = asFeature(feature);
    return featureAsFeature.getID();
  }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

      throw new LayerException(e);
    }
  }

  public Map<String, Attribute> getAttributes(Object feature) throws LayerException {
    SimpleFeature f = asFeature(feature);
    HashMap<String, Attribute> attribs = new HashMap<String, Attribute>();
    for (Map.Entry<String, AttributeInfo> entry : attributeInfoMap.entrySet()) {
      String name = entry.getKey();
      try {
        attribs.put(name, converterService.toDto(f.getAttribute(name), entry.getValue()));
      } catch (GeomajasException e) {
        throw new LayerException(e);
      }
    }
    return attribs;
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

  public String getGeometryAttributeName() throws LayerException {
    return getSchema().getGeometryDescriptor().getLocalName();
  }

  public String getId(Object feature) throws LayerException {
    SimpleFeature realFeature = asFeature(feature);
    return realFeature.getID();
  }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

  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));
    Assert.assertEquals(true, feature.getAttribute(1));
  }
View Full Code Here

Examples of org.opengis.feature.simple.SimpleFeature

              boolean lenient = true; // allow for some error due to different datums
              MathTransform transform = CRS.findMathTransform(dataCRS, mapCRS, lenient);
             
              while (featureIterator.hasNext())
              {
                SimpleFeature feature = featureIterator.next();
   
                GeometryType geomType = feature.getFeatureType().getGeometryDescriptor().getType();
               
                // handle appropriate shape/upload type
                if(gisUpload.type == GisUploadType.ROUTES)
                { 
                  if(geomType.getBinding() != MultiLineString.class)
                  {
                    Logger.error("Unexpected geometry type: ", geomType);
                    continue;
                  }
               
                  MultiLineString multiLineString = (MultiLineString)JTS.transform((Geometry)feature.getDefaultGeometry(), transform);
                 
               
                  GisRoute route = new GisRoute();
                   
                    route.gisUpload = gisUpload;
                    route.agency = gisUpload.agency;
                    route.oid = feature.getID();
                    route.originalShape = multiLineString;
                    route.originalShape.setSRID(4326);
                   
                    if(gisUpload.fieldName != null)
                  {
                    FeatureAttributeFormatter attribFormatter = new FeatureAttributeFormatter(gisUpload.fieldName);
                    route.routeName =  attribFormatter.format(feature);
                   
                  }
                  if(gisUpload.fieldId != null)
                {
                  FeatureAttributeFormatter attribFormatter = new FeatureAttributeFormatter(gisUpload.fieldId);
                  route.routeId =  attribFormatter.format(feature);
                }
                if(gisUpload.fieldDescription != null)
                {
                  FeatureAttributeFormatter attribFormatter = new FeatureAttributeFormatter(gisUpload.fieldDescription);
                  route.description =  attribFormatter.format(feature);
                }
                 
                  route.save();
                 
                  route.processSegments();
                 
                   }
                else if(gisUpload.type == GisUploadType.STOPS)
                {
                  if(geomType.getBinding() != Point.class)
                  {
                    Logger.error("Unexpected geometry type: ", geomType);
                    continue;
                  }
               
                  GisStop stop = new GisStop();
                   
                  stop.gisUpload = gisUpload;
                  stop.agency = gisUpload.agency;
                  stop.oid = feature.getID();
                  stop.shape = (Point)JTS.transform((Geometry)feature.getDefaultGeometry(), transform);
                  stop.shape.setSRID(4326);
                   
                  if(gisUpload.fieldName != null)
                  {
                    FeatureAttributeFormatter attribFormatter = new FeatureAttributeFormatter(gisUpload.fieldName);
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.