Compare commits

..

522 Commits

Author SHA1 Message Date
Tim Schaub
78ac65e57d Merge pull request #3077 from tschaub/release-v3.1.0
Release v3.1.0.
2014-12-22 15:27:31 -05:00
Tim Schaub
a796542223 Summarize changes and add upgrade notes 2014-12-22 15:17:05 -05:00
Tim Schaub
dc7f60801a Update package version to 3.1.0 2014-12-22 14:32:35 -05:00
Tim Schaub
9b55d20f90 Changelog for v3.1.0 2014-12-22 14:32:11 -05:00
Tim Schaub
d8a845de39 Merge pull request #3076 from tschaub/changelog
Add script to standardize changelog ceation.
2014-12-22 14:07:58 -05:00
Tim Schaub
ffea25fd6f Merge pull request #3074 from fredj/misplaced-function-annotation
Remove misplaced function annotation.
2014-12-22 13:30:44 -05:00
Bart van den Eijnden
aee37c4f90 Merge pull request #3075 from bartvde/remove-projlike-undefined
Remove unneeded undefined from ol.proj.ProjectionLike definitions (r=@tschaub)
2014-12-22 19:10:20 +01:00
Tim Schaub
62854f6e32 Add script to standardize changelog ceation 2014-12-22 13:02:27 -05:00
Bart van den Eijnden
ab76c2cae3 Remove unneeded undefined from ol.proj.ProjectionLike definitions 2014-12-22 18:28:04 +01:00
Frederic Junod
eabb795624 Remove misplaced function annotation 2014-12-22 11:12:01 +01:00
Tim Schaub
0ae00fb277 Merge pull request #3071 from tschaub/publish
Add task for publishing to npm.
2014-12-20 09:46:28 -07:00
Tim Schaub
9b0349f2d5 Variable for builds directory 2014-12-20 02:55:56 -07:00
Tim Schaub
d4763a0fe7 Set CLOSURE_NO_DEPS globally 2014-12-20 02:35:05 -07:00
Tim Schaub
3582445755 Add task for publishing to npm
This task publishes an existing tag to the npm registry.  To publish a new release, create a commit that updates the version number in package.json (e.g. to "3.1.0").  Then create a tag, push to GitHub, and run the publish task.  Assuming "openlayers" is the remote for the canonical repo, this would look like the following:

    git tag -a v3.1.0 -m "3.1.0"
    git push --tags openlayers
    ./tasks/publish.sh 3.1.0

The task creates a build for each of the `PROFILES` in `publish.sh` (these correspond to `.json` files in the `config` directory).  Builds are generated in the `dist` directory.  Our `package.json` specifies `dist/ol.js` as the "main" build.  So when people use a module loader to `require('openlayers')`, they get the full build.  It is also possible to load a debug build (e.g. `require('openlayers/dist/ol-debug')`), and we can publish additional builds by adding `config` files and updating `PROFILES` in `publish.sh`.

The `.npmignore` file determines what is *not* included in the package (note that `node_modules` are always ignored).  So if additional items are added to `.gitignore` that should not be included in the npm package, they need to go in `.npmignore` as well (ideally, we don't need to generate anything else outside of the `build` directory that doesn't belong in the package).
2014-12-19 17:45:48 -07:00
Tim Schaub
27b5036c62 Merge pull request #3070 from tschaub/umd-debug
Define goog and assign to global when generating UMD debug builds.
2014-12-19 16:53:45 -07:00
Tim Schaub
a95327f18e Define goog and assign to global
When concatenating the Closure Library, base.js creates a new `goog` object if there is not already one in scope.  Later, `goog.global` is assigned the value of `this`.  Calls to `goog.provide` create "namespace" objects by assigning to `goog.global`.  To ensure that `goog` is the same as `goog.global.goog`, we need to create a new `goog` object in the scope of base.js and assign it to `this.goog`.
2014-12-19 14:41:47 -07:00
Tim Schaub
95972b354e Merge pull request #3068 from tschaub/pre-3
Update pre-release version.
2014-12-19 11:29:31 -07:00
Tim Schaub
b7e0acf4fa Update pre-release version 2014-12-19 11:05:29 -07:00
Tim Schaub
3d86339b88 Merge pull request #3039 from tschaub/umd
Support for UMD builds.
2014-12-19 11:02:54 -07:00
Bart van den Eijnden
3bc84c7288 Merge pull request #3038 from acanimal/master
Update attribution CSS #2803
2014-12-19 11:35:10 +01:00
Éric Lemoine
85a6de0ed6 Merge pull request #3061 from elemoine/render-bug2
Add a renderBuffer option to ol.layer.Vector
2014-12-19 08:58:38 +01:00
Éric Lemoine
a24716ac8a Merge pull request #3048 from elemoine/drag-features
Add a drag-features example
2014-12-19 08:49:11 +01:00
Éric Lemoine
f1bf782133 Change "recreate batch" strategy
Only recreate batch when the (buffered) rendered extent contains the **buffered** viewport extent.
2014-12-19 08:43:47 +01:00
acanimal
2f5999529a Removed unnecessary max-width from CSS .ol-attribution ul 2014-12-18 20:49:01 +01:00
acanimal
fa68410e5d Merge remote-tracking branch 'upstream/master' 2014-12-18 20:45:12 +01:00
Éric Lemoine
33cf4e6179 Add a drag-feature example
This example also demonstrates how to implement a custom interaction that inherits from ol.interaction.Pointer.
2014-12-18 18:42:36 +01:00
Éric Lemoine
14ea2bf413 Add ol.geom.Geometry#translate 2014-12-18 18:42:36 +01:00
Éric Lemoine
374f916b3a Add ol.geom.flat.transform.translate 2014-12-18 18:42:36 +01:00
Frédéric Junod
6d3103d4a9 Merge pull request #3060 from fredj/update-closure-library
Update closure-library version
2014-12-18 15:32:37 +01:00
Éric Lemoine
4a311e66d7 Add ol.Map#getTargetElement
ol.Map#getTarget returns an element or a string, depending on what was passed to setTarget. This commit adds a getTargetElement method that always returns an Element.
2014-12-18 14:13:44 +01:00
Éric Lemoine
6b46d5c76a Make shouldStopEvent default to the identity func 2014-12-18 14:13:44 +01:00
Éric Lemoine
1907de667a Make ol.interaction.Pointer call handleMoveEvent 2014-12-18 14:13:44 +01:00
Éric Lemoine
711ec705b7 Add handle*Event options to ol.interaction.Pointer
More specifically: handleDownEvent, handleDragEvent, handleMoveEvent, and handleUpEvent.
2014-12-18 14:13:44 +01:00
Éric Lemoine
8e8fc9977c Add a renderBuffer option to ol.layer.Vector 2014-12-18 13:20:32 +01:00
Éric Lemoine
ddc51ee267 Unconditionally draw Replay's 2014-12-18 13:04:29 +01:00
Andreas Hocevar
cd0bed6291 Merge pull request #3058 from ahocevar/extend-coordinate
Use an API function to extend the extent
2014-12-18 11:22:29 +01:00
Frederic Junod
440a85c6f4 Update closure-library version
fixes #3034
2014-12-18 11:18:37 +01:00
Andreas Hocevar
5ca6b5dd81 Use an API function to extend the extent 2014-12-18 11:02:41 +01:00
Andreas Hocevar
fe0e17fdaf Merge pull request #3010 from ahocevar/style-geometry
Allow styles to override feature geometries
2014-12-18 10:45:50 +01:00
Andreas Hocevar
784701641d Add a getGeometry method 2014-12-18 10:28:21 +01:00
Andreas Hocevar
2bf191b5e3 Assert that feature.get('foo') returns a geometry 2014-12-18 10:08:35 +01:00
Andreas Hocevar
19015d2ca9 Create typedef 2014-12-18 10:07:57 +01:00
Frédéric Junod
e95a350203 Merge pull request #3056 from fredj/memory-extent
Reuse previousExtent_ local variable
2014-12-17 13:53:16 +01:00
Frédéric Junod
b0cba674bc Merge pull request #3055 from fredj/coding-style
ol.tilecoord.createOrUpdate: add 'opt_' prefix to optional param
2014-12-17 10:40:34 +01:00
Frederic Junod
7c6ccca572 Reuse previousExtent_ local variable 2014-12-17 10:36:31 +01:00
Frederic Junod
2ea685e18f Add 'opt_' prefix to optional param 2014-12-17 10:29:49 +01:00
Bart van den Eijnden
13ce41a1d5 Merge pull request #3044 from gberaudo/api_image_style_constructor_properties
Mark Image style constructor properties `@api`
2014-12-17 10:25:20 +01:00
Bart van den Eijnden
5192257a6d Merge pull request #3052 from bartvde/tests-2888
Add a testcase for parsing GML feature with only boundedBy
2014-12-16 18:09:43 +01:00
Éric Lemoine
0bc96bb769 Merge pull request #3051 from elemoine/compile-wfs
Remove // NOCOMPILE from vector-wfs
2014-12-16 10:32:12 +01:00
Bart van den Eijnden
1bf4ddac6d Add a testcase for parsing GML feature with only boundedBy 2014-12-16 10:22:37 +01:00
Éric Lemoine
d3365fb3a5 Remove // NOCOMPILE from vector-wfs 2014-12-16 09:43:34 +01:00
Andreas Hocevar
af30b88413 Allow geometryFunction to return undefined 2014-12-16 01:12:08 +01:00
Andreas Hocevar
6478454a93 Use getGeometryFunction() in immediate API 2014-12-15 23:22:26 +01:00
Andreas Hocevar
49f9690786 Add tests for setGeometry 2014-12-15 23:21:02 +01:00
Andreas Hocevar
8d9acb8f48 Add an example showing the use of ol.style.Style#geometry 2014-12-15 23:21:02 +01:00
Andreas Hocevar
2d12531105 Allow styles to override feature geometries
With this change, application developers are able to define styles that
render a different geometry than the feature geometry. This can e.g. be
used to render an interior point of a polygon instead of the polygon, or
to render symbols like arrows along lines.
2014-12-15 23:20:53 +01:00
Bart van den Eijnden
e57ea1e66b Merge pull request #2699 from bartvde/issue-2699
No need for featureNS and featureType to be quoted
2014-12-15 21:06:02 +01:00
Bart van den Eijnden
a1c6662812 Do not quote featureNS and featureType in options 2014-12-15 20:28:13 +01:00
Tim Schaub
a101204ded Merge pull request #3047 from tschaub/jsdoc-warnings
Move description above annotation to avoid JSDoc warnings.
2014-12-15 09:57:02 -07:00
Bart van den Eijnden
fffeeaea97 Merge pull request #2996 from bartvde/regularshape-api
Add getter functions for points and angle in ol.style.RegularShape
2014-12-15 17:33:54 +01:00
Bart van den Eijnden
babc33fcb0 Add getter functions for points and angle in ol.style.RegularShape 2014-12-15 17:04:43 +01:00
Tim Schaub
abdae62481 Move description above annotation to avoid JSDoc warnings 2014-12-15 07:50:48 -08:00
Andreas Hocevar
7ece729d5f Merge pull request #3046 from ahocevar/pointerinteraction-api
Need exportable constructor for constructor options in olx
2014-12-15 16:41:44 +01:00
Éric Lemoine
a8b7f3570d Merge pull request #3043 from elemoine/nocompile-wfs
Use // NOCOMPILE for vector-wfs
2014-12-15 16:31:31 +01:00
Éric Lemoine
3623b4b31d Merge pull request #3042 from gberaudo/example_name_in_check_examples_exception
Print example name in check-examples exception
2014-12-15 16:31:11 +01:00
Andreas Hocevar
5eb1537f48 Need exportable constructor for constructor options in olx
When a constructor options object is created in the olx namespace,
the constructor that uses it must be exportable as well.
2014-12-15 16:15:30 +01:00
Éric Lemoine
7a09b11da5 Use // NOCOMPILE for vector-wfs
This is temporary solution until the demo.boundless.com WFS works again.
2014-12-15 15:24:28 +01:00
Guillaume Beraudo
3c00c7cf4c Print example name in check-examples exception 2014-12-15 15:21:55 +01:00
Guillaume Beraudo
ae998a7585 Mark Image style constructor properties @api 2014-12-15 14:41:35 +01:00
Éric Lemoine
86561e5ef2 Merge pull request #3032 from elemoine/custom-components
Extension points for custom controls and interactions
2014-12-15 13:41:56 +01:00
Andreas Hocevar
e0f574bd25 Merge pull request #3033 from ahocevar/select-return
Allow custom mousemove conditions for Select interaction
2014-12-15 13:26:40 +01:00
Frédéric Junod
f5722bbbf9 Merge pull request #3040 from fredj/memory
Transform the coordinates in place
2014-12-15 11:32:41 +01:00
Andreas Hocevar
9b0b1543e0 Allow custom mousemove conditions
When configuring a Select interaction with a custom condition that
includes mousemove, panning the map will not work any more. This is
because the return value of handleMapBrowserEvent is determined by
checking for a default condition function. By checking for the
underlying event type instead, we gain flexibility with custom condition
functions.
2014-12-15 11:28:45 +01:00
Antoine Abt
aafe698285 Merge pull request #3036 from tonio/modify_stride
Respect geometry stride in modify interaction
2014-12-15 09:46:56 +01:00
Frederic Junod
c167b2b49d Transform the coordinates in place 2014-12-15 09:30:37 +01:00
Tim Schaub
b60b0ecdb0 Add support for wrapping the build in UMD syntax. 2014-12-13 13:23:10 -08:00
Tim Schaub
7fd017879f Merge pull request #3020 from tschaub/err-message
Correct error message from generate-info.js.
2014-12-12 12:06:50 -08:00
acanimal
6dc90aefa2 Update attribution CSS #2803 2014-12-12 18:52:46 +01:00
Éric Lemoine
a9f3367310 Rename handleMapPostrender to render (overlay) 2014-12-12 18:30:43 +01:00
Éric Lemoine
d07185e8f2 Add an "handleEvent" interaction option 2014-12-12 18:30:31 +01:00
Éric Lemoine
df170859cc Add a "render" control option 2014-12-12 18:30:02 +01:00
Bart van den Eijnden
ca355d2887 Merge pull request #3037 from bartvde/regularshape-rotation
Implement rotation for ol.style.RegularShape
2014-12-12 16:48:02 +01:00
Bart van den Eijnden
38dca7792c Implement rotation for ol.style.RegularShape 2014-12-12 15:19:31 +01:00
Andreas Hocevar
2c9fab22c8 Merge pull request #3015 from klokantech/utfgrid
UTFGrid Support
2014-12-12 12:37:37 +01:00
Petr Sloup
65583a8b77 preemptive is now true by default + improved documentation 2014-12-12 12:19:20 +01:00
Petr Sloup
7bcd925cdb Minor code style fix 2014-12-12 11:55:55 +01:00
Petr Sloup
82a30b4cd5 Modified the sync/async behavior logic of the forDataAtCoordinate* methods 2014-12-12 11:47:35 +01:00
Antoine Abt
e7db23761c Respect geometry stride in modify interaction 2014-12-12 11:22:15 +01:00
Bart van den Eijnden
31f7279de1 Merge pull request #3012 from bartvde/fix-ie9-tests
Failing tests in IE9
2014-12-10 16:10:38 +01:00
Bart van den Eijnden
c3beae6b16 Fix failing tests in IE9 2014-12-10 12:02:06 +01:00
Frédéric Junod
ae8f5149a7 Merge pull request #3029 from fredj/update-closure
Update closure compiler and library
2014-12-10 07:47:30 +01:00
Frédéric Junod
0052116860 Merge pull request #3031 from fredj/FitGeometryOptions
Add missing maxZoom property in olx.view.FitGeometryOptions
2014-12-09 15:28:29 +01:00
Frederic Junod
5c2501d982 Add missing maxZoom property in olx.view.FitGeometryOptions 2014-12-09 14:59:13 +01:00
Frederic Junod
1238ab0df0 Remove ol.Object.capitalize and use goog.string.capitalize 2014-12-09 11:55:27 +01:00
Frederic Junod
f8b59dbd53 Use goog.array.extend instead of ol.array.safeExtend
The upstream implementation now supports large arrays.
See https://github.com/google/closure-library/pull/356
2014-12-09 11:55:27 +01:00
Frederic Junod
443c9749fb Update closure-library version 2014-12-09 11:55:27 +01:00
Frederic Junod
7bc2081138 Update closure-util to v1.2.0 2014-12-09 11:55:09 +01:00
Frédéric Junod
0a01204bb3 Merge pull request #3028 from fredj/wfsformat-cleanup
ol.format.WFS cleanup
2014-12-09 09:35:00 +01:00
Frederic Junod
aaf689bbec Uppercase ol.format.WFS.SCHEMA_LOCATION const 2014-12-09 09:19:15 +01:00
Frederic Junod
7922c08fe0 Uppercase ol.format.WFS.XMLNS const 2014-12-09 09:18:12 +01:00
Frederic Junod
045109aaab Uppercase ol.format.WFS.FEATURE_PREFIX const 2014-12-09 09:16:41 +01:00
Frederic Junod
de058c7889 Remove unneeded type cast 2014-12-09 09:15:00 +01:00
Frédéric Junod
39cb30308d Merge pull request #3024 from fredj/wfs_gmlFormat
Add missing gmlFormat to olx.format.WFSOptions
2014-12-08 17:55:21 +01:00
Frederic Junod
a9e6b7115f Remove gmlFormat from olx.format.WFSWriteGetFeatureOptions 2014-12-08 17:36:43 +01:00
Frederic Junod
ddcfe77897 Add missing gmlFormat to olx.format.WFSOptions 2014-12-08 17:28:17 +01:00
Frédéric Junod
f3824ec244 Merge pull request #3023 from fredj/server-vector-source
Change loader function return type
2014-12-08 15:39:55 +01:00
Frederic Junod
0c7e9a823c Remove loader function return type 2014-12-08 14:56:25 +01:00
Frédéric Junod
eb6aeee819 Merge pull request #3021 from fredj/attribution-options-typedef
Add missing properties in olx.control.AttributionOptions typedef
2014-12-08 14:38:01 +01:00
Éric Lemoine
bcd983723f Merge pull request #3013 from gberaudo/performance_vector_source_clear
Improve vector source clear() performance
2014-12-08 14:05:24 +01:00
Frederic Junod
8fa628a11d Add missing properties in olx.control.AttributionOptions typedef 2014-12-08 12:09:16 +01:00
Tim Schaub
4c504ede74 Doc fix regarding externs 2014-12-07 16:35:58 -08:00
Tim Schaub
32a67801e5 Include correct path in error message 2014-12-07 16:27:31 -08:00
Bart van den Eijnden
b7d0e06f05 Merge pull request #3017 from bartvde/format-write-string-example
Use writeFeatures instead of writeFeaturesNode in GPX and KML example (r=@elemoine)
2014-12-07 18:14:49 +01:00
Bart van den Eijnden
0fef608683 Use writeFeatures instead of writeFeaturesNode in GPX and KML example 2014-12-07 18:04:35 +01:00
Petr Sloup
d28ffc4808 Use null instead of undefined in the callback 2014-12-06 15:42:40 +01:00
Petr Sloup
b03b762500 More properties made private 2014-12-06 15:26:49 +01:00
Petr Sloup
48478c6868 Listen 'mousemove' and 'click' rather than 'pointermove' in the TileUTFGrid example 2014-12-06 15:21:14 +01:00
Petr Sloup
ca77a20b57 Improved TileUTFGrid example 2014-12-06 15:07:52 +01:00
Petr Sloup
ac144d934f Documentation blocks for the option members 2014-12-06 14:19:56 +01:00
Petr Sloup
250a1e4da3 Various code style fixes 2014-12-06 14:13:22 +01:00
Petr Sloup
363ac54509 Suppress warning about dot notation (compiler would report undefined properties) 2014-12-05 20:26:33 +01:00
Guillaume Beraudo
e3947fb09a Add optional fast parameter for clearing vector source 2014-12-05 18:06:23 +01:00
Petr Sloup
c8bc3620d3 Added TileUTFGrid example 2014-12-05 17:33:30 +01:00
Éric Lemoine
347c4c869d Merge pull request #3014 from elemoine/simplifyreplay
Simplify hit detection code
2014-12-05 16:53:47 +01:00
Petr Sloup
4b605d40d9 getTemplate method to get the Mustache template from the TileJSON 2014-12-05 16:07:37 +01:00
Petr Sloup
ef816d30ed The preemptive loading of UTFGrid tiles is now optional 2014-12-05 16:07:37 +01:00
Petr Sloup
99eab24b20 Implementation of the ol.source.TileUTFGridTile_#getData method 2014-12-05 16:07:36 +01:00
Petr Sloup
9f7e94ec85 Added UTFGridJSON to the TileJSON externs 2014-12-05 16:07:35 +01:00
Petr Sloup
641a829918 Incomplete getFeatureInfo implementation 2014-12-05 16:07:34 +01:00
Petr Sloup
794c7950c8 Added ol.source.TileUTFGrid 2014-12-05 16:07:34 +01:00
Bart van den Eijnden
d62ad47338 Merge pull request #3006 from bartvde/issue-3006
gml3.js and gml2.js don't follow file naming conventions
2014-12-05 15:53:29 +01:00
Éric Lemoine
fdf52c1865 Simplify hit detection code 2014-12-05 15:42:54 +01:00
Bart van den Eijnden
bdc05472bc Rename GML format files to match conventions 2014-12-05 15:28:27 +01:00
Bart van den Eijnden
47325cd4ae Merge pull request #3003 from bartvde/writefeatures
The writeFeatures method should always return a string (r=@elemoine)
2014-12-05 15:05:25 +01:00
Guillaume Beraudo
17e56d8357 Introduce clear event on vector source
Three seconds speed up when clearing 100'000 features.
Clearing is now around 350ms.
2014-12-05 15:03:23 +01:00
Guillaume Beraudo
3e2cc3c246 Faster vector source clear
Three seconds speed up for clearing 100'000 features.
2014-12-05 15:03:20 +01:00
Guillaume Beraudo
e4063102b7 Potentialy faster array allocation in rbush 2014-12-05 15:03:07 +01:00
Bart van den Eijnden
3587418888 The writeFeatures method should always return a string 2014-12-05 14:54:59 +01:00
Paul Spencer
9802cfd56f Merge pull request #3011 from pagameba/master
opt_options may not be defined, use options
2014-12-05 08:50:51 -05:00
Paul Spencer
12ddc7da57 opt_options may not be defined, use options
Constructing an instance of `ol.interaction.DragPan` with no options should be possible, the reference to `opt_options` makes this throw an error when no options are passed.
2014-12-05 08:30:14 -05:00
Éric Lemoine
571cd1c57a Merge pull request #3009 from elemoine/hitdetectionfix
Fix hit detection bug
2014-12-05 14:12:49 +01:00
Éric Lemoine
a820ccea5a Use alphabetical order for canvas ReplayGroup methods 2014-12-05 12:32:54 +01:00
Éric Lemoine
9421bbd362 More clean-ups in the canvas replay code 2014-12-05 12:29:53 +01:00
Éric Lemoine
4c2a0d2053 Remove unused code in the canvas replay code 2014-12-05 12:24:54 +01:00
Éric Lemoine
b3ad50018d Remove unused local variable 2014-12-05 12:24:54 +01:00
Éric Lemoine
27d30e4286 Replay replays in correct order for hit detection 2014-12-05 12:24:54 +01:00
Éric Lemoine
3fb539460c Merge pull request #3002 from elemoine/regularstyle
Passing options to RegularShape is mandatory
2014-12-04 13:45:18 +01:00
Éric Lemoine
61f0c55975 Passing options to RegularShape is mandatory 2014-12-04 13:33:30 +01:00
Éric Lemoine
dfb55fb6a5 Merge pull request #2967 from camptocamp/webgl-point
Add support for drawing points with WebGL
2014-12-04 13:11:31 +01:00
Bart van den Eijnden
e716428895 Merge pull request #2701 from bartvde/geojson-geometryname
Writing GeoJSON does not respect the feature's geometryName
2014-12-04 13:04:17 +01:00
Éric Lemoine
87bb1b956b Merge remote-tracking branch 'upstream/master' into webgl-point
Conflicts:
	src/ol/style/circlestyle.js
	src/ol/style/regularshapestyle.js
	test/spec/ol/style/regularshapestyle.test.js
