Java Code Examples for org.geotools.styling.LineSymbolizer#setUnitOfMeasure()

The following examples show how to use org.geotools.styling.LineSymbolizer#setUnitOfMeasure() . 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: ExtractAttributes.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 *
 * @see
 *     org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.LineSymbolizer)
 */
@Override
public void visit(LineSymbolizer line) {
    LineSymbolizer copy = sf.getDefaultLineSymbolizer();

    copy.setGeometry(copy(LineString.class, line.getGeometry()));

    copy.setUnitOfMeasure(line.getUnitOfMeasure());
    copy.setStroke(copy(line.getStroke()));
    copy.getOptions().putAll(line.getOptions());
    copy.setPerpendicularOffset(line.getPerpendicularOffset());

    if (STRICT && !copy.equals(line)) {
        throw new IllegalStateException(
                "Was unable to duplicate provided LineSymbolizer:" + line);
    }
    pages.push(copy);
}
 
Example 2
Source File: RuleRenderVisitor.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * (non-Javadoc)
 *
 * @see
 *     org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.LineSymbolizer)
 */
public void visit(LineSymbolizer line) {
    LineSymbolizer copy = sf.getDefaultLineSymbolizer();

    copy.setGeometry(copy(line.getGeometry()));

    copy.setUnitOfMeasure(line.getUnitOfMeasure());
    copy.setStroke(copy(line.getStroke()));
    copy.getOptions().putAll(line.getOptions());
    copy.setPerpendicularOffset(line.getPerpendicularOffset());

    if (STRICT && !copy.equals(line)) {
        throw new IllegalStateException(
                "Was unable to duplicate provided LineSymbolizer:" + line);
    }
    pages.push(copy);
}
 
Example 3
Source File: LineSymbolizerDetails.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/** Update symbol. */
private void updateSymbol() {
    if (!Controller.getInstance().isPopulating()) {
        Expression perpendicularOffset =
                fieldConfigVisitor.getExpression(FieldIdEnum.PERPENDICULAR_OFFSET);
        Expression geometryField = ExtractGeometryField.getGeometryField(fieldConfigVisitor);

        StandardData standardData = getStandardData();

        LineSymbolizer lineSymbolizer =
                (LineSymbolizer) SelectedSymbol.getInstance().getSymbolizer();

        if (lineSymbolizer != null) {
            lineSymbolizer.setName(standardData.getName());
            lineSymbolizer.setDescription(standardData.getDescription());
            lineSymbolizer.setUnitOfMeasure(
                    (standardData.getUnit() != null) ? standardData.getUnit().getUnit() : null);

            lineSymbolizer.setGeometry(geometryField);

            lineSymbolizer.setPerpendicularOffset(perpendicularOffset);

            this.fireUpdateSymbol();
        }
    }
}