Commit Graph
100 Commits
Author SHA1 Message Date
Olivier Guyot 15553f7aec Merge pull request #11197 from RydingM/master
Added '&&' logical operator to expressions
2020-07-17 14:37:12 +02:00
Olivier Guyot f9e639c960 Merge pull request #11263 from mike-000/patch-19
Fix rotation reset in Mapbox-gl Layer example
2020-07-13 13:30:59 +02:00
Olivier Guyot 22c02e7f35 Merge pull request #10865 from jahow/view-animate-updatesize-fix
View / avoid solving constraints related to map size during animation
2020-04-03 13:55:54 +02:00
Olivier Guyot 32321e381c View / avoid solving constraints related to map size change during anim 2020-04-02 14:22:47 +02:00
Olivier Guyot 7b4e522e8f Merge pull request #10722 from jellyedwards/master
fix: handle layer clear event in case clear(true) called
2020-03-10 09:27:15 +01:00
Olivier Guyot 29387a2cbb Merge pull request #10758 from jahow/webgl-rotation-fix-attribute
Allow using feature attributes for symbol rotation in WebGL layers
2020-03-03 12:55:25 +01:00
Olivier Guyot 40d44db85e Shader Builder / use vertex context to parse the symbol rotation expression
Previously the expression was parsed in the fragment shader context, which
meant in case the expression used an attributes the resulting GLSL code
would be wrong.

Fragment shader context:
`float angle = v_heading; // we're using the varying: not OK`

Vertex shader context:
`float angle = a_heading; // we're using the attribute: OK`
2020-03-03 10:09:39 +01:00
Olivier Guyot bf38796ec7 Merge pull request #10684 from jellyedwards/master
perf: only do expensive reload when texture changes
2020-02-17 13:26:46 +01:00
Olivier Guyot d5c72f62d5 Merge pull request #10632 from jahow/draw-interaction-append-coords
Draw interaction: Append coordinates to polygons and lines (reworked)
2020-02-11 13:46:01 +01:00
Olivier Guyot 8d4c3b2887 Draw / clearer variable names 2020-02-11 11:19:55 +01:00
Olivier Guyot 6641832621 Improvements to the tracing example
* no embedded geojson
* better behaviour on draw end (no lingering preview line)
* clearer comments
* support for multi polygons to snap to
2020-02-11 11:03:38 +01:00
Olivier Guyot 3c5d0f223e Draw / fix map object in addToDrawing method 2020-02-10 16:55:35 +01:00
Olivier Guyot 8722d16158 Rewrite the example showcasing DrawInteraction#appendCoordinates
The example is now focused on showing how a kind of "tracing" mode
can be achieved using the Draw interaction, making it easier
for the user to snap to an existing geometry while preserving
topology.
2020-02-10 16:48:12 +01:00
Olivier Guyot 6d092cf1a6 Merge pull request #10262 from bjornharrtell/lazy-dom-impl
Rework to make Document and XMLSerializer lazy and injectable
2020-01-06 09:37:17 +01:00
Olivier Guyot e4ea272799 Merge pull request #10413 from MoonE/zoomsliderextent
Limit the ZoomSlider's range to the view's constrained resolution.
2019-12-23 14:59:19 +01:00
Olivier Guyot b68d5e139d Merge pull request #10438 from jahow/prevent-layout-reflow
Avoid accessing the DOM to read the viewport size too often
2019-12-23 10:57:42 +01:00
Olivier Guyot 4440994ec8 Avoid recomputing the viewport size by reading the DOM everytime
Also clarify View#calculateExtent doc & remove the [data-view] attribute
on the viewport element (not needed anymore).
2019-12-23 10:47:54 +01:00
Olivier Guyot 0d9aec4b6b Merge pull request #10439 from jahow/webgl-add-rotation
WebGL points layer / add support for symbol rotation
2019-12-23 10:32:12 +01:00
Olivier Guyot 33e24e9ce9 Updated webgl-points-layer example to add a style with rotation
Also made it so that the map re-renders continously, to be able to
use the ["time"] operator.
2019-12-20 21:54:06 +01:00
Olivier Guyot 6c46eb1dd0 Webgl / add support for a rotation parameter in LiteralStyle
The ShaderBuilder can now take a rotation expression.
2019-12-20 17:39:40 +01:00
Olivier Guyot 6f000e3155 Add missing documentation in ol/style/expressions 2019-12-20 17:13:15 +01:00
Olivier Guyot 4a8a7619d5 Merge pull request #10409 from jahow/fix-heatmap-pixelratio
Improve viewport computation in WebGL Postprocessing
2019-12-13 12:13:17 +01:00
Olivier Guyot cae32edb02 WebGL Postprocess / fix viewport computation with pixelratio != 1 2019-12-13 10:34:31 +01:00
Olivier Guyot ca0ce4986d Merge pull request #10119 from mike-000/patch-8
Add crossOrigin option to ol/format/KML for icons
2019-12-13 09:26:56 +01:00
Olivier Guyot 6537fecc69 Merge pull request #10181 from roemhildtg/master
add tags to example docs
2019-12-13 09:25:50 +01:00
Olivier Guyot ae66471e78 Webgl renderer / hide shader compile errors
Turns out there are sometimes errors that will not prevent the
shader from functioning normally. As such, it is not possible
to simply throw when there are errors/warnings.

