StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.8 KiB
66 lines
1.8 KiB
import {Transform} from 'vega-dataflow';
|
|
import {getProjectionPath} from 'vega-projection';
|
|
import {inherits, identity} from 'vega-util';
|
|
|
|
/**
|
|
* Map GeoJSON data to an SVG path string.
|
|
* @constructor
|
|
* @param {object} params - The parameters for this operator.
|
|
* @param {function(number, number): *} params.projection - The cartographic
|
|
* projection to apply.
|
|
* @param {function(object): *} [params.field] - The field with GeoJSON data,
|
|
* or null if the tuple itself is a GeoJSON feature.
|
|
* @param {string} [params.as='path'] - The output field in which to store
|
|
* the generated path data (default 'path').
|
|
*/
|
|
export default function GeoPath(params) {
|
|
Transform.call(this, null, params);
|
|
}
|
|
|
|
GeoPath.Definition = {
|
|
"type": "GeoPath",
|
|
"metadata": {"modifies": true},
|
|
"params": [
|
|
{ "name": "projection", "type": "projection" },
|
|
{ "name": "field", "type": "field" },
|
|
{ "name": "pointRadius", "type": "number", "expr": true },
|
|
{ "name": "as", "type": "string", "default": "path" }
|
|
]
|
|
};
|
|
|
|
var prototype = inherits(GeoPath, Transform);
|
|
|
|
prototype.transform = function(_, pulse) {
|
|
var out = pulse.fork(pulse.ALL),
|
|
path = this.value,
|
|
field = _.field || identity,
|
|
as = _.as || 'path',
|
|
flag = out.SOURCE;
|
|
|
|
function set(t) { t[as] = path(field(t)); }
|
|
|
|
if (!path || _.modified()) {
|
|
// parameters updated, reset and reflow
|
|
this.value = path = getProjectionPath(_.projection);
|
|
out.materialize().reflow();
|
|
} else {
|
|
flag = field === identity || pulse.modified(field.fields)
|
|
? out.ADD_MOD
|
|
: out.ADD;
|
|
}
|
|
|
|
var prev = initPath(path, _.pointRadius);
|
|
out.visit(flag, set);
|
|
path.pointRadius(prev);
|
|
|
|
return out.modifies(as);
|
|
};
|
|
|
|
function initPath(path, pointRadius) {
|
|
var prev = path.pointRadius();
|
|
path.context(null);
|
|
if (pointRadius != null) {
|
|
path.pointRadius(pointRadius);
|
|
}
|
|
return prev;
|
|
}
|
|
|