大多边形渲染不正确
Large Polygon renders incorrectly
我正在使用 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));
和生成的图片完全一样....
如何渲染我想要渲染的多边形?
这是 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 中走捷径,所以您可能仍然需要将几何体分成两部分。
我正在使用 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));
和生成的图片完全一样....
如何渲染我想要渲染的多边形?
这是 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 中走捷径,所以您可能仍然需要将几何体分成两部分。