Package org.geotools.styling

Examples of org.geotools.styling.Style


            public void widgetSelected( SelectionEvent e ) {
                RuleWrapper selectedRule = getSelectedRule();

                FeatureTypeStyle featureTypeStyle = Utilities.sf.createFeatureTypeStyle();
                featureTypeStyle.rules().add(selectedRule.getRule());
                Style namedStyle = Utilities.sf.createStyle();
                namedStyle.featureTypeStyles().add(featureTypeStyle);
                namedStyle.setName(selectedRule.getName());

                try {
                    lineStyleManager.addStyle(new StyleWrapper(namedStyle));
                } catch (Exception e1) {
                    e1.printStackTrace();
View Full Code Here


        if (editorSupported) {
            colorRulesEditor = new CoverageColorEditor(parent, SWT.NONE);

            StyleBlackboard styleBlackboard = layer.getStyleBlackboard();

            Style style = (Style) styleBlackboard.get(SLDContent.ID);
            if (style == null) {
                style = createDefaultStyle();

                // put style back on blackboard
                styleBlackboard.put(SLDContent.ID, style);
                styleBlackboard.setSelected(new String[]{SLDContent.ID});
            }
            style.setName(layer.getName());
            ArrayList<CoverageRule> listOfRules = new ArrayList<CoverageRule>();
            // Rule ruleToUpdate = SLDs.getRasterSymbolizerRule(style);
            RasterSymbolizer rasterSymbolizer = SLDs.rasterSymbolizer(style);

            ColorMap colorMap = rasterSymbolizer.getColorMap();
View Full Code Here

                /*
                 * set global transparency for the map
                 */
                rasterSym.setOpacity(sB.literalExpression(colorRulesEditor.getAlphaVAlue() / 100.0));

                Style newStyle = SLD.wrapSymbolizers(rasterSym);
                Layer selLayer = getSelectedLayer();
                newStyle.setName(selLayer.getName());

                StyleBlackboard styleBlackboard = layer.getStyleBlackboard();

                // put style back on blackboard
                styleBlackboard.put(SLDContent.ID, newStyle);
View Full Code Here

        RasterSymbolizer rasterSymbolizer = styleFactory.createRasterSymbolizer();
        Rule rule = styleFactory.createRule();
        rule.setSymbolizers(new Symbolizer[]{rasterSymbolizer});

        Style style = styleBuilder.createStyle();
        SLDContentManager sldContentManager = new SLDContentManager(styleBuilder, style);
        sldContentManager.addSymbolizer(rasterSymbolizer);

        // set the feature type name
        FeatureTypeStyle fts = sldContentManager.getDefaultFeatureTypeStyle();
        fts.setFeatureTypeName(SLDs.GENERIC_FEATURE_TYPENAME);
        fts.setName("simple"); //$NON-NLS-1$
        fts.setSemanticTypeIdentifiers(new String[]{"generic:geometry", "simple"}); //$NON-NLS-1$ //$NON-NLS-2$

        fts.addRule(rule);
        style.addFeatureTypeStyle(fts);
        style.setName("simpleStyle"); //$NON-NLS-1$

        return style;
    }
View Full Code Here

     *
     * @see org.locationtech.udig.project.StyleContent#save(org.eclipse.ui.IMemento,
     *      java.lang.Object)
     */
    public void save( IMemento memento, Object value ) {
        Style style = (Style) value;

        // serialize out the style objects
        SLDTransformer sldWriter = new SLDTransformer();
        String out = ""; //$NON-NLS-1$
        try {
View Full Code Here

     */
    public Object createDefaultStyle( IGeoResource resource, Color colour,
            IProgressMonitor m ) throws IOException {
       
        if( resource.canResolve(Style.class)){
            Style style = resource.resolve( Style.class, null);
            if( style != null ){
                DuplicatingStyleVisitor v = new DuplicatingStyleVisitor();
                style.accept(v);
                return v.getCopy();
            }
        }
       
        if( resource.canResolve(FeatureSource.class) ){
            SimpleFeatureSource featureSource = null;
            try {
                featureSource = resource.resolve(SimpleFeatureSource.class, m);
            }
            catch (IOException e) {
                e.printStackTrace();
                return null;
            }
            Style style = createDefaultFeatureStyle(resource, colour, featureSource);
            if( style != null ) return style;
        }
        if (resource.canResolve(GridCoverage.class)){
            //GridCoverage grid = resource.resolve(GridCoverage.class, m );
            return createDefaultGridCoverageStyle( resource, colour );
View Full Code Here

    }

    private Style createDefaultGridCoverageStyle( IGeoResource resource, Color colour ) {
        RasterSymbolizer rasterSymbolizer = styleFactory.createRasterSymbolizer();
       
        Style style = styleBuilder.createStyle();
        SLDContentManager sldContentManager = new SLDContentManager(styleBuilder, style);
        sldContentManager.addSymbolizer(rasterSymbolizer);
       
        style.setName("simpleStyle");
             
        return style;
    }
View Full Code Here

        GeometryDescriptor geom = schema.getGeometryDescriptor();
        if (geom == null) {
            return null;
        }

        Style style = styleBuilder.createStyle();
        SLDContentManager sldContentManager = new SLDContentManager(styleBuilder, style);

        // initialize the symbolizers based on geometry type
        if (SLD.isLine(geom)) {
            sldContentManager.addSymbolizer(createLineSymbolizer(colour));
View Full Code Here

        layer.addUserStyle(style);
        return sld;
    }
   
    public static Style createDefaultStyle() {
        Style style = styleBuilder.createStyle();
        SLDContentManager sldContentManager = new SLDContentManager(styleBuilder, style);
               
        // sldContentManager.addSymbolizer(styleBuilder.createPointSymbolizer());
        sldContentManager.addSymbolizer(createLineSymbolizer(createRandomColor()));
        sldContentManager.addSymbolizer(createPolygonSymbolizer(createRandomColor()));
        sldContentManager.addSymbolizer(createTextSymbolizer());
        // sldContentManager.addSymbolizer(styleBuilder.createRasterSymbolizer());

        //tag as a simple FeatureTypeStyle
        FeatureTypeStyle fts = style.featureTypeStyles().get(0);
        fts.setName("simple"); //$NON-NLS-1$
        fts.setSemanticTypeIdentifiers(new String[] {"generic:geometry", "simple"}); //$NON-NLS-1$ //$NON-NLS-2$
       
        //TODO: add StyledLayerDescriptor to sldContentManager?
        return style;
View Full Code Here

    public StyleBlackboard getStyleBlackboard() {
        if (styleBlackboard == null)
            styleBlackboard = ProjectFactory.eINSTANCE.createStyleBlackboard();

        styleBlackboard.clear();
        Style style = null;
       
        //if the original layer has a selection style on its blackboard, copy
        //it to this blackboard
        if (layer.getStyleBlackboard() != null) {
            style = (Style)layer.getStyleBlackboard().get(SelectionStyleContent.ID);
        }
       
        //no selection style defined on original layer, so create a default one
        if (style == null) {
            style = SelectionStyleContent.createDefaultStyle(layer);
            style.getFeatureTypeStyles()[0].setFeatureTypeName(SLDs.GENERIC_FEATURE_TYPENAME);
        }
        if (style == null)
            return styleBlackboard;
       
        styleBlackboard.put(SelectionStyleContent.ID, style);
View Full Code Here

TOP

Related Classes of org.geotools.styling.Style

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.