Package org.locationtech.udig.style.internal

Examples of org.locationtech.udig.style.internal.StyleLayer


            currentLayer.removeListener(layerListener);
        }
        if (layer == null) {
            currentLayer = null;
        } else {
            currentLayer = new StyleLayer(layer);
            currentLayer.addListener(layerListener);
        }
        enableActions(currentLayer != null);

        // Check if the current site still works
View Full Code Here


        noFeatureLabel = new Label(mainComposite, SWT.NONE);
        noFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
        noFeatureLabel.setText(Messages.SimplePointEditorPage_0);

        StyleLayer layer = getSelectedLayer();
        IGeoResource resource = layer.getGeoResource();
        if (resource.canResolve(FeatureSource.class)) {
            StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
            oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
            if (oldStyle == null) {
                oldStyle = Utilities.createDefaultPointStyle();
            }
           
View Full Code Here

        return true;
    }

    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

        noFeatureLabel = new Label(mainComposite, SWT.NONE);
        noFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
        noFeatureLabel.setText(Messages.SimplePolygonEditorPage_0);

        StyleLayer layer = getSelectedLayer();
        IGeoResource resource = layer.getGeoResource();
        if (resource.canResolve(FeatureSource.class)) {
            StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
            style = (Style) styleBlackboard.get(SLDContent.ID);
            if (style == null) {
                style = Utilities.createDefaultPolygonStyle();
            }
           
View Full Code Here

        return true;
    }

    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

        noFeatureLabel = new Label(mainComposite, SWT.NONE);
        noFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
        noFeatureLabel.setText(Messages.SimpleLineEditorPage_0);

        StyleLayer layer = getSelectedLayer();
        IGeoResource resource = layer.getGeoResource();
        if (resource.canResolve(FeatureSource.class)) {
            StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
            oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
            if (oldStyle == null) {
                oldStyle = Utilities.createDefaultLineStyle();
            }
           
View Full Code Here

        return true;
    }

    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 boolean isValid() {
        return true;
    }

    public void refresh() {
        StyleLayer layer = getSelectedLayer();
        IGeoResource resource = layer.getGeoResource();
        if (!resource.canResolve(FeatureSource.class)) {
            return;
        }

        StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
        oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
        if (oldStyle == null) {
            oldStyle = Utilities.createDefaultLineStyle();
        }
       
View Full Code Here

    private boolean applyCurrentStyle() {

        try {
            if (editorSupported) {
                StyleLayer layer = getSelectedLayer();
                // IGeoResource resource = layer.getGeoResource();
                // GridCoverage2D coverage2d = resource.resolve(GridCoverage2D.class,
                // new NullProgressMonitor());
                // int numBands = coverage2d.getNumSampleDimensions();
                // if (numBands > 1) {
                // System.out.println("BANDS: " + numBands);
                // // return false;
                // }

                StyleBuilder sB = new StyleBuilder(sf);
                RasterSymbolizer rasterSym = sf.createRasterSymbolizer();

                ColorMap colorMap = sf.createColorMap();
                ArrayList<CoverageRule> rulesList = colorRulesEditor.getRulesList();
                for( int i = 0; i < rulesList.size(); i++ ) {
                    CoverageRule coverageRule = rulesList.get(i);
                    if (!coverageRule.isActive()) {
                        continue;
                    }
                    Color fromColor = coverageRule.getFromColor();
                    Color toColor = coverageRule.getToColor();
                    double[] values = coverageRule.getFromToValues();
                    double opacity = coverageRule.getOpacity();

                    Expression fromColorExpr = sB.colorExpression(new java.awt.Color(fromColor.getRed(), fromColor.getGreen(),
                            fromColor.getBlue(), 255));
                    Expression toColorExpr = sB.colorExpression(new java.awt.Color(toColor.getRed(), toColor.getGreen(), toColor
                            .getBlue(), 255));
                    Expression fromExpr = sB.literalExpression(values[0]);
                    Expression toExpr = sB.literalExpression(values[1]);
                    Expression opacityExpr = sB.literalExpression(opacity);

                    ColorMapEntry entry = sf.createColorMapEntry();
                    entry.setQuantity(fromExpr);
                    entry.setColor(fromColorExpr);
                    entry.setOpacity(opacityExpr);
                    colorMap.addColorMapEntry(entry);

                    entry = sf.createColorMapEntry();
                    entry.setQuantity(toExpr);
                    entry.setOpacity(opacityExpr);
                    entry.setColor(toColorExpr);
                    colorMap.addColorMapEntry(entry);
                }

                rasterSym.setColorMap(colorMap);

                /*
                 * 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);
                styleBlackboard.setSelected(new String[]{SLDContent.ID});
            }
View Full Code Here

           
            resetCursor(waitCursor);
           
            if( result ){
                try {
                    StyleLayer layer = getContainer().getSelectedLayer();
                    IGeoResource resource = layer.findGeoResource(FeatureSource.class);
                    if( resource!=null ){
                        style = (Style) new SLDContent().createDefaultStyle(resource, layer.getDefaultColor(), null);
                    }else{
                        resource = layer.findGeoResource(GridCoverage.class);
                        if( resource!=null ){
                            style = (Style) new SLDContent().createDefaultStyle(resource, layer.getDefaultColor(), null);
                        }
                    }
                    if( style!=null ){
                        sld = SLDContent.createDefaultStyledLayerDescriptor(style);
                        setStyle(style);
View Full Code Here

TOP

Related Classes of org.locationtech.udig.style.internal.StyleLayer

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.