Search in sources :

Example 1 with TextSymbolizerType

use of org.geotoolkit.se.xml.v110.TextSymbolizerType in project geotoolkit by Geomatys.

the class SLD110Test method testUnitTranscription.

@Test
public void testUnitTranscription() {
    final SE110toGTTransformer se2gt = new SE110toGTTransformer(FILTER_FACTORY, STYLE_FACTORY);
    final GTtoSE110Transformer gt2se = new GTtoSE110Transformer();
    final TextSymbolizerType textSymbol = new TextSymbolizerType();
    final ParameterValueType labelType = new ParameterValueType();
    labelType.getContent().add("label");
    textSymbol.setLabel(labelType);
    textSymbol.setUom("km");
    TextSymbolizer transcriptedText = se2gt.visit(textSymbol);
    assertEquals("Converted unit of measure", Units.KILOMETRE, transcriptedText.getUnitOfMeasure());
    TextSymbolizerType revertedSymbol = gt2se.visit(transcriptedText, null).getValue();
    assertEquals("Reverted unit of measure", "km", revertedSymbol.getUom());
    textSymbol.setUom(null);
    transcriptedText = se2gt.visit(textSymbol);
    assertEquals("Converted unit of measure", Units.POINT, transcriptedText.getUnitOfMeasure());
    revertedSymbol = gt2se.visit(transcriptedText, null).getValue();
    assertEquals("Reverted unit of measure", "http://www.opengeospatial.org/se/units/pixel", revertedSymbol.getUom());
    textSymbol.setUom("px");
    transcriptedText = se2gt.visit(textSymbol);
    assertEquals("Converted unit of measure", Units.POINT, transcriptedText.getUnitOfMeasure());
    revertedSymbol = gt2se.visit(transcriptedText, null).getValue();
    assertEquals("Reverted unit of measure", "http://www.opengeospatial.org/se/units/pixel", revertedSymbol.getUom());
    textSymbol.setUom("meter");
    transcriptedText = se2gt.visit(textSymbol);
    assertEquals("Converted unit of measure", Units.METRE, transcriptedText.getUnitOfMeasure());
    revertedSymbol = gt2se.visit(transcriptedText, null).getValue();
    assertEquals("Reverted unit of measure", "http://www.opengeospatial.org/se/units/metre", revertedSymbol.getUom());
}
Also used : SE110toGTTransformer(org.geotoolkit.sld.xml.SE110toGTTransformer) TextSymbolizer(org.opengis.style.TextSymbolizer) TextSymbolizerType(org.geotoolkit.se.xml.v110.TextSymbolizerType) ParameterValueType(org.geotoolkit.se.xml.v110.ParameterValueType) GTtoSE110Transformer(org.geotoolkit.sld.xml.GTtoSE110Transformer) Test(org.junit.Test)

Example 2 with TextSymbolizerType

use of org.geotoolkit.se.xml.v110.TextSymbolizerType in project geotoolkit by Geomatys.

the class GTtoSE110Transformer method visit.

/**
 * Transform a GT text symbol in jaxb symbol.
 */
@Override
public JAXBElement<TextSymbolizerType> visit(final TextSymbolizer text, final Object data) {
    final TextSymbolizerType tst = se_factory.createTextSymbolizerType();
    tst.setName(text.getName());
    tst.setDescription(visit(text.getDescription(), null));
    tst.setUom(visitUOM(text.getUnitOfMeasure()));
    tst.setGeometry(visitExpression(text.getGeometry()));
    if (text.getHalo() != null) {
        tst.setHalo(visit(text.getHalo(), null));
    }
    if (text.getFont() != null) {
        tst.setFont(visit(text.getFont(), null));
    }
    tst.setLabel(visitExpression(text.getLabel()));
    if (text.getLabelPlacement() != null) {
        tst.setLabelPlacement(visit(text.getLabelPlacement(), null));
    }
    if (text.getFill() != null) {
        tst.setFill(visit(text.getFill(), null));
    }
    return se_factory.createTextSymbolizer(tst);
}
Also used : TextSymbolizerType(org.geotoolkit.se.xml.v110.TextSymbolizerType)

Aggregations

TextSymbolizerType (org.geotoolkit.se.xml.v110.TextSymbolizerType)2 ParameterValueType (org.geotoolkit.se.xml.v110.ParameterValueType)1 GTtoSE110Transformer (org.geotoolkit.sld.xml.GTtoSE110Transformer)1 SE110toGTTransformer (org.geotoolkit.sld.xml.SE110toGTTransformer)1 Test (org.junit.Test)1 TextSymbolizer (org.opengis.style.TextSymbolizer)1