Package org.geomajas.configuration

Examples of org.geomajas.configuration.FeatureInfo


    } else {
      throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM, "Feature "
          + vectorLayerInfo.getFeatureInfo().getDataSourceName() + " has no valid geometry attribute");
    }

    FeatureInfo featureInfo = vectorLayerInfo.getFeatureInfo();
    attributeInfoMap.put(featureInfo.getIdentifier().getName(), featureInfo.getIdentifier());
    for (AttributeInfo info : featureInfo.getAttributes()) {
      addAttribute(null, info);
    }
    entityMapper = new BeanEntityMapper();
  }
View Full Code Here


    if (null != prefix) {
      name = prefix + SEPARATOR + name;
    }
    attributeInfoMap.put(name, info);
    if (info instanceof AssociationAttributeInfo) {
      FeatureInfo association = ((AssociationAttributeInfo) info).getFeature();
      attributeInfoMap.put(name + SEPARATOR + association.getIdentifier().getName(), association.getIdentifier());
      for (AttributeInfo assInfo : association.getAttributes()) {
        addAttribute(name, assInfo);
      }
    }
  }
View Full Code Here

  @Before
  public void setUp() throws Exception {
    ClassLoader classloader = Thread.currentThread().getContextClassLoader();
    classloader.getResource(SHAPE_FILE);

    FeatureInfo ft = new FeatureInfo();
    ft.setDataSourceName("filtertest");

    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("textAttr");
    pa.setName("textAttr");
    pa.setEditable(false);
    pa.setIdentifying(true);
    pa.setType(PrimitiveType.STRING);

    attr.add(pa);

    PrimitiveAttributeInfo pa2 = new PrimitiveAttributeInfo();
    pa2.setLabel("numberAttr");
    pa2.setName("numberAttr");
    pa2.setEditable(false);
    pa2.setIdentifying(true);
    pa2.setType(PrimitiveType.INTEGER);

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

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

  @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

    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

    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

    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

  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

    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

    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

TOP

Related Classes of org.geomajas.configuration.FeatureInfo

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.