UserBalloon.js 1.78 KB
Newer Older
1
2
3
4
5
var ballonContent = {
    header: "Test",
    Content: "This is a test",
    lat: "",
    lon: "",
Patrick's avatar
test    
Patrick committed
6
    categorie: "locationSM.png"
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  }



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);
    }
Patrick's avatar
test    
Patrick committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
}

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();

      } else {
        
      }
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK)





    

78
}