Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
@@ -13,3 +13,2 @@ (function (global, factory) { | ||
* projection to apply. | ||
* @param {number} params.pointRadius - The point radius for path points. | ||
* @param {function(object): *} [params.field] - The field with GeoJSON data, | ||
@@ -37,6 +36,3 @@ * or null if the tuple itself is a GeoJSON feature. | ||
// parameters updated, reset and reflow | ||
this.value = path = d3Geo.geoPath() | ||
.pointRadius(_.pointRadius) | ||
.projection(_.projection); | ||
this.value = path = _.projection.path; | ||
out.materialize().reflow().visit(out.SOURCE, set); | ||
@@ -100,3 +96,2 @@ } else { | ||
* projection to apply. | ||
* @param {number} params.pointRadius - The point radius for path points. | ||
* @param {function(object): *} [params.field] - The field with GeoJSON data, | ||
@@ -122,7 +117,3 @@ * or null if the tuple itself is a GeoJSON feature. | ||
// parameters updated, reset and reflow | ||
this.value = shape = shapeGenerator( | ||
d3Geo.geoPath().pointRadius(_.pointRadius).projection(_.projection), | ||
datum | ||
); | ||
this.value = shape = shapeGenerator(_.projection.path, datum); | ||
out.materialize().reflow(); | ||
@@ -211,2 +202,4 @@ flag = out.SOURCE; | ||
p.path = d3Geo.geoPath().projection(p); | ||
p.copy = p.copy || function() { | ||
@@ -217,2 +210,3 @@ var c = projection(); | ||
}); | ||
c.path.pointRadius(p.path.pointRadius()); | ||
return c; | ||
@@ -276,2 +270,4 @@ }; | ||
} | ||
if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); | ||
}; | ||
@@ -294,3 +290,2 @@ | ||
{ "name": "projection", "type": "projection", "required": true }, | ||
{ "name": "pointRadius", "type": "number" }, | ||
{ "name": "field", "type": "field" }, | ||
@@ -316,3 +311,2 @@ { "name": "as", "type": "string", "default": "path" } | ||
{ "name": "projection", "type": "projection", "required": true }, | ||
{ "name": "pointRadius", "type": "number" }, | ||
{ "name": "field", "type": "field", "default": "datum" }, | ||
@@ -338,3 +332,3 @@ { "name": "as", "type": "string", "default": "shape" } | ||
] | ||
}; | ||
} | ||
@@ -341,0 +335,0 @@ vegaDataflow.register(GeoPathDefinition, GeoPath); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-geo")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-geo"],t):t(e.vega=e.vega||{},e.vega,e.vega,e.d3)}(this,function(e,t,r,a){"use strict";function i(e){t.Transform.call(this,null,e)}function n(e){t.Transform.call(this,null,e)}function o(e){t.Transform.call(this,null,e)}function s(e,t){var r=function(r){return e(t(r))};return r.context=function(t){return e.context(t),r},r}function u(e){t.Transform.call(this,[],e),this.generator=a.geoGraticule()}function f(e,t){return function r(){var a=t();return a.type=e,a.copy=a.copy||function(){var e=r();return v.forEach(function(t){a.hasOwnProperty(t)&&e[t](a[t]())}),e},a}}function l(e,t){return arguments.length>1?(j[e]=f(e,t),this):j.hasOwnProperty(e)?j[e]:null}function c(e){t.Transform.call(this,null,e),this.modified(!0)}function d(e){var t=l((e||"mercator").toLowerCase());return t||r.error("Unrecognized projection type: "+e),t()}function m(e,t,a){r.isFunction(e[t])&&e[t](a)}var p=r.inherits(i,t.Transform);p.transform=function(e,t){function i(e){e[f]=s(u(e))}var n,o=t.fork(t.ALL),s=this.value,u=e.field||r.identity,f=e.as||"path";return!s||e.modified()?(this.value=s=a.geoPath().pointRadius(e.pointRadius).projection(e.projection),o.materialize().reflow().visit(o.SOURCE,i)):(n=u===r.identity||t.modified(u.fields),o.visit(n?o.ADD_MOD:o.ADD,i)),o.modifies(f)};var g=r.inherits(n,t.Transform);g.transform=function(e,t){function r(e){var t=i([n(e),o(e)]);t?(e[u]=t[0],e[f]=t[1]):(e[u]=void 0,e[f]=void 0)}var a,i=e.projection,n=e.fields[0],o=e.fields[1],s=e.as||["x","y"],u=s[0],f=s[1];return e.modified()?t.materialize().reflow(!0).visit(t.SOURCE,r):(a=t.modified(n.fields)||t.modified(o.fields),t.visit(a?t.ADD_MOD:t.ADD,r)),t.modifies(s)};var h=r.inherits(o,t.Transform);h.transform=function(e,t){var i=t.fork(t.ALL),n=this.value,o=e.field||r.field("datum"),u=e.as||"shape",f=i.ADD_MOD;return n&&!e.modified()||(this.value=n=s(a.geoPath().pointRadius(e.pointRadius).projection(e.projection),o),i.materialize().reflow(),f=i.SOURCE),i.visit(f,function(e){e[u]=n}),i.modifies(u)};var y=r.inherits(u,t.Transform);y.transform=function(e,a){var i,n=a.fork(),o=this.value,s=this.generator;if(!o.length||e.modified())for(var u in e)r.isFunction(s[u])&&s[u](e[u]);return i=s(),o.length?(i._id=o[0]._id,n.mod.push(i)):n.add.push(t.ingest(i)),o[0]=i,n.source=o,n};var v=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"],j={albers:a.geoAlbers,albersusa:a.geoAlbersUsa,azimuthalequalarea:a.geoAzimuthalEqualArea,azimuthalequidistant:a.geoAzimuthalEquidistant,conicconformal:a.geoConicConformal,conicequalarea:a.geoConicEqualArea,conicequidistant:a.geoConicEquidistant,equirectangular:a.geoEquirectangular,gnomonic:a.geoGnomonic,mercator:a.geoMercator,orthographic:a.geoOrthographic,stereographic:a.geoStereographic,transversemercator:a.geoTransverseMercator};for(var q in j)l(q,j[q]);var b=r.inherits(c,t.Transform);b.transform=function(e){var t=this.value;!t||e.modified("type")?(this.value=t=d(e.type),v.forEach(function(r){null!=e[r]&&m(t,r,e[r])})):v.forEach(function(r){e.modified(r)&&m(t,r,e[r])})};var A={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"pointRadius",type:"number"},{name:"field",type:"field"},{name:"as",type:"string",default:"path"}]},D={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"]}]},E={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"pointRadius",type:"number"},{name:"field",type:"field",default:"datum"},{name:"as",type:"string",default:"shape"}]},x={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}]};t.register(A,i),t.register(D,n),t.register(E,o),t.register(x,u),t.transform("Projection",c),e.transform=t.transform,e.definition=t.definition,e.projection=l,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-geo")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-geo"],t):t(e.vega=e.vega||{},e.vega,e.vega,e.d3)}(this,function(e,t,r,a){"use strict";function i(e){t.Transform.call(this,null,e)}function n(e){t.Transform.call(this,null,e)}function o(e){t.Transform.call(this,null,e)}function s(e,t){var r=function(r){return e(t(r))};return r.context=function(t){return e.context(t),r},r}function u(e){t.Transform.call(this,[],e),this.generator=a.geoGraticule()}function f(e,t){return function r(){var i=t();return i.type=e,i.path=a.geoPath().projection(i),i.copy=i.copy||function(){var e=r();return v.forEach(function(t){i.hasOwnProperty(t)&&e[t](i[t]())}),e.path.pointRadius(i.path.pointRadius()),e},i}}function l(e,t){return arguments.length>1?(j[e]=f(e,t),this):j.hasOwnProperty(e)?j[e]:null}function c(e){t.Transform.call(this,null,e),this.modified(!0)}function d(e){var t=l((e||"mercator").toLowerCase());return t||r.error("Unrecognized projection type: "+e),t()}function p(e,t,a){r.isFunction(e[t])&&e[t](a)}var m=r.inherits(i,t.Transform);m.transform=function(e,t){function a(e){e[u]=o(s(e))}var i,n=t.fork(t.ALL),o=this.value,s=e.field||r.identity,u=e.as||"path";return!o||e.modified()?(this.value=o=e.projection.path,n.materialize().reflow().visit(n.SOURCE,a)):(i=s===r.identity||t.modified(s.fields),n.visit(i?n.ADD_MOD:n.ADD,a)),n.modifies(u)};var h=r.inherits(n,t.Transform);h.transform=function(e,t){function r(e){var t=i([n(e),o(e)]);t?(e[u]=t[0],e[f]=t[1]):(e[u]=void 0,e[f]=void 0)}var a,i=e.projection,n=e.fields[0],o=e.fields[1],s=e.as||["x","y"],u=s[0],f=s[1];return e.modified()?t.materialize().reflow(!0).visit(t.SOURCE,r):(a=t.modified(n.fields)||t.modified(o.fields),t.visit(a?t.ADD_MOD:t.ADD,r)),t.modifies(s)};var g=r.inherits(o,t.Transform);g.transform=function(e,t){var a=t.fork(t.ALL),i=this.value,n=e.field||r.field("datum"),o=e.as||"shape",u=a.ADD_MOD;return i&&!e.modified()||(this.value=i=s(e.projection.path,n),a.materialize().reflow(),u=a.SOURCE),a.visit(u,function(e){e[o]=i}),a.modifies(o)};var y=r.inherits(u,t.Transform);y.transform=function(e,a){var i,n=a.fork(),o=this.value,s=this.generator;if(!o.length||e.modified())for(var u in e)r.isFunction(s[u])&&s[u](e[u]);return i=s(),o.length?(i._id=o[0]._id,n.mod.push(i)):n.add.push(t.ingest(i)),o[0]=i,n.source=o,n};var v=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"],j={albers:a.geoAlbers,albersusa:a.geoAlbersUsa,azimuthalequalarea:a.geoAzimuthalEqualArea,azimuthalequidistant:a.geoAzimuthalEquidistant,conicconformal:a.geoConicConformal,conicequalarea:a.geoConicEqualArea,conicequidistant:a.geoConicEquidistant,equirectangular:a.geoEquirectangular,gnomonic:a.geoGnomonic,mercator:a.geoMercator,orthographic:a.geoOrthographic,stereographic:a.geoStereographic,transversemercator:a.geoTransverseMercator};for(var q in j)l(q,j[q]);var b=r.inherits(c,t.Transform);b.transform=function(e){var t=this.value;!t||e.modified("type")?(this.value=t=d(e.type),v.forEach(function(r){null!=e[r]&&p(t,r,e[r])})):v.forEach(function(r){e.modified(r)&&p(t,r,e[r])}),null!=e.pointRadius&&t.path.pointRadius(e.pointRadius)};var A={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"field",type:"field"},{name:"as",type:"string",default:"path"}]},D={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"]}]},E={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"field",type:"field",default:"datum"},{name:"as",type:"string",default:"shape"}]},x={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}]};t.register(A,i),t.register(D,n),t.register(E,o),t.register(x,u),t.transform("Projection",c),e.transform=t.transform,e.definition=t.definition,e.projection=l,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -6,3 +6,2 @@ export default { | ||
{ "name": "projection", "type": "projection", "required": true }, | ||
{ "name": "pointRadius", "type": "number" }, | ||
{ "name": "field", "type": "field" }, | ||
@@ -9,0 +8,0 @@ { "name": "as", "type": "string", "default": "path" } |
@@ -6,3 +6,2 @@ export default { | ||
{ "name": "projection", "type": "projection", "required": true }, | ||
{ "name": "pointRadius", "type": "number" }, | ||
{ "name": "field", "type": "field", "default": "datum" }, | ||
@@ -9,0 +8,0 @@ { "name": "as", "type": "string", "default": "shape" } |
@@ -16,2 +16,2 @@ export default { | ||
] | ||
}; | ||
} |
{ | ||
"name": "vega-geo", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "Geographic data transforms for Vega dataflows.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import {Transform} from 'vega-dataflow'; | ||
import {inherits, identity} from 'vega-util'; | ||
import {geoPath} from 'd3-geo'; | ||
@@ -11,3 +10,2 @@ /** | ||
* projection to apply. | ||
* @param {number} params.pointRadius - The point radius for path points. | ||
* @param {function(object): *} [params.field] - The field with GeoJSON data, | ||
@@ -35,6 +33,3 @@ * or null if the tuple itself is a GeoJSON feature. | ||
// parameters updated, reset and reflow | ||
this.value = path = geoPath() | ||
.pointRadius(_.pointRadius) | ||
.projection(_.projection); | ||
this.value = path = _.projection.path; | ||
out.materialize().reflow().visit(out.SOURCE, set); | ||
@@ -41,0 +36,0 @@ } else { |
import {Transform} from 'vega-dataflow'; | ||
import {inherits, field} from 'vega-util'; | ||
import {geoPath} from 'd3-geo'; | ||
@@ -11,3 +10,2 @@ /** | ||
* projection to apply. | ||
* @param {number} params.pointRadius - The point radius for path points. | ||
* @param {function(object): *} [params.field] - The field with GeoJSON data, | ||
@@ -33,7 +31,3 @@ * or null if the tuple itself is a GeoJSON feature. | ||
// parameters updated, reset and reflow | ||
this.value = shape = shapeGenerator( | ||
geoPath().pointRadius(_.pointRadius).projection(_.projection), | ||
datum | ||
); | ||
this.value = shape = shapeGenerator(_.projection.path, datum); | ||
out.materialize().reflow(); | ||
@@ -40,0 +34,0 @@ flag = out.SOURCE; |
@@ -30,2 +30,4 @@ import {Transform} from 'vega-dataflow'; | ||
} | ||
if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); | ||
}; | ||
@@ -32,0 +34,0 @@ |
@@ -14,3 +14,4 @@ import { | ||
geoStereographic, | ||
geoTransverseMercator | ||
geoTransverseMercator, | ||
geoPath | ||
} from 'd3-geo'; | ||
@@ -50,2 +51,4 @@ | ||
p.path = geoPath().projection(p); | ||
p.copy = p.copy || function() { | ||
@@ -56,2 +59,3 @@ var c = projection(); | ||
}); | ||
c.path.pointRadius(p.path.pointRadius()); | ||
return c; | ||
@@ -58,0 +62,0 @@ }; |
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
28394
599