Search in sources :

Example 51 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.

the class VOGeoServerRandomFill method updateSymbol.

/**
 * Update symbol.
 *
 * @param polygonSymbolizer the polygon symbolizer
 */
@Override
public void updateSymbol(PolygonSymbolizer polygonSymbolizer) {
    Map<String, String> options = polygonSymbolizer.getOptions();
    options.clear();
    for (FieldIdEnum key : fieldMap.keySet()) {
        internalUpdateSymbol(options, key, fieldMap.get(key));
    }
}
Also used : FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Example 52 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.

the class FieldConfigPopulationTest method testColour.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateColourField(com.sldeditor.ui.detail.config.FieldId, org.opengis.filter.expression.Expression, org.opengis.filter.expression.Expression)}.
 */
@Test
public void testColour() {
    FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;
    GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);
    FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
    colourField.createUI();
    colourField.createUI();
    fieldConfigManager.add(fieldId, colourField);
    FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
    StyleBuilder styleBuilder = new StyleBuilder();
    Expression colour = styleBuilder.colorExpression(Color.red);
    obj.populateColourField(fieldId, colour);
    FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
    obj.populateColourField(wrongFieldEnum, colour);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigPopulation(com.sldeditor.ui.detail.config.FieldConfigPopulation) Expression(org.opengis.filter.expression.Expression) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) StyleBuilder(org.geotools.styling.StyleBuilder) FieldConfigColour(com.sldeditor.ui.detail.config.FieldConfigColour) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Example 53 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.

the class FieldConfigPopulationTest method testDouble.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateDoubleField(com.sldeditor.ui.detail.config.FieldId, java.lang.Double)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#getDouble(com.sldeditor.ui.detail.config.FieldId)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#getDouble(com.sldeditor.common.xml.ui.FieldIdEnum)}.
 */
@Test
public void testDouble() {
    FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;
    GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);
    FieldConfigDouble doubleField = new FieldConfigDouble(new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
    doubleField.createUI();
    fieldConfigManager.add(fieldId, doubleField);
    FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
    double expectedValue = 1.256;
    obj.populateDoubleField(fieldId, expectedValue);
    assertTrue(Math.abs(expectedValue - obj.getDouble(fieldId)) < 0.001);
    // This shouldn't work as it does not know about the field
    FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
    assertTrue(Math.abs(obj.getDouble(wrongFieldEnum) - 0.0) < 0.001);
    // Try with null - should revert to default value (0.0)
    obj.populateDoubleField(fieldId, null);
    assertTrue(Math.abs(obj.getDouble(fieldId) - 0.0) < 0.001);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigPopulation(com.sldeditor.ui.detail.config.FieldConfigPopulation) FieldConfigDouble(com.sldeditor.ui.detail.config.FieldConfigDouble) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Example 54 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.

the class FieldConfigPopulationTest method testFieldConfigPopulation.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#FieldConfigPopulation(com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
 */
@Test
public void testFieldConfigPopulation() {
    FieldIdEnum fieldId = FieldIdEnum.UNKNOWN;
    FieldConfigPopulation obj = new FieldConfigPopulation(null);
    obj.populateBooleanField(fieldId, Boolean.TRUE);
    obj.populateComboBoxField(fieldId, "");
    obj.populateColourField(fieldId, null);
    obj.populateColourMapField(FieldIdEnum.ANCHOR_POINT_V, (ColorMap) null);
    obj.populateFontField(FieldIdEnum.ANCHOR_POINT_V, (Font) null);
    obj.populateTextField(fieldId, (String) null);
    obj.populateDoubleField(fieldId, (Double) null);
    obj.populateIntegerField(fieldId, (Integer) null);
    obj.populateField(fieldId, (Expression) null);
    obj.populateUserLayer(fieldId, (UserLayer) null);
    obj.populateFieldTypeConstraint(fieldId, (List<FeatureTypeConstraint>) null);
    assertNull(obj.getExpression(fieldId));
    assertFalse(obj.getBoolean(fieldId));
    assertEquals(0, obj.getInteger(fieldId));
    assertTrue(Math.abs(obj.getDouble(fieldId) - 0.0) < 0.001);
    assertTrue(obj.getText(fieldId).compareTo("") == 0);
    assertNull(obj.getComboBox(fieldId));
    assertNull(obj.getColourMap(fieldId));
    assertNull(obj.getFieldConfig(fieldId));
    assertNull(obj.getFeatureTypeConstraint(fieldId));
}
Also used : FieldConfigPopulation(com.sldeditor.ui.detail.config.FieldConfigPopulation) FeatureTypeConstraint(org.geotools.styling.FeatureTypeConstraint) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) Test(org.junit.Test)

Example 55 with FieldIdEnum

use of com.sldeditor.common.xml.ui.FieldIdEnum in project sldeditor by robward-scisys.

the class FieldConfigPopulationTest method testInteger.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateIntegerField(com.sldeditor.ui.detail.config.FieldId, java.lang.Integer)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#getInteger(com.sldeditor.ui.detail.config.FieldId)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#getInteger(com.sldeditor.common.xml.ui.FieldIdEnum)}.
 */
@Test
public void testInteger() {
    FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;
    GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);
    FieldConfigInteger intField = new FieldConfigInteger(new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
    intField.createUI();
    fieldConfigManager.add(fieldId, intField);
    FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);
    int expectedValue = 1256;
    obj.populateIntegerField(fieldId, expectedValue);
    assertEquals(expectedValue, obj.getInteger(fieldId));
    // This shouldn't work as it does not know about the field
    FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
    assertEquals(0, obj.getInteger(wrongFieldEnum));
    // Try with null - should revert to default value (0.0)
    obj.populateIntegerField(fieldId, null);
    assertEquals(0, obj.getInteger(fieldId));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigPopulation(com.sldeditor.ui.detail.config.FieldConfigPopulation) FieldConfigInteger(com.sldeditor.ui.detail.config.FieldConfigInteger) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) FeatureTypeConstraint(org.geotools.styling.FeatureTypeConstraint) Test(org.junit.Test)

Aggregations

FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)83 Test (org.junit.Test)55 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)54 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)33 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)28 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)27 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)17 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)16 StyleBuilder (org.geotools.styling.StyleBuilder)14 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)13 FieldConfigPopulation (com.sldeditor.ui.detail.config.FieldConfigPopulation)13 Geometry (com.vividsolutions.jts.geom.Geometry)13 Expression (org.opengis.filter.expression.Expression)13 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)12 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)12 GroupIdEnum (com.sldeditor.common.xml.ui.GroupIdEnum)10 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)8 ArrayList (java.util.ArrayList)8 Mark (org.geotools.styling.Mark)7 StrokeDetails (com.sldeditor.ui.detail.StrokeDetails)6