Search in sources :

Example 6 with Extent

use of org.geotools.styling.Extent in project sldeditor by robward-scisys.

the class ExtentModel method populate.

/**
 * Populate.
 *
 * @param extentArray the extent array
 */
public void populate(Extent[] extentArray) {
    this.extentList.clear();
    if (extentArray != null) {
        for (Extent extent : extentArray) {
            Extent newExtent = styleFactory.createExtent(extent.getName(), extent.getValue());
            this.extentList.add(newExtent);
        }
    }
    this.fireTableDataChanged();
}
Also used : Extent(org.geotools.styling.Extent)

Example 7 with Extent

use of org.geotools.styling.Extent in project sldeditor by robward-scisys.

the class ExtentModel method addNewEntry.

/**
 * Adds the new entry.
 */
public void addNewEntry() {
    Extent extent = styleFactory.createExtent(DEFAULT_NEW_EXTENT_NAME, "0 0 0 0");
    extentList.add(extent);
    this.fireTableDataChanged();
    if (parentObj != null) {
        parentObj.extentUpdated();
    }
}
Also used : Extent(org.geotools.styling.Extent)

Example 8 with Extent

use of org.geotools.styling.Extent in project sldeditor by robward-scisys.

the class ExtentModelTest method testUpdateExtent.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.ExtentModel#updateExtent(org.geotools.styling.FeatureTypeConstraint)}.
 */
@Test
public void testUpdateExtent() {
    ExtentModel model = new ExtentModel(null);
    Extent[] extentArray = null;
    model.populate(extentArray);
    extentArray = new Extent[2];
    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    extentArray[0] = styleFactory.createExtent("extent 1", "1 1 1 1");
    extentArray[1] = styleFactory.createExtent("extent 2", "2 2 2 2");
    model.populate(extentArray);
    FeatureTypeConstraint ftc = styleFactory.createFeatureTypeConstraint("feature type name", Filter.INCLUDE, null);
    model.updateExtent(null);
    model.updateExtent(ftc);
    assertNotNull(ftc.getExtents());
    assertEquals(2, ftc.getExtents().length);
}
Also used : FeatureTypeConstraint(org.geotools.styling.FeatureTypeConstraint) ExtentModel(com.sldeditor.ui.detail.config.featuretypeconstraint.ExtentModel) Extent(org.geotools.styling.Extent) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) Test(org.junit.Test)

Aggregations

Extent (org.geotools.styling.Extent)8 FeatureTypeConstraint (org.geotools.styling.FeatureTypeConstraint)3 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)3 Test (org.junit.Test)3 ExtentModel (com.sldeditor.ui.detail.config.featuretypeconstraint.ExtentModel)2 FeatureTypeConstraintModel (com.sldeditor.ui.detail.config.featuretypeconstraint.FeatureTypeConstraintModel)1