Commit Graph

178 Commits

Author SHA1 Message Date
ahocevar
781caff9e5 Expire tile by range and listen to changes
Instead of just listening for the first change, we now listen
for all changes, and expire tiles by tile range. The outcome is
that the vector layer's addFeatures and removeFeatures methods
now show instant results on the rendered map.
2013-07-19 14:07:16 +02:00
ahocevar
a9fcc5ff15 Addressing @elemoine's review comments 2013-07-19 13:30:14 +02:00
ahocevar
9095032014 Removing unused methods and changing getFeaturesObjectForExtent
With this change, getFeaturesObjectForExtent may return null if
the source does not have data loaded for the provided extent.
A callback can be passed to getFeaturesObjectForExtent to get
notified when the requested data is available.
2013-07-17 11:28:48 +02: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
20527ab1f1 Reuse tile range 2013-06-24 11:34:59 -06:00
Tim Schaub
a9f01a4390 Use getMetersPer unit method 2013-06-24 11:34:48 -06:00
ahocevar
5cc3e189eb Need to take units into account 2013-06-23 18:48:21 +02:00
ahocevar
af0764b1ca Simpler tile coord access now that we only have one resolution 2013-06-23 18:47:49 +02:00
ahocevar
27c23f676b Fixing requires 2013-06-23 18:47:00 +02:00
ahocevar
1c5f466e61 Adding comment about MIN_RESOLUTION 2013-06-23 18:31:25 +02:00
ahocevar
61fcbd560e Do not render tiles during animation and interaction 2013-06-23 18:31:25 +02:00
ahocevar
f20e6002cc Tile grid and cache for one resolution only 2013-06-23 18:31:25 +02:00
ahocevar
89c23b5560 Use binaryInsert instead of sort 2013-06-23 18:31:25 +02:00
ahocevar
aa62764d90 Do not add resolutions while interacting 2013-06-23 18:31:25 +02:00
ahocevar
0aacf197bf Separate method for updating the tile cache 2013-06-23 18:31:24 +02:00
ahocevar
3afd8b4242 Do not use a fixed tile grid for vector rendering
Instead, we create a new tile grid whenever renderFrame is
called, no animation is active, and the resolution is not in the
tile grid already. This gives better rendering results because
we get vector tiles at native resolutions.
2013-06-23 18:30:57 +02:00
ahocevar
1826b7a9be Merge pull request #808 from ahocevar/no-empty-tiles
Don't render/cache tiles with no features. r=@tschaub
2013-06-23 09:11:55 -07:00
ahocevar
3fc4fc3eb8 Only render and cache tiles that have features 2013-06-23 15:52:31 +02:00
ahocevar
c17424deec Basic support for text symbolizers
This adds basic label rendering for points and polygons to the
canvas renderer, and a text symbolizer to the style package.
2013-06-19 22:01:51 +02:00
ahocevar
ea02626c28 Reducing number of default zoom levels
To avoid issues with long segments, we accept scaled tiles for
now. Further workarounds and browser tickets reporting our
issues are needed.
2013-06-11 21:06:18 +02:00
ahocevar
489459f313 Apply transform to coordinates rather than the canvas
Credit goes to @jystic for figuring out this approach.
2013-06-09 20:20:53 +02:00
ahocevar
3a6c7cf204 Renaming featureInfoFunction to transformFeatureInfo 2013-06-07 15:34:13 +02:00
ahocevar
77d22c4038 getFeatures method and featureInfo templates
To avoid surprises for application developers, this change
creates a new getFeatures method. So it is clear now beforehand
whether features or feature info markup is returned. The result
is now also grouped by layer, so application developers always
have a link between a layer and the feature info it returns.

To make getFeatureInfo return markup for vector layers, this
change also adds a featureInfoFunction property to the vector
layer, which gives developers full control over how features are
rendered to feature info markup.
2013-06-07 15:34:13 +02:00
ahocevar
461d2a1ba8 Merge pull request #756 from ahocevar/extent-equals
Use ol.extent.equals, removing TODO. r=@elemoine
2013-06-01 15:14:20 -07:00
ahocevar
57e36f4eda Use ol.extent.equals, removing TODO 2013-06-01 11:11:13 -06:00
Frederic Junod
a1a7e21f92 Redefine ol.Size to be Array.<number> 2013-06-01 10:22:06 +02:00
Tim Schaub
38752f4700 Properly reset the dirty flag
Currently, the dirty flag is never reset (to false).  This is a bug.  Because renderFrame is called very often (every layer render gets called when every other layer needs to re-render), it is criticial to know when we can bail out early.  The dirty flag is currently the way that the vector layer renderer knows that it needs to do more work.  On an empty cache, the renderFrame method of the vector layer renderer is called ~30 times for a single zoom in the vector layer example (due to tiles loading on other layers).  Without this change, we miss the fast path out and clear/re-render the canvas all 30 times.  With this change, we are only clear the canvas and redraw 6 times in a typical zoom animation.
2013-05-17 23:22:07 -06:00
ahocevar
824397e6ba Do not change ol.extent.containsCoordinate 2013-05-16 10:42:28 +02:00
ahocevar
2d5c0df7cd More verbose variable names 2013-05-16 10:14:56 +02:00
ahocevar
4e7ffc2711 Store symbol sizes by tile
The reason for this change is that symbolSizes and maxSymbolSize
on the instance will be wrong as soon as the resolution changes
and cached tiles are used. It turned out that the approach used
now has several advantages: smaller symbolSizes objects, no need
to merge symbolSizes objects, and cache management for free (no
risk of memory leaks). Note that the symbolSizes and
maxSymbolSize for each tile are not strictly tile specific -
they represent the rendering pass that created the tile. This
has no negative side effects, and it has the advantage that
there is not a single additional loop needed to create these
structures.
2013-05-16 09:57:26 +02:00
ahocevar
037e44e084 Accurate hit detection
With this change, hit detection for lines and points gets very
accurate, because the vector renderer instance keeps track of
line widths and point symbol sizes. After doing a bbox query in
the RTree, returned lines and points are evaluated against the
thresholds of their line width or symbol size. The KML example
with its different symbolizers now has getFeatureInfo too to
show this in action.
2013-05-15 23:44:22 +02:00
ahocevar
7b256c3ec6 Asynchronous API for map#getFeatureInfo
This change allows us to use feature info services on the
server. It will also be useful for the GetFeature control to
get results from a WFS.
2013-05-09 22:26:55 +02:00
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