Package org.geotools.styling

Examples of org.geotools.styling.Style


    }

    private void applyStyle() {
        StyleLayer layer = getSelectedLayer();

        Style newStyle = propertiesEditor.getStyle();
        List<FeatureTypeStyle> featureTypeStyles = newStyle.featureTypeStyles();
        int ftsNum = featureTypeStyles.size();
        if (ftsNum < 1) {
            MessageDialog.openWarning(getShell(), Messages.SimplePointEditorPage_1, Messages.SimplePointEditorPage_2);
            style = oldStyle;
            setStyle(oldStyle);
            layer.revertAll();
            layer.apply();
           
            StyleEditorDialog dialog = (StyleEditorDialog) getContainer();
            dialog.getCurrentPage().refresh();
            return;
        }
       
        newStyle.setName(layer.getName());

        setStyle(newStyle);

        StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
        styleBlackboard.put(SLDContent.ID, newStyle);
View Full Code Here


        List<StyleWrapper> newStylesList = new ArrayList<StyleWrapper>();
        for( File file : sldFilesArray ) {
            try {
                StyledLayerDescriptor sld = readStyle(file);
                Style style = SLDs.getDefaultStyle(sld);
                String name = FilenameUtils.removeExtension(file.getName());
                style.setName(name);

                StyleWrapper styleWrapper = new StyleWrapper(style);
                newStylesList.add(styleWrapper);
            } catch (IOException e) {
                e.printStackTrace();
View Full Code Here

    }

    private void applyStyle() {
       StyleLayer layer = getSelectedLayer();
       
        Style newStyle = propertiesEditor.getStyle();
        List<FeatureTypeStyle> featureTypeStyles = newStyle.featureTypeStyles();
        int ftsNum = featureTypeStyles.size();
        if (ftsNum < 1) {
            MessageDialog.openWarning(getShell(), Messages.SimplePolygonEditorPage_1, Messages.SimplePolygonEditorPage_2);
            style = oldStyleCopy;
            setStyle(oldStyleCopy);
            layer.revertAll();
            layer.apply();
           
            StyleEditorDialog dialog = (StyleEditorDialog) getContainer();
            dialog.getCurrentPage().refresh();
            return;
        }
       
        newStyle.setName(layer.getName());

        setStyle(newStyle);

        StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
        styleBlackboard.put(SLDContent.ID, newStyle);
View Full Code Here

    }

    private void applyStyle() {
        StyleLayer layer = getSelectedLayer();
       
        Style newStyle = linesEditor.getStyle();
       
        List<FeatureTypeStyle> featureTypeStyles = newStyle.featureTypeStyles();
        int ftsNum = featureTypeStyles.size();
        if (ftsNum < 1) {
            MessageDialog.openWarning(getShell(), Messages.SimpleLineEditorPage_1, Messages.SimpleLineEditorPage_2);
            style = oldStyle;
            setStyle(oldStyle);
            layer.revertAll();
            layer.apply();
           
            StyleEditorDialog dialog = (StyleEditorDialog) getContainer();
            dialog.getCurrentPage().refresh();
            return;
        }
       
        newStyle.setName(layer.getName());

        setStyle(newStyle);

        StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
        styleBlackboard.put(SLDContent.ID, newStyle);
View Full Code Here

    public static Style createDefaultPointStyle() {

        FeatureTypeStyle featureTypeStyle = sf.createFeatureTypeStyle();
        featureTypeStyle.rules().add(createDefaultPointRule());

        Style style = sf.createStyle();
        style.featureTypeStyles().add(featureTypeStyle);

        return style;
    }
View Full Code Here

     */
    public static Style createDefaultPolygonStyle() {
        FeatureTypeStyle featureTypeStyle = sf.createFeatureTypeStyle();
        featureTypeStyle.rules().add(createDefaultPolygonRule());

        Style style = sf.createStyle();
        style.featureTypeStyles().add(featureTypeStyle);

        return style;
    }
View Full Code Here

     */
    public static Style createDefaultLineStyle() {
        FeatureTypeStyle featureTypeStyle = sf.createFeatureTypeStyle();
        featureTypeStyle.rules().add(createDefaultLineRule());

        Style style = sf.createStyle();
        style.featureTypeStyles().add(featureTypeStyle);

        return style;
    }
View Full Code Here

        return false;
    }

    @Override
    protected void refresh() {
        Style style = getStyle();
        RasterSymbolizer sym = SLD.rasterSymbolizer(style);
       
        Rule r = style.getFeatureTypeStyles()[0].getRules()[0];
        double minScaleDen=r.getMinScaleDenominator();
        double maxScaleDen=r.getMaxScaleDenominator();
        this.minScale.setScale(minScaleDen, Math.round(getLayer().getMap().getViewportModel().getScaleDenominator()));           
        this.maxScale.setScale(maxScaleDen, Math.round(getLayer().getMap().getViewportModel().getScaleDenominator()));
    }
View Full Code Here

     * @param name the name of the new style.
     * @param oneFeaturetypestylePerRule switch to create a {@link FeatureTypeStyle} per {@link Rule}.
     * @return the new style created.
     */
    public static Style rulesToStyle( List<Rule> rules, String name, boolean oneFeaturetypestylePerRule ) {
        Style namedStyle = Utilities.sf.createStyle();
        if (!oneFeaturetypestylePerRule) {
            FeatureTypeStyle featureTypeStyle = Utilities.sf.createFeatureTypeStyle();
            List<Rule> currentRules = featureTypeStyle.rules();
            for( int i = 0; i < rules.size(); i++ ) {
                Rule rule = rules.get(i);
                currentRules.add(rule);
            }
            namedStyle.featureTypeStyles().add(featureTypeStyle);
        } else {
            for( int i = 0; i < rules.size(); i++ ) {
                FeatureTypeStyle featureTypeStyle = Utilities.sf.createFeatureTypeStyle();
                Rule rule = rules.get(i);
                featureTypeStyle.rules().add(rule);
                namedStyle.featureTypeStyles().add(featureTypeStyle);
            }
        }
        namedStyle.setName(name);
        return namedStyle;
    }
View Full Code Here

    public void synchronize() {
       
        StyleBlackboard styleBlackboard = (StyleBlackboard) getStyleBlackboard();

        // grab the style defined by the user
        Style style = (Style) styleBlackboard.get( SLDContent.ID );
        if (style == null) {
            style = createDefaultStyle();
           
            //put style back on blackboard
            getStyleBlackboard().put(SLDContent.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.