function LoadWFS() { var viewer = new Cesium.Viewer(‘cesiumContainer‘); $.ajax({ url: "http://localhost/SG/streamer.ashx?&VERSION=1.0.0&Service=WFS&Username=&Password=&TYPENAME=cc.398445&request=GetFeature", cache: false, async: true, success: function (data) { alert(data.childNodes[0].childNodes.length); //alert(data.childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0].firstChild.nodeValue); viewer.entities.removeAll(); for (var i = 1; i < data.childNodes[0].childNodes.length; i++) { var gxyz = data.childNodes[0].childNodes[i].childNodes[0].childNodes[0].childNodes[0].childNodes[0].firstChild.nodeValue; var geo = gxyz.split(‘,‘); var position = Cesium.Cartesian3.fromDegrees(parseFloat(geo[0]), parseFloat(geo[1]), parseFloat(geo[2])); var heading = Cesium.Math.toRadians(135); var pitch = 0; var roll = 0; var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll); var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr); createModel(parseFloat(geo[0]), parseFloat(geo[1]), ‘http://localhost/SG/TerraExplorerWeb/models/Cesium_Air.glb‘, 1000); }; viewer.flyTo(viewer.entities); }, error: function (data) { alert(data); } }); }
时间: 2024-10-02 09:34:14