diff --git a/vcm/js/soundquiz.js b/vcm/js/soundquiz.js index 9302cfbc1255abdb8b67791e935c66345612c3fd..4a9429efd25320d0117fdc2cd098f68f77ddb281 100644 --- a/vcm/js/soundquiz.js +++ b/vcm/js/soundquiz.js @@ -272,88 +272,120 @@ function check_Bau(location) { document.getElementById("solution_rosenstein").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; } } else if (location == "all"){ - var points_bau = turf.points([ + if (point_baustelle) { + var points_bau = turf.points([ [point_baustelle.lon, point_baustelle.lat] ]); ptsWithin_bau = turf.pointsWithinPolygon(points_bau, poly_baustelle); - var points_prag = turf.points([ - [point_pragfriedhof.lon, point_pragfriedhof.lat] - ]); - ptsWithin_prag = turf.pointsWithinPolygon(points_prag, poly_Pragfriedhof); - - var points_markt = turf.points([ - [point_marktplatz.lon, point_marktplatz.lat] - ]); - ptsWithin_markt = turf.pointsWithinPolygon(points_markt, poly_Marktplatz); - - var points_skaten = turf.points([ - [point_skaten.lon, point_skaten.lat] - ]); - ptsWithin_skaten = turf.pointsWithinPolygon(points_skaten, poly_Skaten); - - var points_kirche = turf.points([ - [point_kirche.lon, point_kirche.lat] - ]); - ptsWithin_kirche = turf.pointsWithinPolygon(points_kirche, poly_kirche); - - var points_meer = turf.points([ - [point_meerschweinchen.lon, point_meerschweinchen.lat] - ]); - ptsWithin_meerschweinchen = turf.pointsWithinPolygon(points_meer, poly_Meerschweinchen); - - var points_ufa = turf.points([ - [point_ufapalast.lon, point_ufapalast.lat] - ]); - ptsWithin_ufa = turf.pointsWithinPolygon(points_ufa, poly_UFA_Palast); - - var points_rosen = turf.points([ - [point_rosensteinpark.lon, point_rosensteinpark.lat] - ]); - ptsWithin_rosenstein = turf.pointsWithinPolygon(points_rosen, poly_Rosensteinpark); - - if (ptsWithin_bau.features.length == 0){ document.getElementById("solution_bau").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; } else if (ptsWithin_bau.features.length == 1){ document.getElementById("solution_bau").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; } - if (ptsWithin_prag.features.length == 0){ - document.getElementById("solution_prag").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; - } else if (ptsWithin_prag.features.length == 1){ - document.getElementById("solution_prag").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; + + } + + if (point_pragfriedhof) { + var points_prag = turf.points([ + [point_pragfriedhof.lon, point_pragfriedhof.lat] + ]); + ptsWithin_prag = turf.pointsWithinPolygon(points_prag, poly_Pragfriedhof); + + if (ptsWithin_prag.features.length == 0){ + document.getElementById("solution_prag").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; + } else if (ptsWithin_prag.features.length == 1){ + document.getElementById("solution_prag").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; + } } + if (point_marktplatz) { + var points_markt = turf.points([ + [point_marktplatz.lon, point_marktplatz.lat] + ]); + ptsWithin_markt = turf.pointsWithinPolygon(points_markt, poly_Marktplatz); + if (ptsWithin_markt.features.length == 0){ document.getElementById("solution_markt").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; } else if (ptsWithin_markt.features.length == 1){ document.getElementById("solution_markt").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; } + + } + if (point_skaten) { + var points_skaten = turf.points([ + [point_skaten.lon, point_skaten.lat] + ]); + ptsWithin_skaten = turf.pointsWithinPolygon(points_skaten, poly_Skaten); + if (ptsWithin_skaten.features.length == 0){ document.getElementById("solution_skaten").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; } else if (ptsWithin_skaten.features.length == 1){ document.getElementById("solution_skaten").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; } + + } + if (points_kirche) { + var points_kirche = turf.points([ + [point_kirche.lon, point_kirche.lat] + ]); + ptsWithin_kirche = turf.pointsWithinPolygon(points_kirche, poly_kirche); + if (ptsWithin_kirche.features.length == 0){ document.getElementById("solution_kirche").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; } else if (ptsWithin_kirche.features.length == 1){ document.getElementById("solution_kirche").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; } + + } + if (points_meer) { + var points_meer = turf.points([ + [point_meerschweinchen.lon, point_meerschweinchen.lat] + ]); + ptsWithin_meerschweinchen = turf.pointsWithinPolygon(points_meer, poly_Meerschweinchen); + if (ptsWithin_meerschweinchen.features.length == 0){ document.getElementById("solution_meerschweinchen").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; } else if (ptsWithin_meerschweinchen.features.length == 1){ document.getElementById("solution_meerschweinchen").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; } + + } + if (points_ufa) { + var points_ufa = turf.points([ + [point_ufapalast.lon, point_ufapalast.lat] + ]); + ptsWithin_ufa = turf.pointsWithinPolygon(points_ufa, poly_UFA_Palast); + if (ptsWithin_ufa.features.length == 0){ document.getElementById("solution_ufapalast").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; } else if (ptsWithin_ufa.features.length == 1){ document.getElementById("solution_ufapalast").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; } + + } + if (points_rosen) { + var points_rosen = turf.points([ + [point_rosensteinpark.lon, point_rosensteinpark.lat] + ]); + ptsWithin_rosenstein = turf.pointsWithinPolygon(points_rosen, poly_Rosensteinpark); + if (ptsWithin_rosenstein.features.length == 0){ document.getElementById("solution_rosenstein").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_wrong.png"; } else if (ptsWithin_rosenstein.features.length == 1){ document.getElementById("solution_rosenstein").src="https://transfer.hft-stuttgart.de/partizipation/datasource-data/NoiseData/Icons_soundquiz/icon_right.png"; } + } + + + + + + + + + +