2014-12-04 12:57:46 +01:00
Éric Lemoine
b2e419654b Add ol.INITIAL_ATLAS_SIZE and ol.MAX_ATLAS_SIZE 2014-12-04 12:13:47 +01:00
tsauerwein
e109be4b57 Rename size to initialSize 2014-12-04 11:49:50 +01:00
tsauerwein
0fd1a575a9 Use string instead of ol.structs.Checksum 2014-12-04 11:48:43 +01:00
Bart van den Eijnden
f0bf61bbf3 Do not encode geometry in properties if geometryName is different 2014-12-04 11:23:01 +01:00
Éric Lemoine
6d1d47a918 Remove @api for ol.render.webgl.Immediate#flush 2014-12-04 11:22:15 +01:00
Éric Lemoine
aef11b7471 Better comment in ivectorcontext.js 2014-12-04 11:18:58 +01:00
tsauerwein
b5d80679d8 Add and fix documentation for atlas manager 2014-12-04 10:21:32 +01:00
Bart van den Eijnden
dcd81ab4b3 Merge pull request #3000 from bartvde/color-docs
Explain that return of ol.color.asArray should not be modified
2014-12-04 10:02:06 +01:00
Bart van den Eijnden
ccc7c1b9b7 Remove code that suggests that color arrays may be modified 2014-12-04 09:24:18 +01:00
tsauerwein
88a3fda514 Remove star example in favor of #2976 2014-12-04 09:23:00 +01:00
Bart van den Eijnden
22e33519c8 Explain that return of ol.color.asArray should not be modified 2014-12-04 09:07:21 +01:00
Andreas Hocevar
6255d8b493 Merge pull request #2997 from ahocevar/opengeo-boundless
Use new demo GeoServer location
2014-12-03 14:25:05 +01:00
Andreas Hocevar
0d16e0f0c8 Use new demo GeoServer location
demo.opengeo.org currently redirects to demo.boundlessgeo.com, so this
change makes it so the new location is used directly.
2014-12-03 14:13:36 +01:00
Bart van den Eijnden
c30233d9c7 Merge pull request #2976 from bartvde/regularstyle-example
Add an example to show off ol.style.RegularShape
2014-12-03 11:09:33 +01:00
Bart van den Eijnden
4a07327dab Add an example to show off ol.style.RegularShape (see #2706) 2014-12-03 10:58:00 +01:00
Pierre GIRAUD
cc39c26132 Merge pull request #2992 from pgiraud/tilevector_featureatcoordinate
Add support for finding features at a given coordinates for vector tiles - fixes
2014-12-02 08:54:46 +01:00
Pierre GIRAUD
9f725f99ca Rename methods 2014-12-01 14:22:03 +01:00
Andreas Hocevar
4cbeb5ee22 Merge pull request #2987 from kartverket/2966
Image layer renderers use source projection if given and equivalent
2014-12-01 13:06:42 +01:00
Thomas Hirsch
8e4d7c0715 isDefAndNotNull -> !isNull 2014-12-01 12:57:35 +01:00
Frédéric Junod
6790b8655a Merge pull request #2975 from fredj/mouseevent-offset
Use offsetX and offsetY if available
2014-12-01 11:23:09 +01:00
Frederic Junod
fabf05977a Use offsetX and offsetY if available 2014-12-01 10:56:34 +01:00
Frederic Junod
26ce8032eb Use ol.Map#getEventPixel in mouse position control 2014-12-01 10:56:34 +01:00
Thomas Hirsch
d5bafc5e9f linting 2014-12-01 10:53:36 +01:00
Pierre GIRAUD
ce4ecb711b getFeaturesAtCoordinateAtResolution is not stable yet 2014-12-01 09:49:02 +01:00
Éric Lemoine
4734530ce2 Merge pull request #2973 from s093294/patch-1
Making GetTileCoordFor methods public avaible
2014-12-01 09:05:29 +01:00
Poul Kjeldager Sørensen
1d7bae6b26 Update tilegrid.js 2014-11-30 21:53:42 +01:00
Thomas Hirsch
e385e81a20 linting 2014-11-30 10:08:41 +01:00
Pierre GIRAUD
25516fead9 Merge pull request #2986 from pgiraud/tilevector_featureatcoordinate
Add support for finding features at a given coordinates for vector tiles
2014-11-29 23:12:47 +01:00
Tim Schaub
f57f0e17ab Merge pull request #2937 from tschaub/clipped
Clip layer rendering to limited extent.
2014-11-29 14:01:43 -07:00
Éric Lemoine
56ad3ea9aa Merge pull request #2971 from elemoine/tilevector
Two ol.source.TileVector fixes
2014-11-29 20:07:33 +01:00
Bart van den Eijnden
1a2544d30a Merge pull request #2988 from bartvde/radius1-olx
Correct olx.style.RegularShapeOptions definition (r=@elemoine)
2014-11-29 14:08:40 +01:00
Bart van den Eijnden
6cd1f3f262 Correct olx.style.RegularShapeOptions definition 2014-11-29 13:52:36 +01:00
Bart van den Eijnden
275f5bc796 Merge pull request #2981 from bartvde/circle-linedash
Use lineDash in ol.style.Circle's and ol.style.RegularShape's stroke (r=@fredj,@elemoine)
2014-11-29 12:19:14 +01:00
Thomas Hirsch
c42ec27a4a image layer renderers use source projection if given and equivalent 2014-11-28 22:09:45 +01:00
Bart van den Eijnden
6556e5eb52 Merge pull request #2982 from bartvde/radius1
Allow radius1 as an alias for radius in ol.style.RegularShape
2014-11-28 19:58:46 +01:00
Bart van den Eijnden
da39e9f96a For stars, use radius1 and radius2 in ol.style.RegularShape 2014-11-28 19:44:16 +01:00
Pierre GIRAUD
5878e7f839 Adding getFeaturesAtCoordinateAtResolution in ol.source.TileVector 2014-11-28 17:30:45 +01:00
Pierre GIRAUD
802cfb59d5 Merge pull request #2980 from pgiraud/tilevector_getfeatures
Export ol.source.TileVector#getFeatures in built mode
2014-11-28 14:44:04 +01:00
Bart van den Eijnden
2d74a6b10f Use lineDash in ol.style.Circle's and ol.style.RegularShape's stroke 2014-11-28 13:11:25 +01:00
Pierre GIRAUD
34e82de8c8 Export ol.source.TileVector#getFeatures in built mode 2014-11-28 11:54:35 +01:00
Bart van den Eijnden
9e591d21d0 Merge pull request #2979 from bartvde/proj-urns
Support OGC srs urns without an EPSG database version
2014-11-27 20:09:54 +01:00
Bart van den Eijnden
890b96f1e9 Support OGC srs urns without an EPSG database version 2014-11-27 20:01:53 +01:00
Andreas Hocevar
5a29834555 Merge pull request #2978 from ahocevar/mapquest-zoom
Fix zoom levels for the MapQuest Street layer
2014-11-27 19:41:26 +01:00
Andreas Hocevar
5155e7a6ac Fix zoom levels for the MapQuest Street layer
A typo in 65b8e0f915 introduced this bug.
Before that, 18 zoom levels were used. Now we're using 19, which appears
to be available with full world coverage.
2014-11-27 19:13:02 +01:00
Éric Lemoine
1845665306 Correct spelling for "performance" 2014-11-27 17:14:22 +01:00
Antoine Abt
ed4bae064d Merge pull request #2889 from fgravin/getFeatureInfo
Add GetFeatureInfo format
2014-11-27 10:30:20 +01:00
Poul Kjeldager Sørensen
b72fddf7f4 Making GetTileCoordFor methods public avaible
I am using tilegrid to request elevation data tiles side by side of a raster layer. It would be nice if these two method was public avaible such I could use the tilegrid to convert mouse coordinates to tile coordinates to request backend tiles. 

The elevation tiles are not shown as a layer directly but rather used to compute and show information in relationship to mouse curser or map view.

This would save me the time of adding another tilegrid implementation in my application specific context.
2014-11-26 01:24:00 +01:00
Antoine Abt
22491601ba Restore proj4 state after tests 2014-11-25 17:38:06 +01:00
Antoine Abt
638f8275aa Export readFeatures method 2014-11-25 16:24:51 +01:00
Antoine Abt
fc16c4500d Renaming & better typing 2014-11-25 16:24:32 +01:00
Éric Lemoine
ec01aa45b9 Make createTileCoordTransform return identity func
This makes ol.tilegrid.TileGrid#createTileCoordTransform return the identity function. This makes it possible to use ol.source.TileVector with an ol.tilegrid.TileGrid (as opposed to an ol.tilegrid.XYZ).
2014-11-24 15:19:24 +01:00
Éric Lemoine
8ba830f91f Make loadFeaturesFromUrl accept an error callback 2014-11-24 15:13:17 +01:00
tsauerwein
d6841e6d9d Fix tests for when not run with WebGL support 2014-11-24 13:26:45 +01:00
tsauerwein
b8b48afc82 Use WEBGL_MAX_TEXTURE_SIZE as default 2014-11-24 09:57:09 +01:00
tsauerwein
e307579d49 Move constants from ol.has to ol 2014-11-24 09:42:10 +01:00
Éric Lemoine
3ed46c50cc Merge pull request #46 from elemoine/webgl-point-delete-resources
[webgl-point] Delete WebGL resources
2014-11-21 18:02:38 +01:00
Éric Lemoine
c0bbb6c4fa Disable vertex attrib array after replay 2014-11-21 17:48:58 +01:00
Éric Lemoine
fe2f83e878 Merge pull request #43 from elemoine/webgl-point-examples
[webgl-point] Revert changes to examples
2014-11-21 16:45:51 +01:00
Éric Lemoine
b3369cd516 Delete WebGL resources used by immediate API 2014-11-21 16:35:05 +01:00
Éric Lemoine
857a8ca2bb Delete WebGL resources used at postcompose time 2014-11-21 16:35:05 +01:00
Éric Lemoine
37f91690f1 Merge pull request #45 from elemoine/webgl-point-buffer
[webgl-point] Rename ol.structs.Buffer to ol.webgl.Buffer
2014-11-21 16:14:01 +01:00
Éric Lemoine
b904427087 Merge pull request #44 from elemoine/webgl-point-delete
[webgl-point] Add a comment to WebGL ImageReplay
2014-11-21 15:49:41 +01:00
Éric Lemoine
57db47ac18 Rename ol.structs.Buffer to ol.webgl.Buffer
The Buffer class is WebGL specific, and it's not really a "data structure", in the pure sense of the term.
2014-11-21 15:48:31 +01:00
Éric Lemoine
6360e4497d Add a comment to WebGL ImageReplay
A comment explaining why we don't need to call deleteProgram and deleteShader in the function returned by getDeleteResourcesFunction.
2014-11-21 15:39:23 +01:00
Éric Lemoine
2e873d3e6d Revert changes to the synthetic-points example
These changes were made for testing WebGL. We now have specific examples for WebGL point.
2014-11-21 15:15:06 +01:00
Éric Lemoine
336de4b1b1 Revert changes to the icon example
The changes were made for testing WebGL, and we now have specific examples for WebGL point.
2014-11-21 15:13:51 +01:00
Éric Lemoine
34953e8266 No need to mention WebGL in draw-feature example 2014-11-21 15:12:26 +01:00
Éric Lemoine
dae5bd53b7 Merge pull request #41 from elemoine/webgl-point-cleanup
[webgl-point] Use ol WebGL infrastructure in WebGL replay
2014-11-21 14:56:19 +01:00
gberaudo
a324f9805f Merge pull request #42 from gberaudo/webgl_immediate_fixes
[webgl-point] Webgl Immediate fixes
2014-11-21 14:43:12 +01:00
Antoine Abt
32d5300682 Merge pull request #2965 from tonio/pan_selectinteraction
Fix pan with select interaction in mousemove mode.
2014-11-21 14:01:51 +01:00
Guillaume Beraudo
fe74bd1b2c Add missing call to flush in webgl map renderer 2014-11-21 13:36:09 +01:00
Guillaume Beraudo
235f7c5bd1 Fix lack of @api doc in webgl Immediate 2014-11-21 13:35:20 +01:00
Éric Lemoine
fd9db053c0 Use ol WebGL infrastructure in WebGL replay 2014-11-21 11:39:47 +01:00
Tobias Sauerwein
ac24b615c3 Merge pull request #39 from tsauerwein/webgl-point-hit-detection-atlas
[webgl-point] Add hit-detection images of symbols to separate atlas
2014-11-21 11:37:48 +01:00
Éric Lemoine
44782c59a5 Merge pull request #40 from elemoine/webgl-point-cleanup
[webgl-point] Remove unused WebGL related code
2014-11-21 11:37:21 +01:00
Antoine Abt
374f02c725 Fix pan with select interaction in mousemove mode. 2014-11-21 11:23:06 +01:00
Éric Lemoine
1e12e7ca90 Remove unused WebGL related code 2014-11-21 10:51:00 +01:00
tsauerwein
fb8af71f25 Use goog.isNull and goog.isDef 2014-11-21 10:42:06 +01:00
Tobias Sauerwein
283d878177 Merge pull request #36 from tsauerwein/webgl-point-has-stable
Mark ol.has.WEBGL_MAX_TEXTURE_SIZE as API
2014-11-21 10:33:18 +01:00
Éric Lemoine
a665b76f8f Merge pull request #38 from elemoine/webgl-point-uint
Fix assert in WebGL replay
2014-11-21 10:20:44 +01:00
tsauerwein
8fcde092c7 Set the default of WEBGL_MAX_TEXTURE_SIZE to undefined
By doing so the examples will also work if WebGL is not supported.
2014-11-21 09:54:55 +01:00
tsauerwein
40c33a21eb Mark ol.has.WEBGL_MAX_TEXTURE_SIZE as API 2014-11-21 09:52:09 +01:00
tsauerwein
ab42965aa2 Add hit-detection image to atlas (RegularShape) 2014-11-21 09:41:38 +01:00
tsauerwein
4132505313 Add hit-detection image to atlas (Circle) 2014-11-21 09:41:10 +01:00
tsauerwein
97f8e4ac8d Keep separate atlas for hit-detection images 2014-11-21 09:40:22 +01:00
tsauerwein
82ef80cf60 Add imageSize and origin for hit-detection image 2014-11-21 09:39:38 +01:00
Éric Lemoine
05f71383f9 Fix assert in WebGL replay 2014-11-21 09:33:45 +01:00
Éric Lemoine
ee54d21b89 Merge pull request #37 from elemoine/webgl-point-uint
[webgl-point] Use OES_element_index_uint when available
2014-11-20 17:08:16 +01:00
Éric Lemoine
7c88329354 Use 50000 features in the WebGL vector examples 2014-11-20 16:39:25 +01:00
Éric Lemoine
2f7c97f25a Use OES_element_index_uint when available 2014-11-20 16:39:25 +01:00
gberaudo
3af2257345 Merge pull request #22 from gberaudo/webgl_immediate_point
[webgl-point] Webgl immediate implementation using a replay group
2014-11-20 14:01:08 +01:00
Guillaume Beraudo
7d01946fef Removing webgl Immediate delegation code for drawing text 2014-11-20 13:53:00 +01:00
Guillaume Beraudo
257784e277 More lenient webgl Immediate drawing of a feature.
Remove assert to handle drawing features with supported geometries.
2014-11-20 13:53:00 +01:00
Guillaume Beraudo
f1402522b5 More lenient Immediate geometry collection rendering
Render geometry collection elements with a valid renderer inspite of
throwing an assertion error. Allows support of hierarchies of points.
2014-11-20 13:53:00 +01:00
Guillaume Beraudo
20ceae2655 Webgl immediate implementation for points
Internally uses a replay group to share code.

Modifies the dynamic data example to use PointGeometry
and Feature in addition to MultiPoint.
2014-11-20 13:53:00 +01:00
Tobias Sauerwein
9681ec3e10 Merge pull request #35 from tsauerwein/webgl-point-fix-examples
Fix examples (minor)
2014-11-20 12:01:22 +01:00
Tobias Sauerwein
d5ffd8abac Merge pull request #34 from camptocamp/webgl-point-texture-per-image
Make sure only one texture is created per image
2014-11-20 12:01:11 +01:00
tsauerwein
d73e183c89 Fix examples
The very last style was not used.
2014-11-20 11:50:46 +01:00
tsauerwein
d12db0419c Make sure only one texture is created per image 2014-11-20 11:39:25 +01:00
Tobias Sauerwein
c564a0963c Merge pull request #33 from tsauerwein/webgl-point-symbol-atlas
[webgl-point] Use the atlas manager for symbols [WIP]
2014-11-20 09:50:03 +01:00
Bart van den Eijnden
4b61e864e7 Merge pull request #2960 from bartvde/layergroup-extent
LayerGroup extent should be used if extent not set on child layer
2014-11-20 08:53:23 +01:00
Bart van den Eijnden
3db26f1d2b Use the layergroup's extent if no extent provided 2014-11-20 08:35:40 +01:00
Frédéric Junod
aba47907ca Merge pull request #2956 from fredj/mousewheel-event-name
Revert "Remove mousewheel event name workaround"
2014-11-19 08:19:59 +01:00
Andreas Hocevar
ca3dfe2b35 Merge pull request #2959 from ahocevar/unstable-doc-fix
Fix typo in selector
2014-11-18 16:53:25 +01:00
Andreas Hocevar
4714c9b380 Fix typo in selector 2014-11-18 16:37:18 +01:00
Frederic Junod
552f9483cb Revert "Remove mousewheel event name workaround"
This reverts commit 20ce664068.

Reverted upstream: 4ee0daca0e
2014-11-18 09:00:50 +01:00
Frédéric Junod
a77b7aa817 Merge pull request #2895 from fredj/remove-font-family
Move font-family customization to layout.css
2014-11-17 16:43:57 +01:00
Éric Lemoine
3bf4cf28f8 Merge pull request #2896 from kalinbas/patch-1
Remove duplicated style parameter
2014-11-16 20:24:31 +01:00
Tim Schaub
b1ac2ff2f2 Merge pull request #2938 from tschaub/image-static-docs
Additional image static docs.
2014-11-16 08:47:19 -08:00
Tim Schaub
46e33a2979 Merge pull request #2939 from tschaub/sticky-stability
Make stability checkbox sticky.
2014-11-14 16:36:34 -08:00
Éric Lemoine
a306c5327c Merge pull request #2949 from elemoine/rbush-debug
Add ol.ext to hosted dir
2014-11-13 21:33:07 -09:00
Éric Lemoine
2b2f745248 Add ol.ext to hosted dir 2014-11-14 00:16:28 +01:00
tsauerwein
327763cc82 Add stars to example 2014-11-13 12:04:51 +01:00
tsauerwein
f07e59d63f Add regular shape example 2014-11-13 11:52:35 +01:00
tsauerwein
e9e76954b2 Integrate atlas manager into RegularShape 2014-11-13 11:48:23 +01:00
Frédéric Junod
41eeed5f35 Merge pull request #2943 from fredj/applyTransform-api
Mark applyTransform api stable
2014-11-13 11:05:18 +01:00
tsauerwein
7593a18a19 Add atlas manager to RegularShapeOptions 2014-11-13 10:53:03 +01:00
tsauerwein
ea65f65b37 Implement getChecksum for RegularShape 2014-11-13 10:50:07 +01:00
Frederic Junod
c701ad6749 Mark applyTransform api stable 2014-11-13 10:46:06 +01:00
tsauerwein
7e9dd65f8b Add example for symbols in an atlas 2014-11-13 10:24:28 +01:00
Andreas Hocevar
cee1575a6c Merge pull request #2936 from ahocevar/unselect-index
Fix unselection of selected features
2014-11-13 08:39:40 +01:00
tsauerwein
62e9d259b2 Fix @type annotation
A description for @type annotation emits a warning.
2014-11-12 17:22:27 +01:00
tsauerwein
b3b7579f84 Use atlas manager for circle style 2014-11-12 17:22:27 +01:00
tsauerwein
ffced21893 Add atlas manager to CircleOptions 2014-11-12 17:22:27 +01:00
Tobias Sauerwein
2a5fffaee4 Merge pull request #32 from tsauerwein/webgl-point-offset
[webgl-point] Fix call to drawElements
2014-11-12 17:21:21 +01:00
tsauerwein
41887e660b Fix call to drawElements
The offset must be given in bytes.
2014-11-12 16:29:46 +01:00
Tim Schaub
39010238b9 Make stability checkbox sticky 2014-11-11 20:06:26 -08:00
Tim Schaub
b991895c61 Similar detail for all crossOrigin options 2014-11-11 19:04:25 -08:00
Tim Schaub
b269161276 A bit more static image doc 2014-11-11 19:01:05 -08:00
Andreas Hocevar
96729baa9f Push the feature, not the index 2014-11-11 20:09:24 +01:00
Tim Schaub
3685626187 Example demonstrating limited layer extent 2014-11-11 09:11:12 -08:00
Tim Schaub
50c0bc6879 Clip rendering to layer extent 2014-11-11 08:59:57 -08:00
Andreas Hocevar
08aa6ee82d Do not rely on unstable index 2014-11-11 12:35:19 +01:00
Éric Lemoine
84889d9dc5 Merge pull request #2935 from geosense/master
Fix jsdoc comment
2014-11-11 11:05:47 +01:00
paulsimon
89248cf60a Fix jsdoc comment 2014-11-10 20:49:20 +01:00
Éric Lemoine
01bc02214c Merge pull request #31 from elemoine/webgl-point-refactoring
[webgl-point] Minor refactoring to WebGL image replay func
2014-11-10 18:21:42 +01:00
Éric Lemoine
a7a2499bc7 Merge pull request #2933 from elemoine/fix-warning
Fix compile warning
2014-11-10 18:20:45 +01:00
Éric Lemoine
344658edb0 Fix compile warning 2014-11-10 17:24:29 +01:00
Éric Lemoine
46e436b599 Minor refactoring to WebGL image replay func 2014-11-10 17:19:31 +01:00
Éric Lemoine
23a24973eb Merge pull request #30 from elemoine/webgl-point-delete
[webgl-point] Add ol.renderer.webgl.VectorLayer#disposeInternal
2014-11-10 17:18:28 +01:00
Éric Lemoine
c8e22bdb44 Merge pull request #29 from elemoine/webgl-point-merge
[webgl-point] Merge openlayers:master into the branch
2014-11-10 17:18:04 +01:00
Éric Lemoine
d9a4482393 Add ol.renderer.webgl.VectorLayer#disposeInternal
Implement disposeInternal to free WebGL resources (deleteBuffer and deleteTexture).
2014-11-10 16:52:32 +01:00
Éric Lemoine
501e7456c0 Merge remote-tracking branch 'upstream/master' into webgl-point-merge 2014-11-10 15:40:03 +01:00
Éric Lemoine
6c80ddcb14 Merge pull request #28 from elemoine/webgl-point-shaders
[webgl-point] Add support for changing "colors"
2014-11-10 15:35:48 +01:00
Éric Lemoine
87865be9f4 Add "color" support to WebGL image replay
This adds support for layer brightness, contrast, hue, saturation.
2014-11-10 15:00:35 +01:00
Éric Lemoine
240f425c46 Add global opacity support to WebGL image replay
vectorLayer.setOpacity() now works as expected.
2014-11-10 14:58:57 +01:00
Éric Lemoine
1de46c68d7 Use "discard" in image shader
This leads to better looking Timeline profiles in Chrome's developer tools!
2014-11-10 14:58:56 +01:00
Éric Lemoine
ce879e115f Merge pull request #2931 from elemoine/viewdocs
Improvement to view docs
2014-11-10 13:47:12 +01:00
Éric Lemoine
cb8167b31a Merge pull request #27 from elemoine/webgl-point-texture-coords
Fix texture coordinates in WebGL image replay
2014-11-10 13:05:38 +01:00
Éric Lemoine
96f8a806a6 Improvement to view docs 2014-11-10 12:48:43 +01:00
Éric Lemoine
fb816b7ab5 Fix texture coordinates in WebGL image replay 2014-11-10 12:30:59 +01:00
Éric Lemoine
bdf3798c7a Merge pull request #26 from elemoine/webgl-point-tests
[webgl-point] Add unit tests for WebGL image replay
2014-11-10 12:30:25 +01:00
Frédéric Junod
1df7f6c2c7 Merge pull request #2906 from fredj/polyline-order
Assume a latitude, longitude order for Polyline format
2014-11-10 12:13:35 +01:00
Éric Lemoine
a2cf5b0889 Add unit tests for WebGL image replay 2014-11-10 11:02:32 +01:00
Éric Lemoine
d91330d83d Merge pull request #25 from elemoine/webgl-point-delete-buffers
[webgl-point] Delete WebGL buffers
2014-11-10 11:00:12 +01:00
Éric Lemoine
c79f3aa101 Delete WebGL buffers 2014-11-10 09:54:04 +01:00
Éric Lemoine
b7376779fb Merge pull request #2927 from elemoine/finishdrawing
Make it possible to programmatically finish drawing
2014-11-10 08:55:45 +01:00
Éric Lemoine
2f17106b68 Merge pull request #2928 from elemoine/patch-3
Do not rename handleMapBrowserEvent internally
2014-11-09 22:44:55 +01:00
Éric Lemoine
f32c550dbe Better docs for handleMapBrowserEvent 2014-11-09 22:08:29 +01:00
Éric Lemoine
bdeb195bfb Add finishDrawing to API
This makes it posssible to programmatically finish drawing.
2014-11-09 20:50:36 +01:00
Éric Lemoine
583f47d24d No need to pass event to finishDrawing_ 2014-11-09 20:49:52 +01:00
Éric Lemoine
d85c31e112 Merge pull request #23 from elemoine/webgl-point-comment
[webgl-point] Some explanation to the icon-sprite-webgl example
2014-11-07 18:51:53 +01:00
Éric Lemoine
97dafa6425 Some explanation to the icon-sprite-webgl example 2014-11-07 18:50:56 +01:00
Éric Lemoine
5998011985 Merge pull request #21 from elemoine/webgl-point-compile-err
[webgl-point] Add an assertion to avoid compile error
2014-11-07 17:02:11 +01:00
Éric Lemoine
73e76fe468 Add an assertion to avoid compile error 2014-11-07 16:48:29 +01:00
Tobias Sauerwein
4c3a7d0248 Merge pull request #14 from tsauerwein/webgl-point-atlas-manager
[webgl-point] Add atlas manager
2014-11-07 14:50:33 +01:00
gberaudo
dee4d3b130 Merge pull request #20 from gberaudo/webgl_feature_overlay
[webgl-point] Add feature overlay support to webgl map renderer.
2014-11-07 14:24:08 +01:00
Guillaume Beraudo
c05ffff629 Dynamically selected renderer in draw feature example 2014-11-07 14:20:51 +01:00
Guillaume Beraudo
6abe3047ec Add feature overlay support to webgl map renderer. 2014-11-07 14:17:31 +01:00
Éric Lemoine
89e682ba9c Merge pull request #2924 from gberaudo/canvasmaprenderer_readability
Readability rearangement in canvasmaprenderer.js
2014-11-07 14:00:39 +01:00
Guillaume Beraudo
f715e3186a Readability rearangement in canvasmaprenderer.js 2014-11-07 11:15:02 +01:00
tsauerwein
fe3cdd8d1b Add AtlasManagerOptions and improve docs 2014-11-07 11:12:32 +01:00
Éric Lemoine
440d253335 Merge pull request #19 from elemoine/webgl-point-rotation
[webgl-point] Add support for icon rotation
2014-11-07 11:12:31 +01:00
Éric Lemoine
3268b20333 Make icon-sprite-webgl example usable with Canvas 2014-11-07 10:57:59 +01:00
Éric Lemoine
e0c5e742ad Use 30000 points in icon-sprite-webgl example 2014-11-07 10:52:05 +01:00
Éric Lemoine
0a364b32ed Use LINEAR for icon textures 2014-11-07 10:49:58 +01:00
Éric Lemoine
c0acc8d825 Add comment describing the vertices sent to GPU 2014-11-07 09:59:56 +01:00
Tim Schaub
c50b7d759c Merge pull request #2911 from tschaub/fires
List events fired in the navigation.
2014-11-06 11:10:37 -07:00
Tim Schaub
d4658837e2 Use toggleClass instead of addClass and removeClass 2014-11-06 10:42:40 -07:00
Andreas Hocevar
1d221f8166 Add ability to filter out unstable Fires items 2014-11-06 10:32:17 -07:00
tsauerwein
ebe0c6a88c Move AtlasManager to ol.style.AtlasManager 2014-11-06 17:51:15 +01:00
Éric Lemoine
0c6a40f5b5 Support image rotateWithView 2014-11-06 17:16:58 +01:00
tsauerwein
64da2647a6 Take space into account when checking size 2014-11-06 17:09:34 +01:00
tsauerwein
f0841b38cd Use id string instead of hash code 2014-11-06 16:22:46 +01:00
Éric Lemoine
4924f34287 Merge pull request #2921 from gberaudo/small_overlay_optimization
Small feature overlay optimization
2014-11-06 15:45:40 +01:00
tsauerwein
5ba6ddcecf Only create new atlas after testing all existing 2014-11-06 15:28:44 +01:00
Éric Lemoine
fb24c68b9c Support image rotation 2014-11-06 15:27:25 +01:00
tsauerwein
509fbaee1c Replace hashCode with checksum
Hash codes are not collision free, so what we
actually need is a checksum.
2014-11-06 15:08:34 +01:00
Éric Lemoine
815a22bd22 Merge pull request #18 from elemoine/webgl-point-misc
[webgl-point] Misc changes
2014-11-06 14:30:53 +01:00
Guillaume Beraudo
6b8a5870ba Small feature overlay optimization
Compute `getSquaredTolerance` once, out of the loops.
2014-11-06 11:49:44 +01:00
Frederic Junod
83025fb97d Assume a latitude, longitude order for Polyline format 2014-11-06 10:58:52 +01:00
tsauerwein
581b372c6a Add constant ol.has.WEBGL_MAX_TEXTURE_SIZE 2014-11-06 10:24:14 +01:00
Éric Lemoine
43756a2d59 Support image scale 2014-11-06 09:47:24 +01:00
Éric Lemoine
64a7cdf372 Implement getImageSize in ol.style.Circle and RegularShape 2014-11-06 09:35:47 +01:00
Éric Lemoine
9029c0fdad Use replay maxExtent center as the coord system origin 2014-11-06 09:24:47 +01:00
Frédéric Junod
afe1467ddf Merge pull request #2897 from fredj/longclick
Remove pointerup listener on controls
2014-11-04 17:32:14 +01:00
Frédéric Junod
03ed3fe43f Merge pull request #2912 from fredj/jquery-externs
jQuery externs update
2014-11-04 14:57:18 +01:00
Frederic Junod
84c11b08fa Fix filter() function parameter in jquery externs
Submitted upstream: https://github.com/google/closure-compiler/pull/672
2014-11-04 14:26:05 +01:00
Frederic Junod
161d75dd22 Update jquery externs
From https://github.com/google/closure-compiler/blob/master/contrib/externs/jquery-1.9.js
2014-11-04 14:23:34 +01:00
Frederic Junod
1253177ae4 Add FastClick in mobile-full-screen example 2014-11-04 11:48:33 +01:00
Florent gravin
0f99f113e3 Change format name to WMSGetFeatureInfo 2014-11-04 09:39:19 +01:00
Antoine Abt
c0f2187310 Make GetFeatureInfo format pass ol2 test suite 2014-11-04 09:25:13 +01:00
Florent gravin
d0d6215550 Add tests suite for GetFeatureInfo format 2014-11-04 09:25:13 +01:00
Florent gravin
759386e37e Add WMS GetFeatureInfo reader format 2014-11-04 09:25:13 +01:00
Frederic Junod
4c8d8c21dc Remove 'pointerup' listener in ol.control.OverviewMap 2014-11-04 09:21:41 +01:00
Frederic Junod
e32be091a4 Remove 'pointerup' listener in ol.control.Attribution 2014-11-04 09:21:41 +01:00
Frederic Junod
cc442d964b Remove 'pointerup' listener in ol.control.ZoomToExtent 2014-11-04 09:21:40 +01:00
Frederic Junod
e55caef0d2 Remove 'pointerup' listener in ol.control.Rotate 2014-11-04 09:21:40 +01:00
Frederic Junod
c7a3fcd426 Remove 'pointerup' listener in ol.control.Zoom 2014-11-04 09:21:40 +01:00
Frederic Junod
224d86802e Remove 'pointerup' listener in ol.control.FullScreen 2014-11-04 09:21:40 +01:00
Éric Lemoine
8415a0c8ba Fix type for image replay origin 2014-11-04 08:48:43 +01:00
Tim Schaub
02bfa42736 List events fired in the navigation 2014-11-03 16:52:17 -07:00
Éric Lemoine
0115368649 Merge pull request #17 from elemoine/webgl-point-jitter
[webgl-point] Address precision/jitter problems
2014-11-03 18:10:19 +01:00
tsauerwein
7618c96c29 Double the size when creating new atlases 2014-11-03 18:00:57 +01:00
Éric Lemoine
28e51740c6 Address precision/jitter problems
Address precision/jitter problems by using coordinates relative to the Replay max extent rather that the world.
2014-11-03 17:45:50 +01:00
Éric Lemoine
1c9a87d50d Merge pull request #16 from elemoine/webgl-point-opacity
[webgl-point] Add support for icon opacity
2014-11-03 17:04:05 +01:00
Éric Lemoine
209d39a460 Support image opacity 2014-11-03 16:50:33 +01:00
Éric Lemoine
d7a992ba83 Merge pull request #15 from elemoine/webgl-point-anchor
[webgl-point] Add support for icon anchors
2014-11-03 16:15:59 +01:00
tsauerwein
1bd388188b Add atlas manager 2014-11-03 15:40:42 +01:00
Éric Lemoine
05bbfd58a8 Support image anchor 2014-11-03 15:40:00 +01:00
Éric Lemoine
c99b1772ed Merge pull request #13 from elemoine/webgl-point-merge
[webgl-point] Merge openlayers:master into the branch
2014-11-03 15:05:29 +01:00
Éric Lemoine
46b03e79a4 Merge remote-tracking branch 'upstream/master' into webgl-point 2014-11-03 15:02:22 +01:00
Éric Lemoine
787f98c5f2 Merge pull request #12 from elemoine/webgl-point-refactor
[webgl-point] Refactoring and fixes
2014-11-03 15:01:35 +01:00
Éric Lemoine
2c92d9a709 Fix drawElement call 2014-11-03 14:54:41 +01:00
Éric Lemoine
14d7f2a797 Delete ImageReplay textures 2014-11-03 14:16:32 +01:00
Éric Lemoine
4534bb8861 Make shaders closer to WebGL image replay 2014-11-03 13:46:34 +01:00
Andreas Hocevar
bf43816b66 Merge pull request #2706 from yportier/master 2014-11-03 13:24:37 +01:00
Yannick
a1dded3c27 Add ol.style.RegularShape 2014-11-03 13:24:30 +01:00
Antoine Abt
26f025a409 Merge pull request #2888 from fgravin/boundedBy
Element boundedBy must not be set as geometry field on GML reading
2014-11-03 11:34:30 +01:00
Éric Lemoine
00f20a11b5 Merge pull request #2903 from elemoine/icon-docs
Improved docs for icon options
2014-10-31 19:54:05 +01:00
tsauerwein
22e1159736 Implement hashCode for ol.style.Circle 2014-10-31 17:22:44 +01:00
Éric Lemoine
6eea0a1fc6 Improved docs for icon options 2014-10-31 17:16:04 +01:00
Éric Lemoine
95d2085cc4 Merge pull request #11 from elemoine/webgl-point-refactor
Clean up WebGL replay code
2014-10-31 15:56:27 +01:00
Éric Lemoine
495a7c95a1 Clearer comment 2014-10-31 15:42:52 +01:00
Éric Lemoine
64bc8f74be Better typing, fewer arrays 2014-10-31 15:41:25 +01:00
Éric Lemoine
8bff6a1abe Flatten the WebGL replay class hierarchy 2014-10-31 15:23:50 +01:00
Éric Lemoine
ed1be0d4e7 Merge pull request #10 from elemoine/icon-sprite
[webgl-point] Make WebGL image replay support icon sprites
2014-10-31 14:52:24 +01:00
Frederic Junod
d4bd5f24c6 Move font-family customization to layout.css 2014-10-31 11:57:27 +01:00
Éric Lemoine
f332cdacf1 Add an icon sprite webgl example 2014-10-31 11:17:24 +01:00
tsauerwein
46ec078501 Add Hashable interface 2014-10-31 11:17:03 +01:00
Éric Lemoine
9201312737 Add support for icon sprites 2014-10-31 11:16:51 +01:00
Tim Schaub
178e3f1856 Merge pull request #2900 from tschaub/wrapper
Allow build.js task to add header.
2014-10-30 13:07:39 -06:00
Tim Schaub
4b7e52c76f Allow build.js task to add header 2014-10-30 12:18:08 -06:00
Frédéric Junod
127818f9b7 Merge pull request #2893 from fredj/simplify-createDom
Don't pass an object to goog.dom.createDom for the class name
2014-10-30 17:57:44 +01:00
Frederic Junod
6ca1640659 Don't pass an object to goog.dom.createDom for the class name
If the second argument to goog.dom.createDom is a string, then this is
the className of the new element.
2014-10-30 16:53:42 +01:00
Frédéric Junod
2d53eb7667 Merge pull request #2781 from fredj/button-title
Use a standard title attribute for the control buttons
2014-10-30 16:52:09 +01:00
kalinbas
08c6e601b8 Update wmtssource.js
- "duplicated" style parameter is not supported by Intergraph GeoMedia
- Uppercase Parameter is needed by ARCGis 
- are there other constraints?
2014-10-30 13:23:09 +01:00
Frédéric Junod
ffeda3f25a Merge pull request #2852 from fredj/issue-2845
Add missing space between class names
2014-10-30 12:17:54 +01:00
Andreas Hocevar
8027c577bc Merge pull request #2891 from ahocevar/imageloadfunction
Introduce a load function for image sources
2014-10-30 09:33:47 +01:00
Andreas Hocevar
765189b86e Add missing types to olx.js 2014-10-30 09:22:45 +01:00
Andreas Hocevar
fed6376e26 Add imageLoadFunction option for ol.source.ImageWMS 2014-10-30 09:22:45 +01:00
Andreas Hocevar
a1e19b4905 Add imageLoadFunction option for ol.source.ImageStatic 2014-10-30 09:22:44 +01:00
Andreas Hocevar
46870456ac Add imageLoadFunction option to ol.source.ImageMapGuide 2014-10-30 09:22:44 +01:00
Andreas Hocevar
f5761daa61 Add a default imageLoadFunction to be used by sources 2014-10-30 09:22:44 +01:00
Andreas Hocevar
46eb14dc96 Give ol.Image an imageLoadFunction argument 2014-10-30 09:22:34 +01:00
Andreas Hocevar
87a06c0086 Rename #getImageElement to #getImage
This adds consistency between ol.Image and ol.ImageTile. Now both have
an exportable getImage method.
2014-10-30 08:42:09 +01:00
Frederic Junod
b40c439d33 Add new button-title example 2014-10-29 16:21:34 +01:00
Florent gravin
74410487aa Refactor the use of ol.xml.getLocalName(n) 2014-10-28 16:48:16 +01:00
Frederic Junod
9ebde652dc Use a standard title attribute for the control buttons 2014-10-28 15:22:46 +01:00
Éric Lemoine
abb86e16f0 Merge pull request #2885 from elemoine/tilejson
Add wrapX option to TileJSON source
2014-10-28 14:58:08 +01:00
Éric Lemoine
cd80ca6024 Merge pull request #2890 from elemoine/layerproperty
Use correct layer property names
2014-10-28 14:57:56 +01:00
Éric Lemoine
6fe80c4111 Use correct layer property names 2014-10-28 14:22:27 +01:00
Florent gravin
51da7bad8c Element boundedBy must not be set as geometry field on GML reading 2014-10-28 09:56:55 +01:00
Tim Schaub
f863386f39 Merge pull request #2887 from tschaub/more-d
Explicitly pass coordinate dimension before transforming.
2014-10-27 13:27:43 -06:00
Tim Schaub
e68eb726d2 Test 3d points and proj4 defs 2014-10-27 12:39:28 -06:00
Éric Lemoine
44d9950e8c Merge pull request #2886 from elemoine/ternary
Use ternary notation
2014-10-27 17:47:10 +01:00
Tim Schaub
8a82048c12 Explicitly pass coordinate dimension before transforming 2014-10-27 10:33:46 -06:00
Éric Lemoine
1f54b33961 Add wrapX option to TileJSON source 2014-10-27 17:23:00 +01:00
Éric Lemoine
dc7aee1974 Use ternary notation 2014-10-27 17:22:17 +01:00
Antoine Abt
4d4d9abe76 Merge pull request #2869 from tonio/xmlexport
Export useful xml functions
2014-10-27 17:13:52 +01:00
Tim Schaub
aa41da1318 Merge pull request #2884 from tschaub/wkt-returns
Make WKT methods throw errors instead of calling a method that throws.
2014-10-27 09:15:20 -06:00
Antoine Abt
ef435d9deb Improve doc for xml functions 2014-10-27 16:00:42 +01:00
Antoine Abt
88d1258e83 Rename ol.xml.load to ol.xml.parse 2014-10-27 16:00:42 +01:00
Antoine Abt
757b6a214c Rename ol.xml.parse to ol.xml.parseNode 2014-10-27 16:00:42 +01:00
Tim Schaub
7c2e0fa627 Verbose warnings 2014-10-27 08:45:11 -06:00
Antoine Abt
ba2d39e683 Export useful xml functions 2014-10-27 15:45:06 +01:00
Tim Schaub
aad9e4e8d3 Throw instead of calling a function that throws 2014-10-27 08:44:31 -06:00
Antoine Abt
67ec0b5988 Merge pull request #2746 from fgravin/gmlVersionFormat
Add versioning for GML format
2014-10-27 15:44:06 +01:00
Frédéric Junod
ee3259d13e Merge pull request #2882 from fredj/wmts_requestEncoding_string
Allow olx.source.WMTSOptions#requestEncoding to be a string
2014-10-27 14:24:15 +01:00
Frederic Junod
398b1f86ce Allow olx.source.WMTSOptions#requestEncoding to be a string 2014-10-27 13:48:47 +01:00
Frédéric Junod
f938ce82d9 Merge pull request #2881 from fredj/doc
Add default requestEncoding in documentation
2014-10-27 13:41:18 +01:00
Frederic Junod
70375d5227 Add default requestEncoding in documentation 2014-10-27 13:38:37 +01:00
Frédéric Junod
d77d504d01 Merge pull request #2877 from fredj/rm_fixme
Remove FIXME in src/ol/structs/rbush.js
2014-10-27 09:34:52 +01:00
Frederic Junod
bd72f6117b Remove FIXME in src/ol/structs/rbush.js 2014-10-27 09:24:27 +01:00
Éric Lemoine
bbea205a9c Use texture to draw points with WebGL 2014-10-27 09:18:19 +01:00
Éric Lemoine
2ecd2eadf7 Remove snap code from synthetic-points example 2014-10-27 09:18:19 +01:00
Éric Lemoine
c8225e49b1 Use triangles to draw points with WebGL 2014-10-27 09:18:19 +01:00
Éric Lemoine
9f108391ae Get renderer from query string in vector point examples 2014-10-27 09:18:19 +01:00
Éric Lemoine
33adcd3903 Add very basic webgl vector renderer 2014-10-27 09:18:19 +01:00
Tobias Sauerwein
5ddbe54310 Merge pull request #2870 from tsauerwein/rbush-bulk-insert
Use bulk-insertion for addFeatures
2014-10-27 09:12:23 +01:00
Tim Schaub
2d415b6ce8 Merge pull request #2856 from tschaub/set-source
Allow layer source to be set.
2014-10-26 15:04:13 -06:00
Tim Schaub
aa6a5d52dd Merge pull request #2875 from tschaub/orphan-logos
Avoid modifying `map.logos_` with each frame.
2014-10-26 13:11:54 -06:00
Tim Schaub
8fb5dc75ef Merge pull request #2874 from tschaub/tiny-logo
Avoid shrinking logos.
2014-10-26 00:32:28 -06:00
Tim Schaub
03fa9965c5 Avoid modifying map.logos_ with each frame 2014-10-25 23:54:42 -06:00
Tim Schaub
7152cdc87f Guard against Bootstrap's max-width setting
Bootstrap sets both the max-width and max-height of all image elements to 100%.  When attributions are removed from their containing element, this causes logos to shrink.
2014-10-25 23:37:20 -06:00
Tim Schaub
d712b2ba54 Allow source to be set after layer construction 2014-10-25 15:34:47 -06:00
Tim Schaub
c06774acb5 Allow source to be set with set method as well 2014-10-25 15:31:08 -06:00
Tim Schaub
88030dbce7 Allow layer source to be set 2014-10-25 15:31:07 -06:00
Frédéric Junod
773ac433ce Merge pull request #2872 from fredj/remove_beforechange_event
Remove the beforepropertychange event from ol.Object
2014-10-24 21:03:31 +02:00
Tim Schaub
771c418de3 Merge pull request #2868 from tschaub/event-doc
Remove doc about dispatching events.
2014-10-24 12:07:45 -06:00
Tim Schaub
1652da8e9d Merge pull request #2871 from tschaub/npm-install
Make `npm install` a dependency of node based targets.
2014-10-24 12:07:02 -06:00
Frederic Junod
1d533d2924 Remove the beforepropertychange event from ol.Object
propertychange events include the oldValue so remove the beforepropertychange
event type.
2014-10-24 18:09:34 +02:00
Tim Schaub
5cab561f12 Make npm install a dependency of node based targets 2014-10-24 09:28:27 -06:00
tsauerwein
56e3ba4578 Use bulk insertion for addFeatures 2014-10-24 17:10:02 +02:00
tsauerwein
97acd989a2 Add support for bulk insertion to rbush wrapper 2014-10-24 17:10:02 +02:00
Tim Schaub
8eaeb7bc35 Merge pull request #2867 from openlayers/module
Support for importing CommonJS style modules (like rbush).
2014-10-24 09:07:25 -06:00
Tim Schaub
c6b172aef2 Work with modules that assign to exports
CommonJS style modules will either assign `exports` to `module` or will assign properties to `exports`.  This allows us to work with either style:

    module.exports = Foo;

or

    exports.Foo = Foo;

Support for additional properties that are assigned to `exports` (or non-function values assigned to `module.exports`) will likely take additional typedef work in the wrapper.
2014-10-24 08:45:59 -06:00
Tim Schaub
120ace5cef Minimal typedef 2014-10-24 08:45:31 -06:00
tsauerwein
47d17342ca Set type for ol.ext.* 2014-10-24 08:39:03 -06:00
Éric Lemoine
478ecb80fd Merge pull request #2865 from elemoine/oldvalue
Add old value to property change events
2014-10-24 10:58:06 +02:00
Éric Lemoine
6d095bdf7c Add old value to property change events 2014-10-24 09:24:37 +02:00
Tim Schaub
bf314f30d5 Remove doc about dispatching events 2014-10-23 17:10:29 -06:00
tsauerwein
af4184e743 Add wrapper for the RBush 2014-10-23 15:57:27 -06:00
Tim Schaub
4785001548 Parse examples and build external modules on install 2014-10-23 15:57:10 -06:00
Éric Lemoine
780df9819b Merge pull request #2866 from elemoine/2801
Cluster source calls loadFeatures on vector source
2014-10-23 22:59:19 +02:00
Joseph Miller
d917952615 Cluster source calls loadFeatures on vector source
Closes #2801
2014-10-23 22:29:44 +02:00
Bart van den Eijnden
fd6a5d8df3 Merge pull request #2864 from bartvde/bing-mixed-content
Avoid mixed content in Bing Maps (r=@elemoine)
2014-10-23 22:25:57 +02:00
Tim Schaub
01b64bc655 General purpose task for building external modules 2014-10-23 13:40:31 -06:00
Bart van den Eijnden
ed980e0e73 Add uriScheme parameter to Bing Maps metadata request to avoid mixed content 2014-10-23 21:33:41 +02:00
Frédéric Junod
a6c3607897 Merge pull request #2855 from fredj/blur_preventDefault
Move touchstart preventDefault to ol.renderer.dom.Map
2014-10-23 17:38:44 +02:00
Andreas Hocevar
45967992fb Merge pull request #2690 from ahocevar/layer-vectoroverlay
Vector rendering with the DOM renderer
2014-10-23 10:19:20 +02:00
Frederic Junod
c83caa9686 Add ol.renderer.dom.Map#disposeInternal 2014-10-23 08:53:55 +02:00
Frederic Junod
f440de2446 Move touchstart preventDefault to ol.renderer.dom.Map
`preventDefault` is called to prevent the img context menu on mobile devices.
2014-10-23 08:48:22 +02:00
Tim Schaub
0a93ad5430 Merge pull request #2859 from tschaub/vector-doc
Document exportable vector source symbols.
2014-10-22 17:43:21 -06:00
Tim Schaub
473023d146 Document exportable vector source symbols 2014-10-22 09:12:37 -06:00
Tim Schaub
fa7f580053 Merge pull request #2857 from tschaub/osm-attribution
Update the OSM attribution.
2014-10-21 23:16:21 -06:00
Tim Schaub
3f5dd45310 One OSM attribution 2014-10-21 23:00:10 -06:00
Pol Dell'Aiera
119289040f Issue #2802: Update OSM attribution 2014-10-21 22:48:46 -06:00
Frederic Junod
d8d0f87ad6 Add missing space between class names
Fixes #2845
2014-10-18 12:06:24 +02:00
Éric Lemoine
b42b6ae1c5 Merge pull request #2847 from elemoine/zoomify-example
Constrain center in zoomify example
2014-10-17 08:07:38 +02:00
Éric Lemoine
6d531cdc29 Constrain center in zoomify example 2014-10-16 19:42:26 +02:00
Éric Lemoine
b61c257124 Merge pull request #2838 from mike-mcgann/wmts-tile-class
ol.source.WMTS now passes tileClass option to ol.source.TileImage
2014-10-15 15:33:12 +02:00
Mike McGann
5a2c206cab ol.source.WMTS now passes tileClass option to ol.source.TileImage
The constructor for ol.source.TileImage accepts an option for the tileClass,
but ol.source.WMTS does not pass this to the parent. This pull request adds
that in.
2014-10-15 09:13:35 -04:00
Éric Lemoine
74fd55a3e8 Merge pull request #2821 from elemoine/polygon-from-extent
Add ol.geom.Polygon.fromExtent
2014-10-15 07:48:58 +02:00
Tim Schaub
017703f05d Merge pull request #2835 from j16sdiz/master
Use correct Stamen URL for SSL.
2014-10-14 16:25:34 -06:00
Daniel Cheng
da479908e7 Fix HTTPS server name for stamen source (Close: #2830) 2014-10-15 01:11:51 +08:00
Éric Lemoine
1ce43e323d Add ol.geom.Polygon.fromExtent 2014-10-14 11:32:20 +02:00
Andreas Hocevar
dd337f3526 Add a canvas for FeatureOverlay and pre-/postcompose rendering 2014-10-10 16:17:19 +02:00
Björn Harrtell
c4d6e04e4b Do not rename handleMapBrowserEvent internally 2014-10-10 10:43:59 +02:00
Andreas Hocevar
4702aa496a Add DOM vector layer renderer 2014-10-09 19:10:22 +02:00
Florent gravin
27f32621ab Update comments on WFS format version 2014-10-03 12:13:36 +02:00
Florent gravin
93db3d42b7 Add tests for gml2 gml:box element 2014-10-03 12:02:14 +02:00
Florent gravin
8a07d241ff Add support for gml2 gml:box element 2014-10-03 12:01:52 +02:00
Florent gravin
d290445048 Make sure alias ol.format.GML show its content in apidoc 2014-10-03 11:16:19 +02:00
Florent gravin
1a7cbfd6ac Use Object() for objects in prototype
to avoid linter warning
2014-10-03 10:01:31 +02:00
Florent gravin
47e182524f Put PARSERS object into prototype too
This is to avoid the use of this.constructor that breaks advanced build
2014-10-03 09:45:24 +02:00
Florent gravin
bea721349a Rename gml format files to match convention
also changes some comments and syntax (feedback from PR comments
2014-10-03 09:45:24 +02:00
Florent gravin
0646056751 Overrides schemaLocation in subclasses 2014-10-03 09:45:24 +02:00
Florent gravin
678c66f50c Move GML subclasses to ol.format namespace
to avoid issue with ol.format.GML alias
ol.format.GMLBase
ol.format.GML2
ol.format.GML3
2014-10-03 09:44:56 +02:00
Florent gravin
607543e4e7 Create an alias ol.format.GML to ol.format.GML3
for backward compatibility
2014-10-03 09:44:47 +02:00
Florent gravin
563174383a Merge GML versions tests in base GML suite 2014-10-03 09:44:06 +02:00
Florent gravin
d3ac01445e Use by default instance of ol.format.GML.v3 in WFS format 2014-10-03 09:44:06 +02:00
Florent gravin
58485fc1f1 Instanciate ol.format.GML.v3 by default in gml tests 2014-10-03 09:44:06 +02:00
Florent gravin
07d6b83154 Redefine some PARSERS_ that are different in v2 and v3 2014-10-03 09:44:06 +02:00
Florent gravin
8182396454 Make class members public or protected
to be accessed from subclasses or static objects
2014-10-03 09:43:05 +02:00
Florent gravin
9324580c87 add format for GML v3 version
all writing methods & objects are defined in v3, as writing for v2 is not done yet
2014-10-03 09:43:04 +02:00
Florent gravin
d8114012bb Remove from GML base all objects and methods that should belong to v3 2014-10-03 09:42:51 +02:00
Florent gravin
c9171b8682 Pass options from v2 to its parent constructor 2014-10-03 09:42:51 +02:00
Florent gravin
82f267f0c5 Add test to parse WFS with GML 2.1.2 2014-10-03 09:42:51 +02:00
Florent gravin
f8e8653480 Add gmlFormat as option for WFS format 2014-10-03 09:42:45 +02:00
Florent gravin
192c7827c9 Add tests suite for ol.format.GML.v2 class 2014-10-03 09:42:22 +02:00
Florent gravin
13f10f6a98 Change GML method call signature from WFS format 2014-10-03 09:42:22 +02:00
Florent gravin
074330707c Call dedicated version format methods with 'this.constructor' object 2014-10-03 09:42:17 +02:00
Florent gravin
8efab3d4be Make protected some shared methods or objects 2014-10-03 09:42:13 +02:00
Florent gravin
8b38367e2b Add subclass for version ol.format.GML.v2 2014-10-03 09:42:09 +02:00
Florent gravin
b8e5ffaf31 Use current scope on remote methods call if arg opt_this is undefined 2014-10-03 09:42:09 +02:00
Florent gravin
4aad872d71 Send ol.format.GML instance reference to ol.xml static methods 2014-10-03 09:42:09 +02:00
Florent gravin
5884f7343a Call method in ol.format.GML.prototype from ol.format.GML static objects 2014-10-03 09:42:09 +02:00
Florent gravin
c49891dcce Call inner methods from 'this' object 2014-10-03 09:42:08 +02:00
Florent gravin
42b58cddbd Move all method declarations into ol.format.GML.prototype 2014-10-03 09:42:08 +02:00
Florent gravin
f5e5419cb6 Move gmlformat.js to gml/base.js 2014-10-03 09:41:59 +02:00
238 changed files with 12079 additions and 4772 deletions

3
.gitignore vendored
View File

@@ -1,6 +1,7 @@
*.pyc
/build
/build/
/examples/*.html.png
/examples/example-list.js
/examples/example-list.xml
/node_modules/
/dist/

5
.npmignore Normal file
View File

@@ -0,0 +1,5 @@
*.pyc
/build/
/examples/*.html.png
/examples/example-list.js
/examples/example-list.xml

View File

@@ -32,7 +32,11 @@ class ThreadPool:
try:
function(*args, **kargs)
except:
print("ERROR")
for count, thing in enumerate(args):
print '{0}. {1}'.format(count, thing)
print(sys.exc_info()[0])
print("ERROR")
self.tasks.errors = True
self.tasks.task_done()
@@ -146,6 +150,7 @@ SRC = [path
if path.endswith('.js')
if path not in SHADER_SRC]
NPM_INSTALL = 'build/npm-install-timestamp'
def report_sizes(t):
stringio = StringIO()
@@ -176,18 +181,25 @@ virtual('check', 'lint', 'build/ol.js', 'test')
virtual('todo', 'fixme')
@target('build/ol.css', 'css/ol.css')
@target(NPM_INSTALL, 'package.json')
def npm_install(t):
t.run('npm', 'install')
t.touch()
@target('build/ol.css', 'css/ol.css', NPM_INSTALL)
def build_ol_css(t):
t.output('%(CLEANCSS)s', 'css/ol.css')
@target('build/ol.js', SRC, SHADER_SRC, 'config/ol.json')
@target('build/ol.js', SRC, SHADER_SRC, 'config/ol.json', NPM_INSTALL)
def build_ol_new_js(t):
t.run('node', 'tasks/build.js', 'config/ol.json', 'build/ol.js')
report_sizes(t)
@target('build/ol-debug.js', SRC, SHADER_SRC, 'config/ol-debug.json')
@target('build/ol-debug.js', SRC, SHADER_SRC, 'config/ol-debug.json',
NPM_INSTALL)
def build_ol_debug_js(t):
t.run('node', 'tasks/build.js', 'config/ol-debug.json', 'build/ol-debug.js')
report_sizes(t)
@@ -236,7 +248,7 @@ def examples_examples_list_js(t):
@target('build/examples/all.combined.js', 'build/examples/all.js',
SRC, SHADER_SRC, 'config/examples-all.json')
SRC, SHADER_SRC, 'config/examples-all.json', NPM_INSTALL)
def build_examples_all_combined_js(t):
t.run('node', 'tasks/build.js', 'config/examples-all.json',
'build/examples/all.combined.js')
@@ -270,6 +282,7 @@ def examples_star_json(name, match):
"exports": [],
"src": [
"src/**/*.js",
"build/ol.ext/*.js",
"examples/%(id)s.js" % match.groupdict()],
"compile": {
"js": [
@@ -281,6 +294,7 @@ def examples_star_json(name, match):
"externs/bootstrap.js",
"externs/closure-compiler.js",
"externs/example.js",
"externs/fastclick.js",
"externs/geojson.js",
"externs/jquery-1.9.js",
"externs/proj4js.js",
@@ -336,14 +350,16 @@ def examples_star_json(name, match):
"api", "observable"
],
"compilation_level": "ADVANCED",
"output_wrapper": "// OpenLayers 3. See http://ol3.js.org/\n(function(){%output%})();",
"warning_level": "VERBOSE",
"output_wrapper": "(function(){%output%})();",
"use_types_for_optimization": True,
"manage_closure_dependencies": True
}
})
with open(t.name, 'wb') as f:
f.write(content)
return Target(name, action=action, dependencies=[__file__])
return Target(name, action=action,
dependencies=[__file__, NPM_INSTALL])
@rule(r'\Abuild/examples/(?P<id>.*).combined.js\Z')
@@ -354,11 +370,12 @@ def examples_star_combined_js(name, match):
report_sizes(t)
dependencies = [SRC, SHADER_SRC,
'examples/%(id)s.js' % match.groupdict(),
'build/examples/%(id)s.json' % match.groupdict()]
'build/examples/%(id)s.json' % match.groupdict(),
NPM_INSTALL]
return Target(name, action=action, dependencies=dependencies)
@target('serve', 'examples')
@target('serve', 'examples', NPM_INSTALL)
def serve(t):
t.run('node', 'tasks/serve.js')
@@ -376,11 +393,10 @@ def build_lint_src_timestamp(t):
t.newer(t.dependencies))
t.touch()
virtual('jshint', 'build/jshint-timestamp')
@target('build/jshint-timestamp', SRC, EXAMPLES_SRC, SPEC, TASKS,
precious=True)
NPM_INSTALL, precious=True)
def build_jshint_timestamp(t):
t.run(variables.JSHINT, '--verbose', t.newer(t.dependencies))
t.touch()
@@ -586,7 +602,8 @@ virtual('apidoc', 'build/jsdoc-%(BRANCH)s-timestamp' % vars(variables))
@target('build/jsdoc-%(BRANCH)s-timestamp' % vars(variables), 'host-resources',
SRC, SHADER_SRC, ifind('config/jsdoc/api/template'))
SRC, SHADER_SRC, ifind('config/jsdoc/api/template'),
NPM_INSTALL)
def jsdoc_BRANCH_timestamp(t):
t.run('%(JSDOC)s', 'config/jsdoc/api/index.md',
'-c', 'config/jsdoc/api/conf.json',
@@ -660,8 +677,11 @@ def host_examples(t):
t.rm_rf('build/hosted/%(BRANCH)s/ol')
t.makedirs('build/hosted/%(BRANCH)s/ol')
t.cp_r('src/ol', 'build/hosted/%(BRANCH)s/ol/ol')
t.rm_rf('build/hosted/%(BRANCH)s/ol.ext')
t.cp_r('build/ol.ext', 'build/hosted/%(BRANCH)s/ol.ext')
t.run('%(PYTHON)s', closure_lib_path + '/closure/bin/build/depswriter.py',
'--root_with_prefix', 'src ../../../ol',
'--root_with_prefix', 'build/ol.ext ../../../ol.ext',
'--root', 'build/hosted/%(BRANCH)s/closure-library/closure/goog',
'--root_with_prefix', 'build/hosted/%(BRANCH)s/closure-library/'
'third_party ../../third_party',
@@ -683,7 +703,7 @@ def check_examples(t):
sys.exit(1)
@target('test', phony=True)
@target('test', NPM_INSTALL, phony=True)
def test(t):
t.run('node', 'tasks/test.js')

234
changelog/v3.1.0.md Normal file
View File

@@ -0,0 +1,234 @@
# 3.1.0
## Summary
The 3.1.0 release includes a whopping 214 merged pull requests since 3.0.0. Of note, the WebGL renderer [now supports point rendering](https://github.com/openlayers/ol3/pull/2967). You can use [UTFGrids for interaction](https://github.com/openlayers/ol3/pull/3015)! Styles can now specify [alternate geometries for rendering](https://github.com/openlayers/ol3/pull/3010). Library builds [can now be loaded](https://github.com/openlayers/ol3/pull/3039) with module loaders like Browserify or RequireJS. You can now symbolize point features with stars, squares, enneadecagons, or [any other regular(ish) polygon](https://github.com/openlayers/ol3/pull/2706). See the full list of [changes](#changes) below.
## Upgrade notes
The 3.1.0 release maintains a backwards-compatible API with the 3.0.0 release, so upgrades should be painless. Some special considerations below.
* If you are using a `ol.source.ImageStatic`, you no longer need to provide an `imageSize` option if you don't want any special scaling on your image (see [#2796](https://github.com/openlayers/ol3/pull/2796)).
* Instead of calling `obj.unByKey(key)` you can now call `ol.Observable.unByKey(key)` (see [#2794](https://github.com/openlayers/ol3/pull/2794)).
* If you were using `format.writeFeatures(features)`, note that this method returns a string for all feature formats. We considered the previous behavior a bug (see [#3003](https://github.com/openlayers/ol3/pull/3003)).
* The `obj.dispatchChangeEvent()` method is now spelled `obj.changed()`. This method is still unstable (see [#2684](https://github.com/openlayers/ol3/pull/2684)).
## Changes
* [#3076](https://github.com/openlayers/ol3/pull/3076) - Add script to standardize changelog creation. ([@tschaub](https://github.com/tschaub))
* [#3074](https://github.com/openlayers/ol3/pull/3074) - Remove misplaced function annotation. ([@fredj](https://github.com/fredj))
* [#3075](https://github.com/openlayers/ol3/pull/3075) - Remove unneeded undefined from ol.proj.ProjectionLike definitions (r=@tschaub) ([@bartvde](https://github.com/bartvde))
* [#3071](https://github.com/openlayers/ol3/pull/3071) - Add task for publishing to npm. ([@tschaub](https://github.com/tschaub))
* [#3070](https://github.com/openlayers/ol3/pull/3070) - Define goog and assign to global when generating UMD debug builds. ([@tschaub](https://github.com/tschaub))
* [#3068](https://github.com/openlayers/ol3/pull/3068) - Update pre-release version. ([@tschaub](https://github.com/tschaub))
* [#3039](https://github.com/openlayers/ol3/pull/3039) - Support for UMD builds. ([@tschaub](https://github.com/tschaub))
* [#3038](https://github.com/openlayers/ol3/pull/3038) - Update attribution CSS #2803 ([@acanimal](https://github.com/acanimal))
* [#3061](https://github.com/openlayers/ol3/pull/3061) - Add a renderBuffer option to ol.layer.Vector ([@elemoine](https://github.com/elemoine))
* [#3048](https://github.com/openlayers/ol3/pull/3048) - Add a drag-features example ([@elemoine](https://github.com/elemoine))
* [#3060](https://github.com/openlayers/ol3/pull/3060) - Update closure-library version ([@fredj](https://github.com/fredj))
* [#3058](https://github.com/openlayers/ol3/pull/3058) - Use an API function to extend the extent ([@ahocevar](https://github.com/ahocevar))
* [#3010](https://github.com/openlayers/ol3/pull/3010) - Allow styles to override feature geometries ([@ahocevar](https://github.com/ahocevar))
* [#3056](https://github.com/openlayers/ol3/pull/3056) - Reuse previousExtent_ local variable ([@fredj](https://github.com/fredj))
* [#3055](https://github.com/openlayers/ol3/pull/3055) - ol.tilecoord.createOrUpdate: add 'opt_' prefix to optional param ([@fredj](https://github.com/fredj))
* [#3044](https://github.com/openlayers/ol3/pull/3044) - Mark Image style constructor properties `@api` ([@gberaudo](https://github.com/gberaudo))
* [#3052](https://github.com/openlayers/ol3/pull/3052) - Add a testcase for parsing GML feature with only boundedBy ([@bartvde](https://github.com/bartvde))
* [#3051](https://github.com/openlayers/ol3/pull/3051) - Remove // NOCOMPILE from vector-wfs ([@elemoine](https://github.com/elemoine))
* [#2699](https://github.com/openlayers/ol3/pull/2699) - No need for featureNS and featureType to be quoted ([@bartvde](https://github.com/bartvde))
* [#3047](https://github.com/openlayers/ol3/pull/3047) - Move description above annotation to avoid JSDoc warnings. ([@tschaub](https://github.com/tschaub))
* [#2996](https://github.com/openlayers/ol3/pull/2996) - Add getter functions for points and angle in ol.style.RegularShape ([@bartvde](https://github.com/bartvde))
* [#3046](https://github.com/openlayers/ol3/pull/3046) - Need exportable constructor for constructor options in olx ([@ahocevar](https://github.com/ahocevar))
* [#3043](https://github.com/openlayers/ol3/pull/3043) - Use // NOCOMPILE for vector-wfs ([@elemoine](https://github.com/elemoine))
* [#3042](https://github.com/openlayers/ol3/pull/3042) - Print example name in check-examples exception ([@gberaudo](https://github.com/gberaudo))
* [#3032](https://github.com/openlayers/ol3/pull/3032) - Extension points for custom controls and interactions ([@elemoine](https://github.com/elemoine))
* [#3033](https://github.com/openlayers/ol3/pull/3033) - Allow custom mousemove conditions for Select interaction ([@ahocevar](https://github.com/ahocevar))
* [#3040](https://github.com/openlayers/ol3/pull/3040) - Transform the coordinates in place ([@fredj](https://github.com/fredj))
* [#3036](https://github.com/openlayers/ol3/pull/3036) - Respect geometry stride in modify interaction ([@tonio](https://github.com/tonio))
* [#3020](https://github.com/openlayers/ol3/pull/3020) - Correct error message from generate-info.js. ([@tschaub](https://github.com/tschaub))
* [#3037](https://github.com/openlayers/ol3/pull/3037) - Implement rotation for ol.style.RegularShape ([@bartvde](https://github.com/bartvde))
* [#3015](https://github.com/openlayers/ol3/pull/3015) - UTFGrid Support ([@klokantech](https://github.com/klokantech))
* [#3012](https://github.com/openlayers/ol3/pull/3012) - Failing tests in IE9 ([@bartvde](https://github.com/bartvde))
* [#3029](https://github.com/openlayers/ol3/pull/3029) - Update closure compiler and library ([@fredj](https://github.com/fredj))
* [#3031](https://github.com/openlayers/ol3/pull/3031) - Add missing maxZoom property in olx.view.FitGeometryOptions ([@fredj](https://github.com/fredj))
* [#3028](https://github.com/openlayers/ol3/pull/3028) - ol.format.WFS cleanup ([@fredj](https://github.com/fredj))
* [#3024](https://github.com/openlayers/ol3/pull/3024) - Add missing gmlFormat to olx.format.WFSOptions ([@fredj](https://github.com/fredj))
* [#3023](https://github.com/openlayers/ol3/pull/3023) - Change loader function return type ([@fredj](https://github.com/fredj))
* [#3021](https://github.com/openlayers/ol3/pull/3021) - Add missing properties in olx.control.AttributionOptions typedef ([@fredj](https://github.com/fredj))
* [#3013](https://github.com/openlayers/ol3/pull/3013) - Improve vector source clear() performance ([@gberaudo](https://github.com/gberaudo))
* [#3017](https://github.com/openlayers/ol3/pull/3017) - Use writeFeatures instead of writeFeaturesNode in GPX and KML example (r=@elemoine) ([@bartvde](https://github.com/bartvde))
* [#3014](https://github.com/openlayers/ol3/pull/3014) - Simplify hit detection code ([@elemoine](https://github.com/elemoine))
* [#3006](https://github.com/openlayers/ol3/pull/3006) - gml3.js and gml2.js don't follow file naming conventions ([@bartvde](https://github.com/bartvde))
* [#3003](https://github.com/openlayers/ol3/pull/3003) - The writeFeatures method should always return a string (r=@elemoine) ([@bartvde](https://github.com/bartvde))
* [#3011](https://github.com/openlayers/ol3/pull/3011) - opt_options may not be defined, use options ([@pagameba](https://github.com/pagameba))
* [#3009](https://github.com/openlayers/ol3/pull/3009) - Fix hit detection bug ([@elemoine](https://github.com/elemoine))
* [#3002](https://github.com/openlayers/ol3/pull/3002) - Passing options to RegularShape is mandatory ([@elemoine](https://github.com/elemoine))
* [#2967](https://github.com/openlayers/ol3/pull/2967) - Add support for drawing points with WebGL ([@camptocamp](https://github.com/camptocamp))
* [#2701](https://github.com/openlayers/ol3/pull/2701) - Writing GeoJSON does not respect the feature's geometryName ([@bartvde](https://github.com/bartvde))
* [#3000](https://github.com/openlayers/ol3/pull/3000) - Explain that return of ol.color.asArray should not be modified ([@bartvde](https://github.com/bartvde))
* [#2997](https://github.com/openlayers/ol3/pull/2997) - Use new demo GeoServer location ([@ahocevar](https://github.com/ahocevar))
* [#2976](https://github.com/openlayers/ol3/pull/2976) - Add an example to show off ol.style.RegularShape ([@bartvde](https://github.com/bartvde))
* [#2992](https://github.com/openlayers/ol3/pull/2992) - Add support for finding features at a given coordinates for vector tiles - fixes ([@pgiraud](https://github.com/pgiraud))
* [#2987](https://github.com/openlayers/ol3/pull/2987) - Image layer renderers use source projection if given and equivalent ([@kartverket](https://github.com/kartverket))
* [#2975](https://github.com/openlayers/ol3/pull/2975) - Use offsetX and offsetY if available ([@fredj](https://github.com/fredj))
* [#2973](https://github.com/openlayers/ol3/pull/2973) - Making GetTileCoordFor methods public avaible ([@s093294](https://github.com/s093294))
* [#2986](https://github.com/openlayers/ol3/pull/2986) - Add support for finding features at a given coordinates for vector tiles ([@pgiraud](https://github.com/pgiraud))
* [#2937](https://github.com/openlayers/ol3/pull/2937) - Clip layer rendering to limited extent. ([@tschaub](https://github.com/tschaub))
* [#2971](https://github.com/openlayers/ol3/pull/2971) - Two ol.source.TileVector fixes ([@elemoine](https://github.com/elemoine))
* [#2988](https://github.com/openlayers/ol3/pull/2988) - Correct olx.style.RegularShapeOptions definition (r=@elemoine) ([@bartvde](https://github.com/bartvde))
* [#2981](https://github.com/openlayers/ol3/pull/2981) - Use lineDash in ol.style.Circle's and ol.style.RegularShape's stroke (r=@fredj,@elemoine) ([@bartvde](https://github.com/bartvde))
* [#2982](https://github.com/openlayers/ol3/pull/2982) - Allow radius1 as an alias for radius in ol.style.RegularShape ([@bartvde](https://github.com/bartvde))
* [#2980](https://github.com/openlayers/ol3/pull/2980) - Export ol.source.TileVector#getFeatures in built mode ([@pgiraud](https://github.com/pgiraud))
* [#2979](https://github.com/openlayers/ol3/pull/2979) - Support OGC srs urns without an EPSG database version ([@bartvde](https://github.com/bartvde))
* [#2978](https://github.com/openlayers/ol3/pull/2978) - Fix zoom levels for the MapQuest Street layer ([@ahocevar](https://github.com/ahocevar))
* [#2889](https://github.com/openlayers/ol3/pull/2889) - Add GetFeatureInfo format ([@fgravin](https://github.com/fgravin))
* [#2965](https://github.com/openlayers/ol3/pull/2965) - Fix pan with select interaction in mousemove mode. ([@tonio](https://github.com/tonio))
* [#2960](https://github.com/openlayers/ol3/pull/2960) - LayerGroup extent should be used if extent not set on child layer ([@bartvde](https://github.com/bartvde))
* [#2956](https://github.com/openlayers/ol3/pull/2956) - Revert "Remove mousewheel event name workaround" ([@fredj](https://github.com/fredj))
* [#2959](https://github.com/openlayers/ol3/pull/2959) - Fix typo in selector ([@ahocevar](https://github.com/ahocevar))
* [#2895](https://github.com/openlayers/ol3/pull/2895) - Move font-family customization to layout.css ([@fredj](https://github.com/fredj))
* [#2896](https://github.com/openlayers/ol3/pull/2896) - Remove duplicated style parameter ([@kalinbas](https://github.com/kalinbas))
* [#2938](https://github.com/openlayers/ol3/pull/2938) - Additional image static docs. ([@tschaub](https://github.com/tschaub))
* [#2939](https://github.com/openlayers/ol3/pull/2939) - Make stability checkbox sticky. ([@tschaub](https://github.com/tschaub))
* [#2949](https://github.com/openlayers/ol3/pull/2949) - Add ol.ext to hosted dir ([@elemoine](https://github.com/elemoine))
* [#2943](https://github.com/openlayers/ol3/pull/2943) - Mark applyTransform api stable ([@fredj](https://github.com/fredj))
* [#2936](https://github.com/openlayers/ol3/pull/2936) - Fix unselection of selected features ([@ahocevar](https://github.com/ahocevar))
* [#2935](https://github.com/openlayers/ol3/pull/2935) - Fix jsdoc comment ([@geosense](https://github.com/geosense))
* [#2933](https://github.com/openlayers/ol3/pull/2933) - Fix compile warning ([@elemoine](https://github.com/elemoine))
* [#2931](https://github.com/openlayers/ol3/pull/2931) - Improvement to view docs ([@elemoine](https://github.com/elemoine))
* [#2906](https://github.com/openlayers/ol3/pull/2906) - Assume a latitude, longitude order for Polyline format ([@fredj](https://github.com/fredj))
* [#2927](https://github.com/openlayers/ol3/pull/2927) - Make it possible to programmatically finish drawing ([@elemoine](https://github.com/elemoine))
* [#2928](https://github.com/openlayers/ol3/pull/2928) - Do not rename handleMapBrowserEvent internally ([@elemoine](https://github.com/elemoine))
* [#2924](https://github.com/openlayers/ol3/pull/2924) - Readability rearangement in canvasmaprenderer.js ([@gberaudo](https://github.com/gberaudo))
* [#2911](https://github.com/openlayers/ol3/pull/2911) - List events fired in the navigation. ([@tschaub](https://github.com/tschaub))
* [#2921](https://github.com/openlayers/ol3/pull/2921) - Small feature overlay optimization ([@gberaudo](https://github.com/gberaudo))
* [#2897](https://github.com/openlayers/ol3/pull/2897) - Remove pointerup listener on controls ([@fredj](https://github.com/fredj))
* [#2912](https://github.com/openlayers/ol3/pull/2912) - jQuery externs update ([@fredj](https://github.com/fredj))
* [#2888](https://github.com/openlayers/ol3/pull/2888) - Element boundedBy must not be set as geometry field on GML reading ([@fgravin](https://github.com/fgravin))
* [#2903](https://github.com/openlayers/ol3/pull/2903) - Improved docs for icon options ([@elemoine](https://github.com/elemoine))
* [#2900](https://github.com/openlayers/ol3/pull/2900) - Allow build.js task to add header. ([@tschaub](https://github.com/tschaub))
* [#2893](https://github.com/openlayers/ol3/pull/2893) - Don't pass an object to goog.dom.createDom for the class name ([@fredj](https://github.com/fredj))
* [#2781](https://github.com/openlayers/ol3/pull/2781) - Use a standard title attribute for the control buttons ([@fredj](https://github.com/fredj))
* [#2852](https://github.com/openlayers/ol3/pull/2852) - Add missing space between class names ([@fredj](https://github.com/fredj))
* [#2891](https://github.com/openlayers/ol3/pull/2891) - Introduce a load function for image sources ([@ahocevar](https://github.com/ahocevar))
* [#2885](https://github.com/openlayers/ol3/pull/2885) - Add wrapX option to TileJSON source ([@elemoine](https://github.com/elemoine))
* [#2890](https://github.com/openlayers/ol3/pull/2890) - Use correct layer property names ([@elemoine](https://github.com/elemoine))
* [#2887](https://github.com/openlayers/ol3/pull/2887) - Explicitly pass coordinate dimension before transforming. ([@tschaub](https://github.com/tschaub))
* [#2886](https://github.com/openlayers/ol3/pull/2886) - Use ternary notation ([@elemoine](https://github.com/elemoine))
* [#2869](https://github.com/openlayers/ol3/pull/2869) - Export useful xml functions ([@tonio](https://github.com/tonio))
* [#2884](https://github.com/openlayers/ol3/pull/2884) - Make WKT methods throw errors instead of calling a method that throws. ([@tschaub](https://github.com/tschaub))
* [#2746](https://github.com/openlayers/ol3/pull/2746) - Add versioning for GML format ([@fgravin](https://github.com/fgravin))
* [#2882](https://github.com/openlayers/ol3/pull/2882) - Allow olx.source.WMTSOptions#requestEncoding to be a string ([@fredj](https://github.com/fredj))
* [#2881](https://github.com/openlayers/ol3/pull/2881) - Add default requestEncoding in documentation ([@fredj](https://github.com/fredj))
* [#2877](https://github.com/openlayers/ol3/pull/2877) - Remove FIXME in src/ol/structs/rbush.js ([@fredj](https://github.com/fredj))
* [#2870](https://github.com/openlayers/ol3/pull/2870) - Use bulk-insertion for addFeatures ([@tsauerwein](https://github.com/tsauerwein))
* [#2856](https://github.com/openlayers/ol3/pull/2856) - Allow layer source to be set. ([@tschaub](https://github.com/tschaub))
* [#2875](https://github.com/openlayers/ol3/pull/2875) - Avoid modifying `map.logos_` with each frame. ([@tschaub](https://github.com/tschaub))
* [#2874](https://github.com/openlayers/ol3/pull/2874) - Avoid shrinking logos. ([@tschaub](https://github.com/tschaub))
* [#2872](https://github.com/openlayers/ol3/pull/2872) - Remove the beforepropertychange event from ol.Object ([@fredj](https://github.com/fredj))
* [#2868](https://github.com/openlayers/ol3/pull/2868) - Remove doc about dispatching events. ([@tschaub](https://github.com/tschaub))
* [#2871](https://github.com/openlayers/ol3/pull/2871) - Make `npm install` a dependency of node based targets. ([@tschaub](https://github.com/tschaub))
* [#2867](https://github.com/openlayers/ol3/pull/2867) - Support for importing CommonJS style modules (like rbush). ([@openlayers](https://github.com/openlayers))
* [#2865](https://github.com/openlayers/ol3/pull/2865) - Add old value to property change events ([@elemoine](https://github.com/elemoine))
* [#2866](https://github.com/openlayers/ol3/pull/2866) - Cluster source calls loadFeatures on vector source ([@elemoine](https://github.com/elemoine))
* [#2864](https://github.com/openlayers/ol3/pull/2864) - Avoid mixed content in Bing Maps (r=@elemoine) ([@bartvde](https://github.com/bartvde))
* [#2855](https://github.com/openlayers/ol3/pull/2855) - Move touchstart preventDefault to ol.renderer.dom.Map ([@fredj](https://github.com/fredj))
* [#2690](https://github.com/openlayers/ol3/pull/2690) - Vector rendering with the DOM renderer ([@ahocevar](https://github.com/ahocevar))
* [#2859](https://github.com/openlayers/ol3/pull/2859) - Document exportable vector source symbols. ([@tschaub](https://github.com/tschaub))
* [#2857](https://github.com/openlayers/ol3/pull/2857) - Update the OSM attribution. ([@tschaub](https://github.com/tschaub))
* [#2847](https://github.com/openlayers/ol3/pull/2847) - Constrain center in zoomify example ([@elemoine](https://github.com/elemoine))
* [#2838](https://github.com/openlayers/ol3/pull/2838) - ol.source.WMTS now passes tileClass option to ol.source.TileImage ([@mike-mcgann](https://github.com/mike-mcgann))
* [#2821](https://github.com/openlayers/ol3/pull/2821) - Add ol.geom.Polygon.fromExtent ([@elemoine](https://github.com/elemoine))
* [#2835](https://github.com/openlayers/ol3/pull/2835) - Use correct Stamen URL for SSL. ([@j16sdiz](https://github.com/j16sdiz))
* [#2839](https://github.com/openlayers/ol3/pull/2839) - Dependency updates and new package name. ([@tschaub](https://github.com/tschaub))
* [#2840](https://github.com/openlayers/ol3/pull/2840) - Fewer point resolution tests. ([@tschaub](https://github.com/tschaub))
* [#2836](https://github.com/openlayers/ol3/pull/2836) - Give priority to feature's style instead of source's style ([@oterral](https://github.com/oterral))
* [#2834](https://github.com/openlayers/ol3/pull/2834) - Use ADVANCED instead of ADVANCED_OPTIMIZATIONS ([@fredj](https://github.com/fredj))
* [#2833](https://github.com/openlayers/ol3/pull/2833) - Avoid too many files open with graceful-fs@3.0.3. ([@tschaub](https://github.com/tschaub))
* [#2829](https://github.com/openlayers/ol3/pull/2829) - Zoom slider refactor. ([@tschaub](https://github.com/tschaub))
* [#2757](https://github.com/openlayers/ol3/pull/2757) - Clear the canvas on layer extent changes. ([@tschaub](https://github.com/tschaub))
* [#2796](https://github.com/openlayers/ol3/pull/2796) - Determine image size on load. ([@tschaub](https://github.com/tschaub))
* [#2825](https://github.com/openlayers/ol3/pull/2825) - Change comments for examples_star_json build target ([@elemoine](https://github.com/elemoine))
* [#2822](https://github.com/openlayers/ol3/pull/2822) - Remove obsolete comment ([@gingerik](https://github.com/gingerik))
* [#2769](https://github.com/openlayers/ol3/pull/2769) - OverviewMap control ([@adube](https://github.com/adube))
* [#2820](https://github.com/openlayers/ol3/pull/2820) - Add parsing of LabelStyle in KML format ([@oterral](https://github.com/oterral))
* [#2819](https://github.com/openlayers/ol3/pull/2819) - Improvements to the xyz-esri-4326-512 example ([@elemoine](https://github.com/elemoine))
* [#2743](https://github.com/openlayers/ol3/pull/2743) - Handle ol.interaction.Draw activation/deactivation ([@elemoine](https://github.com/elemoine))
* [#2816](https://github.com/openlayers/ol3/pull/2816) - Exit on check-examples failure ([@gberaudo](https://github.com/gberaudo))
* [#2794](https://github.com/openlayers/ol3/pull/2794) - Add ol.Observable.unByKey ([@elemoine](https://github.com/elemoine))
* [#2815](https://github.com/openlayers/ol3/pull/2815) - Fix jquery.min.js path in xyz-esri-4326-512 example ([@fredj](https://github.com/fredj))
* [#2756](https://github.com/openlayers/ol3/pull/2756) - Add an example for using an Esri 512x512 tile server in EPSG:4326 (r=@elemoine) ([@bartvde](https://github.com/bartvde))
* [#2814](https://github.com/openlayers/ol3/pull/2814) - Add missing whitespaces in CSS calc ([@fredj](https://github.com/fredj))
* [#2811](https://github.com/openlayers/ol3/pull/2811) - Remove defaultProjection and object from typedef ([@fredj](https://github.com/fredj))
* [#2779](https://github.com/openlayers/ol3/pull/2779) - Update jQuery to 1.9.1 ([@fredj](https://github.com/fredj))
* [#2810](https://github.com/openlayers/ol3/pull/2810) - Remove unused properties from olx.source.TileVectorOptions ([@pagameba](https://github.com/pagameba))
* [#2808](https://github.com/openlayers/ol3/pull/2808) - Remove reprojectTo option from olx.source.OSMXMLOptions ([@fredj](https://github.com/fredj))
* [#2809](https://github.com/openlayers/ol3/pull/2809) - Miscellaneous controls cleanups ([@fredj](https://github.com/fredj))
* [#2805](https://github.com/openlayers/ol3/pull/2805) - Enable subclassing Interaction in public API ([@sweco-sebhar](https://github.com/sweco-sebhar))
* [#2798](https://github.com/openlayers/ol3/pull/2798) - Update closure-util to version 1.0.0 ([@fredj](https://github.com/fredj))
* [#2785](https://github.com/openlayers/ol3/pull/2785) - Use goog.* types in externs ([@ahocevar](https://github.com/ahocevar))
* [#2795](https://github.com/openlayers/ol3/pull/2795) - Externs ([@gingerik](https://github.com/gingerik))
* [#2792](https://github.com/openlayers/ol3/pull/2792) - Use valid mediatype for GPX export. ([@pgiraud](https://github.com/pgiraud))
* [#2784](https://github.com/openlayers/ol3/pull/2784) - Add 'tooltip'-tag to KML example. ([@marcjansen](https://github.com/marcjansen))
* [#2782](https://github.com/openlayers/ol3/pull/2782) - Hide the rotate control when the rotation is 0 ([@fredj](https://github.com/fredj))
* [#2774](https://github.com/openlayers/ol3/pull/2774) - Remove unused distinctFeatures object in ol.interaction.Modify#handlePointerDown ([@fredj](https://github.com/fredj))
* [#2771](https://github.com/openlayers/ol3/pull/2771) - Allow package to be published in npm registry. ([@tschaub](https://github.com/tschaub))
* [#2773](https://github.com/openlayers/ol3/pull/2773) - Type-related changes to ol.style.Image ([@elemoine](https://github.com/elemoine))
* [#2751](https://github.com/openlayers/ol3/pull/2751) - Export constructors and options of ol.source.Source children ([@gberaudo](https://github.com/gberaudo))
* [#2772](https://github.com/openlayers/ol3/pull/2772) - Rename updatefeature event to changefeature ([@fredj](https://github.com/fredj))
* [#2766](https://github.com/openlayers/ol3/pull/2766) - Make interaction "active" an ol.Object property ([@elemoine](https://github.com/elemoine))
* [#2765](https://github.com/openlayers/ol3/pull/2765) - Treat unknown opt types as Object in ol externs ([@elemoine](https://github.com/elemoine))
* [#2759](https://github.com/openlayers/ol3/pull/2759) - Fix test failures. ([@tschaub](https://github.com/tschaub))
* [#2762](https://github.com/openlayers/ol3/pull/2762) - Report test failures to the console. ([@tschaub](https://github.com/tschaub))
* [#2768](https://github.com/openlayers/ol3/pull/2768) - Write the function name correctly in the doc. ([@xamgreen](https://github.com/xamgreen))
* [#2764](https://github.com/openlayers/ol3/pull/2764) - Remove rtree example ([@fredj](https://github.com/fredj))
* [#2763](https://github.com/openlayers/ol3/pull/2763) - Miscellaneous coding style and typo fixes ([@fredj](https://github.com/fredj))
* [#2758](https://github.com/openlayers/ol3/pull/2758) - Correctly generate child tile ranges for XYZ tiles. ([@tschaub](https://github.com/tschaub))
* [#2734](https://github.com/openlayers/ol3/pull/2734) - Add maxZoom option to BingMaps ([@elemoine](https://github.com/elemoine))
* [#2752](https://github.com/openlayers/ol3/pull/2752) - Call loadFeatures from ol.source.ImageVector ([@elemoine](https://github.com/elemoine))
* [#2658](https://github.com/openlayers/ol3/pull/2658) - Set inherited values when parsing a GetCapabilities ([@oterral](https://github.com/oterral))
* [#2750](https://github.com/openlayers/ol3/pull/2750) - Export ol.layer.Base ([@fredj](https://github.com/fredj))
* [#2749](https://github.com/openlayers/ol3/pull/2749) - Export ol.source.Source ([@fredj](https://github.com/fredj))
* [#2742](https://github.com/openlayers/ol3/pull/2742) - Dispatch an 'updatefeature' from the vector source ([@fredj](https://github.com/fredj))
* [#2747](https://github.com/openlayers/ol3/pull/2747) - Fix incorrect web address. ([@lazaruslarue](https://github.com/lazaruslarue))
* [#2745](https://github.com/openlayers/ol3/pull/2745) - DragBox Interaction: getGeometry return type can be ol.geom.Polygon (r=@fredj) ([@bartvde](https://github.com/bartvde))
* [#2744](https://github.com/openlayers/ol3/pull/2744) - Fix ol.Feature 'change' event documentation ([@fredj](https://github.com/fredj))
* [#2741](https://github.com/openlayers/ol3/pull/2741) - issue with reading scientific notation coordinates in ol.format.GML (r=@fredj) ([@bartvde](https://github.com/bartvde))
* [#2739](https://github.com/openlayers/ol3/pull/2739) - Revert "Function circular renamed to createCircularOnSphere" ([@elemoine](https://github.com/elemoine))
* [#2616](https://github.com/openlayers/ol3/pull/2616) - Target for attribution links differs between maps ([@fredj](https://github.com/fredj))
* [#2740](https://github.com/openlayers/ol3/pull/2740) - Make interactions activable and deactivable ([@elemoine](https://github.com/elemoine))
* [#2727](https://github.com/openlayers/ol3/pull/2727) - Rename ol.geom.Polygon#circular to createCircularOnSphere ([@elemoine](https://github.com/elemoine))
* [#2730](https://github.com/openlayers/ol3/pull/2730) - Do not call toLowerCase when forming a change:property event ([@elemoine](https://github.com/elemoine))
* [#2728](https://github.com/openlayers/ol3/pull/2728) - Mark `ol.extent.getIntersection` as stable. ([@tschaub](https://github.com/tschaub))
* [#2726](https://github.com/openlayers/ol3/pull/2726) - Make ol.Feature#setStyle accept null ([@elemoine](https://github.com/elemoine))
* [#2724](https://github.com/openlayers/ol3/pull/2724) - Error when compiling individual example ([@fredj](https://github.com/fredj))
* [#1959](https://github.com/openlayers/ol3/pull/1959) - Add a feature box selection example ([@elemoine](https://github.com/elemoine))
* [#2722](https://github.com/openlayers/ol3/pull/2722) - Make ol.Map#setView do not accept undefined ([@elemoine](https://github.com/elemoine))
* [#2696](https://github.com/openlayers/ol3/pull/2696) - Consistent circle transform. ([@gberaudo](https://github.com/gberaudo))
* [#2717](https://github.com/openlayers/ol3/pull/2717) - Change the control visibility by using css class ([@fredj](https://github.com/fredj))
* [#2715](https://github.com/openlayers/ol3/pull/2715) - Add an EPSG:3857 map to Tissot example ([@elemoine](https://github.com/elemoine))
* [#2714](https://github.com/openlayers/ol3/pull/2714) - Set the opacity directly to element.style.opacity ([@fredj](https://github.com/fredj))
* [#2647](https://github.com/openlayers/ol3/pull/2647) - Upgrade closure library version ([@fredj](https://github.com/fredj))
* [#2549](https://github.com/openlayers/ol3/pull/2549) - Use goog.array.ASSUME_NATIVE_FUNCTIONS define ([@fredj](https://github.com/fredj))
* [#2711](https://github.com/openlayers/ol3/pull/2711) - Remove Google Maps example ([@elemoine](https://github.com/elemoine))
* [#2684](https://github.com/openlayers/ol3/pull/2684) - Rename ol.Observable#dispatchChangeEvent() to #changed() ([@ahocevar](https://github.com/ahocevar))
* [#2678](https://github.com/openlayers/ol3/pull/2678) - Mutable symbolizer properties for styles ([@ahocevar](https://github.com/ahocevar))
* [#2568](https://github.com/openlayers/ol3/pull/2568) - re-implement auto-configure code for ol.format.GML (r=@ahocevar) ([@bartvde](https://github.com/bartvde))
* [#2704](https://github.com/openlayers/ol3/pull/2704) - Use pool thread for calling bin/check-example.js. ([@gberaudo](https://github.com/gberaudo))
* [#2698](https://github.com/openlayers/ol3/pull/2698) - StaticVector is not an abstract base class ([@ahocevar](https://github.com/ahocevar))
* [#2702](https://github.com/openlayers/ol3/pull/2702) - Add vector layer in export-map example ([@fredj](https://github.com/fredj))
* [#2687](https://github.com/openlayers/ol3/pull/2687) - Use ol.LEGACY_IE_SUPPORT and ol.IS_LEGACY_IE define ([@fredj](https://github.com/fredj))
* [#2675](https://github.com/openlayers/ol3/pull/2675) - Remove undefined from ol.Map#getLayers return type ([@fredj](https://github.com/fredj))
* [#2692](https://github.com/openlayers/ol3/pull/2692) - Unset z-index in overlay example ([@fredj](https://github.com/fredj))
* [#2681](https://github.com/openlayers/ol3/pull/2681) - Make tileSize a config option for ol.source.XYZ ([@ahocevar](https://github.com/ahocevar))
* [#2534](https://github.com/openlayers/ol3/pull/2534) - Document ol.geom.Polygon#getLinearRing function ([@fredj](https://github.com/fredj))
* [#2677](https://github.com/openlayers/ol3/pull/2677) - Add TextStyle offsets getters to API. ([@gberaudo](https://github.com/gberaudo))
* [#2676](https://github.com/openlayers/ol3/pull/2676) - ol.FeatureOverlay: use the feature style if defined ([@fredj](https://github.com/fredj))
* [#2656](https://github.com/openlayers/ol3/pull/2656) - Set ol.layer.Image#getSource return type to ol.source.Image ([@fredj](https://github.com/fredj))
* [#2651](https://github.com/openlayers/ol3/pull/2651) - ol.layer.Vector.getSource return type specialisation. ([@gberaudo](https://github.com/gberaudo))
* [#2669](https://github.com/openlayers/ol3/pull/2669) - Revert "snapshot" ([@fredj](https://github.com/fredj))
* [#2663](https://github.com/openlayers/ol3/pull/2663) - Set tracking property to false on geolocation error ([@fredj](https://github.com/fredj))
* [#2662](https://github.com/openlayers/ol3/pull/2662) - Delegate transformation in ol.source.FormatVector#readFeatures to `ol.format.*` ([@gingerik](https://github.com/gingerik))
* [#2447](https://github.com/openlayers/ol3/pull/2447) - Correct documentation typo. ([@lazaruslarue](https://github.com/lazaruslarue))
* [#2660](https://github.com/openlayers/ol3/pull/2660) - New domain in the build header ([@elemoine](https://github.com/elemoine))

View File

@@ -1,3 +1,3 @@
{
"library_url": "https://github.com/google/closure-library/archive/fb35d5232edef340dd9a7c6e479556829d0fa452.zip"
"library_url": "https://github.com/google/closure-library/archive/ad5e66c1e7d7829b0d77feae49aaf5f011265715.zip"
}

View File

@@ -2,6 +2,7 @@
"exports": [],
"src": [
"src/**/*.js",
"build/ol.ext/*.js",
"build/examples/all.js"
],
"compile": {
@@ -14,6 +15,7 @@
"externs/bootstrap.js",
"externs/closure-compiler.js",
"externs/example.js",
"externs/fastclick.js",
"externs/geojson.js",
"externs/jquery-1.9.js",
"externs/proj4js.js",
@@ -67,7 +69,8 @@
"api", "observable"
],
"compilation_level": "ADVANCED",
"output_wrapper": "// OpenLayers 3. See http://ol3js.org/\n(function(){%output%})();",
"warning_level": "VERBOSE",
"output_wrapper": "(function(){%output%})();",
"use_types_for_optimization": true,
"manage_closure_dependencies": true

View File

@@ -54,11 +54,25 @@ $(function () {
_onResize();
// show/hide unstable items
var links = $('a[href^="ol."]');
var unstable = $('.unstable');
var stabilityToggle = $('#stability-toggle');
stabilityToggle.change(function() {
unstable.toggle(!this.checked);
unstable.toggleClass('hidden', this.checked);
var search = this.checked ? '' : '?unstable=true';
links.each(function(i, el) {
this.href = this.pathname + search + this.hash;
});
if (history.replaceState) {
var url = window.location.pathname + search + window.location.hash;
history.replaceState({}, '', url);
}
return false;
});
unstable.toggle(!stabilityToggle[0].checked);
var search = window.location.search;
links.each(function(i, el) {
this.href = this.pathname + search + this.hash;
});
stabilityToggle.prop('checked', search !== '?unstable=true');
unstable.toggleClass('hidden', stabilityToggle[0].checked);
});

View File

@@ -372,7 +372,7 @@ footer {
.main .readme table ul li {
margin-bottom: 0;
}
.unstable {
.hidden {
display: none;
}
#stability {

View File

@@ -64,6 +64,23 @@ var self = this;
}
?>
</ul>
<ul class="fires itemMembers">
<?js
if (item.fires && item.fires.length) {
?>
<span class="subtitle">Fires</span>
<?js
item.fires.forEach(function (v) {
v = self.find({longname: v})[0] || {longname: v, name: v.split(/#?event:/)[1]};
?>
<li data-name="<?js= v.longname ?>" class="<?js= (v.stability != 'stable' ? 'unstable' : '') ?>">
<?js= self.linkto(v.longname, v.name) ?>
</li>
<?js
});
}
?>
</ul>
</li>
<?js }); ?>
</ul>

View File

@@ -1,3 +1,4 @@
{
"exports": ["*"]
"exports": ["*"],
"umd": true
}

View File

@@ -1,5 +1,6 @@
{
"exports": ["*"],
"umd": true,
"compile": {
"externs": [
"externs/bingmaps.js",
@@ -58,7 +59,7 @@
"api", "observable"
],
"compilation_level": "ADVANCED",
"output_wrapper": "(function(){%output%})();",
"warning_level": "VERBOSE",
"use_types_for_optimization": true,
"manage_closure_dependencies": true
}

View File

@@ -99,7 +99,6 @@
}
.ol-compass {
display: block;
font-family: Arial;
font-weight: normal;
font-size: 1.2em;
}
@@ -131,65 +130,6 @@ button.ol-full-screen-true:after {
content: "\00d7";
}
/* invisible but not hidden */
.ol-has-tooltip [role=tooltip] {
position: absolute;
clip: rect(1px 1px 1px 1px); /* < IE8 */
clip: rect(1px, 1px, 1px, 1px);
padding: 0;
border: 0;
height: 1px;
width: 1px;
overflow: hidden;
font-weight: normal;
font-size: 14px;
text-shadow: 0 0 2px #fff;
}
/* show a tooltip offset to below and right */
.ol-has-tooltip:hover [role=tooltip], .ol-has-tooltip:focus [role=tooltip] {
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
clip: auto;
padding: 0 .4em;
font-size: .8em;
height: 1.2em;
width: auto;
line-height: 1.2em;
z-index: 1100;
max-height: 100px;
white-space: nowrap;
display: inline-block;
background: #FFF;
background: rgba(255,255,255,0.6);
color: #000;
border: 3px solid rgba(255,255,255,0);
border-left-width: 0;
border-radius: 0 4px 4px 0;
bottom: .3em;
left: 2.2em;
}
.ol-touch .ol-has-tooltip:hover [role=tooltip],
.ol-touch .ol-has-tooltip:focus [role=tooltip] {
display: none;
}
.ol-zoom .ol-has-tooltip:hover [role=tooltip],
.ol-zoom .ol-has-tooltip:focus [role=tooltip] {
top: 1.1em;
}
.ol-rotate .ol-has-tooltip:hover [role=tooltip],
.ol-rotate .ol-has-tooltip:focus [role=tooltip],
.ol-attribution .ol-has-tooltip:hover [role=tooltip],
.ol-attribution .ol-has-tooltip:focus [role=tooltip],
.ol-full-screen .ol-has-tooltip:hover [role=tooltip],
.ol-full-screen .ol-has-tooltip:focus [role=tooltip] {
right: 2.2em;
left: auto;
border-radius: 4px 0 0 4px;
border-left-width: 3px;
border-right-width: 0;
}
.ol-attribution {
text-align: right;
@@ -205,7 +145,6 @@ button.ol-full-screen-true:after {
line-height: 1.375em;
color: #000;
text-shadow: 0 0 2px #fff;
max-width: calc(100% - 3.6em);
}
.ol-attribution li {
display: inline;
@@ -217,11 +156,11 @@ button.ol-full-screen-true:after {
}
.ol-attribution img {
max-height: 2em;
max-width: inherit;
}
.ol-attribution ul, .ol-attribution button {
display: inline-block;
}
.ol-attribution:not(.ol-collapsed) button:hover [role=tooltip],
.ol-attribution.ol-collapsed ul {
display: none;
}
@@ -281,13 +220,6 @@ button.ol-full-screen-true:after {
width: 1.8em;
}
.ol-control button,
.ol-attribution,
.ol-scale-line-inner,
.ol-has-tooltip [role=tooltip] {
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
}
.ol-overviewmap {
position: absolute;
left: 0.5em;
@@ -313,7 +245,6 @@ button.ol-full-screen-true:after {
left: 2px;
position: absolute;
}
.ol-overviewmap:not(.ol-collapsed) button:hover [role=tooltip],
.ol-overviewmap.ol-collapsed .ol-overviewmap-map,
.ol-overviewmap.ol-uncollapsible button {
display: none;

View File

@@ -0,0 +1,62 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<style type="text/css">
.tooltip-inner {
white-space: nowrap;
}
</style>
<title>ol3 custom tooltips example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Custom tooltips</h4>
<p id="shortdesc">
This example shows how to customize the buttons tooltips with
<a href="http://getbootstrap.com/javascript/#tooltips">Bootstrap</a>.
</p>
<div id="docs">
<p>
See the <a href="button-title.js" target="_blank">button-title.js source</a> to see how this is done.
</p>
</div>
<div id="tags">
custom, tooltip
</div>
</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=button-title" type="text/javascript"></script>
</body>
</html>

27
examples/button-title.js Normal file
View File

@@ -0,0 +1,27 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
renderer: exampleNS.getRendererFromQueryString(),
target: 'map',
view: new ol.View({
center: [-8730000, 5930000],
rotation: Math.PI / 5,
zoom: 8
})
});
$('.ol-zoom-in, .ol-zoom-out').tooltip({
placement: 'right'
});
$('.ol-rotate-reset, .ol-attribution button[title]').tooltip({
placement: 'left'
});

BIN
examples/data/Butterfly.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -0,0 +1,51 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Drag features example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Drag features example</h4>
<p id="shortdesc">Example of a drag features interaction.</p>
<div id="docs">
<p>See the <a href="drag-features.js" target="_blank">drag-features.js source</a> to see how this is done.</p>
</div>
<div id="tags">drag, feature, vector, editing</div>
</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=drag-features" type="text/javascript"></script>
</body>
</html>

192
examples/drag-features.js Normal file
View File

@@ -0,0 +1,192 @@
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.interaction');
goog.require('ol.interaction.Pointer');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.TileJSON');
goog.require('ol.source.Vector');
goog.require('ol.style.Fill');
goog.require('ol.style.Icon');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
/**
* Define a namespace for the application.
*/
window.app = {};
var app = window.app;
/**
* @constructor
* @extends {ol.interaction.Pointer}
*/
app.Drag = function() {
ol.interaction.Pointer.call(this, {
handleDownEvent: app.Drag.prototype.handleDownEvent,
handleDragEvent: app.Drag.prototype.handleDragEvent,
handleMoveEvent: app.Drag.prototype.handleMoveEvent,
handleUpEvent: app.Drag.prototype.handleUpEvent
});
/**
* @type {ol.Pixel}
* @private
*/
this.coordinate_ = null;
/**
* @type {string|undefined}
* @private
*/
this.cursor_ = 'pointer';
/**
* @type {ol.Feature}
* @private
*/
this.feature_ = null;
/**
* @type {string|undefined}
* @private
*/
this.previousCursor_ = undefined;
};
ol.inherits(app.Drag, ol.interaction.Pointer);
/**
* @param {ol.MapBrowserEvent} evt Map browser event.
* @return {boolean} `true` to start the drag sequence.
*/
app.Drag.prototype.handleDownEvent = function(evt) {
var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature;
});
if (feature) {
this.coordinate_ = evt.coordinate;
this.feature_ = feature;
}
return !!feature;
};
/**
* @param {ol.MapBrowserEvent} evt Map browser event.
*/
app.Drag.prototype.handleDragEvent = function(evt) {
var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature;
});
var deltaX = evt.coordinate[0] - this.coordinate_[0];
var deltaY = evt.coordinate[1] - this.coordinate_[1];
var geometry = /** @type {ol.geom.SimpleGeometry} */
(this.feature_.getGeometry());
geometry.translate(deltaX, deltaY);
this.coordinate_[0] = evt.coordinate[0];
this.coordinate_[1] = evt.coordinate[1];
};
/**
* @param {ol.MapBrowserEvent} evt Event.
*/
app.Drag.prototype.handleMoveEvent = function(evt) {
if (this.cursor_) {
var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature;
});
var element = evt.map.getTargetElement();
if (feature) {
if (element.style.cursor != this.cursor_) {
this.previousCursor_ = element.style.cursor;
element.style.cursor = this.cursor_;
}
} else if (this.previousCursor_ !== undefined) {
element.style.cursor = this.previousCursor_;
this.previousCursor_ = undefined;
}
}
};
/**
* @param {ol.MapBrowserEvent} evt Map browser event.
* @return {boolean} `false` to stop the drag sequence.
*/
app.Drag.prototype.handleUpEvent = function(evt) {
this.coordinate_ = null;
this.feature_ = null;
return false;
};
var pointFeature = new ol.Feature(new ol.geom.Point([0, 0]));
var lineFeature = new ol.Feature(
new ol.geom.LineString([[-1e7, 1e6], [-1e6, 3e6]]));
var polygonFeature = new ol.Feature(
new ol.geom.Polygon([[[-3e6, -1e6], [-3e6, 1e6],
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
var map = new ol.Map({
interactions: ol.interaction.defaults().extend([new app.Drag()]),
layers: [
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp'
})
}),
new ol.layer.Vector({
source: new ol.source.Vector({
features: [pointFeature, lineFeature, polygonFeature]
}),
style: new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 46],
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
opacity: 0.95,
src: 'data/icon.png'
})),
stroke: new ol.style.Stroke({
width: 3,
color: [255, 0, 0, 1]
}),
fill: new ol.style.Fill({
color: [0, 0, 255, 0.6]
})
})
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -38,6 +38,7 @@ var vector = new ol.layer.Vector({
var map = new ol.Map({
layers: [raster, vector],
renderer: exampleNS.getRendererFromQueryString(),
target: 'map',
view: new ol.View({
center: [-11000000, 4600000],

View File

@@ -1,11 +1,14 @@
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.Point');
goog.require('ol.layer.Tile');
goog.require('ol.source.MapQuest');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var map = new ol.Map({
@@ -14,6 +17,7 @@ var map = new ol.Map({
source: new ol.source.MapQuest({layer: 'sat'})
})
],
renderer: exampleNS.getRendererFromQueryString(),
target: 'map',
view: new ol.View({
center: [0, 0],
@@ -28,6 +32,20 @@ var imageStyle = new ol.style.Circle({
stroke: new ol.style.Stroke({color: 'red', width: 1})
});
var headInnerImageStyle = new ol.style.Style({
image: new ol.style.Circle({
radius: 2,
snapToPixel: false,
fill: new ol.style.Fill({color: 'blue'})
})
});
var headOuterImageStyle = new ol.style.Circle({
radius: 5,
snapToPixel: false,
fill: new ol.style.Fill({color: 'black'})
});
var n = 200;
var omegaTheta = 30000; // Rotation period in ms
var R = 7e6;
@@ -48,6 +66,14 @@ map.on('postcompose', function(event) {
vectorContext.setImageStyle(imageStyle);
vectorContext.drawMultiPointGeometry(
new ol.geom.MultiPoint(coordinates), null);
var headPoint = new ol.geom.Point(coordinates[coordinates.length - 1]);
var headFeature = new ol.Feature(headPoint);
vectorContext.drawFeature(headFeature, headInnerImageStyle);
vectorContext.setImageStyle(headOuterImageStyle);
vectorContext.drawMultiPointGeometry(headPoint, null);
map.render();
});
map.render();

View File

@@ -0,0 +1,75 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Earthquake Clusters</title>
<style>
#map {
position: relative;
}
#info {
position: absolute;
height: 1px;
width: 1px;
z-index: 100;
}
.tooltip.in {
opacity: 1;
filter: alpha(opacity=100);
}
.tooltip.top .tooltip-arrow {
border-top-color: white;
}
.tooltip-inner {
border: 2px solid white;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Earthquake Clusters</h4>
<p id="shortdesc">Demonstrates the use of style geometries to render source features of a cluster.</p>
<div id="docs">
<p>
This example parses a KML file and renders the features as clusters on a vector layer. The styling in this example is quite involved. Single earthquake locations (rendered as stars) have a size relative to their magnitude. Clusters have an opacity relative to the number of features in the cluster, and a size that represents the extent of the features that make up the cluster. When clicking or hovering on a cluster, the individual features that make up the cluster will be shown.
</p>
<p>To achieve this, we make heavy use of style functions and <code>ol.style.Style#geometry</code>. See the <a href="earthquake-clusters.js" target="_blank">earthquake-clusters.js source</a> to see how this is done.</p>
</div>
<div id="tags">KML, vector, style, geometry, cluster</div>
</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=earthquake-clusters" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,154 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.extent');
goog.require('ol.interaction');
goog.require('ol.interaction.Select');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.Cluster');
goog.require('ol.source.KML');
goog.require('ol.source.Stamen');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.RegularShape');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
goog.require('ol.style.Text');
var earthquakeFill = new ol.style.Fill({
color: 'rgba(255, 153, 0, 0.8)'
});
var earthquakeStroke = new ol.style.Stroke({
color: 'rgba(255, 204, 0, 0.2)',
width: 1
});
var textFill = new ol.style.Fill({
color: '#fff'
});
var textStroke = new ol.style.Stroke({
color: 'rgba(0, 0, 0, 0.6)',
width: 3
});
var invisibleFill = new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.01)'
});
function createEarthquakeStyle(feature) {
// 2012_Earthquakes_Mag5.kml stores the magnitude of each earthquake in a
// standards-violating <magnitude> tag in each Placemark. We extract it
// from the Placemark's name instead.
var name = feature.get('name');
var magnitude = parseFloat(name.substr(2));
var radius = 5 + 20 * (magnitude - 5);
return new ol.style.Style({
geometry: feature.getGeometry(),
image: new ol.style.RegularShape({
radius1: radius,
radius2: 3,
points: 5,
angle: Math.PI,
fill: earthquakeFill,
stroke: earthquakeStroke
})
});
}
var maxFeatureCount;
function calculateClusterInfo(resolution) {
maxFeatureCount = 0;
var features = vector.getSource().getFeatures();
var feature, radius;
for (var i = features.length - 1; i >= 0; --i) {
feature = features[i];
var originalFeatures = feature.get('features');
var extent = ol.extent.createEmpty();
for (var j = 0, jj = originalFeatures.length; j < jj; ++j) {
ol.extent.extend(extent, originalFeatures[j].getGeometry().getExtent());
}
maxFeatureCount = Math.max(maxFeatureCount, jj);
radius = 0.25 * (ol.extent.getWidth(extent) + ol.extent.getHeight(extent)) /
resolution;
feature.set('radius', radius);
}
}
var currentResolution;
function styleFunction(feature, resolution) {
if (resolution != currentResolution) {
calculateClusterInfo(resolution);
currentResolution = resolution;
}
var style;
var size = feature.get('features').length;
if (size > 1) {
style = [new ol.style.Style({
image: new ol.style.Circle({
radius: feature.get('radius'),
fill: new ol.style.Fill({
color: [255, 153, 0, Math.min(0.8, 0.4 + (size / maxFeatureCount))]
})
}),
text: new ol.style.Text({
text: size.toString(),
fill: textFill,
stroke: textStroke
})
})];
} else {
var originalFeature = feature.get('features')[0];
style = [createEarthquakeStyle(originalFeature)];
}
return style;
}
function selectStyleFunction(feature, resolution) {
var styles = [new ol.style.Style({
image: new ol.style.Circle({
radius: feature.get('radius'),
fill: invisibleFill
})
})];
var originalFeatures = feature.get('features');
var originalFeature;
for (var i = originalFeatures.length - 1; i >= 0; --i) {
originalFeature = originalFeatures[i];
styles.push(createEarthquakeStyle(originalFeature));
}
return styles;
}
var vector = new ol.layer.Vector({
source: new ol.source.Cluster({
distance: 40,
source: new ol.source.KML({
extractStyles: false,
projection: 'EPSG:3857',
url: 'data/kml/2012_Earthquakes_Mag5.kml'
})
}),
style: styleFunction
});
var raster = new ol.layer.Tile({
source: new ol.source.Stamen({
layer: 'toner'
})
});
var map = new ol.Map({
layers: [raster, vector],
interactions: ol.interaction.defaults().extend([new ol.interaction.Select({
condition: function(evt) {
return evt.originalEvent.type == 'mousemove' ||
evt.type == 'singleclick';
},
style: selectStyleFunction
})]),
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -9,7 +9,7 @@ goog.require('ol.source.TileWMS');
var layers = [
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
}

View File

@@ -5,7 +5,7 @@ goog.require('ol.source.ImageWMS');
var wmsSource = new ol.source.ImageWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'ne:ne'},
serverType: 'geoserver'
});

View File

@@ -5,7 +5,7 @@ goog.require('ol.source.TileWMS');
var wmsSource = new ol.source.TileWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'ne:ne'},
serverType: 'geoserver'
});

View File

@@ -105,9 +105,7 @@ if ('download' in exportGPXElement) {
clone.getGeometry().transform(projection, 'EPSG:4326');
features.push(clone);
});
var node = new ol.format.GPX().writeFeatures(features);
var string = new XMLSerializer().serializeToString(
/** @type {Node} */ (node));
var string = new ol.format.GPX().writeFeatures(features);
var base64 = exampleNS.strToBase64(string);
exportGPXElement.href =
'data:text/gpx+xml;base64,' + base64;

View File

@@ -0,0 +1,53 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Icon sprites with WebGL example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Icon sprite with WebGL example</h4>
<p id="shortdesc">Icon sprite with WebGL.</p>
<div id="docs">
<p>See the <a href="icon-sprite-webgl.js" target="_blank">icon-sprite-webgl.js source</a> to see how this is done.</p>
<p>In this example a sprite image is used for the icon styles. Using a sprite is required to get good performance with WebGL.</p>
</div>
<div id="tags">webgl, icon, sprite, vector, point</div>
</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=icon-sprite-webgl" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,111 @@
goog.require('ol.Feature');
goog.require('ol.FeatureOverlay');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.Point');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Icon');
goog.require('ol.style.Style');
var iconInfo = [{
offset: [0, 0],
opacity: 1.0,
rotateWithView: true,
rotation: 0.0,
scale: 1.0,
size: [55, 55]
}, {
offset: [110, 86],
opacity: 0.75,
rotateWithView: false,
rotation: Math.PI / 2.0,
scale: 1.25,
size: [55, 55]
}, {
offset: [55, 0],
opacity: 0.5,
rotateWithView: true,
rotation: Math.PI / 3.0,
scale: 1.5,
size: [55, 86]
}, {
offset: [212, 0],
opacity: 1.0,
rotateWithView: true,
rotation: 0.0,
scale: 1.0,
size: [44, 44]
}];
var i;
var iconCount = iconInfo.length;
var icons = new Array(iconCount);
for (i = 0; i < iconCount; ++i) {
var info = iconInfo[i];
icons[i] = new ol.style.Icon({
offset: info.offset,
opacity: info.opacity,
rotateWithView: info.rotateWithView,
rotation: info.rotation,
scale: info.scale,
size: info.size,
src: 'data/Butterfly.png'
});
}
var featureCount = 50000;
var features = new Array(featureCount);
var feature, geometry;
var e = 25000000;
for (i = 0; i < featureCount; ++i) {
geometry = new ol.geom.Point(
[2 * e * Math.random() - e, 2 * e * Math.random() - e]);
feature = new ol.Feature(geometry);
feature.setStyle(
new ol.style.Style({
image: icons[i % (iconCount - 1)]
})
);
features[i] = feature;
}
var vectorSource = new ol.source.Vector({
features: features
});
var vector = new ol.layer.Vector({
source: vectorSource
});
// Use the "webgl" renderer by default.
var renderer = exampleNS.getRendererFromQueryString();
if (!renderer) {
renderer = 'webgl';
}
var map = new ol.Map({
renderer: renderer,
layers: [vector],
target: document.getElementById('map'),
view: new ol.View({
center: [0, 0],
zoom: 5
})
});
var overlayFeatures = [];
for (i = 0; i < featureCount; i += 30) {
var clone = features[i].clone();
clone.setStyle(null);
overlayFeatures.push(clone);
}
var featureOverlay = new ol.FeatureOverlay({
map: map,
style: new ol.style.Style({
image: icons[iconCount - 1]
}),
features: overlayFeatures
});

View File

@@ -73,7 +73,7 @@ var map = new ol.Map({
html: 'All maps &copy; ' +
'<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'
}),
ol.source.OSM.DATA_ATTRIBUTION
ol.source.OSM.ATTRIBUTION
],
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
})

View File

@@ -73,9 +73,7 @@ if ('download' in exportKMLElement) {
clone.getGeometry().transform(projection, 'EPSG:4326');
features.push(clone);
});
var node = new ol.format.KML().writeFeatures(features);
var string = new XMLSerializer().serializeToString(
/** @type {Node} */ (node));
var string = new ol.format.KML().writeFeatures(features);
var base64 = exampleNS.strToBase64(string);
exportKMLElement.href =
'data:application/vnd.google-earth.kml+xml;base64,' + base64;

View File

@@ -0,0 +1,68 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Limited Layer Extent</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Limited layer extent</h4>
<p id="shortdesc">Restricting layer rendering to a limited extent.</p>
<div id="docs">
<p>
This example uses the <code>layer.setExtent()</code> method to
modify the extent of the overlay layer. Use the controls below
to limit rendering based on an extent.
</p>
<p>
<div class="btn-group">
<button type="button" class="btn btn-default" id="northwest">northwest</button>
<button type="button" class="btn btn-default" id="northeast">northeast</button>
<button type="button" class="btn btn-default" id="southeast">southeast</button>
<button type="button" class="btn btn-default" id="southwest">southwest</button>
<button type="button" class="btn btn-default" id="world">world</button>
</div>
</p>
<p>
See the <a href="layer-extent.js" target="_blank">layer-extent.js
source</a> for details on how this is done.
</p>
</div>
<div id="tags">extent, tilejson</div>
</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=layer-extent" type="text/javascript"></script>
</body>
</html>

50
examples/layer-extent.js Normal file
View File

@@ -0,0 +1,50 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.TileJSON');
function transform(extent) {
return ol.proj.transformExtent(extent, 'EPSG:4326', 'EPSG:3857');
}
var extents = {
northwest: transform([-180, 0, 0, 85]),
northeast: transform([0, 0, 180, 85]),
southeast: transform([0, -85, 180, 0]),
southwest: transform([-180, -85, 0, 0]),
world: transform([-180, -85, 180, 85])
};
var base = new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.world-black.jsonp',
crossOrigin: 'anonymous'
})
});
var overlay = new ol.layer.Tile({
extent: extents.northwest,
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.world-glass.jsonp',
crossOrigin: 'anonymous'
})
});
var map = new ol.Map({
layers: [base, overlay],
renderer: exampleNS.getRendererFromQueryString(),
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 1
})
});
for (var key in extents) {
document.getElementById(key).onclick = function(event) {
overlay.setExtent(extents[event.target.id]);
};
}

73
examples/lazy-source.html Normal file
View File

@@ -0,0 +1,73 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Lazy Source</title>
<style>
button.code {
font-family: Monaco,Menlo,Consolas,"Courier New",monospace;
font-size: 12px;
padding: 5px;
margin: 0 5px;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Lazy source example</h4>
<p id="shortdesc">Example of setting a layer source after construction.</p>
<div id="docs">
<p>
Typically, the source for a layer is provided to the layer constructor.
If you need to set a layer source after construction, this can be
done with the <code>layer.setSource()</code> method.
</p>
<p>
The layer in the map above is constructed with no source. Use the
links below to set/unset the layer source. A layer is not rendered
until its source is set.
</p>
<p>
<button id="set-source" class="code">layer.setSource(source)</button>
<button id="unset-source" class="code">layer.setSource(null)</button>
</p>
<p>See the <a href="lazy-source.js" target="_blank">lazy-source.js source</a> for details on how this is done.</p>
</div>
<div id="tags">source</div>
</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=lazy-source" type="text/javascript"></script>
</body>
</html>

26
examples/lazy-source.js Normal file
View File

@@ -0,0 +1,26 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.MapQuest');
var source = new ol.source.MapQuest({layer: 'sat'});
var layer = new ol.layer.Tile();
var map = new ol.Map({
layers: [layer],
renderer: exampleNS.getRendererFromQueryString(),
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
document.getElementById('set-source').onclick = function() {
layer.setSource(source);
};
document.getElementById('unset-source').onclick = function() {
layer.setSource(null);
};

View File

@@ -16,7 +16,7 @@ var openCycleMapLayer = new ol.layer.Tile({
html: 'All maps &copy; ' +
'<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'
}),
ol.source.OSM.DATA_ATTRIBUTION
ol.source.OSM.ATTRIBUTION
],
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
})
@@ -29,7 +29,7 @@ var openSeaMapLayer = new ol.layer.Tile({
html: 'All maps &copy; ' +
'<a href="http://www.openseamap.org/">OpenSeaMap</a>'
}),
ol.source.OSM.DATA_ATTRIBUTION
ol.source.OSM.ATTRIBUTION
],
crossOrigin: null,
url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'

View File

@@ -18,6 +18,7 @@
<div id="map" class="map"></div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.3/fastclick.js" type="text/javascript"></script>
<script src="loader.js?id=mobile-full-screen" type="text/javascript"></script>
<div style="display: none;">

View File

@@ -32,3 +32,11 @@ geolocation.once('change:position', function() {
view.setCenter(geolocation.getPosition());
view.setResolution(2.388657133911758);
});
// Use FastClick to eliminate the 300ms delay between a physical tap
// and the firing of a click event on mobile browsers.
// See http://updates.html5rocks.com/2013/12/300ms-tap-delay-gone-away
// for more information.
$(function() {
FastClick.attach(document.body);
});

View File

@@ -0,0 +1,51 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Regular Shape example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Regular Shape example</h4>
<p id="shortdesc">Example of some Regular Shape styles.</p>
<div id="docs">
<p>See the <a href="regularshape.js" target="_blank">regularshape.js source</a> to see how this is done.</p>
</div>
<div id="tags">vector, symbol, regularshape, style, square, cross, star, triangle, x</div>
</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=regularshape" type="text/javascript"></script>
</body>
</html>

101
examples/regularshape.js Normal file
View File

@@ -0,0 +1,101 @@
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.Point');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Fill');
goog.require('ol.style.RegularShape');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var stroke = new ol.style.Stroke({color: 'black', width: 2});
var fill = new ol.style.Fill({color: 'red'});
var styles = {
'square': [new ol.style.Style({
image: new ol.style.RegularShape(
/** @type {olx.style.RegularShapeOptions} */({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
angle: Math.PI / 4
}))
})],
'triangle': [new ol.style.Style({
image: new ol.style.RegularShape(
/** @type {olx.style.RegularShapeOptions} */({
fill: fill,
stroke: stroke,
points: 3,
radius: 10,
rotation: Math.PI / 4,
angle: 0
}))
})],
'star': [new ol.style.Style({
image: new ol.style.RegularShape(
/** @type {olx.style.RegularShapeOptions} */({
fill: fill,
stroke: stroke,
points: 5,
radius: 10,
radius2: 4,
angle: 0
}))
})],
'cross': [new ol.style.Style({
image: new ol.style.RegularShape(
/** @type {olx.style.RegularShapeOptions} */({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
radius2: 0,
angle: 0
}))
})],
'x': [new ol.style.Style({
image: new ol.style.RegularShape(
/** @type {olx.style.RegularShapeOptions} */({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
radius2: 0,
angle: Math.PI / 4
}))
})]
};
var styleKeys = ['x', 'cross', 'star', 'triangle', 'square'];
var count = 250;
var features = new Array(count);
var e = 4500000;
for (var i = 0; i < count; ++i) {
var coordinates = [2 * e * Math.random() - e, 2 * e * Math.random() - e];
features[i] = new ol.Feature(new ol.geom.Point(coordinates));
features[i].setStyle(styles[styleKeys[Math.floor(Math.random() * 5)]]);
}
var source = new ol.source.Vector({
features: features
});
var vectorLayer = new ol.layer.Vector({
source: source
});
var map = new ol.Map({
layers: [
vectorLayer
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -0,0 +1,58 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Symbols with WebGL example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">Symbols with WebGL example</h4>
<p id="shortdesc">Using symbols in an atlas with WebGL.</p>
<div id="docs">
<p>When using symbol styles with WebGL, OpenLayers would render the symbol
on a temporary image and would create a WebGL texture for each image. For a
better performance, it is recommended to use atlas images (similar to
image sprites with CSS), so that the number of textures is reduced. OpenLayers
provides an <code>AtlasManager</code>, which when passed to the constructor
of a symbol style, will create atlases for the symbols.</p>
<p>See the <a href="symbol-atlas-webgl.js" target="_blank">symbol-atlas-webgl.js source</a> to see how this is done.</p>
</div>
<div id="tags">webgl, symbol, atlas, vector, point</div>
</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=symbol-atlas-webgl" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,123 @@
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.Point');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.AtlasManager');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.RegularShape');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var atlasManager = new ol.style.AtlasManager({
// we increase the initial size so that all symbols fit into
// a single atlas image
initialSize: 512
});
var symbolInfo = [{
opacity: 1.0,
scale: 1.0,
fillColor: 'rgba(255, 153, 0, 0.4)',
strokeColor: 'rgba(255, 204, 0, 0.2)'
}, {
opacity: 0.75,
scale: 1.25,
fillColor: 'rgba(70, 80, 224, 0.4)',
strokeColor: 'rgba(12, 21, 138, 0.2)'
}, {
opacity: 0.5,
scale: 1.5,
fillColor: 'rgba(66, 150, 79, 0.4)',
strokeColor: 'rgba(20, 99, 32, 0.2)'
}, {
opacity: 1.0,
scale: 1.0,
fillColor: 'rgba(176, 61, 35, 0.4)',
strokeColor: 'rgba(145, 43, 20, 0.2)'
}];
var radiuses = [3, 6, 9, 15, 19, 25];
var symbolCount = symbolInfo.length * radiuses.length * 2;
var symbols = [];
var i, j;
for (i = 0; i < symbolInfo.length; ++i) {
var info = symbolInfo[i];
for (j = 0; j < radiuses.length; ++j) {
// circle symbol
symbols.push(new ol.style.Circle({
opacity: info.opacity,
scale: info.scale,
radius: radiuses[j],
fill: new ol.style.Fill({
color: info.fillColor
}),
stroke: new ol.style.Stroke({
color: info.strokeColor,
width: 1
}),
// by passing the atlas manager to the symbol,
// the symbol will be added to an atlas
atlasManager: atlasManager
}));
// star symbol
symbols.push(new ol.style.RegularShape({
points: 8,
opacity: info.opacity,
scale: info.scale,
radius: radiuses[j],
radius2: radiuses[j] * 0.7,
angle: 1.4,
fill: new ol.style.Fill({
color: info.fillColor
}),
stroke: new ol.style.Stroke({
color: info.strokeColor,
width: 1
}),
atlasManager: atlasManager
}));
}
}
var featureCount = 50000;
var features = new Array(featureCount);
var feature, geometry;
var e = 25000000;
for (i = 0; i < featureCount; ++i) {
geometry = new ol.geom.Point(
[2 * e * Math.random() - e, 2 * e * Math.random() - e]);
feature = new ol.Feature(geometry);
feature.setStyle(
new ol.style.Style({
image: symbols[i % symbolCount]
})
);
features[i] = feature;
}
var vectorSource = new ol.source.Vector({
features: features
});
var vector = new ol.layer.Vector({
source: vectorSource
});
// Use the "webgl" renderer by default.
var renderer = exampleNS.getRendererFromQueryString();
if (!renderer) {
renderer = 'webgl';
}
var map = new ol.Map({
renderer: renderer,
layers: [vector],
target: document.getElementById('map'),
view: new ol.View({
center: [0, 0],
zoom: 4
})
});

69
examples/tileutfgrid.html Normal file
View File

@@ -0,0 +1,69 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<style type="text/css">
#country-name {
color: black;
font-size: 12pt;
font-weight: bold;
text-shadow: white 0.1em 0.1em 0.2em;
}
</style>
<title>TileUTFGrid example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">TileUTFGrid example</h4>
<p id="shortdesc">This example shows how to read data from a TileUTFGrid layer.</p>
<p>Point to a country to see its name and flag.</p>
<div id="docs">
<p>Tiles made with <a href="http://tilemill.com/">TileMill</a>. Hosting on MapBox.com or with open-source <a href="https://github.com/klokantech/tileserver-php/">TileServer</a>.</p>
<p>See the <a href="tileutfgrid.js" target="_blank">tileutfgrid.js source</a> to see how this is done.</p>
</div>
<div id="tags">utfgrid, tileutfgrid, tilejson</div>
</div>
</div>
</div>
<div style="display: none;">
<!-- Overlay with the country info -->
<div id="country-info">
<div id="country-name">&nbsp;</div>
<img id="country-flag" src="" />
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=tileutfgrid" type="text/javascript"></script>
</body>
</html>

68
examples/tileutfgrid.js Normal file
View File

@@ -0,0 +1,68 @@
goog.require('ol.Map');
goog.require('ol.Overlay');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.TileJSON');
goog.require('ol.source.TileUTFGrid');
var mapLayer = new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json'
})
});
var gridSource = new ol.source.TileUTFGrid({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json'
});
var gridLayer = new ol.layer.Tile({source: gridSource});
var view = new ol.View({
center: [0, 0],
zoom: 1
});
var mapElement = document.getElementById('map');
var map = new ol.Map({
layers: [mapLayer, gridLayer],
target: mapElement,
view: view
});
var infoElement = document.getElementById('country-info');
var flagElement = document.getElementById('country-flag');
var nameElement = document.getElementById('country-name');
var infoOverlay = new ol.Overlay({
element: infoElement,
offset: [15, 15],
stopEvent: false
});
map.addOverlay(infoOverlay);
var displayCountryInfo = function(coordinate) {
var viewResolution = /** @type {number} */ (view.getResolution());
gridSource.forDataAtCoordinateAndResolution(coordinate, viewResolution,
function(data) {
// If you want to use the template from the TileJSON,
// load the mustache.js library separately and call
// info.innerHTML = Mustache.render(gridSource.getTemplate(), data);
mapElement.style.cursor = data ? 'pointer' : '';
if (data) {
/* jshint -W069 */
flagElement.src = 'data:image/png;base64,' + data['flag_png'];
nameElement.innerHTML = data['admin'];
/* jshint +W069 */
}
infoOverlay.setPosition(data ? coordinate : undefined);
});
};
$(map.getViewport()).on('mousemove', function(evt) {
var coordinate = map.getEventCoordinate(evt.originalEvent);
displayCountryInfo(coordinate);
});
map.on('click', function(evt) {
displayCountryInfo(evt.coordinate);
});

View File

@@ -20,7 +20,7 @@ var map4326 = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
}
@@ -41,7 +41,7 @@ var map3857 = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
}

View File

@@ -13,7 +13,7 @@ goog.require('ol.tilegrid.XYZ');
var vectorSource = new ol.source.ServerVector({
format: new ol.format.GeoJSON(),
loader: function(extent, resolution, projection) {
var url = 'http://demo.opengeo.org/geoserver/wfs?service=WFS&' +
var url = 'http://demo.boundlessgeo.com/geoserver/wfs?service=WFS&' +
'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
'outputFormat=text/javascript&format_options=callback:loadFeatures' +
'&srsname=EPSG:3857&bbox=' + extent.join(',') + ',EPSG:3857';

View File

@@ -13,7 +13,7 @@ var layers = [
new ol.layer.Image({
extent: [-13884991, 2870341, -7455066, 6338219],
source: new ol.source.ImageWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'topp:states'},
serverType: 'geoserver'
})

View File

@@ -12,7 +12,7 @@ var layers = [
new ol.layer.Tile({
extent: [-13884991, 2870341, -7455066, 6338219],
source: new ol.source.TileWMS(/** @type {olx.source.TileWMSOptions} */ ({
url: 'http://demo.opengeo.org/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'topp:states', 'TILED': true},
serverType: 'geoserver'
}))

View File

@@ -29,7 +29,7 @@ var source = new ol.source.WMTS({
style: 'normal',
matrixSet: 'google3857',
urls: urls,
requestEncoding: /** @type {ol.source.WMTSRequestEncoding} */ ('REST'),
requestEncoding: 'REST',
tileGrid: new ol.tilegrid.WMTS({
origin: [-20037508.3428, 20037508.3428],
resolutions: [

View File

@@ -27,7 +27,7 @@ var map = new ol.Map({
html: 'Tiles &copy; <a href="http://www.opencyclemap.org/">' +
'OpenCycleMap</a>'
}),
ol.source.OSM.DATA_ATTRIBUTION
ol.source.OSM.ATTRIBUTION
],
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
})

View File

@@ -45,6 +45,9 @@ var map = new ol.Map({
view: new ol.View({
projection: proj,
center: imgCenter,
zoom: 0
zoom: 0,
// constrain the center: center cannot be set outside
// this extent
extent: [0, -imgHeight, imgWidth, 0]
})
});

25
externs/fastclick.js Normal file
View File

@@ -0,0 +1,25 @@
/**
* @fileoverview Externs for FastClick 1.0.3
* @see https://github.com/ftlabs/fastclick
* @externs
*/
/**
* @type {Object}
* @const
*/
var FastClick = {};
/**
* @typedef {{
* touchBoundary: (number|undefined),
* tapDelay: (number|undefined)
* }}
*/
FastClick.AttachOptions;
/**
* @param {Element} layer
* @param {FastClick.AttachOptions=} opt_options
*/
FastClick.attach = function(layer, opt_options) {};

View File

@@ -34,9 +34,9 @@ var GeoJSONCRS = function() {};
/**
* @type {!GeoJSONCRSCode|!GeoJSONCRSName|!GeoJSONLink}
* TODO: remove GeoJSONCRSCode when http://jira.codehaus.org/browse/GEOS-5996
* is fixed and widely deployed.
* @type {!GeoJSONCRSCode|!GeoJSONCRSName|!GeoJSONLink}
*/
GeoJSONCRS.prototype.properties;
@@ -60,9 +60,9 @@ var GeoJSONCRSName = function() {};
/**
* @type {string}
* TODO: remove this when http://jira.codehaus.org/browse/GEOS-5996 is fixed
* and widely deployed.
* @type {string}
*/
GeoJSONCRSName.prototype.code;

143
externs/jquery-1.9.js vendored
View File

@@ -36,6 +36,44 @@ var jQuerySelector;
/** @typedef {function(...)|Array.<function(...)>} */
var jQueryCallback;
/** @typedef {
{
accepts: (Object.<string, string>|undefined),
async: (?boolean|undefined),
beforeSend: (function(jQuery.jqXHR, (jQueryAjaxSettings|Object.<string, *>))|undefined),
cache: (?boolean|undefined),
complete: (function(jQuery.jqXHR, string)|undefined),
contents: (Object.<string, RegExp>|undefined),
contentType: (?string|undefined),
context: (Object.<?, ?>|jQueryAjaxSettings|undefined),
converters: (Object.<string, Function>|undefined),
crossDomain: (?boolean|undefined),
data: (Object.<?, ?>|?string|Array.<?>|undefined),
dataFilter: (function(string, string):Object.<?,?>|undefined),
dataType: (?string|undefined),
error: (function(jQuery.jqXHR, string, string)|undefined),
global: (?boolean|undefined),
headers: (Object.<?, ?>|undefined),
ifModified: (?boolean|undefined),
isLocal: (?boolean|undefined),
jsonp: (?string|undefined),
jsonpCallback: (?string|function()|undefined),
mimeType: (?string|undefined),
password: (?string|undefined),
processData: (?boolean|undefined),
scriptCharset: (?string|undefined),
statusCode: (Object.<number, function()>|undefined),
success: (function(?, string, jQuery.jqXHR)|undefined),
timeout: (?number|undefined),
traditional: (?boolean|undefined),
type: (?string|undefined),
url: (?string|undefined),
username: (?string|undefined),
xhr: (function():(ActiveXObject|XMLHttpRequest)|undefined),
xhrFields: (Object.<?, ?>|undefined)
}} */
var jQueryAjaxSettings;
/**
* @constructor
* @param {(jQuerySelector|Element|Object|Array.<Element>|jQuery|string|
@@ -86,105 +124,61 @@ jQuery.prototype.addClass = function(arg1) {};
jQuery.prototype.after = function(arg1, content) {};
/**
* @param {(string|Object.<string,*>)} arg1
* @param {Object.<string,*>=} settings
* @param {(string|jQueryAjaxSettings|Object.<string,*>)} arg1
* @param {(jQueryAjaxSettings|Object.<string, *>)=} settings
* @return {jQuery.jqXHR}
*/
jQuery.ajax = function(arg1, settings) {};
/**
* @param {(string|Object.<string,*>)} arg1
* @param {Object.<string,*>=} settings
* @param {(string|jQueryAjaxSettings|Object.<string, *>)} arg1
* @param {(jQueryAjaxSettings|Object.<string, *>)=} settings
* @return {jQuery.jqXHR}
*/
$.ajax = function(arg1, settings) {};
/**
* @param {function(!jQuery.event,XMLHttpRequest,Object.<string, *>)} handler
* @param {function(!jQuery.event,XMLHttpRequest,(jQueryAjaxSettings|Object.<string, *>))} handler
* @return {!jQuery}
*/
jQuery.prototype.ajaxComplete = function(handler) {};
/**
* @param {function(!jQuery.event,jQuery.jqXHR,Object.<string, *>,*)} handler
* @param {function(!jQuery.event,jQuery.jqXHR,(jQueryAjaxSettings|Object.<string, *>),*)} handler
* @return {!jQuery}
*/
jQuery.prototype.ajaxError = function(handler) {};
/**
* @param {(string|
* function(Object.<string,*>,Object.<string, *>,jQuery.jqXHR))} dataTypes
* @param {function(Object.<string,*>,Object.<string, *>,jQuery.jqXHR)=} handler
* @param {(string|function((jQueryAjaxSettings|Object.<string, *>),(jQueryAjaxSettings|Object.<string, *>),jQuery.jqXHR))} dataTypes
* @param {function((jQueryAjaxSettings|Object.<string, *>),(jQueryAjaxSettings|Object.<string, *>),jQuery.jqXHR)=} handler
*/
jQuery.ajaxPrefilter = function(dataTypes, handler) {};
/**
* @param {(string|
* function(Object.<string,*>,Object.<string, *>,jQuery.jqXHR))} dataTypes
* @param {function(Object.<string,*>,Object.<string, *>,jQuery.jqXHR)=} handler
* @param {(string|function((jQueryAjaxSettings|Object.<string, *>),(jQueryAjaxSettings|Object.<string, *>),jQuery.jqXHR))} dataTypes
* @param {function((jQueryAjaxSettings|Object.<string, *>),(jQueryAjaxSettings|Object.<string, *>),jQuery.jqXHR)=} handler
*/
$.ajaxPrefilter = function(dataTypes, handler) {};
/**
* @param {function(!jQuery.event,jQuery.jqXHR,Object.<string, *>)} handler
* @param {function(!jQuery.event,jQuery.jqXHR,(jQueryAjaxSettings|Object.<string, *>))} handler
* @return {!jQuery}
*/
jQuery.prototype.ajaxSend = function(handler) {};
/** @const */
jQuery.ajaxSettings = {};
/** @const {jQueryAjaxSettings|Object.<string, *>} */
jQuery.ajaxSettings;
/** @const */
/** @const {jQueryAjaxSettings|Object.<string, *>} */
$.ajaxSettings = {};
/** @type {Object.<string, string>} */
jQuery.ajaxSettings.accepts = {};
/** @type {Object.<string, string>} */
$.ajaxSettings.accepts = {};
/** @type {boolean} */
jQuery.ajaxSettings.async;
/** @type {boolean} */
$.ajaxSettings.async;
/** @type {Object.<string, RegExp>} */
jQuery.ajaxSettings.contents = {};
/** @type {Object.<string, RegExp>} */
$.ajaxSettings.contents = {};
/** @type {string} */
jQuery.ajaxSettings.contentType;
/** @type {string} */
$.ajaxSettings.contentType;
/** @type {Object.<string, *>} */
jQuery.ajaxSettings.converters = {};
/** @type {Object.<string, *>} */
$.ajaxSettings.converters = {};
/** @type {Object.<string, boolean>} */
jQuery.ajaxSettings.flatOptions = {};
/** @type {Object.<string, boolean>} */
$.ajaxSettings.flatOptions = {};
/** @type {boolean} */
jQuery.ajaxSettings.global;
/** @type {boolean} */
$.ajaxSettings.global;
/** @type {boolean} */
jQuery.ajaxSettings.isLocal;
/** @type {boolean} */
$.ajaxSettings.isLocal;
/** @type {boolean} */
jQuery.ajaxSettings.processData;
@@ -197,34 +191,10 @@ jQuery.ajaxSettings.responseFields = {};
/** @type {Object.<string, string>} */
$.ajaxSettings.responseFields = {};
/** @type {boolean} */
jQuery.ajaxSettings.traditional;
/** @type {boolean} */
$.ajaxSettings.traditional;
/** @type {string} */
jQuery.ajaxSettings.type;
/** @type {string} */
$.ajaxSettings.type;
/** @type {string} */
jQuery.ajaxSettings.url;
/** @type {string} */
$.ajaxSettings.url;
/** @return {XMLHttpRequest|ActiveXObject} */
jQuery.ajaxSettings.xhr = function() {};
/** @return {XMLHttpRequest|ActiveXObject} */
$.ajaxSettings.xhr = function() {};
/** @param {Object.<string,*>} options */
/** @param {jQueryAjaxSettings|Object.<string, *>} options */
jQuery.ajaxSetup = function(options) {};
/** @param {Object.<string,*>} options */
/** @param {jQueryAjaxSettings|Object.<string, *>} options */
$.ajaxSetup = function(options) {};
/**
@@ -240,7 +210,7 @@ jQuery.prototype.ajaxStart = function(handler) {};
jQuery.prototype.ajaxStop = function(handler) {};
/**
* @param {function(!jQuery.event,XMLHttpRequest,Object.<string, *>)} handler
* @param {function(!jQuery.event,XMLHttpRequest,(jQueryAjaxSettings|Object.<string, *>), ?)} handler
* @return {!jQuery}
*/
jQuery.prototype.ajaxSuccess = function(handler) {};
@@ -834,8 +804,9 @@ jQuery.prototype.fadeTo = function(duration, opacity, arg3, callback) {};
jQuery.prototype.fadeToggle = function(duration, easing, callback) {};
/**
* @param {(jQuerySelector|function(number)|Element|jQuery)} arg1
* @param {(jQuerySelector|function(number,Element)|Element|jQuery)} arg1
* @return {!jQuery}
* @see http://api.jquery.com/filter/
*/
jQuery.prototype.filter = function(arg1) {};

View File

@@ -55,10 +55,18 @@ oli.DrawEvent.prototype.feature;
oli.ObjectEvent = function() {};
/** @type {string} */
/**
* @type {string}
*/
oli.ObjectEvent.prototype.key;
/**
* @type {*}
*/
oli.ObjectEvent.prototype.oldValue;
/**
* @interface
@@ -122,13 +130,13 @@ oli.control.Control = function() {};
oli.control.Control.prototype.setMap = function(map) {};
/**
* @type {Object}
*/
oli.interaction;
/**
* @interface
*/

View File

@@ -172,6 +172,25 @@ olx.GraticuleOptions.prototype.strokeStyle;
olx.GraticuleOptions.prototype.targetSize;
/**
* Object literal with config options for interactions.
* @typedef {{handleEvent: function(ol.MapBrowserEvent):boolean}}
* @api
*/
olx.interaction.InteractionOptions;
/**
* Method called by the map to notify the interaction that a browser event was
* dispatched to the map. The function may return `false` to prevent the
* propagation of the event to other interactions in the map's interactions
* chain. Required.
* @type {function(ol.MapBrowserEvent):boolean}
* @api
*/
olx.interaction.InteractionOptions.prototype.handleEvent;
/**
* Object literal with config options for the map.
* @typedef {{controls: (ol.Collection.<ol.control.Control>|Array.<ol.control.Control>|undefined),
@@ -474,7 +493,9 @@ olx.ViewOptions.prototype.constrainRotation;
/**
* Enable rotation. Default is `true`.
* Enable rotation. Default is `true`. If `false` a rotation constraint that
* always sets the rotation to zero is used. The `constrainRotation` option
* has no effect if `enableRotation` is `false`.
* @type {boolean|undefined}
* @api
*/
@@ -795,6 +816,12 @@ olx.control;
/**
* @typedef {{className: (string|undefined),
* collapsible: (boolean|undefined),
* collapsed: (boolean|undefined),
* tipLabel: (string|undefined),
* label: (string|undefined),
* collapseLabel: (string|undefined),
* render: (function(ol.MapEvent)|undefined),
* target: (Element|undefined)}}
* @api
*/
@@ -858,8 +885,19 @@ olx.control.AttributionOptions.prototype.label;
*/
olx.control.AttributionOptions.prototype.collapseLabel;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.render;
/**
* @typedef {{element: (Element|undefined),
* render: (function(ol.MapEvent)|undefined),
* target: (Element|string|undefined)}}
* @api stable
*/
@@ -875,6 +913,15 @@ olx.control.ControlOptions;
olx.control.ControlOptions.prototype.element;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.ControlOptions.prototype.render;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
@@ -990,6 +1037,7 @@ olx.control.FullScreenOptions.prototype.target;
* @typedef {{className: (string|undefined),
* coordinateFormat: (ol.CoordinateFormatType|undefined),
* projection: ol.proj.ProjectionLike,
* render: (function(ol.MapEvent)|undefined),
* target: (Element|undefined),
* undefinedHTML: (string|undefined)}}
* @api stable
@@ -1021,6 +1069,15 @@ olx.control.MousePositionOptions.prototype.coordinateFormat;
olx.control.MousePositionOptions.prototype.projection;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.MousePositionOptions.prototype.render;
/**
* Target.
* @type {Element|undefined}
@@ -1043,6 +1100,7 @@ olx.control.MousePositionOptions.prototype.undefinedHTML;
* collapsible: (boolean|undefined),
* label: (string|undefined),
* layers: (Array.<ol.layer.Layer>|ol.Collection|undefined),
* render: (function(ol.MapEvent)|undefined),
* target: (Element|undefined),
* tipLabel: (string|undefined)}}
* @api
@@ -1092,6 +1150,15 @@ olx.control.OverviewMapOptions.prototype.label;
olx.control.OverviewMapOptions.prototype.layers;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.render;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
@@ -1112,6 +1179,7 @@ olx.control.OverviewMapOptions.prototype.tipLabel;
/**
* @typedef {{className: (string|undefined),
* minWidth: (number|undefined),
* render: (function(ol.MapEvent)|undefined),
* target: (Element|undefined),
* units: (ol.control.ScaleLineUnits|string|undefined)}}
* @api stable
@@ -1135,6 +1203,15 @@ olx.control.ScaleLineOptions.prototype.className;
olx.control.ScaleLineOptions.prototype.minWidth;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.ScaleLineOptions.prototype.render;
/**
* Target.
* @type {Element|undefined}
@@ -1157,6 +1234,7 @@ olx.control.ScaleLineOptions.prototype.units;
* label: (string|undefined),
* tipLabel: (string|undefined),
* target: (Element|undefined),
* render: (function(ol.MapEvent)|undefined),
* autoHide: (boolean|undefined)}}
* @api stable
*/
@@ -1203,6 +1281,15 @@ olx.control.RotateOptions.prototype.duration;
olx.control.RotateOptions.prototype.autoHide;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.RotateOptions.prototype.render;
/**
* Target.
* @type {Element|undefined}
@@ -1292,8 +1379,9 @@ olx.control.ZoomOptions.prototype.target;
/**
* @typedef {{className: (string|undefined),
* maxResolution: (number|undefined),
* minResolution: (number|undefined)}}
* @api stable
* minResolution: (number|undefined),
* render: (function(ol.MapEvent)|undefined)}}
* @api
*/
olx.control.ZoomSliderOptions;
@@ -1322,6 +1410,15 @@ olx.control.ZoomSliderOptions.prototype.maxResolution;
olx.control.ZoomSliderOptions.prototype.minResolution;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.ZoomSliderOptions.prototype.render;
/**
* @typedef {{className: (string|undefined),
* target: (Element|undefined),
@@ -1373,8 +1470,8 @@ olx.format;
/**
* @typedef {{dataProjection: (ol.proj.ProjectionLike|undefined),
* featureProjection: (ol.proj.ProjectionLike|undefined)}}
* @typedef {{dataProjection: ol.proj.ProjectionLike,
* featureProjection: ol.proj.ProjectionLike}}
* @api
*/
olx.format.ReadOptions;
@@ -1386,7 +1483,7 @@ olx.format.ReadOptions;
* the format is assigned (where set). If the projection can not be derived from
* the data and if no `defaultDataProjection` is set for a format, the features
* will not be reprojected.
* @type {ol.proj.ProjectionLike|undefined}
* @type {ol.proj.ProjectionLike}
* @api stable
*/
olx.format.ReadOptions.prototype.dataProjection;
@@ -1395,14 +1492,14 @@ olx.format.ReadOptions.prototype.dataProjection;
/**
* Projection of the feature geometries created by the format reader. If not
* provided, features will be returned in the `dataProjection`.
* @type {ol.proj.ProjectionLike|undefined}
* @type {ol.proj.ProjectionLike}
* @api stable
*/
olx.format.ReadOptions.prototype.featureProjection;
/**
* @typedef {{dataProjection: (ol.proj.ProjectionLike|undefined),
* @typedef {{dataProjection: ol.proj.ProjectionLike,
* featureProjection: ol.proj.ProjectionLike}}
* @api
*/
@@ -1414,7 +1511,7 @@ olx.format.WriteOptions;
* `defaultDataProjection` of the format is assigned (where set). If no
* `defaultDataProjection` is set for a format, the features will be returned
* in the `featureProjection`.
* @type {ol.proj.ProjectionLike|undefined}
* @type {ol.proj.ProjectionLike}
* @api stable
*/
olx.format.WriteOptions.prototype.dataProjection;
@@ -1630,6 +1727,7 @@ olx.format.GPXOptions.prototype.readExtensions;
/**
* @typedef {{featureNS: string,
* featureType: string,
* gmlFormat: (ol.format.GMLBase|undefined),
* schemaLocation: (string|undefined)}}
* @api
*/
@@ -1652,6 +1750,14 @@ olx.format.WFSOptions.prototype.featureNS;
olx.format.WFSOptions.prototype.featureType;
/**
* The GML format to use to parse the response. Default is `ol.format.GML3`.
* @type {ol.format.GMLBase|undefined}
* @api
*/
olx.format.WFSOptions.prototype.gmlFormat;
/**
* Optional schemaLocation to use for serialization, this will override the
* default.
@@ -2323,6 +2429,65 @@ olx.interaction.PinchZoomOptions;
olx.interaction.PinchZoomOptions.prototype.duration;
/**
* @typedef {{handleDownEvent: (function(ol.MapBrowserPointerEvent):boolean|undefined),
* handleDragEvent: (function(ol.MapBrowserPointerEvent)|undefined),
* handleEvent: (function(ol.MapBrowserEvent):boolean|undefined),
* handleMoveEvent: (function(ol.MapBrowserPointerEvent)|undefined),
* handleUpEvent: (function(ol.MapBrowserPointerEvent):boolean|undefined)}}
* @api
*/
olx.interaction.PointerOptions;
/**
* Function handling "down" events. If the function returns `true` then a drag
* sequence is started.
* @type {(function(ol.MapBrowserPointerEvent):boolean|undefined)}
* @api
*/
olx.interaction.PointerOptions.prototype.handleDownEvent;
/**
* Function handling "drag" events. This function is called on "move" events
* during a drag sequence.
* @type {(function(ol.MapBrowserPointerEvent):boolean|undefined)}
* @api
*/
olx.interaction.PointerOptions.prototype.handleDragEvent;
/**
* Method called by the map to notify the interaction that a browser event was
* dispatched to the map. The function may return `false` to prevent the
* propagation of the event to other interactions in the map's interactions
* chain.
* @type {(function(ol.MapBrowserEvent):boolean|undefined)}
* @api
*/
olx.interaction.PointerOptions.prototype.handleEvent;
/**
* Function handling "move" events. This function is called on "move" events,
* also during a drag sequence (so during a drag sequence both the
* `handleDragEvent` function and this function are called).
* @type {(function(ol.MapBrowserPointerEvent):boolean|undefined)}
* @api
*/
olx.interaction.PointerOptions.prototype.handleMoveEvent;
/**
* Function handling "up" events. If the function returns `false` then the
* current drag sequence is stopped.
* @type {(function(ol.MapBrowserPointerEvent):boolean|undefined)}
* @api
*/
olx.interaction.PointerOptions.prototype.handleUpEvent;
/**
* @typedef {{addCondition: (ol.events.ConditionType|undefined),
* condition: (ol.events.ConditionType|undefined),
@@ -2508,7 +2673,7 @@ olx.layer.BaseOptions.prototype.maxResolution;
* hue: (number|undefined),
* opacity: (number|undefined),
* saturation: (number|undefined),
* source: ol.source.Source,
* source: (ol.source.Source|undefined),
* visible: (boolean|undefined),
* extent: (ol.Extent|undefined),
* minResolution: (number|undefined),
@@ -2559,8 +2724,10 @@ olx.layer.LayerOptions.prototype.saturation;
/**
* Source for this layer.
* @type {ol.source.Source}
* Source for this layer. If not provided to the constructor, the source can
* be set by calling {@link ol.layer.Layer#setSource layer.setSource(source)}
* after construction.
* @type {ol.source.Source|undefined}
* @api stable
*/
olx.layer.LayerOptions.prototype.source;
@@ -2710,7 +2877,7 @@ olx.layer.GroupOptions.prototype.layers;
* maxResolution: (number|undefined),
* opacity: (number|undefined),
* saturation: (number|undefined),
* source: ol.source.Vector,
* source: (ol.source.Vector|undefined),
* visible: (boolean|undefined)}}
* @api
*/
@@ -2847,7 +3014,7 @@ olx.layer.HeatmapOptions.prototype.visible;
* hue: (number|undefined),
* opacity: (number|undefined),
* saturation: (number|undefined),
* source: ol.source.Image,
* source: (ol.source.Image|undefined),
* visible: (boolean|undefined),
* extent: (ol.Extent|undefined),
* minResolution: (number|undefined),
@@ -2945,7 +3112,7 @@ olx.layer.ImageOptions.prototype.maxResolution;
* opacity: (number|undefined),
* preload: (number|undefined),
* saturation: (number|undefined),
* source: ol.source.Tile,
* source: (ol.source.Tile|undefined),
* visible: (boolean|undefined),
* extent: (ol.Extent|undefined),
* minResolution: (number|undefined),
@@ -3062,8 +3229,9 @@ olx.layer.TileOptions.prototype.useInterimTilesOnError;
* minResolution: (number|undefined),
* maxResolution: (number|undefined),
* opacity: (number|undefined),
* renderBuffer: (number|undefined),
* saturation: (number|undefined),
* source: ol.source.Vector,
* source: (ol.source.Vector|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined),
* visible: (boolean|undefined)}}
* @api
@@ -3138,6 +3306,16 @@ olx.layer.VectorOptions.prototype.maxResolution;
olx.layer.VectorOptions.prototype.opacity;
/**
* The buffer around the viewport extent used by the renderer when getting
* features from the vector source. Recommended value: the size of the
* largest symbol or line width. Default is 100 pixels.
* @type {number|undefined}
* @api
*/
olx.layer.VectorOptions.prototype.renderBuffer;
/**
* Saturation.
* @type {number|undefined}
@@ -3531,6 +3709,34 @@ olx.source.GPXOptions.prototype.url;
olx.source.GPXOptions.prototype.urls;
/**
* @typedef {{preemptive: (boolean|undefined),
* url: string}}
* @api
*/
olx.source.TileUTFGridOptions;
/**
* If `true` the TileUTFGrid source loads the tiles based on their "visibility".
* This improves the speed of response, but increases traffic.
* Note that if set to `false`, you need to pass `true` as `opt_request`
* to the `forDataAtCoordinateAndResolution` method otherwise no data
* will ever be loaded.
* Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.source.TileUTFGridOptions.prototype.preemptive;
/**
* @type {string}
* @api
*/
olx.source.TileUTFGridOptions.prototype.url;
/**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* crossOrigin: (null|string|undefined),
@@ -3559,7 +3765,11 @@ olx.source.TileImageOptions.prototype.attributions;
/**
* crossOrigin setting for image requests. Default is `null`.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api
*/
@@ -3599,7 +3809,7 @@ olx.source.TileImageOptions.prototype.state;
/**
* tile class
* Class used to instantiate image tiles. Default is {@link ol.ImageTile}.
* @type {function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)|undefined}
@@ -3855,6 +4065,7 @@ olx.source.IGCOptions.prototype.urls;
* projection: ol.proj.ProjectionLike,
* ratio: (number|undefined),
* resolutions: (Array.<number>|undefined),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
* params: (Object|undefined)}}
* @api
*/
@@ -3927,6 +4138,15 @@ olx.source.ImageMapGuideOptions.prototype.ratio;
olx.source.ImageMapGuideOptions.prototype.resolutions;
/**
* Optional function to load an image given a URL.
* @type {ol.TileLoadFunctionType|undefined}
* @api
*/
olx.source.ImageMapGuideOptions.prototype.imageLoadFunction;
/**
* Additional parameters.
* @type {Object|undefined}
@@ -4100,7 +4320,13 @@ olx.source.OSMOptions.prototype.attributions;
/**
* crossOrigin setting for image requests. Default is `anonymous`.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
*
* Default is `anonymous`.
* @type {null|string|undefined}
* @api stable
*/
@@ -4366,6 +4592,7 @@ olx.source.ImageVectorOptions.prototype.style;
* hidpi: (boolean|undefined),
* serverType: (ol.source.wms.ServerType|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
* params: Object.<string,*>,
* projection: ol.proj.ProjectionLike,
* ratio: (number|undefined),
@@ -4385,7 +4612,11 @@ olx.source.ImageWMSOptions.prototype.attributions;
/**
* crossOrigin setting for image requests.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api stable
*/
@@ -4410,6 +4641,14 @@ olx.source.ImageWMSOptions.prototype.hidpi;
olx.source.ImageWMSOptions.prototype.serverType;
/**
* Optional function to load an image given a URL.
* @type {ol.TileLoadFunctionType|undefined}
* @api
*/
olx.source.ImageWMSOptions.prototype.imageLoadFunction;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
@@ -4526,6 +4765,7 @@ olx.source.StamenOptions.prototype.url;
* crossOrigin: (null|string|undefined),
* imageExtent: (ol.Extent),
* imageSize: (ol.Size|undefined),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
* logo: (string|olx.LogoOptions|undefined),
* projection: ol.proj.ProjectionLike,
* url: string}}
@@ -4543,7 +4783,11 @@ olx.source.ImageStaticOptions.prototype.attributions;
/**
* crossOrigin setting for image requests.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api stable
*/
@@ -4551,7 +4795,8 @@ olx.source.ImageStaticOptions.prototype.crossOrigin;
/**
* Extent of the image.
* Extent of the image in map coordinates. This is the [left, bottom, right,
* top] map coordinates of your image.
* @type {ol.Extent}
* @api stable
*/
@@ -4559,7 +4804,7 @@ olx.source.ImageStaticOptions.prototype.imageExtent;
/**
* Size of the image.
* Size of the image in pixels.
* @type {ol.Size|undefined}
* @api stable
*/
@@ -4567,7 +4812,15 @@ olx.source.ImageStaticOptions.prototype.imageSize;
/**
* Logo.
* Optional function to load an image given a URL.
* @type {ol.TileLoadFunctionType|undefined}
* @api
*/
olx.source.ImageStaticOptions.prototype.imageLoadFunction;
/**
* Optional logo.
* @type {string|olx.LogoOptions|undefined}
* @api stable
*/
@@ -4583,7 +4836,7 @@ olx.source.ImageStaticOptions.prototype.projection;
/**
* Url.
* Image URL.
* @type {string}
* @api stable
*/
@@ -4654,14 +4907,19 @@ olx.source.ServerVectorOptions.prototype.projection;
/**
* @typedef {{crossOrigin: (null|string|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: string}}
* url: string,
* wrapX: (boolean|undefined)}}
* @api
*/
olx.source.TileJSONOptions;
/**
* crossOrigin setting for image requests.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api stable
*/
@@ -4684,6 +4942,14 @@ olx.source.TileJSONOptions.prototype.tileLoadFunction;
olx.source.TileJSONOptions.prototype.url;
/**
* Whether to wrap the world horizontally. Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.source.TileJSONOptions.prototype.wrapX;
/**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* params: Object.<string,*>,
@@ -4722,7 +4988,11 @@ olx.source.TileWMSOptions.prototype.params;
/**
* crossOrigin setting for image requests.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api stable
*/
@@ -4985,7 +5255,7 @@ olx.source.StaticVectorOptions.prototype.urls;
* logo: (string|olx.LogoOptions|undefined),
* tileGrid: ol.tilegrid.WMTS,
* projection: ol.proj.ProjectionLike,
* requestEncoding: (ol.source.WMTSRequestEncoding|undefined),
* requestEncoding: (ol.source.WMTSRequestEncoding|string|undefined),
* layer: string,
* style: string,
* tilePixelRatio: (number|undefined),
@@ -4996,7 +5266,10 @@ olx.source.StaticVectorOptions.prototype.urls;
* url: (string|undefined),
* maxZoom: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* urls: (Array.<string>|undefined)}}
* urls: (Array.<string>|undefined),
* tileClass: (function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)|undefined)}}
* @api
*/
olx.source.WMTSOptions;
@@ -5011,7 +5284,11 @@ olx.source.WMTSOptions.prototype.attributions;
/**
* crossOrigin setting for image requests.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {string|null|undefined}
* @api
*/
@@ -5043,8 +5320,8 @@ olx.source.WMTSOptions.prototype.projection;
/**
* Request encoding.
* @type {ol.source.WMTSRequestEncoding|undefined}
* Request encoding. Default is `KVP`.
* @type {ol.source.WMTSRequestEncoding|string|undefined}
* @api
*/
olx.source.WMTSOptions.prototype.requestEncoding;
@@ -5066,6 +5343,16 @@ olx.source.WMTSOptions.prototype.layer;
olx.source.WMTSOptions.prototype.style;
/**
* Class used to instantiate image tiles. Default is {@link ol.ImageTile}.
* @type {function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)|undefined}
* @api
*/
olx.source.WMTSOptions.prototype.tileClass;
/**
* The pixel ratio used by the tile service. For example, if the tile
* service advertizes 256px by 256px tiles but actually sends 512px
@@ -5169,7 +5456,11 @@ olx.source.XYZOptions.prototype.attributions;
/**
* Cross origin setting for image requests.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api stable
*/
@@ -5289,7 +5580,11 @@ olx.source.ZoomifyOptions.prototype.attributions;
/**
* Cross origin setting for image requests.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api stable
*/
@@ -5339,7 +5634,8 @@ olx.style;
* @typedef {{fill: (ol.style.Fill|undefined),
* radius: number,
* snapToPixel: (boolean|undefined),
* stroke: (ol.style.Stroke|undefined)}}
* stroke: (ol.style.Stroke|undefined),
* atlasManager: (ol.style.AtlasManager|undefined)}}
* @api
*/
olx.style.CircleOptions;
@@ -5383,6 +5679,16 @@ olx.style.CircleOptions.prototype.snapToPixel;
olx.style.CircleOptions.prototype.stroke;
/**
* The atlas manager to use for this circle. When using WebGL it is
* recommended to use an atlas manager to avoid texture switching.
* If an atlas manager is given, the circle is added to an atlas.
* By default no atlas manager is used.
* @type {ol.style.AtlasManager|undefined}
*/
olx.style.CircleOptions.prototype.atlasManager;
/**
* @typedef {{color: (ol.Color|string|undefined)}}
* @api
@@ -5457,7 +5763,11 @@ olx.style.IconOptions.prototype.anchorYUnits;
/**
* crossOrigin setting for image.
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api
*/
@@ -5466,7 +5776,8 @@ olx.style.IconOptions.prototype.crossOrigin;
/**
* Image object for the icon. If the `src` option is not provided then the
* provided image must already be loaded.
* provided image must already be loaded. And in that case, it is required
* to provide the size of the image, with the `size` option.
* @type {Image|undefined}
* @api
*/
@@ -5531,7 +5842,9 @@ olx.style.IconOptions.prototype.rotation;
/**
* Icon size in pixel.
* Icon size in pixel. Can be used together with `offset` to define the
* sub-rectangle to use from the origin (sprite) icon image. Also, setting
* the `size` is required if `img` is set and `src` is not.
* @type {ol.Size|undefined}
* @api
*/
@@ -5546,6 +5859,114 @@ olx.style.IconOptions.prototype.size;
olx.style.IconOptions.prototype.src;
/**
* Specify radius for regular polygons, or radius1 and radius2 for stars.
* @typedef {{fill: (ol.style.Fill|undefined),
* points: number,
* radius: (number|undefined),
* radius1: (number|undefined),
* radius2: (number|undefined),
* angle: (number|undefined),
* snapToPixel: (boolean|undefined),
* stroke: (ol.style.Stroke|undefined),
* rotation: (number|undefined),
* atlasManager: (ol.style.AtlasManager|undefined)}}
* @api
*/
olx.style.RegularShapeOptions;
/**
* Fill style.
* @type {ol.style.Fill|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.fill;
/**
* Number of points for stars and regular polygons. In case of a polygon, the
* number of points is the number of sides.
* @type {number}
* @api
*/
olx.style.RegularShapeOptions.prototype.points;
/**
* Radius of a regular polygon.
* @type {number|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.radius;
/**
* Inner radius of a star.
* @type {number|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.radius1;
/**
* Outer radius of a star.
* @type {number|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.radius2;
/**
* Shape's angle in radians. A value of 0 will have one of the shape's point
* facing up.
* Default value is 0.
* @type {number|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.angle;
/**
* If `true` integral numbers of pixels are used as the X and Y pixel
* coordinate when drawing the shape in the output canvas. If `false`
* fractional numbers may be used. Using `true` allows for "sharp"
* rendering (no blur), while using `false` allows for "accurate"
* rendering. Note that accuracy is important if the shape's
* position is animated. Without it, the shape may jitter noticeably.
* Default value is `true`.
* @type {boolean|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.snapToPixel;
/**
* Stroke style.
* @type {ol.style.Stroke|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.stroke;
/**
* Rotation in radians (positive rotation clockwise). Default is `0`.
* @type {number|undefined}
* @api
*/
olx.style.RegularShapeOptions.prototype.rotation;
/**
* The atlas manager to use for this symbol. When using WebGL it is
* recommended to use an atlas manager to avoid texture switching.
* If an atlas manager is given, the symbol is added to an atlas.
* By default no atlas manager is used.
* @type {ol.style.AtlasManager|undefined}
*/
olx.style.RegularShapeOptions.prototype.atlasManager;
/**
* @typedef {{color: (ol.Color|string|undefined),
* lineCap: (string|undefined),
@@ -5706,7 +6127,8 @@ olx.style.TextOptions.prototype.stroke;
/**
* @typedef {{fill: (ol.style.Fill|undefined),
* @typedef {{geometry: (undefined|string|ol.geom.Geometry|ol.style.GeometryFunction),
* fill: (ol.style.Fill|undefined),
* image: (ol.style.Image|undefined),
* stroke: (ol.style.Stroke|undefined),
* text: (ol.style.Text|undefined),
@@ -5716,6 +6138,15 @@ olx.style.TextOptions.prototype.stroke;
olx.style.StyleOptions;
/**
* Feature property or geometry or function returning a geometry to render for
* this style.
* @type {undefined|string|ol.geom.Geometry|ol.style.GeometryFunction}
* @api
*/
olx.style.StyleOptions.prototype.geometry;
/**
* Fill style.
* @type {ol.style.Fill|undefined}
@@ -5935,7 +6366,6 @@ olx.tilegrid.XYZOptions.prototype.tileSize;
/**
* @typedef {{resolutions: !Array.<number>}}
* @api
* @api
*/
olx.tilegrid.ZoomifyOptions;
@@ -5959,6 +6389,7 @@ olx.view;
* @typedef {{padding: !Array.<number>,
* constrainResolution: (boolean|undefined),
* nearest: (boolean|undefined),
* maxZoom: (number|undefined),
* minResolution: (number|undefined)}}
* @api
*/
@@ -6086,3 +6517,41 @@ olx.ViewState.prototype.resolution;
* @api
*/
olx.ViewState.prototype.rotation;
/**
* @typedef {{initialSize: (number|undefined),
* maxSize: (number|undefined),
* space: (number|undefined)}}
* @api
*/
olx.style.AtlasManagerOptions;
/**
* The size in pixels of the first atlas image. If no value is given the
* `ol.INITIAL_ATLAS_SIZE` compile-time constant will be used.
* @type {number|undefined}
* @api
*/
olx.style.AtlasManagerOptions.prototype.initialSize;
/**
* The maximum size in pixels of atlas images. If no value is given then
* the `ol.MAX_ATLAS_SIZE` compile-time constant will be used. And if
* `ol.MAX_ATLAS_SIZE` is set to `-1` (the default) then
* `ol.WEBGL_MAX_TEXTURE_SIZE` will used if WebGL is supported. Otherwise
* 2048 is used.
* @type {number|undefined}
* @api
*/
olx.style.AtlasManagerOptions.prototype.maxSize;
/**
* The space in pixels between images (default: 1).
* @type {number|undefined}
* @api
*/
olx.style.AtlasManagerOptions.prototype.space;

View File

@@ -1,6 +1,7 @@
/**
* @externs
* @see https://github.com/mapbox/tilejson-spec
* @see https://github.com/mapbox/utfgrid-spec
*/
@@ -93,3 +94,28 @@ TileJSON.prototype.bounds;
* @type {!Array.<number>|undefined}
*/
TileJSON.prototype.center;
/**
* @constructor
*/
var UTFGridJSON = function() {};
/**
* @type {!Array.<string>}
*/
UTFGridJSON.prototype.grid;
/**
* @type {!Array.<string>}
*/
UTFGridJSON.prototype.keys;
/**
* @type {!Object.<string, Object>|undefined}
*/
UTFGridJSON.prototype.data;

View File

@@ -1,6 +1,6 @@
{
"name": "openlayers",
"version": "3.1.0-pre.2",
"version": "3.1.0",
"description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [
"map",
@@ -9,11 +9,12 @@
],
"homepage": "http://openlayers.org/",
"scripts": {
"install": "node tasks/parse-examples.js",
"install": "node tasks/install.js",
"postinstall": "closure-util update",
"start": "node tasks/serve.js",
"test": "node tasks/test.js"
},
"main": "dist/ol.js",
"repository": {
"type": "git",
"url": "git://github.com/openlayers/ol3.git"
@@ -24,12 +25,13 @@
},
"dependencies": {
"async": "0.9.0",
"closure-util": "1.1.0",
"closure-util": "1.2.0",
"fs-extra": "0.12.0",
"graceful-fs": "3.0.2",
"htmlparser2": "3.7.3",
"jsdoc": "3.3.0-alpha9",
"nomnom": "1.8.0",
"rbush": "1.3.4",
"temp": "0.8.1",
"walk": "2.3.4"
},
@@ -43,5 +45,8 @@
"phantomjs": "1.9.10",
"proj4": "2.3.3",
"sinon": "1.10.3"
}
},
"ext": [
"rbush"
]
}

View File

@@ -11,6 +11,10 @@ body {
.ol-attribution {
max-width: calc(100% - 3em);
}
.ol-control button, .ol-attribution, .ol-scale-line-inner {
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
}
#tags {
display: none;
}

View File

@@ -37,25 +37,6 @@ ol.array.binaryFindNearest = function(arr, target) {
};
/**
* Safe version of goog.array.extend that does not risk to overflow the stack
* even if `array2` contains a large number of elements.
*
* @param {Array.<T>} array1 Array 1.
* @param {Array.<T>} array2 Array 2.
* @template T
*/
ol.array.safeExtend = function(array1, array2) {
// goog.array.extend uses Array.prototype.push.apply, which can overflow the
// stack if array2 contains too many elements. Repeatedly calling push
// performs as well on modern browsers.
var i, ii;
for (i = 0, ii = array2.length; i < ii; ++i) {
array1.push(array2[i]);
}
};
/**
* @param {Array.<number>} arr Array.
* @param {number} target Target.

View File

@@ -16,7 +16,7 @@ goog.require('ol.TileRange');
* html: 'All maps &copy; ' +
* '<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'
* }),
* ol.source.OSM.DATA_ATTRIBUTION
* ol.source.OSM.ATTRIBUTION
* ],
* ..
*

View File

@@ -94,6 +94,8 @@ ol.color.blend = function(dst, src, opt_color) {
/**
* Return the color as an array. This function maintains a cache of calculated
* arrays which means the result should not be modified.
* @param {ol.Color|string} color Color.
* @return {ol.Color} Color.
* @api
@@ -109,6 +111,7 @@ ol.color.asArray = function(color) {
/**
* Return the color as an rgba string.
* @param {ol.Color|string} color Color.
* @return {string} Rgba string.
* @api
@@ -137,12 +140,11 @@ ol.color.equals = function(color1, color2) {
/**
* @param {string} s String.
* @param {ol.Color=} opt_color Color.
* @return {ol.Color} Color.
*/
ol.color.fromString = (
/**
* @return {function(string, ol.Color=): ol.Color}
* @return {function(string): ol.Color}
*/
function() {
@@ -169,10 +171,9 @@ ol.color.fromString = (
return (
/**
* @param {string} s String.
* @param {ol.Color=} opt_color Color.
* @return {ol.Color} Color.
*/
function(s, opt_color) {
function(s) {
var color;
if (cache.hasOwnProperty(s)) {
color = cache[s];
@@ -191,7 +192,7 @@ ol.color.fromString = (
cache[s] = color;
++cacheSize;
}
return ol.color.returnOrUpdate(color, opt_color);
return color;
});
})();
@@ -275,24 +276,6 @@ ol.color.normalize = function(color, opt_color) {
};
/**
* @param {ol.Color} color Color.
* @param {ol.Color=} opt_color Color.
* @return {ol.Color} Color.
*/
ol.color.returnOrUpdate = function(color, opt_color) {
if (goog.isDef(opt_color)) {
opt_color[0] = color[0];
opt_color[1] = color[1];
opt_color[2] = color[2];
opt_color[3] = color[3];
return opt_color;
} else {
return color;
}
};
/**
* @param {ol.Color} color Color.
* @return {string} String.

View File

@@ -12,7 +12,6 @@ goog.require('goog.style');
goog.require('ol.Attribution');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.pointer.PointerEventHandler');
@@ -69,9 +68,6 @@ ol.control.Attribution = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Attributions';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
/**
* @private
@@ -96,15 +92,10 @@ ol.control.Attribution = function(opt_options) {
*/
this.labelSpan_ = label;
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
}, this.labelSpan_);
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);
goog.events.listen(buttonHandler, ol.pointer.EventType.POINTERUP,
this.handlePointerUp_, false, this);
goog.events.listen(button, goog.events.EventType.CLICK,
this.handleClick_, false, this);
@@ -115,15 +106,19 @@ ol.control.Attribution = function(opt_options) {
this.blur();
}, false);
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
'class': className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL +
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
(this.collapsible_ ? '' : ' ol-uncollapsible')
}, this.ulElement_, button);
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL +
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
(this.collapsible_ ? '' : ' ol-uncollapsible');
var element = goog.dom.createDom(goog.dom.TagName.DIV,
cssClasses, this.ulElement_, button);
var render = goog.isDef(options.render) ?
options.render : ol.control.Attribution.render;
goog.base(this, {
element: element,
render: render,
target: options.target
});
@@ -169,6 +164,9 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
var hiddenAttributions = {};
for (i = 0, ii = layerStatesArray.length; i < ii; i++) {
source = layerStatesArray[i].layer.getSource();
if (goog.isNull(source)) {
continue;
}
sourceKey = goog.getUid(source).toString();
sourceAttributions = source.getAttributions();
if (goog.isNull(sourceAttributions)) {
@@ -198,9 +196,11 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
/**
* @inheritDoc
* @param {ol.MapEvent} mapEvent Map event.
* @this {ol.control.Attribution}
* @api
*/
ol.control.Attribution.prototype.handleMapPostrender = function(mapEvent) {
ol.control.Attribution.render = function(mapEvent) {
this.updateElement_(mapEvent.frameState);
};
@@ -331,19 +331,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
* @private
*/
ol.control.Attribution.prototype.handleClick_ = function(event) {
if (event.screenX !== 0 && event.screenY !== 0) {
return;
}
this.handleToggle_();
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent The event to handle
* @private
*/
ol.control.Attribution.prototype.handlePointerUp_ = function(pointerEvent) {
pointerEvent.browserEvent.preventDefault();
event.preventDefault();
this.handleToggle_();
};

View File

@@ -66,6 +66,11 @@ ol.control.Control = function(options) {
*/
this.listenerKeys = [];
/**
* @type {function(ol.MapEvent)}
*/
this.render = goog.isDef(options.render) ? options.render : goog.nullFunction;
};
goog.inherits(ol.control.Control, ol.Object);
@@ -89,15 +94,6 @@ ol.control.Control.prototype.getMap = function() {
};
/**
* Function called on each map render. Executes in a requestAnimationFrame
* callback. Can be implemented in sub-classes to re-render the control's
* UI.
* @param {ol.MapEvent} mapEvent Map event.
*/
ol.control.Control.prototype.handleMapPostrender = goog.nullFunction;
/**
* Remove the control from its current map and attach it to the new map.
* Subclasses may set up event handlers to get notified about changes to
@@ -118,9 +114,9 @@ ol.control.Control.prototype.setMap = function(map) {
var target = !goog.isNull(this.target_) ?
this.target_ : map.getOverlayContainerStopEvent();
goog.dom.appendChild(target, this.element);
if (this.handleMapPostrender !== goog.nullFunction) {
if (this.render !== goog.nullFunction) {
this.listenerKeys.push(goog.events.listen(map,
ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this));
ol.MapEventType.POSTRENDER, this.render, false, this));
}
map.render();
}

View File

@@ -10,7 +10,6 @@ goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.pointer.PointerEventHandler');
@@ -40,20 +39,12 @@ ol.control.FullScreen = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Toggle full-screen';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen() +
' ol-has-tooltip',
'type': 'button'
'class': this.cssClassName_ + '-' + goog.dom.fullscreen.isFullScreen(),
'type': 'button',
'title': tipLabel
});
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);
goog.events.listen(buttonHandler,
ol.pointer.EventType.POINTERUP, this.handlePointerUp_, false, this);
goog.events.listen(button, goog.events.EventType.CLICK,
this.handleClick_, false, this);
@@ -69,7 +60,7 @@ ol.control.FullScreen = function(opt_options) {
this.handleFullScreenChange_, false, this);
var cssClasses = this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE +
' ' + ol.css.CLASS_CONTROL +
' ' + ol.css.CLASS_CONTROL + ' ' +
(!goog.dom.fullscreen.isSupported() ? ol.css.CLASS_UNSUPPORTED : '');
var element = goog.dom.createDom(goog.dom.TagName.DIV, cssClasses, button);
@@ -93,19 +84,7 @@ goog.inherits(ol.control.FullScreen, ol.control.Control);
* @private
*/
ol.control.FullScreen.prototype.handleClick_ = function(event) {
if (event.screenX !== 0 && event.screenY !== 0) {
return;
}
this.handleFullScreen_();
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent The event to handle
* @private
*/
ol.control.FullScreen.prototype.handlePointerUp_ = function(pointerEvent) {
pointerEvent.browserEvent.preventDefault();
event.preventDefault();
this.handleFullScreen_();
};

View File

@@ -6,7 +6,6 @@ goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('goog.style');
goog.require('ol.CoordinateFormatType');
goog.require('ol.Object');
goog.require('ol.Pixel');
@@ -46,12 +45,14 @@ ol.control.MousePosition = function(opt_options) {
var className = goog.isDef(options.className) ?
options.className : 'ol-mouse-position';
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
'class': className
});
var element = goog.dom.createDom(goog.dom.TagName.DIV, className);
var render = goog.isDef(options.render) ?
options.render : ol.control.MousePosition.render;
goog.base(this, {
element: element,
render: render,
target: options.target
});
@@ -102,9 +103,11 @@ goog.inherits(ol.control.MousePosition, ol.control.Control);
/**
* @inheritDoc
* @param {ol.MapEvent} mapEvent Map event.
* @this {ol.control.MousePosition}
* @api
*/
ol.control.MousePosition.prototype.handleMapPostrender = function(mapEvent) {
ol.control.MousePosition.render = function(mapEvent) {
var frameState = mapEvent.frameState;
if (goog.isNull(frameState)) {
this.mapProjection_ = null;
@@ -164,9 +167,7 @@ goog.exportProperty(
*/
ol.control.MousePosition.prototype.handleMouseMove = function(browserEvent) {
var map = this.getMap();
var eventPosition = goog.style.getRelativePosition(
browserEvent, map.getViewport());
this.lastMouseMovePixel_ = [eventPosition.x, eventPosition.y];
this.lastMouseMovePixel_ = map.getEventPixel(browserEvent.getBrowserEvent());
this.updateHTML_(this.lastMouseMovePixel_);
};

View File

@@ -19,7 +19,6 @@ goog.require('ol.control.Control');
goog.require('ol.coordinate');
goog.require('ol.css');
goog.require('ol.extent');
goog.require('ol.pointer.PointerEventHandler');
@@ -57,9 +56,6 @@ ol.control.OverviewMap = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Overview map';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
/**
* @private
@@ -83,15 +79,10 @@ ol.control.OverviewMap = function(opt_options) {
*/
this.labelSpan_ = label;
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
}, this.labelSpan_);
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);
goog.events.listen(buttonHandler, ol.pointer.EventType.POINTERUP,
this.handlePointerUp_, false, this);
goog.events.listen(button, goog.events.EventType.CLICK,
this.handleClick_, false, this);
@@ -138,15 +129,19 @@ ol.control.OverviewMap = function(opt_options) {
});
this.ovmap_.addOverlay(this.boxOverlay_);
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
'class': className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL +
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
(this.collapsible_ ? '' : ' ol-uncollapsible')
}, ovmapDiv, button);
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL +
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
(this.collapsible_ ? '' : ' ol-uncollapsible');
var element = goog.dom.createDom(goog.dom.TagName.DIV,
cssClasses, ovmapDiv, button);
var render = goog.isDef(options.render) ?
options.render : ol.control.OverviewMap.render;
goog.base(this, {
element: element,
render: render,
target: options.target
});
};
@@ -210,12 +205,11 @@ ol.control.OverviewMap.prototype.bindView_ = function() {
/**
* Function called on each map render. Executes in a requestAnimationFrame
* callback. Manage the extent of the overview map accordingly,
* then update the overview map box.
* @param {goog.events.Event} event Event.
* @param {ol.MapEvent} mapEvent Map event.
* @this {ol.control.OverviewMap}
* @api
*/
ol.control.OverviewMap.prototype.handleMapPostrender = function(event) {
ol.control.OverviewMap.render = function(mapEvent) {
this.validateExtent_();
this.updateBox_();
};
@@ -423,19 +417,7 @@ ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function(
* @private
*/
ol.control.OverviewMap.prototype.handleClick_ = function(event) {
if (event.screenX !== 0 && event.screenY !== 0) {
return;
}
this.handleToggle_();
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent The event to handle
* @private
*/
ol.control.OverviewMap.prototype.handlePointerUp_ = function(pointerEvent) {
pointerEvent.browserEvent.preventDefault();
event.preventDefault();
this.handleToggle_();
};

View File

@@ -11,7 +11,6 @@ goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
goog.require('ol.pointer.PointerEventHandler');
@@ -38,24 +37,17 @@ ol.control.Rotate = function(opt_options) {
* @private
*/
this.label_ = goog.dom.createDom(goog.dom.TagName.SPAN,
{ 'class': 'ol-compass' },
goog.isDef(options.label) ? options.label : '\u21E7');
'ol-compass', goog.isDef(options.label) ? options.label : '\u21E7');
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Reset rotation';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-reset ol-has-tooltip',
'type' : 'button'
}, tip, this.label_);
'class': className + '-reset',
'type' : 'button',
'title': tipLabel
}, this.label_);
var handler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(handler);
goog.events.listen(handler, ol.pointer.EventType.POINTERUP,
ol.control.Rotate.prototype.handlePointerUp_, false, this);
goog.events.listen(button, goog.events.EventType.CLICK,
ol.control.Rotate.prototype.handleClick_, false, this);
@@ -70,8 +62,12 @@ ol.control.Rotate = function(opt_options) {
ol.css.CLASS_CONTROL;
var element = goog.dom.createDom(goog.dom.TagName.DIV, cssClasses, button);
var render = goog.isDef(options.render) ?
options.render : ol.control.Rotate.render;
goog.base(this, {
element: element,
render: render,
target: options.target
});
@@ -106,19 +102,7 @@ goog.inherits(ol.control.Rotate, ol.control.Control);
* @private
*/
ol.control.Rotate.prototype.handleClick_ = function(event) {
if (event.screenX !== 0 && event.screenY !== 0) {
return;
}
this.resetNorth_();
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent The event to handle
* @private
*/
ol.control.Rotate.prototype.handlePointerUp_ = function(pointerEvent) {
pointerEvent.browserEvent.preventDefault();
event.preventDefault();
this.resetNorth_();
};
@@ -155,9 +139,11 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
/**
* @inheritDoc
* @param {ol.MapEvent} mapEvent Map event.
* @this {ol.control.Rotate}
* @api
*/
ol.control.Rotate.prototype.handleMapPostrender = function(mapEvent) {
ol.control.Rotate.render = function(mapEvent) {
var frameState = mapEvent.frameState;
if (goog.isNull(frameState)) {
return;

View File

@@ -66,17 +66,15 @@ ol.control.ScaleLine = function(opt_options) {
* @private
* @type {Element}
*/
this.innerElement_ = goog.dom.createDom(goog.dom.TagName.DIV, {
'class': className + '-inner'
});
this.innerElement_ = goog.dom.createDom(goog.dom.TagName.DIV,
className + '-inner');
/**
* @private
* @type {Element}
*/
this.element_ = goog.dom.createDom(goog.dom.TagName.DIV, {
'class': className + ' ' + ol.css.CLASS_UNSELECTABLE
}, this.innerElement_);
this.element_ = goog.dom.createDom(goog.dom.TagName.DIV,
className + ' ' + ol.css.CLASS_UNSELECTABLE, this.innerElement_);
/**
* @private
@@ -114,8 +112,12 @@ ol.control.ScaleLine = function(opt_options) {
*/
this.toEPSG4326_ = null;
var render = goog.isDef(options.render) ?
options.render : ol.control.ScaleLine.render;
goog.base(this, {
element: this.element_,
render: render,
target: options.target
});
@@ -154,9 +156,11 @@ goog.exportProperty(
/**
* @inheritDoc
* @param {ol.MapEvent} mapEvent Map event.
* @this {ol.control.ScaleLine}
* @api
*/
ol.control.ScaleLine.prototype.handleMapPostrender = function(mapEvent) {
ol.control.ScaleLine.render = function(mapEvent) {
var frameState = mapEvent.frameState;
if (goog.isNull(frameState)) {
this.viewState_ = null;

View File

@@ -8,7 +8,6 @@ goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
goog.require('ol.pointer.PointerEventHandler');
@@ -41,19 +40,12 @@ ol.control.Zoom = function(opt_options) {
var zoomOutTipLabel = goog.isDef(options.zoomOutTipLabel) ?
options.zoomOutTipLabel : 'Zoom out';
var tTipZoomIn = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, zoomInTipLabel);
var inElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-in ol-has-tooltip',
'type' : 'button'
}, tTipZoomIn, zoomInLabel);
'class': className + '-in',
'type' : 'button',
'title': zoomInTipLabel
}, zoomInLabel);
var inElementHandler = new ol.pointer.PointerEventHandler(inElement);
this.registerDisposable(inElementHandler);
goog.events.listen(inElementHandler,
ol.pointer.EventType.POINTERUP, goog.partial(
ol.control.Zoom.prototype.handlePointerUp_, delta), false, this);
goog.events.listen(inElement,
goog.events.EventType.CLICK, goog.partial(
ol.control.Zoom.prototype.handleClick_, delta), false, this);
@@ -65,19 +57,12 @@ ol.control.Zoom = function(opt_options) {
this.blur();
}, false);
var tTipsZoomOut = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, zoomOutTipLabel);
var outElement = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': className + '-out ol-has-tooltip',
'type' : 'button'
}, tTipsZoomOut, zoomOutLabel);
'class': className + '-out',
'type' : 'button',
'title': zoomOutTipLabel
}, zoomOutLabel);
var outElementHandler = new ol.pointer.PointerEventHandler(outElement);
this.registerDisposable(outElementHandler);
goog.events.listen(outElementHandler,
ol.pointer.EventType.POINTERUP, goog.partial(
ol.control.Zoom.prototype.handlePointerUp_, -delta), false, this);
goog.events.listen(outElement,
goog.events.EventType.CLICK, goog.partial(
ol.control.Zoom.prototype.handleClick_, -delta), false, this);
@@ -115,20 +100,7 @@ goog.inherits(ol.control.Zoom, ol.control.Control);
* @private
*/
ol.control.Zoom.prototype.handleClick_ = function(delta, event) {
if (event.screenX !== 0 && event.screenY !== 0) {
return;
}
this.zoomByDelta_(delta);
};
/**
* @param {number} delta Zoom delta.
* @param {ol.pointer.PointerEvent} pointerEvent The event to handle
* @private
*/
ol.control.Zoom.prototype.handlePointerUp_ = function(delta, pointerEvent) {
pointerEvent.browserEvent.preventDefault();
event.preventDefault();
this.zoomByDelta_(delta);
};

View File

@@ -100,8 +100,12 @@ ol.control.ZoomSlider = function(opt_options) {
goog.events.listen(thumbElement, goog.events.EventType.CLICK,
goog.events.Event.stopPropagation);
var render = goog.isDef(options.render) ?
options.render : ol.control.ZoomSlider.render;
goog.base(this, {
element: containerElement
element: containerElement,
render: render
});
};
goog.inherits(ol.control.ZoomSlider, ol.control.Control);
@@ -166,9 +170,11 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
/**
* @inheritDoc
* @param {ol.MapEvent} mapEvent Map event.
* @this {ol.control.ZoomSlider}
* @api
*/
ol.control.ZoomSlider.prototype.handleMapPostrender = function(mapEvent) {
ol.control.ZoomSlider.render = function(mapEvent) {
if (goog.isNull(mapEvent.frameState)) {
return;
}

View File

@@ -7,7 +7,6 @@ goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.pointer.PointerEventHandler');
@@ -35,19 +34,11 @@ ol.control.ZoomToExtent = function(opt_options) {
var tipLabel = goog.isDef(options.tipLabel) ?
options.tipLabel : 'Fit to extent';
var tip = goog.dom.createDom(goog.dom.TagName.SPAN, {
'role' : 'tooltip'
}, tipLabel);
var button = goog.dom.createDom(goog.dom.TagName.BUTTON, {
'class': 'ol-has-tooltip',
'type': 'button'
'type': 'button',
'title': tipLabel
});
goog.dom.appendChild(button, tip);
var buttonHandler = new ol.pointer.PointerEventHandler(button);
this.registerDisposable(buttonHandler);
goog.events.listen(buttonHandler, ol.pointer.EventType.POINTERUP,
this.handlePointerUp_, false, this);
goog.events.listen(button, goog.events.EventType.CLICK,
this.handleClick_, false, this);
@@ -75,19 +66,7 @@ goog.inherits(ol.control.ZoomToExtent, ol.control.Control);
* @private
*/
ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
if (event.screenX !== 0 && event.screenY !== 0) {
return;
}
this.handleZoomToExtent_();
};
/**
* @param {ol.pointer.PointerEvent} pointerEvent The event to handle
* @private
*/
ol.control.ZoomToExtent.prototype.handlePointerUp_ = function(pointerEvent) {
pointerEvent.browserEvent.preventDefault();
event.preventDefault();
this.handleZoomToExtent_();
};

View File

@@ -176,6 +176,8 @@ ol.FeatureOverlay.prototype.handleMapPostCompose_ = function(event) {
var frameState = event.frameState;
var pixelRatio = frameState.pixelRatio;
var resolution = frameState.viewState.resolution;
var squaredTolerance = ol.renderer.vector.getSquaredTolerance(resolution,
pixelRatio);
var i, ii, styles, featureStyleFunction;
this.features_.forEach(function(feature) {
featureStyleFunction = feature.getStyleFunction();
@@ -189,8 +191,7 @@ ol.FeatureOverlay.prototype.handleMapPostCompose_ = function(event) {
ii = styles.length;
for (i = 0; i < ii; ++i) {
ol.renderer.vector.renderFeature(replayGroup, feature, styles[i],
ol.renderer.vector.getSquaredTolerance(resolution, pixelRatio),
feature, this.handleImageChange_, this);
squaredTolerance, this.handleImageChange_, this);
}
}, this);
};

View File

@@ -128,7 +128,7 @@ ol.format.Feature.prototype.readProjection = goog.abstractMethod;
*
* @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {ArrayBuffer|Node|Object|string} Result.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeFeature = goog.abstractMethod;
@@ -138,7 +138,7 @@ ol.format.Feature.prototype.writeFeature = goog.abstractMethod;
*
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {ArrayBuffer|Node|Object|string} Result.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeFeatures = goog.abstractMethod;
@@ -148,7 +148,7 @@ ol.format.Feature.prototype.writeFeatures = goog.abstractMethod;
*
* @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {ArrayBuffer|Node|Object|string} Node.
* @return {string} Result.
*/
ol.format.Feature.prototype.writeGeometry = goog.abstractMethod;

View File

@@ -478,22 +478,28 @@ ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
/**
* Encode a feature as a GeoJSON Feature object.
* Encode a feature as a GeoJSON Feature string.
*
* @function
* @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions} options Write options.
* @return {GeoJSONFeature} GeoJSON.
* @return {string} GeoJSON.
* @api stable
*/
ol.format.GeoJSON.prototype.writeFeature;
/**
* @inheritDoc
* Encode a feature as a GeoJSON Feature object.
*
* @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @api
* @return {Object} Object.
*/
ol.format.GeoJSON.prototype.writeFeatureObject = function(
feature, opt_options) {
opt_options = this.adaptOptions(opt_options);
var object = {
'type': 'Feature'
};
@@ -508,7 +514,7 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(
ol.format.GeoJSON.writeGeometry_(geometry, opt_options));
}
var properties = feature.getProperties();
goog.object.remove(properties, 'geometry');
goog.object.remove(properties, feature.getGeometryName());
if (!goog.object.isEmpty(properties)) {
goog.object.set(object, 'properties', properties);
}
@@ -522,17 +528,23 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(
* @function
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions} options Write options.
* @return {GeoJSONObject} GeoJSON.
* @return {string} GeoJSON.
* @api stable
*/
ol.format.GeoJSON.prototype.writeFeatures;
/**
* @inheritDoc
* Encode an array of features as a GeoJSON object.
*
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} GeoJSON Object.
* @api
*/
ol.format.GeoJSON.prototype.writeFeaturesObject =
function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
var objects = [];
var i, ii;
for (i = 0, ii = features.length; i < ii; ++i) {
@@ -546,19 +558,27 @@ ol.format.GeoJSON.prototype.writeFeaturesObject =
/**
* Encode a geometry as GeoJSON.
* Encode a geometry as a GeoJSON string.
*
* @function
* @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions} options Write options.
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON.
* @return {string} GeoJSON.
* @api stable
*/
ol.format.GeoJSON.prototype.writeGeometry;
/**
* @inheritDoc
* Encode a geometry as a GeoJSON object.
*
* @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.
* @api
*/
ol.format.GeoJSON.prototype.writeGeometryObject =
ol.format.GeoJSON.writeGeometry_;
ol.format.GeoJSON.prototype.writeGeometryObject = function(geometry,
opt_options) {
return ol.format.GeoJSON.writeGeometry_(geometry,
this.adaptOptions(opt_options));
};

View File

@@ -0,0 +1,218 @@
goog.provide('ol.format.GML2');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.dom.NodeType');
goog.require('goog.object');
goog.require('ol.extent');
goog.require('ol.format.GML');
goog.require('ol.format.GMLBase');
goog.require('ol.format.XSD');
goog.require('ol.proj');
goog.require('ol.xml');
/**
* @classdesc
* Feature format for reading and writing data in the GML format,
* version 2.1.2.
*
* @constructor
* @param {olx.format.GMLOptions=} opt_options Optional configuration object.
* @extends {ol.format.GMLBase}
* @api
*/
ol.format.GML2 = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */
(goog.isDef(opt_options) ? opt_options : {});
goog.base(this, options);
/**
* @inheritDoc
*/
this.schemaLocation = goog.isDef(options.schemaLocation) ?
options.schemaLocation : ol.format.GML2.schemaLocation_;
};
goog.inherits(ol.format.GML2, ol.format.GMLBase);
/**
* @const
* @type {string}
* @private
*/
ol.format.GML2.schemaLocation_ = 'http://www.opengis.net/gml ' +
'http://schemas.opengis.net/gml/2.1.2/feature.xsd';
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
* @return {Array.<number>|undefined} Flat coordinates.
*/
ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = objectStack[0];
goog.asserts.assert(goog.isObject(context));
var containerSrs = goog.object.get(context, 'srsName');
var containerDimension = node.parentNode.getAttribute('srsDimension');
var axisOrientation = 'enu';
if (!goog.isNull(containerSrs)) {
var proj = ol.proj.get(containerSrs);
axisOrientation = proj.getAxisOrientation();
}
var coords = s.split(/[\s,]+/);
// The "dimension" attribute is from the GML 3.0.1 spec.
var dim = 2;
if (!goog.isNull(node.getAttribute('srsDimension'))) {
dim = ol.format.XSD.readNonNegativeIntegerString(
node.getAttribute('srsDimension'));
} else if (!goog.isNull(node.getAttribute('dimension'))) {
dim = ol.format.XSD.readNonNegativeIntegerString(
node.getAttribute('dimension'));
} else if (!goog.isNull(containerDimension)) {
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
}
var x, y, z;
var flatCoordinates = [];
for (var i = 0, ii = coords.length; i < ii; i += dim) {
x = parseFloat(coords[i]);
y = parseFloat(coords[i + 1]);
z = (dim === 3) ? parseFloat(coords[i + 2]) : 0;
if (axisOrientation.substr(0, 2) === 'en') {
flatCoordinates.push(x, y, z);
} else {
flatCoordinates.push(y, x, z);
}
}
return flatCoordinates;
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
* @return {ol.Extent|undefined} Envelope.
*/
ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'Box');
var flatCoordinates = ol.xml.pushParseAndPop(
/** @type {Array.<number>} */ ([null]),
this.BOX_PARSERS_, node, objectStack, this);
return ol.extent.createOrUpdate(flatCoordinates[1][0],
flatCoordinates[1][1], flatCoordinates[1][3],
flatCoordinates[1][4]);
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GML2.prototype.innerBoundaryIsParser_ =
function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'innerBoundaryIs');
var flatLinearRing = ol.xml.pushParseAndPop(
/** @type {Array.<number>|undefined} */ (undefined),
this.RING_PARSERS, node, objectStack, this);
if (goog.isDef(flatLinearRing)) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isArray(flatLinearRings));
goog.asserts.assert(flatLinearRings.length > 0);
flatLinearRings.push(flatLinearRing);
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GML2.prototype.outerBoundaryIsParser_ =
function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'outerBoundaryIs');
var flatLinearRing = ol.xml.pushParseAndPop(
/** @type {Array.<number>|undefined} */ (undefined),
this.RING_PARSERS, node, objectStack, this);
if (goog.isDef(flatLinearRing)) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isArray(flatLinearRings));
goog.asserts.assert(flatLinearRings.length > 0);
flatLinearRings[0] = flatLinearRing;
}
};
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'coordinates': ol.xml.makeReplacer(
ol.format.GML2.prototype.readFlatCoordinates_)
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'innerBoundaryIs': ol.format.GML2.prototype.innerBoundaryIsParser_,
'outerBoundaryIs': ol.format.GML2.prototype.outerBoundaryIsParser_
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GML2.prototype.BOX_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'coordinates': ol.xml.makeArrayPusher(
ol.format.GML2.prototype.readFlatCoordinates_)
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GML2.prototype.GEOMETRY_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint),
'MultiPoint': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiPoint),
'LineString': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readLineString),
'MultiLineString': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiLineString),
'LinearRing' : ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readLinearRing),
'Polygon': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPolygon),
'MultiPolygon': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readMultiPolygon),
'Box': ol.xml.makeReplacer(ol.format.GML2.prototype.readBox_)
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,563 @@
// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part
// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect
// envelopes/extents, only geometries!
goog.provide('ol.format.GMLBase');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.dom.NodeType');
goog.require('goog.object');
goog.require('goog.string');
goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.XMLFeature');
goog.require('ol.geom.Geometry');
goog.require('ol.geom.LineString');
goog.require('ol.geom.LinearRing');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.proj');
goog.require('ol.xml');
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Feature base format for reading and writing data in the GML format.
* This class cannot be instantiate, it contains only base content that
* is shared with versioned format classes ol.format.GML2 and
* ol.format.GML3.
*
* @constructor
* @param {olx.format.GMLOptions=} opt_options
* Optional configuration object.
* @extends {ol.format.XMLFeature}
* @api
*/
ol.format.GMLBase = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */
(goog.isDef(opt_options) ? opt_options : {});
/**
* @protected
* @type {string}
*/
this.featureType = options.featureType;
/**
* @protected
* @type {string}
*/
this.featureNS = options.featureNS;
/**
* @protected
* @type {string}
*/
this.srsName = options.srsName;
/**
* @protected
* @type {string}
*/
this.schemaLocation = '';
goog.base(this);
};
goog.inherits(ol.format.GMLBase, ol.format.XMLFeature);
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<ol.Feature>} Features.
* @private
*/
ol.format.GMLBase.prototype.readFeatures_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
var localName = ol.xml.getLocalName(node);
var features;
if (localName == 'FeatureCollection') {
features = ol.xml.pushParseAndPop(null,
this.FEATURE_COLLECTION_PARSERS, node,
objectStack, this);
} else if (localName == 'featureMembers' || localName == 'featureMember') {
var context = objectStack[0];
goog.asserts.assert(goog.isObject(context));
var featureType = goog.object.get(context, 'featureType');
if (!goog.isDef(featureType) && !goog.isNull(node.firstElementChild)) {
var member = node.firstElementChild;
featureType = member.nodeName.split(':').pop();
goog.object.set(context, 'featureType', featureType);
goog.object.set(context, 'featureNS', member.namespaceURI);
}
var parsers = {};
var parsersNS = {};
parsers[featureType] = (localName == 'featureMembers') ?
ol.xml.makeArrayPusher(this.readFeatureElement, this) :
ol.xml.makeReplacer(this.readFeatureElement, this);
parsersNS[goog.object.get(context, 'featureNS')] = parsers;
features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack);
}
if (!goog.isDef(features)) {
features = [];
}
return features;
};
/**
* @type {Object.<string, Object.<string, Object>>}
*/
ol.format.GMLBase.prototype.FEATURE_COLLECTION_PARSERS = Object({
'http://www.opengis.net/gml': {
'featureMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readFeatures_),
'featureMembers': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFeatures_)
}
});
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Geometry|undefined} Geometry.
*/
ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
var context = objectStack[0];
goog.asserts.assert(goog.isObject(context));
goog.object.set(context, 'srsName',
node.firstElementChild.getAttribute('srsName'));
var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null),
this.GEOMETRY_PARSERS_, node, objectStack, this);
if (goog.isDefAndNotNull(geometry)) {
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, context));
} else {
return undefined;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.Feature} Feature.
*/
ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
var n;
var fid = node.getAttribute('fid') ||
ol.xml.getAttributeNS(node, 'http://www.opengis.net/gml', 'id');
var values = {}, geometryName;
for (n = node.firstElementChild; !goog.isNull(n);
n = n.nextElementSibling) {
var localName = ol.xml.getLocalName(n);
// Assume attribute elements have one child node and that the child
// is a text node. Otherwise assume it is a geometry node.
if (n.childNodes.length === 0 ||
(n.childNodes.length === 1 &&
n.firstChild.nodeType === 3)) {
var value = ol.xml.getAllTextContent(n, false);
if (goog.string.isEmpty(value)) {
value = undefined;
}
values[localName] = value;
} else {
// boundedBy is an extent and must not be considered as a geometry
if (localName !== 'boundedBy') {
geometryName = localName;
}
values[localName] = this.readGeometryElement(n, objectStack);
}
}
var feature = new ol.Feature(values);
if (goog.isDef(geometryName)) {
feature.setGeometryName(geometryName);
}
if (fid) {
feature.setId(fid);
}
return feature;
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Point|undefined} Point.
*/
ol.format.GMLBase.prototype.readPoint = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'Point');
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (goog.isDefAndNotNull(flatCoordinates)) {
var point = new ol.geom.Point(null);
goog.asserts.assert(flatCoordinates.length == 3);
point.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
return point;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiPoint|undefined} MultiPoint.
*/
ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'MultiPoint');
var coordinates = ol.xml.pushParseAndPop(
/** @type {Array.<Array.<number>>} */ ([]),
this.MULTIPOINT_PARSERS_, node, objectStack, this);
if (goog.isDef(coordinates)) {
return new ol.geom.MultiPoint(coordinates);
} else {
return undefined;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiLineString|undefined} MultiLineString.
*/
ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'MultiLineString');
var lineStrings = ol.xml.pushParseAndPop(
/** @type {Array.<ol.geom.LineString>} */ ([]),
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
if (goog.isDef(lineStrings)) {
var multiLineString = new ol.geom.MultiLineString(null);
multiLineString.setLineStrings(lineStrings);
return multiLineString;
} else {
return undefined;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiPolygon|undefined} MultiPolygon.
*/
ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'MultiPolygon');
var polygons = ol.xml.pushParseAndPop(
/** @type {Array.<ol.geom.Polygon>} */ ([]),
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
if (goog.isDef(polygons)) {
var multiPolygon = new ol.geom.MultiPolygon(null);
multiPolygon.setPolygons(polygons);
return multiPolygon;
} else {
return undefined;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'pointMember' ||
node.localName == 'pointMembers');
ol.xml.parseNode(this.POINTMEMBER_PARSERS_,
node, objectStack, this);
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.lineStringMemberParser_ =
function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'lineStringMember' ||
node.localName == 'lineStringMembers');
ol.xml.parseNode(this.LINESTRINGMEMBER_PARSERS_,
node, objectStack, this);
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.GMLBase.prototype.polygonMemberParser_ =
function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'polygonMember' ||
node.localName == 'polygonMembers');
ol.xml.parseNode(this.POLYGONMEMBER_PARSERS_, node,
objectStack, this);
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.LineString|undefined} LineString.
*/
ol.format.GMLBase.prototype.readLineString = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'LineString');
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (goog.isDefAndNotNull(flatCoordinates)) {
var lineString = new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
return lineString;
} else {
return undefined;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
* @return {Array.<number>|undefined} LinearRing flat coordinates.
*/
ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'LinearRing');
var ring = ol.xml.pushParseAndPop(/** @type {Array.<number>} */(null),
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this);
if (goog.isDefAndNotNull(ring)) {
return ring;
} else {
return undefined;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.LinearRing|undefined} LinearRing.
*/
ol.format.GMLBase.prototype.readLinearRing = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'LinearRing');
var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
if (goog.isDef(flatCoordinates)) {
var ring = new ol.geom.LinearRing(null);
ring.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
return ring;
} else {
return undefined;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Polygon|undefined} Polygon.
*/
ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'Polygon');
var flatLinearRings = ol.xml.pushParseAndPop(
/** @type {Array.<Array.<number>>} */ ([null]),
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
if (goog.isDef(flatLinearRings) &&
!goog.isNull(flatLinearRings[0])) {
var polygon = new ol.geom.Polygon(null);
var flatCoordinates = flatLinearRings[0];
var ends = [flatCoordinates.length];
var i, ii;
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
goog.array.extend(flatCoordinates, flatLinearRings[i]);
ends.push(flatCoordinates.length);
}
polygon.setFlatCoordinates(
ol.geom.GeometryLayout.XYZ, flatCoordinates, ends);
return polygon;
} else {
return undefined;
}
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
* @return {Array.<number>} Flat coordinates.
*/
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ =
function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(
null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this));
};
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'pointMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.pointMemberParser_),
'pointMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.pointMemberParser_)
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'lineStringMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.lineStringMemberParser_),
'lineStringMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.lineStringMemberParser_)
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'polygonMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.polygonMemberParser_),
'polygonMembers': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.polygonMemberParser_)
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'Point': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_)
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'LineString': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readLineString)
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private
*/
ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = Object({
'http://www.opengis.net/gml' : {
'Polygon': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readPolygon)
}
});
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @protected
*/
ol.format.GMLBase.prototype.RING_PARSERS = Object({
'http://www.opengis.net/gml' : {
'LinearRing': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFlatLinearRing_)
}
});
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readGeometryFromNode =
function(node, opt_options) {
var geometry = this.readGeometryElement(node,
[this.getReadOptions(node, goog.isDef(opt_options) ? opt_options : {})]);
return goog.isDef(geometry) ? geometry : null;
};
/**
* Read all features from a GML FeatureCollection.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Options.
* @return {Array.<ol.Feature>} Features.
* @api stable
*/
ol.format.GMLBase.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readFeaturesFromNode =
function(node, opt_options) {
var options = {
featureType: this.featureType,
featureNS: this.featureNS
};
if (goog.isDef(opt_options)) {
goog.object.extend(options, this.getReadOptions(node, opt_options));
}
return this.readFeatures_(node, [options]);
};
/**
* @inheritDoc
*/
ol.format.GMLBase.prototype.readProjectionFromNode = function(node) {
return ol.proj.get(goog.isDef(this.srsName_) ? this.srsName_ :
node.firstElementChild.getAttribute('srsName'));
};

View File

@@ -100,7 +100,7 @@ ol.format.GPX.parseLink_ = function(node, objectStack) {
if (!goog.isNull(href)) {
goog.object.set(values, 'link', href);
}
ol.xml.parse(ol.format.GPX.LINK_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack);
};
@@ -164,7 +164,7 @@ ol.format.GPX.parseTrkSeg_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'trkseg');
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
ol.xml.parse(ol.format.GPX.TRKSEG_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.GPX.TRKSEG_PARSERS_, node, objectStack);
var flatCoordinates = /** @type {Array.<number>} */
(goog.object.get(values, 'flatCoordinates'));
var ends = /** @type {Array.<number>} */ (goog.object.get(values, 'ends'));
@@ -869,16 +869,22 @@ ol.format.GPX.GPX_SERIALIZERS_ = ol.xml.makeStructureNS(
* @function
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Node} Result.
* @return {string} Result.
* @api stable
*/
ol.format.GPX.prototype.writeFeatures;
/**
* @inheritDoc
* Encode an array of features in the GPX format as an XML node.
*
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options.
* @return {Node} Node.
* @api
*/
ol.format.GPX.prototype.writeFeaturesNode = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
//FIXME Serialize metadata
var gpx = ol.xml.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');

View File

@@ -122,14 +122,13 @@ ol.format.JSONFeature.prototype.readProjectionFromObject = goog.abstractMethod;
* @inheritDoc
*/
ol.format.JSONFeature.prototype.writeFeature = function(feature, opt_options) {
return this.writeFeatureObject(feature, this.adaptOptions(opt_options));
return goog.json.serialize(this.writeFeatureObject(feature, opt_options));
};
/**
* @param {ol.Feature} feature Feature.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @protected
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeFeatureObject = goog.abstractMethod;
@@ -140,14 +139,13 @@ ol.format.JSONFeature.prototype.writeFeatureObject = goog.abstractMethod;
*/
ol.format.JSONFeature.prototype.writeFeatures = function(
features, opt_options) {
return this.writeFeaturesObject(features, this.adaptOptions(opt_options));
return goog.json.serialize(this.writeFeaturesObject(features, opt_options));
};
/**
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @protected
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeFeaturesObject = goog.abstractMethod;
@@ -158,14 +156,13 @@ ol.format.JSONFeature.prototype.writeFeaturesObject = goog.abstractMethod;
*/
ol.format.JSONFeature.prototype.writeGeometry = function(
geometry, opt_options) {
return this.writeGeometryObject(geometry, this.adaptOptions(opt_options));
return goog.json.serialize(this.writeGeometryObject(geometry, opt_options));
};
/**
* @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options.
* @protected
* @return {Object} Object.
*/
ol.format.JSONFeature.prototype.writeGeometryObject = goog.abstractMethod;

View File

@@ -14,7 +14,6 @@ goog.require('goog.math');
goog.require('goog.object');
goog.require('goog.string');
goog.require('ol.Feature');
goog.require('ol.array');
goog.require('ol.color');
goog.require('ol.feature');
goog.require('ol.format.Feature');
@@ -850,7 +849,7 @@ ol.format.KML.readMultiGeometry_ = function(node, objectStack) {
geometry = geometries[i];
goog.asserts.assertInstanceof(geometry, ol.geom.Point);
goog.asserts.assert(geometry.getLayout() == layout);
ol.array.safeExtend(flatCoordinates, geometry.getFlatCoordinates());
goog.array.extend(flatCoordinates, geometry.getFlatCoordinates());
}
var multiPoint = new ol.geom.MultiPoint(null);
multiPoint.setFlatCoordinates(layout, flatCoordinates);
@@ -916,7 +915,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) {
var ends = [flatCoordinates.length];
var i, ii;
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
ol.array.safeExtend(flatCoordinates, flatLinearRings[i]);
goog.array.extend(flatCoordinates, flatLinearRings[i]);
ends.push(flatCoordinates.length);
}
polygon.setFlatCoordinates(
@@ -1000,7 +999,7 @@ ol.format.KML.DataParser_ = function(node, objectStack) {
ol.format.KML.ExtendedDataParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'ExtendedData');
ol.xml.parse(ol.format.KML.EXTENDED_DATA_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.KML.EXTENDED_DATA_PARSERS_, node, objectStack);
};
@@ -1066,7 +1065,7 @@ ol.format.KML.PlacemarkStyleMapParser_ = function(node, objectStack) {
ol.format.KML.SchemaDataParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'SchemaData');
ol.xml.parse(ol.format.KML.SCHEMA_DATA_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.KML.SCHEMA_DATA_PARSERS_, node, objectStack);
};
@@ -1655,7 +1654,7 @@ ol.format.KML.prototype.readName = function(source) {
} else if (ol.xml.isNode(source)) {
return this.readNameFromNode(/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readNameFromDocument(doc);
} else {
goog.asserts.fail();
@@ -2581,16 +2580,22 @@ ol.format.KML.OUTER_BOUNDARY_NODE_FACTORY_ =
* @function
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options.
* @return {Node} Result.
* @return {string} Result.
* @api stable
*/
ol.format.KML.prototype.writeFeatures;
/**
* @inheritDoc
* Encode an array of features in the KML format as an XML node.
*
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options.
* @return {Node} Node.
* @api
*/
ol.format.KML.prototype.writeFeaturesNode = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options);
var kml = ol.xml.createElementNS(ol.format.KML.NAMESPACE_URIS_[4], 'kml');
var xmlnsUri = 'http://www.w3.org/2000/xmlns/';
var xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance';

View File

@@ -5,12 +5,17 @@ goog.require('ol.Feature');
goog.require('ol.format.Feature');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.LineString');
goog.require('ol.geom.flat.flip');
goog.require('ol.geom.flat.inflate');
goog.require('ol.proj');
/**
* @classdesc
* Feature format for reading and writing data in the Encoded
* Polyline Algorithm Format.
*
* @constructor
* @extends {ol.format.TextFeature}
* @param {olx.format.PolylineOptions=} opt_options
@@ -250,7 +255,8 @@ ol.format.Polyline.encodeUnsignedInteger = function(num) {
/**
* Read the feature from the Polyline source.
* Read the feature from the Polyline source. The coordinates are assumed to be
* in two dimensions and in latitude, longitude order.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
@@ -311,6 +317,8 @@ ol.format.Polyline.prototype.readGeometry;
ol.format.Polyline.prototype.readGeometryFromText =
function(text, opt_options) {
var flatCoordinates = ol.format.Polyline.decodeDeltas(text, 2, this.factor_);
ol.geom.flat.flip.flipXY(
flatCoordinates, 0, flatCoordinates.length, 2, flatCoordinates);
var coordinates = ol.geom.flat.inflate.coordinates(
flatCoordinates, 0, flatCoordinates.length, 2);
@@ -387,5 +395,7 @@ ol.format.Polyline.prototype.writeGeometryText =
geometry, true, this.adaptOptions(opt_options)));
var flatCoordinates = geometry.getFlatCoordinates();
var stride = geometry.getStride();
ol.geom.flat.flip.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
return ol.format.Polyline.encodeDeltas(flatCoordinates, stride, this.factor_);
};

View File

@@ -3,7 +3,8 @@ goog.provide('ol.format.WFS');
goog.require('goog.asserts');
goog.require('goog.dom.NodeType');
goog.require('goog.object');
goog.require('ol.format.GML');
goog.require('ol.format.GML3');
goog.require('ol.format.GMLBase');
goog.require('ol.format.XMLFeature');
goog.require('ol.format.XSD');
goog.require('ol.geom.Geometry');
@@ -15,8 +16,9 @@ goog.require('ol.xml');
/**
* @classdesc
* Feature format for reading and writing data in the WFS format.
* Currently only supports WFS version 1.1.0.
* Also see {@link ol.format.GML} which is used by this format.
* By default, supports WFS version 1.1.0. You can pass a GML format
* as option if you want to read a WFS that contains GML2 (WFS 1.0.0).
* Also see {@link ol.format.GMLBase} which is used by this format.
*
* @constructor
* @param {olx.format.WFSOptions=} opt_options
@@ -25,8 +27,7 @@ goog.require('ol.xml');
* @api stable
*/
ol.format.WFS = function(opt_options) {
var options = /** @type {olx.format.WFSOptions} */
(goog.isDef(opt_options) ? opt_options : {});
var options = goog.isDef(opt_options) ? opt_options : {};
/**
* @private
@@ -40,12 +41,19 @@ ol.format.WFS = function(opt_options) {
*/
this.featureNS_ = options.featureNS;
/**
* @private
* @type {ol.format.GMLBase}
*/
this.gmlFormat_ = goog.isDef(options.gmlFormat) ?
options.gmlFormat : new ol.format.GML3();
/**
* @private
* @type {string}
*/
this.schemaLocation_ = goog.isDef(options.schemaLocation) ?
options.schemaLocation : ol.format.WFS.schemaLocation_;
options.schemaLocation : ol.format.WFS.SCHEMA_LOCATION;
goog.base(this);
};
@@ -56,14 +64,14 @@ goog.inherits(ol.format.WFS, ol.format.XMLFeature);
* @const
* @type {string}
*/
ol.format.WFS.featurePrefix = 'feature';
ol.format.WFS.FEATURE_PREFIX = 'feature';
/**
* @const
* @type {string}
*/
ol.format.WFS.xmlns = 'http://www.w3.org/2000/xmlns/';
ol.format.WFS.XMLNS = 'http://www.w3.org/2000/xmlns/';
/**
@@ -89,9 +97,8 @@ ol.format.WFS.TransactionResponse;
/**
* @const
* @type {string}
* @private
*/
ol.format.WFS.schemaLocation_ = 'http://www.opengis.net/wfs ' +
ol.format.WFS.SCHEMA_LOCATION = 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd';
@@ -119,7 +126,8 @@ ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
goog.isDef(opt_options) ? opt_options : {}));
var objectStack = [context];
var features = ol.xml.pushParseAndPop([],
ol.format.GML.FEATURE_COLLECTION_PARSERS, node, objectStack);
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
objectStack, this.gmlFormat_);
if (!goog.isDef(features)) {
features = [];
}
@@ -139,7 +147,7 @@ ol.format.WFS.prototype.readTransactionResponse = function(source) {
} else if (ol.xml.isNode(source)) {
return this.readTransactionResponseFromNode(/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readTransactionResponseFromDocument(doc);
} else {
goog.asserts.fail();
@@ -162,7 +170,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadata = function(source) {
return this.readFeatureCollectionMetadataFromNode(
/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readFeatureCollectionMetadataFromDocument(doc);
} else {
goog.asserts.fail();
@@ -196,7 +204,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadataFromDocument =
ol.format.WFS.FEATURE_COLLECTION_PARSERS_ = {
'http://www.opengis.net/gml': {
'boundedBy': ol.xml.makeObjectPropertySetter(
ol.format.GML.readGeometry, 'bounds')
ol.format.GMLBase.prototype.readGeometryElement, 'bounds')
}
};
@@ -215,7 +223,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) {
goog.object.set(result, 'numberOfFeatures', value);
return ol.xml.pushParseAndPop(
/** @type {ol.format.WFS.FeatureCollectionMetadata} */ (result),
ol.format.WFS.FEATURE_COLLECTION_PARSERS_, node, []);
ol.format.WFS.FEATURE_COLLECTION_PARSERS_, node, [], this.gmlFormat_);
};
@@ -268,7 +276,7 @@ ol.format.WFS.OGC_FID_PARSERS_ = {
* @private
*/
ol.format.WFS.fidParser_ = function(node, objectStack) {
ol.xml.parse(ol.format.WFS.OGC_FID_PARSERS_, node, objectStack);
ol.xml.parseNode(ol.format.WFS.OGC_FID_PARSERS_, node, objectStack);
};
@@ -363,7 +371,7 @@ ol.format.WFS.writeFeature_ = function(node, feature, objectStack) {
var featureNS = goog.object.get(context, 'featureNS');
var child = ol.xml.createElementNS(featureNS, featureType);
node.appendChild(child);
ol.format.GML.writeFeature(child, feature, objectStack);
ol.format.GML3.prototype.writeFeatureElement(child, feature, objectStack);
};
@@ -394,10 +402,10 @@ ol.format.WFS.writeDelete_ = function(node, feature, objectStack) {
var featureType = goog.object.get(context, 'featureType');
var featurePrefix = goog.object.get(context, 'featurePrefix');
featurePrefix = goog.isDef(featurePrefix) ? featurePrefix :
ol.format.WFS.featurePrefix;
ol.format.WFS.FEATURE_PREFIX;
var featureNS = goog.object.get(context, 'featureNS');
node.setAttribute('typeName', featurePrefix + ':' + featureType);
ol.xml.setAttributeNS(node, ol.format.WFS.xmlns, 'xmlns:' + featurePrefix,
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS);
var fid = feature.getId();
if (goog.isDef(fid)) {
@@ -418,10 +426,10 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
var featureType = goog.object.get(context, 'featureType');
var featurePrefix = goog.object.get(context, 'featurePrefix');
featurePrefix = goog.isDef(featurePrefix) ? featurePrefix :
ol.format.WFS.featurePrefix;
ol.format.WFS.FEATURE_PREFIX;
var featureNS = goog.object.get(context, 'featureNS');
node.setAttribute('typeName', featurePrefix + ':' + featureType);
ol.xml.setAttributeNS(node, ol.format.WFS.xmlns, 'xmlns:' + featurePrefix,
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS);
var fid = feature.getId();
if (goog.isDef(fid)) {
@@ -457,7 +465,8 @@ ol.format.WFS.writeProperty_ = function(node, pair, objectStack) {
var value = ol.xml.createElementNS('http://www.opengis.net/wfs', 'Value');
node.appendChild(value);
if (pair.value instanceof ol.geom.Geometry) {
ol.format.GML.writeGeometry(value, pair.value, objectStack);
ol.format.GML3.prototype.writeGeometryElement(value,
pair.value, objectStack);
} else {
ol.format.XSD.writeStringTextNode(value, pair.value);
}
@@ -519,7 +528,7 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
node.setAttribute('srsName', srsName);
}
if (goog.isDef(featureNS)) {
ol.xml.setAttributeNS(node, ol.format.WFS.xmlns, 'xmlns:' + featurePrefix,
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS);
}
var item = goog.object.clone(context);
@@ -564,7 +573,7 @@ ol.format.WFS.writeOgcBBOX_ = function(node, bbox, objectStack) {
var bboxNode = ol.xml.createElementNS('http://www.opengis.net/ogc', 'BBOX');
node.appendChild(bboxNode);
ol.format.WFS.writeOgcPropertyName_(bboxNode, geometryName, objectStack);
ol.format.GML.writeGeometry(bboxNode, bbox, objectStack);
ol.format.GML3.prototype.writeGeometryElement(bboxNode, bbox, objectStack);
};
@@ -746,7 +755,7 @@ ol.format.WFS.prototype.readProjectionFromNode = function(node) {
(n.childNodes.length === 1 &&
n.firstChild.nodeType === 3))) {
var objectStack = [{}];
ol.format.GML.readGeometry(n, objectStack);
this.gmlFormat_.readGeometryElement(n, objectStack);
return ol.proj.get(objectStack.pop().srsName);
}
}

View File

@@ -582,7 +582,7 @@ ol.format.WKT.Parser.prototype.parse = function() {
/**
* @return {!ol.geom.Geometry|!ol.geom.GeometryCollection} The geometry.
* @return {!(ol.geom.Geometry|ol.geom.GeometryCollection)} The geometry.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
@@ -602,7 +602,7 @@ ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
return new ctor(coordinates);
}
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -622,7 +622,7 @@ ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -639,7 +639,7 @@ ol.format.WKT.Parser.prototype.parsePointText_ = function() {
} else if (this.isEmptyGeometry_()) {
return null;
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -656,7 +656,7 @@ ol.format.WKT.Parser.prototype.parseLineStringText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -673,7 +673,7 @@ ol.format.WKT.Parser.prototype.parsePolygonText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -695,7 +695,7 @@ ol.format.WKT.Parser.prototype.parseMultiPointText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -713,7 +713,7 @@ ol.format.WKT.Parser.prototype.parseMultiLineStringText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -730,7 +730,7 @@ ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -751,7 +751,7 @@ ol.format.WKT.Parser.prototype.parsePoint_ = function() {
if (coordinates.length == this.dimension_) {
return coordinates;
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -822,12 +822,13 @@ ol.format.WKT.Parser.prototype.isEmptyGeometry_ = function() {
/**
* Create an error message for an unexpected token error.
* @return {string} Error message.
* @private
*/
ol.format.WKT.Parser.prototype.raiseError_ = function() {
throw new Error('Unexpected `' + this.token_.value +
'` at position ' + this.token_.position +
' in `' + this.lexer_.wkt + '`');
ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() {
return 'Unexpected `' + this.token_.value + '` at position ' +
this.token_.position + ' in `' + this.lexer_.wkt + '`';
};

View File

@@ -0,0 +1,146 @@
goog.provide('ol.format.WMSGetFeatureInfo');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.dom.NodeType');
goog.require('goog.object');
goog.require('goog.string');
goog.require('ol.format.GML');
goog.require('ol.format.GML2');
goog.require('ol.format.XMLFeature');
goog.require('ol.xml');
/**
* @classdesc
* Format for reading WMSGetFeatureInfo format. It uses
* {@link ol.format.GML2} to read features.
*
* @constructor
* @extends {ol.format.XMLFeature}
* @api
*/
ol.format.WMSGetFeatureInfo = function() {
/**
* @private
* @type {string}
*/
this.featureNS_ = 'http://mapserver.gis.umn.edu/mapserver';
/**
* @private
* @type {ol.format.GML2}
*/
this.gmlFormat_ = new ol.format.GML2();
goog.base(this);
};
goog.inherits(ol.format.WMSGetFeatureInfo, ol.format.XMLFeature);
/**
* @const
* @type {string}
* @private
*/
ol.format.WMSGetFeatureInfo.featureIdentifier_ = '_feature';
/**
* @const
* @type {string}
* @private
*/
ol.format.WMSGetFeatureInfo.layerIdentifier_ = '_layer';
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<ol.Feature>} Features.
* @private
*/
ol.format.WMSGetFeatureInfo.prototype.readFeatures_ =
function(node, objectStack) {
node.namespaceURI = this.featureNS_;
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
var localName = ol.xml.getLocalName(node);
/** @type {Array.<ol.Feature>} */
var features = [];
if (node.childNodes.length === 0) {
return features;
}
if (localName == 'msGMLOutput') {
goog.array.forEach(node.childNodes, function(layer) {
if (layer.nodeType !== goog.dom.NodeType.ELEMENT) {
return;
}
var context = objectStack[0];
goog.asserts.assert(goog.isObject(context));
goog.asserts.assert(layer.localName.indexOf(
ol.format.WMSGetFeatureInfo.layerIdentifier_) >= 0);
var featureType = goog.string.remove(layer.localName,
ol.format.WMSGetFeatureInfo.layerIdentifier_) +
ol.format.WMSGetFeatureInfo.featureIdentifier_;
goog.object.set(context, 'featureType', featureType);
goog.object.set(context, 'featureNS', this.featureNS_);
var parsers = {};
parsers[featureType] = ol.xml.makeArrayPusher(
this.gmlFormat_.readFeatureElement, this.gmlFormat_);
var parsersNS = ol.xml.makeParsersNS(
[goog.object.get(context, 'featureNS'), null], parsers);
layer.namespaceURI = this.featureNS_;
var layerFeatures = ol.xml.pushParseAndPop(
[], parsersNS, layer, objectStack, this.gmlFormat_);
if (goog.isDef(layerFeatures)) {
goog.array.extend(features, layerFeatures);
}
}, this);
}
if (localName == 'FeatureCollection') {
var gmlFeatures = ol.xml.pushParseAndPop([],
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
[{}], this.gmlFormat_);
if (goog.isDef(gmlFeatures)) {
features = gmlFeatures;
}
}
return features;
};
/**
* Read all features from a WMSGetFeatureInfo response.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Options.
* @return {Array.<ol.Feature>} Features.
* @api stable
*/
ol.format.WMSGetFeatureInfo.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.WMSGetFeatureInfo.prototype.readFeaturesFromNode =
function(node, opt_options) {
var options = {
'featureType': this.featureType,
'featureNS': this.featureNS
};
if (goog.isDef(opt_options)) {
goog.object.extend(options, this.getReadOptions(node, opt_options));
}
return this.readFeatures_(node, [options]);
};

View File

@@ -3,6 +3,7 @@ goog.provide('ol.format.XMLFeature');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.dom.NodeType');
goog.require('goog.dom.xml');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
goog.require('ol.proj');
@@ -43,7 +44,7 @@ ol.format.XMLFeature.prototype.readFeature = function(source, opt_options) {
} else if (ol.xml.isNode(source)) {
return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options);
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readFeatureFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
@@ -86,7 +87,7 @@ ol.format.XMLFeature.prototype.readFeatures = function(source, opt_options) {
} else if (ol.xml.isNode(source)) {
return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options);
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readFeaturesFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
@@ -134,7 +135,7 @@ ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) {
} else if (ol.xml.isNode(source)) {
return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options);
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readGeometryFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
@@ -170,7 +171,7 @@ ol.format.XMLFeature.prototype.readProjection = function(source) {
} else if (ol.xml.isNode(source)) {
return this.readProjectionFromNode(/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readProjectionFromDocument(doc);
} else {
goog.asserts.fail();
@@ -199,7 +200,9 @@ ol.format.XMLFeature.prototype.readProjectionFromNode = goog.abstractMethod;
* @inheritDoc
*/
ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) {
return this.writeFeatureNode(feature, this.adaptOptions(opt_options));
var node = this.writeFeatureNode(feature, opt_options);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
return goog.dom.xml.serialize(/** @type {Element} */(node));
};
@@ -216,14 +219,15 @@ ol.format.XMLFeature.prototype.writeFeatureNode = goog.abstractMethod;
* @inheritDoc
*/
ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) {
return this.writeFeaturesNode(features, this.adaptOptions(opt_options));
var node = this.writeFeaturesNode(features, opt_options);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
return goog.dom.xml.serialize(/** @type {Element} */(node));
};
/**
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options.
* @protected
* @return {Node} Node.
*/
ol.format.XMLFeature.prototype.writeFeaturesNode = goog.abstractMethod;
@@ -233,14 +237,15 @@ ol.format.XMLFeature.prototype.writeFeaturesNode = goog.abstractMethod;
* @inheritDoc
*/
ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) {
return this.writeGeometryNode(geometry, this.adaptOptions(opt_options));
var node = this.writeGeometryNode(geometry, opt_options);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
return goog.dom.xml.serialize(/** @type {Element} */(node));
};
/**
* @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Options.
* @protected
* @return {Node} Node.
*/
ol.format.XMLFeature.prototype.writeGeometryNode = goog.abstractMethod;

View File

@@ -25,7 +25,7 @@ ol.format.XML.prototype.read = function(source) {
} else if (ol.xml.isNode(source)) {
return this.readFromNode(/** @type {Node} */ (source));
} else if (goog.isString(source)) {
var doc = ol.xml.load(source);
var doc = ol.xml.parse(source);
return this.readFromDocument(doc);
} else {
goog.asserts.fail();

View File

@@ -22,7 +22,7 @@ ol.geom.flat.transform.transform2D =
var m13 = goog.vec.Mat4.getElement(transform, 1, 3);
var dest = goog.isDef(opt_dest) ? opt_dest : [];
var i = 0;
var j, jj;
var j;
for (j = offset; j < end; j += stride) {
var x = flatCoordinates[j];
var y = flatCoordinates[j + 1];
@@ -34,3 +34,32 @@ ol.geom.flat.transform.transform2D =
}
return dest;
};
/**
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @param {number} deltaX Delta X.
* @param {number} deltaY Delta Y.
* @param {Array.<number>=} opt_dest Destination.
* @return {Array.<number>} Transformed coordinates.
*/
ol.geom.flat.transform.translate =
function(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
var dest = goog.isDef(opt_dest) ? opt_dest : [];
var i = 0;
var j, k;
for (j = offset; j < end; j += stride) {
dest[i++] = flatCoordinates[j] + deltaX;
dest[i++] = flatCoordinates[j + 1] + deltaY;
for (k = j + 2; k < j + stride; ++k) {
dest[i++] = flatCoordinates[k];
}
}
if (goog.isDef(opt_dest) && dest.length != i) {
dest.length = i;
}
return dest;
};

View File

@@ -194,6 +194,16 @@ ol.geom.Geometry.prototype.applyTransform = goog.abstractMethod;
ol.geom.Geometry.prototype.intersectsExtent = goog.abstractMethod;
/**
* Translate the geometry.
* @param {number} deltaX Delta X.
* @param {number} deltaY Delta Y.
* @function
* @api
*/
ol.geom.Geometry.prototype.translate = goog.abstractMethod;
/**
* Transform each coordinate of the geometry from one coordinate reference
* system to another. The geometry is modified in place.

View File

@@ -265,6 +265,7 @@ ol.geom.GeometryCollection.prototype.setGeometriesArray = function(geometries) {
/**
* @inheritDoc
* @api stable
*/
ol.geom.GeometryCollection.prototype.applyTransform = function(transformFn) {
var geometries = this.geometries_;
@@ -276,6 +277,22 @@ ol.geom.GeometryCollection.prototype.applyTransform = function(transformFn) {
};
/**
* Translate the geometry.
* @param {number} deltaX Delta X.
* @param {number} deltaY Delta Y.
* @api
*/
ol.geom.GeometryCollection.prototype.translate = function(deltaX, deltaY) {
var geometries = this.geometries_;
var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) {
geometries[i].translate(deltaX, deltaY);
}
this.changed();
};
/**
* @inheritDoc
*/

View File

@@ -1,7 +1,7 @@
goog.provide('ol.geom.LineString');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.SimpleGeometry');
@@ -69,7 +69,7 @@ ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = coordinate.slice();
} else {
ol.array.safeExtend(this.flatCoordinates, coordinate);
goog.array.extend(this.flatCoordinates, coordinate);
}
this.changed();
};

View File

@@ -1,7 +1,7 @@
goog.provide('ol.geom.MultiLineString');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
@@ -63,7 +63,7 @@ ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = lineString.getFlatCoordinates().slice();
} else {
ol.array.safeExtend(
goog.array.extend(
this.flatCoordinates, lineString.getFlatCoordinates().slice());
}
this.ends_.push(this.flatCoordinates.length);
@@ -212,7 +212,7 @@ ol.geom.MultiLineString.prototype.getFlatMidpoints = function() {
var end = ends[i];
var midpoint = ol.geom.flat.interpolate.lineString(
flatCoordinates, offset, end, stride, 0.5);
ol.array.safeExtend(midpoints, midpoint);
goog.array.extend(midpoints, midpoint);
offset = end;
}
return midpoints;
@@ -313,7 +313,7 @@ ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) {
// FIXME better handle the case of non-matching layouts
goog.asserts.assert(lineString.getLayout() == layout);
}
ol.array.safeExtend(flatCoordinates, lineString.getFlatCoordinates());
goog.array.extend(flatCoordinates, lineString.getFlatCoordinates());
ends.push(flatCoordinates.length);
}
this.setFlatCoordinates(layout, flatCoordinates, ends);

View File

@@ -1,7 +1,7 @@
goog.provide('ol.geom.MultiPoint');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.Point');
@@ -39,7 +39,7 @@ ol.geom.MultiPoint.prototype.appendPoint = function(point) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = point.getFlatCoordinates().slice();
} else {
ol.array.safeExtend(this.flatCoordinates, point.getFlatCoordinates());
goog.array.extend(this.flatCoordinates, point.getFlatCoordinates());
}
this.changed();
};

View File

@@ -1,7 +1,7 @@
goog.provide('ol.geom.MultiPolygon');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.MultiPoint');
@@ -97,7 +97,7 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
this.endss_.push();
} else {
var offset = this.flatCoordinates.length;
ol.array.safeExtend(this.flatCoordinates, polygon.getFlatCoordinates());
goog.array.extend(this.flatCoordinates, polygon.getFlatCoordinates());
ends = polygon.getEnds().slice();
var i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
@@ -397,7 +397,7 @@ ol.geom.MultiPolygon.prototype.setPolygons = function(polygons) {
for (j = 0, jj = ends.length; j < jj; ++j) {
ends[j] += offset;
}
ol.array.safeExtend(flatCoordinates, polygon.getFlatCoordinates());
goog.array.extend(flatCoordinates, polygon.getFlatCoordinates());
endss.push(ends);
}
this.setFlatCoordinates(layout, flatCoordinates, endss);

View File

@@ -2,7 +2,6 @@ goog.provide('ol.geom.Polygon');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LinearRing');
@@ -92,7 +91,7 @@ ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
} else {
ol.array.safeExtend(this.flatCoordinates, linearRing.getFlatCoordinates());
goog.array.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
}
this.ends_.push(this.flatCoordinates.length);
this.changed();
@@ -374,3 +373,23 @@ ol.geom.Polygon.circular = function(sphere, center, radius, opt_n) {
ol.geom.GeometryLayout.XY, flatCoordinates, [flatCoordinates.length]);
return polygon;
};
/**
* Create a polygon from an extent. The layout used is `XY`.
* @param {ol.Extent} extent The extent.
* @return {ol.geom.Polygon} The polygon.
* @api
*/
ol.geom.Polygon.fromExtent = function(extent) {
var minX = extent[0];
var minY = extent[1];
var maxX = extent[2];
var maxY = extent[3];
var flatCoordinates =
[minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY];
var polygon = new ol.geom.Polygon(null);
polygon.setFlatCoordinates(
ol.geom.GeometryLayout.XY, flatCoordinates, [flatCoordinates.length]);
return polygon;
};

View File

@@ -245,6 +245,7 @@ ol.geom.SimpleGeometry.prototype.setLayout =
/**
* @inheritDoc
* @api stable
*/
ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) {
if (!goog.isNull(this.flatCoordinates)) {
@@ -254,6 +255,24 @@ ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) {
};
/**
* Translate the geometry.
* @param {number} deltaX Delta X.
* @param {number} deltaY Delta Y.
* @api
*/
ol.geom.SimpleGeometry.prototype.translate = function(deltaX, deltaY) {
var flatCoordinates = this.getFlatCoordinates();
if (!goog.isNull(flatCoordinates)) {
var stride = this.getStride();
ol.geom.flat.transform.translate(
flatCoordinates, 0, flatCoordinates.length, stride,
deltaX, deltaY, flatCoordinates);
this.changed();
}
};
/**
* @param {ol.geom.SimpleGeometry} simpleGeometry Simple geometry.
* @param {goog.vec.Mat4.Number} transform Transform.

View File

@@ -119,21 +119,32 @@ ol.has.MSPOINTER = !!(goog.global.navigator.msPointerEnabled);
* @type {boolean}
* @api stable
*/
ol.has.WEBGL = ol.ENABLE_WEBGL && (
/**
* @return {boolean} WebGL supported.
*/
function() {
if (!('WebGLRenderingContext' in goog.global)) {
return false;
}
ol.has.WEBGL;
(function() {
if (ol.ENABLE_WEBGL) {
var hasWebGL = false;
var textureSize;
var /** @type {Array.<string>} */ extensions = [];
if ('WebGLRenderingContext' in goog.global) {
try {
var canvas = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS));
return !goog.isNull(ol.webgl.getContext(canvas, {
var gl = ol.webgl.getContext(canvas, {
failIfMajorPerformanceCaveat: true
}));
} catch (e) {
return false;
}
})();
});
if (!goog.isNull(gl)) {
hasWebGL = true;
textureSize = /** @type {number} */
(gl.getParameter(gl.MAX_TEXTURE_SIZE));
extensions = gl.getSupportedExtensions();
}
} catch (e) {}
}
ol.has.WEBGL = hasWebGL;
ol.WEBGL_EXTENSIONS = extensions;
ol.WEBGL_MAX_TEXTURE_SIZE = textureSize;
}
})();

View File

@@ -20,9 +20,10 @@ goog.require('ol.extent');
* @param {Array.<ol.Attribution>} attributions Attributions.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
*/
ol.Image =
function(extent, resolution, pixelRatio, attributions, src, crossOrigin) {
ol.Image = function(extent, resolution, pixelRatio, attributions, src,
crossOrigin, imageLoadFunction) {
goog.base(this, extent, resolution, pixelRatio, ol.ImageState.IDLE,
attributions);
@@ -59,6 +60,13 @@ ol.Image =
* @type {ol.ImageState}
*/
this.state = ol.ImageState.IDLE;
/**
* @private
* @type {ol.ImageLoadFunctionType}
*/
this.imageLoadFunction_ = imageLoadFunction;
};
goog.inherits(ol.Image, ol.ImageBase);
@@ -66,8 +74,9 @@ goog.inherits(ol.Image, ol.ImageBase);
/**
* @param {Object=} opt_context Object.
* @return {HTMLCanvasElement|Image|HTMLVideoElement} Image.
* @api
*/
ol.Image.prototype.getImageElement = function(opt_context) {
ol.Image.prototype.getImage = function(opt_context) {
if (goog.isDef(opt_context)) {
var image;
var key = goog.getUid(opt_context);
@@ -126,7 +135,7 @@ ol.Image.prototype.load = function() {
goog.events.listenOnce(this.image_, goog.events.EventType.LOAD,
this.handleImageLoad_, false, this)
];
this.image_.src = this.src_;
this.imageLoadFunction_(this, this.src_);
}
};

View File

@@ -95,7 +95,7 @@ ol.ImageBase.prototype.getExtent = function() {
* @param {Object=} opt_context Object.
* @return {HTMLCanvasElement|Image|HTMLVideoElement} Image.
*/
ol.ImageBase.prototype.getImageElement = goog.abstractMethod;
ol.ImageBase.prototype.getImage = goog.abstractMethod;
/**

View File

@@ -33,6 +33,6 @@ goog.inherits(ol.ImageCanvas, ol.ImageBase);
/**
* @inheritDoc
*/
ol.ImageCanvas.prototype.getImageElement = function(opt_context) {
ol.ImageCanvas.prototype.getImage = function(opt_context) {
return this.canvas_;
};

View File

@@ -0,0 +1,21 @@
goog.provide('ol.ImageLoadFunctionType');
/**
* A function that takes an {@link ol.Image} for the image and a `{string}` for
* the src as arguments. It is supposed to make it so the underlying image
* {@link ol.Image#getImage} is assigned the content specified by the src. If
* not specified, the default is
*
* function(image, src) {
* image.getImage().src = src;
* }
*
* Providing a custom `imageLoadFunction` can be useful to load images with
* post requests or - in general - through XHR requests, where the src of the
* image element would be set to a data URI when the content is loaded.
*
* @typedef {function(ol.Image, string)}
* @api
*/
ol.ImageLoadFunctionType;

View File

@@ -26,7 +26,9 @@ ol.interaction.DoubleClickZoom = function(opt_options) {
*/
this.delta_ = goog.isDef(options.delta) ? options.delta : 1;
goog.base(this);
goog.base(this, {
handleEvent: ol.interaction.DoubleClickZoom.handleEvent
});
/**
* @private
@@ -39,10 +41,12 @@ goog.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction);
/**
* @inheritDoc
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {ol.interaction.DoubleClickZoom}
* @api
*/
ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent =
function(mapBrowserEvent) {
ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) {
var stopEvent = false;
var browserEvent = mapBrowserEvent.browserEvent;
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK) {

Some files were not shown because too many files have changed in this diff Show More