Commit Graph
100 Commits
Author SHA1 Message Date
Tim Schaub e1c3faa53e Vector related exports 2013-03-05 18:13:10 +01:00
Tim Schaub 12bee3178e Moving the feature management to the layer
The source will be responsible for fetching vector data.
2013-03-05 12:46:55 +01:00
Tim Schaub a968a5ca66 The shared vertices structure now works with integer arrays only
Previously, a lookup object containing start indexes was also used.  This allowed us to remove arrays of vertices and properly update the start indexes for remaining coordinate values.  In order to provide callers with stable identifiers and to work with arrays of integers alone, we cannot support a remove method.  I think this is worth revisiting.  Even if the array length cannot be changed in WebGL, we don't need to also impose the restriction outside.  Instead, the WebGL renderer could be notified when array sizes change and update itself accordingly.  I think there is more value in providing geometries with stable identifiers.

This common structure is used to store vertices for all geometry types.  A slight optimization could be made by creating yet another structure to store point vertices - since these don't need to have a counts array (always 1).  Creating a new structure would mean saving memory at the expense of more lib code to transport.  The coordinate value lookups are not negatively impacted by using the same structure for points and higher order geometries.  Since the first change above goes against my instincts, I'm not making this second change (to add another structure for shared point vertices).
2013-03-05 11:47:42 +01:00
Tim Schaub 54d8d45fc9 Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-03-05 10:58:27 +01:00
Tim Schaub 1d6cd1bd1b Lint-free tests 2013-03-04 21:30:23 +01:00
Tim Schaub dc19948a85 Get tile size for zoom level (see #258) 2013-03-04 21:30:01 +01:00
Tim Schaub c29fabebef Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-03-04 21:06:13 +01:00
Tim Schaub cae925ad1f Correct spelling (thanks @fredj) 2013-03-04 21:04:59 +01:00
Tim Schaub 8c8ddce290 GeoJSON parser implements StringFeatureParser 2013-03-04 20:31:01 +01:00
Tim Schaub 9c8ec42713 Feature parser interfaces
Parsers that read features from strings, objects, or dom elements should implement the right interface.  Among the read options is a callback that gets called after feature construction and before geometry construction.  This callback is called with the feature and the geometry type and returns a shared vertices structure.  The geometry is then constructed with this shared vertices structure before being added to the feature.
2013-03-04 20:29:42 +01:00
Tim Schaub 9edf63fdb8 Proper bounds 2013-03-04 20:25:18 +01:00
Tim Schaub 978527f880 Accept missing properties in symbolizer constructors
Still need to have some discussion about when to apply defaults.
2013-03-04 19:31:11 +01:00
Tim Schaub fae79dbc0f Fewer function calls during bounds calculation 2013-03-04 18:55:20 +01:00
Tim Schaub 0b05432faa Vector source isn't a tile source 2013-03-04 18:43:46 +01:00
Tim Schaub 0558cfa3ac Add externs for GeoJSON support 2013-03-04 18:41:04 +01:00
Tim Schaub 303f2df9e1 Merge pull request #256 from tschaub/transform-arrays
Updating ol.TransformFunction instances so they work with arrays instead of coordinates.
2013-03-03 14:46:22 -08:00
Tim Schaub e9fa08fccb Use in-place transforms where possible 2013-03-03 20:53:13 +01:00
Tim Schaub 40bde4056b Accept a destination array for transforms
This allows in-place transforms.
2013-03-03 20:24:14 +01:00
Tim Schaub 7a5e6a06d8 Make transform functions work with arrays
Instead of working with ol.Coordinate instances, transform functions work with arrays.  This is in anticipation of using transform functions to transform large arrays of vertex coordinate values.  The ol.projection.transform and ol.projection.transformWithCodes are slightly more convenient functions for dealing with ol.Coordinate instances.  Whether we make this more consistent with the use of functions returned by ol.projection.getTransform is up for discussion.
2013-03-03 19:27:57 +01:00
Tim Schaub 0df692e159 Lint in the tests 2013-03-03 17:58:03 +01:00
Tim Schaub 022917e719 Lint free externs 2013-03-03 17:06:15 +01:00
Tim Schaub d3c4869917 Work with new ol.projection package 2013-03-03 16:09:00 +01:00
Tim Schaub 5a73529da5 Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-03-03 15:52:40 +01:00
Tim Schaub b247031fe2 Test reading with shared vertices 2013-03-03 15:51:24 +01:00
Tim Schaub 4af32560ce Removing abstract methods for now
Later we'll discuss having more specific FeatureParser and readFeatures type methods.
2013-03-03 15:50:33 +01:00
Tim Schaub 5d917ebed6 Helper functions for running tests after xhr 2013-03-03 14:29:22 +01:00
Tim Schaub 69b6fae744 Parser base class
GeoJSON is now a parser.  The idea is that we'll want to pass parsers to sources or protocols and want a known type.
2013-03-03 11:50:51 +01:00
Tim Schaub 93ab45432b Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-03-03 09:46:11 +01:00
Tim Schaub b52d283641 Allow geometries to use a shared vertex array
The ol.geom.SharedVertices structure represents a flattened array of vertex coordinates.  This is intended to support optimal WebGL rendering.
2013-03-02 18:39:24 +01:00
Tim Schaub ff27fd33a1 Merge pull request #232 from tschaub/projection-tests
Projection tests
2013-02-27 21:06:54 -08:00
Tim Schaub 52da64564c Tests for getting transforms
These are regression tests for #231.
2013-02-25 11:40:55 -07:00
Tim Schaub ca85c26537 Method for removing cached transforms 2013-02-25 11:28:14 -07:00
Tim Schaub 940ba8afa7 Stray debugger 2013-02-25 11:26:04 -07:00
Tim Schaub 72ba8c4cbd Smoke test for ol.Projection.getTransformFromCodes 2013-02-25 10:36:21 -07:00
Tim Schaub 48e69f7559 Unused var 2013-02-25 10:36:21 -07:00
Tim Schaub 86262bf17e Space for linter 2013-02-25 10:36:21 -07:00
Tim Schaub 6ceae978bf Merge pull request #231 from probins/projfix
Fix bug/typo in projection.getTransform
2013-02-25 09:33:10 -08:00
Tim Schaub e23ca1655c Confirm that arbitrary attribute names can be used 2013-02-20 10:34:10 -07:00
Tim Schaub 7ce89f1fbe Proper getAttributes method
With a59aa9bb37 we can now provide an object with user set attributes.
2013-02-20 10:33:42 -07:00
Tim Schaub 0f2f26969d Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-02-20 10:18:09 -07:00
Tim Schaub a59aa9bb37 Merge pull request #217 from tschaub/safer-object
Allow ol.Object to be used with arbitrary keys.  Add a getKeys method.
2013-02-20 07:56:07 -08:00
Tim Schaub 689f8c9d9d Merge pull request #206 from tschaub/interim-tiles
Share common code to find loaded tiles
2013-02-20 00:52:49 -08:00
Tim Schaub 8f578b88b1 Removing the typed arrays
Its not clear that we will be able to leverage the Float64Array.  It may also be that the overhead of constructing these small arrays negates any benefit of faster access.  And for all coordinate arrays, we'll need arrays that grow/shrink.
2013-02-20 01:15:39 -07:00
Tim Schaub 176f18c937 Merge branch 'master' of github.com:openlayers/ol3 into vector
Resolved conflicts:
  src/ol/renderer/canvas/canvasrenderer.js
2013-02-20 00:38:07 -07:00
Tim Schaub d642628545 Example syntax 2013-02-20 00:21:08 -07:00
Tim Schaub 9cac8ec2f6 Moving GeoJSON into parser package
Need to discuss whether we want all to require constructing a new parser.  I liked the simple `ol.io.geojson.read` function.
2013-02-20 00:09:38 -07:00
Tim Schaub 735f490f56 Treating geometry as just another attribute
The first set geometry is considered the default.  As an added bonus, we're back to a single argument constructor.  Later, we could allow a schema to be set.  This would be done before setting values (calling constructor with no args).
2013-02-20 00:02:50 -07:00
Tim Schaub 0015e466dc Allow instanceof checks for geometries 2013-02-19 23:21:05 -07:00
Tim Schaub 083404bd58 Provides for tests 2013-02-19 23:15:45 -07:00
Tim Schaub 438664a190 Renaming literals 2013-02-19 22:35:29 -07:00
Tim Schaub 7141721bb1 Symbolizers with method for creating literals 2013-02-19 22:24:21 -07:00
Tim Schaub 1faa6214f1 Expression literal 2013-02-19 21:38:10 -07:00
Tim Schaub 360e37146c Rule is filter and symbolizer, style is collection of rules 2013-02-19 21:37:40 -07:00
Tim Schaub 2919906ba6 Add method for getting keys 2013-02-19 14:47:49 -07:00
Tim Schaub d6ff58305d Using a dedicated object for value storage
Without this, we are limited in the key names that we can accept from users.  And because of compiler renaming, we don't know ahead of time what the limitations are (e.g. the key 'a' may clobber the 'set' method).
2013-02-19 14:35:11 -07:00
Tim Schaub 0707deb465 Properties set with set should not be accessed with bracket 2013-02-19 14:28:59 -07:00
Tim Schaub 052e995f2e Key in obj check not appropriate for user supplied keys 2013-02-19 14:19:40 -07:00
Tim Schaub 6cfc36d8cc Using hasOwnProperty is better for user keys on objects we control 2013-02-19 14:17:58 -07:00
Tim Schaub b9507de3ea Removing unnecessary overhead 2013-02-19 14:14:36 -07:00
Tim Schaub 3698049543 View needs to call constructor on super 2013-02-19 14:03:48 -07:00
Tim Schaub eef683fcdb Indentation for linter 2013-02-19 13:58:43 -07:00
Tim Schaub 80dc7b5bf7 Accept custom isLoaded method in findLoadedTiles method 2013-02-19 12:13:58 -07:00
Tim Schaub 1b984ac06c Fewer tiles to be considered fully loaded
With 797dba2cdb we no longer have to load excess tiles to consider an extent fully loaded.
2013-02-19 09:54:41 -07:00
Tim Schaub b061e23606 Merge branch 'master' of github.com:openlayers/ol3 into interim-tiles 2013-02-19 08:59:23 -07:00
Tim Schaub 1f4b34cdb8 Merge pull request #207 from tschaub/tilerange
Make tile range calculation consistent.  Tile ranges are always inclusive in their min/max values.
2013-02-19 07:43:27 -08:00
Tim Schaub 5148ad038c Sharing code with rectangle
We cannot use the rectangle constructor here because a rectangle makes an assertion about min being less than max and a range may have equal min/max.
2013-02-19 07:30:54 -07:00
Tim Schaub 797dba2cdb Correct range for extent and resolution
Tile ranges are inclusive.  When getting the tile range for an extent, the top-right corner of the extent should be considered with a different intersection policy than the bottom-left corner.
2013-02-19 07:21:42 -07:00
Tim Schaub 184e1e782c Spare space 2013-02-19 07:19:31 -07:00
Tim Schaub a55a6bda3b Merge pull request #208 from tschaub/shift-with-care
Calculating resolution by left shifting tile sizes, we're unnecessarily restricted in the number of zoom levels we can have.
2013-02-19 06:00:39 -08:00
Tim Schaub c7569026db Merge branch 'vector' of github.com:openlayers/ol3 into vector 2013-02-19 06:58:23 -07:00
Tim Schaub 46e31f9f9a Lint and names 2013-02-18 22:20:50 -07:00
Tim Schaub 0a5dae9ed0 Avoid left shift in resolution calculations 2013-02-18 18:37:27 -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 8b19751264 Making it explicit that this is a range of tiles
With tile range extending rectangle, a tile range that represented a single tile was not allowed.
2013-02-18 17:07:31 -07:00
Tim Schaub 0d6c54847b Removing logic that assumes occasionally stretched tiles
When the dom renderer included logic to stretch tiles so that gaps were properly filled for fractional zoom levels, we needed to take this into account when getting a tile coordinate for a given coordinate and resolution.  This was never the proper logic for a renderer that wasn't stretching occassional tiles (e.g. the WebGL renderer, the Canvas renderer, or the new DOM renderer).
2013-02-18 15:55:27 -07:00
Tim Schaub e8c50c7290 Passing tests 2013-02-18 15:11:53 -07:00
Tim Schaub 6aa4e99fe5 Fix return from findLoadedTiles
Previously, the findInterimTiles method was returning undefined if the min x/y coord for a tile range was already in the lookup.  The return says it indicates whether all tiles for the given z are loaded.  This change corrects the return.

This change also reveals a misunderstanding of the tile range returned by `getTileRangeForExtentAndZ`.  The previous findInterimTiles method was treating max values as inclusive.  This is intuitive.  It looks like the method returns a range where max values are exclusive.
2013-02-18 14:51:39 -07:00
Tim Schaub ddf993f0c9 Factor out common code and test
The findInterimTiles method was used in three renderers.  This change makes it available on the tile source and adds some basic tests.
2013-02-18 14:18:08 -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 8defe3a3a1 Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-02-18 11:51:51 -07:00
Tim Schaub e30b0959e0 Merge branch 'master' of github.com:openlayers/ol3 into vector 2013-02-18 10:11:00 -07:00
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