Since we are not logging to the console, these errors will have to stay hidden
unless the user requests them explicitly.
2019-11-06 21:40:39 +01:00
Olivier Guyot 7da86ae71f Webgl points renderer / slight improvements following review
Also fixes a lint error.
2019-11-04 09:55:54 +01:00
Olivier Guyot af15cfb815 Icon webgl example / avoid doing hit detection when view is moving 2019-11-04 09:31:38 +01:00
Olivier Guyot 600e1a4647 Webgl points renderer / use a smaller canvas for hit detection render
The hit detection render is now done against a canvas with half the
width/height of the main render. This still provides sufficient precision
while requiring a much smaller memory allocation (especially for
retina devices).
2019-11-04 09:31:38 +01:00
Olivier Guyot 43010c8934 Webgl / return 0 if doing renderTarget.read outside of data width/height
This would happen when WebGLPointsLayerRenderer.forEachFeatureAtCoordinate
is called on "warped" worlds at -360/+360 degrees, and may produce false
positives.
2019-11-04 09:31:38 +01:00
Olivier Guyot e5e03d46a0 Webgl points renderer / more optimizations
Simplify calls in the attributes callback, also less stress
on garbage collection.
2019-11-04 09:31:38 +01:00
Olivier Guyot e78c14c061 Webgl points renderer / add a cache for features in the source
This allows quicker access to features as well as their geometries
and properties, reducing the time taken by a rebuildBuffers call.
2019-11-04 09:31:38 +01:00
Olivier Guyot 6c0dd6152d Modified the icon-sprite-webgl example to allow filtering on a string attribute 2019-10-28 15:55:15 +01:00
Olivier Guyot b96e70e952 Expressions / renamed mod to % to be more in line with MB style spec 2019-10-28 15:55:15 +01:00
Olivier Guyot 501c90b0a2 Expressions / introduced the case operator
This operator is used for if/else control flow
2019-10-28 15:52:31 +01:00
Olivier Guyot 2a2783c086 ShaderBuilder / better handling of strings variables/attributes
Now values which are not mentioned in the style are still added to
the string literals mapping.

Also an error will be thrown if a style references a missing variable.
2019-10-28 15:21:44 +01:00
Olivier Guyot 2f49876180 Expressions / add != operator & slightly better doc 2019-10-28 15:13:43 +01:00
Olivier Guyot 80b4473180 Simplify the heatmap example
Use a weight function instead of manually edditing the features.
2019-10-28 10:27:29 +01:00
Olivier Guyot cd3b222467 Specify an actual extent when loading features in the Webgl points renderer
This means any specified loading strategy will be taken into account.

Also added some tests to make sure the interaction with the source is
correct.
2019-10-28 10:26:31 +01:00
Olivier Guyot e63bb45e6f Webgl points layer / allow disabling hit detection
Having hit detection enabled has an overhead as it means
continously generating additional render instructions and rendering
to an offscreen canvas
2019-10-25 15:11:37 +02:00
Olivier Guyot 4462608991 Expressions / adds color and array conversion operators
Also fixes existing error throwingtests which were essentially doing nothing.
2019-10-25 14:55:44 +02:00
Olivier Guyot ff3cc9b4d0 Expressions / renamed operator pow to ^
To be more in line with Mapbox style spec
2019-10-25 14:55:44 +02:00
Olivier Guyot a844691d7b Added new example styles in the webgl points layer example 2019-10-25 14:55:44 +02:00
Olivier Guyot acf973751b Webgl / added time and resolution as default uniforms
Also added the `zoom` and `resolution` style operators
2019-10-25 14:55:44 +02:00
Olivier Guyot e843b2cfc0 Expressions / adaptation and cleanup after stretch operator removal
The examples have been fixed as well.
2019-10-25 14:55:44 +02:00
Olivier Guyot 719495587c Expressions / rework the interpolate operator
This operator is now able to map numbers to output ranges as well as colors,
making the stretch operator unnecessary. Also allows giving multiple stops,
like in Mapbox style spec.
2019-10-25 14:55:44 +02:00
Olivier Guyot 9e010631c1 Expressions / refactor operators to avoid linting errors
Previously the utilities used the Operators dict before its definition.
2019-10-25 14:55:44 +02:00
Olivier Guyot a64f2eb720 Update the icon-sprite-webgl example to use a WebGLPoints layer 2019-10-25 14:55:44 +02:00
Olivier Guyot d643951a74 Shader Builder / add option to generate hit detection shaders 2019-10-25 14:55:44 +02:00
Olivier Guyot a39f751981 Shader Builder / adapt logic & test to the new expression types
Also fixes a sneaky bug where the two last texture coordinates were inverted.
2019-10-25 14:55:44 +02:00
Olivier Guyot fc98704bcb Expressions / adds a test for a complex combination of operators 2019-10-25 14:55:44 +02:00
Olivier Guyot 27c530ec64 Expressions / introduce the match operator
This operator allows mapping from input values to output values of different
kinds and handles variable arguments count.
2019-10-25 14:55:44 +02:00
Olivier Guyot e3f7d29bb2 Expressions / add utilities for using strings in GLSL & more type checking
It is now possible to specify a type hint when parsing an expression, which
helps determine the output value type.

