Commit Graph
100 Commits
Author SHA1 Message Date
Tim Schaub 8317317127 Always add first segment when appending coordinates
When we have only a single point, we want to make sure it gets added (fixes #1821).

Because this code doesn't differentiate coordinates that are part of a linestring or linearring from those that are independent points, we always add the first segment (or pair of points).  In addition, coordinates for segments are appended whenever they represent a change in relationship with respect to the extent.  This keeps the code simpler for handling fills and properly capturing intersection points for linestrings.  This could be modified to save a few extra coordinates, but it provides for simpler code at a very minimal cost.
2014-03-07 11:02:25 -07:00
Tim Schaub 50001132be Transform extent coordinates before clipping 2014-03-05 13:27:40 -07:00
Tim Schaub a18593ee10 Support minPointsPerRing and default to 3 2014-03-05 12:58:03 -07:00
Tim Schaub 2e47777794 Rename getAllFeaturesAtCoordinate to getFeaturesAtCoordinate 2014-03-05 12:32:09 -07:00
Tim Schaub 30dc8195ca Rename getAllFeatruesInExtent to getFeaturesInExtent 2014-03-05 12:31:09 -07:00
Tim Schaub 333e4a9625 Rename getAllFeatures to getFeatures 2014-03-05 12:29:24 -07:00
Tim Schaub f3b615299f Example applying a convolution kernel to an image 2014-03-02 22:56:50 -07:00
Tim Schaub af1bd0228c Function for applying a 2d transform to an extent 2014-02-25 22:07:16 -07:00
Tim Schaub 2750f53fda Clip to max extent 2014-02-25 21:47:57 -07:00
Tim Schaub 50822a4d58 Skip coordinates that don't affect the rendered extent
Segments that intersect the replay group's extent are drawn.  Any segment that represents a change in coordinate-extent relationship is drawn.  This maintains the left/right relationship (or cross product) between points in the rendered extent and every rendered segment.

Still left undone: clip the replay group's rendering to the max extent.
2014-02-25 21:47:57 -07:00
Tim Schaub 6b018bbaf9 Testing segment intersection with extent
If needed, this function can be modified to take two additional coorinates that will be set to the intersection points.
2014-02-25 21:47:57 -07:00
Tim Schaub cb11959f01 Determining coordinate relationship to extent 2014-02-25 21:47:57 -07:00
Tim Schaub f4746687e8 Keep track of max extent for replay 2014-02-25 21:47:57 -07:00
Tim Schaub ee2485534a Add an example that renders a simple fractal
This works at resolutions where simplification is significantly reducing the number of points in the line.  At high resolutions, navigation becomes unresponsive.  Limiting draw instructions to a replay group's extent will fix this.
2014-02-25 21:47:56 -07:00
Tim Schaub bfc42ffa62 More realistic precision for cosine distance results
Chris Veness' discussion of using the spherical law of cosines (http://www.movable-type.co.uk/scripts/latlong.html) suggests it gives well-conditioned results "around 1 metre" in JavaScript (this assumes a sphere with 6,371km radius).

In Chrome 33, Math.pow(Math.cos(Math.PI / 4), 2) yields 0.4999999999999999.  When we take the arccosine of twice this, we get something significantly different than zero.  Multiplying by 6371 means we can't assert that this is within 1e-9 of zero.
2014-02-24 15:54:17 -07:00
Tim Schaub ac83bb78f1 More repeated test cases 2014-02-24 15:02:30 -07:00
Tim Schaub b01e90b942 Removing repeated test cases 2014-02-24 14:59:18 -07:00
Tim Schaub 7f1a13361b Remove antipodal test cases
The Vincenty formula can fail to converge for antipodal points (see http://en.wikipedia.org/wiki/Vincenty's_formulae#Nearly_antipodal_points), so those test cases are removed.  These tests fail with the latest V8 due to optimization of trig functions with lookup tables.  For example, Math.cos(Math.PI / 2) is no longer calculated based on the value of Math.PI / 2 (which is different than the actual value of π / 2).  Instead, values close to multiples of π / 2 are determined to be 0 (which is arguably what you want).  Previously the tests were relying on very small numbers being returned in this case.
2014-02-24 14:53:00 -07:00
Tim Schaub 2537fb4574 Fixing test failure on Chrome 33 2014-02-24 14:53:00 -07:00
Tim Schaub e633f7f8c1 Don't inject stylesheets with JavaScript
This reverts 4d619d71b1 (see #1527), going back to what we had after e13075f6ff (see #881).

To avoid the 404 in the hosted examples, the css is copied to the same relative path when hosted as during development.
2014-02-21 18:45:46 -07:00
Tim Schaub 4cc4c157fb No WFS parser currently 2014-02-20 15:32:18 -07:00
Tim Schaub 0015331273 Provide a default style function 2014-02-20 08:57:11 -07:00
Tim Schaub 59cbe7c23a Safer feature constructor
Calling setValues now behaves like calling set (closes #1672)
2014-02-19 10:20:57 -07:00
Tim Schaub 6344b8e06c Make setValues consistent with repeated calls to set 2014-02-19 10:17:39 -07:00
Tim Schaub e9b4e42d84 Create anonymous functions in an execution context with limited scope 2014-02-13 10:49:01 -07:00
Tim Schaub 0ec5201f3a Documentation and exports 2014-02-13 10:37:10 -07:00
Tim Schaub 66d5d1d277 Export setStyle for vector layer 2014-02-13 10:25:17 -07:00
Tim Schaub f4585331f2 Add setStyle and getStyle to ol.Feature
As with vector layers and feature overlays, feature style can be set by calling
setStyle.  Calling getStyle returns what was passed to setStyle.  Internally, we call getStyleFunction.
2014-02-13 10:25:17 -07:00
Tim Schaub 477c369f6c As with the vector layer, feature overlays have getStyle and setStyle 2014-02-13 10:25:17 -07:00
Tim Schaub a1f714f7dc Add setStyle and getStyle methods to ol.layer.Vector
The setStyle method accepts a single style, an array of styles, or a style function.  The getStyle method returns what was set.  Internally, we use the getStyleFunction method which always returns a function.  When calling setStyle, a change event is dispatched (fixes #1671).
2014-02-13 10:25:17 -07:00
Tim Schaub a185fc963d Tests for get/setStyleFunction
It would be nice to also test the following:

    it('does not return user set property with the same name', function() {
      var feature = new ol.Feature({
        whatever: 'some value',
        styleFunction: 'another value'
      });
      expect(feature.getStyleFunction()).to.be(undefined);
    });

Unfortunately, in uncompiled code (or if we export `setStyleFunction`) this does not work.  Same goes for user set `id` properties (this will set our internal `id_` property).  See #1672.
2014-02-13 10:25:17 -07:00
Tim Schaub 620a38d3e9 Avoid clashing with user property names
Features are records with any number of user set values.  Separate from this, we rely on feature properties like the feature identifier and feature style.  The two (user properties and our internal properties) should not be mixed.
2014-02-13 10:25:17 -07:00
Tim Schaub 10d5073732 Give the draw interaction a style option 2014-02-13 10:25:17 -07:00
Tim Schaub 76f6961f83 Delete style option before passing to base 2014-02-13 10:25:16 -07:00
Tim Schaub c64c24d3dc Common code for creating a style function 2014-02-13 10:25:16 -07:00
Tim Schaub 6abb691224 Give feature overlays a style option 2014-02-13 10:25:16 -07:00
Tim Schaub b309c44020 Give vector image source a style option 2014-02-13 10:25:16 -07:00
Tim Schaub 1072f6dfa7 Use style option in vector layer examples
Providing a styleFunction option still works because the layer property is still named styleFunction.
2014-02-13 10:25:16 -07:00
Tim Schaub 5c21f24df5 Add tests for vector layer 2014-02-13 10:25:16 -07:00
Tim Schaub 499ba4ac8f Add a style option for vector layers
This can be a single ol.style.Style, and array of styles, or a style function.
2014-02-13 10:25:16 -07:00
Tim Schaub 5f81a3f745 Clarify the style function signature 2014-02-07 17:57:11 -07:00
Tim Schaub 2fc15a5bf0 As it is currently used, opt_options is not optional
It would be nice if the compiler would warn us of things like this (accessing properties of undefined).
2014-02-07 13:48:32 -07:00
Tim Schaub d288c5b4eb Don't render feature with all countries
The feature with undefined id is a multi-polygon representing all countries.  Instead of rendering all multi-polygons with a lower z-index, we just avoid rendering this single feature.
2014-02-07 11:09:45 -07:00
Tim Schaub f3c764ce3c Roy G. Biv 2014-02-07 11:06:43 -07:00
Tim Schaub 2ad11608ce Anchor the popup to the top of the icon 2014-02-07 10:00:41 -07:00
Tim Schaub 336ee808de The examples don't provide information on classes used 2014-02-05 20:17:50 -07:00
Tim Schaub d2cd0808a8 Use projection option instead of reprojectTo
The projection option for vector file sources currently has no good meaning.  The reprojectTo option is used to set the projection for cached features.  This change makes it so the projection option is used for this purpose.  The getProjection method (not currently exported) can then be used to get the cached feature projection.

This also removes the default of 'EPSG:3857' for vector file sources.  If a projection is not configured, features will not be transformed.
2014-02-03 18:13:25 -07:00
Tim Schaub 3ce6c295be Add task for parsing examples 2014-02-03 14:59:06 -07:00
Tim Schaub b7ed585e31 Reminder to remove workaround when GeoServer GeoJSON issue is fixed
See #1566 and http://jira.codehaus.org/browse/GEOS-5996
2014-01-21 09:59:25 -07:00
Tim Schaub f78a668ce3 Handle case where resource has no imagery providers 2014-01-10 13:50:51 -07:00
Tim Schaub 29e3794845 Example demonstrating a spyglass effect
Riffing off of the layer swipe example, this one demonstrates viewing one layer over another though a lens.
2014-01-10 13:32:54 -07:00
Tim Schaub 2b8e87f17f Add error handler
If the server fails to start, display error message and exit.  Typically this is due to the address being in use.
2014-01-10 12:05:38 -07:00
Tim Schaub 251ebbcbac Update closure-util 2014-01-10 11:58:18 -07:00
Tim Schaub 36e2e51899 Only create a frame state if the map has non-zero size 2014-01-09 18:23:53 -07:00
Tim Schaub f5b9687479 Translate to image center before scale and rotation
Same treatment here as with the canvas replay.
2013-12-20 13:29:30 -07:00
Tim Schaub c599c649ab Translate to image anchor point, scale, rotate, translate back 2013-12-20 13:27:08 -07:00
Tim Schaub ec7fea090b Remove ol.geom.GeometryEvent
This removes geometry specific change events.  Since geometries are mere observables, we only get generic change events.  To minimize changes in other places, as a workaround, we cache geometry bounds on features.  This is not the way things should be long term, but the objective is to remove the geometry specific event.
2013-12-13 16:02:51 -07:00
Tim Schaub 5caa0eb659 Geometries inherit from ol.Observable
Because ol.Observable is now a struct, we have stricter type checking (hence the extra assertions).
2013-12-13 14:18:10 -07:00
Tim Schaub b77a29f2f4 Remove handling of @exportFunction 2013-12-13 08:50:38 -07:00
Tim Schaub ad0212ea69 Remove handling of @exportClass 2013-12-13 08:47:47 -07:00
Tim Schaub 20d74810ab Export a getKey method on ol.ObjectEvent 2013-12-12 16:59:34 -07:00
Tim Schaub 69385f4ff0 More consistent event types 2013-12-11 16:54:01 -07:00
Tim Schaub 625007f364 Make enum property name like its value
Where an enum value is used as an event type, it should be alllowercase (to follow DOM events).  Property names should be ALLUPPERCASE in this case (just as camelCase and PascalCase are converted to CONSTANT_CASE).
2013-12-11 16:54:01 -07:00
Tim Schaub c8985b9906 Using unique event type values for distinct events
Any event target can be used to dispatch generic goog.events.Event instances with an arbitrary type.  In cases where we dispatch custom events, we should not use type values that collide with those used for generic events (at least internally).  This allows listeners a better chance of knowing what kind of argument they will receive.

As subsequent change will clean up the enumeration and add a bit more consistency.
2013-12-11 16:53:52 -07:00
Tim Schaub 17e91feb52 Listen for property changes in layer group
This avoids a future bug when the ol.ObjectEventType.CHANGE value becomes something different than the goog.events.EventType.CHANGE value.
2013-12-11 12:23:05 -07:00
Tim Schaub 1783776976 Getting explicit about which type 2013-12-11 11:36:04 -07:00
Tim Schaub 153cb307e0 Handle beforechange events for bound properties 2013-12-11 11:25:51 -07:00
Tim Schaub 9d3a4e3c6c Add beforechange event type and provide key with change events
If you know ahead of time that you only want to listen for changes for a specific property, the foo:change type events can be useful.  If you want to listen for changes on all properties, the change event becomes more useful if it provides information on what changed.  And the beforechange event allows listeners to access values before they change.
2013-12-11 11:25:50 -07:00
Tim Schaub 8b8563f0fd Test change events on layer groups 2013-12-11 01:46:23 -07:00
Tim Schaub 5a5d1dec40 Remove unused handleLayerVisibleChange 2013-12-11 01:38:44 -07:00
Tim Schaub a792a224f6 Avoid duplicate change event on visibility change 2013-12-11 01:28:55 -07:00
Tim Schaub 858fe14163 No need for handleLayerChange in base layer 2013-12-11 01:23:51 -07:00
Tim Schaub 8fbfac52d4 Avoid firing duplicate change events in ol.layer.Layer 2013-12-11 01:20:07 -07:00
Tim Schaub 8297f6a9da Marking the geometry type enum as stable 2013-12-05 14:58:22 -07:00
Tim Schaub 9d00b1b993 This commit serves no purpose other than helping minimize a diff 2013-12-05 14:44:36 -07:00
Tim Schaub 2f7fa8f442 Using PascalCase for geometry enum values
This adds a bit more inconsistency to the library, but we didn't have complete consistency before.  Almost all existing string enum values are lowercase (a couple are camelCase and one is dash-separated).  The closure library isn't consistent either (with case for enum properties or values).  I imagine this could be justified in saying someone could blindly use GeoJSON type values in places, but in the end, you'll need to read the docs before guessing right.
2013-12-05 14:40:26 -07:00
Tim Schaub 4ee9605d61 Using CONSTANT_CASE for geometry type 2013-12-05 14:00:04 -07:00
Tim Schaub 162b245d7c ol.Object extends ol.Observable 2013-12-05 12:28:33 -07:00
Tim Schaub 3dc40f8cb6 Add ol.Observable for on, once, un, and unByKey methods 2013-12-05 12:27:30 -07:00
Tim Schaub b7b14420a4 Test removeFeatures and featureremove event 2013-11-27 12:22:34 -07:00
Tim Schaub 8b5dccb742 Test featureadd event 2013-11-27 12:22:34 -07:00
Tim Schaub a5cadacb78 Test featureload event 2013-11-27 12:22:34 -07:00
Tim Schaub f9710b6698 Test forEachFeatureInExtent 2013-11-27 12:22:33 -07:00
Tim Schaub 3bcd4bf833 Tests for getFeatures method 2013-11-27 12:22:33 -07:00
Tim Schaub 1f6d9fc5ae Test for vector source load method 2013-11-27 12:22:33 -07:00
Tim Schaub 6229c0a1d4 Unused getFeaturesByIds_ method 2013-11-27 12:22:33 -07:00
Tim Schaub 1877f92d46 Add forEach method to rtree, use it in feature cache
This saves having to create feature lookup objects and iterate through lookup properties multiple times.
2013-11-27 12:22:33 -07:00
Tim Schaub 8cc4ae8dbd Separate load requests from feature requests
This separates the action of requesting an extent to be loaded from the action of requesting cached features.  The renderer (or any other consumer of a vector source) calls load to request a data extent.  A `featureload` event fires when new features are loaded.  The renderer (or any other consumer) separately asks for cached features given an extent.  This vector source only loads features once, but this separation will also work with sources that make multiple requests for data in different extents.

This also removes the `data` option from the vector source in favor of a `features` option.  Since we no longer have shared data structures for geometries, people can manually create features and pass them to a vector source.  The `addFeatures` method is exported as well.  This is used to add features to a source that don't have a representation on the "remote" (or server).
2013-11-27 12:22:32 -07:00
Tim Schaub ec02e09ce8 Move render intent enum to feature 2013-11-27 12:22:32 -07:00
Tim Schaub bfaed4d52d Moving all style functionality from source to style 2013-11-27 12:20:43 -07:00
Tim Schaub 307e425891 Remove unused method 2013-11-27 12:20:42 -07:00
Tim Schaub 01a0b9ff8d Private source methods 2013-11-27 12:20:42 -07:00
Tim Schaub 2000b0af78 Vector layer/source refactor
This moves the feature cache from ol.layer.Vector to ol.source.Vector.  These are the minimum changes required to maintain the existing functionality and make tests pass.  More refactoring to come.
2013-11-27 12:20:42 -07:00
Tim Schaub b235fe25ea Return for getFeatureInfoForPixel
In b8a9aeb14e a return was added to `ol.renderer.Layer.prototype.getFeatureInfoForPixel`.  The `ol.renderer.canvas.VectorLayer.prototype.getFeatureInfoForPixel` method needs the same.
2013-11-25 15:29:40 -07:00
Tim Schaub 3fbbdb78d5 Call getElement to get layer 2013-11-19 09:52:27 -07:00
Tim Schaub b0362b8c0a Only set interacting hint when modifying the view 2013-11-14 14:21:01 -07:00
Tim Schaub 22da054774 Determine the callback count while iterating through all layers
Previously, if a layer didn't have a `getFeature*ForPixel` type method, the loop count would be decremented.  This means that all layers would not be considered.  Instead, the callback count should be incremented before requests are made and decremented in the callback.
2013-11-13 07:36:54 -07:00
Tim Schaub a2b55b04e8 Rename layerFilter option to layers and accept array 2013-11-12 22:08:59 -07:00
Tim Schaub 7b69373985 Remove ol.geom2 2013-11-12 19:27:02 -07:00
Tim Schaub 61d13f9a39 Remove ol.source.Vector2 2013-11-12 19:26:29 -07:00