Commit Graph

2555 Commits

Author SHA1 Message Date
Bart van den Eijnden
875edc540e implement @tschaub's suggestions for the LIKE function 2013-07-22 13:23:08 +02:00
Bart van den Eijnden
31fd41ab14 make filterMap_ static as proposed by @tschaub 2013-07-09 13:34:23 +02:00
Bart van den Eijnden
c299bfa1cb more dot notation 2013-07-08 17:29:32 +02:00
Bart van den Eijnden
499319fb99 address most of @tschaub's review comments, use dot notation where possible still needs to be done, and I have some questions on the _expression reader still 2013-07-08 17:04:27 +02:00
Bart van den Eijnden
ab40ab6208 Add parser for OGC Filter 1.0 and 1.1 (read/write)
This work is based on the ol.expr package by @tschaub.
It adds a few named expression functions to that package:

 * INTERSECTS, CONTAINS, DWITHIN, WITHIN (no client-side implementation as yet)
 * LIKE (like comparison with wildcard, singleChar and escapeChar)
 * IEQ (case-insensitive equality)
 * INEQ (case-insensitive non-equality)

It also adds a few extra parameters to the existing EXTENT function to be able
to deserialize and serialize all info (i.e. projection and property name).

Some changes were needed for the GML parser as well:

 * createGeometry function needed to be public
 * when parsing Box (GML2) and Envelope (GML3) also parse the srsName
 * fix up writing for Box and Envelope now that bounds is an array

Also added createDocumentFragment function to the XML parser. Implementation
is similar to OpenLayers 2.

Some addtional notes on the implementation:

 * PropertyIsBetween was implemented as an ol.expr.Logical with operator
   ol.expr.LogicalOp.AND and two ol.expr.Comparison instances with operator
   ol.expr.ComparisonOp.GTE and ol.expr.ComparisonOp.LTE
 * In OGC Filter And and Or can contain more than 2 sub filters, so this
   is translated into a hierarchy of ol.expr.Logical
2013-07-03 13:09:25 +02:00
Tim Schaub
a7ca22dde0 Merge pull request #790 from tschaub/expression
Expression parsing
2013-06-26 16:40:08 -07:00
Tim Schaub
71153d26d1 Prefer if/else to switch 2013-06-26 17:01:27 -06:00
Éric Lemoine
16e23a33fb Merge pull request #823 from elemoine/tilegridbug
Tile has a child if z < maxZoom
2013-06-26 10:10:38 -07:00
Frederic Junod
87dda95b18 Handle ol.ViewHint.INTERACTING in ol.interaction.Touch 2013-06-26 09:27:44 +02:00
Frederic Junod
ae7b342ee9 Handle ol.ViewHint.INTERACTING in ol.interaction.Drag 2013-06-26 09:27:44 +02:00
Éric Lemoine
020d528e73 Tile has a child if z < maxZoom 2013-06-26 07:18:59 +02:00
Tim Schaub
3dc8c4bc7b Properly exporting the transformFeatureInfo option
This was previously called getTransformFeatureInfo, which is a method instead of an option.  In addition, the generate-exports.py script does not properly export properties whose names appear on a different line than the @property annotation.  This makes the vector-layer.html, kml.html, and gpx.html examples work with the built lib.
2013-06-25 13:21:13 -06:00
Tim Schaub
72532b7dd6 Export individual geometry types
This makes the style-rules.html example work with built lib.
2013-06-25 13:21:13 -06:00
Tim Schaub
4e5ef05e5e Expression for evaluating feature ids 2013-06-25 12:15:34 -06:00
Tim Schaub
1eaf82ead5 Enum for checking built-in lib functions internally 2013-06-25 12:15:34 -06:00
Tim Schaub
c81057780a More tests for binary operators 2013-06-25 12:15:34 -06:00
Tim Schaub
2577d3f7d6 Rename ol.expression to ol.expr 2013-06-25 12:15:34 -06:00
Tim Schaub
233595ac75 Allow registration of custom functions for expressions 2013-06-25 12:15:33 -06:00
Tim Schaub
8e8b26805f Uniformly support evaluating symbolizers without features
In combination with a (not yet implemented) `Symbolizer#isLiteral` method, calling `Symbolizer#evaluate` without a feature is the fast track for rendering batches of like-styled features.  This change also simplifies the handling of undefined symbolizer literal properties (where stroke or fill properties are optional).
2013-06-25 12:15:33 -06:00
Tim Schaub
cab983f826 We are guarnteed that all TextLiteral properties are defined (see #770)
Instead of using the browser defaults, we use `ol.style.TextDefaults`.
2013-06-25 12:15:33 -06:00
Tim Schaub
c7da7e4c2e Using new expressions in text symbolizer 2013-06-25 12:15:33 -06:00
Tim Schaub
b04a36ede7 Replace use of filter with expressions
The canvas vector layer still has the (API candidate) `getFeatures` method that accepts an arbitrary expression (was filter).  This, and the `getFeaturesObject` method under it are only used in the tests.  The rendering code that was using filters is now calling `layer.getFeaturesObjectForExtent` with an explicit extent and optional geometry type.
2013-06-25 12:15:33 -06:00
Tim Schaub
a663d8fcae Accept an expression string for rule filter 2013-06-25 12:11:50 -06:00
Tim Schaub
38b784d672 Support +/- unary operators for literals 2013-06-25 12:11:50 -06:00
Tim Schaub
d70a9eba01 Lib for well-known functions
This reveals a lexer bug that needs addressing.
2013-06-25 12:11:50 -06:00
Tim Schaub
bd5d9d572e Lint 2013-06-25 12:11:50 -06:00
Tim Schaub
5e309e244b Using ol.expression.parse 2013-06-25 12:11:50 -06:00
Tim Schaub
53abedaada Correct doc and arg order 2013-06-25 12:11:50 -06:00
Tim Schaub
72d32ec71a Correct index for tokens 2013-06-25 12:11:50 -06:00
Tim Schaub
36d10bef11 Custom error for unexpected token
This makes it clearer to the compiler where we are throwing.
2013-06-25 12:11:49 -06:00
Tim Schaub
62eb0dd72b Give token an index and throw unexpected token from a common place 2013-06-25 12:11:49 -06:00
Tim Schaub
bb1b0cba95 Getter for not expression argument 2013-06-25 12:11:49 -06:00
Tim Schaub
c05fb8c61b Getters for member expression properties 2013-06-25 12:11:49 -06:00
Tim Schaub
2528581642 Getters for math expression properties 2013-06-25 12:11:49 -06:00
Tim Schaub
4a617871da Getters for logical expression properties 2013-06-25 12:11:49 -06:00
Tim Schaub
3de330eb99 Getter for literal expression value 2013-06-25 12:11:49 -06:00
Tim Schaub
6d6ec357e1 Getter for identifier expression name 2013-06-25 12:11:48 -06:00
Tim Schaub
582a52849c Getters for comparison expression properties 2013-06-25 12:11:48 -06:00
Tim Schaub
be636d7f46 Getters for call expression properties 2013-06-25 12:11:48 -06:00
Tim Schaub
6458f98996 Describing the extent of support for ES-5 expressions 2013-06-25 12:11:48 -06:00
Tim Schaub
973606e67a Integration tests for equality operators 2013-06-25 12:11:48 -06:00
Tim Schaub
d5e133b7d8 Satisfy the build/check-requires-timestamp task (see #785)
I think this line should not be required, as `ol.expression.Char` is only used internally in this file.
2013-06-25 12:11:48 -06:00
Tim Schaub
26a7d907a2 Test unary expression parsing 2013-06-25 12:11:47 -06:00
Tim Schaub
a0bd736948 Left-hand-side expression parsing 2013-06-25 12:11:47 -06:00
Tim Schaub
40b12410f0 Increment after scanning >= and <= (and expect EOF in tests) 2013-06-25 12:11:46 -06:00
Tim Schaub
38c8927ae2 Doc and method reorg 2013-06-25 12:11:46 -06:00
Tim Schaub
6d0badcf2a Optional scope (works for expressions without identifiers) 2013-06-25 12:11:46 -06:00
Tim Schaub
d920d8e578 Test left-hand-side expression parsing 2013-06-25 12:11:46 -06:00
Tim Schaub
13d0b8b084 Provide ol.expression.parse method
This is the only method needed in the API.
2013-06-25 12:11:46 -06:00
Tim Schaub
3643ea164f Cast boolean and null before creating literal expression 2013-06-25 12:11:46 -06:00