<commit_before><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">  <!-- Use Chrome Frame in IE -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta name="description" content="Use the mouse to select and manipulate objects in the scene.">
    <meta name="cesium-sandcastle-labels" content="Showcases">
    <title>Cesium Demo</title>
    <script type="text/javascript" src="../Sandcastle-header.js"></script>
    <script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.9/require.js"></script>
    <script type="text/javascript">
    require.config({
        baseUrl : '../../../Source',
        waitSeconds : 60
    });
    </script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
    @import url(../templates/bucket.css);
    
    #pickDepth {
        display: none;
        background-color: red;
        color: white;
    }
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"><div id="pickDepth"></div></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
    "use strict";
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer', {
    selectionIndicator : false,
    infoBox : false
});

viewer.extend(Cesium.viewerCesiumInspectorMixin);
viewer.scene.globe.depthTestAgainstTerrain = false;

var scene = viewer.scene;
var handler;

Sandcastle.addDefaultToolbarButton('Show Cartographic Position on Mouse Over', function() {
    var ellipsoid = scene.globe.ellipsoid;
    var entity = viewer.entities.add({
        label : {
            show : false
        }
    });

    // Mouse over the globe to see the cartographic position
    handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
    handler.setInputAction(function(movement) {
        var cartesian = viewer.camera.pickEllipsoid(movement.endPosition, ellipsoid);
        if (cartesian) {
            var cartographic = ellipsoid.cartesianToCartographic(cartesian);
            var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2);
            var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2);

            entity.position = cartesian;
            entity.label.show = true;
            entity.label.text = '(' + longitudeString + ', ' + latitudeString + ')';
        } else {
            entity.label.show = false;
        }
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

Sandcastle.addToolbarButton('Pick Entity', function() {
    var entity = viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
        billboard : {
            image : '../images/Cesium_Logo_overlay.png'
        }
    });

    // If the mouse is over the billboard, change its scale and color
    handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
    handler.setInputAction(function(movement) {
        var pickedObject = scene.pick(movement.endPosition);
        if (Cesium.defined(pickedObject) && (pickedObject.id === entity)) {
            entity.billboard.scale = 2.0;
            entity.billboard.color = Cesium.Color.YELLOW;
        } else {
            entity.billboard.scale = 1.0;
            entity.billboard.color = Cesium.Color.WHITE;
        }
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

Sandcastle.addToolbarButton('Drill-Down Picking', function() {
    var pickedEntities = new Cesium.EntityCollection();
    var pickColor = Cesium.Color.YELLOW.withAlpha(0.5);
    function makeProperty(entity, color) {
        var colorProperty = new Cesium.CallbackProperty(function(time, result) {
            if (pickedEntities.contains(entity)) {
                return pickColor.clone(result);
            }
            return color.clone(result);
        }, false);

        entity.polygon.material = new Cesium.ColorMaterialProperty(colorProperty);
    }

    var red = viewer.entities.add({
        polygon : {
            hierarchy : Cesium.Cartesian3.fromDegreesArray([-70.0, 30.0,
                                                            -60.0, 30.0,
                                                            -60.0, 40.0,
                                                            -70.0, 40.0])
        }
    });
    makeProperty(red, Cesium.Color.RED.withAlpha(0.5));

    var blue = viewer.entities.add({
        polygon : {
            hierarchy : Cesium.Cartesian3.fromDegreesArray([-75.0, 34.0,
                                                            -63.0, 34.0,
                                                            -63.0, 40.0,
                                                            -75.0, 40.0])
        }
    });
    makeProperty(blue, Cesium.Color.BLUE.withAlpha(0.5));

    var green = viewer.entities.add({
        polygon : {
            hierarchy : Cesium.Cartesian3.fromDegreesArray([-67.0, 36.0,
                                                            -55.0, 36.0,
                                                            -55.0, 30.0,
                                                            -67.0, 30.0])
        }
    });
    makeProperty(green, Cesium.Color.GREEN.withAlpha(0.5));

    // Move the primitive that the mouse is over to the top.
    handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
    handler.setInputAction(function(movement) {
        // get an array of all primitives at the mouse position
        var pickedObjects = scene.drillPick(movement.endPosition);
        if (Cesium.defined(pickedObjects)) {
            //Update the collection of picked entities.
            pickedEntities.removeAll();
            for (var i = 0; i < pickedObjects.length; ++i) {
                var entity = pickedObjects[i].id;
                pickedEntities.add(entity);
            }
        }

    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

var pickDepthElement = document.getElementById('pickDepth');

Sandcastle.addToolbarButton('Pick depth buffer', function() {
    var ellipsoid = scene.globe.ellipsoid;
    
    var modelEntity = viewer.entities.add({
        name : 'milktruck',
        position : Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706),
        model : {
            minimumPixelSize : 128,
            uri : '../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.gltf'
        }
    });
    
    viewer.zoomTo(modelEntity);
    
    var labelEntity = viewer.entities.add({
        label : {
            show : false,
            eyeOffset : new Cesium.Cartesian3(0.0, 0.0, -10.0)
        }
    });

    // Mouse over the globe to see the cartographic position
    handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
    handler.setInputAction(function(movement) {
        var cartesian = viewer.scene.pickDepth(movement.endPosition);
        if (cartesian) {
            var cartographic = ellipsoid.cartesianToCartographic(cartesian);
            var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2);
            var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2);
            var heightString = cartographic.height.toFixed(2);

            pickDepthElement.style.display = 'block';
            pickDepthElement.innerText = '(' + longitudeString + ', ' + latitudeString + ', ' + heightString + ')';
        } else {
            pickDepthElement.style.display = 'none';
        }
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

Sandcastle.reset = function() {
    pickDepthElement.style.display = 'none';
    viewer.entities.removeAll();
    handler = handler && handler.destroy();
};
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {<commit_msg>Update Sandcastle example based on review.<commit_after><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">  <!-- Use Chrome Frame in IE -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta name="description" content="Use the mouse to select and manipulate objects in the scene.">
    <meta name="cesium-sandcastle-labels" content="Showcases">
    <title>Cesium Demo</title>
    <script type="text/javascript" src="../Sandcastle-header.js"></script>
    <script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.9/require.js"></script>
    <script type="text/javascript">
    require.config({
        baseUrl : '../../../Source',
        waitSeconds : 60
    });
    </script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
    @import url(../templates/bucket.css);
    
    #pickDepth {
        display: none;
        background-color: red;
        color: white;
    }
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"><div id="pickDepth"></div></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
    "use strict";
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer', {
    selectionIndicator : false,
    infoBox : false
});

viewer.extend(Cesium.viewerCesiumInspectorMixin);
viewer.scene.globe.depthTestAgainstTerrain = false;

var scene = viewer.scene;
var handler;

Sandcastle.addDefaultToolbarButton('Show Cartographic Position on Mouse Over', function() {
    var ellipsoid = scene.globe.ellipsoid;
    var entity = viewer.entities.add({
        label : {
            show : false
        }
    });

    // Mouse over the globe to see the cartographic position
    handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
    handler.setInputAction(function(movement) {
        var cartesian = viewer.camera.pickEllipsoid(movement.endPosition, ellipsoid);
        if (cartesian) {
            var cartographic = ellipsoid.cartesianToCartographic(cartesian);
            var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2);
            var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2);

            entity.position = cartesian;
            entity.label.show = true;
            entity.label.text = '(' + longitudeString + ', ' + latitudeString + ')';
        } else {
            entity.label.show = false;
        }
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

Sandcastle.addToolbarButton('Pick Entity', function() {
    var entity = viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
        billboard : {
            image : '../images/Cesium_Logo_overlay.png'
        }
    });

    // If the mouse is over the billboard, change its scale and color
    handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
    handler.setInputAction(function(movement) {
        var pickedObject = scene.pick(movement.endPosition);
        if (Cesium.defined(pickedObject) && (pickedObject.id === entity)) {
            entity.billboard.scale = 2.0;
            entity.billboard.color = Cesium.Color.YELLOW;
        } else {
            entity.billboard.scale = 1.0;
            entity.billboard.color = Cesium.Color.WHITE;
        }
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

Sandcastle.addToolbarButton('Drill-Down Picking', function() {
    var pickedEntities = new Cesium.EntityCollection();
    var pickColor = Cesium.Color.YELLOW.withAlpha(0.5);
    function makeProperty(entity, color) {
        var colorProperty = new Cesium.CallbackProperty(function(time, result) {
            if (pickedEntities.contains(entity)) {
                return pickColor.clone(result);
            }
            return color.clone(result);
        }, false);

        entity.polygon.material = new Cesium.ColorMaterialProperty(colorProperty);
    }

    var red = viewer.entities.add({
        polygon : {
            hierarchy : Cesium.Cartesian3.fromDegreesArray([-70.0, 30.0,
                                                            -60.0, 30.0,
                                                            -60.0, 40.0,
                                                            -70.0, 40.0])
        }
    });
    makeProperty(red, Cesium.Color.RED.withAlpha(0.5));

    var blue = viewer.entities.add({
        polygon : {
            hierarchy : Cesium.Cartesian3.fromDegreesArray([-75.0, 34.0,
                                                            -63.0, 34.0,
                                                            -63.0, 40.0,
                                                            -75.0, 40.0])
        }
    });
    makeProperty(blue, Cesium.Color.BLUE.withAlpha(0.5));

    var green = viewer.entities.add({
        polygon : {
            hierarchy : Cesium.Cartesian3.fromDegreesArray([-67.0, 36.0,
                                                            -55.0, 36.0,
                                                            -55.0, 30.0,
                                                            -67.0, 30.0])
        }
    });
    makeProperty(green, Cesium.Color.GREEN.withAlpha(0.5));

    // Move the primitive that the mouse is over to the top.
    handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
    handler.setInputAction(function(movement) {
        // get an array of all primitives at the mouse position
        var pickedObjects = scene.drillPick(movement.endPosition);
        if (Cesium.defined(pickedObjects)) {
            //Update the collection of picked entities.
            pickedEntities.removeAll();
            for (var i = 0; i < pickedObjects.length; ++i) {
                var entity = pickedObjects[i].id;
                pickedEntities.add(entity);
            }
        }

    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

var pickDepthElement = document.getElementById('pickDepth');

Sandcastle.addToolbarButton('Pick depth buffer', function() {
    var ellipsoid = scene.globe.ellipsoid;
    
    var modelEntity = viewer.entities.add({
        name : 'milktruck',
        position : Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706),
        model : {
            uri : '../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.gltf'
        }
    });
    viewer.zoomTo(modelEntity);
    
    var labelEntity = viewer.entities.add({
        label : {
            show : false,
            horizontalOrigin : Cesium.HorizontalOrigin.LEFT,
            eyeOffset : new Cesium.Cartesian3(0.0, 0.0, -6.0)
        }
    });

    // Mouse over the globe to see the cartographic position
    handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
    handler.setInputAction(function(movement) {
        var scene = viewer.scene;
        var pickedObject = scene.pick(movement.endPosition);
        if (Cesium.defined(pickedObject) && pickedObject.id === modelEntity) {
            var cartesian = viewer.scene.pickDepth(movement.endPosition);
            
            var cartographic = ellipsoid.cartesianToCartographic(cartesian);
            var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2);
            var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2);
            var heightString = cartographic.height.toFixed(2);

            labelEntity.position = cartesian;
            labelEntity.label.show = true;
            labelEntity.label.text = '(' + longitudeString + ', ' + latitudeString + ', ' + heightString + ')';
        } else {
            labelEntity.label.show = false;
        }
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

Sandcastle.reset = function() {
    pickDepthElement.style.display = 'none';
    viewer.entities.removeAll();
    handler = handler && handler.destroy();
};
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
{'fraction_non_alphanumeric': 0.12564295571446493, 'fraction_numerical': 0.018692761259565926, 'mean_word_length': 2.1439558272530075, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '956524', 'n_tokens_mistral': 4736, 'n_tokens_neox': 4503, 'n_words': 837}