When no single output type can be inferred, an error is thrown.

For strings, every literal value will be replaced by a number and a map of
these associations will be kept in the parsing context, which is passed
recursively.
2019-10-25 14:55:44 +02:00
Olivier Guyot 44347a9ed3 Adapt the icon-sprite-webgl example to the new expressions module 2019-10-25 14:55:44 +02:00
Olivier Guyot 31dae929f5 ShaderBuilder / adapt logic & tests to new expressions module 2019-10-25 14:55:44 +02:00
Olivier Guyot 5712792772 Expressions / add more tests for conversion to GLSL 2019-10-25 14:55:44 +02:00
Olivier Guyot bcf7649b9a Expressions / store the variables & attributes in the context 2019-10-25 14:55:44 +02:00
Olivier Guyot 7e4119d580 Expressions / restored the parsing logic with better type checking
Converting expressions to GLSL is now done in ol/style/expressions, with the
same logic as before in ol/webgl/ShaderBuilder.
2019-10-25 14:55:44 +02:00
Olivier Guyot 72903d6454 Expressions / added operator declarations & type checking logic 2019-10-25 14:55:44 +02:00
Olivier Guyot 35af80b433 Style / add an ol/style/expressions module
This module will contain the utilities and operator declarations
for literal style expressions, boh for type checking and parsing
2019-10-25 14:55:44 +02:00
Olivier Guyot fc555241ea ShaderBuilder / simplify check/parse code a bit 2019-10-23 09:22:12 +02:00
Olivier Guyot 1fe5a68e16 Fix the triangles style in the wbegl-points-layer example 2019-10-22 23:27:26 +02:00
Olivier Guyot 948003ff27 Rewrite to filter-points-webgl example to use a Webgl points layer
The demonstrated features have been recreated using a literal
style (filtering, pulse animation).
2019-10-22 23:17:00 +02:00
Olivier Guyot d837166a1b Literal Style / add new math operators 2019-10-22 23:17:00 +02:00
Olivier Guyot c659c05de8 ShaderBuilder / fix stretch operator GLSL expression 2019-10-22 23:17:00 +02:00
Olivier Guyot 485ade42b5 Literal Style / add support for color interpolation 2019-10-22 23:17:00 +02:00
Olivier Guyot 85c3aae454 ShaderBuilder / add support for color interpolation in parse 2019-10-22 23:17:00 +02:00
Olivier Guyot a29fc016f5 ShaderBuilder / formatColor/Array utilities now output vecX(...) 2019-10-22 23:17:00 +02:00
Olivier Guyot 19eadaea24 Shader Builder / add type checking in expressions parsing
All expressions will now be type checked before actually being parsed.
2019-10-22 23:17:00 +02:00
Olivier Guyot b8e8d30df0 Shader Builder / add utilities for checking an expression type
Type checking is done either against a literal value (number, string...)
or against the operator in case of an expression.

Sometimes it is not possible to infer only one type, for example
the value 'transparent' could either be a color or a string. This
is covered by the fact that all operators expect exactly one type
for their arguments.
2019-10-22 23:17:00 +02:00
Olivier Guyot f43637cc33 Shader Builder / support strings in formatColor 2019-10-22 23:17:00 +02:00
Olivier Guyot 56faf4c3ad Color / add an isStringColor utility function 2019-10-22 23:17:30 +02:00
Olivier Guyot a0b271a812 Literal Style / add support for variables in the style
These variables are accessed using the `var` operator, and are meant
to be mutated directly in the style object. When doing so,
the new value will always be used for the render.

