Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
CurvedLines
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HS-public
CurvedLines
Commits
6d932f5b
Commit
6d932f5b
authored
Oct 26, 2014
by
Michael Zinsmaier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new parameters to the tests and improved the parameter box
parent
9f95f117
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
120 deletions
+108
-120
curvedLines.js
curvedLines.js
+2
-2
_TestSetup.js
tests/_TestSetup.js
+106
-118
No files found.
curvedLines.js
View file @
6d932f5b
...
@@ -190,7 +190,7 @@
...
@@ -190,7 +190,7 @@
var
xStart
=
points
[
curX
];
var
xStart
=
points
[
curX
];
var
xEnd
=
points
[
curX
+
ps
];
var
xEnd
=
points
[
curX
+
ps
];
var
xStep
=
(
xEnd
-
xStart
)
/
curvedLinesOptions
.
nrSplinePoints
;
var
xStep
=
(
xEnd
-
xStart
)
/
Number
(
curvedLinesOptions
.
nrSplinePoints
)
;
//add point
//add point
result
.
push
(
points
[
curX
]);
result
.
push
(
points
[
curX
]);
...
@@ -256,7 +256,7 @@
...
@@ -256,7 +256,7 @@
for
(
var
i
=
ps
;
i
<
points
.
length
-
ps
;
i
+=
ps
)
{
for
(
var
i
=
ps
;
i
<
points
.
length
-
ps
;
i
+=
ps
)
{
var
curX
=
i
;
var
curX
=
i
;
var
curY
=
i
+
yPos
;
var
curY
=
i
+
yPos
;
c1s
.
push
(
curvedLinesOptions
.
tension
*
(
points
[
curX
+
ps
]
-
points
[
curY
-
ps
])
/
(
points
[
curX
+
ps
]
-
points
[
curX
-
ps
]));
c1s
.
push
(
Number
(
curvedLinesOptions
.
tension
)
*
(
points
[
curY
+
ps
]
-
points
[
curY
-
ps
])
/
(
points
[
curX
+
ps
]
-
points
[
curX
-
ps
]));
}
}
}
}
c1s
.
push
(
ms
[
ms
.
length
-
1
]);
c1s
.
push
(
ms
[
ms
.
length
-
1
]);
...
...
tests/_TestSetup.js
View file @
6d932f5b
!
function
()
{
!
function
()
{
var
TestSetup
=
function
(
div
,
lineParameter
,
replotFunctions
)
{
var
TestSetup
=
function
(
div
,
lineParameter
,
replotFunctions
)
{
div
.
append
(
"<div id='normalParameters' class='parameterBox'></div>"
);
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='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>"
);
div
.
append
(
"<div id='legacyParameters' class='parameterBox'></div>"
);
$
(
"#legacyParameters"
).
append
(
"<input class='parameterInput' id='useLegacy' type='checkbox' onchange='TestSetup.useLegacyChanged()'>use legacy options</input>"
);
$
(
"#legacyParameters"
).
append
(
"<input class='parameterInput' id='useLegacy' type='checkbox' onchange='TestSetup.useLegacyChanged()'>use legacy options</input>"
);
$
(
"#legacyParameters"
).
append
(
"<input class='parameterInput' id='legacyFit' type='checkbox' onchange='TestSetup.legacyFitChanged()'>fit</input>"
);
$
(
"#legacyParameters"
).
append
(
"<input class='parameterInput' id='legacyFit' type='checkbox' onchange='TestSetup.legacyFitChanged()'>fit</input>"
);
$
(
"#legacyParameters"
).
append
(
"<input class='parameterInput' id='legacyPointFactor' type='text' onchange='TestSetup.legacyPointFactorChanged()'>point factor</input>"
);
$
(
"#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>"
);
$
(
"#legacyParameters"
).
append
(
"<input class='parameterInput' id='legacyFitPointDist' type='text' onchange='TestSetup.legacyFitPointDistChanged()'>fit point dist</input>"
);
var
parameter
=
lineParameter
;
function
replotAll
()
{
var
changing
=
false
;
var
parameter
=
{
function
replotAll
(
parameter
,
replotFunctions
)
{
apply
:
$
(
"#apply"
).
prop
(
"checked"
),
for
(
var
i
=
0
;
i
<
replotFunctions
.
length
;
i
++
)
{
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
,
};
}
for
(
var
i
=
0
;
i
<
replotFunctions
.
length
;
i
++
)
{
replotFunctions
[
i
](
parameter
);
replotFunctions
[
i
](
parameter
);
}
}
}
}
function
init
(
parameter
)
{
function
init
(
parameter
)
{
if
(
changing
)
return
;
changing
=
true
;
{
var
defaultParam
=
{
active
:
false
,
apply
:
false
,
monotonicFit
:
false
,
tension
:
0.0
,
legacyOverride
:
undefined
};
var
combinedParam
=
jQuery
.
extend
(
defaultParam
,
parameter
);
if
(
combinedParam
.
legacyOverride
==
true
)
{
combinedParam
.
legacyOverride
=
{
fit
:
false
,
curvePointFactor
:
20
,
fitPointDist
:
undefined
};
parameter
.
legacyOverride
=
{
fit
:
false
,
curvePointFactor
:
20
,
fitPointDist
:
undefined
};
}
var
defaultParam
=
{
active
:
false
,
apply
:
false
,
monotonicFit
:
false
,
tension
:
0.0
,
nrSplinePoints
:
20
,
legacyOverride
:
undefined
};
$
(
"#apply"
).
prop
(
"checked"
,
combinedParam
.
apply
);
var
defaultLegacy
=
{
fit
:
false
,
var
withLegacy
=
(
typeof
combinedParam
.
legacyOverride
!=
'undefined'
&&
combinedParam
.
legacyOverride
!=
false
);
curvePointFactor
:
20
,
var
fit
=
withLegacy
?
combinedParam
.
legacyOverride
.
fit
:
false
;
fitPointDist
:
undefined
var
pointFactor
=
withLegacy
?
combinedParam
.
legacyOverride
.
curvePointFactor
:
'20'
;
};
var
fitDist
=
withLegacy
?
combinedParam
.
legacyOverride
.
fitPointDist
:
''
;
if
(
typeof
parameter
.
legacyOverride
!=
'undefined'
)
{
$
(
"#useLegacy"
).
prop
(
"checked"
,
withLegacy
);
defaultParam
.
legacyOverride
=
defaultLegacy
;
$
(
"#legacyFit"
).
prop
(
"checked"
,
fit
);
if
(
parameter
.
legacyOverride
==
true
)
{
$
(
"#legacyPointFactor"
).
val
(
pointFactor
);
parameter
.
legacyOverride
=
defaultLegacy
;
$
(
"#legacyFitPointDist"
).
val
(
fitDist
);
}
replotAll
(
parameter
,
replotFunctions
);
}
}
changing
=
false
;
}
var
combinedParam
=
jQuery
.
extend
(
true
,
defaultParam
,
parameter
);
$
(
"#apply"
).
prop
(
"checked"
,
combinedParam
.
apply
);
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
);
}
TestSetup
.
applyChanged
=
function
()
{
TestSetup
.
applyChanged
=
function
()
{
if
(
changing
)
return
;
replotAll
();
changing
=
true
;
{
parameter
.
apply
=
$
(
"#apply"
).
prop
(
"checked"
);
replotAll
(
parameter
,
replotFunctions
);
}
changing
=
false
;
};
};
TestSetup
.
useLegacyChanged
=
function
()
{
TestSetup
.
useLegacyChanged
=
function
()
{
if
(
changing
)
return
;
replotAll
();
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
;
};
};
TestSetup
.
legacyFitChanged
=
function
()
{
TestSetup
.
legacyFitChanged
=
function
()
{
if
(
changing
)
return
;
if
(
$
(
"#useLegacy"
).
prop
(
"checked"
))
{
changing
=
true
;
replotAll
();
{
if
(
$
(
"#useLegacy"
).
prop
(
"checked"
))
{
parameter
.
legacyOverride
.
fit
=
$
(
"#legacyFit"
).
prop
(
"checked"
);
replotAll
(
parameter
,
replotFunctions
);
}
}
}
changing
=
false
;
};
};
TestSetup
.
legacyPointFactorChanged
=
function
()
{
TestSetup
.
legacyPointFactorChanged
=
function
()
{
if
(
changing
)
return
;
if
(
$
(
"#useLegacy"
).
prop
(
"checked"
))
{
changing
=
true
;
replotAll
();
{
if
(
$
(
"#useLegacy"
).
prop
(
"checked"
))
{
parameter
.
legacyOverride
.
curvePointFactor
=
$
(
"#legacyPointFactor"
).
val
();
replotAll
(
parameter
,
replotFunctions
);
}
}
}
changing
=
false
;
};
};
TestSetup
.
legacyFitPointDistChanged
=
function
()
{
TestSetup
.
legacyFitPointDistChanged
=
function
()
{
if
(
changing
)
return
;
if
(
$
(
"#useLegacy"
).
prop
(
"checked"
))
{
changing
=
true
;
replotAll
();
{
if
(
$
(
"#useLegacy"
).
prop
(
"checked"
))
{
var
text
=
$
(
"#legacyFitPointDist"
).
val
();
if
(
text
==
''
)
{
parameter
.
legacyOverride
.
fitPointDist
=
undefined
;
}
else
{
parameter
.
legacyOverride
.
fitPointDist
=
text
;
}
replotAll
(
parameter
,
replotFunctions
);
}
}
}
changing
=
false
;
};
};
init
(
parameter
);
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
(
lineParameter
);
};
};
this
.
TestSetup
=
TestSetup
;
this
.
TestSetup
=
TestSetup
;
}();
}();
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment