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

693 color of 3dtiles layer config is useless + remove add layer from config method #699

Merged
merged 6 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 58 additions & 12 deletions examples/2DVisualization.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,70 @@
);

// ADD BASE MAP
udvizBrowser.addBaseMapLayer(
configs['base_maps'][0],
frame3DPlanar.itownsView,
extent
frame3DPlanar.itownsView.addLayer(
new udvizBrowser.itowns.ColorLayer(
configs['base_maps'][0]['layer_name'],
{
updateStrategy: {
type: udvizBrowser.itowns.STRATEGY_DICHOTOMY,
options: {},
},
source: new udvizBrowser.itowns.WMSSource({
extent: extent,
name: configs['base_maps'][0]['name'],
url: configs['base_maps'][0]['url'],
version: configs['base_maps'][0]['version'],
crs: extent.crs,
format: configs['base_maps'][0]['format'],
}),
transparent: true,
}
)
);

// ADD ELEVATION LAYER
udvizBrowser.addElevationLayer(
configs['elevation'],
frame3DPlanar.itownsView,
extent
const isTextureFormat =
configs['elevation']['format'] == 'image/jpeg' ||
configs['elevation']['format'] == 'image/png';
frame3DPlanar.itownsView.addLayer(
new udvizBrowser.itowns.ElevationLayer(
configs['elevation']['layer_name'],
{
useColorTextureElevation: isTextureFormat,
colorTextureElevationMinZ: isTextureFormat
? configs['elevation']['colorTextureElevationMinZ']
: null,
colorTextureElevationMaxZ: isTextureFormat
? configs['elevation']['colorTextureElevationMaxZ']
: null,
source: new udvizBrowser.itowns.WMSSource({
extent: extent,
url: configs['elevation']['url'],
name: configs['elevation']['name'],
crs: extent.crs,
heightMapWidth: 256,
format: configs['elevation']['format'],
}),
}
)
);

// ADD LAYERS
udvizBrowser.add3DTilesLayers(
configs['3DTiles'],
frame3DPlanar.itownsView
);
configs['3DTiles'].forEach((layerConfig) => {
udvizBrowser.itowns.View.prototype.addLayer.call(
frame3DPlanar.itownsView,
new udvizBrowser.itowns.C3DTilesLayer(
layerConfig['id'],
{
name: layerConfig['id'],
source: new udvizBrowser.itowns.C3DTilesSource({
url: layerConfig['url'],
}),
},
frame3DPlanar.itownsView
)
);
});

const button = document.createElement('button');
button.innerHTML = 'Change visualization mode to 3D';
Expand Down
46 changes: 38 additions & 8 deletions examples/3DTilesPointCloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'./assets/config/crs.json',
'./assets/config/frame3D_planars.json',
'./assets/config/layer/3DTiles_point_cloud.json',
'./assets/config/layer/base_maps.json'
'./assets/config/layer/base_maps.json',
])
.then((configs) => {
udvizBrowser.proj4.default.defs(
Expand All @@ -38,17 +38,47 @@
);

// ADD BASE MAP
udvizBrowser.addBaseMapLayer(
configs['base_maps'][0],
frame3DPlanar.itownsView,
extent
frame3DPlanar.itownsView.addLayer(
new udvizBrowser.itowns.ColorLayer(
configs['base_maps'][0]['layer_name'],
{
updateStrategy: {
type: udvizBrowser.itowns.STRATEGY_DICHOTOMY,
options: {},
},
source: new udvizBrowser.itowns.WMSSource({
extent: extent,
name: configs['base_maps'][0]['name'],
url: configs['base_maps'][0]['url'],
version: configs['base_maps'][0]['version'],
crs: extent.crs,
format: configs['base_maps'][0]['format'],
}),
transparent: true,
}
)
);

// /// ADD LAYER
udvizBrowser.add3DTilesLayers(
configs['3DTiles_point_cloud'],
const pointCloudLayer = new udvizBrowser.itowns.C3DTilesLayer(
configs['3DTiles_point_cloud'][0]['id'],
{
name: configs['3DTiles_point_cloud'][0]['id'],
source: new udvizBrowser.itowns.C3DTilesSource({
url: configs['3DTiles_point_cloud'][0]['url'],
}),
},
frame3DPlanar.itownsView
);

// hack (not declare in C3DTilesLayer) to override point cloud material
pointCloudLayer.material = new udvizBrowser.THREE.PointsMaterial({
size: configs['3DTiles_point_cloud'][0]['pc_size'],
vertexColors: true,
});
udvizBrowser.itowns.View.prototype.addLayer.call(
frame3DPlanar.itownsView,
pointCloudLayer
);
});
</script>
SCRIPT_TAG_RELOAD
Expand Down
14 changes: 7 additions & 7 deletions examples/3DTilesWidget.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'./assets/config/extents.json',
'./assets/config/crs.json',
'./assets/config/frame3D_planars.json',
'./assets/config/layer/3DTiles.json'
'./assets/config/layer/3DTiles.json',
])
.then((configs) => {
udvizBrowser.proj4.default.defs(
Expand All @@ -43,8 +43,8 @@
return feature.userData.selectedColor
? feature.userData.selectedColor
: 'white';
}
}
},
},
});

