颜色强度调试
colorModulation 属性用于将颜色调整为扫描仪捕获的强度值,从而以更逼真的方式显示点云的扫描表面。颜色的亮度随着强度值的降低而降低,产生较暗的区域并有助于区分扫描表面的不同部分。
这个示例显示了如何使用颜色调试从分类点云数据中获取更多信息。
程序完整源代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>PointCloudLayer - intensity color modulation - 4.5</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#paneDiv {
padding: 12px 12px 12px 12px;
background-color: rgba(255, 255, 255, 1);
}
label {
font-size: 18px;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.5/esri/css/main.css">
<script src="https://js.arcgis.com/4.5/"></script>
<script>
require([
"esri/Map",
"esri/views/SceneView",
"esri/layers/PointCloudLayer",
"dojo/domReady!"
], function(
Map, SceneView, PointCloudLayer
) {
/******************************************************************
* 加载点云图层 分类显示
******************************************************************/
// Intentsity 取值为 0 ~ 255 。
var colorModulation = {
field: "INTENSITY",
minValue: 35,
maxValue: 211
};
var pcLayer = new PointCloudLayer({
url: "https://tiles.arcgis.com/tiles/Imiq6naek6ZWdour/arcgis/rest/services/PointCloud_urban/SceneServer",
renderer: {
type: "point-cloud-unique-value",
field: "CLASS_CODE",
colorModulation: colorModulation,
pointSizeAlgorithm: {
type: "fixed-size",
useRealWorldSymbolSizes: false,
size: 3
},
pointsPerInch: 35,
colorUniqueValueInfos: [
{
values: ["1"],
label: "Unassigned",
color: [178, 178, 178]
},
{
values: ["2"],
label: "Ground",
color: [168, 112, 0]
},
{
values: ["5"],
label: "High vegetation",
color: [205, 245, 121]
},
{
values: ["6"],
label: "Building",
color: [229, 75, 65]
},
{
values: ["7"],
label: "Low Point",
color: [229, 0, 0]
}]
}
});
var map = new Map({
basemap: "gray-vector",
ground: "world-elevation",
layers: [pcLayer]
});
var view = new SceneView({
container: "viewDiv",
map: map,
camera: {
heading: 321,
tilt: 65,
position: {
x: -13660884.75182009,
y: 4641370.954907834,
z: 174.2508678585291,
spatialReference: {
wkid: 3857
}
}
}
});
// 切换渲染器
var modulation = document.getElementById("modulation");
modulation.addEventListener("click", function(event) {
var renderer = pcLayer.renderer.clone();
renderer.colorModulation = event.target.checked ?
colorModulation : null;
pcLayer.renderer = renderer;
});
view.ui.add("paneDiv", "bottom-left");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="paneDiv">
<label>Color modulation based on intensity:</label> <input type="checkbox" name="modulation"
id="modulation" checked>
</div>
</body>
</html>
程序运行效果:
(完)