Search in sources :

Example 1 with FieldConfigWindBarbs

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

the class FieldConfigWindBarbsTest method testCreateCopy.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
 */
@Test
public void testCreateCopy() {
    boolean valueOnly = true;
    class TestFieldConfigWindBarbs extends FieldConfigWindBarbs {

        public TestFieldConfigWindBarbs(FieldConfigCommonData commonData) {
            super(commonData, null, null, null);
        }

        public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
            return createCopy(fieldConfigBase);
        }
    }
    TestFieldConfigWindBarbs field = new TestFieldConfigWindBarbs(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
    FieldConfigWindBarbs copy = (FieldConfigWindBarbs) field.callCreateCopy(null);
    assertNull(copy);
    copy = (FieldConfigWindBarbs) field.callCreateCopy(field);
    assertEquals(field.getFieldId(), copy.getFieldId());
    assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
    assertEquals(field.isValueOnly(), copy.isValueOnly());
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigWindBarbs(com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs) Test(org.junit.Test)

Example 2 with FieldConfigWindBarbs

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

the class FieldConfigWindBarbsTest method testGetValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#getValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, org.opengis.filter.expression.Expression, boolean, boolean)}.
 */
@Test
public void testGetValue() {
    // Test it with null values
    boolean valueOnly = true;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    field.createUI();
    assertNull(field.getStringValue());
    GraphicPanelFieldManager fieldConfigManager = null;
    Expression symbolType = null;
    List<GraphicalSymbol> actualValue = field.getValue(fieldConfigManager, symbolType, false, false);
    assertTrue(actualValue.isEmpty());
    Class<?> panelId = PointFillDetails.class;
    fieldConfigManager = new GraphicPanelFieldManager(panelId);
    String actualMarkerSymbol = "solid";
    StyleBuilder styleBuilder = new StyleBuilder();
    symbolType = styleBuilder.literalExpression(actualMarkerSymbol);
    FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
    FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false));
    colourField.createUI();
    String expectedColourValue = "#012345";
    colourField.setTestValue(null, expectedColourValue);
    double expectedOpacityValue = 0.72;
    FieldConfigSlider opacityField = new FieldConfigSlider(new FieldConfigCommonData(panelId, colourFieldId, "", false));
    opacityField.createUI();
    opacityField.populateField(expectedOpacityValue);
    FieldConfigBase symbolSelectionField = new FieldConfigSymbolType(new FieldConfigCommonData(panelId, colourFieldId, "", false));
    symbolSelectionField.createUI();
    fieldConfigManager.add(colourFieldId, colourField);
    FieldIdEnum opacityFieldId = FieldIdEnum.OVERALL_OPACITY;
    fieldConfigManager.add(opacityFieldId, opacityField);
    FieldIdEnum symbolSelectionFieldId = FieldIdEnum.SYMBOL_TYPE;
    fieldConfigManager.add(symbolSelectionFieldId, symbolSelectionField);
    // Try without setting any fields
    actualValue = field.getValue(fieldConfigManager, symbolType, false, false);
    assertNotNull(actualValue);
    assertEquals(1, actualValue.size());
    Mark actualSymbol = (Mark) actualValue.get(0);
    assertTrue(actualSymbol.getWellKnownName().toString().compareTo("windbarbs://default(0)[m/s]") == 0);
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) GraphicalSymbol(org.opengis.style.GraphicalSymbol) StyleBuilder(org.geotools.styling.StyleBuilder) FieldConfigSlider(com.sldeditor.ui.detail.config.FieldConfigSlider) Mark(org.geotools.styling.Mark) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Expression(org.opengis.filter.expression.Expression) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigWindBarbs(com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs) FieldConfigColour(com.sldeditor.ui.detail.config.FieldConfigColour) PointFillDetails(com.sldeditor.ui.detail.PointFillDetails) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) FieldConfigSymbolType(com.sldeditor.ui.detail.config.FieldConfigSymbolType) Test(org.junit.Test)

Example 3 with FieldConfigWindBarbs

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

the class FieldConfigWindBarbsTest method testGetBasePanel.

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

Example 4 with FieldConfigWindBarbs

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

the class FieldConfigWindBarbsTest method testGetConfigField.

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

Example 5 with FieldConfigWindBarbs

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

the class FieldConfigWindBarbsTest method testSetVisible.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#setVisible(boolean)}.
 */
@Test
public void testSetVisible() {
    boolean valueOnly = true;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    boolean expectedValue = true;
    field.setVisible(expectedValue);
    field.createUI();
    expectedValue = false;
    field.setVisible(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