This repository has been archived by the owner on Nov 4, 2020. It is now read-only.
forked from CesiumGS/cesium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from fredj/c2c_patches_cesium_1.26
cesium 1.26
- Loading branch information
Showing
164 changed files
with
7,372 additions
and
1,662 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="Cluster labels, billboards and points."> | ||
<meta name="cesium-sandcastle-labels" content="Tutorials,Showcases"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/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); | ||
#toolbar { | ||
background: rgba(42, 42, 42, 0.8); | ||
padding: 4px; | ||
border-radius: 4px; | ||
} | ||
#toolbar input { | ||
vertical-align: middle; | ||
padding-top: 2px; | ||
padding-bottom: 2px; | ||
} | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<div id="toolbar"> | ||
<table> | ||
<tbody><tr> | ||
<td>Pixel Range</td> | ||
<td> | ||
<input type="range" min="1" max="200" step="1" data-bind="value: pixelRange, valueUpdate: 'input'"> | ||
<input type="text" size="2" data-bind="value: pixelRange"> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Minimum Cluster Size</td> | ||
<td> | ||
<input type="range" min="2" max="20" step="1" data-bind="value: minimumClusterSize, valueUpdate: 'input'"> | ||
<input type="text" size="2" data-bind="value: minimumClusterSize"> | ||
</td> | ||
</tr> | ||
<tr><td><input type="checkbox" data-bind="checked: enabled"/>Enabled</td></tr> | ||
<tr><td><input type="checkbox" data-bind="checked: customStyle"/>Custom Styling</td></tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<script id="cesium_sandcastle_script"> | ||
function startup(Cesium) { | ||
'use strict'; | ||
//Sandcastle_Begin | ||
var viewer = new Cesium.Viewer('cesiumContainer'); | ||
|
||
var options = { | ||
camera : viewer.scene.camera, | ||
canvas : viewer.scene.canvas | ||
}; | ||
var dataSourcePromise = viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/kml/facilities/facilities.kml', options)); | ||
dataSourcePromise.then(function(dataSource) { | ||
var pixelRange = 15; | ||
var minimumClusterSize = 3; | ||
var enabled = true; | ||
|
||
dataSource.clustering.enabled = enabled; | ||
dataSource.clustering.pixelRange = pixelRange; | ||
dataSource.clustering.minimumClusterSize = minimumClusterSize; | ||
|
||
var removeListener; | ||
|
||
var pinBuilder = new Cesium.PinBuilder(); | ||
var pin50 = pinBuilder.fromText('50+', Cesium.Color.RED, 48).toDataURL(); | ||
var pin40 = pinBuilder.fromText('40+', Cesium.Color.ORANGE, 48).toDataURL(); | ||
var pin30 = pinBuilder.fromText('30+', Cesium.Color.YELLOW, 48).toDataURL(); | ||
var pin20 = pinBuilder.fromText('20+', Cesium.Color.GREEN, 48).toDataURL(); | ||
var pin10 = pinBuilder.fromText('10+', Cesium.Color.BLUE, 48).toDataURL(); | ||
|
||
var singleDigitPins = new Array(8); | ||
for (var i = 0; i < singleDigitPins.length; ++i) { | ||
singleDigitPins[i] = pinBuilder.fromText('' + (i + 2), Cesium.Color.VIOLET, 48).toDataURL(); | ||
} | ||
|
||
function customStyle() { | ||
if (Cesium.defined(removeListener)) { | ||
removeListener(); | ||
removeListener = undefined; | ||
} else { | ||
removeListener = dataSource.clustering.clusterEvent.addEventListener(function(clusteredEntities, cluster) { | ||
cluster.label.show = false; | ||
cluster.billboard.show = true; | ||
cluster.billboard.verticalOrigin = Cesium.VerticalOrigin.BOTTOM; | ||
|
||
if (clusteredEntities.length >= 50) { | ||
cluster.billboard.image = pin50; | ||
} else if (clusteredEntities.length >= 40) { | ||
cluster.billboard.image = pin40; | ||
} else if (clusteredEntities.length >= 30) { | ||
cluster.billboard.image = pin30; | ||
} else if (clusteredEntities.length >= 20) { | ||
cluster.billboard.image = pin20; | ||
} else if (clusteredEntities.length >= 10) { | ||
cluster.billboard.image = pin10; | ||
} else { | ||
cluster.billboard.image = singleDigitPins[clusteredEntities.length - 2]; | ||
} | ||
}); | ||
} | ||
|
||
// force a re-cluster with the new styling | ||
var pixelRange = dataSource.clustering.pixelRange; | ||
dataSource.clustering.pixelRange = 0; | ||
dataSource.clustering.pixelRange = pixelRange; | ||
} | ||
|
||
// start with custom style | ||
customStyle(); | ||
|
||
var viewModel = { | ||
pixelRange: pixelRange, | ||
minimumClusterSize: minimumClusterSize, | ||
enabled : enabled, | ||
customStyle : true | ||
}; | ||
Cesium.knockout.track(viewModel); | ||
|
||
var toolbar = document.getElementById('toolbar'); | ||
Cesium.knockout.applyBindings(viewModel, toolbar); | ||
|
||
function subscribeParameter(name) { | ||
Cesium.knockout.getObservable(viewModel, name).subscribe( | ||
function(newValue) { | ||
dataSource.clustering[name] = newValue; | ||
} | ||
); | ||
} | ||
|
||
subscribeParameter('pixelRange'); | ||
subscribeParameter('minimumClusterSize'); | ||
subscribeParameter('enabled'); | ||
Cesium.knockout.getObservable(viewModel, 'customStyle').subscribe(customStyle); | ||
|
||
var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); | ||
handler.setInputAction(function(movement) { | ||
var pickedLabel = viewer.scene.pick(movement.position); | ||
if (Cesium.defined(pickedLabel)) { | ||
var ids = pickedLabel.id; | ||
if (Cesium.isArray(ids)) { | ||
for (var i = 0; i < ids.length; ++i) { | ||
ids[i].label.fillColor = Cesium.Color.RED; | ||
} | ||
} | ||
} | ||
}, Cesium.ScreenSpaceEventType.LEFT_CLICK); | ||
}); | ||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
Apps/Sandcastle/gallery/Distance Display Conditions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="Distance display conditions"> | ||
<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.20/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 addBillboardAndRectangle() { | ||
Sandcastle.declare(addBillboardAndRectangle); | ||
|
||
viewer.entities.add({ | ||
position : Cesium.Cartesian3.fromDegrees(-77, 40.5), | ||
billboard : { | ||
image : '../images/facility.gif', | ||
distanceDisplayCondition : new Cesium.DistanceDisplayCondition(5.5e6) | ||
}, | ||
rectangle : { | ||
coordinates : Cesium.Rectangle.fromDegrees(-80.5, 39.7, -75.1, 42.0), | ||
height : 0.0, | ||
material : Cesium.Color.RED.withAlpha(0.5), | ||
outline : true, | ||
outlineColor : Cesium.Color.RED, | ||
distanceDisplayCondition : new Cesium.DistanceDisplayCondition(0.0, 5.5e6) | ||
} | ||
}); | ||
} | ||
|
||
function addPointAndModel() { | ||
Sandcastle.declare(addPointAndModel); | ||
|
||
var position = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883, 0.0); | ||
var heading = Cesium.Math.toRadians(135); | ||
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, 0.0, 0.0); | ||
|
||
viewer.entities.add({ | ||
position : position, | ||
orientation : orientation, | ||
point : { | ||
pixelSize : 10, | ||
color : Cesium.Color.YELLOW, | ||
distanceDisplayCondition : new Cesium.DistanceDisplayCondition(250.5) | ||
}, | ||
model : { | ||
uri : '../../SampleData/models/CesiumGround/Cesium_Ground.glb', | ||
distanceDisplayCondition : new Cesium.DistanceDisplayCondition(0.0, 250.5) | ||
} | ||
}); | ||
} | ||
|
||
Sandcastle.addToolbarMenu([{ | ||
text : 'Billboard and Primitive', | ||
onselect : function() { | ||
addBillboardAndRectangle(); | ||
Sandcastle.highlight(addBillboardAndRectangle); | ||
} | ||
}, { | ||
text : 'Point and Model', | ||
onselect : function() { | ||
addPointAndModel(); | ||
Sandcastle.highlight(addPointAndModel); | ||
} | ||
}]); | ||
|
||
Sandcastle.reset = function () { | ||
viewer.camera.flyHome(0); | ||
viewer.entities.removeAll(); | ||
}; | ||
|
||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.