import { action } from "@storybook/addon-actions"; import { Meta, StoryObj } from "@storybook/react"; import { Color, KmlDataSource as CesiumKmlDataSource } from "cesium"; import { events } from "../core/storybook"; import Viewer from "../Viewer"; import KmlDataSource from "./KmlDataSource"; type Story = StoryObj; export default { title: "KmlDataSource", component: KmlDataSource, } as Meta; const data = new DOMParser().parseFromString( ` Portland -122.681944,45.52,0 Rio de Janeiro -43.196389,-22.908333,0 Istanbul 28.976018,41.01224,0 Reykjavik -21.933333,64.133333,0 Simple Polygon -122.681944,45.52,0 -43.196389,-22.908333,0 28.976018,41.01224,0 -21.933333,64.133333,0 -122.681944,45.52,0 `.trim(), "text/xml", ); const onLoadAction = action("onLoad"); const onLoad = (k: CesiumKmlDataSource) => { // You can process the data source here const p = k.entities.values[4].polygon; if (p) { p.material = Color.RED as any; } onLoadAction(k); }; export const Basic: Story = { args: { show: true }, render: args => ( ), };