本文整理汇总了Java中org.opengis.filter.FilterFactory类的典型用法代码示例。如果您正苦于以下问题:Java FilterFactory类的具体用法?Java FilterFactory怎么用?Java FilterFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FilterFactory类属于org.opengis.filter包,在下文中一共展示了FilterFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEncodedNativeTermQuery
import org.opengis.filter.FilterFactory; //导入依赖的package包/类
@Test
public void testEncodedNativeTermQuery() throws Exception {
init("not-active");
Map<String, String> vparams = new HashMap<String, String>();
Map<String,Object> query = ImmutableMap.of("term", ImmutableMap.of("security_ss", "WPA"));
vparams.put("q", URLEncoder.encode(mapper.writeValueAsString(query), "UTF-8"));
Hints hints = new Hints(Hints.VIRTUAL_TABLE_PARAMETERS, vparams);
Query q = new Query(featureSource.getSchema().getTypeName());
q.setHints(hints);
FilterFactory ff = dataStore.getFilterFactory();
PropertyIsEqualTo filter = ff.equals(ff.property("speed_is"), ff.literal("300"));
q.setFilter(filter);
ContentFeatureCollection features = featureSource.getFeatures(q);
assertEquals(1, features.size());
SimpleFeatureIterator fsi = features.features();
assertTrue(fsi.hasNext());
assertEquals(fsi.next().getID(), "active.12");
}
示例2: testIsSameAnchorPointAnchorPoint
import org.opengis.filter.FilterFactory; //导入依赖的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));
}
示例3: testExpressionUpdated
import org.opengis.filter.FilterFactory; //导入依赖的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);
}
示例4: testFunctionUpdated
import org.opengis.filter.FilterFactory; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBase#functionUpdated(org.opengis.filter.expression.Expression)}.
*/
@Test
public void testFunctionUpdated() {
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);
assertFalse(listener.hasBeenCalled());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
DefaultFunctionFactory functionFactory = new DefaultFunctionFactory();
FunctionName functionName = functionFactory.getFunctionNames().get(0);
Expression testExpression = ff.function(functionName.getFunctionName(), (Expression) null);
field.functionUpdated(testExpression);
assertTrue(listener.hasBeenCalled());
assertEquals(ExpressionTypeEnum.E_FUNCTION, field.getExpressionType());
Expression expression = field.getExpression();
assertTrue(expression.toString().startsWith(functionName.getName()));
}
示例5: testGetStringValue
import org.opengis.filter.FilterFactory; //导入依赖的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);
}
示例6: createChannelSelection
import org.opengis.filter.FilterFactory; //导入依赖的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,代码来源:VOGeoServerContrastEnhancementNormalizeGreyTest.java
示例7: createChannelSelectionError
import org.opengis.filter.FilterFactory; //导入依赖的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,代码来源:VOGeoServerContrastEnhancementNormalizeGreyTest.java
示例8: createChannelSelection
import org.opengis.filter.FilterFactory; //导入依赖的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,代码行数:30,代码来源:VOGeoServerContrastEnhancementNormalizeBlueTest.java
示例9: createChannelSelectionError
import org.opengis.filter.FilterFactory; //导入依赖的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
示例10: testGetSymbolList
import org.opengis.filter.FilterFactory; //导入依赖的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));
}
示例11: testExpressionPanelv2
import org.opengis.filter.FilterFactory; //导入依赖的package包/类
/**
* Test method for {@link com.sldeditor.filter.v2.expression.ExpressionPanelv2#ExpressionPanelv2(java.util.List)}.
*/
@Test
public void testExpressionPanelv2() {
TestExpressionPanelv2 testObj = new TestExpressionPanelv2(null);
assertNull(testObj.getVendorOptionList());
testObj.dataSourceAboutToUnloaded(null);
testObj.populate((String) null);
testObj.configure("title", String.class, false);
testObj.testShowExpressionDialog(null, null);
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Expression expectedExpression = ff.add(ff.property("field"), ff.literal(42));
testObj.populate(expectedExpression);
testObj.testShowExpressionDialog(Integer.class, expectedExpression);
assertEquals(testObj.getExpression().toString(), testObj.getExpressionString());
testObj.dataApplied();
testObj.testSelection();
}
示例12: testLessDateFilterLong
import org.opengis.filter.FilterFactory; //导入依赖的package包/类
@Test
public void testLessDateFilterLong() throws Exception {
init();
Date testDate = new Date(1005912798000l);
FilterFactory ff = dataStore.getFilterFactory();
Filter f = ff.lessOrEqual(ff.property("installed_td"), ff.literal(testDate.getTime()));
SimpleFeatureCollection features = featureSource.getFeatures(f);
assertEquals(4, features.size());
SimpleFeatureIterator it = features.features();
while (it.hasNext()) {
SimpleFeature next = it.next();
Date date = (Date) next.getAttribute("installed_td");
assertTrue(date.before(testDate) || date.equals(testDate));
}
it.close();
}
示例13: testGreaterDateFilterLong
import org.opengis.filter.FilterFactory; //导入依赖的package包/类
@Test
public void testGreaterDateFilterLong() throws Exception {
init();
Date testDate = new Date(1005912798000l);
FilterFactory ff = dataStore.getFilterFactory();
Filter f = ff.greaterOrEqual(ff.property("installed_td"), ff.literal(testDate.getTime()));
SimpleFeatureCollection features = featureSource.getFeatures(f);
assertEquals(7, features.size());
SimpleFeatureIterator it = features.features();
while (it.hasNext()) {
SimpleFeature next = it.next();
Date date = (Date) next.getAttribute("installed_td");
assertTrue(date.after(testDate) || date.equals(testDate));
}
it.close();
}
示例14: testGetFeaturesWithORLogicFilter
import org.opengis.filter.FilterFactory; //导入依赖的package包/类
@Test
public void testGetFeaturesWithORLogicFilter() throws Exception {
init();
FilterFactory ff = dataStore.getFilterFactory();
PropertyIsEqualTo property1 = ff.equals(ff.property("vendor_s"), ff.literal("D-Link"));
PropertyIsEqualTo property2 = ff.equals(ff.property("vendor_s"), ff.literal("Linksys"));
Or filter = ff.or(property1, property2);
SimpleFeatureCollection features = featureSource.getFeatures(filter);
assertEquals(6, features.size());
SimpleFeatureIterator iterator = features.features();
while (iterator.hasNext()) {
SimpleFeature f = iterator.next();
assertTrue(f.getAttribute("vendor_s").equals("D-Link")
|| f.getAttribute("vendor_s").equals("Linksys"));
}
}
示例15: testGetFeaturesWithQuery
import org.opengis.filter.FilterFactory; //导入依赖的package包/类
@Test
public void testGetFeaturesWithQuery() throws Exception {
init();
FilterFactory ff = dataStore.getFilterFactory();
PropertyIsEqualTo filter = ff.equals(ff.property("modem_b"), ff.literal(true));
Query query = new Query();
query.setPropertyNames(new String[] { "standard_ss", "security_ss" });
query.setFilter(filter);
SimpleFeatureCollection features = featureSource.getFeatures(query);
assertEquals(8, features.size());
SimpleFeatureIterator iterator = features.features();
try {
assertTrue(iterator.hasNext());
SimpleFeature feature = iterator.next();
assertEquals(2, feature.getAttributeCount());
String st = (String) feature.getAttribute("standard_ss");
// changed from "IEEE 802.11b" in SolrFeatureSourceTest
assertTrue(st.contains("IEEE 802.11b"));
} finally {
iterator.close();
}
}