0

我正在使用 ArcGIS Runtime .NET Quartz Beta

我有一个需要在 3D 场景视图上渲染大多边形的应用程序。

例如,我执行以下代码:

            var ContourOverlayScene = CreateGraphicsOverlay("Contours");
            MySceneView.GraphicsOverlays.Add(ContourOverlayScene);


            List<MapPoint> combined = new List<MapPoint>();

            combined.Add(new MapPoint(-160,  20, wgs84));
            combined.Add(new MapPoint( 160,  20, wgs84));
            combined.Add(new MapPoint( 160, -20, wgs84));
            combined.Add(new MapPoint(-160, -20, wgs84));

            var arcpoly = new Esri.ArcGISRuntime.Geometry.Polygon(combined, wgs84);

            ContourOverlayScene.Graphics.Add(new Graphic() { Geometry = arcpoly, Symbol = new SimpleFillSymbol() { Color = Colors.Red } });

给了我这个结果(我期待多边形环绕地球的大部分区域)

在此处输入图像描述

因此,我将其更改为具有中间点,以试图迫使它在全球范围内传播,如下所示:

            combined.Add(new MapPoint(-160,  20, wgs84));
            combined.Add(new MapPoint(-40, 20, wgs84));
            combined.Add(new MapPoint(40, 20, wgs84));
            combined.Add(new MapPoint( 160,  20, wgs84));
            combined.Add(new MapPoint( 160, -20, wgs84));
            combined.Add(new MapPoint(40, -20, wgs84));
            combined.Add(new MapPoint(-40, -20, wgs84));
            combined.Add(new MapPoint(-160, -20, wgs84));

和得到的图片完全一样....

我将如何渲染我想要渲染的多边形?

4

1 回答 1

0

这是 3D 渲染器中的一个错误。我发现的唯一解决方法是创建两个图形,每个图形的宽度必须小于 180 度。它甚至在创建具有两个部分的单个多边形时都不起作用(轮廓正确渲染但填充仍然错误)

        var pb = new PolygonBuilder(wgs84);
        combined.Add(new MapPoint(-160, 20, wgs84));
        combined.Add(new MapPoint(0, 20, wgs84));
        combined.Add(new MapPoint(0, -20, wgs84));
        combined.Add(new MapPoint(-160, -20, wgs84));
        pb.AddPart(combined);

        ContourOverlayScene.Graphics.Add(new Graphic() { Geometry = GeometryEngine.Densify(pb.ToGeometry(),1), Symbol = new SimpleFillSymbol() { Color = Colors.Red } });

        pb = new PolygonBuilder(wgs84);

        combined = new List<MapPoint>();
        combined.Add(new MapPoint(0, 20, wgs84));
        combined.Add(new MapPoint(160, 20, wgs84));
        combined.Add(new MapPoint(160, -20, wgs84));
        combined.Add(new MapPoint(0, -20, wgs84));
        pb.AddPart(combined);

        ContourOverlayScene.Graphics.Add(new Graphic() { Geometry = GeometryEngine.Densify(pb.ToGeometry(), 1), Symbol = new SimpleFillSymbol() { Color = Colors.Red } });

我在 ArcGIS Runtime 中记录了一个错误,因此希望这可以得到修复 - 但是目前 > 180 的部分将在 3D 中走捷径,因此您可能仍需要将几何图形分成两部分。

于 2017-02-28T00:27:00.480 回答