Examples of StyleLayer


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

        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

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

    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

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

    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

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

           
            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

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

            return;
        }
        if (layer == null) {
            selectedLayer = null;
        } else {
            selectedLayer = new StyleLayer(layer);
        }
        // TODO: determine if we need to deal with layer listeners
    }
View Full Code Here

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

        pageControls.put(COMBO_ATTRIBUTES, attributeCombo);
        attributeCombo.setLayout(new GridLayout());
        gridData = createDefaultGridData();
        attributeCombo.setLayoutData(gridData);
        //populate the comboBox
        StyleLayer selectedLayer = getSelectedLayer();
        if (selectedLayer != null) {
            loadWithAttributeTypes(attributeCombo, selectedLayer);
        }
        attributeCombo.setVisibleItemCount(16);
        attributeCombo.addListener(SWT.Modify, new AttributeComboListener());
View Full Code Here

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

            return true;
        }
        return false;
    }
    private void doDefaults() {
            StyleLayer layer = styleEditorDialog.selectedLayer;
            layer.getStyleBlackboard().clear();
            SetDefaultStyleProcessor p = new SetDefaultStyleProcessor(layer.getGeoResource(), layer);
            p.run();
            Style style = (Style) layer.getStyleBlackboard().get(SLDContent.ID);
            StyledLayerDescriptor oldSLD=null;
            if(style!=null){
                oldSLD = this.styleEditorDialog.getSLD();
            }
            this.styleEditorDialog.selectedLayer.apply();
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.