var ballonContent = { header: "Test", Content: "This is a test", lat: "", lon: "", categorie: "locationSM.png" } function PostUserInput(){ try { $.ajax({ async: false, type: "POST", url: '/newBallon', data: ballonContent }).done(function (SimSMid) { return(SimSMid) // convertdata(SimSMid); }); // function convertdata(SimSMids) { // SimSOutput = SimSMids; // } // // console.log(currentwind); // return SimSOutput; } catch (err) { console.log('-> function PostUserInput() failed!\n' + err); } startVCM(); } function addingPin() { var map = vcs.vcm.Framework.getInstance().getActiveMap(); var CViewer = map.viewer var CScene = map.viewer.scene // Mouse over the globe to see the cartographic position handler = new Cesium.ScreenSpaceEventHandler(CScene.canvas); handler.setInputAction(function (movement) { var cartesian = CViewer.camera.pickEllipsoid( movement.position, CScene.globe.ellipsoid ); if (cartesian) { var cartographic = Cesium.Cartographic.fromCartesian(cartesian); var longitudeString = Cesium.Math.toDegrees( cartographic.longitude ).toFixed(6); ballonContent.lon = longitudeString; var latitudeString = Cesium.Math.toDegrees( cartographic.latitude ).toFixed(6); ballonContent.lat = latitudeString; alert( "Lon: " + longitudeString + "\u00B0" + "\nLat: " + (" " + latitudeString).slice(-7) + "\u00B0"); // PostUserInput(); createTempPin(cartographic) } else { } }, Cesium.ScreenSpaceEventType.LEFT_CLICK) } var map var billboards function createTempPin(cart) { alert("start") var mapstuff = vcs.vcm.Framework.getInstance().getActiveMap() mapstuff.viewer.entities.add({ position: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883), point: { pixelSize: 10, color: Cesium.Color.YELLOW, }, }); // map = vcs.vcm.Framework.getInstance().getActiveMap(); // // var CScene = map.viewer.scene // billboards = vcs.vcm.Framework.getInstance().getActiveMap().viewer.scene.primitives.add(new Cesium.BillboardCollection()); // billboards.add({ // show : true, // position : new Cesium.Cartesian3.fromDegrees(-80.12, 25.46), // image: '/templates/locationSM.png', // heightReference : Cesium.HeightReference.CLAMP_TO_GROUND // }) };