// create 3DTilesLayers
Expand All @@ -55,8 +55,8 @@
style: style,
name: layerConfig['id'],
source: new udvizBrowser.itowns.C3DTilesSource({
url: layerConfig['url']
})
url: layerConfig['url'],
}),
},
frame3DPlanar.itownsView
);
Expand All @@ -74,15 +74,15 @@
layerContainerClassName: 'widgets-3dtiles-layer-container',
c3DTFeatureInfoContainerClassName:
'widgets-3dtiles-feature-container',
urlContainerClassName: 'widgets-3dtiles-url-container'
urlContainerClassName: 'widgets-3dtiles-url-container',
}
);
widget.domElement.setAttribute('id', 'widgets-3dtiles');

// add on click behavior
const contextSelection = {
feature: null,
layer: null
layer: null,
};
frame3DPlanar.domElement.onclick = (event) => {
if (contextSelection.feature) {
Expand Down
72 changes: 59 additions & 13 deletions examples/3DTilesWireframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'./assets/config/frame3D_planars.json',
'./assets/config/layer/3DTiles.json',
'./assets/config/layer/base_maps.json',
'./assets/config/layer/elevation.json'
'./assets/config/layer/elevation.json',
])
.then((configs) => {
udvizBrowser.proj4.default.defs(
Expand All @@ -39,24 +39,70 @@
);

// ADD BASE MAP
udvizBrowser.addBaseMapLayer(
configs['base_maps'][0],
frame3DPlanar.itownsView,
extent
frame3DPlanar.itownsView.addLayer(
new udvizBrowser.itowns.ColorLayer(
configs['base_maps'][0]['layer_name'],
{
updateStrategy: {
type: udvizBrowser.itowns.STRATEGY_DICHOTOMY,
options: {},
},
source: new udvizBrowser.itowns.WMSSource({
extent: extent,
name: configs['base_maps'][0]['name'],
url: configs['base_maps'][0]['url'],
version: configs['base_maps'][0]['version'],
crs: extent.crs,
format: configs['base_maps'][0]['format'],
}),
transparent: true,
}
)
);

// ADD ELEVATION LAYER
udvizBrowser.addElevationLayer(
configs['elevation'],
frame3DPlanar.itownsView,
extent
const isTextureFormat =
configs['elevation']['format'] == 'image/jpeg' ||
configs['elevation']['format'] == 'image/png';
frame3DPlanar.itownsView.addLayer(
new udvizBrowser.itowns.ElevationLayer(
configs['elevation']['layer_name'],
{
useColorTextureElevation: isTextureFormat,
colorTextureElevationMinZ: isTextureFormat
? configs['elevation']['colorTextureElevationMinZ']
: null,
colorTextureElevationMaxZ: isTextureFormat
? configs['elevation']['colorTextureElevationMaxZ']
: null,
source: new udvizBrowser.itowns.WMSSource({
extent: extent,
url: configs['elevation']['url'],
name: configs['elevation']['name'],
crs: extent.crs,
heightMapWidth: 256,
format: configs['elevation']['format'],
}),
}
)
);

// ADD LAYERS
udvizBrowser.add3DTilesLayers(
configs['3DTiles'],
frame3DPlanar.itownsView
);
configs['3DTiles'].forEach((layerConfig) => {
udvizBrowser.itowns.View.prototype.addLayer.call(
frame3DPlanar.itownsView,
new udvizBrowser.itowns.C3DTilesLayer(
layerConfig['id'],
{
name: layerConfig['id'],
source: new udvizBrowser.itowns.C3DTilesSource({
url: layerConfig['url'],
}),
},
frame3DPlanar.itownsView
)
);
});

frame3DPlanar.itownsView
.getLayers()
Expand Down
51 changes: 43 additions & 8 deletions examples/3DTiles_loading.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,52 @@
);

// ADD BASE MAP
udvizBrowser.addBaseMapLayer(
configs['base_maps'][0],
frame3DPlanar.itownsView,
extent
frame3DPlanar.itownsView.addLayer(
new udvizBrowser.itowns.ColorLayer(
configs['base_maps'][0]['layer_name'],
{
updateStrategy: {
type: udvizBrowser.itowns.STRATEGY_DICHOTOMY,
options: {}
},
source: new udvizBrowser.itowns.WMSSource({
extent: extent,
name: configs['base_maps'][0]['name'],
url: configs['base_maps'][0]['url'],
version: configs['base_maps'][0]['version'],
crs: extent.crs,
format: configs['base_maps'][0]['format']
}),
transparent: true
}
)
);

// ADD ELEVATION LAYER
udvizBrowser.addElevationLayer(
configs['elevation'],
frame3DPlanar.itownsView,
extent
const isTextureFormat =
configs['elevation']['format'] == 'image/jpeg' ||
configs['elevation']['format'] == 'image/png';
frame3DPlanar.itownsView.addLayer(
new udvizBrowser.itowns.ElevationLayer(
configs['elevation']['layer_name'],
{
useColorTextureElevation: isTextureFormat,
colorTextureElevationMinZ: isTextureFormat
? configs['elevation']['colorTextureElevationMinZ']
: null,
colorTextureElevationMaxZ: isTextureFormat
? configs['elevation']['colorTextureElevationMaxZ']
: null,
source: new udvizBrowser.itowns.WMSSource({
extent: extent,
url: configs['elevation']['url'],
name: configs['elevation']['name'],
crs: extent.crs,
heightMapWidth: 256,
format: configs['elevation']['format']
})
}
)
);

// c3DTiles loading element
Expand Down
Loading