Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
com.akaver.sportmap
SportMap-aurelia
Commits
f62062f9
Commit
f62062f9
authored
Apr 22, 2020
by
Andres Käver
Browse files
small fixes
parent
c942d0cf
Pipeline
#796
passed with stages
in 1 minute and 14 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/utils/utils-general.ts
View file @
f62062f9
...
...
@@ -45,3 +45,8 @@ export function decimalToHex(d: number, padding? : number | null): string {
return
hex
;
}
export
function
roundToPrecision
(
x
:
number
,
precision
?:
number
):
number
{
const
y
=
+
x
+
(
precision
===
undefined
?
0.5
:
precision
/
2
);
return
y
-
(
y
%
(
precision
===
undefined
?
1
:
+
precision
));
}
src/utils/utils-leaflet.ts
View file @
f62062f9
...
...
@@ -35,7 +35,7 @@ function addToBucket(buckets: L.LatLngExpression[][][], bucketNo: number, latLon
return
buckets
;
}
// minSpeed and maxSpeed - seconds per km
export
function
getColorCodedPolylines
(
locations
:
IGpsLocation
[],
minPace
:
number
=
6
,
maxPace
:
number
=
1
0
,
paceBuckets
:
number
=
256
):
L
.
LatLngExpression
[][][]
{
export
function
getColorCodedPolylines
(
locations
:
IGpsLocation
[],
minPace
:
number
=
6
,
maxPace
:
number
=
1
8
,
paceBuckets
:
number
=
256
):
L
.
LatLngExpression
[][][]
{
if
(
!
locations
||
locations
.
length
==
0
)
return
[];
const
result
:
L
.
LatLngExpression
[][][]
=
[];
...
...
src/views/home/index.ts
View file @
f62062f9
...
...
@@ -43,9 +43,9 @@ export class HomeIndex {
constructor
(
private
gpsSessionService
:
GpsSessionService
,
private
gpsLocationService
:
GpsLocationService
)
{
this
.
paceColorGradient
=
gradstop
({
stops
:
1024
,
stops
:
256
,
inputFormat
:
'
hex
'
,
colorArray
:
[
'
#00FF00
'
,
'
#FFFF00
'
,
'
#FF0000
'
]
colorArray
:
[
'
#00FF00
'
,
'
#FFFF00
'
,
'
#FF0000
'
]
});
}
...
...
@@ -166,7 +166,7 @@ export class HomeIndex {
const
polylinePoints
:
L
.
LatLngExpression
[]
=
[];
this
.
trackLength
=
0
;
const
paceBuckets
=
getColorCodedPolylines
(
this
.
gpsLocations
,
6
,
18
,
1024
);
const
paceBuckets
=
getColorCodedPolylines
(
this
.
gpsLocations
,
6
,
18
,
this
.
paceColorGradient
.
length
);
this
.
gpsLocations
.
forEach
((
location
,
index
)
=>
{
polylinePoints
.
push
([
location
.
latitude
,
location
.
longitude
]);
...
...
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