2017-11-13 3 views
1

나는 지정된 경로를 비행하는 항공기를 나타내는 czml 파일을 가지고 있습니다. 이 파일은 CesML (CZML 모델 + CZML 경로)에서 제공 한 Sancastle 예제를 기반으로 구성됩니다. 여기 CZML 파일에 궤도 방향을 추가하는 방법

는 CZML 변수입니다 :

var czml = [{ 
    "id" : "document", 
    "name" : "CZML Path", 
    "version" : "1.0", 
    "clock": { 
     "interval": "2012-08-04T10:00:00Z/2012-08-04T15:00:00Z", 
     "currentTime": "2012-08-04T10:00:00Z", 
     "multiplier": 10 
    } 
}, { 
    "id" : "path", 
    "name" : "path with GPS flight data", 
    "description" : "<p>Hang gliding flight log data from Daniel H. Friedman.<br>Icon created by Larisa Skosyrska from the Noun Project</p>", 
    "availability" : "2012-08-04T10:00:00Z/2012-08-04T15:00:00Z", 
    "path" : { 
     "material" : { 
      "polylineOutline" : { 
       "color" : { 
        "rgba" : [255, 0, 255, 255] 
       }, 
       "outlineColor" : { 
        "rgba" : [0, 255, 255, 255] 
       }, 
       "outlineWidth" : 5 
      } 
     }, 
     "width" : 8, 
     "leadTime" : 10, 
     "trailTime" : 1000, 
     "resolution" : 5 
    }, 
    "model": { 
     "gltf" : "../../SampleData/models/CesiumAir/Cesium_Air.glb", 
     "scale" : 2.0, 
     "minimumPixelSize": 128 
    }, 
    "position" : { 
     "epoch" : "2012-08-04T10:00:00Z", 
     "cartographicDegrees" : [ 
      0,-122.93797,39.50935,1776, 
      10,-122.93822,39.50918,1773, 
      20,-122.9385,39.50883,1772, 
      30,-122.93855,39.50842,1770, 
      40,-122.93868,39.50792,1770, 
      50,-122.93877,39.50743,1767, 
      60,-122.93862,39.50697,1771, 
      70,-122.93828,39.50648,1765, 
      80,-122.93818,39.50608,1770, 
      90,-122.93783,39.5057,1754, 
      100,-122.93777,39.50513,1732, 
      110,-122.93793,39.50458,1727, 
      120,-122.93815,39.50415,1717, 
      130,-122.9382,39.50362,1713, 
      140,-122.93818,39.5031,1703, 
      150,-122.93812,39.50258,1706, 
      160,-122.93792,39.5022,1707, 
      170,-122.93775,39.50177,1698, 
      180,-122.93745,39.50125,1693, 
      190,-122.93723,39.50073,1694, 
      200,-122.9373,39.50023,1702 
     ] 
    } 
}]; 

나는 또한 다음 줄을 추가하는 코드를 실행하기 위해 : 당신이 코드를 실행하면

var terrainProvider = new Cesium.CesiumTerrainProvider({ 
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles', 
requestVertexNormals : true 
}); 

var viewer = new Cesium.Viewer('cesiumContainer', { 
terrainProvider : terrainProvider, 
baseLayerPicker : false 
}); 

viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function(ds) { 
viewer.trackedEntity = ds.entities.getById('path'); 
}); 

당신이 볼 수있는 방법 항공기의 중심점은 궤적을 따라 가며 그 제목은 그와 일치하지 않으므로 비행편의 모습을 랩 랩핑으로 보여줍니다.

enter image description here

초기 czml 파일 구조를 변경하지 않고 항공기 방향을 코드에 추가하는 방법을 설명 할 수 있습니까?

참고 : answer to this question을 찾았지만 문제에 구현할 수 없습니다.

답변

0

나는 내 질문에 대한 답을 찾았다. 여기에 코드의 라인은 모래성에 배치하면 czml 파일을로드 한 후 보간의 몇 가지 유형을 통해 방향 속성을 추가 할 수 있음이 있습니다 : 항공기가 궤도에 정렬됩니다 이런 식으로

//Sandcastle_Begin 
var terrainProvider = new Cesium.CesiumTerrainProvider({ 
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles', 
requestVertexNormals : true 
}); 

var viewer = new Cesium.Viewer('cesiumContainer', { 
terrainProvider : terrainProvider, 
baseLayerPicker : false 
}); 

var options = { 
    camera : viewer.scene.camera, 
    canvas : viewer.scene.canvas 
}; 

Sandcastle.addToolbarMenu([{ 
    text : 'Lateral avoidance w. real Wx and waypoints (KJFK-LEBL)', 
    onselect : function() { 

     viewer.camera.flyHome(0); 

     viewer.dataSources.add(Cesium.CzmlDataSource.load('./SampleData/interp_turb_data_fromFede_avoid_realistic_w_waypoints.czml')).then(function(ds) { 

     var entity = ds.entities.getById('path'); 

     // viewer.trackedEntity = entity; 

     entity.orientation = new Cesium.VelocityOrientationProperty(entity.position); 

     entity.position.setInterpolationOptions({ 
      interpolationDegree : 1, 
      interpolationAlgorithm : Cesium.HermitePolynomialApproximation 
      });  
    }); 

    } 
}], 'toolbar'); 

Sandcastle.reset = function() { 
    viewer.dataSources.removeAll(); 
    viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED; 
    viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK; 
}; 
//Sandcastle_End 

!

관련 문제