Examples of StyleFactory


Examples of org.geotools.styling.StyleFactory

                Optional<? extends Style> style = plugin.parseStyle(configuration, clientHttpRequestFactory, styleString, mapContext);
                if (style.isPresent()) {
                    if (LOGGER.isDebugEnabled()) {
                        try {
                            final SLDTransformer transformer = new SLDTransformer();
                            final StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
                            final UserLayer userLayer = styleFactory.createUserLayer();
                            userLayer.addUserStyle(style.get());
                            final StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
                            sld.addStyledLayer(userLayer);
                            if (LOGGER.isDebugEnabled()) {
                                LOGGER.debug("Loaded style from: \n\n '" + styleString + "': \n\n" + transformer.transform(sld));
                            }
                        } catch (Exception e) {
View Full Code Here

Examples of org.geotools.styling.StyleFactory

     * @param sldFilename
     * @return
     * @throws IOException
     */
    protected static Style loadStyle(Object loader, String sldFilename) throws IOException {
        StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);

        java.net.URL surl = TestData.getResource(loader, sldFilename);
        SLDParser stylereader = new SLDParser(factory, surl);

        Style style = stylereader.readXML()[0];
View Full Code Here

Examples of org.geotools.styling.StyleFactory

* @source $URL$
*/
public class StyleBuilderTest {

    public void example() {
        StyleFactory sf = CommonFactoryFinder.getStyleFactory(null);
        StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
        sld.setName("example");
        sld.setAbstract("Example Style Layer Descriptor");

        UserLayer layer = sf.createUserLayer();
        layer.setName("layer");

        FeatureTypeConstraint constraint = sf.createFeatureTypeConstraint("Feature",
                Filter.INCLUDE, null);

        layer.layerFeatureConstraints().add(constraint);

        Style style = sf.createStyle();

        style.getDescription().setTitle("Style");
        style.getDescription().setAbstract("Definition of Style");

        // define feature type styles used to actually
View Full Code Here

Examples of org.geotools.styling.StyleFactory

    }

    @Test
    public void testGEOT3111() throws Exception {
        FilterFactory2 ff2 = CommonFactoryFinder.getFilterFactory2(null);
        StyleFactory sf = CommonFactoryFinder.getStyleFactory(null);
        Symbolizer sym = sf.createPolygonSymbolizer(Stroke.NULL,
                sf.createFill(ff2.literal(Color.CYAN)), null);
        Style style = SLD.wrapSymbolizers(sym);

        MapContent mc = new MapContent();
        mc.addLayer(new FeatureLayer(fs, style));
View Full Code Here

Examples of org.geotools.styling.StyleFactory

        renderer.paint(g, viewport.getScreenArea(), viewport.getBounds());
        return image;
    }

    private static Style createPointStyle() {
        StyleFactory sf = CommonFactoryFinder.getStyleFactory();
        URL iconUrl = ScreenMapShapefileTest.class.getResource("icon.png");
        ExternalGraphic icon = sf.createExternalGraphic(iconUrl, "image/png");
        Graphic graphic = sf.createGraphic(new ExternalGraphic[] { icon }, null, null, null, null,
                null);
        PointSymbolizer symbolizer = sf.createPointSymbolizer(graphic, "the_geom");

        Rule rule = sf.createRule();
        rule.symbolizers().add(symbolizer);

        FeatureTypeStyle fts = sf.createFeatureTypeStyle();
        fts.rules().add(rule);

        Style style = sf.createStyle();
        style.featureTypeStyles().add(fts);
        return style;
    }
View Full Code Here

Examples of org.geotools.styling.StyleFactory

        return gcf.create("coverage", matrix, env);
    }

    private Style createCoverageStyle(String bandName) {
        StyleFactory sf = CommonFactoryFinder.getStyleFactory(null);
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);

        ContrastEnhancement ce = sf.contrastEnhancement(ff.literal(1.0), ContrastMethod.NORMALIZE);
        SelectedChannelType sct = sf.createSelectedChannelType(bandName, ce);

        RasterSymbolizer sym = sf.getDefaultRasterSymbolizer();
        ChannelSelection sel = sf.channelSelection(sct);
        sym.setChannelSelection(sel);

        return SLD.wrapSymbolizers(sym);
    }
View Full Code Here

Examples of org.geotools.styling.StyleFactory

                    env.getMinY() - boundary, env.getMaxY() + boundary, null);
            RendererBaseTest.showRender("testPointLabeling", renderer, timout, env);
        }

  private Style loadStyle(String sldFilename) throws IOException {
        StyleFactory factory = StyleFactoryFinder.createStyleFactory();

        java.net.URL surl = TestData.getResource(this, sldFilename);
        SLDParser stylereader = new SLDParser(factory, surl);

        Style style = stylereader.readXML()[0];
View Full Code Here

Examples of org.geotools.styling.StyleFactory

                .getDefaultHints()));
        legend.setRotation(0);
        legend.setOpacity(1);
        Style pStyle = RendererBaseTest.loadStyle(this, "externalGraphic.sld");
        URL url = StreamingRenderer.class.getResource("test-data/");
        StyleFactory sf = CommonFactoryFinder.getStyleFactory(null);
        ExternalGraphic eg = sf.createExternalGraphic(url + "icon64.png", "image/png");
        legend.addExternalGraphic(eg);
        BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = (Graphics2D) image.getGraphics();
        MathTransform transform = ProjectiveTransform.create(new AffineTransform());
        Decimator decimator = new Decimator(transform);
View Full Code Here

Examples of org.geotools.styling.StyleFactory

      }
    }
  }
 
  protected static Style loadStyle(Object loader, String sldFilename) throws IOException {
        StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);

        java.net.URL surl = TestData.getResource(loader, sldFilename);
        SLDParser stylereader = new SLDParser(factory, surl);

        Style style = stylereader.readXML()[0];
View Full Code Here

Examples of org.geotools.styling.StyleFactory

  public Rendering2DTest(java.lang.String testName) {
    super(testName);
  }

  Style loadTestStyle() throws IOException {
    StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);

    URL surl = TestData.getResource(this, "test-sld.xml");
    SLDParser stylereader = new SLDParser(factory, surl);
    StyledLayerDescriptor sld = stylereader.parseSLD();
    UserLayer layer = (UserLayer) sld.getStyledLayers()[0];
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.