<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="Create and style textual labels.">
    <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);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
    "use strict";
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;

function addLabel() {
    Sandcastle.declare(addLabel);
    scene.primitives.removeAll();
    var labels = scene.primitives.add(new Cesium.LabelCollection());
    labels.add({
        position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
        text     : 'Philadelphia'
    });
}

function setFont() {
    Sandcastle.declare(setFont);
    scene.primitives.removeAll();
    var labels = scene.primitives.add(new Cesium.LabelCollection());
    labels.add({
        position  : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
        text      : 'Philadelphia',
        // CSS font-family
        font      : '24px Helvetica',
        fillColor : new Cesium.Color(0.6, 0.9, 1.0),
        outlineColor : Cesium.Color.BLACK,
        outlineWidth : 2,
        style : Cesium.LabelStyle.FILL_AND_OUTLINE
    });
}

function setProperties() {
    Sandcastle.declare(setProperties);
    scene.primitives.removeAll();
    var labels = scene.primitives.add(new Cesium.LabelCollection());
    var l = labels.add({
        position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
        text     : 'Philadelphia'
    });

    l.position = Cesium.Cartesian3.fromDegrees(-75.10, 39.57, 300000.0);
    l.scale = 2.0;
}

function inReferenceFrame() {
    Sandcastle.declare(inReferenceFrame);
    scene.primitives.removeAll();
    var center = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);
    var labels = scene.primitives.add(new Cesium.LabelCollection());
    labels.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
    labels.add({
        position : new Cesium.Cartesian3(0.0, 0.0, 0.0),
        text     : 'Center'
    });
    labels.add({
        position : new Cesium.Cartesian3(1000000.0, 0.0, 0.0),
        text     : 'East'
    });
    labels.add({
        position : new Cesium.Cartesian3(0.0, 1000000.0, 0.0),
        text     : 'North'
    });
    labels.add({
        position : new Cesium.Cartesian3(0.0, 0.0, 1000000.0),
        text     : 'Up'
    });
}

function offsetByDistance() {
    Sandcastle.declare(offsetByDistance);
    scene.primitives.removeAll();
    var image = new Image();
    image.onload = function() {
        var billboards = scene.primitives.add(new Cesium.BillboardCollection());
        billboards.add({
            position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
            scaleByDistance : new Cesium.NearFarScalar(1.5e2, 5.0, 1.5e7, 0.5),
            image : image
        });

        var labels = scene.primitives.add(new Cesium.LabelCollection());
        labels.add({
            position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
            text     : 'Label on top of scaling billboard',
            font : '20px sans-serif',
            horizontalOrigin : Cesium.HorizontalOrigin.CENTER,
            pixelOffset : new Cesium.Cartesian2(0.0, -image.height),
            pixelOffsetScaleByDistance : new Cesium.NearFarScalar(1.5e2, 3.0, 1.5e7, 0.5)
        });
    };
    image.src = '../images/facility.gif';
}

function fadeByDistance() {
    Sandcastle.declare(fadeByDistance);
    scene.primitives.removeAll();
    var labels = scene.primitives.add(new Cesium.LabelCollection());
    labels.add({
        position : Cesium.Cartesian3.fromDegrees(-73.94, 40.67),
        text     : 'New York',
        translucencyByDistance : new Cesium.NearFarScalar(1.5e2, 1.0, 1.5e8, 0.0)
    });
    labels.add({
        position : Cesium.Cartesian3.fromDegrees(-84.39, 33.75),
        text     : 'Atlanta',
        translucencyByDistance : new Cesium.NearFarScalar(1.5e5, 1.0, 1.5e7, 0.0)
    });
}

Sandcastle.addToolbarMenu([{
    text : 'Add label',
    onselect : function() {
        addLabel();
        Sandcastle.highlight(addLabel);
    }
}, {
    text : 'Set font',
    onselect : function() {
        setFont();
        Sandcastle.highlight(setFont);
    }
}, {
    text : 'Set properties',
    onselect : function() {
        setProperties();
        Sandcastle.highlight(setProperties);
    }
}, {
    text : 'Add labels in reference frame',
    onselect : function() {
        inReferenceFrame();
        Sandcastle.highlight(inReferenceFrame);
    }
}, {
    text : 'Offset label by distance',
    onselect : function() {
        offsetByDistance();
        Sandcastle.highlight(offsetByDistance);
    }
}, {
    text : 'Fade label by distance',
    onselect : function() {
        fadeByDistance();
        Sandcastle.highlight(fadeByDistance);
    }
}]);
//Sandcastle_End
    Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
    startup(Cesium);
} else if (typeof require === "function") {
    require(["Cesium"], startup);
}
</script>
</body>
</html><commit_msg>Update Label Sandcastle example to use entities.<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="Create and style textual labels.">
    <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);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
    "use strict";
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');

