大多边形渲染不正确

时间:2016-09-14 19:37:47

标签: c# .net arcgis-runtime

我正在使用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 } });

给了我这个结果(我期待多边形在全球范围内大部分包裹)

enter image description here

所以,我把它改成了中间点,试图强迫它环游世界,就像这样:

            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));

,结果图片完全相同....

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

1 个答案:

答案 0 :(得分: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中记录了一个错误,所以希望这可以修复 - 但是目前的部分&gt; 180将在设计中采用3D方式,因此您可能仍需要将几何体分成两部分。