My goal is to add CZML to my ol-cesium application.
I have created an application using the ol-cesium-v1.27 get started instructions:
ol3d = new olcs.OLCesium({map: map}); // map is the ol.Map instance
I have added 3D terrain and a glTF model to my application as such:
var scene = ol3d.getCesiumScene();
scene.terrainProvider = new Cesium.CesiumTerrainProvider({
url: 'https://my.terrain',
requestWaterMask: true
});
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(-3, 54, 0));
var model = scene.primitives.add(Cesium.Model.fromGltf({
url: '/model.glb',
modelMatrix: modelMatrix,
heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
scene: scene
}));
Now I would like to add a CZML solid to the globe. The Cesium example from the Sandcastle (CZML Sandcastle) looks like this:
var czml = [{
"id" : "document",
"name" : "CZML Geometries: Cones and Cylinders",
"version" : "1.0"
}, {
"id" : "shape1",
"name" : "Green cylinder with black outline",
"position" : {
"cartographicDegrees" : [-100.0, 40.0, 200000.0]
},
"cylinder" : {
"length" : 400000.0,
"topRadius" : 200000.0,
"bottomRadius" : 200000.0,
"material" : {
"solidColor" : {
"color" : {
"rgba" : [0, 255, 0, 128]
}
}
},
"outline" : true,
"outlineColor" : {
"rgba" : [0, 0, 0, 255]
}
}
}, {
"id" : "shape2",
"name" : "Red cone",
"position" : {
"cartographicDegrees" : [-105.0, 40.0, 200000.0]
},
"cylinder" : {
"length" : 400000.0,
"topRadius" : 0.0,
"bottomRadius" : 200000.0,
"material" : {
"solidColor" : {
"color" : {
"rgba" : [255, 0, 0, 255]
}
}
}
}
}];
var viewer = new Cesium.Viewer('cesiumContainer');
var dataSourcePromise = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSourcePromise);
How do I (Can I) apply that CZML example to my ol-cesium application without using the Cesium.Viewer.
Do I need to (Can I) create my application in that "Viewer" manner?
Or can I use my current method using "Scenes" to add the CZML?