function addLabel() {
    Sandcastle.declare(addLabel);
    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
        label : {
            text : 'Philadelphia'
        }
    });
}

function setFont() {
    Sandcastle.declare(setFont);
    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
        label : {
            text : 'Philadelphia',
            font : '24px Helvetica',
            fillColor : new Cesium.Color(0.6, 0.9, 1.0),
            outlineColor : Cesium.Color.BLACK,
            outlineWidth : 2,
            style : Cesium.LabelStyle.FILL_AND_OUTLINE
        }
    });
}

function setProperties() {
    Sandcastle.declare(setProperties);
    var entity = viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57, 300000.0),
        label : {
            text : 'Philadelphia'
        }
    });

    entity.label.scale = 2.0;
}
/*
function inReferenceFrame() {
    Sandcastle.declare(inReferenceFrame);
    scene.primitives.removeAll();
    var center = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);
    var labels = scene.primitives.add(new Cesium.LabelCollection());
    labels.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
    labels.add({
        position : new Cesium.Cartesian3(0.0, 0.0, 0.0),
        text     : 'Center'
    });
    labels.add({
        position : new Cesium.Cartesian3(1000000.0, 0.0, 0.0),
        text     : 'East'
    });
    labels.add({
        position : new Cesium.Cartesian3(0.0, 1000000.0, 0.0),
        text     : 'North'
    });
    labels.add({
        position : new Cesium.Cartesian3(0.0, 0.0, 1000000.0),
        text     : 'Up'
    });
}
*/

function offsetByDistance() {
    Sandcastle.declare(offsetByDistance);
    var image = new Image();
    image.onload = function() {
        viewer.entities.add({
            position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
            billboard : {
                position : Cesium.Cartesian3.fromDegrees(-75.10, 39.57),
                scaleByDistance : new Cesium.NearFarScalar(1.5e2, 5.0, 1.5e7, 0.5),
                image : image
            },
            label : {
                text : 'Label on top of scaling billboard',
                font : '20px sans-serif',
                horizontalOrigin : Cesium.HorizontalOrigin.CENTER,
                pixelOffset : new Cesium.Cartesian2(0.0, -image.height),
                pixelOffsetScaleByDistance : new Cesium.NearFarScalar(1.5e2, 3.0, 1.5e7, 0.5)
            }
        });
    };
    image.src = '../images/facility.gif';
}

function fadeByDistance() {
    Sandcastle.declare(fadeByDistance);
    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-73.94, 40.67),
        label : {
            text : 'New York',
            translucencyByDistance : new Cesium.NearFarScalar(1.5e2, 1.0, 1.5e8, 0.0)
        }
    });
    viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-84.39, 33.75),
        label : {
            text : 'Atlanta',
            translucencyByDistance : new Cesium.NearFarScalar(1.5e5, 1.0, 1.5e7, 0.0)
        }
    });
}

Sandcastle.addToolbarMenu([{
    text : 'Add label',
    onselect : function() {
        addLabel();
        Sandcastle.highlight(addLabel);
    }
}, {
    text : 'Set font',
    onselect : function() {
        setFont();
        Sandcastle.highlight(setFont);
    }
}, {
    text : 'Set properties',
    onselect : function() {
        setProperties();
        Sandcastle.highlight(setProperties);
    }
}, {
    text : 'Add labels in reference frame',
    onselect : function() {
        //inReferenceFrame();
        //Sandcastle.highlight(inReferenceFrame);
    }
}, {
    text : 'Offset label by distance',
    onselect : function() {
        offsetByDistance();
        Sandcastle.highlight(offsetByDistance);
    }
}, {
    text : 'Fade label by distance',
    onselect : function() {
        fadeByDistance();
        Sandcastle.highlight(fadeByDistance);
    }
}]);

Sandcastle.reset = function() {
    viewer.entities.removeAll();
};
//Sandcastle_End
    Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
    startup(Cesium);
} else if (typeof require === "function") {
    require(["Cesium"], startup);
}
</script>
</body>
</html>
{'fraction_non_alphanumeric': 0.153164886689242, 'fraction_numerical': 0.03533906399235912, 'mean_word_length': 2.589280149579308, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3933728', 'n_tokens_mistral': 3967, 'n_tokens_neox': 3654, 'n_words': 671}