Comparing version 2.1.0 to 2.1.1
@@ -452,4 +452,4 @@ (function (global, factory) { | ||
features: features.reduce(function(list, f) { | ||
(f && f.type === FeatureCollection) | ||
? list.push.apply(list, f.features) | ||
(f && f.type === FeatureCollection) ? list.push.apply(list, f.features) | ||
: vegaUtil.isArray(f) ? list.push.apply(list, f) | ||
: list.push(f); | ||
@@ -456,0 +456,0 @@ return list; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-array"),require("d3-contour"),require("vega-projection"),require("d3-geo")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-array","d3-contour","vega-projection","d3-geo"],t):t((e.vega=e.vega||{},e.vega.transforms=e.vega.transforms||{}),e.vega,e.vega,e.d3,e.d3,e.vega,e.d3)}(this,function(e,t,n,r,i,a,o){"use strict";function s(e){t.Transform.call(this,null,e)}function u(e){return function(t){for(var n=r.extent(t),i=n[0],a=n[1]-i,o=[],s=1;s<=e;++s)o.push(i+a*s/(e+1));return o}}function f(e){t.Transform.call(this,null,e)}function l(e){t.Transform.call(this,null,e)}function d(e){t.Transform.call(this,null,e)}function c(e){t.Transform.call(this,null,e)}function m(e,t){var n=function(n){return e(t(n))};return n.context=function(t){return e.context(t),n},n}function p(e){t.Transform.call(this,[],e),this.generator=o.geoGraticule()}function h(e){t.Transform.call(this,null,e),this.modified(!0)}function y(e,t){var n=j(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function g(e){var t=a.projection((e||"mercator").toLowerCase());return t||n.error("Unrecognized projection type: "+e),t()}function v(e,t,r){n.isFunction(e[t])&&e[t](r)}function j(e){return 1===(e=n.array(e)).length?e[0]:{type:x,features:e.reduce(function(e,t){return t&&t.type===x?e.push.apply(e,t.features):e.push(t),e},[])}}var D=["values","size"],b=["x","y","size","cellSize","bandwidth"];s.Definition={type:"Contour",metadata:{generates:!0,source:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"number",default:!1},{name:"thresholds",type:"number",array:!0}]},n.inherits(s,t.Transform).transform=function(e,n){if(this.value&&!n.changed()&&!e.modified())return n.StopPropagation;var r,a,o,s=n.fork(n.NO_SOURCE|n.NO_FIELDS),f=e.count||10;return e.values?(r=i.contours(),a=D,o=e.values):(r=i.contourDensity(),a=b,o=n.materialize(n.SOURCE).source),r.thresholds(e.thresholds||(e.nice?f:u(f))),a.forEach(function(t){null!=e[t]&&r[t](e[t])}),this.value&&(s.rem=this.value),this.value=s.source=s.add=r(o).map(t.ingest),s};var x="FeatureCollection";f.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},n.inherits(f,t.Transform).transform=function(e,t){var r,i=this._features,a=this._points,o=e.fields,s=o&&o[0],u=o&&o[1],f=e.geojson,l=t.ADD;r=e.modified()||t.changed(t.REM)||t.modified(n.accessorFields(f))||s&&t.modified(n.accessorFields(s))||u&&t.modified(n.accessorFields(u)),this.value&&!r||(l=t.SOURCE,this._features=i=[],this._points=a=[]),f&&t.visit(l,function(e){i.push(f(e))}),s&&u&&(t.visit(l,function(e){var t=s(e),n=u(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&a.push([t,n])}),i=i.concat({type:"Feature",geometry:{type:"MultiPoint",coordinates:a}})),this.value={type:x,features:i}},l.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"as",type:"string",default:"path"}]},n.inherits(l,t.Transform).transform=function(e,t){function r(e){e[f]=s(u(e))}var i,o=t.fork(t.ALL),s=this.value,u=e.field||n.identity,f=e.as||"path";return!s||e.modified()?(this.value=s=a.getProjectionPath(e.projection).context(null),o.materialize().reflow().visit(o.SOURCE,r)):(s.context(null),i=u===n.identity||t.modified(u.fields),o.visit(i?o.ADD_MOD:o.ADD,r)),o.modifies(f)},d.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},n.inherits(d,t.Transform).transform=function(e,t){function n(e){var t=i([a(e),o(e)]);t?(e[u]=t[0],e[f]=t[1]):(e[u]=void 0,e[f]=void 0)}var r,i=e.projection,a=e.fields[0],o=e.fields[1],s=e.as||["x","y"],u=s[0],f=s[1];return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,n):(r=t.modified(a.fields)||t.modified(o.fields),t.visit(r?t.ADD_MOD:t.ADD,n)),t.modifies(s)},c.Definition={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"as",type:"string",default:"shape"}]},n.inherits(c,t.Transform).transform=function(e,t){var r=t.fork(t.ALL),i=this.value,o=e.field||n.field("datum"),s=e.as||"shape",u=r.ADD_MOD;return i&&!e.modified()||(this.value=i=m(a.getProjectionPath(e.projection),o),r.materialize().reflow(),u=r.SOURCE),r.visit(u,function(e){e[s]=i}),r.modifies(s)},p.Definition={type:"Graticule",metadata:{source:!0,generates:!0,changes:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},n.inherits(p,t.Transform).transform=function(e,r){var i,a=r.fork(),o=this.value,s=this.generator;if(!o.length||e.modified())for(var u in e)n.isFunction(s[u])&&s[u](e[u]);return i=s(),o.length?a.mod.push(t.replace(o[0],i)):a.add.push(t.ingest(i)),o[0]=i,a.source=o,a},n.inherits(h,t.Transform).transform=function(e,t){var n=this.value;return!n||e.modified("type")?(this.value=n=g(e.type),a.projectionProperties.forEach(function(t){null!=e[t]&&v(n,t,e[t])})):a.projectionProperties.forEach(function(t){e.modified(t)&&v(n,t,e[t])}),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&y(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)},e.contour=s,e.geojson=f,e.geopath=l,e.geopoint=d,e.geoshape=c,e.graticule=p,e.projection=h,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-array"),require("d3-contour"),require("vega-projection"),require("d3-geo")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-array","d3-contour","vega-projection","d3-geo"],t):t((e.vega=e.vega||{},e.vega.transforms=e.vega.transforms||{}),e.vega,e.vega,e.d3,e.d3,e.vega,e.d3)}(this,function(e,t,n,r,i,a,o){"use strict";function s(e){t.Transform.call(this,null,e)}function u(e){return function(t){for(var n=r.extent(t),i=n[0],a=n[1]-i,o=[],s=1;s<=e;++s)o.push(i+a*s/(e+1));return o}}function f(e){t.Transform.call(this,null,e)}function l(e){t.Transform.call(this,null,e)}function d(e){t.Transform.call(this,null,e)}function c(e){t.Transform.call(this,null,e)}function m(e,t){var n=function(n){return e(t(n))};return n.context=function(t){return e.context(t),n},n}function p(e){t.Transform.call(this,[],e),this.generator=o.geoGraticule()}function h(e){t.Transform.call(this,null,e),this.modified(!0)}function y(e,t){var n=j(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function g(e){var t=a.projection((e||"mercator").toLowerCase());return t||n.error("Unrecognized projection type: "+e),t()}function v(e,t,r){n.isFunction(e[t])&&e[t](r)}function j(e){return 1===(e=n.array(e)).length?e[0]:{type:x,features:e.reduce(function(e,t){return t&&t.type===x?e.push.apply(e,t.features):n.isArray(t)?e.push.apply(e,t):e.push(t),e},[])}}var D=["values","size"],b=["x","y","size","cellSize","bandwidth"];s.Definition={type:"Contour",metadata:{generates:!0,source:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"number",default:!1},{name:"thresholds",type:"number",array:!0}]},n.inherits(s,t.Transform).transform=function(e,n){if(this.value&&!n.changed()&&!e.modified())return n.StopPropagation;var r,a,o,s=n.fork(n.NO_SOURCE|n.NO_FIELDS),f=e.count||10;return e.values?(r=i.contours(),a=D,o=e.values):(r=i.contourDensity(),a=b,o=n.materialize(n.SOURCE).source),r.thresholds(e.thresholds||(e.nice?f:u(f))),a.forEach(function(t){null!=e[t]&&r[t](e[t])}),this.value&&(s.rem=this.value),this.value=s.source=s.add=r(o).map(t.ingest),s};var x="FeatureCollection";f.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},n.inherits(f,t.Transform).transform=function(e,t){var r,i=this._features,a=this._points,o=e.fields,s=o&&o[0],u=o&&o[1],f=e.geojson,l=t.ADD;r=e.modified()||t.changed(t.REM)||t.modified(n.accessorFields(f))||s&&t.modified(n.accessorFields(s))||u&&t.modified(n.accessorFields(u)),this.value&&!r||(l=t.SOURCE,this._features=i=[],this._points=a=[]),f&&t.visit(l,function(e){i.push(f(e))}),s&&u&&(t.visit(l,function(e){var t=s(e),n=u(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&a.push([t,n])}),i=i.concat({type:"Feature",geometry:{type:"MultiPoint",coordinates:a}})),this.value={type:x,features:i}},l.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"as",type:"string",default:"path"}]},n.inherits(l,t.Transform).transform=function(e,t){function r(e){e[f]=s(u(e))}var i,o=t.fork(t.ALL),s=this.value,u=e.field||n.identity,f=e.as||"path";return!s||e.modified()?(this.value=s=a.getProjectionPath(e.projection).context(null),o.materialize().reflow().visit(o.SOURCE,r)):(s.context(null),i=u===n.identity||t.modified(u.fields),o.visit(i?o.ADD_MOD:o.ADD,r)),o.modifies(f)},d.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},n.inherits(d,t.Transform).transform=function(e,t){function n(e){var t=i([a(e),o(e)]);t?(e[u]=t[0],e[f]=t[1]):(e[u]=void 0,e[f]=void 0)}var r,i=e.projection,a=e.fields[0],o=e.fields[1],s=e.as||["x","y"],u=s[0],f=s[1];return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,n):(r=t.modified(a.fields)||t.modified(o.fields),t.visit(r?t.ADD_MOD:t.ADD,n)),t.modifies(s)},c.Definition={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"as",type:"string",default:"shape"}]},n.inherits(c,t.Transform).transform=function(e,t){var r=t.fork(t.ALL),i=this.value,o=e.field||n.field("datum"),s=e.as||"shape",u=r.ADD_MOD;return i&&!e.modified()||(this.value=i=m(a.getProjectionPath(e.projection),o),r.materialize().reflow(),u=r.SOURCE),r.visit(u,function(e){e[s]=i}),r.modifies(s)},p.Definition={type:"Graticule",metadata:{source:!0,generates:!0,changes:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},n.inherits(p,t.Transform).transform=function(e,r){var i,a=r.fork(),o=this.value,s=this.generator;if(!o.length||e.modified())for(var u in e)n.isFunction(s[u])&&s[u](e[u]);return i=s(),o.length?a.mod.push(t.replace(o[0],i)):a.add.push(t.ingest(i)),o[0]=i,a.source=o,a},n.inherits(h,t.Transform).transform=function(e,t){var n=this.value;return!n||e.modified("type")?(this.value=n=g(e.type),a.projectionProperties.forEach(function(t){null!=e[t]&&v(n,t,e[t])})):a.projectionProperties.forEach(function(t){e.modified(t)&&v(n,t,e[t])}),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&y(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)},e.contour=s,e.geojson=f,e.geopath=l,e.geopoint=d,e.geoshape=c,e.graticule=p,e.projection=h,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "vega-geo", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Geographic data transforms for Vega dataflows.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import {FeatureCollection} from './constants'; | ||
import {Transform} from 'vega-dataflow'; | ||
import {projection, projectionProperties} from 'vega-projection'; | ||
import {array, error, inherits, isFunction} from 'vega-util'; | ||
import {array, error, inherits, isArray, isFunction} from 'vega-util'; | ||
@@ -61,4 +61,4 @@ /** | ||
features: features.reduce(function(list, f) { | ||
(f && f.type === FeatureCollection) | ||
? list.push.apply(list, f.features) | ||
(f && f.type === FeatureCollection) ? list.push.apply(list, f.features) | ||
: isArray(f) ? list.push.apply(list, f) | ||
: list.push(f); | ||
@@ -65,0 +65,0 @@ return list; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40871