Commit Graph
100 Commits
Author SHA1 Message Date
Tim Schaub be255ed6c7 Adding ol.Expression
This simple expression constructor will be used for symbolizer properties and the layer will generate symbolizer literals for rendering by evaluating any expressions with a feature as the this argument and feature attributes as the scope.  This allows generating labels that concatenate multiple attribute values together or displaying point symbols that are sized according to a population attribute divided by an area attribute, for example.

This implementation will not work in environments where the content security policy disallows the use of the Function constructor.  This is the case on browser extensions.  A more content-security-policy-friendly implementation would be to come up with a restricted grammar and write a lex/parser.  This is the road I started down, but this verison is far less code, and I think the security policy limitations are minor at this point.  This version will always be faster/lighter than a parser, so one is written in the future, it should only be pulled in where content security policy mandates it.
2013-02-14 17:19:15 -07:00
Tim Schaub 59a203b2b7 Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-02-14 17:18:00 -07:00
Tim Schaub 2082ba7637 Fewer, bigger tiles 2013-02-13 15:51:06 -07:00
Tim Schaub f5c627ab51 Only listen once for tile events
Assuming browser garbage collection cannot happen while we have listeners in the global registry, we need to listenOnce to avoid memory leaks with the tile queue.
2013-02-13 15:37:33 -07:00
Tim Schaub 652b7dd696 Merge pull request #184 from tschaub/less-animation
Avoid unnecessary animation loop while tiles load
2013-02-07 15:48:28 -08:00
Tim Schaub 440ea038fe Merge pull request #183 from tschaub/natural-names
More natural names for animations
2013-02-07 13:44:13 -08:00
Tim Schaub 3c4d218ec5 Only listen for first event 2013-02-07 14:06:05 -07:00
Tim Schaub 5bbd8fd9f3 Using ol.TileCache for managing canvas tiles 2013-02-06 18:23:39 -07:00
Tim Schaub 11b8c0ff47 Don't generate new tiles while animating 2013-02-06 17:47:03 -07:00
Tim Schaub e079c19413 Don't repeatedly render while waiting for tiles to load
Instead of going into an unnecessary animation loop, we can simply wait to be notified when tiles load.

