function getFavoritePlaces() { // console.log("arrive") // Sensor.id = sensorid // console.log(Sensor.id) var favplaces = new vcs.vcm.layer.GeoJSON({ name: "FavPlaces", url: FavoritePlacesUrl, data: geojson, projection: { epsg: 4326 }, altitudeMode : "relativeToGround", style: { image: { icon: { src: "./templates/locationSMgreen.png", scale: 0.5 } } }, heightAboveGround: 0 }) framework.addLayer(favplaces) favplaces.activate(true); } function hideFavoritePlaces(){ var layern = ["FavPlaces"] 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("FavPlaces") } var favdatapoint = { slat:"", slon:"", sloc:"", } //-- Set point in the map function setPointFav(location, pointd){ favdatapoint.slat = pointd.lat favdatapoint.slon = pointd.lon favdatapoint.sloc = location var layern = [location + "point"] var layers = framework.getLayers(); // hide layer if it already exists for (var i = 0; i< layers.length; i++) { var layer = layers[i]; if(layern.indexOf(layer.name) >= 0){ layer.activate(false); } } // delete layer if it already exists framework.removeLayerByName(location + "point") // visualizing with vcs GeoJson function pointlayer = new vcs.vcm.layer.GeoJSON({ name: location + "point", url: addPointurl + "?slat=" + pointd.lat + "&slon=" + pointd.lon + "&sloc=" + location, data: geojson, projection: { epsg: 4326 }, altitudeMode : "relativeToGround", style: { image: { icon: { src: "./templates/locationSM.png", scale: 0.5 } } }, heightAboveGround: 0 }) framework.addLayer(pointlayer) pointlayer.activate(true); } function saveFavPoint(){ var favdatapoint2 = { lat:"", lon:"", contentext: document.getElementById("favoritText").value } favdatapoint2.lat = favdatapoint.slat; favdatapoint2.lon = favdatapoint.slon; // var incidents = getTraffic() try { $.ajax({ type: "POST", url: saveFavPOINT, data: favdatapoint2, }).done(function (newdata) { convertdata(newdata); }); function convertdata(data) { navcardata = data; console.log(navcardata) } return navcardata } catch (err) { console.log('loading Gas Values from DB failed!'); } } function disableButton(){ var element = document.getElementById("FavSaveButton"); element.classList.add("Disabled"); } function switchFavPlaces(){ var checkBox = document.getElementById("favcheck"); if (checkBox.checked == true){ getFavoritePlaces() } else { hideFavoritePlaces() } }