Java Code Examples for org.geotools.styling.Style#getName()

The following examples show how to use org.geotools.styling.Style#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LegendManager.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates the legend for a single SLD style.
 *
 * @param styleMap the style map
 * @param selectedStyledLayer the selected styled layer
 * @param selectedStyle the selected style
 */
private void createSingleStyleLegend(
        Map<String, Style> styleMap, StyledLayer selectedStyledLayer, Style selectedStyle) {
    // A style has been selected
    List<Style> styleList = SLDUtils.getStylesList(selectedStyledLayer);

    String styleName;
    if (selectedStyle.getName() != null) {
        styleName = selectedStyle.getName();
    } else {
        styleName =
                String.format(
                        "Style %d", (styleList != null) ? styleList.indexOf(selectedStyle) : 0);
    }

    styleMap.put(styleName, selectedStyle);
}
 
Example 2
Source File: LegendManager.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the legend for multiple SLD styles.
 *
 * @param sld the sld
 * @param styleMap the style map
 * @param selectedStyledLayer the selected styled layer
 */
private void createMultipleStyleLegend(
        StyledLayerDescriptor sld,
        Map<String, Style> styleMap,
        StyledLayer selectedStyledLayer) {
    List<StyledLayer> styledLayerList = null;

    if (selectedStyledLayer == null) {
        styledLayerList = sld.layers();
    } else {
        styledLayerList = new ArrayList<>();
        styledLayerList.add(selectedStyledLayer);
    }

    for (StyledLayer styledLayer : styledLayerList) {
        List<Style> styleList = SLDUtils.getStylesList(styledLayer);

        int count = 1;
        for (Style style : styleList) {
            String styleName;
            if (style.getName() != null) {
                styleName = style.getName();
            } else {
                styleName = String.format("Style %d", count);
            }
            styleMap.put(styleName, style);

            count++;
        }
    }
}
 
Example 3
Source File: StyleTreeItem.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getTreeString(DefaultMutableTreeNode node, Object nodeObject) {
    Style style = (Style) nodeObject;

    String name = "";
    if ((style != null) && (style.getName() != null)) {
        name = style.getName();
    }
    return String.format("%s : %s", TITLE, name);
}
 
Example 4
Source File: StandardPanel.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Populate standard data.
 *
 * @param style the style
 */
protected void populateStandardData(Style style) {
    StandardData standardData = new StandardData();

    if (style != null) {
        standardData.name = style.getName();
        standardData.description = style.getDescription();
    }

    populateStandardData(standardData);
}
 
Example 5
Source File: StyleWrapper.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
public StyleWrapper(Style style) {
    this.style = style;
    name = style.getName();

    List<FeatureTypeStyle> featureTypeStyles = style.featureTypeStyles();
    for (FeatureTypeStyle featureTypeStyle : featureTypeStyles) {
        FeatureTypeStyleWrapper fstW = new FeatureTypeStyleWrapper(featureTypeStyle, this);
        featureTypeStylesWrapperList.add(fstW);
    }
}