The WebGL renderer still sets frameState.animate true, but I think this too should be unnecessary (full page example works without it, side-by-side example shows it cannot yet be removed).
2013-02-06 16:10:46 -07:00
Tim Schaub 2bd29ff60e Only track tiles that are actually wanted
Instead of keeping track of wanted tile ranges, we can instead track wanted tiles individually.  This provides enough for the map to know how to prioritize tiles and should be more efficient (no extra calls to extend tile ranges or check for tile containment within a range).
2013-02-06 16:08:24 -07:00
Tim Schaub e335b7b74a Make frame state available before rendering frame
Without this change, tiles that are enqueued on the first rendering will always get priority `ol.TileQueue.DROP` because `map.frameState_` is not yet defined (meaning a single render call doesn't result in any tiles loading).
2013-02-06 16:02:26 -07:00
Tim Schaub a2bbdf7ccc More natural names for animations 2013-02-06 13:43:54 -07:00
Tim Schaub 0c48fbd188 Check sooner and only assert if duration hasn't passed 2013-02-05 10:50:18 -07:00
Tim Schaub a7737150fe Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-01-24 22:21:25 -07:00
Tim Schaub 4e3f984796 Properly rendering features to canvas tiles
It looks like this approach will work well for panning (as anticipated).  For animated zooming, it is not going to work as is.  It looks like the canvas tile generation is too much for this type of animation loop.  Though there are clearly still areas for optimization:

 * Don't create new tiles while animating between zoom levels.  Using existing tiles only while animating should bring a significant performance gain.
 * Simple spatial index for tiles - each tile coord in the matrix could have a feature lookup object (keyed by id).  This needs to account for rendered dimension (as witnessed by the point being cut by a tile).  Given that the current example uses only three features, adding the spatial index should only be a minor improvement.
 * Reuse a fixed set of canvas tiles that are generated at construction (and increased/decreased with view size changes).
 * If a fixed set of tiles is not used, at least new ones could be cloned from existing ones (minor).
 * Do some profiling to look for more ideas.

In addition, world-wrapping needs addressed.  I don't think this renderer is the right (or at least the only) place to address this.  And the cache of tiles needs to be managed for real.  But hey, at least we've got a working tiled vector renderer now.
2013-01-24 21:57:12 -07:00
Tim Schaub f2b325b430 Adding convenient tile labels for debugging
This will be removed when behavior is right.
2013-01-24 17:16:54 -07:00
Tim Schaub 033daa425b Reverting b0a7badc8f
I think it's complicating things at this point to deal with this.  Unfortunately, it's not proper dateline wrapping as is (only arbitrary tile range extent wrapping).
2013-01-24 17:15:32 -07:00
Tim Schaub 8d5a45d827 Set up example for debugging 2013-01-24 16:51:10 -07:00
Tim Schaub 9bd1ab99d1 Toward tiled vector rendering 2013-01-24 02:06:40 -07:00
Tim Schaub 483e309216 Merge pull request #153 from tschaub/extent
Care with transform
2013-01-24 00:56:18 -08:00
Tim Schaub 3ccfaebcfc Punctuated 2013-01-23 22:18:00 -07:00
Tim Schaub afb9add911 Checked with third-party tool 2013-01-23 22:12:17 -07:00
Tim Schaub 0845dea366 Care with transform
Since the transform method takes an arbitrary transform function, new coordinates may not be ordered in the same way as the originals.
2013-01-23 22:03:08 -07:00
Tim Schaub 07a56bfe3f Parsing GeoJSON FeatureCollection 2013-01-22 17:41:22 -07:00
Tim Schaub 35f6984e69 Unused var and some notes 2013-01-22 11:21:35 -07:00
Tim Schaub c50fcecf42 Vector rendering example
There is a ton of room for optimization here.  The vector layer renderer should only render dirty areas and could maintain a cache of rendered canvas tiles.  The vector source could have a simple spatial index for features (by tile coord).  Need to also discuss how to work with this animation framework (to avoid the excess work while waiting for tiles to load on every other layer).
2013-01-22 01:46:27 -07:00
Tim Schaub 1dd17fc88f Rendering vector layers 2013-01-22 01:36:32 -07:00
Tim Schaub 92c8c9c5df Shape extends point 2013-01-21 23:20:52 -07:00
Tim Schaub 45af404f4b Initial tests for filter 2013-01-21 18:06:29 -07:00
Tim Schaub e4132813af Shorter name 2013-01-21 18:06:14 -07:00
Tim Schaub f80f4fab36 Symbolizer literals will be cached by the renderer 2013-01-21 18:03:25 -07:00
Tim Schaub 0f33561af2 Skeleton canvas renderer for vector layer 2013-01-21 18:02:28 -07:00
Tim Schaub 1a63bf078f Basic vector source and layer
The vector source maintains a cache of features.  These are indexed by geometry type in anticipation of the renderer's needs.
2013-01-21 17:59:09 -07:00
Tim Schaub 9543ce4d4a Initial filter package, geometry type filtering only for now 2013-01-21 17:57:12 -07:00
Tim Schaub 89bc69ccc1 Types for rings and mixed collections 2013-01-21 17:56:12 -07:00
Tim Schaub 6ef2184c83 Geometry type enumeration 2013-01-21 17:46:41 -07:00
Tim Schaub 0fad23970c Disallowing mixed geometry collections for now 2013-01-21 14:46:45 -07:00
Tim Schaub 7ef127cfac Shorter name for ol.Feature 2013-01-21 14:46:02 -07:00
Tim Schaub b4d44f815f Add getBounds to geometry 2013-01-21 12:59:04 -07:00
Tim Schaub 216d30ddc1 Getting the nanometer precision we deserve with web mercator 2013-01-21 10:52:17 -07:00
Tim Schaub 3cf3ef629c Lint
Caught by `build.py precommit` not `build.py lint`.
2013-01-21 10:51:38 -07:00
Tim Schaub 4c2ad60619 Add geojson module in io package 2013-01-20 00:28:07 -07:00
Tim Schaub 497eac82c2 Polygon rendering (no holes yet) 2013-01-19 17:50:04 -07:00
Tim Schaub 0414e337b3 Render lines 2013-01-18 17:57:32 -07:00
Tim Schaub 140e9ba355 General purpose canvas renderer
Currently only renders points as circles.  Eventually will have methods for other geometry types and other symbolizer types.  Also provides static methods to render point symbolizers (returning a canvas that can be drawn on another).
2013-01-18 17:42:12 -07:00
Tim Schaub b92fdaf911 Going with point, line, and polygon symbolizers
Separate fill and stroke symbolizers make a nicer API, but less efficient rendering
2013-01-18 17:20:10 -07:00
Tim Schaub fd0a5f3622 Point, linestring, and linearring coordinates as Float32Array 2013-01-18 15:57:48 -07:00
Tim Schaub 278d32061f To be reworked for rendering like geoms with same symbolizer 2013-01-18 15:55:24 -07:00
Tim Schaub 3ac437393a To be reworked as ol.renderer.canvas.VectorLayer 2013-01-18 15:54:48 -07:00
Tim Schaub 74281d2b00 Merge from master 2013-01-17 18:12:06 -07:00
Tim Schaub fe56b15c52 Clear canvas with opacity 1 2013-01-17 15:30:16 -07:00
Tim Schaub d6de79b2bd Merge pull request #129 from tschaub/color
Going with CSS norms for r/g/b/a values.
2013-01-17 13:28:51 -08:00
Tim Schaub f39b6a1be3 Errant require 2013-01-17 14:23:35 -07:00
Tim Schaub 10672ad303 Standardizing color ranges (see #129) 2013-01-17 14:19:50 -07:00
Tim Schaub b36eab1dfa Properly set transform before filling background (closes #128)
Order of args is m11, m12, m21, m22, dx, dy
2013-01-17 13:40:00 -07:00
Tim Schaub 141e5aa9fc Trim search string before use
The `window.location.search` string includes the "?" symbol.  Without this change, `createFromQueryData` only works if the "renderer" parameter is not in first position (see 4037bafc45).
2013-01-17 13:05:47 -07:00
Tim Schaub 7971ec1b3b Render geometries to a canvas 2013-01-07 01:42:31 -05:00
Tim Schaub 7cca691b9f Start of style package
These literals will be used internally only - created when evaluating
non-literal symbolizers (with properties that are expressions).
2013-01-07 01:41:02 -05:00
Tim Schaub 997c7145ab Bare bones geom package 2013-01-07 01:34:33 -05:00
Tim Schaub 464be78a16 Satisfying compiler 2013-01-06 10:59:21 -07:00
Tim Schaub 39af56ecb3 Satisfying gjslint 2013-01-06 10:07:29 -07:00
Tim Schaub 6f929efeb3 Merge branch 'master' into vector 2013-01-06 09:37:34 -07:00
tschaub 9622395c86 Use radians for hue rotation
This commit is a cherry-pick from 7f578f0.

Conflicts:

	src/ol/renderer/dom/domlayerrenderer.js
2012-12-12 15:22:01 +01:00
tschaub 4d97b583c6 Match the current Filter Effects spec
This commit is a cherry-pick of 19f7778.

The current draft of the [filter spec](https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html)
describes brightness, contrast, hue-rotate, and saturate functions that
roughly match our layer's setBrightness, setContrast, setHue, and
setSaturation methods.  These changes make the range of our methods match
the corresponding functions in the spec.  The one exception is the
brightness function.  The spec says it has a range of 0 to positive infinity.
The WebKit implementation accepts a range of -1 to 1 (as of
https://github.com/WebKit/webkit/commit/8f4765e569).  There's an open
(ticket)[https://www.w3.org/Bugs/Public/show_bug.cgi?id=15647] recommending
that the spec be changed to match.

I'm not stuck on having our methods match those of the filter spec, but the
parity would be nice.

These changes leave the WebGL map renderer "broken" (whacky colors).  It would
be straightforward to update the current fragment shader to handle the new
range of hue, but the brightness, contrast, and saturation handling will
need to be reworked.

For inspiration, here are the color transformation
matrix calculations the WebKit filters:
https://github.com/WebKit/webkit/blob/8f4765e5698c9171c2b3f984d0d9d65188185de3/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp#L64-80

Conflicts:

	src/ol/renderer/dom/domlayerrenderer.js
2012-12-12 15:18:34 +01:00
Tim Schaub e57f8b45a6 Merge pull request #78 from geops/api-docs-jsdoc
Taking over new template from jsdoc but keep modifications by OpenLayers as much as possible
2012-10-31 13:38:24 -07:00
tschaub 3af801df96 Updating instructions on contributions
This links to the newly created online ICLA form.
2012-10-26 15:41:13 -06:00
Tim Schaub eef4eb0eea Merge pull request #61 from twpayne/z-sort-in-dom-renderer
Z sort in dom renderer
2012-10-17 21:24:40 -07:00
Tim Schaub f8462460bf Two lessons learned
Telling the compiler that object keys are numeric causes more harm
than good (see === comparison that could never be met though the
compiler didn't catch it).

Never use goog functions without reading the source first.  The
goog.array.sort method does nothing special sorting numeric strings
(so the zs array might be ['1', '10', '2'] here).
2012-10-09 23:31:38 -06:00
Tim Schaub ce1b99cb56 Remove alt-z tiles when all tiles load at target z
The changes in a14a15159f made it so tiles
at alternate resolutions were not pruned when target tiles finished loading.
2012-10-09 22:56:37 -06:00
Tim Schaub a14a15159f Simpler and more thorough tile pruning
The render method always generates a map of all tiles that should be drawn
(called tilesToDrawByZ).  This includes tiles at alternate resolutions, tiles
still loading, and tiles previously rendered.  At the end of the render
sequence we can simply remove all previously rendered tiles that aren't in
tilesToDrawByZ.  This provides an alternate solution to the problem described
in #53 and more.
2012-10-08 00:41:21 -06:00
Tim Schaub 2c2d40a53c Remove tiles outside rendered extent
To avoid having misplaced at alternate resolutions while zooming, all tiles
outside the rendered extent need to be removed from the dom (closes #53).
2012-10-07 23:47:47 -06:00
Tim Schaub d6173a5aac Removing unused code 2012-10-07 22:57:09 -06:00
tschaub 671c902d72 Creating the target directory for api docs 2012-10-01 16:35:38 -06:00
Tim Schaub c120c03fb1 Properly maintain offset and origin while rotating
This brings equivalent behavior when rotating in both renderers.  Previously, offsets were maintained with style top/left.  Now a single transform handles the translation and rotation.  The scale3d function removes the separation between tiles.  The next step for the DOM renderer is to scale in this same transform.
2012-09-29 17:55:28 -06:00
Tim Schaub 0e27f31785 Avoid undefined rotation 2012-09-29 17:47:44 -06:00
Tim Schaub 67bc677ecb Stick with radians 2012-09-29 01:37:54 +02:00
Tim Schaub 50bf2f015c Getting rid of lines between rotated tiles
Applying the scale3d trick just to get rid of small pixel gap between rotated tiles.  This will be reworked soon with additional use of transforms.
2012-09-29 01:33:50 +02:00
Tim Schaub bc5cd13855 Tiny bit of style 2012-09-29 01:17:46 +02:00
Tim Schaub c24e520961 Non-functioning example
When loading this example in compiled mode, the page displays the following:

    ol3 proj4js demo

    [object Object][object Object]

With `mode=RAW`, it does display some numbers, but I think we could better explain this functionality with a different sort of tutorial/example.
2012-09-29 01:12:40 +02:00
Tim Schaub 71547c6e48 Examples don't load without make serve 2012-09-29 00:47:42 +02:00
Tim Schaub ff19ab0a28 Call event.getPixel() to get the map pixel offset
The new getPixel method should be used instead of checking offsetX/Y on the browser event.
2012-09-28 12:19:32 +02:00
Tim Schaub eb29e6a43c Using null instead of null or object or undefined 2012-09-28 12:08:21 +02:00
Tim Schaub 3e34013c09 Separating out method to get pixel offset 2012-09-28 12:08:21 +02:00
Tim Schaub 6ed27779cc Rotation support for the dom renderer
Thanks @fredj for the inspiration.  This gives us initial rotation support.  It exposes some issues in the interactions that I'll address separately.  Closes #22.
2012-09-28 10:53:36 +02:00
Tim Schaub 981a40a994 Remove tiles that are still loading at alt z
When zooming to a new zoom level, we can immediately remove tiles from the previous level.  This (strongly) suggests not adding images to the container until they have actually loaded.
2012-09-27 17:46:23 +02:00
Tim Schaub b8a69f0777 Adjusting layers pane only when necessary
We only want to adjust things that have to do with rendering (like the position of the layers panel) when actually rendering.  The handleXChange methods may be called more times than we can actually render, so we never want to do anything that touches the DOM there.  Instead, we have to keep track of the state at previous render and adjust the layers panel (or other) based on changes only when rendering.
2012-09-27 16:09:04 +02:00
Tim Schaub d4d04eface Less whitespace by default. 2012-09-27 16:09:03 +02:00
Tim Schaub 9f9729656b Todos done. 2012-09-27 16:09:03 +02:00
Tim Schaub 3510c37e43 Handle map size changes in the renderer 2012-09-26 14:10:16 +02:00
Tim Schaub 5b36cf1312 Only adjust tile when necessary 2012-09-26 13:12:36 +02:00
Tim Schaub 24edce24f1 Add alternate tiles under tiles at target z
When zooming or panning, if we have tiles at alternate resolutions, those tiles are inserted in the DOM before the tiles at the target resolution.  This means you should see blurry tiles instead of whitespace when panning (assuming you've already zoomed in a bit).
2012-09-26 12:18:11 +02:00
Tim Schaub 48c4cbc1e5 Correcting comment typos 2012-09-26 11:11:51 +02:00
Tim Schaub 8e38ab0fdc Lint free. 2012-09-26 10:58:17 +02:00
Tim Schaub 3479e20b0a Merge branch 'alt-tiles' 2012-09-26 10:55:25 +02:00
Tim Schaub 7f58d1a8c6 Proper handling of out-of-range and alt-z tiles
Tile pruning code separated into to methods for clarity.  Alt-z tiles are only removed when all current-z tiles have loaded.  Thanks @elemoine for the excellent debugging session.
2012-09-26 10:52:17 +02:00
Tim Schaub 299173194c First pass at alt-tile rendering for dom renderer 2012-09-25 20:06:20 +02:00
Tim Schaub 900eead7c6 Correct type for imagesToLoad. Add note about shorter path. 2012-09-25 12:08:02 +02:00
Tim Schaub 5eb5715530 More longname display. 2012-09-24 18:23:19 +02:00
Tim Schaub 2b307ef6a9 Replace opt_ prefix with (Optional) in description. 2012-09-24 18:23:19 +02:00