Skip to content

Commit

Permalink
support tile setting
Browse files Browse the repository at this point in the history
  • Loading branch information
caichi-t committed Aug 5, 2024
1 parent be9d8a7 commit 53da0d7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions web/src/components/molecules/Common/Form/GeometryItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
EditorSupportedType,
} from "@reearth-cms/components/molecules/Schema/types";
import { WorkspaceSettings } from "@reearth-cms/components/molecules/Workspace/types";
import { config } from "@reearth-cms/config";
import { useT } from "@reearth-cms/i18n";

import schema from "./schema";
Expand All @@ -47,6 +48,17 @@ const GEO_TYPE_MAP = {
ANY: "Point",
} as const;

const TILE_TYPE_MAP = {
DEFAULT: "default",
LABELLED: "default_label",
ROAD_MAP: "default_road",
OPEN_STREET_MAP: "open_street_map",
ESRI_TOPOGRAPHY: "esri_world_topo",
EARTH_AT_NIGHT: "black_marble",
JAPAN_GSI_STANDARD_MAP: "japan_gsi_standard",
URL: "url",
} as const;

interface Props {
value?: string | null;
onChange?: (value: string) => void;
Expand Down Expand Up @@ -233,15 +245,16 @@ const GeometryItem: React.FC<Props> = ({
tiles: [
{
id: "default",
type: "open_street_map",
type: TILE_TYPE_MAP[workspaceSettings.tiles?.resources[0]?.type ?? "DEFAULT"],
url: workspaceSettings.tiles?.resources[0]?.props.url
},
],
terrain: { enabled: workspaceSettings.terrains?.enabled },
indicator: {
type: "custom",
},
}),
[workspaceSettings.terrains?.enabled],
[workspaceSettings.terrains?.enabled, workspaceSettings.tiles?.resources],
);

const [sketchType, setSketchType] = useState<SketchType>();
Expand Down Expand Up @@ -503,6 +516,7 @@ const GeometryItem: React.FC<Props> = ({
ready={isReady}
onMount={handleMount}
engine={"cesium"}
meta={{cesiumIonAccessToken: config()?.cesiumIonAccessToken}}
viewerProperty={viewerProperty}
onSketchFeatureCreate={handleSketchFeatureCreate}
/>
Expand Down

0 comments on commit 53da0d7

Please sign in to comment.