shape1
및 shape2
의 특정 수를 런타임에 다른 위치에 알리고 프로그램 적으로 다른 속성도 변경할 수 있기를 원합니다.CZML 패킷 복제 및 수정
CZML 패킷을 참조, 복제 및 수정하는 데 선호되는 방법은 무엇입니까? CzmlDataSource로드시
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 dataSource = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSource);
감사합니다. 제비 뽑기를 명백하게한다. "직접 엔티티를 복제 할 수는 없지만 여러 번 저장하고 재사용 할 수있는 일반 옵션 오브젝트에서 새로운 엔티티 ({options ...})를'EntityCollection'에 추가 할 수 있습니다. " CZML 패킷 (재사용을 위해 일반 옵션 객체에 저장)에서 생성 된'Entity' 객체에서 속성을 어떻게 추출합니까? 내 어리 석음을 참아주십시오. 나는 C와 C++의 땅에서 왔고 JS 관용구에 정통하지 않습니다. – Slaiyer
@Slaiyer는 일반적인 코드 경로가 아니며 Cesium은이를 직접 지원하지 않습니다. 하나의 옵션은 CZML을 완전히 건너 뛰고 서버가 엔티티 생성 템플리트 객체를 대신 제공하도록하는 것입니다. 또 다른 옵션은 [CzmlDataSource.process] (http://cesiumjs.org/Cesium/Build/Documentation/CzmlDataSource.html#process)를 사용하여 ID가 변경된 czml 패킷을 루프에서 다시 가져 오는 것입니다. – emackey