Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Building Scene Layer (BSL) OGC I3S standard #11678

Merged
merged 33 commits into from
Feb 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
808fcaa
- Added support for conversion from sRGB color space profile to linea…
Tamrat-B Dec 5, 2023
0b9869b
Added Support for BSL structure, BSL statistics, generic feature attr…
Tamrat-B Dec 5, 2023
d612e7b
I3S Building Scene Layer Sandcastle app
Tamrat-B Dec 5, 2023
a4da846
I3S BSL app icon
Tamrat-B Dec 5, 2023
f469a21
Added support for conversion from sRGB color space profile to linear …
Tamrat-B Dec 5, 2023
4f92b4a
added additional payload options
Tamrat-B Dec 5, 2023
a2066b0
- Added support for binary attribute data with values stored in objec…
Tamrat-B Dec 5, 2023
562d6e5
- Added support for 3D objects transparency
Tamrat-B Dec 5, 2023
89f6dbe
- Added support for BSL hierarchy of layers
Tamrat-B Dec 5, 2023
394f823
- Added support for the generic feature attribute driven filter
Tamrat-B Dec 5, 2023
1394e4a
Added support for BSL structure per the OGC I3S standard
Tamrat-B Dec 5, 2023
5a34b60
- Added support for symbolization defined in I3S Layer data
Tamrat-B Dec 5, 2023
1054536
Added support for EXT_mesh_features and EXT_structural_metadata glTF …
Tamrat-B Dec 5, 2023
e1d55f7
Added bsl layer tests
Tamrat-B Dec 5, 2023
04f3c51
Added I3S BSL ViewModel tests
Tamrat-B Dec 5, 2023
3e75b94
Added I3S BSL explorer
Tamrat-B Dec 5, 2023
969ac49
Added I3S Explorer tests
Tamrat-B Dec 5, 2023
b4b23a6
Added I3S BSL Explorer layer widget
Tamrat-B Dec 5, 2023
e03286b
Merge branch 'CesiumGS:main' into feature/i3s_bsl_support
Tamrat-B Jan 11, 2024
21b2f4f
updates based on review feedback
Tamrat-B Jan 11, 2024
efc7db5
Added I3S support PR to additions
Tamrat-B Feb 2, 2024
03a9125
removed non necessary options
Tamrat-B Feb 2, 2024
17784df
check before updating visibility
Tamrat-B Feb 2, 2024
c815c03
additional specs changes
Tamrat-B Feb 2, 2024
4bffc64
Merge branch 'main' into feature/i3s_bsl_support
Tamrat-B Feb 2, 2024
9f02cf3
Merge branch 'CesiumGS:main' into feature/i3s_bsl_support
Tamrat-B Feb 28, 2024
9d6dc59
Removed picking result from console output
Tamrat-B Feb 28, 2024
c7570c3
Remove console out if geoid transform is not needed
Tamrat-B Feb 28, 2024
88eae59
Default to model overview if present
Tamrat-B Feb 28, 2024
1aefdc9
update tests to account for model views
Tamrat-B Feb 28, 2024
cf8d1da
Added I3S Building Scene Layer support to March 1 release
Tamrat-B Feb 28, 2024
96aca3e
Handling edge case use cases where there is no Full Model and/or Over…
Tamrat-B Feb 28, 2024
a3ea292
Rename BSL -> BuildingSceneLayer
ggetz Feb 28, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
I3S Building Scene Layer Sandcastle app
  • Loading branch information
Tamrat-B committed Dec 5, 2023
commit d612e7b2e5c0db30bf7ba6f7f59729896003d6f2
232 changes: 232 additions & 0 deletions Apps/Sandcastle/gallery/I3S Building Scene Layer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
<!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="Add I3S Building Scene Layer from a service."
/>
<meta name="cesium-sandcastle-labels" content="DataSources" />
<title>I3S Building Scene Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script
type="text/javascript"
src="../../../Build/CesiumUnminified/Cesium.js"
nomodule
></script>
<script type="module" src="../load-cesium-es6.js"></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: 10px;
border-radius: 4px;
max-height: 100%;
overflow-y: auto;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay">
<h1>Loading...</h1>
</div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
const viewer = new Cesium.Viewer("cesiumContainer", {
terrain: new Cesium.Terrain(
Cesium.ArcGISTiledElevationTerrainProvider.fromUrl(
"https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
)
),
animation: false,
timeline: false,
orderIndependentTranslucency: false,
msaaSamples: 4, // enables Multisample anti-aliasing for improved visual quality
});

// More datasets to tour can be added here...
// The url passed to I3SDataProvider supports loading a single Indexed 3D Scene (I3S) layer (.<host>/SceneServer/layers/<id>) or a collection of scene layers (.<host>/SceneServer) from a SceneServer.
const resource = new Cesium.Resource(
"https://tiles.arcgis.com/tiles/cFEFS0EWrhfDeVw9/arcgis/rest/services/Turanga_Library/SceneServer"
);
// Set a query parameter for json to avoid failure on html pages
resource.setQueryParameters(
Tamrat-B marked this conversation as resolved.
Show resolved Hide resolved
{
f: "pjson",
},
true
);
const tours = {
"Turanga Library": resource.url,
};

