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

test: Stories with layers exposed as controls will crash if layers are instantiated with new (as opposed to json) #1895 #1896

Merged
merged 8 commits into from
Feb 2, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -595,22 +595,30 @@ Wells3d.parameters = {
},
};

export const VerticalWellWithDuplicates = Template.bind({});
export const VerticalWellWithDuplicates: ComponentStory<
typeof SubsurfaceViewer
> = (args) => {
const props = {
...args,
layers: [
new WellsLayer({
data: testWellWithDuplicates,
ZIncreasingDownwards: false,
}),
new AxesLayer({
id: "axes-layer",
bounds: [-100, -100, -500, 100, 100, 0],
ZIncreasingDownwards: false,
}),
],
};

return <SubsurfaceViewer {...props} />;
};

VerticalWellWithDuplicates.args = {
id: "well_176",
bounds: [-150, -150, 150, 150],
layers: [
new WellsLayer({
data: testWellWithDuplicates,
ZIncreasingDownwards: false,
}),
new AxesLayer({
id: "axes-layer",
bounds: [-100, -100, -500, 100, 100, 0],
ZIncreasingDownwards: false,
}),
],

views: {
layout: [1, 1],
viewports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ export const SyncedSubsurfaceViewers: StoryObj<
};

const zoomBox3D: BoundingBox3D = [-325, -450, -25, 125, 150, 125];
//const zoomBox3D: BoundingBox3D = [-100, -100, -100, 100, 100, 100];

const AutoZoomToBox = (args: SubsurfaceViewerProps) => {
const [rotX, setRotX] = React.useState(0);
Expand All @@ -259,6 +258,26 @@ const AutoZoomToBox = (args: SubsurfaceViewerProps) => {

const props = {
...args,
layers: [
new AxesLayer({
id: "axes",
bounds: zoomBox3D,
ZIncreasingDownwards: false,
}),
new SimpleMeshLayer({
id: "sphere",
data: [{}],
mesh: new SphereGeometry({
nlat: 100,
nlong: 100,
radius: 30,
}),
wireframe: false,
getPosition: [0, 0, 0],
getColor: [255, 255, 255],
material: true,
}),
],
cameraPosition,
};

Expand Down Expand Up @@ -295,28 +314,6 @@ const AutoZoomToBox = (args: SubsurfaceViewerProps) => {

export const AutoZoomToBoxStory: StoryObj<typeof SubsurfaceViewer> = {
args: {
id: "DeckGL-Map",
layers: [
new AxesLayer({
id: "polyhedral-cells-axes",
bounds: zoomBox3D,
ZIncreasingDownwards: false,
}),
// unfortunately, SimpleMeshLayer can not be specified as a Record<string, any> :(
new SimpleMeshLayer({
id: "sphere",
data: [{}],
mesh: new SphereGeometry({
nlat: 100,
nlong: 100,
radius: 30,
}),
wireframe: false,
getPosition: [0, 0, 0],
getColor: [255, 255, 255],
material: true,
}),
],
views: default3DViews,
},
parameters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const volveWellsLayer = {
"@@type": "WellsLayer",
id: "volve-wells",
data: "./volve_wells.json",
ZIncreasingDownwards: false,
};

export const volveWellsBounds: BoundingBox2D = [
Expand All @@ -98,6 +99,7 @@ export const volveWellsWithLogsLayer = {
logrunName: "BLOCKING",
logName: "ZONELOG",
logColor: "Stratigraphy",
ZIncreasingDownwards: false,
w1nklr marked this conversation as resolved.
Show resolved Hide resolved
};

// Example using "Map" layer. Uses PNG float for mesh.
Expand Down
Loading