Advertisement
Guest User

Cesium color

a guest
Jun 12th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dojo.xhrGet({
  2.     url: filePath,
  3.     load: function(result){
  4.         var jsonResult = JSON.parse(result);   
  5.         var color;
  6.         var width; 
  7.         for(var i in jsonResult){
  8.             if(jsonResult[i].event_type == "speeding_down"){
  9.                 color = new Cesium.Color(1.0, 1.5, 0.0, 1.0);
  10.                 width = 1;
  11.             }else if(jsonResult[i].event_type == "speeding_up"){
  12.                 color = new Cesium.Color(1.0, 2.5, 0.0, 1.0);
  13.                 width=5;
  14.             }else{
  15.                 color = new Cesium.Color(1.0, 0.5, 0.0, 1.0)
  16.                 width=8;
  17.             }          
  18.            
  19.             polylines.add({
  20.                 positions:ellipsoid.cartographicArrayToCartesianArray([
  21.     new Cesium.Cartographic.fromDegrees(jsonResult[i].startpointx, jsonResult[i].startpointy),
  22.     new Cesium.Cartographic.fromDegrees(jsonResult[i].endpointx, jsonResult[i].endpointy)
  23.                 ]),
  24.                 width:width,
  25.                 "material.uniforms.color" : color
  26.             });                                        
  27.         }                  
  28.      },
  29.     changeURL: true,
  30.     mimetype: "text/plain"
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement