Search in sources :

Example 71 with FieldConfigCommonData

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

the class FieldConfigColourMapTest method testUndoAction.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#undoAction(com.sldeditor.common.undo.UndoInterface)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#redoAction(com.sldeditor.common.undo.UndoInterface)}.
 */
@Test
public void testUndoAction() {
    FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.undoAction(null);
    field.redoAction(null);
    field.createUI();
    ColorMap expectedValue1 = new ColorMapImpl();
    field.populateField(expectedValue1);
    assertEquals(expectedValue1, field.getColourMap());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    ColorMap expectedValue2 = new ColorMapImpl();
    ColorMapEntryImpl entry = new ColorMapEntryImpl();
    entry.setColor(ff.literal("#001122"));
    expectedValue2.addColorMapEntry(entry);
    field.populateField(expectedValue2);
    UndoManager.getInstance().undo();
    assertEquals(expectedValue1.getColorMapEntries().length, field.getColourMap().getColorMapEntries().length);
    UndoManager.getInstance().redo();
    assertEquals(expectedValue2.getColorMapEntries().length, field.getColourMap().getColorMapEntries().length);
    // Increase the code coverage
    field.undoAction(null);
    field.undoAction(new UndoEvent(null, FieldIdEnum.NAME, "", "new"));
    field.redoAction(null);
    field.redoAction(new UndoEvent(null, FieldIdEnum.NAME, "", "new"));
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) UndoEvent(com.sldeditor.common.undo.UndoEvent) ColorMapImpl(org.geotools.styling.ColorMapImpl) FieldConfigColourMap(com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap) ColorMapEntryImpl(org.geotools.styling.ColorMapEntryImpl) ColorMap(org.geotools.styling.ColorMap) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FilterFactory(org.opengis.filter.FilterFactory) Test(org.junit.Test)

Example 72 with FieldConfigCommonData

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

the class FieldConfigColourMapTest method testColourMapUpdated.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#colourMapUpdated()}.
 */
@Test
public void testColourMapUpdated() {
    FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.createUI();
    field.colourMapUpdated();
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FieldConfigColourMap(com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) Test(org.junit.Test)

Example 73 with FieldConfigCommonData

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

the class FieldConfigMarkerTest method testAttributeSelection.

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

Example 74 with FieldConfigCommonData

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

the class FieldConfigMarkerTest method testGetColourExpression.

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

Example 75 with FieldConfigCommonData

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

the class FieldConfigMarkerTest method testPopulateFieldOverrideMap.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#populateFieldOverrideMap(java.lang.Class, com.sldeditor.ui.detail.FieldEnableState)}.
 */
@Test
public void testPopulateFieldOverrideMap() {
    // Test it with non null values
    FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
    Class<?> panelId = PointFillDetails.class;
    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();
    GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(panelId);
    fieldConfigManager.add(colourFieldId, colourField);
    FieldIdEnum opacityFieldId = FieldIdEnum.OVERALL_OPACITY;
    fieldConfigManager.add(opacityFieldId, opacityField);
    FieldIdEnum symbolSelectionFieldId = FieldIdEnum.SYMBOL_TYPE;
    fieldConfigManager.add(symbolSelectionFieldId, symbolSelectionField);
    ColourFieldConfig strokeConfig = new ColourFieldConfig(GroupIdEnum.STROKE, FieldIdEnum.STROKE_STROKE_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_FILL_WIDTH);
    boolean valueOnly = true;
    ColourFieldConfig fillConfig = new ColourFieldConfig(GroupIdEnum.FILL, FieldIdEnum.FILL_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_WIDTH);
    FieldConfigMarker field = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
    field.populateFieldOverrideMap(String.class, null);
    field.populateFieldOverrideMap(PointSymbolizerDetails.class, null);
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigSlider(com.sldeditor.ui.detail.config.FieldConfigSlider) 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) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) PointFillDetails(com.sldeditor.ui.detail.PointFillDetails) FieldConfigSymbolType(com.sldeditor.ui.detail.config.FieldConfigSymbolType) Test(org.junit.Test)

Aggregations

FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)322 Test (org.junit.Test)316 Geometry (com.vividsolutions.jts.geom.Geometry)69 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)54 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)44 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)38 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)34 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)24 StyleBuilder (org.geotools.styling.StyleBuilder)24 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)22 UndoEvent (com.sldeditor.common.undo.UndoEvent)20 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)20 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)20 Expression (org.opengis.filter.expression.Expression)20 FieldConfigWindBarbs (com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs)18 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)17 FieldConfigTTF (com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF)17 FieldConfigFilename (com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename)16 FieldConfigArrow (com.sldeditor.ui.detail.vendor.geoserver.marker.arrow.FieldConfigArrow)16 FieldConfigWKT (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT)16