try {
// Create i3s and Cesium3DTileset options to pass optional parameters useful for debugging and visualizing
const cesium3dTilesetOptions = {
skipLevelOfDetail: false,
debugShowBoundingVolume: false,
Tamrat-B marked this conversation as resolved.
Show resolved Hide resolved
// maximumScreenSpaceError: 1, //setting to lower values will improve (quality-wise) the level of detail refinement by forcing higher lod tile descendants to 'show up sooner'.
// outlineColor: Cesium.Color.BLUE, // To replace/override the outline color defined in I3S symbology
ggetz marked this conversation as resolved.
Show resolved Hide resolved
};
const i3sOptions = {
traceFetches: false, // for tracing I3S fetches
cesium3dTilesetOptions: cesium3dTilesetOptions, // options for internal Cesium3dTileset
adjustMaterialAlphaMode: true, // force the alpha mode to be set for transparent geometry
enableFeatureFiltering: true, // Enables feature filtering and allows to display (popup) feature attributes
applySymbology: true, // applies outlines based on the I3S layer renderer details
calculateNormals: true, // generates flat normals if they are missing in I3S buffers
};

// Create I3S data provider
const i3sProvider = await Cesium.I3SDataProvider.fromUrl(
tours["Turanga Library"],
i3sOptions
);

Cesium.I3SBSLExplorer("toolbar", i3sProvider);

// Add the i3s layer provider as a primitive data type
viewer.scene.primitives.add(i3sProvider);

// Center camera on I3S once it's loaded
const center = Cesium.Rectangle.center(i3sProvider.extent);
center.height = 300.0;
// Adjust camera height by the I3S BSL extent
let bslLayer = i3sProvider.data;
if (Cesium.defined(bslLayer.layers) && bslLayer.layers.length > 0) {
bslLayer = bslLayer.layers[0];
}
if (
Cesium.defined(bslLayer.fullExtent) &&
Cesium.defined(bslLayer.fullExtent.zmax)
) {
center.height += bslLayer.fullExtent.zmax;
}
const destination = Cesium.Ellipsoid.WGS84.cartographicToCartesian(
center
);
viewer.camera.setView({
destination: destination,
});

// Override home button to center the camera on I3S
viewer.homeButton.viewModel._command = Cesium.createCommand(
function () {
viewer.camera.flyTo({
destination: destination,
});
}
);
} catch (error) {
console.error(
`There was an error creating the I3S Data Provider: ${error}`
);
}

// Information about the currently selected feature
const selected = {
feature: undefined,
originalColor: new Cesium.Color(),
};

// An entity object which will hold info about the currently selected feature for infobox display
const selectedEntity = new Cesium.Entity();
// Show metadata in the InfoBox.
viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(
movement
) {
const selectedFeature = selected.feature;

// Pick a new feature
const pickedFeature = viewer.scene.pick(movement.position);
if (selectedFeature === pickedFeature) {
return;
}

// If a feature was previously selected, undo the highlight
if (Cesium.defined(selected.feature)) {
selected.feature.color = selected.originalColor;
selected.feature = undefined;
}

if (
!Cesium.defined(pickedFeature) ||
!Cesium.defined(pickedFeature.content) ||
!Cesium.defined(pickedFeature.content.tile.i3sNode)
) {
viewer.selectedEntity = undefined;
return;
}

// Highlight newly selected feature
selected.feature = pickedFeature;
Cesium.Color.clone(pickedFeature.color, selected.originalColor);
pickedFeature.color = Cesium.Color.BLUE;

const i3sNode = pickedFeature.content.tile.i3sNode;
i3sNode.loadFields().then(function () {
let description = "No attributes";
let name;

const fields = i3sNode.getFieldsForFeature(pickedFeature.featureId);
if (Object.keys(fields).length > 0) {
description =
'<table class="cesium-infoBox-defaultTable"><tbody>';
for (const fieldName in fields) {
if (i3sNode.fields.hasOwnProperty(fieldName)) {
description += `<tr><th>${fieldName}</th><td>`;
description += `${fields[fieldName]}</td></tr>`;
console.log(`${fieldName}: ${fields[fieldName]}`);
if (!Cesium.defined(name) && isNameProperty(fieldName)) {
name = fields[fieldName];
}
}
}
description += `</tbody></table>`;
}
if (!Cesium.defined(name)) {
name = "unknown";
}
selectedEntity.name = name;
selectedEntity.description = description;
viewer.selectedEntity = selectedEntity;
});
},
Cesium.ScreenSpaceEventType.LEFT_CLICK);

function isNameProperty(propertyName) {
const name = propertyName.toLowerCase();
if (
name.localeCompare("name") === 0 ||
name.localeCompare("objname") === 0 ||
name.localeCompare("category") === 0
) {
return true;
}
return false;
} //Sandcastle_End
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
</html>