[gnome-maps/wip/jonasdn/geojson: 3/7] Add and convert geojson-vt to GJS
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/jonasdn/geojson: 3/7] Add and convert geojson-vt to GJS
- Date: Sun, 25 Oct 2015 08:02:30 +0000 (UTC)
commit e389ef6a1d236651402e1df9e95e99bb4c524ab5
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Fri Oct 23 12:04:03 2015 +0200
Add and convert geojson-vt to GJS
src/Makefile.am | 2 ++
src/geojson-vt/clip.js | 2 --
src/geojson-vt/convert.js | 4 +---
src/geojson-vt/index.js | 14 ++++++--------
src/geojson-vt/simplify.js | 2 --
src/geojson-vt/tile.js | 2 --
src/geojson-vt/transform.js | 3 ---
src/geojson-vt/wrap.js | 4 +---
src/org.gnome.Maps.src.gresource.xml | 7 +++++++
9 files changed, 17 insertions(+), 23 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index df345cd..2a8bf72 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,6 +6,7 @@ nodist_app_SCRIPTS = org.gnome.Maps
app_resource_files = \
$(shell $(GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) \
+ --sourcedir=$(srcdir)/geojson-vt \
--generate-dependencies \
$(srcdir)/org.gnome.Maps.src.gresource.xml \
)
@@ -13,6 +14,7 @@ app_resource_files = \
org.gnome.Maps.src.gresource: org.gnome.Maps.src.gresource.xml $(app_resource_files)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
--target=$@ \
+ --sourcedir=$(srcdir)/geojson-vt \
--sourcedir=$(srcdir) $<
resourcedir = $(pkgdatadir)
diff --git a/src/geojson-vt/clip.js b/src/geojson-vt/clip.js
index f657ad8..cad7a21 100644
--- a/src/geojson-vt/clip.js
+++ b/src/geojson-vt/clip.js
@@ -1,7 +1,5 @@
'use strict';
-module.exports = clip;
-
/* clip features between two axis-parallel lines:
* | |
* ___|___ | /
diff --git a/src/geojson-vt/convert.js b/src/geojson-vt/convert.js
index 920498e..8a58c70 100644
--- a/src/geojson-vt/convert.js
+++ b/src/geojson-vt/convert.js
@@ -1,8 +1,6 @@
'use strict';
-module.exports = convert;
-
-var simplify = require('./simplify');
+const simplify = imports.geojsonvt.simplify.simplify;
// converts GeoJSON feature into an intermediate projected JSON vector format with simplification data
diff --git a/src/geojson-vt/index.js b/src/geojson-vt/index.js
index 4cf532e..b4330fe 100644
--- a/src/geojson-vt/index.js
+++ b/src/geojson-vt/index.js
@@ -1,13 +1,11 @@
'use strict';
-module.exports = geojsonvt;
-
-var convert = require('./convert'), // GeoJSON conversion and preprocessing
- transform = require('./transform'), // coordinate transformation
- clip = require('./clip'), // stripe clipping algorithm
- wrap = require('./wrap'), // date line processing
- createTile = require('./tile'); // final simplified tile generation
-
+const convert = imports.geojsonvt.convert.convert;
+const transform = { tile: imports.geojsonvt.transform.transformTile,
+ point: imports.geojsonvt.transform.transformPoint };
+const clip = imports.geojsonvt.clip.clip;
+const createTile = imports.geojsonvt.tile.createTile;
+const wrap = imports.geojsonvt.wrap.wrap;
function geojsonvt(data, options) {
return new GeoJSONVT(data, options);
diff --git a/src/geojson-vt/simplify.js b/src/geojson-vt/simplify.js
index fe9eea6..2e55972 100644
--- a/src/geojson-vt/simplify.js
+++ b/src/geojson-vt/simplify.js
@@ -1,7 +1,5 @@
'use strict';
-module.exports = simplify;
-
// calculate simplification data using optimized Douglas-Peucker algorithm
function simplify(points, tolerance) {
diff --git a/src/geojson-vt/tile.js b/src/geojson-vt/tile.js
index 4e6ccb1..764d538 100644
--- a/src/geojson-vt/tile.js
+++ b/src/geojson-vt/tile.js
@@ -1,7 +1,5 @@
'use strict';
-module.exports = createTile;
-
function createTile(features, z2, tx, ty, tolerance, noSimplify) {
var tile = {
features: [],
diff --git a/src/geojson-vt/transform.js b/src/geojson-vt/transform.js
index 5ee426a..fe93e94 100644
--- a/src/geojson-vt/transform.js
+++ b/src/geojson-vt/transform.js
@@ -1,8 +1,5 @@
'use strict';
-exports.tile = transformTile;
-exports.point = transformPoint;
-
// Transforms the coordinates of each feature in the given tile from
// mercator-projected space into (extent x extent) tile space.
function transformTile(tile, extent) {
diff --git a/src/geojson-vt/wrap.js b/src/geojson-vt/wrap.js
index 0eefbb5..7d9b243 100644
--- a/src/geojson-vt/wrap.js
+++ b/src/geojson-vt/wrap.js
@@ -1,8 +1,6 @@
'use strict';
-var clip = require('./clip');
-
-module.exports = wrap;
+const clip = imports.geojsonvt.clip.clip;
function wrap(features, buffer, intersectX) {
var merged = features,
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index a15ac7e..77ca028 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -54,5 +54,12 @@
<file>userLocationMarker.js</file>
<file>utils.js</file>
<file>zoomControl.js</file>
+ <file alias="geojsonvt/clip.js">clip.js</file>
+ <file alias="geojsonvt/convert.js">convert.js</file>
+ <file alias="geojsonvt/geojsonvt.js">index.js</file>
+ <file alias="geojsonvt/simplify.js">simplify.js</file>
+ <file alias="geojsonvt/tile.js">tile.js</file>
+ <file alias="geojsonvt/transform.js">transform.js</file>
+ <file alias="geojsonvt/wrap.js">wrap.js</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]