Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c53a46d7d | |||
| 962473c3ab | |||
| 57ee7f52fd | |||
| 7985f030fa | |||
| fd8df2949b | |||
| 6fc6450630 | |||
| 1e25fc5585 | |||
| b3ac1afd00 | |||
| bd9092199b | |||
| 84cad42f6d | |||
| 516c1b39f7 | |||
| ef9db32dda | |||
| 9b734a3335 | |||
| f150259eee | |||
| 849774dceb | |||
| bac0f304de | |||
| c2bb8a27f0 | |||
| 10ee3b644c | |||
| 881373b178 | |||
| 13db9a5038 | |||
| 5d14b9e2d4 | |||
| 17c3936ab6 | |||
| 1ac4ed574f | |||
| 1d3c4bf4e7 | |||
| 5e603e0889 | |||
| 213d1ac0fe | |||
| 934e52d75a | |||
| 4dc48d748e | |||
| 535febbd07 | |||
| ea546e820e | |||
| 9cef8d2818 | |||
| acb618e473 | |||
| 80887d9deb | |||
| 10e299148e | |||
| 92cad64411 | |||
| dc9c5b3cfe | |||
| e9c319cb5e | |||
| 406ea86fb7 | |||
| 1f8c98db8c | |||
| 453f8499d6 | |||
| de8bd80c7d | |||
| 5a66d6e728 | |||
| 021fd236f9 | |||
| 447d9ec05b |
@@ -1,6 +0,0 @@
|
||||
*.pyc
|
||||
/build
|
||||
/examples/*.html.png
|
||||
/examples/example-list.js
|
||||
/examples/example-list.xml
|
||||
/node_modules/
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
before_install:
|
||||
- "sudo pip install -r requirements.txt"
|
||||
- "npm install"
|
||||
|
||||
before_script:
|
||||
- "./build.py plovr"
|
||||
- "./build.py serve-integration-test &"
|
||||
- "rm src/ol/renderer/webgl/*shader.js"
|
||||
- "sleep 3"
|
||||
|
||||
script: "./build.py integration-test"
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
OpenLayers contributors:
|
||||
|
||||
* Antoine Abt
|
||||
* Mike Adair
|
||||
* Jeff Adams
|
||||
* Seb Benthall
|
||||
* Bruno Binet
|
||||
* Stéphane Brunner
|
||||
* Howard Butler
|
||||
* Bertil Chaupis
|
||||
* John Cole
|
||||
* Tim Coulter
|
||||
* Robert Coup
|
||||
* Jeff Dege
|
||||
* Roald de Wit
|
||||
* Schuyler Erle
|
||||
* Christian López Espínola
|
||||
* John Frank
|
||||
* Sean Gilles
|
||||
* Pierre Giraud
|
||||
* Ivan Grcic
|
||||
* Andreas Hocevar
|
||||
* Marc Jansen
|
||||
* Ian Johnson
|
||||
* Frédéric Junod
|
||||
* Eric Lemoine
|
||||
* Philip Lindsay
|
||||
* Martijn van Oosterhout
|
||||
* David Overstrom
|
||||
* Tom Payne
|
||||
* Corey Puffault
|
||||
* Peter William Robins
|
||||
* Gregers Rygg
|
||||
* Tim Schaub
|
||||
* Christopher Schmidt
|
||||
* Tobias Schwinger
|
||||
* Cameron Shorter
|
||||
* Pedro Simonetti
|
||||
* Paul Spencer
|
||||
* Paul Smith
|
||||
* Glen Stampoultzis
|
||||
* James Stembridge
|
||||
* Erik Uzureau
|
||||
* Bart van den Eijnden
|
||||
* Ivan Willig
|
||||
* Thomas Wood
|
||||
* Bill Woodall
|
||||
* Steve Woodbridge
|
||||
* David Zwarg
|
||||
|
||||
Some portions of OpenLayers are used under the Apache 2.0 license, available
|
||||
in doc/licenses/APACHE-2.0.txt.
|
||||
|
||||
Some portions of OpenLayers are used under the MIT license, availabie in
|
||||
doc/licenses/MIT-LICENSE.txt.
|
||||
|
||||
Some portions of OpenLayers are Copyright 2001 Robert Penner, and are used
|
||||
under the BSD license, available in doc/licenses/BSD-LICENSE.txt
|
||||
@@ -1,21 +0,0 @@
|
||||
# Contributing to OpenLayers 3
|
||||
|
||||
Thanks for your interest in contributing to OpenLayers 3.
|
||||
|
||||
## Contributing Code
|
||||
|
||||
Our preferred means of receiving contributions is through [pull
|
||||
requests](https://help.github.com/articles/using-pull-requests).
|
||||
|
||||
See the [Developer
|
||||
Guide](https://github.com/openlayers/ol3/wiki/Developer-Guide) to get started
|
||||
with OpenLayers 3 development. This guide provides information you should know
|
||||
before creating pull requests.
|
||||
|
||||
Note that, before accepting a contribution, we ask that you provide us
|
||||
a Contributor License Agreement. If you are making your contribution as part of
|
||||
work for your employer, please follow the guidelines on submitting a [Corporate
|
||||
Contributor License Agreement](http://www.openlayers.org/ccla.txt). If you are
|
||||
making your contribution as an individual, you can submit a digital [Individual
|
||||
Contributor License
|
||||
Agreement](https://docs.google.com/spreadsheet/viewform?formkey=dGNNVUJEMXF2dERTU0FXM3JjNVBQblE6MQ).
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
Copyright 2005-2013 OpenLayers Contributors. All rights reserved. See
|
||||
AUTHORS.md for full list.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY OPENLAYERS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of OpenLayers Contributors.
|
||||
@@ -1,11 +0,0 @@
|
||||
# OpenLayers 3
|
||||
|
||||
[](http://travis-ci.org/#!/openlayers/ol3)
|
||||
|
||||
Welcome to [OpenLayers 3](http://ol3js.org/)!
|
||||
|
||||
Check out the [hosted examples](http://ol3js.org/en/master/examples/), the [workshop](http://ol3js.org/ol3-workshop/) or poke around the evolving [API docs](http://ol3js.org/en/master/apidoc/).
|
||||
|
||||
Please don't ask questions in the github issue tracker but use [the mailing list](https://groups.google.com/forum/#!forum/ol3-dev) instead.
|
||||
|
||||
Please see our guide on [contributing](CONTRIBUTING.md) if you're interested in getting involved.
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"opts": {
|
||||
"recurse": true,
|
||||
"template": "apidoc/template"
|
||||
},
|
||||
"tags": {
|
||||
"allowUnknownTags": true
|
||||
},
|
||||
"source": {
|
||||
"includePattern": ".+\\.js(doc)?$",
|
||||
"excludePattern": "(^|\\/|\\\\)_",
|
||||
"exclude": [
|
||||
"src/googx/dom/fullscreen.js"
|
||||
],
|
||||
"include": [
|
||||
"src",
|
||||
"externs/oli.js",
|
||||
"externs/olx.js"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"node_modules/jsdoc/plugins/markdown",
|
||||
"apidoc/plugins/inheritdoc",
|
||||
"apidoc/plugins/interface",
|
||||
"apidoc/plugins/typedefs",
|
||||
"apidoc/plugins/inheritdoc",
|
||||
"apidoc/plugins/api",
|
||||
"apidoc/plugins/todo",
|
||||
"apidoc/plugins/observable"
|
||||
],
|
||||
"markdown": {
|
||||
"parser": "gfm"
|
||||
},
|
||||
"stability": {
|
||||
"levels": ["deprecated","experimental","unstable","stable","frozen","locked"]
|
||||
},
|
||||
"templates": {
|
||||
"cleverLinks": false,
|
||||
"monospaceLinks": false,
|
||||
"default": {
|
||||
"outputSourceFiles": true
|
||||
}
|
||||
},
|
||||
"jsVersion": 180
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
Finding your way around
|
||||
-----------------------
|
||||
See the class list to the right and especially take a look at {@link ol.Map} and {@link ol.layer.Layer} because those are the central objects.
|
||||
|
||||
In general every use of OpenLayers starts by initializing a map, then adding the required layers. Controls and interactions can be added to change the behavior of the map.
|
||||
|
||||
Projections
|
||||
-----------
|
||||
A {@link ol.proj.Projection} defines which point on earth is represented by a pair of coordinates.
|
||||
Coordinates within OpenLayers can be used in various projections where some common projections are always supported,
|
||||
others can be used via [Proj4js](http://trac.osgeo.org/proj4js/).
|
||||
|
||||
Maps and Layers
|
||||
---------------
|
||||
A map in OpenLayers is essentially a staple of layers that is viewed from the top. Layers are responsible for retrieving data and displaying it.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
See [CONTRIBUTING.md](https://github.com/openlayers/ol3/blob/master/CONTRIBUTING.md) for instructions
|
||||
on building and testing OpenLayers. The file does also describe how to commit your changes to OpenLayers.
|
||||
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* Define an @api tag
|
||||
*/
|
||||
var conf = env.conf.stability;
|
||||
var defaultLevels = ["deprecated","experimental","unstable","stable","frozen","locked"];
|
||||
var levels = conf.levels || defaultLevels;
|
||||
var util = require('util');
|
||||
exports.defineTags = function(dictionary) {
|
||||
dictionary.defineTag('api', {
|
||||
mustHaveValue: false,
|
||||
canHaveType: false,
|
||||
canHaveName: false,
|
||||
onTagged: function(doclet, tag) {
|
||||
var level = tag.text || "experimental";
|
||||
if (levels.indexOf(level) >= 0) {
|
||||
doclet.stability = level;
|
||||
} else {
|
||||
var errorText = util.format('Invalid stability level (%s) in %s line %s', tag.text, doclet.meta.filename, doclet.meta.lineno);
|
||||
require('jsdoc/util/error').handle( new Error(errorText) );
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Based on @stability annotations, and assuming that items with no @stability
|
||||
* annotation should not be documented, this plugin removes undocumented symbols
|
||||
* from the documentation. Undocumented classes with documented members get a
|
||||
* 'hideConstructur' property, which is read by the template so it can hide the
|
||||
* constructor.
|
||||
*/
|
||||
|
||||
function hasApiMembers(doclet) {
|
||||
return doclet.longname.split('#')[0] == this.longname;
|
||||
}
|
||||
|
||||
var api = [];
|
||||
|
||||
exports.handlers = {
|
||||
|
||||
newDoclet: function(e) {
|
||||
var doclet = e.doclet;
|
||||
// Keep track of api items - needed in parseComplete to determine classes
|
||||
// with api members.
|
||||
if (doclet.stability) {
|
||||
api.push(doclet);
|
||||
}
|
||||
// Mark explicity defined namespaces - needed in parseComplete to keep
|
||||
// namespaces that we need as containers for api items.
|
||||
if (/.*\.jsdoc$/.test(doclet.meta.filename) && doclet.kind == 'namespace') {
|
||||
doclet.namespace_ = true;
|
||||
}
|
||||
},
|
||||
|
||||
parseComplete: function(e) {
|
||||
var doclets = e.doclets;
|
||||
for (var i = doclets.length - 1; i >= 0; --i) {
|
||||
var doclet = doclets[i];
|
||||
// Always document namespaces and items with stability annotation
|
||||
if (doclet.stability || doclet.namespace_) {
|
||||
continue;
|
||||
}
|
||||
if (doclet.kind == 'class' && api.some(hasApiMembers, doclet)) {
|
||||
// Mark undocumented classes with documented members as unexported.
|
||||
// This is used in ../template/tmpl/container.tmpl to hide the
|
||||
// constructor from the docs.
|
||||
doclet.hideConstructor = true;
|
||||
} else {
|
||||
// Remove all other undocumented symbols
|
||||
doclets.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* This is a hack to prevent inheritDoc tags from entirely removing
|
||||
* documentation of the method that inherits the documentation.
|
||||
*
|
||||
* TODO: Remove this hack when https://github.com/jsdoc3/jsdoc/issues/53
|
||||
* is addressed.
|
||||
*/
|
||||
|
||||
|
||||
exports.defineTags = function(dictionary) {
|
||||
dictionary.defineTag('inheritDoc', {
|
||||
mustHaveValue: false,
|
||||
canHaveType: false,
|
||||
canHaveName: false,
|
||||
onTagged: function(doclet, tag) {
|
||||
doclet.inheritdoc = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var lookup = {};
|
||||
var incompleteByClass = {};
|
||||
var keepKeys = ['comment', 'meta', 'name', 'memberof', 'longname', 'augment',
|
||||
'stability'];
|
||||
|
||||
exports.handlers = {
|
||||
|
||||
newDoclet: function(e) {
|
||||
var doclet = e.doclet;
|
||||
var incompletes;
|
||||
if (!(doclet.longname in lookup)) {
|
||||
lookup[doclet.longname] = [];
|
||||
}
|
||||
lookup[doclet.longname].push(doclet);
|
||||
if (doclet.inheritdoc) {
|
||||
if (!(doclet.memberof in incompleteByClass)) {
|
||||
incompleteByClass[doclet.memberof] = [];
|
||||
}
|
||||
incompletes = incompleteByClass[doclet.memberof];
|
||||
if (incompletes.indexOf(doclet.name) == -1) {
|
||||
incompletes.push(doclet.name);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
parseComplete: function(e) {
|
||||
var ancestors, candidate, candidates, doclet, i, j, k, l, key;
|
||||
var incompleteDoclet, stability, incomplete, incompletes;
|
||||
var doclets = e.doclets;
|
||||
for (i = doclets.length - 1; i >= 0; --i) {
|
||||
doclet = doclets[i];
|
||||
if (doclet.augments) {
|
||||
ancestors = [].concat(doclet.augments);
|
||||
}
|
||||
incompletes = incompleteByClass[doclet.longname];
|
||||
if (ancestors && incompletes) {
|
||||
// collect ancestors from the whole hierarchy
|
||||
for (j = 0; j < ancestors.length; ++j) {
|
||||
candidates = lookup[ancestors[j]];
|
||||
if (candidates) {
|
||||
for (k = candidates.length - 1; k >= 0; --k) {
|
||||
candidate = candidates[k];
|
||||
if (candidate.augments) {
|
||||
ancestors = ancestors.concat(candidate.augments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// walk through all inheritDoc members
|
||||
for (j = incompletes.length - 1; j >= 0; --j) {
|
||||
incomplete = incompletes[j];
|
||||
candidates = lookup[doclet.longname + '#' + incomplete];
|
||||
if (candidates) {
|
||||
// get the incomplete doclet that needs to be augmented
|
||||
for (k = candidates.length - 1; k >= 0; --k) {
|
||||
incompleteDoclet = candidates[k];
|
||||
if (incompleteDoclet.inheritdoc) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// find the documented ancestor
|
||||
for (k = ancestors.length - 1; k >= 0; --k) {
|
||||
candidates = lookup[ancestors[k] + '#' + incomplete];
|
||||
if (candidates) {
|
||||
for (l = candidates.length - 1; l >= 0; --l) {
|
||||
candidate = candidates[l];
|
||||
if (candidate && !candidate.inheritdoc) {
|
||||
stability = candidate.stability || incompleteDoclet.stability
|
||||
if (stability) {
|
||||
incompleteDoclet.stability = stability;
|
||||
for (key in candidate) {
|
||||
if (candidate.hasOwnProperty(key) &&
|
||||
keepKeys.indexOf(key) == -1) {
|
||||
incompleteDoclet[key] = candidate[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
var util = require('util');
|
||||
exports.defineTags = function(dictionary) {
|
||||
|
||||
var classTag = dictionary.lookUp('class');
|
||||
dictionary.defineTag('interface', {
|
||||
mustHaveValue: false,
|
||||
onTagged: function(doclet, tag) {
|
||||
classTag.onTagged.apply(this, arguments);
|
||||
doclet.interface = true;
|
||||
}
|
||||
});
|
||||
|
||||
var augmentsTag = dictionary.lookUp('augments');
|
||||
dictionary.defineTag('implements', {
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
tag.value = tag.value.match(/^\{?([^\}]*)\}?$/)[1];
|
||||
augmentsTag.onTagged.apply(this, arguments);
|
||||
if (!doclet.implements) {
|
||||
doclet.implements = [];
|
||||
}
|
||||
doclet.implements.push(tag.value);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
var util = require('util');
|
||||
exports.defineTags = function(dictionary) {
|
||||
dictionary.defineTag('observable', {
|
||||
mustHaveValue: true,
|
||||
canHaveType: true,
|
||||
canHaveName: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
if (!doclet.observables) {
|
||||
doclet.observables = [];
|
||||
}
|
||||
var description = tag.value.description;
|
||||
var readonly = description.split(' ').shift() === 'readonly';
|
||||
if (readonly) {
|
||||
description = description.split(' ').slice(1).join(' ');
|
||||
}
|
||||
doclet.observables.push({
|
||||
name: tag.value.name,
|
||||
type: {
|
||||
names: tag.value.type.names
|
||||
},
|
||||
description: description,
|
||||
readonly: readonly
|
||||
});
|
||||
if (!doclet.fires) {
|
||||
doclet.fires = [];
|
||||
}
|
||||
if (doclet.fires.indexOf('{@link ol.ObjectEvent} ol.event:ObjectEvent') === -1) {
|
||||
doclet.fires.push('{@link ol.ObjectEvent} ol.event:ObjectEvent');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
var util = require('util');
|
||||
exports.defineTags = function(dictionary) {
|
||||
dictionary.defineTag('todo', {
|
||||
mustHaveValue: true,
|
||||
canHaveType: true,
|
||||
canHaveName: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
var parts = tag.text.split(' ');
|
||||
if (parts[0] === 'api') {
|
||||
doclet.stability = parts.slice(1).join(' ') || 'experimental';
|
||||
} else if (parts[0] === 'observable') {
|
||||
if (!doclet.observables) {
|
||||
doclet.observables = [];
|
||||
}
|
||||
var readonly = parts.length > 3 && parts[3] === 'readonly';
|
||||
var description = (readonly ? parts.slice(4) : parts.slice(3)).join(' ');
|
||||
doclet.observables.push({
|
||||
name: parts[1],
|
||||
type: {
|
||||
names: tag.value.type.names
|
||||
},
|
||||
description: description,
|
||||
readonly: readonly
|
||||
});
|
||||
if (!doclet.fires) {
|
||||
doclet.fires = [];
|
||||
}
|
||||
if (doclet.fires.indexOf('{@link ol.ObjectEvent} ol.event:ObjectEvent') === -1) {
|
||||
doclet.fires.push('{@link ol.ObjectEvent} ol.event:ObjectEvent');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Converts olx.js @type annotations into properties of the previous @typedef.
|
||||
* Changes @enum annotations into @typedef.
|
||||
*/
|
||||
|
||||
var lastOlxTypedef = null;
|
||||
var olxTypes = {};
|
||||
|
||||
function addSubparams(params) {
|
||||
for (var j = 0, jj = params.length; j < jj; ++j) {
|
||||
var param = params[j];
|
||||
var types = param.type.names;
|
||||
for (var k = 0, kk = types.length; k < kk; ++k) {
|
||||
var name = types[k];
|
||||
if (name in olxTypes) {
|
||||
param.subparams = olxTypes[name];
|
||||
// TODO Change template before recursing here, because the table gets
|
||||
// too wide.
|
||||
//addSubparams(param.subparams);
|
||||
// TODO Do we need to support multiple object literal types per
|
||||
// param?
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.handlers = {
|
||||
|
||||
newDoclet: function(e) {
|
||||
var doclet = e.doclet;
|
||||
if (doclet.meta.filename == 'olx.js') {
|
||||
if (doclet.kind == 'typedef') {
|
||||
lastOlxTypedef = doclet;
|
||||
olxTypes[doclet.longname] = [];
|
||||
doclet.properties = [];
|
||||
} else if (lastOlxTypedef && doclet.memberof == lastOlxTypedef.longname) {
|
||||
lastOlxTypedef.properties.push(doclet);
|
||||
olxTypes[lastOlxTypedef.longname].push(doclet);
|
||||
} else {
|
||||
lastOlxTypedef = null;
|
||||
}
|
||||
} else if (doclet.isEnum) {
|
||||
// We never export enums, so we document them like typedefs
|
||||
doclet.kind = 'typedef';
|
||||
delete doclet.isEnum;
|
||||
}
|
||||
},
|
||||
|
||||
parseComplete: function(e) {
|
||||
var doclets = e.doclets;
|
||||
for (var i = doclets.length - 1; i >= 0; --i) {
|
||||
var doclet = doclets[i];
|
||||
var params = doclet.params;
|
||||
if (params) {
|
||||
addSubparams(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,74 +0,0 @@
|
||||
# API Documentation
|
||||
|
||||
This directory contains configuration (`conf.json`), static content (`index.md`), template (`template/`) and plugins (`plugins/`) for the [JSDoc3](http://usejsdoc.org/) API generator.
|
||||
|
||||
## Documenting the source code
|
||||
|
||||
JSDoc annotations are used for metadata used by the compiler, for defining the user facing API, and for user documentation.
|
||||
|
||||
In the simplest case, a JSDoc block can look like this:
|
||||
```js
|
||||
/**
|
||||
* Add the given control to the map.
|
||||
* @param {ol.control.Control} control Control.
|
||||
* @todo api
|
||||
*/
|
||||
ol.Map.prototype.addControl = function(control) {
|
||||
// ...
|
||||
};
|
||||
```
|
||||
The first line is text for the user documentation. This can be long, and it can
|
||||
contain Markdown.
|
||||
|
||||
The second line tells the Closure compiler the type of the argument.
|
||||
|
||||
The third line (`@todo api`) marks the method as exportable. The stability can be added as value, e.g. `@todo api stable`. Once the documentation story is fully settled, we will remove the `todo ` and just write `@api` or `@api stable`. Without such an api note, the method will not be exported and not documented in the generated API documentation.
|
||||
|
||||
### Events
|
||||
|
||||
Events are documented using `@fires` and `@event` annotations:
|
||||
```js
|
||||
/**
|
||||
* Constants for event names.
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.MapBrowserEvent.EventType = {
|
||||
/**
|
||||
* A true single click with no dragging and no double click. Note that this
|
||||
* event is delayed by 250 ms to ensure that it is not a double click.
|
||||
* @event ol.MapBrowserEvent#singleclick
|
||||
* @todo api
|
||||
*/
|
||||
SINGLECLICK: 'singleclick',
|
||||
// ...
|
||||
};
|
||||
```
|
||||
Note the value of the `@event` annotation. The text before the hash refers to the event class that the event belongs to, and the text after the hash is the type of the event.
|
||||
|
||||
To export event properties, they need to be defined in `externs/oli.js` (also see `readme.md` in `externs/`) and marked with an @api annotation:
|
||||
```js
|
||||
/** @interface */
|
||||
oli.MapBrowserEvent;
|
||||
|
||||
/**
|
||||
* @type {ol.Coordinate}
|
||||
* @todo api
|
||||
*/
|
||||
oli.MapBrowserEvent.prototype.coordinate;
|
||||
|
||||
// ...
|
||||
|
||||
};
|
||||
```
|
||||
To document which events are fired by a class or method, the `@fires` annotation is used:
|
||||
```js
|
||||
* @fires {@link ol.MapBrowserEvent} ol.MapBrowserEvent
|
||||
* @fires {@link ol.MapEvent} ol.MapEvent
|
||||
* @fires {@link ol.render.Event} ol.render.Event
|
||||
* ...
|
||||
*/
|
||||
ol.Map = function(options) {
|
||||
// ...
|
||||
};
|
||||
```
|
||||
Again, note the syntax of the `@fires` annotation. The link is necessary to provide a link to the documentation of the event, and the name of the event class is necessary for JSDoc3 to know which event we are talking about.
|
||||
@@ -1 +0,0 @@
|
||||
The default template for JSDoc 3 uses: [the Taffy Database library](http://taffydb.com/) and the [Underscore Template library](http://documentcloud.github.com/underscore/#template).
|
||||
@@ -1,392 +0,0 @@
|
||||
/*global env: true */
|
||||
var template = require('jsdoc/template'),
|
||||
fs = require('jsdoc/fs'),
|
||||
path = require('jsdoc/path'),
|
||||
taffy = require('taffydb').taffy,
|
||||
helper = require('jsdoc/util/templateHelper'),
|
||||
scopeToPunc = helper.scopeToPunc,
|
||||
hasOwnProp = Object.prototype.hasOwnProperty,
|
||||
data,
|
||||
view,
|
||||
outdir = env.opts.destination;
|
||||
|
||||
|
||||
function find(spec) {
|
||||
return helper.find(data, spec);
|
||||
}
|
||||
|
||||
function tutoriallink(tutorial) {
|
||||
return helper.toTutorial(tutorial, null, { tag: 'em', classname: 'disabled', prefix: 'Tutorial: ' });
|
||||
}
|
||||
|
||||
function getAncestorLinks(doclet) {
|
||||
return helper.getAncestorLinks(data, doclet);
|
||||
}
|
||||
|
||||
var linkto = helper.linkto;
|
||||
|
||||
var htmlsafe = helper.htmlsafe;
|
||||
|
||||
function hashToLink(doclet, hash) {
|
||||
if ( !/^(#.+)/.test(hash) ) { return hash; }
|
||||
|
||||
var url = helper.createLink(doclet);
|
||||
|
||||
url = url.replace(/(#.+|$)/, hash);
|
||||
return '<a href="' + url + '">' + hash + '</a>';
|
||||
}
|
||||
|
||||
function addSignatureParams(f) {
|
||||
var params = helper.getSignatureParams(f, 'optional');
|
||||
|
||||
f.signature = (f.signature || '') + '('+params.join(', ')+')';
|
||||
}
|
||||
|
||||
function addSignatureReturns(f) {
|
||||
var returnTypes = helper.getSignatureReturns(f);
|
||||
|
||||
f.signature = '<span class="signature">'+(f.signature || '') + '</span>' + '<span class="type-signature">'+(returnTypes.length? ' → {'+returnTypes.join('|')+'}' : '')+'</span>';
|
||||
}
|
||||
|
||||
function addSignatureTypes(f) {
|
||||
var types = helper.getSignatureTypes(f);
|
||||
|
||||
f.signature = (f.signature || '') + '<span class="type-signature">'+(types.length? ' :'+types.join('|') : '')+'</span>';
|
||||
}
|
||||
|
||||
function addAttribs(f) {
|
||||
var attribs = helper.getAttribs(f);
|
||||
|
||||
f.attribs = '<span class="type-signature">'+htmlsafe(attribs.length? '<'+attribs.join(', ')+'> ' : '')+'</span>';
|
||||
}
|
||||
|
||||
function generate(title, docs, filename) {
|
||||
var docData = {
|
||||
title: title,
|
||||
docs: docs
|
||||
};
|
||||
|
||||
var outpath = path.join(outdir, filename),
|
||||
html = view.render('container.tmpl', docData);
|
||||
|
||||
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
||||
|
||||
fs.writeFileSync(outpath, html, 'utf8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the navigation sidebar.
|
||||
* @param {object} members The members that will be used to create the sidebar.
|
||||
* @param {array<object>} members.classes
|
||||
* @param {array<object>} members.externals
|
||||
* @param {array<object>} members.globals
|
||||
* @param {array<object>} members.mixins
|
||||
* @param {array<object>} members.modules
|
||||
* @param {array<object>} members.namespaces
|
||||
* @param {array<object>} members.tutorials
|
||||
* @return {string} The HTML for the navigation sidebar.
|
||||
*/
|
||||
function buildNav(members) {
|
||||
var nav = '<h2><a href="index.html">Index</a></h2>',
|
||||
seen = {};
|
||||
|
||||
/**
|
||||
* Sorts elements by their qualified names (property longname).
|
||||
* See https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort
|
||||
* @param {object} a
|
||||
* @param {object} b
|
||||
* @return {number}
|
||||
*/
|
||||
function byLongName(a, b){
|
||||
if(a.longname===b.longname){
|
||||
return 0;
|
||||
} else if(a.longname < b.longname){
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (members.modules.length) {
|
||||
nav += '<h3>Modules</h3><ul>';
|
||||
members.modules.sort(byLongName).forEach(function(m) {
|
||||
if ( !hasOwnProp.call(seen, m.longname) ) {
|
||||
nav += '<li>'+linkto(m.longname, m.longname)+'</li>';
|
||||
}
|
||||
seen[m.longname] = true;
|
||||
});
|
||||
|
||||
nav += '</ul>';
|
||||
}
|
||||
|
||||
if (members.externals.length) {
|
||||
nav += '<h3>Externals</h3><ul>';
|
||||
members.externals.sort(byLongName).forEach(function(e) {
|
||||
if ( !hasOwnProp.call(seen, e.longname) ) {
|
||||
nav += '<li>'+linkto( e.longname, e.name.replace(/(^"|"$)/g, '') )+'</li>';
|
||||
}
|
||||
seen[e.longname] = true;
|
||||
});
|
||||
|
||||
nav += '</ul>';
|
||||
}
|
||||
|
||||
if (members.classes.length) {
|
||||
var moduleClasses = 0;
|
||||
members.classes.sort(byLongName).forEach(function(c) {
|
||||
var moduleSameName = find({kind: 'module', longname: c.longname});
|
||||
if (moduleSameName.length) {
|
||||
c.name = c.name.replace('module:', 'require("')+'")';
|
||||
moduleClasses++;
|
||||
moduleSameName[0].module = c;
|
||||
}
|
||||
if (moduleClasses !== -1 && moduleClasses < members.classes.length) {
|
||||
nav += '<h3>Classes</h3><ul>';
|
||||
moduleClasses = -1;
|
||||
}
|
||||
if ( !hasOwnProp.call(seen, c.longname) ) {
|
||||
nav += '<li>'+linkto(c.longname, c.longname)+'</li>';
|
||||
}
|
||||
seen[c.longname] = true;
|
||||
});
|
||||
|
||||
nav += '</ul>';
|
||||
}
|
||||
|
||||
if (members.namespaces.length) {
|
||||
nav += '<h3>Namespaces</h3><ul>';
|
||||
members.namespaces.sort(byLongName).forEach(function(n) {
|
||||
if ( !hasOwnProp.call(seen, n.longname) ) {
|
||||
nav += '<li>'+linkto(n.longname, n.longname)+'</li>';
|
||||
}
|
||||
seen[n.longname] = true;
|
||||
});
|
||||
|
||||
nav += '</ul>';
|
||||
}
|
||||
|
||||
if (members.mixins.length) {
|
||||
nav += '<h3>Mixins</h3><ul>';
|
||||
members.mixins.sort(byLongName).forEach(function(m) {
|
||||
if ( !hasOwnProp.call(seen, m.longname) ) {
|
||||
nav += '<li>'+linkto(m.longname, m.longname)+'</li>';
|
||||
}
|
||||
seen[m.longname] = true;
|
||||
});
|
||||
|
||||
nav += '</ul>';
|
||||
}
|
||||
|
||||
if (members.tutorials.length) {
|
||||
nav += '<h3>Tutorials</h3><ul>';
|
||||
members.tutorials.sort(byLongName).forEach(function(t) {
|
||||
nav += '<li>'+tutoriallink(t.name)+'</li>';
|
||||
});
|
||||
|
||||
nav += '</ul>';
|
||||
}
|
||||
|
||||
if (members.globals.length) {
|
||||
nav += '<h3>Global</h3><ul>';
|
||||
members.globals.sort(byLongName).forEach(function(g) {
|
||||
if ( g.kind !== 'typedef' && !hasOwnProp.call(seen, g.longname) ) {
|
||||
nav += '<li>'+linkto(g.longname, g.longname)+'</li>';
|
||||
}
|
||||
seen[g.longname] = true;
|
||||
});
|
||||
|
||||
nav += '</ul>';
|
||||
}
|
||||
|
||||
return nav;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@param {TAFFY} taffyData See <http://taffydb.com/>.
|
||||
@param {object} opts
|
||||
@param {Tutorial} tutorials
|
||||
*/
|
||||
exports.publish = function(taffyData, opts, tutorials) {
|
||||
data = taffyData;
|
||||
|
||||
var templatePath = opts.template;
|
||||
view = new template.Template(templatePath + '/tmpl');
|
||||
|
||||
// set up templating
|
||||
view.layout = 'layout.tmpl';
|
||||
|
||||
// set up tutorials for helper
|
||||
helper.setTutorials(tutorials);
|
||||
|
||||
data = helper.prune(data);
|
||||
data.sort('longname, version, since');
|
||||
|
||||
data().each(function(doclet) {
|
||||
doclet.attribs = '';
|
||||
|
||||
if (doclet.examples) {
|
||||
doclet.examples = doclet.examples.map(function(example) {
|
||||
var caption, code;
|
||||
|
||||
if (example.match(/^\s*<caption>([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) {
|
||||
caption = RegExp.$1;
|
||||
code = RegExp.$3;
|
||||
}
|
||||
|
||||
return {
|
||||
caption: caption || '',
|
||||
code: code || example
|
||||
};
|
||||
});
|
||||
}
|
||||
if (doclet.see) {
|
||||
doclet.see.forEach(function(seeItem, i) {
|
||||
doclet.see[i] = hashToLink(doclet, seeItem);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// update outdir if necessary, then create outdir
|
||||
var packageInfo = ( find({kind: 'package'}) || [] ) [0];
|
||||
if (packageInfo && packageInfo.name) {
|
||||
outdir = path.join(outdir, packageInfo.name, packageInfo.version);
|
||||
}
|
||||
fs.mkPath(outdir);
|
||||
|
||||
// copy static files to outdir
|
||||
var fromDir = path.join(templatePath, 'static'),
|
||||
staticFiles = fs.ls(fromDir, 3);
|
||||
|
||||
staticFiles.forEach(function(fileName) {
|
||||
var toDir = fs.toDir( fileName.replace(fromDir, outdir) );
|
||||
fs.mkPath(toDir);
|
||||
fs.copyFileSync(fileName, toDir);
|
||||
});
|
||||
|
||||
data().each(function(doclet) {
|
||||
var url = helper.createLink(doclet);
|
||||
helper.registerLink(doclet.longname, url);
|
||||
});
|
||||
|
||||
data().each(function(doclet) {
|
||||
var url = helper.longnameToUrl[doclet.longname];
|
||||
|
||||
if (url.indexOf('#') > -1) {
|
||||
doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop();
|
||||
}
|
||||
else {
|
||||
doclet.id = doclet.name;
|
||||
}
|
||||
|
||||
if (doclet.kind === 'function' || doclet.kind === 'class') {
|
||||
addSignatureParams(doclet);
|
||||
addSignatureReturns(doclet);
|
||||
addAttribs(doclet);
|
||||
}
|
||||
});
|
||||
|
||||
// do this after the urls have all been generated
|
||||
data().each(function(doclet) {
|
||||
doclet.ancestors = getAncestorLinks(doclet);
|
||||
|
||||
doclet.signature = '';
|
||||
|
||||
if (doclet.kind === 'member') {
|
||||
addSignatureTypes(doclet);
|
||||
addAttribs(doclet);
|
||||
}
|
||||
|
||||
if (doclet.kind === 'constant') {
|
||||
addSignatureTypes(doclet);
|
||||
addAttribs(doclet);
|
||||
doclet.kind = 'member';
|
||||
}
|
||||
});
|
||||
|
||||
var members = helper.getMembers(data);
|
||||
members.tutorials = tutorials.children;
|
||||
|
||||
// add template helpers
|
||||
view.find = find;
|
||||
view.linkto = linkto;
|
||||
view.tutoriallink = tutoriallink;
|
||||
view.htmlsafe = htmlsafe;
|
||||
|
||||
// once for all
|
||||
view.nav = buildNav(members);
|
||||
|
||||
for (var longname in helper.longnameToUrl) {
|
||||
if ( hasOwnProp.call(helper.longnameToUrl, longname) ) {
|
||||
// reuse 'members', which speeds things up a bit
|
||||
var classes = taffy(members.classes);
|
||||
classes = helper.find(classes, {longname: longname});
|
||||
if (classes.length) {
|
||||
generate('Class: ' + classes[0].longname, classes, helper.longnameToUrl[longname]);
|
||||
}
|
||||
|
||||
var modules = taffy(members.modules);
|
||||
modules = helper.find(modules, {longname: longname});
|
||||
if (modules.length) {
|
||||
generate('Module: ' + modules[0].longname, modules, helper.longnameToUrl[longname]);
|
||||
}
|
||||
|
||||
var namespaces = taffy(members.namespaces);
|
||||
namespaces = helper.find(namespaces, {longname: longname});
|
||||
if (namespaces.length) {
|
||||
generate('Namespace: ' + namespaces[0].longname, namespaces, helper.longnameToUrl[longname]);
|
||||
}
|
||||
|
||||
var mixins = taffy(members.mixins);
|
||||
mixins = helper.find(mixins, {longname: longname});
|
||||
if (mixins.length) {
|
||||
generate('Mixin: ' + mixins[0].longname, mixins, helper.longnameToUrl[longname]);
|
||||
}
|
||||
|
||||
var externals = taffy(members.externals);
|
||||
externals = helper.find(externals, {longname: longname});
|
||||
if (externals.length) {
|
||||
generate('External: ' + externals[0].longname, externals, helper.longnameToUrl[longname]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (members.globals.length) { generate('Global', members.globals, 'global.html'); }
|
||||
|
||||
// index page displays information from package.json and lists files
|
||||
var files = find({kind: 'file'}),
|
||||
packages = find({kind: 'package'});
|
||||
|
||||
generate('Index',
|
||||
packages.concat(
|
||||
[{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}]
|
||||
).concat(files),
|
||||
'index.html');
|
||||
|
||||
// TODO: move the tutorial functions to templateHelper.js
|
||||
function generateTutorial(title, tutorial, filename) {
|
||||
var tutorialData = {
|
||||
title: title,
|
||||
header: tutorial.title,
|
||||
content: tutorial.parse(),
|
||||
children: tutorial.children
|
||||
};
|
||||
|
||||
var tutorialPath = path.join(outdir, filename),
|
||||
html = view.render('tutorial.tmpl', tutorialData);
|
||||
|
||||
// yes, you can use {@link} in tutorials too!
|
||||
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
||||
|
||||
fs.writeFileSync(tutorialPath, html, 'utf8');
|
||||
}
|
||||
|
||||
// tutorials can have only one parent so there is no risk for loops
|
||||
function saveChildren(node) {
|
||||
node.children.forEach(function(child) {
|
||||
generateTutorial('Tutorial: ' + child.title, child, helper.tutorialToUrl(child.name));
|
||||
saveChildren(child);
|
||||
});
|
||||
}
|
||||
saveChildren(tutorials);
|
||||
};
|
||||
@@ -1,164 +0,0 @@
|
||||
<?js
|
||||
var self = this;
|
||||
docs.forEach(function(doc, i) {
|
||||
?>
|
||||
|
||||
<?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>
|
||||
<?js= self.partial('mainpage.tmpl', doc) ?>
|
||||
<?js } else { ?>
|
||||
|
||||
<section>
|
||||
|
||||
<header>
|
||||
<h2><?js if (doc.ancestors && doc.ancestors.length) { ?>
|
||||
<span class="ancestors"><?js= doc.ancestors.join('') ?></span>
|
||||
<?js } ?>
|
||||
<?js= doc.longname ?>
|
||||
<?js if (doc.variation) { ?>
|
||||
<sup class="variation"><?js= doc.variation ?></sup>
|
||||
<?js } ?></h2>
|
||||
<?js if (doc.classdesc) { ?>
|
||||
<div class="class-description"><?js= doc.classdesc ?></div>
|
||||
<?js } ?>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="container-overview">
|
||||
<?js if (doc.kind === 'module' && doc.module) { ?>
|
||||
<?js= self.partial('method.tmpl', doc.module) ?>
|
||||
<?js } ?>
|
||||
<?js if (doc.kind === 'class' && !doc.hideConstructor && !doc.interface) { ?>
|
||||
<?js= self.partial('method.tmpl', doc) ?>
|
||||
<?js } else { ?>
|
||||
<?js if (doc.description) { ?>
|
||||
<div class="description"><?js= doc.description ?></div>
|
||||
<?js } ?>
|
||||
|
||||
<?js= self.partial('details.tmpl', doc) ?>
|
||||
|
||||
<?js if (doc.examples && doc.examples.length) { ?>
|
||||
<h3>Example<?js= doc.examples.length > 1? 's':'' ?></h3>
|
||||
<?js= self.partial('examples.tmpl', doc.examples) ?>
|
||||
<?js } ?>
|
||||
<?js } ?>
|
||||
</div>
|
||||
|
||||
<?js if (doc.augments && doc.augments.length) { ?>
|
||||
<h3 class="subsection-title">Extends</h3>
|
||||
|
||||
<ul><?js doc.augments.forEach(function(a) { ?>
|
||||
<li><?js= self.linkto(a, a) ?>
|
||||
<?js= (doc.implements&&doc.implements.indexOf(a)>-1?'(Interface)':'') ?></li>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (doc.mixes && doc.mixes.length) { ?>
|
||||
<h3 class="subsection-title">Mixes In</h3>
|
||||
|
||||
<ul><?js doc.mixes.forEach(function(a) { ?>
|
||||
<li><?js= self.linkto(a, a) ?></li>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (doc.requires && doc.requires.length) { ?>
|
||||
<h3 class="subsection-title">Requires</h3>
|
||||
|
||||
<ul><?js doc.requires.forEach(function(r) { ?>
|
||||
<li><?js= self.linkto(r, r) ?></li>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var classes = self.find({kind: 'class', memberof: doc.longname});
|
||||
if (doc.kind !== 'globalobj' && classes && classes.length) {
|
||||
?>
|
||||
<h3 class="subsection-title">Classes</h3>
|
||||
|
||||
<dl><?js classes.forEach(function(c) { ?>
|
||||
<dt><?js= self.linkto(c.longname, c.longname) ?></dt>
|
||||
<dd><?js if (c.summary) { ?><?js= c.summary ?><?js } ?></dd>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var namespaces = self.find({kind: 'namespace', memberof: doc.longname});
|
||||
if (doc.kind !== 'globalobj' && namespaces && namespaces.length) {
|
||||
?>
|
||||
<h3 class="subsection-title">Namespaces</h3>
|
||||
|
||||
<dl><?js namespaces.forEach(function(n) { ?>
|
||||
<dt><a href="namespaces.html#<?js= n.longname ?>"><?js= self.linkto(n.longname, n.longname) ?></a></dt>
|
||||
<dd><?js if (n.summary) { ?><?js= n.summary ?><?js } ?></dd>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var observables = doc.observables;
|
||||
if (observables && observables.length && observables.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Observable Properties</h3>
|
||||
<dl><?js= self.partial('observables.tmpl', observables) ?></dl>
|
||||
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var events = doc.events;
|
||||
if (events && events.length && events.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Events</h3>
|
||||
<?js if (observables && observables.length) { ?>
|
||||
<p>These events are available in addition to the <b>Observable Properties</b> events listed above.</p>
|
||||
<?js } ?>
|
||||
<dl><?js= self.partial('events.tmpl', events) ?></dl>
|
||||
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var members = self.find({kind: 'member', memberof: title === 'Globals'? {isUndefined: true} : doc.longname});
|
||||
if (members && members.length && members.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Members</h3>
|
||||
|
||||
<dl><?js members.forEach(function(p) { ?>
|
||||
<?js= self.partial('members.tmpl', p) ?>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var methods = self.find({kind: 'function', memberof: title === 'Globals'? {isUndefined: true} : doc.longname});
|
||||
if (methods && methods.length && methods.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Methods</h3>
|
||||
|
||||
<dl><?js methods.forEach(function(m) { ?>
|
||||
<?js= self.partial('method.tmpl', m) ?>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var typedefs = self.find({kind: 'typedef', memberof: doc.longname});
|
||||
if (typedefs && typedefs.length && typedefs.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">TypeDefs</h3>
|
||||
|
||||
<dl><?js typedefs.forEach(function(e) { ?>
|
||||
<?js= self.partial(e.params ? 'method.tmpl' : 'members.tmpl', e) ?>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var events = self.find({kind: 'event', memberof: doc.longname});
|
||||
if (events && events.length && events.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Events</h3>
|
||||
|
||||
<dl><?js events.forEach(function(e) { ?>
|
||||
<?js= self.partial('method.tmpl', e) ?>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
<?js } ?>
|
||||
|
||||
<?js }); ?>
|
||||
@@ -1,96 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
?>
|
||||
<dl class="details">
|
||||
<?js
|
||||
var properties = data.properties;
|
||||
if (properties && properties.length && properties.forEach) {
|
||||
?>
|
||||
|
||||
<h5 class="subsection-title">Properties:</h5>
|
||||
|
||||
<dl><?js= this.partial('properties.tmpl', properties) ?></dl>
|
||||
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.version) {?>
|
||||
<dt class="tag-version">Version:</dt>
|
||||
<dd class="tag-version"><ul class="dummy"><li><?js= version ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.since) {?>
|
||||
<dt class="tag-since">Since:</dt>
|
||||
<dd class="tag-since"><ul class="dummy"><li><?js= since ?></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.inherited && data.inherits) { ?>
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
<?js= this.linkto(data.inherits, this.htmlsafe(data.inherits)) ?>
|
||||
</li></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.deprecated) { ?>
|
||||
<dt class="important tag-deprecated">Deprecated:</dt><?js
|
||||
if (data.deprecated === true) { ?><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd><?js }
|
||||
else { ?><dd><ul class="dummy"><li><?js= data.deprecated ?></li><ul></dd><?js }
|
||||
?>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.author && author.length) {?>
|
||||
<dt class="tag-author">Author:</dt>
|
||||
<dd class="tag-author">
|
||||
<ul><?js author.forEach(function(a) { ?>
|
||||
<li><?js= a ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.copyright) {?>
|
||||
<dt class="tag-copyright">Copyright:</dt>
|
||||
<dd class="tag-copyright"><ul class="dummy"><li><?js= copyright ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.license) {?>
|
||||
<dt class="tag-license">License:</dt>
|
||||
<dd class="tag-license"><ul class="dummy"><li><?js= license ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.defaultvalue) {?>
|
||||
<dt class="tag-default">Default Value:</dt>
|
||||
<dd class="tag-default"><ul class="dummy"><li><?js= data.defaultvalue ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.meta) {?>
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li><?js= meta.filename ?>, line <?js= meta.lineno ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.tutorials && tutorials.length) {?>
|
||||
<dt class="tag-tutorial">Tutorials:</dt>
|
||||
<dd class="tag-tutorial">
|
||||
<ul><?js tutorials.forEach(function(t) { ?>
|
||||
<li><?js= self.tutoriallink(t) ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.see && see.length) {?>
|
||||
<dt class="tag-see">See:</dt>
|
||||
<dd class="tag-see">
|
||||
<ul><?js see.forEach(function(s) { ?>
|
||||
<li><?js= self.linkto(s) ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.todo && todo.length) {?>
|
||||
<dt class="tag-todo">To Do:</dt>
|
||||
<dd class="tag-todo">
|
||||
<ul><?js todo.forEach(function(t) { ?>
|
||||
<li><?js= t ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
</dl>
|
||||
@@ -1,2 +0,0 @@
|
||||
<?js var data = obj; ?>
|
||||
<pre><code><?js= data ?></code></pre>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
data.forEach(function(example) {
|
||||
if (example.caption) {
|
||||
?>
|
||||
<p class="code-caption"><?js= example.caption ?></p>
|
||||
<?js } ?>
|
||||
<pre class="prettyprint"><code><?js= example.code ?></code></pre>
|
||||
<?js
|
||||
});
|
||||
?>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
if (data.description) {
|
||||
?>
|
||||
<div class="param-desc">
|
||||
<?js= description ?>
|
||||
</div>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.type && data.type.names) {?>
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
<?js= this.partial('type.tmpl', data.type.names) ?>
|
||||
</dd>
|
||||
</dl>
|
||||
<?js } ?>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?js var data = obj; ?>
|
||||
<li>
|
||||
<?js= data ?>
|
||||
</li>
|
||||
@@ -1,46 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>OpenLayers 3 API Documentation - <?js= title ?></title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-jsdoc.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.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">
|
||||
<link type="text/css" rel="stylesheet" href="styles/ol.css">
|
||||
</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</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
<?js= content ?>
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<?js= this.nav ?>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3</a>
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
?>
|
||||
|
||||
<?js if (data.kind === 'package') { ?>
|
||||
<h3><?js= data.name ?> <?js= data.version ?></h3>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.readme) { ?>
|
||||
<section>
|
||||
<article><?js= data.readme ?></article>
|
||||
</section>
|
||||
<?js } ?>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?js var data = obj; ?>
|
||||
<dt class="<?js= data.access ?>">
|
||||
<h4 class="name" id="<?js= id ?>"><?js= data.attribs + name + data.signature ?></h4>
|
||||
|
||||
<?js= this.partial('stability.tmpl', data) ?>
|
||||
|
||||
<?js if (data.summary) { ?>
|
||||
<p class="summary"><?js= summary ?></p>
|
||||
<?js } ?>
|
||||
</dt>
|
||||
<dd class="<?js= data.access ?>">
|
||||
<?js if (data.description) { ?>
|
||||
<div class="description">
|
||||
<?js= data.description ?>
|
||||
</div>
|
||||
<?js } ?>
|
||||
|
||||
<?js= this.partial('details.tmpl', data) ?>
|
||||
|
||||
<?js if (data.examples && examples.length) { ?>
|
||||
<h5>Example<?js= examples.length > 1? 's':'' ?></h5>
|
||||
<?js= this.partial('examples.tmpl', examples) ?>
|
||||
<?js } ?>
|
||||
</dd>
|
||||
@@ -1,78 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
?>
|
||||
<dt>
|
||||
<h4 class="name" id="<?js= id ?>"><?js= data.attribs + (kind == 'class'? 'new ':'') + name + data.signature ?></h4>
|
||||
|
||||
<?js= this.partial('stability.tmpl', data) ?>
|
||||
|
||||
<?js if (data.summary) { ?>
|
||||
<p class="summary"><?js= summary ?></p>
|
||||
<?js } ?>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<?js if (data.description) { ?>
|
||||
<div class="description">
|
||||
<?js= data.description ?>
|
||||
</div>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (kind === 'event' && data.type && data.type.names) {?>
|
||||
<h5>Type:</h5>
|
||||
<ul>
|
||||
<li>
|
||||
<?js= self.partial('type.tmpl', data.type.names) ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data['this']) { ?>
|
||||
<h5>This:</h5>
|
||||
<ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.params && params.length) { ?>
|
||||
<h5>Parameters:</h5>
|
||||
<?js= this.partial('params.tmpl', params) ?>
|
||||
<?js } ?>
|
||||
|
||||
<?js= this.partial('details.tmpl', data) ?>
|
||||
|
||||
<?js if (data.fires && fires.length) { ?>
|
||||
<h5>Fires:</h5>
|
||||
<ul><?js fires.forEach(function(f) { ?>
|
||||
<?js= self.partial('fires.tmpl', self.linkto(f) ) ?>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.exceptions && exceptions.length) { ?>
|
||||
<h5>Throws:</h5>
|
||||
<?js if (exceptions.length > 1) { ?><ul><?js
|
||||
exceptions.forEach(function(r) { ?>
|
||||
<li><?js= self.partial('exceptions.tmpl', r) ?></li>
|
||||
<?js });
|
||||
?></ul><?js } else {
|
||||
exceptions.forEach(function(r) { ?>
|
||||
<?js= self.partial('exceptions.tmpl', r) ?>
|
||||
<?js });
|
||||
} } ?>
|
||||
|
||||
<?js if (data.returns && returns.length) { ?>
|
||||
<h5>Returns:</h5>
|
||||
<?js if (returns.length > 1) { ?><ul><?js
|
||||
returns.forEach(function(r) { ?>
|
||||
<li><?js= self.partial('returns.tmpl', r) ?></li>
|
||||
<?js });
|
||||
?></ul><?js } else {
|
||||
returns.forEach(function(r) { ?>
|
||||
<?js= self.partial('returns.tmpl', r) ?>
|
||||
<?js });
|
||||
} } ?>
|
||||
|
||||
<?js if (data.examples && examples.length) { ?>
|
||||
<h5>Example<?js= examples.length > 1? 's':'' ?></h5>
|
||||
<?js= this.partial('examples.tmpl', examples) ?>
|
||||
<?js } ?>
|
||||
</dd>
|
||||
@@ -1,37 +0,0 @@
|
||||
<?js
|
||||
var props = obj;
|
||||
?>
|
||||
|
||||
<table class="props">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Settable</th>
|
||||
<th><a href="ol.ObjectEvent.html">ol.ObjectEvent</a> type</th>
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?js
|
||||
var self = this;
|
||||
props.forEach(function(prop) {
|
||||
if (!prop) { return; }
|
||||
var setter = prop.readonly ? 'no' : 'yes';
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td class="name"><code><?js= prop.name ?></code></td>
|
||||
<td class="type">
|
||||
<?js if (prop.type && prop.type.names) {?>
|
||||
<?js= self.partial('type.tmpl', prop.type.names) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<td class="setter"><?js= setter ?></td>
|
||||
<td class="event"><code>change:<?js= prop.name.toLowerCase() ?></code></td>
|
||||
<td class="description last"><?js= prop.description ?></td>
|
||||
</tr>
|
||||
<?js }); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1,108 +0,0 @@
|
||||
<?js
|
||||
var params = obj;
|
||||
|
||||
/* sort subparams under their parent params (like opts.classname) */
|
||||
var parentParam = null;
|
||||
params.forEach(function(param, i) {
|
||||
if (!param) { return; }
|
||||
if ( parentParam && param.name && param.name.indexOf(parentParam.name + '.') === 0 ) {
|
||||
param.name = param.name.substr(parentParam.name.length+1);
|
||||
parentParam.subparams = parentParam.subparams || [];
|
||||
parentParam.subparams.push(param);
|
||||
params[i] = null;
|
||||
}
|
||||
else {
|
||||
parentParam = param;
|
||||
}
|
||||
});
|
||||
|
||||
/* determine if we need extra columns, "attributes" and "default" */
|
||||
params.hasAttributes = false;
|
||||
params.hasDefault = false;
|
||||
params.hasName = false;
|
||||
|
||||
params.forEach(function(param) {
|
||||
if (!param) { return; }
|
||||
|
||||
if (param.optional || param.nullable) {
|
||||
params.hasAttributes = true;
|
||||
}
|
||||
|
||||
if (param.name) {
|
||||
params.hasName = true;
|
||||
}
|
||||
|
||||
if (typeof param.defaultvalue !== 'undefined') {
|
||||
params.hasDefault = true;
|
||||
}
|
||||
});
|
||||
?>
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<?js if (params.hasName) {?>
|
||||
<th>Name</th>
|
||||
<?js } ?>
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
<?js if (params.hasAttributes) {?>
|
||||
<th>Argument</th>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (params.hasDefault) {?>
|
||||
<th>Default</th>
|
||||
<?js } ?>
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?js
|
||||
var self = this;
|
||||
params.forEach(function(param) {
|
||||
if (!param) { return; }
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<?js if (params.hasName) {?>
|
||||
<td class="name"><code><?js= param.name.replace(/^opt_/, "") ?></code></td>
|
||||
<?js } ?>
|
||||
|
||||
<td class="type">
|
||||
<?js if (param.type && param.type.names) {?>
|
||||
<?js= self.partial('type.tmpl', param.type.names) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
|
||||
<?js if (params.hasAttributes) {?>
|
||||
<td class="attributes">
|
||||
<?js if (param.optional) { ?>
|
||||
<optional><br>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (param.nullable) { ?>
|
||||
<nullable><br>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (params.hasDefault) {?>
|
||||
<td class="default">
|
||||
<?js if (typeof param.defaultvalue !== 'undefined') { ?>
|
||||
<?js= self.htmlsafe(param.defaultvalue) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<?js } ?>
|
||||
|
||||
<td class="description last"><?js= param.description ?><?js if (param.subparams) { ?>
|
||||
<h6>Properties</h6>
|
||||
<?js= self.partial('params.tmpl', param.subparams) ?>
|
||||
<?js } ?></td>
|
||||
</tr>
|
||||
|
||||
<?js }); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1,107 +0,0 @@
|
||||
<?js
|
||||
var props = obj;
|
||||
|
||||
/* sort subprops under their parent props (like opts.classname) */
|
||||
var parentProp = null;
|
||||
props.forEach(function(prop, i) {
|
||||
if (!prop) { return; }
|
||||
if ( parentProp && prop.name.indexOf(parentProp.name + '.') === 0 ) {
|
||||
prop.name = prop.name.substr(parentProp.name.length+1);
|
||||
parentProp.subprops = parentProp.subprops || [];
|
||||
parentProp.subprops.push(prop);
|
||||
props[i] = null;
|
||||
}
|
||||
else {
|
||||
parentProp = prop;
|
||||
}
|
||||
});
|
||||
|
||||
/* determine if we need extra columns, "attributes" and "default" */
|
||||
props.hasAttributes = false;
|
||||
props.hasDefault = false;
|
||||
props.hasName = false;
|
||||
|
||||
props.forEach(function(prop) {
|
||||
if (!prop) { return; }
|
||||
|
||||
if (prop.optional || prop.nullable) {
|
||||
props.hasAttributes = true;
|
||||
}
|
||||
|
||||
if (prop.name) {
|
||||
props.hasName = true;
|
||||
}
|
||||
|
||||
if (typeof prop.defaultvalue !== 'undefined') {
|
||||
props.hasDefault = true;
|
||||
}
|
||||
});
|
||||
?>
|
||||
|
||||
<table class="props">
|
||||
<thead>
|
||||
<tr>
|
||||
<?js if (props.hasName) {?>
|
||||
<th>Name</th>
|
||||
<?js } ?>
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
<?js if (props.hasAttributes) {?>
|
||||
<th>Argument</th>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (props.hasDefault) {?>
|
||||
<th>Default</th>
|
||||
<?js } ?>
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?js
|
||||
var self = this;
|
||||
props.forEach(function(prop) {
|
||||
if (!prop) { return; }
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<?js if (props.hasName) {?>
|
||||
<td class="name"><code><?js= prop.name ?></code></td>
|
||||
<?js } ?>
|
||||
|
||||
<td class="type">
|
||||
<?js if (prop.type && prop.type.names) {?>
|
||||
<?js= self.partial('type.tmpl', prop.type.names) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
|
||||
<?js if (props.hasAttributes) {?>
|
||||
<td class="attributes">
|
||||
<?js if (prop.optional) { ?>
|
||||
<optional><br>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (prop.nullable) { ?>
|
||||
<nullable><br>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (props.hasDefault) {?>
|
||||
<td class="default">
|
||||
<?js if (typeof prop.defaultvalue !== 'undefined') { ?>
|
||||
<?js= self.htmlsafe(prop.defaultvalue) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<?js } ?>
|
||||
|
||||
<td class="description last"><?js= prop.description ?><?js if (prop.subprops) { ?>
|
||||
<h6>Properties</h6><?js= self.partial('properties.tmpl', prop.subprops) ?>
|
||||
<?js } ?></td>
|
||||
</tr>
|
||||
|
||||
<?js }); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
if (data.description) {
|
||||
?>
|
||||
<div class="param-desc">
|
||||
<?js= description ?>
|
||||
</div>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.type && data.type.names) {?>
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
<?js= this.partial('type.tmpl', data.type.names) ?>
|
||||
</dd>
|
||||
</dl>
|
||||
<?js } ?>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
?>
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source"><code><?js= data.code ?></code></pre>
|
||||
</article>
|
||||
</section>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
|
||||
if (data.stability) { ?>
|
||||
<div class="stability stability-<?js= stability ?>">Stability: <?js= data.stability ?></div>
|
||||
<?js } else { ?>
|
||||
<div class="stability">Stability: not documented</div>
|
||||
<?js } ?>
|
||||
@@ -1,19 +0,0 @@
|
||||
<section>
|
||||
|
||||
<header>
|
||||
<?js if (children.length > 0) { ?>
|
||||
<ul><?js
|
||||
var self = this;
|
||||
children.forEach(function(t) { ?>
|
||||
<li><?js= self.tutoriallink(t.name) ?></li>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<h2><?js= header ?></h2>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<?js= content ?>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
data.forEach(function(name, i) { ?>
|
||||
<span class="param-type"><?js= self.linkto(name, self.htmlsafe(name)) ?></span>
|
||||
<?js if (i < data.length-1) { ?>|<?js } ?>
|
||||
<?js }); ?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// A PhantomJS script used to check that the hosted examples load
|
||||
// without errors. This script is executed by the build tool's
|
||||
// check-examples target.
|
||||
//
|
||||
var args = require('system').args;
|
||||
if (args.length != 2) {
|
||||
phantom.exit(2);
|
||||
}
|
||||
var examplePath = args[1];
|
||||
var page = require('webpage').create();
|
||||
page.onError = function(msg, trace) {
|
||||
var msgStack = ['JavaScript ERROR: ' + msg];
|
||||
if (trace) {
|
||||
msgStack.push('TRACE:');
|
||||
trace.forEach(function(t) {
|
||||
msgStack.push(' -> ' + t.file + ': ' + t.line + (t.function ? ' (in function "' + t.function + '")' : ''));
|
||||
});
|
||||
}
|
||||
console.error(msgStack.join('\n'));
|
||||
phantom.exit(1);
|
||||
};
|
||||
page.open(examplePath, function(s) {
|
||||
var exitCode = 0;
|
||||
if (s != 'success') {
|
||||
exitCode = 1;
|
||||
console.error('PAGE LOAD ERROR');
|
||||
}
|
||||
phantom.exit(exitCode);
|
||||
});
|
||||
@@ -1,202 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2009 The Closure Library Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
"""Generates out a Closure deps.js file given a list of JavaScript sources.
|
||||
|
||||
Paths can be specified as arguments or (more commonly) specifying trees
|
||||
with the flags (call with --help for descriptions).
|
||||
|
||||
Usage: depswriter.py [path/to/js1.js [path/to/js2.js] ...]
|
||||
"""
|
||||
|
||||
import logging
|
||||
import optparse
|
||||
import os
|
||||
import posixpath
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
import source
|
||||
import treescan
|
||||
|
||||
|
||||
__author__ = 'nnaze@google.com (Nathan Naze)'
|
||||
|
||||
|
||||
def MakeDepsFile(source_map):
|
||||
"""Make a generated deps file.
|
||||
|
||||
Args:
|
||||
source_map: A dict map of the source path to source.Source object.
|
||||
|
||||
Returns:
|
||||
str, A generated deps file source.
|
||||
"""
|
||||
|
||||
# Write in path alphabetical order
|
||||
paths = sorted(source_map.keys())
|
||||
|
||||
lines = []
|
||||
|
||||
for path in paths:
|
||||
js_source = source_map[path]
|
||||
|
||||
# We don't need to add entries that don't provide anything.
|
||||
if js_source.provides:
|
||||
lines.append(_GetDepsLine(path, js_source))
|
||||
|
||||
return ''.join(lines)
|
||||
|
||||
|
||||
def _GetDepsLine(path, js_source):
|
||||
"""Get a deps.js file string for a source."""
|
||||
|
||||
provides = sorted(js_source.provides)
|
||||
requires = sorted(js_source.requires)
|
||||
|
||||
return 'goog.addDependency(\'%s\', %s, %s);\n' % (path, provides, requires)
|
||||
|
||||
|
||||
def _GetOptionsParser():
|
||||
"""Get the options parser."""
|
||||
|
||||
parser = optparse.OptionParser(__doc__)
|
||||
|
||||
parser.add_option('--output_file',
|
||||
dest='output_file',
|
||||
action='store',
|
||||
help=('If specified, write output to this path instead of '
|
||||
'writing to standard output.'))
|
||||
parser.add_option('--root',
|
||||
dest='roots',
|
||||
default=[],
|
||||
action='append',
|
||||
help='A root directory to scan for JS source files. '
|
||||
'Paths of JS files in generated deps file will be '
|
||||
'relative to this path. This flag may be specified '
|
||||
'multiple times.')
|
||||
parser.add_option('--root_with_prefix',
|
||||
dest='roots_with_prefix',
|
||||
default=[],
|
||||
action='append',
|
||||
help='A root directory to scan for JS source files, plus '
|
||||
'a prefix (if either contains a space, surround with '
|
||||
'quotes). Paths in generated deps file will be relative '
|
||||
'to the root, but preceded by the prefix. This flag '
|
||||
'may be specified multiple times.')
|
||||
parser.add_option('--path_with_depspath',
|
||||
dest='paths_with_depspath',
|
||||
default=[],
|
||||
action='append',
|
||||
help='A path to a source file and an alternate path to '
|
||||
'the file in the generated deps file (if either contains '
|
||||
'a space, surround with whitespace). This flag may be '
|
||||
'specified multiple times.')
|
||||
return parser
|
||||
|
||||
|
||||
def _NormalizePathSeparators(path):
|
||||
"""Replaces OS-specific path separators with POSIX-style slashes.
|
||||
|
||||
Args:
|
||||
path: str, A file path.
|
||||
|
||||
Returns:
|
||||
str, The path with any OS-specific path separators (such as backslash on
|
||||
Windows) replaced with URL-compatible forward slashes. A no-op on systems
|
||||
that use POSIX paths.
|
||||
"""
|
||||
return path.replace(os.sep, posixpath.sep)
|
||||
|
||||
|
||||
def _GetRelativePathToSourceDict(root, prefix=''):
|
||||
"""Scans a top root directory for .js sources.
|
||||
|
||||
Args:
|
||||
root: str, Root directory.
|
||||
prefix: str, Prefix for returned paths.
|
||||
|
||||
Returns:
|
||||
dict, A map of relative paths (with prefix, if given), to source.Source
|
||||
objects.
|
||||
"""
|
||||
# Remember and restore the cwd when we're done. We work from the root so
|
||||
# that paths are relative from the root.
|
||||
start_wd = os.getcwd()
|
||||
os.chdir(root)
|
||||
|
||||
path_to_source = {}
|
||||
for path in treescan.ScanTreeForJsFiles('.'):
|
||||
prefixed_path = _NormalizePathSeparators(os.path.join(prefix, path))
|
||||
path_to_source[prefixed_path] = source.Source(source.GetFileContents(path))
|
||||
|
||||
os.chdir(start_wd)
|
||||
|
||||
return path_to_source
|
||||
|
||||
|
||||
def _GetPair(s):
|
||||
"""Return a string as a shell-parsed tuple. Two values expected."""
|
||||
try:
|
||||
# shlex uses '\' as an escape character, so they must be escaped.
|
||||
s = s.replace('\\', '\\\\')
|
||||
first, second = shlex.split(s)
|
||||
return (first, second)
|
||||
except:
|
||||
raise Exception('Unable to parse input line as a pair: %s' % s)
|
||||
|
||||
|
||||
def main():
|
||||
"""CLI frontend to MakeDepsFile."""
|
||||
logging.basicConfig(format=(sys.argv[0] + ': %(message)s'),
|
||||
level=logging.INFO)
|
||||
options, args = _GetOptionsParser().parse_args()
|
||||
|
||||
path_to_source = {}
|
||||
|
||||
# Roots without prefixes
|
||||
for root in options.roots:
|
||||
path_to_source.update(_GetRelativePathToSourceDict(root))
|
||||
|
||||
# Roots with prefixes
|
||||
for root_and_prefix in options.roots_with_prefix:
|
||||
root, prefix = _GetPair(root_and_prefix)
|
||||
path_to_source.update(_GetRelativePathToSourceDict(root, prefix=prefix))
|
||||
|
||||
# Source paths
|
||||
for path in args:
|
||||
path_to_source[path] = source.Source(source.GetFileContents(path))
|
||||
|
||||
# Source paths with alternate deps paths
|
||||
for path_with_depspath in options.paths_with_depspath:
|
||||
srcpath, depspath = _GetPair(path_with_depspath)
|
||||
path_to_source[depspath] = source.Source(source.GetFileContents(srcpath))
|
||||
|
||||
# Make our output pipe.
|
||||
if options.output_file:
|
||||
out = open(options.output_file, 'w')
|
||||
else:
|
||||
out = sys.stdout
|
||||
|
||||
out.write('// This file was autogenerated by %s.\n' % sys.argv[0])
|
||||
out.write('// Please do not edit.\n')
|
||||
|
||||
out.write(MakeDepsFile(path_to_source))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,114 +0,0 @@
|
||||
# Copyright 2009 The Closure Library Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
"""Scans a source JS file for its provided and required namespaces.
|
||||
|
||||
Simple class to scan a JavaScript file and express its dependencies.
|
||||
"""
|
||||
|
||||
__author__ = 'nnaze@google.com'
|
||||
|
||||
|
||||
import re
|
||||
|
||||
_BASE_REGEX_STRING = '^\s*goog\.%s\(\s*[\'"](.+)[\'"]\s*\)'
|
||||
_PROVIDE_REGEX = re.compile(_BASE_REGEX_STRING % 'provide')
|
||||
_REQUIRES_REGEX = re.compile(_BASE_REGEX_STRING % 'require')
|
||||
|
||||
# This line identifies base.js and should match the line in that file.
|
||||
_GOOG_BASE_LINE = (
|
||||
'var goog = goog || {}; // Identifies this file as the Closure base.')
|
||||
|
||||
|
||||
class Source(object):
|
||||
"""Scans a JavaScript source for its provided and required namespaces."""
|
||||
|
||||
# Matches a "/* ... */" comment.
|
||||
# Note: We can't definitively distinguish a "/*" in a string literal without a
|
||||
# state machine tokenizer. We'll assume that a line starting with whitespace
|
||||
# and "/*" is a comment.
|
||||
_COMMENT_REGEX = re.compile(
|
||||
r"""
|
||||
^\s* # Start of a new line and whitespace
|
||||
/\* # Opening "/*"
|
||||
.*? # Non greedy match of any characters (including newlines)
|
||||
\*/ # Closing "*/""",
|
||||
re.MULTILINE | re.DOTALL | re.VERBOSE)
|
||||
|
||||
def __init__(self, source):
|
||||
"""Initialize a source.
|
||||
|
||||
Args:
|
||||
source: str, The JavaScript source.
|
||||
"""
|
||||
|
||||
self.provides = set()
|
||||
self.requires = set()
|
||||
|
||||
self._source = source
|
||||
self._ScanSource()
|
||||
|
||||
def __str__(self):
|
||||
return 'Source %s' % self._path
|
||||
|
||||
def GetSource(self):
|
||||
"""Get the source as a string."""
|
||||
return self._source
|
||||
|
||||
@classmethod
|
||||
def _StripComments(cls, source):
|
||||
return cls._COMMENT_REGEX.sub('', source)
|
||||
|
||||
def _ScanSource(self):
|
||||
"""Fill in provides and requires by scanning the source."""
|
||||
|
||||
source = self._StripComments(self.GetSource())
|
||||
|
||||
source_lines = source.splitlines()
|
||||
for line in source_lines:
|
||||
match = _PROVIDE_REGEX.match(line)
|
||||
if match:
|
||||
self.provides.add(match.group(1))
|
||||
match = _REQUIRES_REGEX.match(line)
|
||||
if match:
|
||||
self.requires.add(match.group(1))
|
||||
|
||||
# Closure's base file implicitly provides 'goog'.
|
||||
for line in source_lines:
|
||||
if line == _GOOG_BASE_LINE:
|
||||
if len(self.provides) or len(self.requires):
|
||||
raise Exception(
|
||||
'Base files should not provide or require namespaces.')
|
||||
self.provides.add('goog')
|
||||
|
||||
|
||||
def GetFileContents(path):
|
||||
"""Get a file's contents as a string.
|
||||
|
||||
Args:
|
||||
path: str, Path to file.
|
||||
|
||||
Returns:
|
||||
str, Contents of file.
|
||||
|
||||
Raises:
|
||||
IOError: An error occurred opening or reading the file.
|
||||
|
||||
"""
|
||||
fileobj = open(path)
|
||||
try:
|
||||
return fileobj.read()
|
||||
finally:
|
||||
fileobj.close()
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def main(argv):
|
||||
examples = {}
|
||||
requires = set()
|
||||
for filename in argv[1:]:
|
||||
lines = open(filename, 'rU').readlines()
|
||||
if len(lines) > 0 and lines[0].startswith('// NOCOMPILE'):
|
||||
continue
|
||||
requires.update(line for line in lines if line.startswith('goog.require'))
|
||||
examples[filename] = [line for line in lines if not line.startswith('goog.require')]
|
||||
for require in sorted(requires):
|
||||
sys.stdout.write(require)
|
||||
for filename in sorted(examples.keys()):
|
||||
sys.stdout.write('// ' + filename + '\n')
|
||||
sys.stdout.write('(function(){\n')
|
||||
for line in examples[filename]:
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.write('})();\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -1,180 +0,0 @@
|
||||
|
||||
|
||||
/**
|
||||
* This script is supposed to be executed via phantomjs. It will generate
|
||||
* screenshots of the html files in the directory specified by a commandline
|
||||
* option when these files are served through a webserver which can also be
|
||||
* specified. The screenshots will be in the current working directory.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* user@host:~/ol3/bin $ phantomjs example-screenshot.js \
|
||||
* http://localhost:8000/ol3/examples/ \
|
||||
* ../examples
|
||||
*
|
||||
* The above command will generate `*.png` files in `examples/` for all html
|
||||
* files that are served through `http://localhost:8000/ol3/examples/`.
|
||||
*
|
||||
* So if there is a file `my-humpty-example.html` inside of the relative folder
|
||||
* `../examples/` which is being served through the webserver so that
|
||||
* `http://localhost:8000/ol3/examples/my-humpty-example.html` is a valid and
|
||||
* reachable URL, this script will generate a screenshot and store it as
|
||||
* `my-humpty-example.html.png`.
|
||||
*
|
||||
* The query string `?mode=raw` will be appended to the generated URL.
|
||||
*
|
||||
* Known limitations:
|
||||
*
|
||||
* As phantomjs doesn't support WebGL (see e.g.
|
||||
* https://github.com/ariya/phantomjs/wiki/Supported-Web-Standards and
|
||||
* http://code.google.com/p/phantomjs/issues/detail?id=273) This won't render
|
||||
* OpenLayers maps rendered through the webglrenderer.
|
||||
*
|
||||
* In parts based upon this gist: https://gist.github.com/crazy4groovy/3160121
|
||||
*/
|
||||
(function() { // global closure
|
||||
|
||||
var page = require('webpage').create(), // imports
|
||||
fs = require('fs'),
|
||||
system = require('system'),
|
||||
// arguments
|
||||
baseExamplesUrl = system.args[1],
|
||||
exampleDir = system.args[2],
|
||||
// various settings
|
||||
ignoreFiles = [
|
||||
'index.html'
|
||||
],
|
||||
intervalMillisecs = 25,
|
||||
renderMillisecs = 2000,
|
||||
// basic variables
|
||||
curDir = fs.workingDirectory,
|
||||
exampleDirList = fs.list(exampleDir),
|
||||
pageindex = 0,
|
||||
fileName = '',
|
||||
htmlFiles = [],
|
||||
lenHtmlFiles = 0,
|
||||
loadInProgress = false;
|
||||
|
||||
// simple object with helper functions
|
||||
var util = {
|
||||
/**
|
||||
* Returns the basename of a file given a path.
|
||||
*/
|
||||
baseName: function(path) {
|
||||
var parts = path.split(fs.separator);
|
||||
return parts[parts.length - 1];
|
||||
},
|
||||
/**
|
||||
* Super basic test whether a file can be considered a HTML-file.
|
||||
*/
|
||||
isHtmlFile: function(filename) {
|
||||
return (/\.html?$/).test(filename);
|
||||
},
|
||||
/**
|
||||
* Appends a slash to given string if it isn't there already.
|
||||
*/
|
||||
appendSlash: function(str) {
|
||||
return ((/\/$/).test(str)) ? str : str + '/';
|
||||
},
|
||||
/**
|
||||
* Generates an URL out of given baseurl and path.
|
||||
*/
|
||||
buildUrl: function(baseurl, path) {
|
||||
var name = util.baseName(path),
|
||||
mode = 'raw';
|
||||
return util.appendSlash(baseurl) + name + '?mode=' + mode;
|
||||
},
|
||||
/**
|
||||
* Simple progressbar logger that uses our globals pageindex & lenHtmlFiles.
|
||||
*/
|
||||
logProgress: function() {
|
||||
var doneSymbol = '-',
|
||||
todoSymbol = ' ',
|
||||
currentSymbol = '>',
|
||||
barStrLeft = '[',
|
||||
barStrRight = ']',
|
||||
progresStep = 5, // one doneSymbol equals this percentage
|
||||
totalSteps = Math.round(100 / progresStep),
|
||||
ratio = (lenHtmlFiles === 0) ? 0 : (pageindex / lenHtmlFiles),
|
||||
percent = (ratio === 0) ? 0 : ratio * 100,
|
||||
normalizedNumDone = Math.floor(ratio * totalSteps),
|
||||
normalizedNumTodo = totalSteps - normalizedNumDone,
|
||||
progressLine = '',
|
||||
i = 0;
|
||||
// the progress bar
|
||||
progressLine += barStrLeft;
|
||||
for (; i < normalizedNumDone; i++) {
|
||||
progressLine += doneSymbol;
|
||||
}
|
||||
for (i = 0; i < normalizedNumTodo; i++) {
|
||||
progressLine += (i === 0) ? currentSymbol : todoSymbol;
|
||||
}
|
||||
progressLine += barStrRight;
|
||||
// the percentage information
|
||||
// pad if necessary
|
||||
if (percent < 10) {
|
||||
progressLine += ' ';
|
||||
} else if (percent < 100) {
|
||||
progressLine += ' ';
|
||||
}
|
||||
progressLine += ' ' + percent.toFixed(1) + ' % done';
|
||||
// additional information
|
||||
if (fileName !== '') {
|
||||
progressLine += ', ' + util.baseName(fileName) + '';
|
||||
}
|
||||
console.log(progressLine);
|
||||
}
|
||||
};
|
||||
|
||||
// iterate over all files in examples directory
|
||||
// and find the HTML files.
|
||||
for (var i = 0; i < exampleDirList.length; i++) {
|
||||
var fullpath = exampleDir + fs.separator + exampleDirList[i];
|
||||
if (fs.isFile(fullpath) && util.isHtmlFile(fullpath) &&
|
||||
ignoreFiles.indexOf(util.baseName(fullpath)) === -1) {
|
||||
//TODO: make this more async (i.e. pop on/off stack WHILE rending pages)
|
||||
htmlFiles.push(fullpath);
|
||||
}
|
||||
}
|
||||
lenHtmlFiles = htmlFiles.length;
|
||||
|
||||
console.log('Capturing ' + lenHtmlFiles + ' example screenshots.');
|
||||
|
||||
// The main interval function that is executed regularily and renders a
|
||||
// page to a file
|
||||
var interval = setInterval(function() {
|
||||
if (!loadInProgress && pageindex < lenHtmlFiles) {
|
||||
util.logProgress();
|
||||
fileName = htmlFiles[pageindex];
|
||||
page.viewportSize = { width: 800, height: 600 };
|
||||
page.clipRect = {
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: page.viewportSize.width,
|
||||
height: page.viewportSize.height
|
||||
};
|
||||
page.open(util.buildUrl(baseExamplesUrl, htmlFiles[pageindex]));
|
||||
}
|
||||
if (pageindex == lenHtmlFiles) {
|
||||
util.logProgress();
|
||||
console.log(lenHtmlFiles + ' screenshots captured.');
|
||||
phantom.exit();
|
||||
}
|
||||
}, intervalMillisecs);
|
||||
|
||||
// set loadInProgress flag so we only process one image at time.
|
||||
page.onLoadStarted = function() {
|
||||
loadInProgress = true;
|
||||
};
|
||||
|
||||
// When the page is loaded, render it to an image
|
||||
page.onLoadFinished = function() {
|
||||
var dest = exampleDir + fs.separator + util.baseName(fileName) + '.png';
|
||||
window.setTimeout(function() {
|
||||
loadInProgress = false;
|
||||
page.render(dest); // actually render the page.
|
||||
pageindex++;
|
||||
}, renderMillisecs);
|
||||
};
|
||||
|
||||
})(); // eof global closure
|
||||
@@ -1,269 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
from xml.dom.minidom import Document
|
||||
|
||||
try:
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
except ImportError:
|
||||
try:
|
||||
import cElementTree as ElementTree # NOQA
|
||||
except ImportError:
|
||||
try:
|
||||
import elementtree.ElementTree as ElementTree # NOQA
|
||||
except ImportError:
|
||||
import lxml.etree as ElementTree # NOQA
|
||||
|
||||
missing_deps = False
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
try:
|
||||
import simplejson as json # NOQA
|
||||
except ImportError, E:
|
||||
missing_deps = E
|
||||
|
||||
try:
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
except ImportError, E:
|
||||
missing_deps = E
|
||||
|
||||
feedName = "example-list.xml"
|
||||
feedPath = "http://openlayers.github.io/ol3/master/examples/"
|
||||
|
||||
|
||||
def getListOfExamples(relPath):
|
||||
"""
|
||||
returns list of .html filenames within a given path - excludes
|
||||
index.html
|
||||
"""
|
||||
examples = os.listdir(relPath)
|
||||
examples = [example for example in examples if
|
||||
example.endswith('.html') and example != "index.html"]
|
||||
return examples
|
||||
|
||||
|
||||
def getExampleHtml(path):
|
||||
"""
|
||||
returns html of a specific example
|
||||
"""
|
||||
print '.',
|
||||
f = open(path)
|
||||
html = f.read()
|
||||
f.close()
|
||||
return html
|
||||
|
||||
|
||||
def extractById(soup, tagId, value=None):
|
||||
"""
|
||||
returns full contents of a particular tag id
|
||||
"""
|
||||
beautifulTag = soup.find(id=tagId)
|
||||
if beautifulTag:
|
||||
if beautifulTag.contents:
|
||||
value = str(beautifulTag.renderContents()).strip()
|
||||
value = value.replace('\t', '')
|
||||
value = value.replace('\n', '')
|
||||
return value
|
||||
|
||||
|
||||
def getRelatedClasses(html):
|
||||
"""
|
||||
parses the html, and returns a list of all OpenLayers Classes
|
||||
used within (ie what parts of OL the javascript uses).
|
||||
"""
|
||||
rawstr = r'''(?P<class>ol\..*?)\('''
|
||||
return re.findall(rawstr, html)
|
||||
|
||||
|
||||
def parseHtml(html, ids):
|
||||
"""
|
||||
returns dictionary of items of interest
|
||||
"""
|
||||
soup = BeautifulSoup(html)
|
||||
d = {}
|
||||
for tagId in ids:
|
||||
d[tagId] = extractById(soup, tagId)
|
||||
#classes should eventually be parsed from docs - not automatically created.
|
||||
classes = getRelatedClasses(html)
|
||||
d['classes'] = classes
|
||||
return d
|
||||
|
||||
|
||||
def getGitInfo(exampleDir, exampleName):
|
||||
orig = os.getcwd()
|
||||
os.chdir(exampleDir)
|
||||
h = os.popen("git log -n 1 --pretty=format:'%an|%ai' " + exampleName)
|
||||
os.chdir(orig)
|
||||
log = h.read()
|
||||
h.close()
|
||||
d = {}
|
||||
if log:
|
||||
parts = log.split("|")
|
||||
d["author"] = parts[0]
|
||||
# compensate for spaces in git log time
|
||||
td = parts[1].split(" ")
|
||||
td.insert(1, "T")
|
||||
d["date"] = "".join(td)
|
||||
else:
|
||||
d["author"] = ""
|
||||
d["date"] = ""
|
||||
return d
|
||||
|
||||
|
||||
def createFeed(examples):
|
||||
doc = Document()
|
||||
atomuri = "http://www.w3.org/2005/Atom"
|
||||
feed = doc.createElementNS(atomuri, "feed")
|
||||
feed.setAttribute("xmlns", atomuri)
|
||||
title = doc.createElementNS(atomuri, "title")
|
||||
title.appendChild(doc.createTextNode("OpenLayers Examples"))
|
||||
feed.appendChild(title)
|
||||
link = doc.createElementNS(atomuri, "link")
|
||||
link.setAttribute("rel", "self")
|
||||
link.setAttribute("href", feedPath + feedName)
|
||||
|
||||
modtime = time.strftime("%Y-%m-%dT%I:%M:%SZ", time.gmtime())
|
||||
id = doc.createElementNS(atomuri, "id")
|
||||
id.appendChild(doc.createTextNode(
|
||||
"%s%s#%s" % (feedPath, feedName, modtime)))
|
||||
feed.appendChild(id)
|
||||
|
||||
updated = doc.createElementNS(atomuri, "updated")
|
||||
updated.appendChild(doc.createTextNode(modtime))
|
||||
feed.appendChild(updated)
|
||||
|
||||
examples.sort(key=lambda x: x["modified"])
|
||||
for example in sorted(examples, key=lambda x: x["modified"], reverse=True):
|
||||
entry = doc.createElementNS(atomuri, "entry")
|
||||
|
||||
title = doc.createElementNS(atomuri, "title")
|
||||
title.appendChild(doc.createTextNode(example["title"] or
|
||||
example["example"]))
|
||||
entry.appendChild(title)
|
||||
|
||||
tags = doc.createElementNS(atomuri, "tags")
|
||||
tags.appendChild(doc.createTextNode(example["tags"] or
|
||||
example["example"]))
|
||||
entry.appendChild(tags)
|
||||
|
||||
link = doc.createElementNS(atomuri, "link")
|
||||
link.setAttribute("href", "%s%s" % (feedPath, example["example"]))
|
||||
entry.appendChild(link)
|
||||
|
||||
summary = doc.createElementNS(atomuri, "summary")
|
||||
summary.appendChild(doc.createTextNode(example["shortdesc"] or
|
||||
example["example"]))
|
||||
entry.appendChild(summary)
|
||||
|
||||
updated = doc.createElementNS(atomuri, "updated")
|
||||
updated.appendChild(doc.createTextNode(example["modified"]))
|
||||
entry.appendChild(updated)
|
||||
|
||||
author = doc.createElementNS(atomuri, "author")
|
||||
name = doc.createElementNS(atomuri, "name")
|
||||
name.appendChild(doc.createTextNode(example["author"]))
|
||||
author.appendChild(name)
|
||||
entry.appendChild(author)
|
||||
|
||||
id = doc.createElementNS(atomuri, "id")
|
||||
id.appendChild(doc.createTextNode("%s%s#%s" % (feedPath,
|
||||
example["example"],
|
||||
example["modified"])))
|
||||
entry.appendChild(id)
|
||||
|
||||
feed.appendChild(entry)
|
||||
|
||||
doc.appendChild(feed)
|
||||
return doc
|
||||
|
||||
|
||||
def wordIndex(examples):
|
||||
"""
|
||||
Create an inverted index based on words in title and shortdesc. Keys are
|
||||
lower cased words. Values are dictionaries with example index keys and
|
||||
count values.
|
||||
"""
|
||||
index = {}
|
||||
unword = re.compile("\\W+")
|
||||
keys = ["shortdesc", "title", "tags"]
|
||||
for i in range(len(examples)):
|
||||
for key in keys:
|
||||
text = examples[i][key]
|
||||
if text:
|
||||
words = unword.split(text)
|
||||
for word in words:
|
||||
if word:
|
||||
word = word.lower()
|
||||
if word in index:
|
||||
if i in index[word]:
|
||||
index[word][i] += 1
|
||||
else:
|
||||
index[word][i] = 1
|
||||
else:
|
||||
index[word] = {i: 1}
|
||||
return index
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if missing_deps:
|
||||
print """This script requires json or simplejson and BeautifulSoup.
|
||||
You don't have them. \n(%s)""" % E
|
||||
sys.exit()
|
||||
|
||||
if len(sys.argv) == 3:
|
||||
inExampleDir = sys.argv[1]
|
||||
outExampleDir = sys.argv[2]
|
||||
else:
|
||||
inExampleDir = "../examples"
|
||||
outExampleDir = "../examples"
|
||||
|
||||
outFile = open(os.path.join(outExampleDir, "example-list.js"), "w")
|
||||
|
||||
print 'Reading examples from %s and writing out to %s' % (inExampleDir,
|
||||
outFile.name)
|
||||
|
||||
exampleList = []
|
||||
docIds = ['title', 'shortdesc', 'tags']
|
||||
|
||||
examples = getListOfExamples(inExampleDir)
|
||||
|
||||
modtime = time.strftime("%Y-%m-%dT%I:%M:%SZ", time.gmtime())
|
||||
|
||||
for example in examples:
|
||||
path = os.path.join(inExampleDir, example)
|
||||
html = getExampleHtml(path)
|
||||
tagvalues = parseHtml(html, docIds)
|
||||
tagvalues['example'] = example
|
||||
# add in author/date info
|
||||
d = getGitInfo(inExampleDir, example)
|
||||
tagvalues["author"] = d["author"] or "anonymous"
|
||||
tagvalues["modified"] = d["date"] or modtime
|
||||
tagvalues['link'] = example
|
||||
|
||||
exampleList.append(tagvalues)
|
||||
|
||||
print
|
||||
|
||||
exampleList.sort(key=lambda x: x['example'].lower())
|
||||
|
||||
index = wordIndex(exampleList)
|
||||
|
||||
json = json.dumps({"examples": exampleList, "index": index})
|
||||
# Give the json a global variable we can use in our js.
|
||||
# This should be replaced or made optional.
|
||||
json = 'var info=' + json + ';'
|
||||
outFile.write(json)
|
||||
outFile.close()
|
||||
|
||||
outFeedPath = os.path.join(outExampleDir, feedName)
|
||||
print "writing feed to %s " % outFeedPath
|
||||
atom = open(outFeedPath, 'w')
|
||||
doc = createFeed(exampleList)
|
||||
atom.write(doc.toxml())
|
||||
atom.close()
|
||||
|
||||
print 'complete'
|
||||
@@ -1,121 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from optparse import OptionParser
|
||||
import re
|
||||
import sys
|
||||
|
||||
import pystache
|
||||
|
||||
|
||||
ESCAPE_SEQUENCE = {
|
||||
'\\': '\\\\',
|
||||
'\n': '\\n',
|
||||
'\t': '\\t'
|
||||
}
|
||||
|
||||
|
||||
def js_escape(s):
|
||||
return ''.join(ESCAPE_SEQUENCE.get(c, c) for c in s)
|
||||
|
||||
|
||||
def glsl_compress(s, shortNames):
|
||||
# strip leading whitespace
|
||||
s = re.sub(r'\A\s+', '', s)
|
||||
# strip trailing whitespace
|
||||
s = re.sub(r'\s+\Z', '', s)
|
||||
# strip multi-line comments
|
||||
s = re.sub(r'/\*.*?\*/', '', s)
|
||||
# strip single line comments
|
||||
s = re.sub(r'//.*?\n', '', s)
|
||||
# replace multiple whitespace with a single space
|
||||
s = re.sub(r'\s+', ' ', s)
|
||||
# remove whitespace between non-word tokens
|
||||
s = re.sub(r'(\S)\s+([^\w])', r'\1\2', s)
|
||||
s = re.sub(r'([^\w])\s+(\S)', r'\1\2', s)
|
||||
# replace original names with short names
|
||||
for originalName, shortName in shortNames.items():
|
||||
s = s.replace(originalName, shortName)
|
||||
return s
|
||||
|
||||
|
||||
def main(argv):
|
||||
option_parser = OptionParser()
|
||||
option_parser.add_option('--input')
|
||||
option_parser.add_option('--output')
|
||||
option_parser.add_option('--template')
|
||||
options, args = option_parser.parse_args(argv[1:])
|
||||
|
||||
context = {}
|
||||
nextShortName = ord('a')
|
||||
shortNames = {}
|
||||
|
||||
common, vertex, fragment = [], [], []
|
||||
attributes, uniforms, varyings = {}, {}, {}
|
||||
block = None
|
||||
for line in open(options.input, 'rU'):
|
||||
if line.startswith('//!'):
|
||||
m = re.match(r'//!\s+NAMESPACE=(\S+)\s*\Z', line)
|
||||
if m:
|
||||
context['namespace'] = m.group(1)
|
||||
continue
|
||||
m = re.match(r'//!\s+CLASS=(\S+)\s*\Z', line)
|
||||
if m:
|
||||
context['className'] = m.group(1)
|
||||
continue
|
||||
m = re.match(r'//!\s+COMMON\s*\Z', line)
|
||||
if m:
|
||||
block = common
|
||||
continue
|
||||
m = re.match(r'//!\s+VERTEX\s*\Z', line)
|
||||
if m:
|
||||
block = vertex
|
||||
continue
|
||||
m = re.match(r'//!\s+FRAGMENT\s*\Z', line)
|
||||
if m:
|
||||
block = fragment
|
||||
continue
|
||||
else:
|
||||
if block is None:
|
||||
assert line.rstrip() == ''
|
||||
else:
|
||||
block.append(line)
|
||||
m = re.match(r'attribute\s+\S+\s+(\S+);\s*\Z', line)
|
||||
if m:
|
||||
attribute = m.group(1)
|
||||
if attribute not in attributes:
|
||||
shortName = chr(nextShortName)
|
||||
nextShortName += 1
|
||||
attributes[attribute] = {'originalName': attribute, 'shortName': shortName}
|
||||
shortNames[attribute] = shortName
|
||||
m = re.match(r'uniform\s+\S+\s+(\S+);\s*\Z', line)
|
||||
if m:
|
||||
uniform = m.group(1)
|
||||
if uniform not in uniforms:
|
||||
shortName = chr(nextShortName)
|
||||
nextShortName += 1
|
||||
uniforms[uniform] = {'originalName': uniform, 'shortName': shortName}
|
||||
shortNames[uniform] = shortName
|
||||
m = re.match(r'varying\s+\S+\s+(\S+);\s*\Z', line)
|
||||
if m:
|
||||
varying = m.group(1)
|
||||
if varying not in varyings:
|
||||
shortName = chr(nextShortName)
|
||||
nextShortName += 1
|
||||
shortNames[varying] = shortName
|
||||
|
||||
context['getOriginalFragmentSource'] = js_escape(''.join(common + fragment))
|
||||
context['getOriginalVertexSource'] = js_escape(''.join(common + vertex))
|
||||
context['getFragmentSource'] = glsl_compress(''.join(common + fragment), shortNames)
|
||||
context['getVertexSource'] = glsl_compress(''.join(common + vertex), shortNames)
|
||||
context['getAttributes'] = [attributes[a] for a in sorted(attributes.keys())]
|
||||
context['getUniforms'] = [uniforms[u] for u in sorted(uniforms.keys())]
|
||||
|
||||
if options.output and options.output != '-':
|
||||
output = open(options.output, 'wb')
|
||||
else:
|
||||
output = sys.stdout
|
||||
output.write(pystache.render(open(options.template, 'rb').read(), context))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -1,794 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from cStringIO import StringIO
|
||||
import gzip
|
||||
import json
|
||||
import os
|
||||
import glob
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
from pake import Target
|
||||
from pake import ifind, main, output, rule, target, variables, virtual, which
|
||||
|
||||
|
||||
if sys.platform == 'win32':
|
||||
|
||||
win = {
|
||||
'GIT': 'git.exe',
|
||||
'GJSLINT': 'gjslint.exe',
|
||||
'JAVA': 'java.exe',
|
||||
'JAR': 'jar.exe',
|
||||
'JSDOC': './node_modules/.bin/jsdoc',
|
||||
'JSHINT': './node_modules/.bin/jshint',
|
||||
'PYTHON': 'python.exe',
|
||||
'PHANTOMJS': 'phantomjs.cmd'
|
||||
}
|
||||
|
||||
sys_dir = os.environ.get('SYSTEMDRIVE')
|
||||
program_files = os.environ.get('PROGRAMFILES')
|
||||
java_home = os.environ.get('JAVA_HOME')
|
||||
|
||||
if not java_home:
|
||||
# Following lines choose sensible defaults to guess JAVA_HOME in
|
||||
# 32/64bit Program Files folder opting for the most current version.
|
||||
search_term = os.path.join(sys_dir, os.sep, 'Program Files*', 'Java', 'jdk*')
|
||||
found_jdks = sorted(glob.glob(search_term), key=lambda x: x[-8:])
|
||||
if found_jdks:
|
||||
java_home = found_jdks[-1]
|
||||
|
||||
if java_home:
|
||||
if not which(win['JAVA']):
|
||||
win['JAVA'] = os.path.join(java_home, 'bin', 'java.exe')
|
||||
if not which(win['JAR']):
|
||||
win['JAR'] = os.path.join(java_home, 'bin', 'jar.exe')
|
||||
elif not which(win['JAVA']):
|
||||
win['JAVA'] = os.path.join(program_files,
|
||||
'Java', 'jre7', 'bin', 'java.exe')
|
||||
|
||||
if not which(win['GIT']):
|
||||
win['GIT'] = os.path.join(program_files, 'Git', 'cmd', 'git.exe')
|
||||
if not which(win['GIT']):
|
||||
win['GIT'] = os.path.join(program_files, 'Git', 'bin', 'git.exe')
|
||||
|
||||
if not which(win['PYTHON']):
|
||||
win['PYTHON'] = os.path.join(sys_dir, 'Python27', 'python.exe')
|
||||
|
||||
if not which(win['GJSLINT']):
|
||||
win['GJSLINT'] = os.path.join(sys_dir, 'Python27', 'Scripts', 'gjslint.exe')
|
||||
|
||||
if not which(win['PHANTOMJS']):
|
||||
win['PHANTOMJS'] = 'phantomjs.exe'
|
||||
if not which(win['PHANTOMJS']):
|
||||
win['PHANTOMJS'] = os.path.join(sys_dir, 'phantomjs-1.9.7-windows', 'phantomjs.exe')
|
||||
|
||||
if not which(win['JSDOC']):
|
||||
win['JSDOC'] = os.path.join(program_files, 'jsdoc3', 'jsdoc.cmd')
|
||||
|
||||
for program, path in win.iteritems():
|
||||
setattr(variables, program, path)
|
||||
|
||||
else:
|
||||
variables.GIT = 'git'
|
||||
variables.GJSLINT = 'gjslint'
|
||||
variables.JSHINT = './node_modules/.bin/jshint'
|
||||
variables.JAVA = 'java'
|
||||
variables.JAR = 'jar'
|
||||
variables.JSDOC = './node_modules/.bin/jsdoc'
|
||||
variables.PYTHON = 'python'
|
||||
variables.PHANTOMJS = 'phantomjs'
|
||||
|
||||
variables.BRANCH = output(
|
||||
'%(GIT)s', 'rev-parse', '--abbrev-ref', 'HEAD').strip()
|
||||
|
||||
EXECUTABLES = [variables.GIT, variables.GJSLINT, variables.JAVA, variables.JAR,
|
||||
variables.JSDOC, variables.JSHINT, variables.PYTHON,
|
||||
variables.PHANTOMJS]
|
||||
|
||||
EXPORTS = 'build/exports.js'
|
||||
|
||||
EXAMPLES = [path
|
||||
for path in ifind('examples')
|
||||
if path.endswith('.html')
|
||||
if path != 'examples/index.html']
|
||||
|
||||
EXAMPLES_SRC = [path
|
||||
for path in ifind('examples')
|
||||
if path.endswith('.js')
|
||||
if not path.endswith('.combined.js')
|
||||
if not path.startswith('examples/bootstrap')
|
||||
if path != 'examples/Jugl.js'
|
||||
if path != 'examples/jquery.min.js'
|
||||
if path != 'examples/loader.js'
|
||||
if path != 'examples/example-list.js']
|
||||
|
||||
EXAMPLES_JSON = ['build/' + example.replace('.html', '.json')
|
||||
for example in EXAMPLES]
|
||||
|
||||
EXAMPLES_COMBINED = ['build/' + example.replace('.html', '.combined.js')
|
||||
for example in EXAMPLES]
|
||||
|
||||
GLSL_SRC = [path
|
||||
for path in ifind('src')
|
||||
if path.endswith('.glsl')]
|
||||
|
||||
JSDOC_SRC = [path
|
||||
for path in ifind('src')
|
||||
if path.endswith('.jsdoc')]
|
||||
|
||||
SHADER_SRC = [path.replace('.glsl', 'shader.js')
|
||||
for path in GLSL_SRC]
|
||||
|
||||
SPEC = [path
|
||||
for path in ifind('test/spec')
|
||||
if path.endswith('.js')]
|
||||
|
||||
SRC = [path
|
||||
for path in ifind('src/ol')
|
||||
if path.endswith('.js')
|
||||
if path not in SHADER_SRC]
|
||||
|
||||
LIBTESS_JS_SRC = [path
|
||||
for path in ifind('src/libtess.js')
|
||||
if path.endswith('.js')]
|
||||
|
||||
PLOVR_JAR = 'build/plovr-81ed862.jar'
|
||||
PLOVR_JAR_MD5 = '1c752daaf11ad6220b298e7d2ee2b87d'
|
||||
|
||||
PROJ4JS = 'build/proj4js/lib/proj4js-combined.js'
|
||||
PROJ4JS_ZIP = 'build/proj4js-1.1.0.zip'
|
||||
PROJ4JS_ZIP_MD5 = '17caad64cf6ebc6e6fe62f292b134897'
|
||||
|
||||
|
||||
def report_sizes(t):
|
||||
stringio = StringIO()
|
||||
gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio)
|
||||
with open(t.name, 'rb') as f:
|
||||
shutil.copyfileobj(f, gzipfile)
|
||||
gzipfile.close()
|
||||
rawsize = os.stat(t.name).st_size
|
||||
gzipsize = len(stringio.getvalue())
|
||||
savings = '{0:.2%}'.format((rawsize - gzipsize)/float(rawsize))
|
||||
t.info('uncompressed: %8d bytes', rawsize)
|
||||
t.info(' compressed: %8d bytes, (saved %s)', gzipsize, savings)
|
||||
|
||||
|
||||
virtual('default', 'build')
|
||||
|
||||
|
||||
virtual('integration-test', 'lint', 'jshint', 'build', 'build-all',
|
||||
'test', 'build/examples/all.combined.js', 'check-examples', 'apidoc')
|
||||
|
||||
|
||||
virtual('build', 'build/ol.css', 'build/ol.js',
|
||||
'build/ol-simple.js', 'build/ol-whitespace.js')
|
||||
|
||||
|
||||
virtual('check', 'lint', 'jshint', 'build/ol-all.js', 'test')
|
||||
|
||||
|
||||
virtual('todo', 'fixme')
|
||||
|
||||
|
||||
@target('build/ol.css', 'build/ol.js')
|
||||
def build_ol_css(t):
|
||||
t.touch()
|
||||
|
||||
|
||||
@target('build/ol.js', PLOVR_JAR, SRC, EXPORTS, SHADER_SRC, LIBTESS_JS_SRC,
|
||||
'buildcfg/base.json', 'buildcfg/ol.json')
|
||||
def build_ol_js(t):
|
||||
t.output('%(JAVA)s', '-server', '-XX:+TieredCompilation', '-jar',
|
||||
PLOVR_JAR, 'build', 'buildcfg/ol.json')
|
||||
report_sizes(t)
|
||||
|
||||
|
||||
@target('build/ol-simple.js', PLOVR_JAR, SRC, EXPORTS, SHADER_SRC,
|
||||
LIBTESS_JS_SRC, 'buildcfg/base.json', 'buildcfg/ol.json',
|
||||
'buildcfg/ol-simple.json')
|
||||
def build_ol_simple_js(t):
|
||||
t.output('%(JAVA)s', '-server', '-XX:+TieredCompilation', '-jar',
|
||||
PLOVR_JAR, 'build', 'buildcfg/ol-simple.json')
|
||||
report_sizes(t)
|
||||
|
||||
|
||||
@target('build/ol-whitespace.js', PLOVR_JAR, SRC, EXPORTS,
|
||||
SHADER_SRC, LIBTESS_JS_SRC, 'buildcfg/base.json', 'buildcfg/ol.json',
|
||||
'buildcfg/ol-whitespace.json')
|
||||
def build_ol_whitespace_js(t):
|
||||
t.output('%(JAVA)s', '-server', '-XX:+TieredCompilation', '-jar',
|
||||
PLOVR_JAR, 'build', 'buildcfg/ol-whitespace.json')
|
||||
report_sizes(t)
|
||||
|
||||
|
||||
virtual('build-all', 'build/ol-all.js')
|
||||
|
||||
|
||||
@target('build/ol-all.js', PLOVR_JAR, SRC, EXPORTS, SHADER_SRC, LIBTESS_JS_SRC,
|
||||
'buildcfg/base.json', 'buildcfg/ol-all.json')
|
||||
def build_ol_all_js(t):
|
||||
t.output('%(JAVA)s', '-server', '-XX:+TieredCompilation', '-jar',
|
||||
PLOVR_JAR, 'build', 'buildcfg/ol-all.json')
|
||||
|
||||
|
||||
@target(EXPORTS, SRC)
|
||||
def build_exports_js(t):
|
||||
t.run('node', 'tasks/generate-exports.js', EXPORTS)
|
||||
|
||||
|
||||
for glsl_src in GLSL_SRC:
|
||||
def shader_src_helper(glsl_src):
|
||||
@target(glsl_src.replace('.glsl', 'shader.js'), glsl_src,
|
||||
'src/ol/webgl/shader.mustache', 'bin/pyglslunit.py')
|
||||
def shader_src(t):
|
||||
t.run('%(PYTHON)s', 'bin/pyglslunit.py',
|
||||
'--input', glsl_src,
|
||||
'--template', 'src/ol/webgl/shader.mustache',
|
||||
'--output', t.name)
|
||||
shader_src_helper(glsl_src)
|
||||
|
||||
|
||||
@target('build/test/requireall.js', SPEC)
|
||||
def build_test_requireall_js(t):
|
||||
requires = set()
|
||||
for dependency in t.dependencies:
|
||||
for line in open(dependency, 'rU'):
|
||||
match = re.match(r'goog\.provide\(\'(.*)\'\);', line)
|
||||
if match:
|
||||
requires.add(match.group(1))
|
||||
with open(t.name, 'wb') as f:
|
||||
for require in sorted(requires):
|
||||
f.write('goog.require(\'%s\');\n' % (require,))
|
||||
|
||||
|
||||
virtual('build-examples', 'examples', 'build/examples/all.combined.js',
|
||||
EXAMPLES_COMBINED)
|
||||
|
||||
|
||||
virtual('examples', 'examples/example-list.xml', EXAMPLES_JSON)
|
||||
|
||||
|
||||
@target('examples/example-list.xml', 'examples/example-list.js')
|
||||
def examples_examples_list_xml(t):
|
||||
t.touch() # already generated by bin/exampleparser.py
|
||||
|
||||
|
||||
@target('examples/example-list.js', 'bin/exampleparser.py', EXAMPLES)
|
||||
def examples_examples_list_js(t):
|
||||
t.run('%(PYTHON)s', 'bin/exampleparser.py', 'examples', 'examples')
|
||||
|
||||
|
||||
@target('build/examples/all.combined.js', 'build/examples/all.js', PLOVR_JAR,
|
||||
SRC, SHADER_SRC, LIBTESS_JS_SRC,
|
||||
'buildcfg/base.json', 'build/examples/all.json')
|
||||
def build_examples_all_combined_js(t):
|
||||
t.output('%(JAVA)s', '-server', '-XX:+TieredCompilation', '-jar',
|
||||
PLOVR_JAR, 'build', 'buildcfg/examples-all.json')
|
||||
report_sizes(t)
|
||||
|
||||
|
||||
@target('build/examples/all.js', EXAMPLES_SRC)
|
||||
def build_examples_all_js(t):
|
||||
t.output('%(PYTHON)s', 'bin/combine-examples.py', t.dependencies)
|
||||
|
||||
|
||||
@rule(r'\Abuild/examples/(?P<id>.*).json\Z')
|
||||
def examples_star_json(name, match):
|
||||
def action(t):
|
||||
# It would make more sense to use olx.js as an input file here. We use
|
||||
# it as an externs file instead to prevent "Cannot read property '*' of
|
||||
# undefined" error when running examples in "raw" or "whitespace" mode.
|
||||
# Note that we use the proper way in buildcfg/examples-all.json, which
|
||||
# is only used to check the examples code using the compiler.
|
||||
content = json.dumps({
|
||||
'id': match.group('id'),
|
||||
'inherits': '../../buildcfg/base.json',
|
||||
'inputs': [
|
||||
'../examples/%(id)s.js' % match.groupdict()
|
||||
],
|
||||
'externs': [
|
||||
'//jquery-1.7.js',
|
||||
'../externs/bingmaps.js',
|
||||
'../externs/bootstrap.js',
|
||||
'../externs/closure-compiler.js',
|
||||
'../externs/example.js',
|
||||
'../externs/geojson.js',
|
||||
'../externs/oli.js',
|
||||
'../externs/olx.js',
|
||||
'../externs/proj4js.js',
|
||||
'../externs/tilejson.js',
|
||||
'../externs/topojson.js',
|
||||
'../externs/vbarray.js',
|
||||
],
|
||||
})
|
||||
with open(t.name, 'wb') as f:
|
||||
f.write(content)
|
||||
dependencies = [__file__, 'buildcfg/base.json']
|
||||
return Target(name, action=action, dependencies=dependencies)
|
||||
|
||||
|
||||
@rule(r'\Abuild/examples/(?P<id>.*).combined.js\Z')
|
||||
def examples_star_combined_js(name, match):
|
||||
def action(t):
|
||||
t.output('%(JAVA)s', '-server', '-XX:+TieredCompilation', '-jar',
|
||||
PLOVR_JAR, 'build', 'build/examples/%(id)s.json' %
|
||||
match.groupdict())
|
||||
report_sizes(t)
|
||||
dependencies = [PLOVR_JAR, SRC, SHADER_SRC, LIBTESS_JS_SRC,
|
||||
'buildcfg/base.json',
|
||||
'examples/%(id)s.js' % match.groupdict(),
|
||||
'build/examples/%(id)s.json' % match.groupdict()]
|
||||
return Target(name, action=action, dependencies=dependencies)
|
||||
|
||||
|
||||
@target('serve', PLOVR_JAR, 'test-deps', 'examples')
|
||||
def serve(t):
|
||||
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'buildcfg/ol.json',
|
||||
'buildcfg/ol-all.json', EXAMPLES_JSON, 'buildcfg/test.json')
|
||||
|
||||
|
||||
@target('serve-integration-test', PLOVR_JAR)
|
||||
def serve_precommit(t):
|
||||
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve',
|
||||
'buildcfg/ol-all.json', 'buildcfg/test.json')
|
||||
|
||||
|
||||
virtual('lint', 'build/lint-timestamp', 'build/lint-libtess.js-timestamp',
|
||||
'build/check-requires-timestamp', 'build/check-whitespace-timestamp')
|
||||
|
||||
|
||||
@target('build/lint-timestamp', SRC, EXPORTS, EXAMPLES_SRC, SPEC, precious=True)
|
||||
def build_lint_src_timestamp(t):
|
||||
t.run('%(GJSLINT)s',
|
||||
'--jslint_error=all',
|
||||
'--custom_jsdoc_tags=event,fires,todo,function',
|
||||
'--strict',
|
||||
t.newer(t.dependencies))
|
||||
t.touch()
|
||||
|
||||
|
||||
@target('build/lint-libtess.js-timestamp', LIBTESS_JS_SRC, precious=True)
|
||||
def build_lint_libtess_js_timestamp(t):
|
||||
t.run('%(GJSLINT)s',
|
||||
'--jslint_error=all',
|
||||
'--disable=110',
|
||||
'--strict',
|
||||
t.newer(t.dependencies))
|
||||
t.touch()
|
||||
|
||||
|
||||
virtual('jshint', 'build/jshint-timestamp')
|
||||
|
||||
@target('build/jshint-timestamp', SRC, EXPORTS, EXAMPLES_SRC, SPEC,
|
||||
precious=True)
|
||||
def build_jshint_timestamp(t):
|
||||
t.run(variables.JSHINT, '--verbose', t.newer(t.dependencies))
|
||||
t.touch()
|
||||
|
||||
|
||||
def _strip_comments(lines):
|
||||
# FIXME this is a horribe hack, we should use a proper JavaScript parser
|
||||
# here
|
||||
in_multiline_comment = False
|
||||
lineno = 0
|
||||
for line in lines:
|
||||
lineno += 1
|
||||
if in_multiline_comment:
|
||||
index = line.find('*/')
|
||||
if index != -1:
|
||||
in_multiline_comment = False
|
||||
line = line[index + 2:]
|
||||
if not in_multiline_comment:
|
||||
line = re.sub(r'//[^\n]*', '', line)
|
||||
line = re.sub(r'/\*.*?\*/', '', line)
|
||||
index = line.find('/*')
|
||||
if index != -1:
|
||||
yield lineno, line[:index]
|
||||
in_multiline_comment = True
|
||||
else:
|
||||
yield lineno, line
|
||||
|
||||
|
||||
@target('build/check-requires-timestamp', SRC, EXAMPLES_SRC,
|
||||
SHADER_SRC, LIBTESS_JS_SRC, SPEC)
|
||||
def build_check_requires_timestamp(t):
|
||||
from zipfile import ZipFile
|
||||
unused_count = 0
|
||||
all_provides = set()
|
||||
zf = ZipFile(PLOVR_JAR)
|
||||
for zi in zf.infolist():
|
||||
if zi.filename.endswith('.js'):
|
||||
if not zi.filename.startswith('closure/goog/'):
|
||||
continue
|
||||
# Skip goog.i18n because it contains so many modules that it causes
|
||||
# the generated regular expression to exceed Python's limits
|
||||
if zi.filename.startswith('closure/goog/i18n/'):
|
||||
continue
|
||||
for line in zf.open(zi, 'rU'):
|
||||
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
|
||||
if m:
|
||||
all_provides.add(m.group(1))
|
||||
for filename in sorted(t.dependencies):
|
||||
require_linenos = {}
|
||||
uses = set()
|
||||
lines = open(filename, 'rU').readlines()
|
||||
for lineno, line in _strip_comments(lines):
|
||||
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
|
||||
if m:
|
||||
all_provides.add(m.group(1))
|
||||
continue
|
||||
m = re.match(r'goog.require\(\'(.*)\'\);', line)
|
||||
if m:
|
||||
require_linenos[m.group(1)] = lineno
|
||||
continue
|
||||
ignore_linenos = require_linenos.values()
|
||||
for lineno, line in enumerate(lines):
|
||||
if lineno in ignore_linenos:
|
||||
continue
|
||||
for require in require_linenos.iterkeys():
|
||||
if require in line:
|
||||
uses.add(require)
|
||||
for require in sorted(set(require_linenos.keys()) - uses):
|
||||
t.info('%s:%d: unused goog.require: %r' % (
|
||||
filename, require_linenos[require], require))
|
||||
unused_count += 1
|
||||
all_provides.discard('ol')
|
||||
all_provides.discard('ol.MapProperty')
|
||||
|
||||
class Node(object):
|
||||
|
||||
def __init__(self):
|
||||
self.present = False
|
||||
self.children = {}
|
||||
|
||||
def _build_re(self, key):
|
||||
if key == '*':
|
||||
assert len(self.children) == 0
|
||||
# We want to match `.doIt` but not `.SomeClass` or `.more.stuff`
|
||||
return '(?=\\.[a-z]\\w*\\b(?!\\.))'
|
||||
elif len(self.children) == 1:
|
||||
child_key, child = next(self.children.iteritems())
|
||||
child_re = child._build_re(child_key)
|
||||
if child_key != '*':
|
||||
child_re = '\\.' + child_re
|
||||
if self.present:
|
||||
return key + '(' + child_re + ')?'
|
||||
else:
|
||||
return key + child_re
|
||||
elif self.children:
|
||||
children_re = '(?:' + '|'.join(
|
||||
('\\.' if k != '*' else '') + self.children[k]._build_re(k)
|
||||
for k in sorted(self.children.keys())) + ')'
|
||||
if self.present:
|
||||
return key + children_re + '?'
|
||||
else:
|
||||
return key + children_re
|
||||
else:
|
||||
assert self.present
|
||||
return key
|
||||
|
||||
def build_re(self, key):
|
||||
return re.compile('\\b' + self._build_re(key) + '\\b')
|
||||
root = Node()
|
||||
for provide in all_provides:
|
||||
node = root
|
||||
for component in provide.split('.'):
|
||||
if component not in node.children:
|
||||
node.children[component] = Node()
|
||||
node = node.children[component]
|
||||
if component[0].islower():
|
||||
# We've arrived at a namespace provide like `ol.foo`.
|
||||
# In this case, we want to match uses like `ol.foo.doIt()` but
|
||||
# not match things like `new ol.foo.SomeClass()`.
|
||||
# For this purpose, we use the special wildcard key for the child.
|
||||
node.children['*'] = Node()
|
||||
else:
|
||||
node.present = True
|
||||
provide_res = [child.build_re(key)
|
||||
for key, child in root.children.iteritems()]
|
||||
missing_count = 0
|
||||
for filename in sorted(t.dependencies):
|
||||
provides = set()
|
||||
requires = set()
|
||||
uses = set()
|
||||
uses_linenos = {}
|
||||
for lineno, line in _strip_comments(open(filename, 'rU')):
|
||||
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
|
||||
if m:
|
||||
provides.add(m.group(1))
|
||||
continue
|
||||
m = re.match(r'goog.require\(\'(.*)\'\);', line)
|
||||
if m:
|
||||
requires.add(m.group(1))
|
||||
continue
|
||||
while True:
|
||||
for provide_re in provide_res:
|
||||
m = provide_re.search(line)
|
||||
if m:
|
||||
uses.add(m.group())
|
||||
uses_linenos[m.group()] = lineno
|
||||
line = line[:m.start()] + line[m.end():]
|
||||
break
|
||||
else:
|
||||
break
|
||||
if filename == 'src/ol/renderer/layerrenderer.js':
|
||||
uses.discard('ol.renderer.Map')
|
||||
m = re.match(
|
||||
r'src/ol/renderer/(\w+)/\1(\w*)layerrenderer\.js\Z', filename)
|
||||
if m:
|
||||
uses.discard('ol.renderer.Map')
|
||||
uses.discard('ol.renderer.%s.Map' % (m.group(1),))
|
||||
missing_requires = uses - requires - provides
|
||||
if missing_requires:
|
||||
for missing_require in sorted(missing_requires):
|
||||
t.info("%s:%d missing goog.require('%s')" %
|
||||
(filename, uses_linenos[missing_require], missing_require))
|
||||
missing_count += 1
|
||||
if unused_count or missing_count:
|
||||
t.error('%d unused goog.requires, %d missing goog.requires' %
|
||||
(unused_count, missing_count))
|
||||
t.touch()
|
||||
|
||||
|
||||
@target('build/check-whitespace-timestamp', SRC, EXPORTS, EXAMPLES_SRC,
|
||||
SPEC, JSDOC_SRC, LIBTESS_JS_SRC, precious=True)
|
||||
def build_check_whitespace_timestamp(t):
|
||||
CR_RE = re.compile(r'\r')
|
||||
LEADING_WHITESPACE_RE = re.compile(r'\s+')
|
||||
TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z')
|
||||
NO_NEWLINE_RE = re.compile(r'[^\n]\Z')
|
||||
ALL_WHITESPACE_RE = re.compile(r'\s+\Z')
|
||||
errors = 0
|
||||
for filename in sorted(t.newer(t.dependencies)):
|
||||
whitespace = False
|
||||
for lineno, line in enumerate(open(filename, 'rU')):
|
||||
if lineno == 0 and LEADING_WHITESPACE_RE.match(line):
|
||||
t.info('%s:%d: leading whitespace', filename, lineno + 1)
|
||||
errors += 1
|
||||
if CR_RE.search(line):
|
||||
t.info('%s:%d: carriage return character in line', filename, lineno + 1)
|
||||
errors += 1
|
||||
if TRAILING_WHITESPACE_RE.search(line):
|
||||
t.info('%s:%d: trailing whitespace', filename, lineno + 1)
|
||||
errors += 1
|
||||
if NO_NEWLINE_RE.search(line):
|
||||
t.info('%s:%d: no newline at end of file', filename, lineno + 1)
|
||||
errors += 1
|
||||
whitespace = ALL_WHITESPACE_RE.match(line)
|
||||
if whitespace:
|
||||
t.info('%s: trailing whitespace at end of file', filename)
|
||||
errors += 1
|
||||
if errors:
|
||||
t.error('%d whitespace errors' % (errors,))
|
||||
t.touch()
|
||||
|
||||
|
||||
virtual('plovr', PLOVR_JAR)
|
||||
|
||||
|
||||
@target(PLOVR_JAR, clean=False)
|
||||
def plovr_jar(t):
|
||||
t.info('downloading %r', t.name)
|
||||
t.download('https://plovr.googlecode.com/files/' +
|
||||
os.path.basename(PLOVR_JAR), md5=PLOVR_JAR_MD5)
|
||||
t.info('downloaded %r', t.name)
|
||||
|
||||
|
||||
virtual('apidoc', 'build/jsdoc-%(BRANCH)s-timestamp' % vars(variables))
|
||||
|
||||
|
||||
@target('build/jsdoc-%(BRANCH)s-timestamp' % vars(variables), 'host-resources',
|
||||
EXPORTS, SRC, SHADER_SRC,
|
||||
ifind('apidoc/template'))
|
||||
def jsdoc_BRANCH_timestamp(t):
|
||||
t.run('%(JSDOC)s', 'apidoc/index.md', '-c', 'apidoc/conf.json',
|
||||
'-d', 'build/hosted/%(BRANCH)s/apidoc')
|
||||
t.touch()
|
||||
|
||||
|
||||
def split_example_file(example, dst_dir):
|
||||
lines = open(example, 'rU').readlines()
|
||||
|
||||
target_lines = []
|
||||
target_require_lines = []
|
||||
|
||||
found_requires = False
|
||||
found_code = False
|
||||
for line in lines:
|
||||
m = re.match(r'goog.require\(\'(.*)\'\);', line)
|
||||
if m:
|
||||
found_requires = True
|
||||
target_require_lines.append(line)
|
||||
elif found_requires:
|
||||
if found_code or line not in ('\n', '\r\n'):
|
||||
found_code = True
|
||||
target_lines.append(line)
|
||||
|
||||
target = open(
|
||||
os.path.join(dst_dir, os.path.basename(example)), 'wb')
|
||||
target_require = open(
|
||||
os.path.join(dst_dir, os.path.basename(example)
|
||||
.replace('.js', '-require.js')),
|
||||
'wb')
|
||||
|
||||
target.writelines(target_lines)
|
||||
target.close()
|
||||
|
||||
target_require.writelines(target_require_lines)
|
||||
target_require.close()
|
||||
|
||||
|
||||
@target('host-resources', phony=True)
|
||||
def host_resources(t):
|
||||
resources_dir = 'build/hosted/%(BRANCH)s/resources'
|
||||
t.rm_rf(resources_dir)
|
||||
t.cp_r('resources', resources_dir)
|
||||
|
||||
|
||||
@target('host-examples', 'build', 'host-resources', 'examples', phony=True)
|
||||
def host_examples(t):
|
||||
examples_dir = 'build/hosted/%(BRANCH)s/examples'
|
||||
build_dir = 'build/hosted/%(BRANCH)s/build'
|
||||
css_dir = 'build/hosted/%(BRANCH)s/css'
|
||||
t.rm_rf(examples_dir)
|
||||
t.makedirs(examples_dir)
|
||||
t.rm_rf(build_dir)
|
||||
t.makedirs(build_dir)
|
||||
t.rm_rf(css_dir)
|
||||
t.makedirs(css_dir)
|
||||
t.cp(EXAMPLES, examples_dir)
|
||||
for example in [path.replace('.html', '.js') for path in EXAMPLES]:
|
||||
split_example_file(example, examples_dir % vars(variables))
|
||||
t.cp_r('examples/data', examples_dir + '/data')
|
||||
t.cp('bin/loader_hosted_examples.js', examples_dir + '/loader.js')
|
||||
t.cp('build/ol.js', 'build/ol-simple.js', 'build/ol-whitespace.js',
|
||||
build_dir)
|
||||
t.cp('build/ol.css', css_dir)
|
||||
t.cp('examples/index.html', 'examples/example-list.js',
|
||||
'examples/example-list.xml', 'examples/Jugl.js',
|
||||
'examples/jquery.min.js', examples_dir)
|
||||
t.rm_rf('build/hosted/%(BRANCH)s/closure-library')
|
||||
t.makedirs('build/hosted/%(BRANCH)s/closure-library')
|
||||
with t.chdir('build/hosted/%(BRANCH)s/closure-library'):
|
||||
t.run('%(JAR)s', 'xf', '../../../../' + PLOVR_JAR, 'closure')
|
||||
t.run('%(JAR)s', 'xf', '../../../../' + PLOVR_JAR, 'third_party')
|
||||
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.run('%(PYTHON)s', 'bin/closure/depswriter.py',
|
||||
'--root_with_prefix', 'src ../../../ol',
|
||||
'--root', 'build/hosted/%(BRANCH)s/closure-library/closure/goog',
|
||||
'--root_with_prefix', 'build/hosted/%(BRANCH)s/closure-library/'
|
||||
'third_party ../../third_party',
|
||||
'--output_file', 'build/hosted/%(BRANCH)s/build/ol-deps.js')
|
||||
|
||||
|
||||
@target('check-examples', 'host-examples', phony=True)
|
||||
def check_examples(t):
|
||||
examples = ['build/hosted/%(BRANCH)s/' + e
|
||||
for e in EXAMPLES
|
||||
if not open(e.replace('.html', '.js'), 'rU').readline().startswith('// NOCOMPILE')]
|
||||
all_examples = \
|
||||
[e + '?mode=advanced' for e in examples]
|
||||
for example in all_examples:
|
||||
t.run('%(PHANTOMJS)s', 'bin/check-example.js', example)
|
||||
|
||||
|
||||
@target(PROJ4JS, PROJ4JS_ZIP)
|
||||
def proj4js(t):
|
||||
from zipfile import ZipFile
|
||||
zf = ZipFile(PROJ4JS_ZIP)
|
||||
contents = zf.open('proj4js/lib/proj4js-combined.js').read()
|
||||
with open(t.name, 'wb') as f:
|
||||
f.write(contents)
|
||||
|
||||
|
||||
@target(PROJ4JS_ZIP, clean=False)
|
||||
def proj4js_zip(t):
|
||||
t.info('downloading %r', t.name)
|
||||
t.download('http://download.osgeo.org/proj4js/' +
|
||||
os.path.basename(t.name), md5=PROJ4JS_ZIP_MD5)
|
||||
t.info('downloaded %r', t.name)
|
||||
|
||||
|
||||
virtual('test-deps', PROJ4JS, 'build/test/requireall.js')
|
||||
|
||||
|
||||
@target('test', 'test-deps', phony=True)
|
||||
def test(t):
|
||||
t.run('%(PHANTOMJS)s', 'test/mocha-phantomjs.js', 'test/ol.html')
|
||||
|
||||
|
||||
@target('fixme', phony=True)
|
||||
def find_fixme(t):
|
||||
regex = re.compile('FIXME|TODO')
|
||||
matches = dict()
|
||||
totalcount = 0
|
||||
for filename in SRC:
|
||||
f = open(filename, 'r')
|
||||
for lineno, line in enumerate(f):
|
||||
if regex.search(line):
|
||||
if (filename not in matches):
|
||||
matches[filename] = list()
|
||||
matches[filename].append('#%-10d %s' % (
|
||||
lineno + 1, line.strip()))
|
||||
totalcount += 1
|
||||
f.close()
|
||||
|
||||
for filename in matches:
|
||||
num_matches = len(matches[filename])
|
||||
noun = 'matches' if num_matches > 1 else 'match'
|
||||
print ' %s has %d %s:' % (filename, num_matches, noun)
|
||||
for match in matches[filename]:
|
||||
print ' %s' % (match,)
|
||||
print
|
||||
print 'A total of %d TODO/FIXME(s) were found' % (totalcount,)
|
||||
|
||||
|
||||
@target('reallyclean')
|
||||
def reallyclean(t):
|
||||
"""Removes untracked files and folders from previous builds."""
|
||||
# -X => only clean up files that are usually ignored e.g.
|
||||
# through .gitignore
|
||||
# -d => also consider directories for deletion
|
||||
# -f => if git configuration variable clean.requireForce != false,
|
||||
# git clean will refuse to run unless given -f or -n.
|
||||
t.run('%(GIT)s', 'clean', '-X', '-d', '-f', '.')
|
||||
|
||||
|
||||
@target('checkdeps')
|
||||
def check_dependencies(t):
|
||||
for exe in EXECUTABLES:
|
||||
status = 'present' if which(exe) else 'MISSING'
|
||||
print 'Program "%s" seems to be %s.' % (exe, status)
|
||||
print 'For certain targets all above programs need to be present.'
|
||||
|
||||
|
||||
@target('help')
|
||||
def display_help(t):
|
||||
print '''
|
||||
build.py - The OpenLayers 3 build script.
|
||||
|
||||
Usage:
|
||||
./build.py [options] [target] (on Unix-based machines)
|
||||
<python-executable.exe> build.py [options] [target] (on Windows machines)
|
||||
|
||||
There is one option:
|
||||
-c - Cleans up the repository from previous builds.
|
||||
|
||||
The most common targets are:
|
||||
serve - Serves files through plovr, usually on port 9810.
|
||||
lint - Runs gjslint on all sourcefiles to enforce specific syntax.
|
||||
build - Builds singlefile versions of OpenLayers JavaScript and
|
||||
CSS. This is also the default build target which runs when
|
||||
no target is specified.
|
||||
test - Runs the testsuite and displays the results.
|
||||
check - Runs the lint-target, builds some OpenLayers files, and
|
||||
then runs test. Many developers call this target often
|
||||
while working on the code.
|
||||
help - Shows this help.
|
||||
|
||||
Other less frequently used targets are:
|
||||
apidoc - Builds the API-Documentation using JSDoc3.
|
||||
integration-test - Builds all examples in various modes and usually takes a
|
||||
long time to finish. This target calls the following
|
||||
targets: lint, build, build-all, test, build-examples,
|
||||
check-examples and apidoc.
|
||||
reallyclean - Remove untracked files from the repository.
|
||||
checkdeps - Checks whether all required development software is
|
||||
installed on your machine.
|
||||
fixme - Will print a list of parts of the code that are marked
|
||||
with either TODO or FIXME.
|
||||
todo - This is an alias for the fixme-target (see above).
|
||||
plovr - Fetches the required plovr.jar. Usually called by other
|
||||
targets that depend on plovr.
|
||||
|
||||
If no target is given, the build-target will be executed.
|
||||
|
||||
The above list is not complete, please see the source code for not-mentioned
|
||||
and only seldomly called targets.
|
||||
'''
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,115 +0,0 @@
|
||||
{
|
||||
|
||||
"ambiguate-properties": true,
|
||||
|
||||
"checks": {
|
||||
"accessControls": "ERROR",
|
||||
"ambiguousFunctionDecl": "ERROR",
|
||||
"checkDebuggerStatement": "WARNING",
|
||||
"checkEventfulObjectDisposal": "ERROR",
|
||||
"checkProvides": "ERROR",
|
||||
"checkRegExp": "ERROR",
|
||||
"checkStructDictInheritance": "ERROR",
|
||||
"checkTypes": "ERROR",
|
||||
"checkVars": "ERROR",
|
||||
"const": "ERROR",
|
||||
"constantProperty": "ERROR",
|
||||
"deprecated": "ERROR",
|
||||
"duplicate": "ERROR",
|
||||
"duplicateMessage": "ERROR",
|
||||
"es3": "ERROR",
|
||||
"es5Strict": "ERROR",
|
||||
"externsValidation": "ERROR",
|
||||
"fileoverviewTags": "ERROR",
|
||||
"globalThis": "ERROR",
|
||||
"internetExplorerChecks": "ERROR",
|
||||
"invalidCasts": "ERROR",
|
||||
"misplacedTypeAnnotation": "ERROR",
|
||||
"missingProperties": "ERROR",
|
||||
"nonStandardJsDocs": "ERROR",
|
||||
"strictModuleDepCheck": "ERROR",
|
||||
"suspiciousCode": "ERROR",
|
||||
"typeInvalidation": "ERROR",
|
||||
"tweakValidation": "ERROR",
|
||||
"undefinedNames": "ERROR",
|
||||
"undefinedVars": "ERROR",
|
||||
"unknownDefines": "ERROR",
|
||||
"uselessCode": "ERROR",
|
||||
"violatedModuleDep": "ERROR",
|
||||
"visibility": "ERROR"
|
||||
},
|
||||
|
||||
"define": {
|
||||
"goog.dom.ASSUME_STANDARDS_MODE": true,
|
||||
"goog.DEBUG": false
|
||||
},
|
||||
|
||||
"disambiguate-properties": true,
|
||||
|
||||
"externs": [
|
||||
"../externs/bingmaps.js",
|
||||
"../externs/closure-compiler.js",
|
||||
"../externs/geojson.js",
|
||||
"../externs/oli.js",
|
||||
"../externs/olx.js",
|
||||
"../externs/proj4js.js",
|
||||
"../externs/tilejson.js",
|
||||
"../externs/topojson.js",
|
||||
"../externs/vbarray.js"
|
||||
],
|
||||
|
||||
"level": "VERBOSE",
|
||||
|
||||
"mode": "ADVANCED",
|
||||
|
||||
"name-suffixes-to-strip": [
|
||||
"logger",
|
||||
"logger_"
|
||||
],
|
||||
|
||||
"paths": [
|
||||
"../src"
|
||||
],
|
||||
|
||||
"treat-warnings-as-errors": false,
|
||||
|
||||
"type-prefixes-to-strip": [
|
||||
"goog.asserts",
|
||||
"goog.debug.Console",
|
||||
"goog.debug.DebugWindow",
|
||||
"goog.debug.DevCss",
|
||||
"goog.debug.DivConsole",
|
||||
"goog.debug.EntryPointMonitor",
|
||||
"goog.debug.ErrorHandler",
|
||||
"goog.debug.ErrorReporter",
|
||||
"goog.debug.FancyWindow",
|
||||
"goog.debug.Formatter",
|
||||
"goog.debug.FpsDisplay",
|
||||
"goog.debug.GcDiagnostics",
|
||||
"goog.debug.HtmlFormatter",
|
||||
"goog.debug.LogBuffer",
|
||||
"goog.debug.LogManager",
|
||||
"goog.debug.LogRecord",
|
||||
"goog.debug.Logger",
|
||||
"goog.debug.RelativeTimeProvider",
|
||||
"goog.debug.TextFormatter",
|
||||
"goog.debug.Trace",
|
||||
"goog.debug.catchErrors",
|
||||
"goog.debug.deepExpose",
|
||||
"goog.debug.enhanceError",
|
||||
"goog.debug.entryPointRegistry",
|
||||
"goog.debug.errorHandlerWeakDep",
|
||||
"goog.debug.expose",
|
||||
"goog.debug.exposeArray",
|
||||
"goog.debug.exposeException",
|
||||
"goog.debug.getFunctionName",
|
||||
"goog.debug.getStacktrace",
|
||||
"goog.debug.getStacktraceSimple",
|
||||
"goog.debug.logRecordSerializer",
|
||||
"goog.debug.makeWhitespaceVisible",
|
||||
"goog.debug.normalizeErrorObject",
|
||||
"goog.debug.reflect",
|
||||
"goog.log"
|
||||
]
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"externs": [
|
||||
"//jquery-1.7.js",
|
||||
"../externs/bingmaps.js",
|
||||
"../externs/bootstrap.js",
|
||||
"../externs/closure-compiler.js",
|
||||
"../externs/example.js",
|
||||
"../externs/geojson.js",
|
||||
"../externs/oli.js",
|
||||
"../externs/proj4js.js",
|
||||
"../externs/tilejson.js",
|
||||
"../externs/topojson.js",
|
||||
"../externs/vbarray.js"
|
||||
],
|
||||
"id": "simple",
|
||||
"inherits": "base.json",
|
||||
"inputs": [
|
||||
"../build/examples/all.js",
|
||||
"../externs/olx.js"
|
||||
]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"opts": {
|
||||
"recurse": true,
|
||||
"template": "buildcfg/jsdoc/symbols"
|
||||
},
|
||||
"tags": {
|
||||
"allowUnknownTags": true
|
||||
},
|
||||
"source": {
|
||||
"includePattern": "\\.js$"
|
||||
},
|
||||
"plugins": [
|
||||
"buildcfg/jsdoc/symbols/todo-plugin"
|
||||
]
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Generates JSON output based on doclets with the "api" tag.
|
||||
*/
|
||||
var assert = require('assert');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
|
||||
/**
|
||||
* Publish hook for the JSDoc template. Writes to JSON stdout.
|
||||
* @param {function} data The root of the Taffy DB containing doclet records.
|
||||
* @param {Object} opts Options.
|
||||
*/
|
||||
exports.publish = function(data, opts) {
|
||||
var cwd = process.cwd();
|
||||
|
||||
// get all doclets with the "api" property, but no enums, typedefs and events.
|
||||
var docs = data(
|
||||
{api: {isString: true}},
|
||||
{isEnum: {'!is': true}},
|
||||
{kind: {'!is': 'typedef'}},
|
||||
{kind: {'!is': 'event'}}
|
||||
).get();
|
||||
|
||||
// get symbols data, filter out those that are members of private classes
|
||||
var symbols = docs.filter(function(doc) {
|
||||
var include = true;
|
||||
var constructor = doc.memberof;
|
||||
if (constructor && constructor.substr(-1) === '_') {
|
||||
assert.strictEqual(doc.inherited, true,
|
||||
'Unexpected export on private class: ' + doc.longname);
|
||||
include = false;
|
||||
}
|
||||
return include;
|
||||
}).map(function(doc) {
|
||||
return {
|
||||
name: doc.longname,
|
||||
extends: doc.augments,
|
||||
path: path.join(doc.meta.path, doc.meta.filename)
|
||||
};
|
||||
});
|
||||
|
||||
process.stdout.write(JSON.stringify({symbols: symbols}, null, 2));
|
||||
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* @fileoverview This plugin should go away when we get rid of Plovr and can
|
||||
* use Closure Compiler's extra_annotation_name option. Until then, we hijack
|
||||
* the todo tag to add doclet properties for other tags we eventually want to
|
||||
* support. For example, the "todo api" tag can eventually be replaced with
|
||||
* the "api" tag.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Our hook to define new tags.
|
||||
* @param {Object} dictionary The tag dictionary.
|
||||
*/
|
||||
exports.defineTags = function(dictionary) {
|
||||
|
||||
dictionary.defineTag('todo', {
|
||||
mustHaveValue: true,
|
||||
onTagged: function(doclet, tag) {
|
||||
var parts = tag.text.split(' ');
|
||||
if (parts[0] === 'api') {
|
||||
doclet.api = parts.slice(1).join(' ').trim();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
|
||||
"id": "ol-all",
|
||||
|
||||
"externs": [
|
||||
"../externs/bingmaps.js",
|
||||
"../externs/closure-compiler.js",
|
||||
"../externs/geojson.js",
|
||||
"../externs/oli.js",
|
||||
"../externs/olx.js",
|
||||
"../externs/proj4js.js",
|
||||
"../externs/tilejson.js",
|
||||
"../externs/topojson.js",
|
||||
"../externs/vbarray.js"
|
||||
],
|
||||
|
||||
"inherits": "base.json",
|
||||
|
||||
"inputs": [
|
||||
"../build/exports.js"
|
||||
]
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
|
||||
// If ambiguate-properties and disambiguate-properties are set to true
|
||||
// we get function names like "ol_control_Control_prototype$setMap" in
|
||||
// the compiled code when using the SIMPLE compilation. It looks like
|
||||
// "ambiguate-properties" and "disambiguate-properties" are only
|
||||
// appropriate for ADVANCED compilation.
|
||||
|
||||
"ambiguate-properties": false,
|
||||
|
||||
"disambiguate-properties": false,
|
||||
|
||||
"id": "ol-simple",
|
||||
|
||||
"externs": [
|
||||
"../externs/bingmaps.js",
|
||||
"../externs/closure-compiler.js",
|
||||
"../externs/geojson.js",
|
||||
"../externs/oli.js",
|
||||
"../externs/olx.js",
|
||||
"../externs/proj4js.js",
|
||||
"../externs/tilejson.js",
|
||||
"../externs/topojson.js",
|
||||
"../externs/vbarray.js"
|
||||
],
|
||||
|
||||
"inherits": "ol.json",
|
||||
|
||||
"inputs": [
|
||||
"../build/exports.js"
|
||||
],
|
||||
|
||||
"mode": "SIMPLE",
|
||||
|
||||
// Note: we can't have a (function(){%output%})() output wrapper with
|
||||
// WHITESPACE and SIMPLE modes. See this link for explanations:
|
||||
// https://groups.google.com/forum/#!topic/plovr/gQyZEa2NpsU
|
||||
"output-wrapper": "%output%"
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
|
||||
"id": "ol-whitespace",
|
||||
|
||||
// If ambiguate-properties and disambiguate-properties are set to true
|
||||
// we get function names like "ol_control_Control_prototype$setMap" in
|
||||
// the compiled code when using the SIMPLE compilation. It looks like
|
||||
// "ambiguate-properties" and "disambiguate-properties" are only
|
||||
// appropriate for ADVANCED compilation. To be sure we also don't
|
||||
// set them for WHITESPACE.
|
||||
|
||||
"ambiguate-properties": false,
|
||||
|
||||
"disambiguate-properties": false,
|
||||
|
||||
"externs": [
|
||||
"../externs/bingmaps.js",
|
||||
"../externs/closure-compiler.js",
|
||||
"../externs/geojson.js",
|
||||
"../externs/oli.js",
|
||||
"../externs/olx.js",
|
||||
"../externs/proj4js.js",
|
||||
"../externs/tilejson.js",
|
||||
"../externs/topojson.js",
|
||||
"../externs/vbarray.js"
|
||||
],
|
||||
|
||||
"inherits": "ol.json",
|
||||
|
||||
"inputs": [
|
||||
"../build/exports.js"
|
||||
],
|
||||
|
||||
"mode": "WHITESPACE",
|
||||
|
||||
"output-wrapper": [
|
||||
"var CLOSURE_NO_DEPS = true;\n",
|
||||
"%output%"
|
||||
],
|
||||
|
||||
"pretty-print": true
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
|
||||
"id": "ol",
|
||||
|
||||
"css-allowed-unrecognized-properties": [
|
||||
"user-select"
|
||||
],
|
||||
|
||||
"css-inputs": [
|
||||
"../css/ol.css"
|
||||
],
|
||||
|
||||
"css-output-file": "../build/ol.css",
|
||||
|
||||
"externs": [
|
||||
"../externs/bingmaps.js",
|
||||
"../externs/closure-compiler.js",
|
||||
"../externs/geojson.js",
|
||||
"../externs/oli.js",
|
||||
"../externs/olx.js",
|
||||
"../externs/proj4js.js",
|
||||
"../externs/tilejson.js",
|
||||
"../externs/topojson.js",
|
||||
"../externs/vbarray.js"
|
||||
],
|
||||
|
||||
"inherits": "base.json",
|
||||
|
||||
"inputs": [
|
||||
"../build/exports.js"
|
||||
],
|
||||
|
||||
"output-wrapper": "// OpenLayers 3. see http://ol3js.org/\n(function(){%output%})();",
|
||||
|
||||
"paths": [
|
||||
"../src"
|
||||
]
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
|
||||
"id": "test",
|
||||
|
||||
"inherits": "base.json",
|
||||
|
||||
"inputs": [
|
||||
"../build/test/requireall.js"
|
||||
],
|
||||
|
||||
"paths": [
|
||||
"../src",
|
||||
"../test"
|
||||
]
|
||||
|
||||
}
|
||||
-285
@@ -1,285 +0,0 @@
|
||||
.ol-attribution {
|
||||
position: absolute;
|
||||
text-align: right;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
padding: 6px;
|
||||
color: #000000;
|
||||
color: rgba(238,238,238,1);
|
||||
background: rgba(0,60,136,0.3);
|
||||
}
|
||||
.ol-attribution a {
|
||||
text-decoration: none;
|
||||
color: #7b98bc;
|
||||
color: rgba(255,255,255,1);
|
||||
}
|
||||
|
||||
.ol-attribution ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 10px;
|
||||
line-height: 12px;
|
||||
}
|
||||
.ol-attribution li {
|
||||
display: inline;
|
||||
list-style: none;
|
||||
line-height: inherit;
|
||||
}
|
||||
.ol-attribution li:not(:last-child):after {
|
||||
content: "\2003";
|
||||
}
|
||||
.ol-attribution-bing-tos {
|
||||
float:right;
|
||||
padding-top: 2px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ol-logo {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
padding: 2px;
|
||||
position: absolute;
|
||||
}
|
||||
.ol-logo ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.ol-logo ul li {
|
||||
display: inline;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.ol-mouse-position {
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.ol-scale-line {
|
||||
background: #95b9e6;
|
||||
background: rgba(0,60,136,0.3);
|
||||
border-radius: 4px;
|
||||
bottom: 8px;
|
||||
left: 8px;
|
||||
padding: 2px;
|
||||
position: absolute;
|
||||
}
|
||||
.ol-scale-line-inner {
|
||||
border: 1px solid #eeeeee;
|
||||
border-top: none;
|
||||
color: #eeeeee;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
margin: 1px;
|
||||
padding: 0px 2px;
|
||||
}
|
||||
.ol-unsupported {
|
||||
display: none;
|
||||
}
|
||||
.ol-viewport .ol-unselectable {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
}
|
||||
|
||||
.ol-zoom,
|
||||
.ol-zoom-extent,
|
||||
.ol-full-screen {
|
||||
position: absolute;
|
||||
background-color: #eee;
|
||||
background-color: rgba(255,255,255,0.4);
|
||||
border-radius: 4px;
|
||||
padding: 2px;
|
||||
}
|
||||
.ol-zoom:hover,
|
||||
.ol-zoom-extent:hover,
|
||||
.ol-full-screen:hover {
|
||||
background-color: rgba(255,255,255,0.6);
|
||||
}
|
||||
.ol-zoom {
|
||||
top: .5em;
|
||||
left: .5em;
|
||||
}
|
||||
.ol-zoom-extent {
|
||||
top: 4.643em;
|
||||
left: .5em;
|
||||
}
|
||||
.ol-full-screen {
|
||||
right: .5em;
|
||||
top: .5em;
|
||||
}
|
||||
@media print {
|
||||
.ol-zoom,
|
||||
.ol-zoom-extent,
|
||||
.ol-full-screen {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.ol-zoom button,
|
||||
.ol-zoom-extent button,
|
||||
.ol-full-screen button {
|
||||
display: block;
|
||||
margin: 1px;
|
||||
padding: 0;
|
||||
color: white;
|
||||
font-size: 1.14em;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
height: 1.375em;
|
||||
width: 1.375em;
|
||||
line-height: .4em;
|
||||
background-color: #7b98bc;
|
||||
background-color: rgba(0,60,136,0.5);
|
||||
border: none;
|
||||
}
|
||||
.ol-zoom button::-moz-focus-inner,
|
||||
.ol-zoom-extent button::-moz-focus-inner,
|
||||
.ol-full-screen button::-moz-focus-inner {
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
.ol-zoom-extent button {
|
||||
line-height: 1.4em;
|
||||
}
|
||||
.ol-touch .ol-zoom button,
|
||||
.ol-touch .ol-full-screen button,
|
||||
.ol-touch .ol-zoom-extent button {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
.ol-touch .ol-zoom-extent {
|
||||
top: 5.5em;
|
||||
}
|
||||
.ol-zoom button:hover,
|
||||
.ol-zoom button:focus,
|
||||
.ol-zoom-extent button:hover,
|
||||
.ol-zoom-extent button:focus,
|
||||
.ol-full-screen button:hover,
|
||||
.ol-full-screen button:focus {
|
||||
text-decoration: none;
|
||||
background-color: #4c6079;
|
||||
background-color: rgba(0,60,136,0.7);
|
||||
}
|
||||
.ol-zoom-extent button:after {
|
||||
content: "E";
|
||||
}
|
||||
.ol-zoom-in {
|
||||
border-radius: 2px 2px 0 0;
|
||||
}
|
||||
.ol-zoom-out {
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
button.ol-full-screen-false:after {
|
||||
content: "\2194";
|
||||
}
|
||||
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-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;
|
||||
}
|
||||
|
||||
.ol-zoomslider {
|
||||
position: absolute;
|
||||
top: 4.5em;
|
||||
left: .5em;
|
||||
|
||||
background: #eee;
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
|
||||
width: 1.5675em;
|
||||
height: 200px;
|
||||
padding: 3px;
|
||||
margin: 0;
|
||||
}
|
||||
.ol-zoomslider-thumb {
|
||||
position: absolute;
|
||||
display: block;
|
||||
background: #7b98bc;
|
||||
background: rgba(0,60,136,0.5);
|
||||
border-radius: 2px;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
|
||||
font-size: 1.14em;
|
||||
height: 1em;
|
||||
width: 1.375em;
|
||||
margin: 3px;
|
||||
padding: 0;
|
||||
}
|
||||
.ol-touch .ol-zoomslider {
|
||||
top: 5.5em;
|
||||
width: 2.052em;
|
||||
}
|
||||
.ol-touch .ol-zoomslider-thumb {
|
||||
width: 1.8em;
|
||||
}
|
||||
|
||||
.ol-zoom-extent button,
|
||||
.ol-attribution,
|
||||
.ol-full-screen button,
|
||||
.ol-scale-line-inner,
|
||||
.ol-zoom button,
|
||||
.ol-has-tooltip [role=tooltip] {
|
||||
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
title: Documentation
|
||||
layout: doc.hbs
|
||||
---
|
||||
|
||||
# Documentation
|
||||
|
||||
If you're eager to get your first OpenLayers 3 map on a page, dive into the [quick start](quickstart.html).
|
||||
|
||||
For a more in-depth overview of OpenLayers 3 core concepts, check out the [tutorials](tutorials/).
|
||||
|
||||
Find additional reference material in the [API docs](../apidoc).
|
||||
@@ -1,137 +0,0 @@
|
||||
---
|
||||
title: Quick Start
|
||||
layout: doc.hbs
|
||||
---
|
||||
|
||||
# Quick Start
|
||||
|
||||
## Workshop
|
||||
|
||||
Make sure to also check out the [OpenLayers 3 workshop](http://ol3js.org/ol3-workshop/).
|
||||
|
||||
## Put a map on a page
|
||||
|
||||
Below you'll find a complete working example. Create a new file, copy in the contents below, and open in a browser:
|
||||
|
||||
```xml
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" href="http://ol3js.org/en/{{ latest }}/css/ol.css" type="text/css">
|
||||
<style>
|
||||
.map {
|
||||
height: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<script src="http://ol3js.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
|
||||
<title>OpenLayers 3 example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>My Map</h2>
|
||||
<div id="map" class="map"></div>
|
||||
<script type="text/javascript">
|
||||
var map = new ol.Map({
|
||||
target: 'map',
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.MapQuest({layer: 'sat'})
|
||||
})
|
||||
],
|
||||
view: new ol.View2D({
|
||||
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 4
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## Understanding what is going on
|
||||
|
||||
To include a map a web page you will need 3 things:
|
||||
|
||||
1. Include OpenLayers
|
||||
2. `<div>` map container
|
||||
3. JavaScript to create a simple map
|
||||
|
||||
### Include OpenLayers
|
||||
|
||||
```xml
|
||||
<script src="http://ol3js.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
|
||||
```
|
||||
|
||||
The first part is to include the JavaScript library. For the purpose of this tutorial, here we simply point to the ol3js.org website to get the whole library. In a production environment, we would build a custom version of the library including only the module needed for our application.
|
||||
|
||||
|
||||
### `<div>` to contain the map
|
||||
|
||||
```xml
|
||||
<div id="map" class="map"></div>
|
||||
```
|
||||
|
||||
The map in the application is contained in a [`<div>` HTML element](http://en.wikipedia.org/wiki/Span_and_div). Through this `<div>` the map properties like width, height and border can be controlled through CSS. Here's the CSS element used to make the map 400 pixels high and as wide as the browser window.
|
||||
|
||||
```xml
|
||||
<style>
|
||||
.map {
|
||||
height: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### JavaScript to create a simple map
|
||||
|
||||
```js
|
||||
var map = new ol.Map({
|
||||
target: 'map',
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.MapQuest({layer: 'sat'})
|
||||
})
|
||||
],
|
||||
view: new ol.View2D({
|
||||
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 4
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
With this JavaScript code, a map object is created with a MapQuest Open Aerial layer zoomed on the African East coast. Let's break this down:
|
||||
|
||||
The following line creates an OpenLayers `Map` object. Just by itself, this does nothing since there's no layers or interaction attached to it.
|
||||
|
||||
```js
|
||||
var map = new ol.Map({ ... });
|
||||
```
|
||||
|
||||
To attach the map object to the `<div>`, the map object takes a `target` into arguments. The value is the `id` of the `<div>`:
|
||||
|
||||
```js
|
||||
target: 'map'
|
||||
```
|
||||
|
||||
The `layers: [ ... ]` array is used to define the list of layers available in the map. The first and only layer right now is a tiled layer:
|
||||
|
||||
```js
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.MapQuest({layer: 'sat'})
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
Layers in OpenLayers 3 are defined with a type (Image, Tile or Vector) which contains a source. The source is the protocol used to get the map tiles. You can consult the list of [available layer sources here](/en/{{ latest }}/apidoc/ol.source.html)
|
||||
|
||||
The next part of the `Map` object is the `View`. The view allow to specify the center, resolution, and rotation of the map. Right now, only `View2D` is supported, but other views should be available at some point. The simplest way to define a view is to define a center point and a zoom level. Note that zoom level 0 is zoomed out.
|
||||
|
||||
```js
|
||||
view: new ol.View2D({
|
||||
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 4
|
||||
})
|
||||
```
|
||||
|
||||
You will notice that the `center` specified is in lat/lon coordinates (EPSG:4326). Since the only layer we use is in Spherical Mercator projection (EPSG:3857), we can reproject them on the fly to be able to zoom the map on the right coordinates.
|
||||
@@ -1,73 +0,0 @@
|
||||
---
|
||||
title: Basic Concepts
|
||||
layout: doc.hbs
|
||||
---
|
||||
|
||||
# Basic Concepts
|
||||
|
||||
## Map
|
||||
The core component of OpenLayers 3 is the map (`ol.Map`). It is rendered to a `target` container (e.g. a `div` element on the web page that contains the map). All map properties can either be configured at construction time, or by using setter methods, e.g. `setTarget()`.
|
||||
|
||||
```xml
|
||||
<div id="map" style="width: 100%, height: 400px"></div>
|
||||
<script>
|
||||
var map = new ol.Map({target: 'map'});
|
||||
</script>
|
||||
```
|
||||
|
||||
## View
|
||||
`ol.Map` is not responsible for things like center, zoom level and projection of the map. Instead, these are properties of an `ol.View` instance - typically an `ol.View2D` for 2D maps. The reason for this abstraction is the idea of instantly switching e.g. between a 2D and a tilted 3D view, without the need to maintain two copies of the `layers`.
|
||||
|
||||
```js
|
||||
map.setView(new ol.View2D({
|
||||
center: [0, 0],
|
||||
zoom: 2
|
||||
}));
|
||||
```
|
||||
|
||||
An `ol.View2D` also has a `projection`. The projection determines the coordinate system of the `center` and the units for map resolution calculations. If not specified (like in the above snippet), the default projection is Spherical Mercator (EPSG:3857), with meters as map units.
|
||||
|
||||
The `zoom` option is a convenient way to specify the map resolution. The available zoom levels are determined by `maxZoom` (default: 28), `zoomFactor` (default: 2) and `maxResolution` (default is calculated in such a way that the projection's validity extent fits in a 256x256 pixel tile). Starting at zoom level 0 with a resolution of `maxResolution` units per pixel, subsequent zoom levels are calculated by dividing the previous zoom level's resolution by `zoomFactor`, until zoom level `maxZoom` is reached.
|
||||
|
||||
|
||||
## Source
|
||||
To get remote data for a layer, OpenLayers 3 uses `ol.source.Source` subclasses. These are available for free and commercial map tile services like OpenStreetMap or Bing, for OGC sources like WMS or WMTS, and for vector data in formats like GeoJSON or KML.
|
||||
|
||||
```js
|
||||
var osmSource = new ol.source.OSM();
|
||||
```
|
||||
|
||||
## Layer
|
||||
A layer is a visual representation of data from a `source`. OpenLayers 3 has three basic types of layers: `ol.layer.Tile`, `ol.layer.Image` and `ol.layer.Vector`.
|
||||
|
||||
`ol.layer.Tile` is for layer sources that provide pre-rendered, tiled images in grids that are organized by zoom levels for specific resolutions.
|
||||
|
||||
`ol.layer.Image` is for server rendered images that are available for arbitrary extents and resolutions.
|
||||
|
||||
`ol.layer.Vector` is for vector data that is rendered client-side.
|
||||
|
||||
```js
|
||||
var osmLayer = new ol.layer.Tile({source: osmSource});
|
||||
map.addLayer(osmLayer);
|
||||
```
|
||||
|
||||
## Putting it all together
|
||||
|
||||
|
||||
The above snippets can be conflated to a self contained map configuration with view and layers:
|
||||
|
||||
```xml
|
||||
<div id="map" style="width: 100%, height: 400px"></div>
|
||||
<script>
|
||||
new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({source: new ol.source.OSM()})
|
||||
],
|
||||
view: new ol.View2D({
|
||||
center: [0, 0],
|
||||
zoom: 2
|
||||
}),
|
||||
target: 'map'
|
||||
});
|
||||
</script>
|
||||
```
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
title: Tutorials
|
||||
layout: doc.hbs
|
||||
---
|
||||
|
||||
# Tutorials
|
||||
|
||||
We'll be putting together a more comprehensive set of tutorials here. For now, you can take a look at the [basic concepts](concepts.html) tutorial. Stay tuned for more!
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2806
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user