Commit Graph

146 Commits

Author SHA1 Message Date
ahocevar
58c8b07ab5 Get hit candidates from RTree, then refine result
Now we get exact hits also for lines and polygons.
2013-04-30 13:34:12 +02:00
ahocevar
cc1b70c74b Giving the map a getFeatureInfoForPixel method
This method is an entry point for getting feature information.
Renderers can use a hit canvas or defer to a layer (source) to
get matching features for a pixel.

For now this is only implemented for vector layers, and it uses
a bbox query because we cannot refine the result because of
missing geometry intersection functions yet.
2013-04-30 13:32:16 +02:00
Tom Payne
465e24cf4e Port ol.renderer.canvas to new extents 2013-04-19 10:03:35 +02:00
Tom Payne
4be8c991f7 Add missing Closure Library requires 2013-04-06 14:28:12 +02:00
Tom Payne
02196c94b5 Redefine ol.Coordinate to be Array.<number> 2013-04-05 12:30:37 +02:00
ahocevar
28f29e9d40 Don't create tile if rendering needs to be deferred
Rendering vector tiles with mixed geometry types does not work
as expected, because the tile is created without the geometries
that need another rendering pass because of missing icons. This
was discovered by @bartvde when working on the KML parser, where
mixed geometry types are common.

This change fixes the issue by breaking out from rendering
entirely when renderFeaturesByGeometryType returns a deferred
state. In addition, there was a related bug because icons are
added to the cache regardless of its loaded state. This is also
fixed now.
2013-03-23 11:34:38 +01:00
Jeff Williams
97879a3572 remove descriptions from JSDoc type tags 2013-03-21 09:54:52 -07:00
Tim Schaub
825a6d65e8 Properly maintain dirty state during animation
The previous logic assumed that if there were any tiles to render, the dirty state should be false.  The correct logic is to say that if we don't render during animation, dirty is true.
2013-03-19 07:27:59 -06:00
Frederic Junod
bce9e9d0de Fix typecast
Fix JSC_MISPLACED_TYPE_ANNOTATION warnings with the plovr 2013 release
candidate (http://plovr.com/plovr-2013-rc.jar)
2013-03-14 15:59:21 +01:00
ahocevar
eeecd424bf Moving vector rendering to ol.renderer.canvas.VectorRenderer 2013-03-12 10:05:47 +01:00
ahocevar
5af71a488a No need to continue rendering when we need to defer 2013-03-07 18:13:22 +01:00
ahocevar
f4a16e7f57 Collect features before rendering to the sketch canvas
This avoids features being rendered multiple times when they
cross tile borders. Currently this makes the style-rules.html
example extremely slow. Fix for that to come in my next commit.
2013-03-07 16:57:22 +01:00
ahocevar
f0039ee460 Additional index dimension for RTree; use RTree again
The RTree can easily maintain an additional index dimension,
by passing a type with each added item. Now instead of
maintaining an RTree for each geometry type, we have a single
RTree with a type filter. With this change, using the RTree
finally speeds up rendering as expected.
2013-03-07 14:36:09 +01:00
Tim Schaub
84527c4b56 Disable bbox filtering for now
The RTree doesn't appear to be performing properly
2013-03-06 19:07:26 -07:00
Tim Schaub
2e4dc430e9 Render multi-part geometries
As noted in the comment, filtering/rendering once per geometry type will be replaced by rendering once per symbolizer type.
2013-03-06 19:06:41 -07:00
Tim Schaub
00fa7ff3a9 Listen for layer changes and expire tiles
We need a more flexible event system.  We could have a VectorLayerEvent type and dispatch 'featuresadded' here.  But listeners want features typically and perhaps extent.  This won't be true for all vector layer events (suggesting a more specific VectorFeatureEvent type or something).
2013-03-06 19:05:35 -07:00
ahocevar
100c8a1cf4 Adding gutter when requesting features for a tile
By doing so, we avoid features being cut off when the symbolizer
causes it to be rendered across tile borders.
2013-03-06 21:06:21 +01:00
ahocevar
ab19d255c7 Rendering icons from external graphic urls 2013-03-06 01:57:08 +01:00
Tim Schaub
9a0e7a96fe Moving the feature management to the layer
The source will be responsible for fetching vector data.
2013-03-05 18:25:07 +01:00
Tim Schaub
dc19948a85 Get tile size for zoom level (see #258) 2013-03-04 21:30:01 +01:00
ahocevar
f4a4522eb4 Giving vector layers the style they deserve
Now vector layers can have a style. ol.Style instances have an
apply method to get the symbolizer literals for a feature. If the
layer does not have a style defined, there is also a static
applyDefaultStyle function on ol.Style to get the default
symbolizer literals for a feature. The vector layer also got a
groupFeaturesBySymbolizerLiteral method, which returns an array
with features grouped by symbolizer, as needed by the canvas
renderer.
2013-03-02 17:38:01 +01:00
Tim Schaub
438664a190 Renaming literals 2013-02-19 22:35:29 -07:00
Tim Schaub
46e31f9f9a Lint and names 2013-02-18 22:20:50 -07:00
Tim Schaub
ce4b95f960 Decoupling canvas tile grid from vector source grid
If we have a gridded vector source, the grid should have something to do with the source data (e.g. the vector data is available in a regular grid).  The vector layer renderer's internal grid is for rendering canvas tiles and doesn't have anything to do with the source.
2013-02-18 17:54:13 -07:00
Tim Schaub
e9fb83d4ee Use post render frame for tile pruning
We should discuss whether post render functions must be run after each render frame or not.  If these can be run after multiple render frames, it would make sense to increase the timeout.  As it is, it looks like post render functions are run for every render.  Hard to see what the benefit is in this case.
2013-02-18 11:58:43 -07:00
Tim Schaub
2082ba7637 Fewer, bigger tiles 2013-02-13 15:51:06 -07:00
ahocevar
e155f870cd Fixing RTree, and using it for retrieving geometries 2013-02-13 12:29:14 +01: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
ahocevar
619803cdeb More goog.requires fixes 2013-02-06 16:36:42 +01:00
ahocevar
61e4452c83 Adding missing and removing unused goog.requires 2013-02-06 16:26:24 +01:00
ahocevar
43dd9ca68c Don't use unshift 2013-02-02 12:29:08 +01:00
ahocevar
e61c26830e Manage tile cache
This change implements a LRU policy for tile cachint, and keeps
128 tiles in the cache by default.
2013-01-30 17:09:43 +01:00
ahocevar
65b3bb70a1 Some optimizations
* Tiles are now cut out of the sketch renderer in a separate
  pass. This ensures that point features at tile borders appear
  at both sides of the border. However, if such features get
  added in a later tileRange rendering pass, tiles from a
  previous rendering pass will still not have that feature.
* The tile canvas is only created once, and cloneNode(false) is
  used to get a canvas for a new tile.
2013-01-25 16:46:12 +01: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
ahocevar
b0a7badc8f Started on proper date line wrapping
What we want in the end is vector tiles repeated just as raster
tiles. This change only avoids repeated tiles with the same
content being rendered and stored in the cache.
2013-01-24 17:29:21 +01:00
ahocevar
fe605ceebb Better, but still not all the way there 2013-01-24 16:21:30 +01:00
Tim Schaub
9bd1ab99d1 Toward tiled vector rendering 2013-01-24 02:06:40 -07:00
ahocevar
4a54cc69ce Tiled vector rendering
This needs more work still - see inline TODOs. It also has a
major bug - rendered vector features do not scale and do not
change their offset during panning. So only the initial view is
correct.
2013-01-23 21:37:06 +01:00
Tim Schaub
35f6984e69 Unused var and some notes 2013-01-22 11:21:35 -07:00
ahocevar
4e6b864e27 Making default symbolizers compiler safe 2013-01-22 14:09:04 +01: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
0f33561af2 Skeleton canvas renderer for vector layer 2013-01-21 18:02:28 -07:00