Search in sources :

Example 11 with FieldConfigWindBarbs

use of com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs in project sldeditor by robward-scisys.

the class FieldConfigWindBarbsTest method testGetSymbolClass.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#getSymbolClass()}.
 */
@Test
public void testGetSymbolClass() {
    boolean valueOnly = true;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertEquals(ExternalGraphicImpl.class, field.getSymbolClass());
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigWindBarbs(com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs) Test(org.junit.Test)

Example 12 with FieldConfigWindBarbs

use of com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs in project sldeditor by robward-scisys.

the class FieldConfigWindBarbsTest method testJustSelected.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#justSelected()}.
 */
@Test
public void testJustSelected() {
    boolean valueOnly = true;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    field.justSelected();
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigWindBarbs(com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs) Test(org.junit.Test)

Example 13 with FieldConfigWindBarbs

use of com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs in project sldeditor by robward-scisys.

the class FieldConfigWindBarbsTest method testSetValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#setValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, com.sldeditor.ui.detail.config.FieldConfigSymbolType, org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testSetValue() {
    boolean valueOnly = true;
    GraphicPanelFieldManager fieldConfigManager = null;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    field.setValue(null, null, null, null, null);
    field.setValue(null, fieldConfigManager, null, null, null);
    field.createUI();
    StyleBuilder styleBuilder = new StyleBuilder();
    Mark marker = styleBuilder.createMark("star");
    field.setValue(null, null, null, null, marker);
    field.setValue(null, fieldConfigManager, null, null, marker);
    File f = null;
    String filename = null;
    try {
        f = File.createTempFile(getClass().getSimpleName(), ".png");
    } catch (IOException e) {
        e.printStackTrace();
    }
    try {
        if ((f != null) && (f.toURI() != null)) {
            if (f.toURI().toURL() != null) {
                filename = f.toURI().toURL().toString();
            }
        }
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder.createExternalGraphic(filename, "png");
    field.setValue(null, fieldConfigManager, null, null, externalGraphic);
    if (f != null) {
        f.delete();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ExternalGraphicImpl(org.geotools.styling.ExternalGraphicImpl) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) StyleBuilder(org.geotools.styling.StyleBuilder) Mark(org.geotools.styling.Mark) FieldConfigWindBarbs(com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs) IOException(java.io.IOException) File(java.io.File) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Example 14 with FieldConfigWindBarbs

use of com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs in project sldeditor by robward-scisys.

the class FieldConfigWindBarbsTest method testGetFieldList.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#getFieldList(com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
 */
@Test
public void testGetFieldList() {
    boolean valueOnly = true;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertEquals(4, field.getFieldList(null).size());
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigWindBarbs(com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs) Test(org.junit.Test)

Example 15 with FieldConfigWindBarbs

use of com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs in project sldeditor by robward-scisys.

the class FieldConfigWindBarbsTest method testGenerateExpression.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#generateExpression()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#setTestValue(com.sldeditor.ui.detail.config.FieldId, java.lang.String)}.
 */
@Test
public void testGenerateExpression() {
    boolean valueOnly = true;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    field.setTestValue(null, (String) null);
    field.populateExpression((Double) null);
    assertNull(field.getStringValue());
    // Create ui
    field.createUI();
    field.populateExpression((Double) null);
    String expectedValue = "string value";
    field.populateExpression(expectedValue);
    expectedValue = "windbarbs://default(9)[m/s]?hemisphere=s";
    field.setTestValue(null, expectedValue);
    field.populateExpression(expectedValue);
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigWindBarbs(com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs) Test(org.junit.Test)

Aggregations

FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)18 FieldConfigWindBarbs (com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs)18 Test (org.junit.Test)18 Mark (org.geotools.styling.Mark)3 StyleBuilder (org.geotools.styling.StyleBuilder)3 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)2 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)2 ExternalGraphicImpl (org.geotools.styling.ExternalGraphicImpl)2 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)1 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)1 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)1 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)1 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)1 File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 Expression (org.opengis.filter.expression.Expression)1 GraphicalSymbol (org.opengis.style.GraphicalSymbol)1