function addPointSource() {
    const features = [
      {
        type: "Feature",
        geometry: {
          type: "Point",
          coordinates: [120.9297336546423,29.366224497507602],
        },
        properties: {
          id: 1001,
          icon: "test-icon",
          name: "测试点位",
        },
      },
    {
        type: "Feature",
        geometry: {
          type: "Point",
          coordinates: [120.94033784936559,29.364959150669904],
        },
        properties: {
          id: 1002,
          icon: "camera",
          name: "测试点位2",
        }
      },
    ];
    const data = {
      type: "geojson",
      data: {
        type: "FeatureCollection",
        features: features,
      },
    };
    lbsMap.addMapSource("source.point", data);
  }
  function updatePoiSource(){
  
   const features = [
      {
        type: "Feature",
        geometry: {
          type: "Point",
          coordinates: [120.9298336546423,29.366224497507602],
        },
        properties: {
          id: 1001,
          icon: "camera",
          name: "测试点位",
        },
      },
    {
        type: "Feature",
        geometry: {
          type: "Point",
          coordinates: [120.94033784936559,29.364959150669904],
        },
        properties: {
          id: 1002,
          icon: "test-icon",
          name: "测试点位2",
        }
      },
    ];
    lbsMap.setMapSource("source.point", {
        type: "FeatureCollection",
        features: features
      });
  }
  function addLineSource() {
    const features = [
      {
        type: "Feature",
        geometry: {
          type: "LineString",
          coordinates: [[120.9297336546423,29.366224497507602],[120.93496873502703,29.37039607246446]]
        },
        properties: {
          id: 2001,
          name: "测试LineString",
        },
      },
    ];
       
    const data = {
      type: "geojson",
      data: {
        type: "FeatureCollection",
        features: features,
      },
    };
    lbsMap.addMapSource("source.line", data);
  }
  function addPolygonSource() {
    const features = [
      {
        type: "Feature",
        geometry: {
          type: "Polygon",
          coordinates: [[[120.92901054916676,29.367904193830995],[120.92977038024786,29.36790922765094],[
            120.92997217716756,29.36684904550775
          ],[120.92922480771146,29.366866398046227],[120.92901054916676,29.367904193830995]]]
        },
        properties: {
          id: 3001,
          name: "测试Polygon",
        },
      },
    ];
       
    const data = {
      type: "geojson",
      data: {
        type: "FeatureCollection",
        features: features,
      },
    };
    lbsMap.addMapSource("source.polygon", data);
  }
  function registerIcons() {
    lbsMap.registerMapIcon("test-icon", "images/default.png");
    lbsMap.registerMapIcon("camera", "images/camera_gun.png");
  }
  function openSymbolLayer() {
    addPointSource();
    registerIcons();
    const layer = {
      id: "layer.point", //图层唯一ID
      type: "symbol", //图层类型
      source: "source.point", //数据源
      layout: {
        "icon-image": "{icon}", // reference the image
        "icon-offset": [0, -20],
        "icon-size":0.5,
        "text-field": "{name}", //标签对应的Feature.properties属性
        "text-size": 14,
        "text-offset": [0, -2],
      },
      paint: {
        "text-color": "hsl(230, 50%, 98%)", //文本颜色
        "text-opacity": 1, //文本透明度
        "text-halo-color": "hsl(0, 1%, 3%)",
        "text-halo-blur": 0.5,
        "text-halo-width": 1.75,
      },
    };
    lbsMap.addMapLayer(layer);
  }
  function openLineLayer() {
    addLineSource();
    const layer = {
      id: "layer.line", //图层唯一ID
      source: "source.line", //数据源
      type: "line",
      layout: {
        "line-cap": "round",
        "line-join": "round",
      },
      paint: {
        "line-color": "#FFFF00",
        "line-opacity": 1,
        "line-width": 4,
      },
    };
    lbsMap.addMapLayer(layer);
  }
  function openPolygonLayer() {
    addPolygonSource();
    const layer = {
      id: "layer.polygon", //图层唯一ID
      source: "source.polygon", //数据源
      type: "fill",
      layout: {
      
      },
      paint: {
        "fill-color": "#FFFF00",
        "fill-opacity": 0.8,
      },
    };
    lbsMap.addMapLayer(layer);
  }
  
  