import { useEffect, useMemo, useState } from "react";
import { ImageryLayer, useCesium } from "resium";
import { WebMapServiceImageryProvider } from "cesium";
import { useInterval } from "ahooks";
import { useSelector } from "react-redux";

const url = "http://analysis.tpdc.ac.cn/gs/geoserver/phitrellis/wms";

function LayerAntarcticaToQTP() {
  const { imageLayer } = useSelector((state) => state.data);

  console.log("imageLayer :>> ", imageLayer);
  const tempProvider = useMemo(
    () =>
      new WebMapServiceImageryProvider({
        url: url,
        layers: "phitrellis:india_ocean_sst",
        parameters: {
          service: "WMS",
          format: "image/png",
          transparent: true,
        },
      }),
    [url]
  );

  return (
    <ImageryLayer
      key={`ImageryLayer-india-ocean`}
      imageryProvider={tempProvider}
      show={!!imageLayer.indianOcean}
    />
  );
}

export default LayerAntarcticaToQTP;
