本文整理汇总了Java中org.geotools.filter.text.cql2.CQL类的典型用法代码示例。如果您正苦于以下问题:Java CQL类的具体用法?Java CQL怎么用?Java CQL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CQL类属于org.geotools.filter.text.cql2包,在下文中一共展示了CQL类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: displayResult
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
/**
* Display result.
*/
private void displayResult() {
String result = "";
if (rootNode instanceof ExpressionNode) {
overallExpression = addExpression((ExpressionNode) rootNode);
if (overallExpression != null) {
result = overallExpression.toString();
}
} else if (rootNode instanceof FilterNode) {
overallFilter = addFilter((FilterNode) rootNode);
try {
result = CQL.toCQL(overallFilter);
} catch (Exception e) {
// Do nothing
}
}
textArea.setText(result);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:24,代码来源:ExpressionPanelv2.java
示例2: displayResult
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
/**
* Display result.
*
* @return true, if filter is valid
*/
private boolean displayResult() {
String result = INVALID_RESULT_STRING;
if (rootNode instanceof FilterNode) {
overallFilter = addFilter((FilterNode) rootNode);
if (overallFilter == null) {
result = "";
} else {
try {
result = CQL.toCQL(overallFilter);
} catch (Exception e) {
// DO nothing
}
}
}
textArea.setText(result);
return (result.compareTo(INVALID_RESULT_STRING) != 0);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:26,代码来源:FilterPanelv2.java
示例3: createFilter
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
static Filter createFilter(String geomField, double x0, double y0, double x1, double y1,
String dateField, String t0, String t1,
String attributesQuery)
throws CQLException, IOException {
// there are many different geometric predicates that might be used;
// here, we just use a bounding-box (BBOX) predicate as an example.
// this is useful for a rectangular query area
String cqlGeometry = "BBOX(" + geomField + ", " +
x0 + ", " + y0 + ", " + x1 + ", " + y1 + ")";
// there are also quite a few temporal predicates; here, we use a
// "DURING" predicate, because we have a fixed range of times that
// we want to query
String cqlDates = "(" + dateField + " DURING " + t0 + "/" + t1 + ")";
// there are quite a few predicates that can operate on other attribute
// types; the GeoTools Filter constant "INCLUDE" is a default that means
// to accept everything
String cqlAttributes = attributesQuery == null ? "INCLUDE" : attributesQuery;
String cql = cqlGeometry + " AND " + cqlDates + " AND " + cqlAttributes;
return CQL.toFilter(cql);
}
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:25,代码来源:FeatureLevelVisibility.java
示例4: createFilter
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
static Filter createFilter(String geomField, double x0, double y0, double x1, double y1,
String dateField, String t0, String t1,
String attributesQuery)
throws CQLException, IOException {
// there are many different geometric predicates that might be used;
// here, we just use a bounding-box (BBOX) predicate as an example.
// this is useful for a rectangular query area
String cqlGeometry = "BBOX(" + geomField + ", " +
x0 + ", " + y0 + ", " + x1 + ", " + y1 + ")";
// there are also quite a few temporal predicates; here, we use a
// "DURING" predicate, because we have a fixed range of times that
// we want to query
String cqlDates = "(" + dateField + " DURING " + t0 + "/" + t1 + ")";
// there are quite a few predicates that can operate on other attribute
// types; the GeoTools Filter constant "INCLUDE" is a default that means
// to accept everything
String cqlAttributes = attributesQuery == null ? "INCLUDE" : attributesQuery;
String cql = cqlGeometry + " AND " + cqlDates + " AND " + cqlAttributes;
return CQL.toFilter(cql);
}
开发者ID:geomesa,项目名称:geomesa-quickstart,代码行数:25,代码来源:QuickStart.java
示例5: createExpressionList
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
private List<Expression> createExpressionList( String expressionString ) {
List<Expression> list = new ArrayList<Expression>();
String definition = expressionString.replaceAll("\r", "\n").replaceAll("[\n\r][\n\r]", "\n");
for( String line : definition.split("\n") ) {
int mark = line.indexOf("=");
if (mark != -1) {
String expressionDefinition = line.substring(mark + 1).trim();
Expression expression;
try {
expression = CQL.toExpression(expressionDefinition);
} catch (CQLException e) {
throw new ModelsRuntimeException(e.toString(), this);
}
list.add(expression);
}
}
return list;
}
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:21,代码来源:OmsVectorReshaper.java
示例6: getBboxFilter
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
/**
* Create a bounding box filter from the bounds coordinates.
*
* @param attribute the geometry attribute or null in the case of default "the_geom".
* @param west western bound coordinate.
* @param east eastern bound coordinate.
* @param south southern bound coordinate.
* @param north northern bound coordinate.
* @return the filter.
* @throws CQLException
*/
public static Filter getBboxFilter( String attribute, double west, double east, double south, double north )
throws CQLException {
if (attribute == null) {
attribute = "the_geom";
}
StringBuilder sB = new StringBuilder();
sB.append("BBOX(");
sB.append(attribute);
sB.append(",");
sB.append(west);
sB.append(",");
sB.append(south);
sB.append(",");
sB.append(east);
sB.append(",");
sB.append(north);
sB.append(")");
Filter bboxFilter = CQL.toFilter(sB.toString());
return bboxFilter;
}
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:36,代码来源:FilterUtilities.java
示例7: beforePredicate
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
private static void beforePredicate() throws Exception{
// cql_beforePredicate start
Before filter = (Before) CQL.toFilter("lastEarthQuake BEFORE 2006-11-30T01:30:00Z");
// cql_beforePredicate end
Utility.prittyPrintFilter(filter);
final SimpleFeature city = DataExamples.getInstanceOfCity();
Expression leftExpr = filter.getExpression1();
Expression rightExpr = filter.getExpression2();
System.out.println("left expression value: " + leftExpr.evaluate(city));
System.out.println("right expression value: " + rightExpr.evaluate(city));
Boolean result = filter.evaluate(city);
System.out.println("Result of filter evaluation: " + result);
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:17,代码来源:CQLExamples.java
示例8: afterPredicate
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
private static void afterPredicate() throws Exception{
// cql_afterPredicate start
After filter = (After) CQL.toFilter("lastEarthQuake AFTER 2006-11-30T01:30:00Z");
// cql_afterPredicate end
Utility.prittyPrintFilter(filter);
final SimpleFeature city = DataExamples.getInstanceOfCity();
Expression leftExpr = filter.getExpression1();
Expression rightExpr = filter.getExpression2();
System.out.println("left expression value: " + leftExpr.evaluate(city));
System.out.println("right expression value: " + rightExpr.evaluate(city));
Boolean result = filter.evaluate(city);
System.out.println("Result of filter evaluation: " + result);
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:17,代码来源:CQLExamples.java
示例9: afterPredicateGMT3
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
private static void afterPredicateGMT3() throws Exception{
// cql_afterPredicateGMT3 start
After filter = (After) CQL.toFilter("lastEarthQuake AFTER 2006-11-30T01:30:00+03:00");
// cql_afterPredicateGMT3 end
Utility.prittyPrintFilter(filter);
final SimpleFeature city = DataExamples.getInstanceOfCity();
Expression leftExpr = filter.getExpression1();
Expression rightExpr = filter.getExpression2();
System.out.println("left expression value: " + leftExpr.evaluate(city));
System.out.println("right expression value: " + rightExpr.evaluate(city));
Boolean result = filter.evaluate(city);
System.out.println("Result of filter evaluation: " + result);
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:17,代码来源:CQLExamples.java
示例10: duringPredicate
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
private static void duringPredicate() throws Exception{
// cql_duringPredicate start
During filter = (During) CQL.toFilter("lastEarthQuake DURING 1700-01-01T00:00:00/2011-01-01T00:00:00");
// cql_duringPredicate end
Utility.prittyPrintFilter(filter);
final SimpleFeature city = DataExamples.getInstanceOfCity();
Expression leftExpr = filter.getExpression1();
Expression rightExpr = filter.getExpression2();
System.out.println("left expression value: " + leftExpr.evaluate(city));
System.out.println("right expression value: " + rightExpr.evaluate(city));
Boolean result = filter.evaluate(city);
System.out.println("Result of filter evaluation: " + result);
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:17,代码来源:CQLExamples.java
示例11: relatePattern
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
/**
* Example using the "contains" intersection matrix.
*
* @throws Exception
*/
private static void relatePattern() throws Exception{
// cql relatePattern start
Filter filter = CQL.toFilter( "RELATE(geometry, LINESTRING (-134.921387 58.687767, -135.303391 59.092838), T*****FF*)");
// cql relatePattern end
Utility.prittyPrintFilter(filter);
SimpleFeature usa = DataExamples.getInstanceOfCountry();
Boolean result = filter.evaluate(usa);
System.out.println("Result of filter evaluation: " + result);
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:19,代码来源:CQLExamples.java
示例12: comparisonPredicateCQLCompatibility
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
/**
* This example shows that ECQL syntax is compatible with CQL.
*
* @throws Exception
*/
static private void comparisonPredicateCQLCompatibility() throws Exception {
// comparisonCQLCompatibility start
Filter filter = ECQL.toFilter("POPULTATION >= 1000");
// comparisonCQLCompatibility end
// the same syntax, now using CQL parser will produce the same filter
Filter filterFromCQL = CQL.toFilter("POPULTATION >= 1000");
if (!filter.equals(filterFromCQL)) {
throw new Exception("uncompatible ECQL Syntax");
} else {
System.out.println("CQL and ECQL have produced the same filter for the predicate \"POPULTATION >= 1000\"");
Utility.prittyPrintFilter( filter );
}
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:22,代码来源:ECQLExamples.java
示例13: example5
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
private static void example5() throws IOException, CQLException {
System.out.println("example5 start\n");
// example5 start
Map<String, Serializable> params = new HashMap<String, Serializable>();
params.put("directory", directory);
DataStore store = DataStoreFinder.getDataStore(params);
SimpleFeatureSource featureSource = store.getFeatureSource("example");
Filter filter = CQL.toFilter("name = 'dave'");
SimpleFeatureCollection features = featureSource.getFeatures(filter);
System.out.println("found :" + features.size() + " feature");
SimpleFeatureIterator iterator = features.features();
try {
while (iterator.hasNext()) {
SimpleFeature feature = iterator.next();
Geometry geometry = (Geometry) feature.getDefaultGeometry();
System.out.println(feature.getID() + " location " + geometry);
}
} catch (Throwable t) {
iterator.close();
}
// example5 end
System.out.println("\nexample5 end\n");
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:27,代码来源:PropertyExamples.java
示例14: testDisjoint
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
@Test
public void testDisjoint()
throws CQLException,
TransformException,
ParseException {
final Filter filter = CQL.toFilter(String.format(
"DISJOINT(%s, POLYGON((0 0, 0 25, 10 25, 10 0, 0 0)))",
geomAttributeName));
final Query query = new Query(
"type",
filter);
final ExtractGeometryFilterVisitorResult result = (ExtractGeometryFilterVisitorResult) query
.getFilter()
.accept(
visitorWithDescriptor,
null);
// for non-inclusive filters we can't extract query geometry and
// predicate
// assertTrue(Double.isNaN(result.getGeometry().getArea()));
assertTrue(result.getCompareOp() == null);
}
开发者ID:locationtech,项目名称:geowave,代码行数:24,代码来源:ExtractGeometryFilterVisitorTest.java
示例15: setup
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
@Before
public void setup()
throws SchemaException,
CQLException,
IOException,
GeoWavePluginException {
dataStore = createDataStore();
type = DataUtilities.createType(
"geostuff",
"geometry:Geometry:srid=4326,pop:java.lang.Long,when:Date,pid:String");
dataStore.createSchema(type);
query = new Query(
"geostuff",
CQL
.toFilter("BBOX(geometry,27.20,41.30,27.30,41.20) and when during 2005-05-19T20:32:56Z/2005-05-19T21:32:56Z"),
new String[] {
"geometry",
"pid"
});
}
开发者ID:locationtech,项目名称:geowave,代码行数:22,代码来源:WFSSpatialTest.java
示例16: testAllAttributes
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
@Test
public void testAllAttributes()
throws CQLException,
IOException {
final Query query = new Query(
typeName,
CQL.toFilter(cqlPredicate),
Query.ALL_PROPERTIES);
final FeatureReader<SimpleFeatureType, SimpleFeature> reader = geotoolsDataStore.getFeatureReader(
query,
Transaction.AUTO_COMMIT);
int count = 0;
while (reader.hasNext()) {
final SimpleFeature feature = reader.next();
count++;
Assert.assertTrue(feature.getAttribute(geometry_attribute) != null);
Assert.assertTrue(feature.getAttribute(long_attribute) != null);
Assert.assertTrue(feature.getAttribute(string_attribute) != null);
}
Assert.assertTrue(count == 3);
}
开发者ID:locationtech,项目名称:geowave,代码行数:22,代码来源:GeoToolsAttributesSubsetTest.java
示例17: testSubsetAttributes
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
@Test
public void testSubsetAttributes()
throws CQLException,
IOException {
final Query query = new Query(
typeName,
CQL.toFilter(cqlPredicate),
new String[] {
geometry_attribute,
string_attribute
});
final FeatureReader<SimpleFeatureType, SimpleFeature> reader = geotoolsDataStore.getFeatureReader(
query,
Transaction.AUTO_COMMIT);
int count = 0;
while (reader.hasNext()) {
final SimpleFeature feature = reader.next();
count++;
Assert.assertTrue(feature.getAttribute(geometry_attribute) != null);
Assert.assertTrue(feature.getAttribute(long_attribute) == null);
Assert.assertTrue(feature.getAttribute(string_attribute) != null);
}
Assert.assertTrue(count == 3);
}
开发者ID:locationtech,项目名称:geowave,代码行数:25,代码来源:GeoToolsAttributesSubsetTest.java
示例18: setup
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
@Before
public void setup()
throws SchemaException,
CQLException,
IOException,
GeoWavePluginException {
dataStore = createDataStore();
type = DataUtilities.createType(
"geostuff",
"geometry:Geometry:srid=4326,pop:java.lang.Long,pid:String");
dataStore.createSchema(type);
query = new Query(
"geostuff",
CQL.toFilter("BBOX(geometry,27.30,41.20,27.20,41.30)"),
new String[] {
"geometry",
"pid"
});
}
开发者ID:locationtech,项目名称:geowave,代码行数:21,代码来源:WFSTransactionTest.java
示例19: testTextTypes
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
@Test
public void testTextTypes()
throws CQLException {
Filter filter = CQL.toFilter("b = '10'");
Query query = new Query(
"type",
filter);
PropertyFilterVisitor visitor = new PropertyFilterVisitor();
PropertyConstraintSet constraints = (PropertyConstraintSet) query.getFilter().accept(
visitor,
null);
TextExactMatchFilter tf = (TextExactMatchFilter) ((TextQueryConstraint) constraints
.getConstraintsById(new ByteArrayId(
"b"))).getFilter();
assertEquals(
"10",
tf.getMatchValue());
assertTrue(tf.isCaseSensitive());
}
开发者ID:locationtech,项目名称:geowave,代码行数:23,代码来源:PropertyFilterVisitorTest.java
示例20: parseFilter
import org.geotools.filter.text.cql2.CQL; //导入依赖的package包/类
/** @inheritDoc */
public Filter parseFilter(String filter) throws GeomajasException {
if (null == filter || filter.length() == 0) {
return createTrueFilter();
}
try {
if (idReplacer.shouldParse(filter)) {
return idReplacer.parse(filter);
} else {
return ECQL.toFilter(filter, FF);
}
} catch (CQLException e) {
// ECQL should be a superset of CQL, but there are apparently extra key words like "id"
// fall back to CQL for backwards compatibility
log.warn("Filter not parsable by ECQL, falling back to CQL", e);
try {
return CQL.toFilter(filter, FF);
} catch (CQLException ce) {
throw new GeomajasException(ce, ExceptionCode.FILTER_PARSE_PROBLEM, filter);
}
}
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:23,代码来源:FilterServiceImpl.java
注:本文中的org.geotools.filter.text.cql2.CQL类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论