Search in sources :

Example 66 with FieldConfigCommonData

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

the class FieldConfigColourMapTest method testGenerateExpression.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#generateExpression()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#populateField(org.geotools.styling.ColorMap)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#setTestValue(com.sldeditor.ui.detail.config.FieldId, org.geotools.styling.ColorMap)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#getColourMap()}.
 */
@Test
public void testGenerateExpression() {
    FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    ColorMap testValue = null;
    field.populate(null);
    field.setTestValue(FieldIdEnum.UNKNOWN, testValue);
    field.populateField(testValue);
    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.setTestValue(FieldIdEnum.UNKNOWN, expectedValue2);
    assertEquals(expectedValue2.getColorMapEntries().length, field.getColourMap().getColorMapEntries().length);
    field.populateExpression((String) null);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) 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 67 with FieldConfigCommonData

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

the class FieldConfigColourMapTest method testRevertToDefaultValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#revertToDefaultValue()}.
 */
@Test
public void testRevertToDefaultValue() {
    FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.revertToDefaultValue();
    assertNull(field.getColourMap());
    field.createUI();
    field.revertToDefaultValue();
    assertNotNull(field.getColourMap());
    assertTrue(field.getColourMap().getColorMapEntries().length == 0);
}
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 68 with FieldConfigCommonData

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

the class FieldConfigColourMapTest method testGetStringValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#getStringValue()}.
 */
@Test
public void testGetStringValue() {
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    ColorMapEntryImpl entry1 = new ColorMapEntryImpl();
    entry1.setColor(ff.literal("#001122"));
    entry1.setLabel("testlabel");
    entry1.setOpacity(ff.literal(0.42));
    entry1.setQuantity(ff.literal(42));
    ColorMap expectedValue = new ColorMapImpl();
    expectedValue.addColorMapEntry(entry1);
    ColorMapEntryImpl entry2 = new ColorMapEntryImpl();
    entry2.setColor(ff.literal("#551122"));
    entry2.setLabel("testlabel2");
    entry2.setOpacity(ff.literal(0.22));
    entry2.setQuantity(ff.literal(12));
    expectedValue.addColorMapEntry(entry2);
    FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.populateField(expectedValue);
    assertTrue(field.getStringValue().compareTo(EncodeColourMap.encode(expectedValue)) == 0);
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) ColorMapImpl(org.geotools.styling.ColorMapImpl) ColorMapEntryImpl(org.geotools.styling.ColorMapEntryImpl) FieldConfigColourMap(com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap) ColorMap(org.geotools.styling.ColorMap) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FilterFactory(org.opengis.filter.FilterFactory) Test(org.junit.Test)

Example 69 with FieldConfigCommonData

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

the class FieldConfigColourMapTest method testAttributeSelection.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#attributeSelection(java.lang.String)}.
 */
@Test
public void testAttributeSelection() {
    FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.attributeSelection(null);
// Does nothing
}
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 70 with FieldConfigCommonData

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

the class FieldConfigColourMapTest method testSetVisible.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#setVisible(boolean)}.
 */
@Test
public void testSetVisible() {
    FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    boolean expectedValue = true;
    field.setVisible(expectedValue);
    field.createUI();
    field.setVisible(expectedValue);
    expectedValue = false;
    field.setVisible(expectedValue);
}
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)

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