Skip to content

Commit

Permalink
Clean up sensor API
Browse files Browse the repository at this point in the history
This are changes needed ahead of #1887 to ensure API/CZML compatibility with 1.0
  • Loading branch information
mramato committed Jul 18, 2014
1 parent 8e0a2b0 commit d21a142
Show file tree
Hide file tree
Showing 16 changed files with 274 additions and 625 deletions.
62 changes: 31 additions & 31 deletions Apps/SampleData/LotsOfSensors.czml
Original file line number Diff line number Diff line change
Expand Up @@ -9418,7 +9418,7 @@
0,255,0,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -11055,7 +11055,7 @@
0,255,255,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -12692,7 +12692,7 @@
255,0,255,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -14329,7 +14329,7 @@
255,255,0,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -15966,7 +15966,7 @@
0,0,255,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -17603,7 +17603,7 @@
255,0,0,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -19240,7 +19240,7 @@
65,105,225,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -20877,7 +20877,7 @@
135,206,250,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -22514,7 +22514,7 @@
107,142,35,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -24151,7 +24151,7 @@
143,188,143,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -25788,7 +25788,7 @@
255,215,0,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -27425,7 +27425,7 @@
186,85,211,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -29062,7 +29062,7 @@
255,105,180,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -30699,7 +30699,7 @@
210,105,30,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -32336,7 +32336,7 @@
255,240,245,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -33973,7 +33973,7 @@
127,255,0,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -35610,7 +35610,7 @@
255,106,106,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -37247,7 +37247,7 @@
155,48,255,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -38884,7 +38884,7 @@
255,165,0,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -40521,7 +40521,7 @@
240,128,128,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -42158,7 +42158,7 @@
240,230,140,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -43795,7 +43795,7 @@
153,153,153,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -45432,7 +45432,7 @@
64,128,128,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -47068,7 +47068,7 @@
255,0,128,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -47102,7 +47102,7 @@
255,128,0,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -48739,7 +48739,7 @@
203,132,52,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -50376,7 +50376,7 @@
127,255,0,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -52013,7 +52013,7 @@
163,143,239,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -53650,7 +53650,7 @@
201,193,54,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -55287,7 +55287,7 @@
210,105,30,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down Expand Up @@ -56924,7 +56924,7 @@
155,48,255,255
]
},
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down
2 changes: 1 addition & 1 deletion Apps/SampleData/simple.czml
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@
}
},
"portionToDisplay":"COMPLETE",
"material":{
"lateralSurfaceMaterial":{
"solidColor":{
"color":{
"rgba":[
Expand Down
32 changes: 16 additions & 16 deletions Apps/Sandcastle/gallery/Sensors.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,27 @@
return Cesium.Matrix4.multiply(modelMatrix, Cesium.Matrix4.fromRotationTranslation(orientation, Cesium.Cartesian3.ZERO), new Cesium.Matrix4());
}

function addRectangularSensor(sensors, ellipsoid, scene) {
var rectangularPyramidSensor = sensors.addRectangularPyramid();
function addRectangularSensor(primitives, ellipsoid, scene) {
var rectangularPyramidSensor = new Cesium.RectangularPyramidSensorVolume();
Sandcastle.declare(rectangularPyramidSensor); // For highlighting in Sandcastle.

rectangularPyramidSensor.modelMatrix = getModelMatrix(ellipsoid);
rectangularPyramidSensor.radius = 20000000.0;
rectangularPyramidSensor.xHalfAngle = Cesium.Math.toRadians(40.0);
rectangularPyramidSensor.yHalfAngle = Cesium.Math.toRadians(20.0);

rectangularPyramidSensor.material = Cesium.Material.fromType('Color');
rectangularPyramidSensor.material.uniforms.color = {
rectangularPyramidSensor.lateralSurfaceMaterial = Cesium.Material.fromType('Color');
rectangularPyramidSensor.lateralSurfaceMaterial.uniforms.color = {
red : 0.0,
green : 1.0,
blue : 1.0,
alpha : 0.5
};
primitives.add(rectangularPyramidSensor);
}

function addCustomSensor(sensors, ellipsoid, scene) {
var customSensor = sensors.addCustom();
function addCustomSensor(primitives, ellipsoid, scene) {
var customSensor = new Cesium.CustomSensorVolume();
Sandcastle.declare(customSensor); // For highlighting in Sandcastle.

var directions = [];
Expand All @@ -119,10 +120,11 @@

customSensor.modelMatrix = getModelMatrix(ellipsoid);
customSensor.radius = 20000000.0;
customSensor.setDirections(directions);
customSensor.directions = directions;
primitives.add(customSensor);
}

function createUserInterface(viewer, sensors) {
function createUserInterface(viewer) {
var tp = new TitlePane({
title: 'Manipulate Sensor',
id:'title-pane',
Expand All @@ -135,23 +137,22 @@
var scene = viewer.scene;
var ellipsoid = scene.globe.ellipsoid;
var primitives = scene.primitives;
primitives.add(sensors);

var sensorMenu = new DropDownMenu({ style: 'display: none;'});

function updateSensor()
{
sensors.removeAll();
primitives.removeAll();
switch (selection)
{
case 'Rectangular':
addRectangularSensor(sensors, ellipsoid, scene);
addRectangularSensor(primitives, ellipsoid, scene);
break;
case 'Custom':
addCustomSensor(sensors, ellipsoid, scene);
addCustomSensor(primitives, ellipsoid, scene);
break;
case 'Rectangular':
addRectangularSensor(sensors, ellipsoid, scene);
addRectangularSensor(primitives, ellipsoid, scene);
}
}

Expand Down Expand Up @@ -258,16 +259,15 @@
}

var viewer = new Cesium.Viewer('cesiumContainer', {
sceneModePicker : false //sensors currently only work in 3D
sceneModePicker : false
});

viewer.screenSpaceEventHandler.setInputAction(function(movement) {
var pickedPrimitive = viewer.scene.pick(movement.endPosition);
Sandcastle.highlight(pickedPrimitive);
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

var sensors = new Cesium.SensorVolumeCollection();
createUserInterface(viewer, sensors);
createUserInterface(viewer);
});
//Sandcastle_End
Sandcastle.finishedLoading();
Expand Down
Loading

0 comments on commit d21a142

Please sign in to comment.