This is intended to be used for modifying the style through external
parameters such as an input field, a slider, mouse position etc.
2019-10-22 23:17:00 +02:00
Olivier Guyot a1c00744d1 Webgl points renderer / throw if shader compilation fails
This should only happen if providing handcrafted shaders to the renderer.
2019-10-22 23:17:00 +02:00
Olivier Guyot 94b8cf6af3 Webgl / add support for a time operator in literal styles
This required adding `u_time` as one of the default uniforms provided by the
webgl helper.
2019-10-22 23:17:23 +02:00
Olivier Guyot 0c0c8c5d56 Literal Style / add support for a filter property 2019-10-22 23:17:00 +02:00
Olivier Guyot e38250ee14 ShaderBuilder / add fragment discard expression in shader params 2019-10-22 11:39:30 +02:00
Olivier Guyot 7b66b294a8 ShaderBuilder / attempt to clarify the way attributes are handled in parseSymbolStyle 2019-10-22 11:18:39 +02:00
Olivier Guyot 9ee93cd2cf ShaderBuilder / refactoring to use an actual builder pattern
There is now a ShaderBuilder class with chainable methods
to specify more easily the contents of the final shaders.
This is to avoid passing around large objects to different functions,
and allow for a richer API.

The documentation has also been corrected and clarified.
2019-10-22 11:12:06 +02:00
Olivier Guyot 87414256e2 Heatmap / use worker events instead of timeout for test 2019-10-11 14:06:27 +02:00
Olivier Guyot b44a6ab26a Heatmap / add hit detection shaders 2019-10-08 13:27:31 +02:00
Olivier Guyot 13147e0b82 Add experimental tags to a few examples & added doc in the README
Plus some typos.
2019-09-26 20:19:23 +02:00
Olivier Guyot 09134a6091 Shader builder / typecheck fix for parse fn 2019-09-26 16:30:19 +02:00
Olivier Guyot 858f0fc0cc Update the webgl-points-layer example to reflect new possibilities 2019-09-26 16:30:19 +02:00
Olivier Guyot 28d157af56 Shader builder / add circle and triangle shapes for symbols 2019-09-26 16:30:19 +02:00
Olivier Guyot 9b3a9b5eca Shader builder / add logic for transforming a style into shader params
This was previously handled by the WebGLPointsLayer class, but is now
externalized and tested.
2019-09-26 16:20:35 +02:00
Olivier Guyot d5caabbbfc Shader builder / add basic expression parsing
Only a handful of expressions for now, very loosely based on the
mapbox style spec. Also only work on numerical values.
2019-09-26 16:20:35 +02:00
Olivier Guyot 02e5e1776c Hit detection / fix test for wrapped geometries hit detection
Also restores the whole unit test suite.
2019-09-26 15:59:14 +02:00
Olivier Guyot b89c1255f7 Canvas vector / Avoid modifying the coordinates array in place 2019-09-26 15:34:31 +02:00
Olivier Guyot 7e4383f554 Webgl renderer / now accepts any kind of layer (not just vector) 2019-09-26 15:33:54 +02:00
Olivier Guyot 7da3b60061 Webgl Layer / rename literalStyle property to style 2019-09-26 14:44:32 +02:00
Olivier Guyot 0732f17fd3 Webgl layer / remove @api tag & better doc
Also the webgl layer now only inherits from the Layer class,
not the VectorLayer one.
2019-09-26 14:42:04 +02:00
Olivier Guyot 9e9aa66f5f Webgl points renderer / restore check for hit detection readiness 2019-09-25 17:22:36 +02:00
Olivier Guyot 34572da17b Webgl shader builder / expanded functionality
Now takes in a custom object with attributes, uniforms etc.
The WebGLPointsLayer uses this to handle image icons.
2019-09-25 17:22:36 +02:00
Olivier Guyot b8564d503a Webgl icon example / restore texture for icons 2019-09-25 17:22:36 +02:00
Olivier Guyot 9e55a8b2f0 Webgl / linting & test fixes 2019-09-25 17:22:36 +02:00
Olivier Guyot 610a846149 Webgl points renderer / make the hit detection optional 2019-09-25 17:22:36 +02:00
Olivier Guyot 23c2999cab Webgl points renderer / fix hit detection
Due to the fact that the points renderer does not know for sure
which attributes will be used for rendering, it is now mandatory
to provide both vertex/fragment shaders for rendering AND hit
detection.

The hit detection shaders should expect having an `a_hitColor`
that they should return to allow matching the feature uid.

This will be all one eventually by shader builders under the hood.
2019-09-25 12:11:09 +02:00
Olivier Guyot 109f9718f9 Webgl renderer / fix existing examples
The shaders were rewritten manually for those, althoughj eventually they
should use the shader builder utilities as well.
2019-09-25 11:09:07 +02:00
Olivier Guyot 2b36445ecc Webgl / Adapt the points renderer to use custom attributes
Now most attributes will be custom ones defined by the user of the renderer.
The hit detection is broken for now and still has to be fixed.
Also it is not possible anymore to give a texture to the renderer,
this will have to be fixed as well.
2019-09-25 10:11:27 +02:00