SuperMap/iClient-JavaScript

iclient-mapboxgl使用4490坐标系, toThreeMesh转一个多边形时,位置与实际位置偏移

redk-hub opened this issue · 1 comments

Request a feature or report a bug? [这是一个需求还是一个缺陷]

缺陷

One-line summary [问题简述]

iclient-mapboxgl使用4490坐标系, toThreeMesh转一个多边形时,位置与实际位置偏移

Version [产品及版本]

  • iClient product (for leaflet,for openlayers,for mapboxgl,classic)[iClient 产品]: iClient-mapboxgl
  • iClient version [iClient 版本]:v11.0.0
  • Browser version [浏览器类型和版本]: chrome 最新版本
  • OS Version [操作系统类型和版本]: window7

Actual Behavior [当前现象]

当使用默认crs时,toThreeMesh转的mesh叠加后坐标是对的,当crs设置为4490时,toThreeMesh转一个多边形时,位置与实际位置偏移

Expected Behavior [期望现象]

下图中绿色的边界是正常坐标边界,红色是叠加的threejs,期望是红色和绿色重合

Example of reproducing the issue [重现现象的例子]

const threeLayer = new mapboxgl.supermap.ThreeLayer('three', 'gl');
threeLayer.on('initialized', renderer);
threeLayer.addTo(glMap);

 function renderer() {
          const scene = threeLayer.getScene();
          const camera = threeLayer.getCamera();
          const light = new THREE.PointLight(0xffffff);
          camera.add(light);

          const material = new THREE.MeshBasicMaterial({
            color: '#ff0000',
            transparent: true,
            opacity: 0.6,
          });

          geojson.features.forEach((feature) => {
            //根据坐标点转换成模型
            const { type, coordinates } = feature.geometry;
            if (type === 'MultiPolygon') {
              coordinates.forEach((multiPolygon) => {
                multiPolygon.forEach((polygon) => {
                  const mesh = this.toThreeMesh(polygon, 100, material, true);
                  scene.add(mesh);
                });
              });
            }
          });
        }

image


What is motivation or use case for changing the behavior? [需求的场景和目的是什么?]

需要显示立体的网格边界,并且显示边界线

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.