Search in sources :

Example 6 with FieldConfigMarker

use of com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker in project sldeditor by robward-scisys.

the class FieldConfigMarkerTest method testGetFillColourOpacity.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#getFillColourOpacity()}.
 */
@Test
public void testGetFillColourOpacity() {
    boolean valueOnly = true;
    FieldConfigMarker field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertNull(field.getFillColourOpacity());
}
Also used : FieldConfigMarker(com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 7 with FieldConfigMarker

use of com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker in project sldeditor by robward-scisys.

the class FieldConfigMarkerTest method testGetVendorOption.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#getVendorOption()}.
 */
@Test
public void testGetVendorOption() {
    boolean valueOnly = true;
    FieldConfigMarker field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertEquals(VendorOptionManager.getInstance().getDefaultVendorOptionVersion(), field.getVendorOption());
}
Also used : FieldConfigMarker(com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 8 with FieldConfigMarker

use of com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker in project sldeditor by robward-scisys.

the class FieldConfigMarkerTest method testGenerateExpression.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#generateExpression()}.
 */
@Test
public void testGenerateExpression() {
    boolean valueOnly = true;
    FieldConfigMarker field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertNull(field.getStringValue());
    field.populateExpression((String) null);
}
Also used : FieldConfigMarker(com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 9 with FieldConfigMarker

use of com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker in project sldeditor by robward-scisys.

the class FieldConfigMarkerTest method testCreateCopy.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
 */
@Test
public void testCreateCopy() {
    boolean valueOnly = true;
    class TestFieldConfigMarker extends FieldConfigMarker {

        public TestFieldConfigMarker(FieldConfigCommonData commonData, ColourFieldConfig fillFieldConfig, ColourFieldConfig strokeFieldConfig, FieldIdEnum symbolSelectionField) {
            super(commonData, fillFieldConfig, strokeFieldConfig, symbolSelectionField);
        }

        public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
            return createCopy(fieldConfigBase);
        }
    }
    TestFieldConfigMarker field = new TestFieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    FieldConfigMarker copy = (FieldConfigMarker) field.callCreateCopy(null);
    assertNull(copy);
    copy = (FieldConfigMarker) 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) FieldConfigMarker(com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker) ColourFieldConfig(com.sldeditor.ui.detail.ColourFieldConfig) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) Test(org.junit.Test)

Example 10 with FieldConfigMarker

use of com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker in project sldeditor by robward-scisys.

the class FieldConfigMarkerTest method testSetValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#setValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, com.sldeditor.ui.detail.config.FieldConfigSymbolType, org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testSetValue() {
    GraphicPanelFieldManager fieldConfigManager = null;
    Class<?> panelId = PointFillDetails.class;
    fieldConfigManager = new GraphicPanelFieldManager(panelId);
    // Test it with non null values
    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);
    boolean valueOnly = true;
    ColourFieldConfig fillConfig = new ColourFieldConfig(GroupIdEnum.FILL, FieldIdEnum.FILL_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_WIDTH);
    ColourFieldConfig strokeConfig = new ColourFieldConfig(GroupIdEnum.STROKE, FieldIdEnum.STROKE_STROKE_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_FILL_WIDTH);
    FieldConfigMarker field2 = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
    field2.setValue(null, null, null, null, null);
    field2.setValue(null, fieldConfigManager, null, null, null);
    StyleBuilder styleBuilder = new StyleBuilder();
    Mark marker = styleBuilder.createMark("star");
    field2.setValue(null, null, null, null, marker);
    field2.setValue(null, fieldConfigManager, null, null, marker);
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) StyleBuilder(org.geotools.styling.StyleBuilder) FieldConfigSlider(com.sldeditor.ui.detail.config.FieldConfigSlider) Mark(org.geotools.styling.Mark) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) FieldConfigMarker(com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker) ColourFieldConfig(com.sldeditor.ui.detail.ColourFieldConfig) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) 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)

Aggregations

FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)22 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)22 Test (org.junit.Test)22 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)8 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)7 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)7 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)7 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)6 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)6 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)6 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)6 StyleBuilder (org.geotools.styling.StyleBuilder)4 ValueComboBoxData (com.sldeditor.ui.widgets.ValueComboBoxData)3 ValueComboBoxDataGroup (com.sldeditor.ui.widgets.ValueComboBoxDataGroup)3 ArrayList (java.util.ArrayList)3 Mark (org.geotools.styling.Mark)3 UndoEvent (com.sldeditor.common.undo.UndoEvent)1 LiteralExpressionImpl (org.geotools.filter.LiteralExpressionImpl)1 ExternalGraphicImpl (org.geotools.styling.ExternalGraphicImpl)1 Fill (org.geotools.styling.Fill)1