Package org.geomajas.sld

Examples of org.geomajas.sld.StyledLayerDescriptorInfo$ChoiceInfo


  @Test
  public void testSingleStyle() throws JiBXException, LayerException {
    IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
    Object object = uctx.unmarshalDocument(getClass().getResourceAsStream("/org/geomajas/testdata/sld/single_layer_no_stylename.sld"), null);
    StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
    NamedStyleInfo info = styleConverterService.convert(sld, featureInfo, "layer", "style");
    Assert.assertNotNull(info);
    Assert.assertEquals("Some title", info.getName());
  }
View Full Code Here


  @Test
  public void testPickStyle() throws JiBXException, LayerException {
    IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
    Object object = uctx.unmarshalDocument(getClass().getResourceAsStream("/org/geomajas/testdata/sld/multiple_layer_stylename.sld"), null);
    StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
    NamedStyleInfo info1 = styleConverterService.convert(sld, featureInfo, "Layer1", "Style1");
    Assert.assertNotNull(info1);
    Assert.assertEquals("Style1", info1.getName());
    Assert.assertEquals(1, info1.getFeatureStyles().size());
   
View Full Code Here

    Assert.assertEquals(1, slds.size());
  }

  @Test
  public void testFindByName() throws SldException {
    StyledLayerDescriptorInfo sld = sldService.findByName("point_attribute");
    Assert.assertNotNull(sld);
  }
View Full Code Here

    Assert.assertNotNull(sld);
  }

  @Test
  public void testSaveOrUpdate() throws SldException, JiBXException {
    StyledLayerDescriptorInfo sld = new StyledLayerDescriptorInfo();
    sld.setName("test");
    try {
      sldService.saveOrUpdate(sld);
      Assert.fail("invalid sld saved");
    } catch (Exception e) {
    }
    sld.setVersion("1.0.0");
    sldService.saveOrUpdate(sld);
    Assert.assertEquals(2, sldService.findAll().size());
  }
View Full Code Here

            });
            for (File file : sldFiles) {
              IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
              IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
              Object object = uctx.unmarshalDocument(new FileReader(file));
              StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
              String fileName = StringUtils.stripFilenameExtension(file.getName());
              if (sld.getName() == null) {
                  sld.setName(fileName);
              }
              log.info("added sld " + fileName + " to service");
              allSlds.put(sld.getName(), sld);
            }
          }
        }
      } catch (Exception e) {
        throw new SldException("Could not initialize SLD service", e);
View Full Code Here

          Resource resource = applicationContext.getResource(namedStyle.getSldLocation());
          IBindingFactory bindingFactory;
          try {
            bindingFactory = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
            IUnmarshallingContext unmarshallingContext = bindingFactory.createUnmarshallingContext();
            StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) unmarshallingContext
                .unmarshalDocument(new InputStreamReader(resource.getInputStream()));
            namedStyle.setStyledLayerInfo(sld);
          } catch (JiBXException e) {
            throw new LayerException(e, ExceptionCode.INVALID_SLD, namedStyle.getSldLocation(),
                layer.getId());
View Full Code Here

TOP

Related Classes of org.geomajas.sld.StyledLayerDescriptorInfo$ChoiceInfo

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.