• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FeatureTypeConstraint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.geotools.styling.FeatureTypeConstraint的典型用法代码示例。如果您正苦于以下问题:Java FeatureTypeConstraint类的具体用法?Java FeatureTypeConstraint怎么用?Java FeatureTypeConstraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FeatureTypeConstraint类属于org.geotools.styling包,在下文中一共展示了FeatureTypeConstraint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: populate

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
@Override
public void populate(SelectedSymbol selectedSymbol) {

    if (selectedSymbol != null) {
        StyledLayer styledLayer = selectedSymbol.getStyledLayer();
        if (styledLayer instanceof NamedLayerImpl) {
            NamedLayerImpl namedLayer = (NamedLayerImpl) styledLayer;

            fieldConfigVisitor.populateTextField(FieldIdEnum.NAME, namedLayer.getName());

            // Feature layer constraint
            List<FeatureTypeConstraint> ftcList = namedLayer.layerFeatureConstraints();

            fieldConfigVisitor.populateFieldTypeConstraint(
                    FieldIdEnum.LAYER_FEATURE_CONSTRAINTS, ftcList);
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:19,代码来源:NamedLayerDetails.java


示例2: populateField

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Populate field.
 *
 * @param valueList the value list
 */
@Override
public void populateField(List<FeatureTypeConstraint> valueList) {
    if (filterModel != null) {
        if (valueList != null) {
            filterModel.populate(valueList);

            UndoManager.getInstance()
                    .addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, valueList));

            oldValueObj = valueList;

            valueUpdated();
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:FieldConfigFeatureTypeConstraint.java


示例3: updateExtent

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Update extents of a feature type constraint.
 *
 * @param ftc the feature type constraint to update
 */
public void updateExtent(FeatureTypeConstraint ftc) {
    if (ftc == null) {
        return;
    }

    if (!extentList.isEmpty()) {
        Extent[] extentArray = new Extent[extentList.size()];
        int index = 0;
        for (Extent extent : extentList) {
            Extent newExtent = styleFactory.createExtent(extent.getName(), extent.getValue());

            extentArray[index] = newExtent;

            index++;
        }

        ftc.setExtents(extentArray);
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:ExtentModel.java


示例4: getValueAt

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
    if ((rowIndex < 0) || (rowIndex >= getRowCount())) {
        return null;
    }

    if ((columnIndex < 0) || (columnIndex >= getColumnCount())) {
        return null;
    }

    FeatureTypeConstraint ftc = ftcList.get(rowIndex);

    switch (columnIndex) {
    case COL_NAME:
        return ftc.getFeatureTypeName();
    case COL_FILTER:
        if (ftc.getFilter() != null) {
            return ftc.getFilter().toString();
        }
        break;
    default:
        break;
    }
    return null;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:26,代码来源:FeatureTypeConstraintModel.java


示例5: testUpdateExtent

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:27,代码来源:ExtentModelTest.java


示例6: updateSymbol

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Update symbol.
 */
private void updateSymbol() {
    if (!Controller.getInstance().isPopulating()) {
        String name = fieldConfigVisitor.getText(FieldIdEnum.NAME);
        NamedLayer namedLayer = getStyleFactory().createNamedLayer();
        namedLayer.setName(name);

        // Feature type constraints
        List<FeatureTypeConstraint> ftcList = fieldConfigVisitor
                .getFeatureTypeConstraint(FieldIdEnum.LAYER_FEATURE_CONSTRAINTS);
        if ((ftcList != null) && !ftcList.isEmpty()) {
            FeatureTypeConstraint[] ftcArray = new FeatureTypeConstraint[ftcList.size()];
            namedLayer.setLayerFeatureConstraints(ftcList.toArray(ftcArray));
        }

        StyledLayer existingStyledLayer = SelectedSymbol.getInstance().getStyledLayer();
        if (existingStyledLayer instanceof NamedLayerImpl) {
            NamedLayerImpl existingNamedLayer = (NamedLayerImpl) existingStyledLayer;

            for (Style style : existingNamedLayer.styles()) {
                namedLayer.addStyle(style);
            }
        }
        SelectedSymbol.getInstance().replaceStyledLayer(namedLayer);

        this.fireUpdateSymbol();
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:31,代码来源:NamedLayerDetails.java


示例7: undoAction

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Undo action.
 *
 * @param undoRedoObject the undo/redo object
 */
@Override
public void undoAction(UndoInterface undoRedoObject) {
    if ((filterTable != null) && (undoRedoObject != null)) {
        try {
            @SuppressWarnings("unchecked")
            List<FeatureTypeConstraint> oldValue = (List<FeatureTypeConstraint>) undoRedoObject
                    .getOldValue();

            populateField(oldValue);
        } catch (ClassCastException e) {
            // Ignore
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:FieldConfigFeatureTypeConstraint.java


示例8: redoAction

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Redo action.
 *
 * @param undoRedoObject the undo/redo object
 */
@Override
public void redoAction(UndoInterface undoRedoObject) {
    if ((filterTable != null) && (undoRedoObject != null)) {
        try {
            @SuppressWarnings("unchecked")
            List<FeatureTypeConstraint> newValue = (List<FeatureTypeConstraint>) undoRedoObject
                    .getNewValue();

            populateField(newValue);
        } catch (ClassCastException e) {
            // Ignore
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:FieldConfigFeatureTypeConstraint.java


示例9: extentUpdated

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
@Override
public void extentUpdated() {
    if (filterTable != null) {
        FeatureTypeConstraint ftc = filterModel
                .getFeatureTypeConstraint(filterTable.getSelectedRow());
        if (ftc != null) {
            extentModel.updateExtent(ftc);
        }

        featureTypeConstraintUpdated();
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:13,代码来源:FieldConfigFeatureTypeConstraint.java


示例10: addNewEntry

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Adds the new entry.
 */
public void addNewEntry() {

    FeatureTypeConstraint ftc = styleFactory.createFeatureTypeConstraint(DEFAULT_NAME,
            Filter.INCLUDE, new Extent[0]);
    ftcList.add(ftc);

    this.fireTableDataChanged();

    if (parentObj != null) {
        parentObj.featureTypeConstraintUpdated();
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:16,代码来源:FeatureTypeConstraintModel.java


示例11: setValueAt

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Sets the value at.
 *
 * @param aValue the a value
 * @param rowIndex the row index
 * @param columnIndex the column index
 */
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    if ((rowIndex < 0) || (rowIndex >= getRowCount())) {
        return;
    }

    if ((columnIndex < 0) || (columnIndex >= getColumnCount())) {
        return;
    }

    FeatureTypeConstraint ftc = ftcList.get(rowIndex);

    switch (columnIndex) {
    case COL_NAME: {
        String name = (String) aValue;
        ftc.setFeatureTypeName(name);
    }
        break;
    case COL_FILTER:
        break;
    default:
        break;
    }

    this.fireTableDataChanged();

    if (parentObj != null) {
        parentObj.featureTypeConstraintUpdated();
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:38,代码来源:FeatureTypeConstraintModel.java


示例12: populate

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Populate.
 *
 * @param ftcList the ftc list
 */
public void populate(List<FeatureTypeConstraint> ftcList) {
    this.ftcList.clear();

    if (ftcList != null) {
        for (FeatureTypeConstraint ftc : ftcList) {
            FeatureTypeConstraint newFTC = styleFactory.createFeatureTypeConstraint(
                    ftc.getFeatureTypeName(), ftc.getFilter(), new Extent[0]);

            this.ftcList.add(newFTC);
        }
    }
    this.fireTableDataChanged();
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:19,代码来源:FeatureTypeConstraintModel.java


示例13: getFeatureTypeConstraint

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Gets the feature type constraint.
 *
 * @param row the row
 * @return the feature type constraint
 */
public FeatureTypeConstraint getFeatureTypeConstraint(int row) {
    if ((row >= 0) && (row < ftcList.size())) {
        FeatureTypeConstraint ftc = ftcList.get(row);

        return ftc;
    }
    return null;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:15,代码来源:FeatureTypeConstraintModel.java


示例14: populateFieldTypeConstraint

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Populate feature type constraint field.
 *
 * @param fieldId the field id
 * @param ftcList the ftc list
 */
public void populateFieldTypeConstraint(FieldIdEnum fieldId,
        List<FeatureTypeConstraint> ftcList) {
    if (fieldConfigManager == null) {
        return;
    }
    FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
    if (fieldConfig != null) {
        fieldConfig.populateField(ftcList);
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:17,代码来源:FieldConfigPopulation.java


示例15: getFeatureTypeConstraint

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Gets the list of feature type constraints.
 *
 * @param fieldId the field id
 * @return the list of feature type constraints
 */
public List<FeatureTypeConstraint> getFeatureTypeConstraint(FieldIdEnum fieldId) {
    if (fieldConfigManager != null) {
        FieldConfigValuePopulateInterface fieldConfig = fieldConfigManager.get(fieldId);

        if (fieldConfig != null) {
            return fieldConfig.getFeatureTypeConstraint();
        }
    }
    return null;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:17,代码来源:FieldConfigPopulation.java


示例16: visit

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/** (non-Javadoc)
 * @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.UserLayer)
 */
public void visit(UserLayer layer) {

    Style[] style = layer.getUserStyles();
    int length = style.length;
    Style[] styleCopy = new Style[length];
    for (int i = 0; i < length; i++) {
        if (style[i] != null) {
            style[i].accept(this);
            styleCopy[i] = (Style) pages.pop();
        }
    }

    FeatureTypeConstraint[] lfc = layer.getLayerFeatureConstraints();
    FeatureTypeConstraint[] lfcCopy = new FeatureTypeConstraint[lfc.length];

    length = lfc.length;
    for (int i = 0; i < length; i++) {
        if (lfc[i] != null) {
            lfc[i].accept(this);
            lfcCopy[i] = (FeatureTypeConstraint) pages.pop();
        }
    }

    UserLayer copy = sf.createUserLayer();
    copy.setName(layer.getName());
    copy.setUserStyles(styleCopy);
    copy.setLayerFeatureConstraints(lfcCopy);

    // Reuse the existing inline feature data store
    copy.setInlineFeatureDatastore(layer.getInlineFeatureDatastore());
    copy.setInlineFeatureType(layer.getInlineFeatureType());

    if (STRICT && !copy.equals(layer)) {
        throw new IllegalStateException("Was unable to duplicate provided UserLayer:" + layer);
    }
    pages.push(copy);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:41,代码来源:InlineDatastoreVisitor.java


示例17: testFieldConfigPopulation

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:31,代码来源:FieldConfigPopulationTest.java


示例18: testGenerateExpression

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#generateExpression()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#populateExpression(java.lang.Object)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#setTestValue(com.sldeditor.ui.detail.config.FieldId, java.util.List)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#populateField(java.util.List)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#getFeatureTypeConstraint()}.
 */
@Test
public void testGenerateExpression() {
    FieldConfigFeatureTypeConstraint field = new FieldConfigFeatureTypeConstraint(
            new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    List<FeatureTypeConstraint> testValue = null;
    field.populate(null);
    field.setTestValue(FieldIdEnum.UNKNOWN, testValue);
    field.populateField(testValue);

    field.createUI();
    assertNull(field.getStringValue());

    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FeatureTypeConstraint expectedValue1 = styleFactory.createFeatureTypeConstraint("Feature",
            Filter.INCLUDE, new Extent[0]);

    testValue = new ArrayList<FeatureTypeConstraint>();
    testValue.add(expectedValue1);
    field.populateField(testValue);
    assertEquals(expectedValue1, field.getFeatureTypeConstraint().get(0));

    field.setTestValue(FieldIdEnum.UNKNOWN, testValue);
    assertEquals(expectedValue1, field.getFeatureTypeConstraint().get(0));

    field.populateExpression((String) null);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:39,代码来源:FieldConfigFeatureTypeConstraintTest.java


示例19: testUndoAction

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#undoAction(com.sldeditor.common.undo.UndoInterface)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#redoAction(com.sldeditor.common.undo.UndoInterface)}.
 */
@Test
public void testUndoAction() {
    FieldConfigFeatureTypeConstraint field = new FieldConfigFeatureTypeConstraint(
            new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.undoAction(null);
    field.redoAction(null);
    field.createUI();

    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FeatureTypeConstraint expectedValue1 = styleFactory.createFeatureTypeConstraint("Feature",
            Filter.INCLUDE, new Extent[0]);

    List<FeatureTypeConstraint> testValue = new ArrayList<FeatureTypeConstraint>();

    testValue.add(expectedValue1);
    field.populateField(testValue);
    assertEquals(expectedValue1, field.getFeatureTypeConstraint().get(0));

    FeatureTypeConstraint expectedValue2 = styleFactory.createFeatureTypeConstraint("Feature2",
            Filter.INCLUDE, new Extent[0]);
    List<FeatureTypeConstraint> testValue2 = new ArrayList<FeatureTypeConstraint>();
    testValue2.add(expectedValue1);
    testValue2.add(expectedValue2);
    field.populateField(testValue2);

    UndoManager.getInstance().undo();
    assertEquals(1, field.getFeatureTypeConstraint().size());
    assertEquals(expectedValue1, field.getFeatureTypeConstraint().get(0));
    UndoManager.getInstance().redo();
    assertEquals(2, field.getFeatureTypeConstraint().size());
    assertEquals(expectedValue2, field.getFeatureTypeConstraint().get(1));

    // 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"));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:45,代码来源:FieldConfigFeatureTypeConstraintTest.java


示例20: styleToString

import org.geotools.styling.FeatureTypeConstraint; //导入依赖的package包/类
/**
 * Converts a style to its string representation to be written to file.
 * 
 * @param style
 *            the style to convert.
 * @return the style string.
 * @throws Exception
 */
public static String styleToString(final Style style) throws Exception {
	final StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
	final UserLayer layer = sf.createUserLayer();
	layer.setLayerFeatureConstraints(new FeatureTypeConstraint[] { null });
	sld.addStyledLayer(layer);
	layer.addUserStyle(style);

	final SLDTransformer aTransformer = new SLDTransformer();
	aTransformer.setIndentation(4);
	final String xml = aTransformer.transform(sld);
	return xml;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:21,代码来源:SimpleStyleConfigurator.java



注:本文中的org.geotools.styling.FeatureTypeConstraint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NullStruct类代码示例发布时间:2022-05-22
下一篇:
Java DefaultApacheHttpClient4Config类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap