Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Lauftracking Tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Gatzert
Lauftracking Tool
Commits
bcc23721
Commit
bcc23721
authored
2 years ago
by
czm4871
Browse files
Options
Downloads
Patches
Plain Diff
01.08.2022
parent
1bc3e05b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
function.js
+21
-54
21 additions, 54 deletions
function.js
index.html
+7
-3
7 additions, 3 deletions
index.html
style.css
+19
-8
19 additions, 8 deletions
style.css
with
47 additions
and
65 deletions
function.js
+
21
−
54
View file @
bcc23721
...
@@ -110,79 +110,46 @@ function show_position(position){
...
@@ -110,79 +110,46 @@ function show_position(position){
console.log("Länge: " + position.coords.longitude);
console.log("Länge: " + position.coords.longitude);
console.log("Genauigkeit: " + position.coords.accuracy);*/
console.log("Genauigkeit: " + position.coords.accuracy);*/
let
marker
=
L
.
marker
([
position
.
coords
.
latitude
,
position
.
coords
.
longitude
]).
addTo
(
map
);
let
marker
=
L
.
marker
([
position
.
coords
.
latitude
,
position
.
coords
.
longitude
]).
addTo
(
map
);
//fetched coordinates get pushed in the Array of coordinates
latlngs
.
push
(
marker
.
getLatLng
());
latlngs
.
push
(
marker
.
getLatLng
());
// create a red polyline from an arrays of LatLng points
let
polyline
=
L
.
polyline
(
latlngs
,
{
color
:
'
red
'
}).
addTo
(
map
);
let
polyline
=
L
.
polyline
(
latlngs
,
{
color
:
'
red
'
}).
addTo
(
map
);
// zoom the map to the polyline
map
.
fitBounds
(
polyline
.
getBounds
());
map
.
fitBounds
(
polyline
.
getBounds
());
distance
();
//the function is called where the distance is shown in the browser
distanceto
();
}
}
function
distance
(){
function
distance
to
(){
//
console.log(latlngs);
//
function wich calculates whole poyline
var
distance
=
0
;
let
distance
=
0
;
for
(
let
i
=
0
;
i
<
latlngs
.
length
-
1
;
i
++
)
for
(
let
i
=
0
;
i
<
latlngs
.
length
-
1
;
i
++
)
{
{
distance
+=
(
latlngs
[
i
].
distanceTo
(
latlngs
[
i
+
1
]))
/
1000
;
distance
+=
(
latlngs
[
i
].
distanceTo
(
latlngs
[
i
+
1
]))
/
1000
;
console
.
log
(
distance
);
console
.
log
(
distance
);
}
}
let
rounddistance
=
distance
.
toFixed
(
1
);
//rounds up the number
let
rounddistance
=
distance
.
toFixed
(
4
);
document
.
getElementById
(
"
case
"
).
innerHTML
=
rounddistance
+
"
km
"
;
document
.
getElementById
(
"
case
"
).
innerHTML
=
rounddistance
+
"
km
"
;
document
.
getElementById
(
"
distance
"
).
value
=
rounddistance
;
//console.log(rounddistance);
//console.log(rounddistance);
}
}
//marker1.addTo(map); ---> wie kann ich eine Variable definieren,
//------------------------die auch außerhalb einer Funktion gilt?
//Marker get added
/*var koordinaten = ["53.468336", "9.960204"];
var marker1 = L.marker(koordinaten).addTo(map);
var marker2 = L.marker([53.459333, 10.017835]).addTo(map);
var marker3 = L.marker([53.444, 9.947]).addTo(map);
var marker4 = L.marker([53.452, 10.020]).addTo(map);
console.log(marker1.getLatLng());
function
list_coordinates
(){
let latlngs = Array()
//document.getElementById(distance).innerHTML = rounddistance;
}
setInterval
(
get_coordinates
,
1000
);
//Get latlng from a marker and push it in the Array "latlngs" ----> durch eine for-Schleife realisierbar?
latlngs.push(marker1.getLatLng());
latlngs.push(marker2.getLatLng());
latlngs.push(marker3.getLatLng());
latlngs.push(marker4.getLatLng());*/
//From documentation http://leafletjs.com/reference.html#polyline
// create a red polyline from an arrays of LatLng points
//let polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
// zoom the map to the polyline
//map.fitBounds(polyline.getBounds());
//calculate the distance between two points
//var dist = (marker1.getLatLng().distanceTo(marker2.getLatLng()) /*+ marker2.getLatLng().distanceTo(marker3.getLatLng())*/)/1000;
//rounds up the number
//let rounddist = dist.toFixed(1);
//show this distance in the browser
//document.getElementById("case").innerHTML = rounddist + " km";
//----------- Method for calculating whole polyline ()
/*let distance = 0;
console.log(latlngs);
\ No newline at end of file
for(var i = 0; i < latlngs.length - 1; i++)
{
//text += latlngs[i];
//distance += ((latlngs[i].distanceTo(latlngs[i + 1]))/1000);
distance += (latlngs[i].getLatLng()).distanceTo(latlngs[i + 1].getLatLng());
}
let rounddistance = distance.toFixed(1);
document.getElementById("case").innerHTML = rounddistance + " km";
let distance2 = L.getLatLng.marker1.distanceTo(latlngs[i + 1]);*/
\ No newline at end of file
This diff is collapsed.
Click to expand it.
index.html
+
7
−
3
View file @
bcc23721
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<ul>
<ul>
<li
class=
""
><a
class=
"nav-item"
href=
"#home"
>
Home
</a></li>
<li
class=
""
><a
class=
"nav-item"
href=
"#home"
>
Home
</a></li>
<li
class=
""
><a
class=
"nav-item"
href=
"#eintrag"
>
Laufeintrag
</a></li>
<li
class=
""
><a
class=
"nav-item"
href=
"#eintrag"
>
Laufeintrag
</a></li>
<li
class=
""
><a
class=
"nav-item"
href=
"#messung"
>
Streckenbemessung
</a></li>
</ul>
</ul>
</nav>
</nav>
</header>
</header>
...
@@ -81,11 +81,15 @@
...
@@ -81,11 +81,15 @@
<button
onclick=
"deleteEntries()"
type=
"button"
id=
"red-button"
>
Einträge löschen
</button>
<button
onclick=
"deleteEntries()"
type=
"button"
id=
"red-button"
>
Einträge löschen
</button>
</div>
</div>
</section>
</section>
<section>
<section
id=
"messung"
>
<div
class=
"section-container"
>
<div
class=
"section-container"
>
<h2
class=
"h-underline"
>
Streckenbemessung
</h2>
<form>
<form>
<!--<input type="text" id="coordinates" name="koordinaten" placeholder="Gib hier deine Koordinaten ein">-->
<!--<input type="text" id="coordinates" name="koordinaten" placeholder="Gib hier deine Koordinaten ein">-->
<button
onclick=
"get_coordinates()"
id=
"buttoncoordinates"
type=
"button"
>
Standort ermitteln
</button>
<button
onclick=
"get_coordinates()"
id=
"buttoncoordinates"
type=
"button"
>
Punkt hinzufügen
</button>
<!--<button onclick="list_coordinates()" id="buttoncoordinates" type="button">Strecke übermitteln in Lauf-Eintrag</button>-->
</form>
</form>
<div
class=
"coordinates_output"
>
<div
class=
"coordinates_output"
>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
style.css
+
19
−
8
View file @
bcc23721
...
@@ -20,10 +20,15 @@ Dies ist eine CSS-Datei für die index.html vom Lauftracker-Projekt
...
@@ -20,10 +20,15 @@ Dies ist eine CSS-Datei für die index.html vom Lauftracker-Projekt
--footer-color
:
#969696
;
--footer-color
:
#969696
;
}
}
html
{
html
{
font-size
:
10
px
;
font-size
:
8
px
;
line-height
:
1.4
;
line-height
:
1.4
;
scroll-behavior
:
smooth
;
scroll-behavior
:
smooth
;
}
}
@media
(
min-width
:
576px
){
html
{
font-size
:
10px
;
}
}
body
{
body
{
font-size
:
1.6rem
;
font-size
:
1.6rem
;
position
:
relative
;
position
:
relative
;
...
@@ -33,6 +38,7 @@ ul {
...
@@ -33,6 +38,7 @@ ul {
}
}
h1
{
h1
{
font-size
:
3.8rem
;
font-size
:
3.8rem
;
text-transform
:
uppercase
;
font-weight
:
700
;
font-weight
:
700
;
color
:
var
(
--primary
);
color
:
var
(
--primary
);
width
:
auto
;
width
:
auto
;
...
@@ -216,7 +222,7 @@ header{
...
@@ -216,7 +222,7 @@ header{
size
:
5
;
size
:
5
;
}
}
.h-underline
{
.h-underline
{
width
:
80%
;
/*
width: 80%;
*/
text-align
:
center
;
text-align
:
center
;
border-bottom
:
solid
4px
var
(
--primary
);
border-bottom
:
solid
4px
var
(
--primary
);
}
}
...
@@ -228,31 +234,33 @@ form{
...
@@ -228,31 +234,33 @@ form{
text-align
:
center
;
text-align
:
center
;
padding-top
:
30px
;
padding-top
:
30px
;
margin-bottom
:
50px
;
margin-bottom
:
50px
;
width
:
100%
;
}
}
input
{
input
{
padding
:
10px
18px
;
padding
:
10px
18px
;
margin
:
8px
0
;
margin
:
8px
0
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
font-size
:
1.5rem
;
font-size
:
1.5rem
;
width
:
450px
;
width
:
100%
;
/*
max-width:
90%;*/
max-width
:
450px
;
}
}
textarea
{
textarea
{
padding
:
10px
18px
;
padding
:
10px
18px
;
margin
:
8px
0
;
margin
:
8px
0
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
font-size
:
1.5rem
;
font-size
:
1.5rem
;
width
:
450px
;
width
:
100%
;
/*
max-width:
90%;*/
max-width
:
450px
;
}
}
button
{
button
{
padding
:
10px
18px
;
padding
:
10px
18px
;
margin
:
8px
0
;
margin
:
8px
0
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
font-size
:
1.5rem
;
font-size
:
1.5rem
;
width
:
450px
;
width
:
100%
;
/*
max-width:
90%;*/
max-width
:
450px
;
}
}
#red-button
{
#red-button
{
background-color
:
rgb
(
172
,
69
,
55
);
background-color
:
rgb
(
172
,
69
,
55
);
color
:
white
;
color
:
white
;
...
@@ -276,6 +284,9 @@ button{
...
@@ -276,6 +284,9 @@ button{
flex-direction
:
column
;
flex-direction
:
column
;
}
}
/* Distance Value --------------------------------------*/
/* Distance Value --------------------------------------*/
.distance-value
{
.distance-value
{
margin-bottom
:
70px
;
margin-bottom
:
70px
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment