Examples of FeatureInfo


Examples of org.geomajas.configuration.FeatureInfo

  @Before
  public void init() throws Exception {
    layer = (GeoToolsLayer) applicationContext.getBean("test", VectorLayer.class);

    FeatureInfo ft = new FeatureInfo();
    ft.setDataSourceName(LAYER_NAME);

    PrimitiveAttributeInfo ia = new PrimitiveAttributeInfo();
    ia.setLabel("id");
    ia.setName("Id");
    ia.setType(PrimitiveType.STRING);
    ft.setIdentifier(ia);

    GeometryAttributeInfo ga = new GeometryAttributeInfo();
    ga.setName("the_geom");
    ga.setEditable(false);
    ft.setGeometryType(ga);

    List<AttributeInfo> attr = new ArrayList<AttributeInfo>();
    PrimitiveAttributeInfo pa = new PrimitiveAttributeInfo();
    pa.setLabel("Name");
    pa.setName("NAME");
    pa.setEditable(false);
    pa.setIdentifying(true);
    pa.setType(PrimitiveType.STRING);

    attr.add(pa);
    ft.setAttributes(attr);

    VectorLayerInfo layerInfo = new VectorLayerInfo();
    layerInfo.setFeatureInfo(ft);
    layerInfo.setCrs("EPSG:4326");
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

    ListFeatureCollection result = new ListFeatureCollection(type);
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
    StyleAttributeExtractor extractor = new StyleAttributeExtractor();
    style.accept(extractor);
    Set<String> styleAttributeNames = extractor.getAttributeNameSet();
    FeatureInfo featureInfo = layer.getLayerInfo().getFeatureInfo();
    for (InternalFeature internalFeature : features) {
      // 2 more attributes : geometry + style attribute
      Object[] values = new Object[internalFeature.getAttributes().size() + 2];
      int i = 0;
      for (AttributeInfo attrInfo : featureInfo.getAttributes()) {
        String name = attrInfo.getName();
        if (styleAttributeNames.contains(name)) {
          values[i++] = internalFeature.getAttributes().get(name).getValue();
        } else {
          values[i++] = null;
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

    return filteredAttributes;
  }

  private Map<String, Attribute> getAttributes(VectorLayer layer, Object featureBean) throws LayerException {
    FeatureModel featureModel = layer.getFeatureModel();
    FeatureInfo featureInfo = layer.getLayerInfo().getFeatureInfo();
    String geometryAttributeName = featureInfo.getGeometryType().getName();
    boolean lazy = layer instanceof VectorLayerLazyFeatureConversionSupport &&
        ((VectorLayerLazyFeatureConversionSupport) layer).useLazyFeatureConversion();

    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    for (AttributeInfo attribute : featureInfo.getAttributes()) {
      String name = attribute.getName();
      if (!name.equals(geometryAttributeName)) {
        Attribute value;
        if (lazy) {
          // need to use the correct lazy type to allow instanceof to work
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

    builder = new SimpleFeatureBuilder(getSchema());
    this.converterService = converterService;
  }

  public void setLayerInfo(VectorLayerInfo vectorLayerInfo) throws LayerException {
    FeatureInfo featureInfo = vectorLayerInfo.getFeatureInfo();
    for (AttributeInfo info : featureInfo.getAttributes()) {
      attributeInfoMap.put(info.getName(), info);
    }
  }
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

  private Style createNamedStyle(VectorLayer layer, VectorLayerRasterizingInfo vectorLayerRasterizingInfo)
      throws GeomajasException {
    Style style = styleBuilder.createStyle();
    String typeName = layer.getLayerInfo().getFeatureInfo().getDataSourceName();
    FeatureInfo featureInfo = layer.getLayerInfo().getFeatureInfo();
    LayerType layerType = layer.getLayerInfo().getLayerType();

    if (vectorLayerRasterizingInfo.isPaintGeometries()) {
      // apply the normal styles
      List<Rule> rules = new ArrayList<Rule>();
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

    this.converterService = converterService;
  }

  public void setLayerInfo(VectorLayerInfo vectorLayerInfo) throws LayerException {
    this.vectorLayerInfo = vectorLayerInfo;
    FeatureInfo featureInfo = vectorLayerInfo.getFeatureInfo();
    for (AttributeInfo info : featureInfo.getAttributes()) {
      attributeInfoMap.put(info.getName(), info);
    }
  }
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

    Assert.assertEquals("Test beans", layer.getLabel());
    Assert.assertTrue(layer.getLayerInfo() instanceof VectorLayerInfo);
    VectorLayerInfo vectorLayerInfo = ((VectorLayerInfo)layer.getLayerInfo());
    Assert.assertEquals("EPSG:4326", vectorLayerInfo.getCrs());
    Assert.assertNotNull(vectorLayerInfo.getFeatureInfo());
    FeatureInfo featureInfo = vectorLayerInfo.getFeatureInfo();
    List<AttributeInfo> attributes = featureInfo.getAttributes();
    Assert.assertNotNull(attributes);
    Assert.assertEquals(1, attributes.size());
    Assert.assertEquals("stringAttr", attributes.get(0).getName());
  }
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

      throws LayerException {
    if (entity == null) {
      return null;
    }
    PrimitiveAttributeInfo idInfo = associationAttributeInfo.getFeature().getIdentifier();
    FeatureInfo childInfo = associationAttributeInfo.getFeature();
    PrimitiveAttribute<?> id;
    try {
      id = (PrimitiveAttribute) dtoConverterService.toDto(entity.getId(idInfo.getName()), idInfo);
    } catch (GeomajasException e) {
      throw new LayerException(e, ExceptionCode.CONVERSION_PROBLEM);
    }
    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    for (AttributeInfo attributeInfo : childInfo.getAttributes()) {
      attributes.put(attributeInfo.getName(),
          getRecursiveAttribute(entity, childInfo, new String[] { attributeInfo.getName() }));
    }
    AssociationValue value = new AssociationValue(id, attributes, false);
    return value;
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

    many.setEditable(true);
    many.setLabel("manyInMany");
    many.setName("manyInMany");

    PrimitiveAttributeInfo textAttr = new PrimitiveAttributeInfo("text", "text", PrimitiveType.STRING);
    FeatureInfo featureInfo = new FeatureInfo();
    featureInfo.setIdentifier(new PrimitiveAttributeInfo("id", "id", PrimitiveType.LONG));
    featureInfo.setAttributes(Collections.singletonList((AttributeInfo) textAttr));
    many.setFeature(featureInfo);
    Attribute<?> attr = converter.toDto(new Bean[] { new Bean("t1",1L), new Bean("t2",2L) }, many);
    Assert.assertTrue(attr instanceof AssociationAttribute);
    AssociationAttribute assoc = (AssociationAttribute)attr;
    List<AssociationValue> value = (List<AssociationValue>)assoc.getValue();
View Full Code Here

Examples of org.geomajas.configuration.FeatureInfo

        // set statuses
        vectorLayer.setCreatable(securityContext.isLayerCreateAuthorized(layerId));
        vectorLayer.setUpdatable(securityContext.isLayerUpdateAuthorized(layerId));
        vectorLayer.setDeletable(securityContext.isLayerDeleteAuthorized(layerId));
        // filter feature info
        FeatureInfo featureInfo = vectorLayer.getFeatureInfo();
        List<AttributeInfo> originalAttr = featureInfo.getAttributes();
        List<AttributeInfo> filteredAttr = new ArrayList<AttributeInfo>();
        featureInfo.setAttributes(filteredAttr);
        for (AttributeInfo ai : originalAttr) {
          if (securityContext.isAttributeReadable(layerId, null, ai.getName())) {
            filteredAttr.add(ai);
          }
        }
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.