|
|
|
|
@ -3,6 +3,9 @@
|
|
|
|
|
var TestSetup = function(div, lineParameter, replotFunctions) {
|
|
|
|
|
div.append("<div id='normalParameters' class='parameterBox'></div>");
|
|
|
|
|
$("#normalParameters").append("<input class='parameterInput' id='apply' type='checkbox' onchange='TestSetup.applyChanged()'>apply</input>");
|
|
|
|
|
$("#normalParameters").append("<input class='parameterInput' id='monotonicFit' type='checkbox' onchange='TestSetup.monotonicFitChanged()'>monotonicFit</input>");
|
|
|
|
|
$("#normalParameters").append("<input class='parameterInput' id='tension' type='range' min='0' max='1' step='0.1' onchange='TestSetup.tensionChanged()'>tension /in [0,1]</input>");
|
|
|
|
|
$("#normalParameters").append("<input class='parameterInput' id='nrSplinePoints' type='text' onchange='TestSetup.nrSplinePointsChanged()'># spline points</input>");
|
|
|
|
|
|
|
|
|
|
div.append("<div id='legacyParameters' class='parameterBox'></div>");
|
|
|
|
|
$("#legacyParameters").append("<input class='parameterInput' id='useLegacy' type='checkbox' onchange='TestSetup.useLegacyChanged()'>use legacy options</input>");
|
|
|
|
|
@ -10,136 +13,121 @@
|
|
|
|
|
$("#legacyParameters").append("<input class='parameterInput' id='legacyPointFactor' type='text' onchange='TestSetup.legacyPointFactorChanged()'>point factor</input>");
|
|
|
|
|
$("#legacyParameters").append("<input class='parameterInput' id='legacyFitPointDist' type='text' onchange='TestSetup.legacyFitPointDistChanged()'>fit point dist</input>");
|
|
|
|
|
|
|
|
|
|
function replotAll() {
|
|
|
|
|
|
|
|
|
|
var parameter = lineParameter;
|
|
|
|
|
var changing = false;
|
|
|
|
|
var parameter = {
|
|
|
|
|
apply: $("#apply").prop("checked"),
|
|
|
|
|
monotonicFit: $("#monotonicFit").prop("checked"),
|
|
|
|
|
tension: $("#tension").val(),
|
|
|
|
|
nrSplinePoints: $("#nrSplinePoints").val(),
|
|
|
|
|
legacyOverride: undefined
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if ($("#useLegacy").prop("checked")) {
|
|
|
|
|
var fDist = $("#legacyFitPointDist").val();
|
|
|
|
|
|
|
|
|
|
parameter.legacyOverride = {
|
|
|
|
|
fit: $("#legacyFit").prop("checked"),
|
|
|
|
|
curvePointFactor: $("#legacyPointFactor").val(),
|
|
|
|
|
fitPointDist: (fDist == '') ? undefined : fDist,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function replotAll(parameter, replotFunctions) {
|
|
|
|
|
for (var i = 0; i < replotFunctions.length; i++) {
|
|
|
|
|
replotFunctions[i](parameter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function init(parameter) {
|
|
|
|
|
if (changing) return;
|
|
|
|
|
changing = true;
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var defaultParam = {
|
|
|
|
|
active: false,
|
|
|
|
|
apply: false,
|
|
|
|
|
monotonicFit: false,
|
|
|
|
|
tension: 0.0,
|
|
|
|
|
nrSplinePoints: 20,
|
|
|
|
|
legacyOverride: undefined
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var combinedParam = jQuery.extend(defaultParam, parameter);
|
|
|
|
|
|
|
|
|
|
if (combinedParam.legacyOverride == true) {
|
|
|
|
|
combinedParam.legacyOverride = {
|
|
|
|
|
fit : false,
|
|
|
|
|
curvePointFactor : 20,
|
|
|
|
|
fitPointDist : undefined
|
|
|
|
|
};
|
|
|
|
|
parameter.legacyOverride = {
|
|
|
|
|
var defaultLegacy = {
|
|
|
|
|
fit: false,
|
|
|
|
|
curvePointFactor: 20,
|
|
|
|
|
fitPointDist: undefined
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (typeof parameter.legacyOverride != 'undefined' ) {
|
|
|
|
|
defaultParam.legacyOverride = defaultLegacy;
|
|
|
|
|
if (parameter.legacyOverride == true) {
|
|
|
|
|
parameter.legacyOverride = defaultLegacy;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var combinedParam = jQuery.extend(true, defaultParam, parameter);
|
|
|
|
|
|
|
|
|
|
$("#apply").prop("checked", combinedParam.apply);
|
|
|
|
|
|
|
|
|
|
var withLegacy = (typeof combinedParam.legacyOverride != 'undefined' && combinedParam.legacyOverride != false);
|
|
|
|
|
var fit = withLegacy ? combinedParam.legacyOverride.fit : false;
|
|
|
|
|
var pointFactor = withLegacy ? combinedParam.legacyOverride.curvePointFactor : '20';
|
|
|
|
|
var fitDist = withLegacy ? combinedParam.legacyOverride.fitPointDist : '';
|
|
|
|
|
var withLegacy = (typeof combinedParam.legacyOverride != 'undefined');
|
|
|
|
|
var fit = combinedParam.legacyOverride.fit;
|
|
|
|
|
var pointFactor = combinedParam.legacyOverride.curvePointFactor;
|
|
|
|
|
var fitDist = combinedParam.legacyOverride.fitPointDist;
|
|
|
|
|
var monotone = combinedParam.monotonicFit;
|
|
|
|
|
var tension = combinedParam.tension;
|
|
|
|
|
var nrPoints = combinedParam.nrSplinePoints;
|
|
|
|
|
|
|
|
|
|
$("#useLegacy").prop("checked", withLegacy);
|
|
|
|
|
$("#legacyFit").prop("checked", fit);
|
|
|
|
|
$("#legacyPointFactor").val(pointFactor);
|
|
|
|
|
$("#legacyFitPointDist").val(fitDist);
|
|
|
|
|
$("#monotonicFit").prop("checked", monotone);
|
|
|
|
|
$("#tension").val(tension);
|
|
|
|
|
$("#nrSplinePoints").val(nrPoints);
|
|
|
|
|
|
|
|
|
|
replotAll(parameter, replotFunctions);
|
|
|
|
|
}
|
|
|
|
|
changing = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TestSetup.applyChanged = function() {
|
|
|
|
|
if (changing) return;
|
|
|
|
|
changing = true;
|
|
|
|
|
{
|
|
|
|
|
parameter.apply = $("#apply").prop("checked");
|
|
|
|
|
replotAll(parameter, replotFunctions);
|
|
|
|
|
}
|
|
|
|
|
changing = false;
|
|
|
|
|
replotAll();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TestSetup.useLegacyChanged = function() {
|
|
|
|
|
if (changing) return;
|
|
|
|
|
changing = true;
|
|
|
|
|
{
|
|
|
|
|
if ($("#useLegacy").prop("checked")) {
|
|
|
|
|
parameter.legacyOverride = {
|
|
|
|
|
fit : false,
|
|
|
|
|
curvePointFactor : 20,
|
|
|
|
|
fitPointDist : undefined
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
parameter.legacyOverride = undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("#legacyFit").prop("checked", false);
|
|
|
|
|
$("#legacyPointFactor").val(20);
|
|
|
|
|
$("#legacyFitPointDist").val('');
|
|
|
|
|
replotAll(parameter, replotFunctions);
|
|
|
|
|
}
|
|
|
|
|
changing = false;
|
|
|
|
|
replotAll();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TestSetup.legacyFitChanged = function() {
|
|
|
|
|
if (changing) return;
|
|
|
|
|
changing = true;
|
|
|
|
|
{
|
|
|
|
|
if ($("#useLegacy").prop("checked")) {
|
|
|
|
|
parameter.legacyOverride.fit = $("#legacyFit").prop("checked");
|
|
|
|
|
replotAll(parameter, replotFunctions);
|
|
|
|
|
}
|
|
|
|
|
replotAll();
|
|
|
|
|
}
|
|
|
|
|
changing = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TestSetup.legacyPointFactorChanged = function() {
|
|
|
|
|
if (changing) return;
|
|
|
|
|
changing = true;
|
|
|
|
|
{
|
|
|
|
|
if ($("#useLegacy").prop("checked")) {
|
|
|
|
|
parameter.legacyOverride.curvePointFactor = $("#legacyPointFactor").val();
|
|
|
|
|
replotAll(parameter, replotFunctions);
|
|
|
|
|
}
|
|
|
|
|
replotAll();
|
|
|
|
|
}
|
|
|
|
|
changing = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TestSetup.legacyFitPointDistChanged = function() {
|
|
|
|
|
if (changing) return;
|
|
|
|
|
changing = true;
|
|
|
|
|
{
|
|
|
|
|
if ($("#useLegacy").prop("checked")) {
|
|
|
|
|
var text = $("#legacyFitPointDist").val();
|
|
|
|
|
if (text == '') {
|
|
|
|
|
parameter.legacyOverride.fitPointDist = undefined;
|
|
|
|
|
} else {
|
|
|
|
|
parameter.legacyOverride.fitPointDist = text;
|
|
|
|
|
replotAll();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
replotAll(parameter, replotFunctions);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
changing = false;
|
|
|
|
|
TestSetup.monotonicFitChanged = function() {
|
|
|
|
|
$("#useLegacy").prop("checked", false);
|
|
|
|
|
replotAll();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TestSetup.tensionChanged = function() {
|
|
|
|
|
$("#useLegacy").prop("checked", false);
|
|
|
|
|
replotAll();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TestSetup.nrSplinePointsChanged = function() {
|
|
|
|
|
$("#useLegacy").prop("checked", false);
|
|
|
|
|
replotAll();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
init(parameter);
|
|
|
|
|
init(lineParameter);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.TestSetup = TestSetup;
|
|
|
|
|
|