当前位置: 首页>>代码示例>>Java>>正文


Java CommonFactoryFinder.getFilterFactory方法代码示例

本文整理汇总了Java中org.geotools.factory.CommonFactoryFinder.getFilterFactory方法的典型用法代码示例。如果您正苦于以下问题:Java CommonFactoryFinder.getFilterFactory方法的具体用法?Java CommonFactoryFinder.getFilterFactory怎么用?Java CommonFactoryFinder.getFilterFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.factory.CommonFactoryFinder的用法示例。


在下文中一共展示了CommonFactoryFinder.getFilterFactory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createChannelSelectionError

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
/**
 * Creates the channel selection error object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory,
        ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = 
            (ContrastEnhancement) styleFactory.contrastEnhancement(null, 
            contrastMethod.name());

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1.0"));
    options.put("maxValue", ff.literal("5.0"));

    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name",
            contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:VOGeoServerContrastEnhancementNormalizeBlueTest.java

示例2: testIsSameAnchorPointAnchorPoint

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
/**
 * Test method for {@link com.sldeditor.ui.detail.DetailsUtilities#isSame(org.geotools.styling.AnchorPoint, org.geotools.styling.AnchorPoint)}.
 */
@Test
public void testIsSameAnchorPointAnchorPoint() {
    assertFalse(DetailsUtilities.isSame((AnchorPoint)null, (AnchorPoint)null));

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    // Try values that are the same
    AnchorPoint anchorPoint1 = new AnchorPointImpl();
    anchorPoint1.setAnchorPointX(ff.literal(0.58));
    anchorPoint1.setAnchorPointY(ff.literal(0.1));

    AnchorPoint anchorPoint2 = new AnchorPointImpl();
    anchorPoint2.setAnchorPointX(ff.literal(0.58));
    anchorPoint2.setAnchorPointY(ff.literal("0.1"));

    assertTrue(DetailsUtilities.isSame(anchorPoint1, anchorPoint2));

    // Try values that are not the same
    AnchorPoint anchorPoint3 = new AnchorPointImpl();
    anchorPoint3.setAnchorPointX(ff.literal(1.0));
    anchorPoint3.setAnchorPointY(ff.literal(0.1));
    assertFalse(DetailsUtilities.isSame(anchorPoint1, anchorPoint3));
    assertFalse(DetailsUtilities.isSame(anchorPoint2, anchorPoint3));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:DetailsUtilitiesTest.java

示例3: testExpressionUpdated

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigBase#expressionUpdated(org.opengis.filter.expression.Expression)}.
 */
@Test
public void testExpressionUpdated() {
    FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
    String expectedLabel = "test label";
    TestFieldConfigBase field = new TestFieldConfigBase(
            new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, false));

    TestUpdateSymbolInterface listener = new TestUpdateSymbolInterface();
    field.addDataChangedListener(listener);

    String expressionName = "test expression";
    assertFalse(listener.hasBeenCalled());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Expression testExpression = ff.literal(expressionName);
    field.expressionUpdated(testExpression);
    assertTrue(listener.hasBeenCalled());

    assertEquals(ExpressionTypeEnum.E_EXPRESSION, field.getExpressionType());
    Expression expression = field.getExpression();
    assertTrue(expressionName.compareTo(expression.toString()) == 0);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:27,代码来源:FieldConfigBaseTest.java

示例4: createChannelSelectionError

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
/**
 * Creates the channel selection error object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory,
        ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory
            .contrastEnhancement(null, contrastMethod.name());

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1.0"));
    options.put("maxValue", ff.literal("5.0"));

    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name",
            contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:29,代码来源:VOGeoServerContrastEnhancementNormalizeRedTest.java

示例5: testGetStringValue

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

示例6: createChannelSelection

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
/**
 * Creates the channel selection object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelection(StyleFactoryImpl styleFactory,
        ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory
            .contrastEnhancement(null, contrastMethod.name());

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("StretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1"));
    options.put("maxValue", ff.literal("5"));

    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name",
            contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:29,代码来源:VOGeoServerContrastEnhancementNormalizeGreenTest.java

示例7: testGetSymbolList

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.common.data.SelectedSymbol#getSymbolList(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testGetSymbolList() {

    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Stroke stroke = null;
    Fill fill = styleFactory.createFill(ff.literal(DefaultSymbols.defaultColour()));
    GraphicalSymbol symbolToAdd = styleFactory.mark(ff.literal("circle"), fill, stroke);

    List<GraphicalSymbol> symbolList = SelectedSymbol.getInstance().getSymbolList(symbolToAdd);

    assertEquals(1, symbolList.size());

    assertEquals(symbolToAdd, symbolList.get(0));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:SelectedSymbolTest.java

示例8: createStyle

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
@SuppressWarnings({"deprecation"})
private static Style createStyle() {
    StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null);
    FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null);
    PolygonSymbolizer symbolizer = styleFactory.createPolygonSymbolizer();
    Fill fill = styleFactory.createFill(
            filterFactory.literal("#FFAA00"),
            filterFactory.literal(0.5)
    );
    symbolizer.setFill(fill);
    Rule rule = styleFactory.createRule();
    rule.setSymbolizers(new Symbolizer[]{symbolizer});
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    fts.setRules(new Rule[]{rule});

    Style style = styleFactory.createStyle();
    style.addFeatureTypeStyle(fts);
    return style;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:FeatureLayerConfigurationPersistencyTest.java

示例9: addFeatureIdExample

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
private void addFeatureIdExample(SimpleFeatureCollection collection ) throws Exception {
    // addFeatureIdExample start
    Transaction transaction = new DefaultTransaction("Add Example");
    SimpleFeatureStore store = (SimpleFeatureStore) dataStore.getFeatureSource(typeName);
    store.setTransaction(transaction);
    try {
        List<FeatureId> added = store.addFeatures( collection );
        System.out.println( added ); // prints out the temporary feature ids
        
        transaction.commit();
        System.out.println( added ); // prints out the final feature ids
        
        Set<FeatureId> selection = new HashSet<FeatureId>( added );
        FilterFactory ff = CommonFactoryFinder.getFilterFactory();
        Filter selected = ff.id( selection ); // filter selecting all the features just added
    }
    catch( Exception problem){
        transaction.rollback();
        throw problem;
    }
    // addFeatureIdExample end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:23,代码来源:SimpleFeatureStoreExamples.java

示例10: removeExample

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
private void removeExample() throws Exception {
    // removeExample start
    Transaction transaction = new DefaultTransaction("removeExample");
    SimpleFeatureStore store = (SimpleFeatureStore) dataStore.getFeatureSource(typeName);
    store.setTransaction(transaction);
    
    FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    Filter filter = ff.id(Collections.singleton(ff.featureId("fred")));
    try {
        store.removeFeatures(filter);
        transaction.commit();
    } catch (Exception eek) {
        transaction.rollback();
    }
    // removeExample end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:17,代码来源:SimpleFeatureStoreExamples.java

示例11: removeExample2

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
private void removeExample2() throws Exception {
    // removeExample2 start
    Transaction transaction = new DefaultTransaction("removeExample");
    SimpleFeatureStore store = (SimpleFeatureStore) dataStore.getFeatureSource(typeName);
    store.setTransaction(transaction);
    
    FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    Filter filter = ff.id(Collections.singleton(ff.featureId("fred")));
    try {
        final Set<FeatureId> removed = new HashSet<FeatureId>();
        SimpleFeatureCollection collection = store.getFeatures( new Query( typeName, filter, Query.NO_NAMES ));
        collection.accepts( new FeatureVisitor(){
            public void visit(Feature feature) {
                removed.add( feature.getIdentifier() );
            }
        }, null );
        store.removeFeatures(filter);
        transaction.commit();
    } catch (Exception eek) {
        transaction.rollback();
    }
    // removeExample2 end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:24,代码来源:SimpleFeatureStoreExamples.java

示例12: createRules

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
private static Rule[] createRules(String parameter,
		StyleBuilder styleBuilder, double[] breaks, Color[] colors,
		FeatureType type) {
	FilterFactory filterFactory = CommonFactoryFinder
			.getFilterFactory(GeoTools.getDefaultHints());
	Rule[] rules = new Rule[breaks.length];
	for (int i = 0; i < breaks.length; i++) {
		Symbolizer symbolizer = createSymbolizer(styleBuilder, colors[i],
				type);
		Rule rule = styleBuilder.createRule(symbolizer);
		Expression property = filterFactory.property(parameter);
		Filter filter = filterFactory.lessOrEqual(property,
				filterFactory.literal(breaks[i]));
		if (i > 0) {
			Filter greater = filterFactory.greater(property,
					filterFactory.literal(breaks[i - 1]));
			filter = filterFactory.and(filter, greater);
		}
		rule.setFilter(filter);
		rules[i] = rule;
	}
	return rules;
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:24,代码来源:SFMapStyle.java

示例13: testEncodeColorMap

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
/**
 * Test method for {@link com.sldeditor.ui.detail.config.colourmap.EncodeColourMap#encode(org.geotools.styling.ColorMap)}.
 * Test method for {@link com.sldeditor.ui.detail.config.colourmap.EncodeColourMap#encode(java.util.List)}.
 */
@Test
public void testEncodeColorMap() {
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    ColorMapEntryImpl entry1 = new ColorMapEntryImpl();
    entry1.setColor(ff.literal(COLOUR_1));
    entry1.setOpacity(ff.literal(OPACITY_1));
    entry1.setQuantity(ff.literal(QUANTITY_1));
    ColorMap expectedValue = new ColorMapImpl();
    expectedValue.addColorMapEntry(entry1);
    ColorMapEntryImpl entry2 = new ColorMapEntryImpl();
    entry2.setColor(ff.literal(COLOUR_2));
    entry2.setLabel(LABEL_2);
    entry2.setOpacity(ff.literal(OPACITY_2));
    entry2.setQuantity(ff.literal(QUANTITY_2));
    expectedValue.addColorMapEntry(entry2);

    XMLColourMapEntry xml1 = new XMLColourMapEntry();
    xml1.setColour(COLOUR_1);
    xml1.setOpacity(OPACITY_1);
    xml1.setQuantity(42);
    List<XMLColourMapEntry> xmlList = new ArrayList<XMLColourMapEntry>();
    xmlList.add(xml1);

    XMLColourMapEntry xml2 = new XMLColourMapEntry();
    xml2.setColour(COLOUR_2);
    xml2.setLabel(LABEL_2);
    xml2.setOpacity(OPACITY_2);
    xml2.setQuantity(QUANTITY_2);
    xmlList.add(xml2);

    String actualValue1 = EncodeColourMap.encode(expectedValue);
    String actualValue2 = EncodeColourMap.encode(xmlList);

    assertTrue(actualValue1.compareTo(actualValue2) == 0);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:41,代码来源:EncodeColourMapTest.java

示例14: testUndoAction

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

示例15: testGetIntColour

import org.geotools.factory.CommonFactoryFinder; //导入方法依赖的package包/类
/**
 * Test method for {@link com.sldeditor.common.utils.ColourUtils#getIntColour(org.opengis.filter.expression.Expression)}.
 */
@Test
public void testGetIntColour() {

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Expression colourExpression = ff.literal("#FF00FF");
    int colourValue = ColourUtils.getIntColour(colourExpression);
    assertEquals(0xff00ff, colourValue);

    colourValue = ColourUtils.getIntColour(null);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:15,代码来源:ColourUtilsTest.java


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