Commit Graph
100 Commits
Author SHA1 Message Date
Tim Schaub 0b8f1e8944 Mark applyTransform as part of the API for all geometries 2014-05-02 13:24:04 -06:00
Tim Schaub e448f100fd Add a transform method to geometries
This accepts CRS identifiers for source and destination, transforms the geometry in place, and returns a reference to the geometry.
2014-05-02 11:47:59 -06:00
Tim Schaub 1110da37e1 Move ol.Sphere#circle to ol.geom.Polygon.circular
Previously, ol.geom.Polygon was a transitive dependency of ol.proj (since ol.proj requires ol.sphere.NORMAL, and all spheres were capable of generating circular polygons).  Instead, ol.proj should be lower-level.  Since it deals only with coordinate arrays, it shouldn't depend on all of the geometry code.

By adding a static `circular` function to `ol.geom.Polygon`, the dependency tree makes more sense.  If you want to create a polygon that approximates a circle on a sphere, you require `ol.geom.Polygon` and `ol.Sphere` (or one of the constants).

This makes room for geometries to have a `transform` method that takes projection-like arguments (meaning that `ol.geom.Geometry` will require `ol.proj`).
2014-05-02 11:25:44 -06:00
Tim Schaub f66ad1253f Reducing expectations about spherical interpolation precision
This avoids test failures in Chrome 34 (see also #1748 and https://code.google.com/p/v8/issues/detail?id=3006).
2014-05-02 10:23:03 -06:00
Tim Schaub 015aab8af3 Rename ol.extent.transform to ol.extent.applyTransform
This gives more consistency with ol.proj.applyTransform, allowing us to add a more convenient ol.extent.transform method that takes projection-like arguments.
2014-05-02 10:13:28 -06:00
Tim Schaub a4f1efbddb Add tests for geometry applyTransform method 2014-05-02 09:58:23 -06:00
Tim Schaub 4f9968d106 Rename transform to applyTransform for geometries 2014-05-02 09:27:53 -06:00
Tim Schaub f8e6fac90e Modules used in postinstall are dependencies
Since async and htmlparser2 are used by the postinstall task, they need to be listed as dependencies.  These will get installed when ol3 is a dependency of another project.
2014-04-30 17:54:39 -06:00
Tim Schaub 24498fa9d0 Defines in a namespace that can be required
For consistency, all defines are in the ol namespace.  If they are to be moved to another namespace, they need to be requireable.
2014-04-30 09:14:10 -06:00
Tim Schaub e4e3b2229a Defines in ol namespace defined in ol.js 2014-04-30 08:54:30 -06:00
Tim Schaub cec41c4b0a Add missing requires
Without explicit requires, it is possible that a build would exclude ol.js.
2014-04-30 08:37:52 -06:00
Tim Schaub 3f0da11008 Move ol defines from browserfeature.js to ol.js 2014-04-30 08:24:00 -06:00
Tim Schaub 193d5c9ac1 Rename EXTERNAL_SRC to EXPORTS
The build/exports.js file passes gjslint and jshint, so the separate linting task is not needed.
2014-04-29 09:57:25 -06:00
Tim Schaub a083c6149a No more generated internal source
With this change, the only two remaining generated scripts are build/exports.js and build/test/requireall.js.  Both are only required by Plovr.  With the Node based build task, a temporary exports.js file is created.  The Node based server can be used to run the tests without build/test/requireall.js.
2014-04-29 09:57:25 -06:00
Tim Schaub 9b4f61be3e No need for requireall.js when including exports.js 2014-04-29 09:57:25 -06:00
Tim Schaub d552dfd96d Making ol.proj.Projection subclasses exportable
Because ol.proj.EPSG4326 et al. extend ol.proj.Projection which has exportable methods, these constructors need to be exportable as well (e.g. so ol.proj.EPSG4326.prototype is defined in exports.js when calling goog.exportProperty on getCode etc.).  If we really don't want these to be exportable, they should be removed or made private (and named like ol.proj.EPSG4326_) for internal use only.
2014-04-29 09:57:25 -06:00
Tim Schaub ec6aa21912 Include goog.require calls in exports file 2014-04-29 09:57:25 -06:00
Tim Schaub d087fdbefd Add list of provides to symbol metadata 2014-04-29 09:57:25 -06:00
Tim Schaub fd170eb295 Accept a path for exports file 2014-04-29 09:57:19 -06:00
Tim Schaub 3dd5fb88e5 Allow configuration of JVM arguments in build 2014-04-29 09:53:07 -06:00
Tim Schaub 758eed357e Accept a src config, add docs 2014-04-29 09:53:06 -06:00
Tim Schaub a28db38eef Parse options and add docs 2014-04-29 09:53:06 -06:00
Tim Schaub b6277e0a01 Build task for driving the compiler 2014-04-29 09:53:06 -06:00
Tim Schaub 88e41f25ea Generate symbols before exports 2014-04-29 09:53:06 -06:00
Tim Schaub fe5d8712f2 Unused script 2014-04-29 09:53:06 -06:00
Tim Schaub 7c68107b17 Call generate-symbols.js from build.py 2014-04-29 09:53:06 -06:00
Tim Schaub 88d67b7370 Regenerate symbols if parents have changed
The generate-symbols.js task runs JSDoc on source files.  Because this takes a long time (13s) to run on the whole library, the resulting symbols file includes additional metadata to make it possible to do incremental symbol generation on subsequent runs.  The 'path' and 'extends' metadata for a symbol are used to determine what needs to be regenerated.
2014-04-29 09:53:06 -06:00
Tim Schaub 1273c26f7a Use new generate-exports.js task 2014-04-29 09:53:05 -06:00
Tim Schaub c692204ffd Task for generating a limited set of exports 2014-04-29 09:53:05 -06:00
Tim Schaub d3e477a8df Allow main method to be called from elsewhere 2014-04-29 09:53:05 -06:00
Tim Schaub e53fde402b Write out sorted symbols, excluding inherited ones on private classes
There are cases where a private class may inherit an exportable member (e.g. ol.DebugTile_#getTileCoord comes from ol.Tile#getTileCoord).  We want to avoid making these exportable.
2014-04-29 09:53:05 -06:00
Tim Schaub 11b49d6305 Removing old *.exports for completeness 2014-04-29 09:53:05 -06:00
Tim Schaub fb497f5288 Annotations for exports 2014-04-29 09:53:05 -06:00
Tim Schaub 457cfe851a Add a task to generate metadata on exported symbols
This runs JSDoc with the "symbols" config, providing a list of source files that have been changed since the previous run.  The output is used to generate a symbols.json metadata file containing all exportable symbols info.  A separate task will be run to generate the exports.js file.  These same metadata files will be used by a build tool.
2014-04-29 09:53:05 -06:00
Tim Schaub 9800b38250 Adding a JSDoc configuration for generating metadata on exported symbols
This generates info for all symbols annotated with "@todo api" (when Plovr is replaced, this will become "@api").  Generated metadata is written to stdout.  A separate process will handle the output.
2014-04-29 09:53:05 -06:00
Tim Schaub e72b383976 Required return from event handler 2014-04-10 06:32:27 -06:00
Tim Schaub 3c92b693c5 Adding comment about using externs/olx.js as a source file
The externs/olx.js script includes @typedef annotations for objects that are used in the library.  When compiling the examples together with the library, we need these @typedef annotations.  In this same case, we don't need the object property names to be treated as externs (they can be safely renamed).
2014-04-08 20:11:49 -06:00
Tim Schaub 9e33672503 Unused externs and typedef generating code 2014-04-08 11:41:24 -06:00
Tim Schaub acb0fd8f06 Use externs/olx.js instead of objectliterals.jsdoc
The single externs/olx.js file describes all of the "options" objects we accept in our constructors.  The @typedef annotations are used by the compiler for type checking.  The @type annotations include documentation for individual options and serve as externs when compiling a profile of the library.  When compiling an application together with the library, the externs/olx.js file is included as one of the sources to provide the @typedef's without generating externs.

If we want to maintain multiple src/*.externs.js files instead of one large externs/olx.js file, we can.  But while we are still using Plovr, it makes for easier build configurations to have one file.

This removes the build tasks that generated the build/src/external/src/externs/types.js and build/src/internal/src/types.js files as those are both replaced by the single externs/olx.js file.
2014-04-08 11:41:24 -06:00
Tim Schaub 6fc915ba7b Strip tags from shortdesc (et al.) when parsing
This strips markup from elements with id attributes that we care about: title, shortdesc, tags.  This will only work for people who use `npm install && npm start` to browse examples.  The other example parser doesn't strip this markup, so it should still not be used in these elements.
2014-04-04 10:07:25 -06:00
Tim Schaub 2a4300085e No markup in shortdesc
The example parser and index template don't handle markup in the shortdesc element.  Use the docs element instead.
2014-04-04 10:07:02 -06:00
Tim Schaub fe60d07ef0 Externs lint 2014-04-04 09:28:36 -06:00
Tim Schaub 7826036307 Make getLayerStatesArray return an array of layer states 2014-04-04 07:39:54 -06:00
Tim Schaub 78324fb54b Remove layers array from frame state 2014-04-04 07:36:42 -06:00
Tim Schaub aa3a20e911 Provide layer states array in frame state 2014-04-04 07:36:42 -06:00
Tim Schaub 9d5451b1d6 Provide a reference to the layer 2014-04-04 07:36:42 -06:00
Tim Schaub 86c5a582c7 Rename loadingStrategy to strategy 2014-04-03 15:12:22 +02:00
Tim Schaub ce8d805201 Rename loadingFunction to loader 2014-04-03 15:12:22 +02:00
Tim Schaub 5653d57712 Change default renderer to Canvas 2014-04-02 11:43:20 -06:00
Tim Schaub 2770e61e6c Curly instead of bar 2014-04-01 16:15:22 -06:00
Tim Schaub 2dd3bd88ea Update node packages
* closure-util - Driving the compiler, not watching spurious files
 * async - Bugfixes not related to our use, but this may sidestep the Travis errors we're seeing
2014-03-28 17:27:41 -06:00
Tim Schaub 2da07f8837 Always toggle selection 2014-03-27 11:26:17 -06:00
Tim Schaub 02a7913c0f Add condition for selection 2014-03-27 11:07:06 -06:00
Tim Schaub 1e0d2af0f0 Add a style for selected features 2014-03-27 11:01:12 -06:00
Tim Schaub 9ce7d6ea45 Avoid protocol relative URL to support apps using file protocol 2014-03-24 15:46:12 -06:00
Tim Schaub 1b4aa63673 Separate test example from modify example 2014-03-20 12:18:17 -06:00
Tim Schaub 88efda1a1f Track resolution and buffer max extent to capture strokes 2014-03-13 20:40:18 -04:00
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