Cesium.CzmlDataSource.processMaterialPacketData

Could some one tell me what is the function for:?

Cesium.CzmlDataSource.processMaterialPacketData(object, propertyName, packetData, interval, sourceUri, entityCollection)

the documentation says,

" A helper function used by custom CZML updater functions which creates or updates a MaterialProperty from a CZML packet."

But I am confused about its application. So anyone can give me a simple example?

This function looks for the material property for an object in the CZML data, creates a material and adds it to the entity in the entityCollection.
Why are you interested in this function? Are you writing a custom CZML property?

-Hannah

Thanks very much for your reply.
I have searched the “customProperty” in this forum ,and I have learnt something.

Now I want to know the syntax of such function like this:

Cesium.CzmlDataSource.processMaterialPacketData(object, propertyName, packetData, interval, sourceUri, entityCollection)

Cesium.CzmlDataSource.processPacketData(type, object, propertyName, packetData, interval, sourceUri, entityCollection)

Cesium.CzmlDataSource.processPacketData(type, object, propertyName, packetData, interval, sourceUri, entityCollection)

I want to know how to call this function.Can I write like this, if I want to update the material.solidColor of the first packet?

Or these functions just mean to make some custom properties, not to update the packet? I am very confused.

Thanks if you can give an answer.

var czml = [

{

“id” : “document”,

“name” : “CZML Geometries: Polygon”,

“version” : “1.0”

}, {

“id” : “redPolygon”,

“name” : “Red polygon on surface”,

“polygon” : {

“positions” : {

“cartographicDegrees” : [

-115.0, 37.0, 0,

-115.0, 32.0, 0,

-107.0, 33.0, 0,

-102.0, 31.0, 0,

-102.0, 35.0, 0

]

},

“material” : {

“solidColor” : {

“color” : {

“rgba” : [255, 0, 0, 255]

}

}

}

}

}, {

“id” : “greenPolygon”,

“name” : “Green extruded polygon”,

“polygon” : {

“positions” : {

“cartographicDegrees” : [

-108.0, 42.0, 0,

-100.0, 42.0, 0,

-104.0, 40.0, 0

]

},

“material” : {

“solidColor” : {

“color” : {

“rgba” : [0, 255, 0, 255]

}

}

},

“extrudedHeight” : 500000.0

}

}, {

“id” : “orangePolygon”,

“name” : “Orange polygon with per-position heights and outline”,

“polygon” : {

“positions” : {

“cartographicDegrees” : [

-108.0, 25.0, 100000,

-100.0, 25.0, 100000,

-100.0, 30.0, 100000,

-108.0, 30.0, 300000

]

},

“material” : {

“solidColor” : {

“color” : {

“rgba” : [255, 100, 0, 100]

}

}

},

“extrudedHeight” : 0,

“perPositionHeight” : true,

“outline” : true,

“outlineColor” : {

“rgba” : [0, 0, 0, 255]

}

}

}

];

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var czmlDataSource = new Cesium.CzmlDataSource();

czmlDataSource.load(czml);

viewer.dataSources.add(czmlDataSource);

var object = czmlDataSource.entities.values[0];

var packetData=object.color;

var propertyName=‘color’;

var interval=object.interval;

var entityCollection=czmlDataSource.entities;

Cesium.CzmlDataSource.processMaterialPacketData(object, propertyName, packetData, interval,undefined, entityCollection)

{ //I want to update the firdt packet’s solidcolor into BROWN

object.solidColor=Cesium.Color.BLUE ;

}

viewer.zoomTo(czmlDataSource);

在 2015年12月23日星期三 UTC+8下午3:42:50,insh写道: