function getStart(point){ position_var = true pointsoe = point; } var pointsoe =""; function PostNavPoint(testing){ try { $.ajax({ async: true, type: "POST", url: navPointUrl, data: point }).done(function (SimSMid) { console.log(SimSMid) convertdata(); return(SimSMid) }); function convertdata() { console.log("angekommen......") if (testing == "Start"){ showStartPoint(); } else if (testing == "End"){ showEndPoint(); } } // // console.log(currentwind); // return SimSOutput; } catch (err) { console.log('-> function PostUserInput() failed!\n' + err); } } function showStartPoint(){ var layern = ["Startpoint"] var layers = framework.getLayers(); for (var i = 0; i< layers.length; i++) { var layer = layers[i]; if(layern.indexOf(layer.name) >= 0){ layer.activate(false); } } framework.removeLayerByName("Startpoint") console.log("testStartpointvis") Startpointlayer = new vcs.vcm.layer.GeoJSON({ name: "Startpoint", url: StartpointUrl, data: geojson, projection: { epsg: 4326 }, altitudeMode : "relativeToGround", style: { image: { icon: { src: "./templates/locationSM.png", scale: 0.5 } } }, heightAboveGround: 0 }) framework.addLayer(Startpointlayer) Startpointlayer.activate(true); } function showEndPoint(){ var layern = ["EndpointNav"] var layers = framework.getLayers(); for (var i = 0; i< layers.length; i++) { var layer = layers[i]; if(layern.indexOf(layer.name) >= 0){ layer.activate(false); } }framework.removeLayerByName("EndpointNav") // console.log("testStartpointvis") Endpointlayer = new vcs.vcm.layer.GeoJSON({ name: "EndpointNav", url: EndpointUrl, data: geojson, projection: { epsg: 4326 }, altitudeMode : "relativeToGround", style: { image: { icon: { src: "./templates/locationSM.png", scale: 0.5 } } }, heightAboveGround: 0 }) framework.addLayer(Endpointlayer) Endpointlayer.activate(true); } function showRoute(){ var datapointSend = { slat:"", slon:"", sloc:"", elat: "", elon: "", eloc: "" } pointsoe = ""; datapointSend.slat = document.getElementById("Spunktlat").value; datapointSend.slon = document.getElementById("Spunktlon").value; datapointSend.elat = document.getElementById("Epunktlat").value; datapointSend.elon = document.getElementById("Epunktlon").value; try { $.ajax({ async: true, type: "POST", url: RoutecalcUrl, data: datapointSend }).done(function (SimSMid) { console.log(SimSMid) convertdata(SimSMid); return(SimSMid) }); function convertdata(data) { console.log("angekommen......") document.getElementById("Routeduration").value = data.features[0].properties.minutesDifference + " min " + data.features[0].properties.secondsDifference + " sek"; if (testing == "Start"){ // showStartPoint(); } else if (testing == "End"){ // showEndPoint(); } // drawnavcar(); } // // console.log(currentwind); // return SimSOutput; } catch (err) { console.log('-> function PostUserInput() failed!\n' + err); } try { $.ajax({ async: true, type: "POST", url: navPublicTUrl, data: datapointSend }).done(function (SimSMid) { console.log(SimSMid) convertdata(SimSMid); return(SimSMid) }); function convertdata(data) { var minutesRoute = 0; var hourRoute = 0; var sekRoute = 0; var daysRoute = 0; console.log("angekommen......") var length = data.features.length; for (var i=0; i <= length -1; i++){ daysRoute += data.features[i].properties.daysDifference; minutesRoute += data.features[i].properties.minutesDifference; hourRoute += data.features[i].properties.hoursDifference; sekRoute += data.features[i].properties.secondsDifference; } document.getElementById("RoutedurationPub").value = minutesRoute + " min " + sekRoute + " sek"; } // // console.log(currentwind); // return SimSOutput; } catch (err) { console.log('-> function PostUserInput() failed!\n' + err); } } function publictransport(){ var datapointSend = { slat:"", slon:"", sloc:"", elat: "", elon: "", eloc: "" } datapointSend.slat = document.getElementById("Spunktlat").value; datapointSend.slon = document.getElementById("Spunktlon").value; datapointSend.elat = document.getElementById("Epunktlat").value; datapointSend.elon = document.getElementById("Epunktlon").value; console.log(datapointSend); try { $.ajax({ async: true, type: "get", url: navPublicTUrl, data: datapointSend }).done(function (SimSMid) { console.log(SimSMid) // convertdata(); return(SimSMid) }); function convertdata() { console.log("angekommen......") if (testing == "Start"){ showStartPoint(); } else if (testing == "End"){ showEndPoint(); } } // // console.log(currentwind); // return SimSOutput; } catch (err) { console.log('-> function PostUserInput() failed!\n' + err); } }; function deletenav(){ document.getElementById("PubRouteShow").innerHTML = ""; document.getElementById("Routeduration").value = ""; document.getElementById("RoutedurationPub").value = ""; var layernend = ["Endpoint"] var layernavpub = ["PublicRoute"] var layern = ["Startpoint"] var layerncar = ["CarRoute"] var layers = framework.getLayers(); for (var i = 0; i< layers.length; i++) { var layer1 = layers[i]; if(layerncar.indexOf(layer1.name) >= 0){ layer1.activate(false); } } framework.removeLayerByName("CarRoute") for (var i = 0; i< layers.length; i++) { var layer2 = layers[i]; if(layern.indexOf(layer2.name) >= 0){ layer2.activate(false); } } framework.removeLayerByName("Startpoint") for (var i = 0; i< layers.length; i++) { var layer3 = layers[i]; if(layernend.indexOf(layer3.name) >= 0){ layer3.activate(false); } }framework.removeLayerByName("Endpoint") for (var i = 0; i< layers.length; i++) { var layer4 = layers[i]; if(layernavpub.indexOf(layer4.name) >= 0){ layer4.activate(false); } } framework.removeLayerByName("PublicRoute") }