2016-09-14 36 views
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 } }); 

给了我这样的结果(我期待将多数的方式在全球范围内的多边形)

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

和生成的图片是完全一样的....

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

+0

您是否尝试过改变点的顺序,使其相反? -160,20 | -160,-20 | 160,-20 | 160,20 –

+0

@SamiKuhmonen是的,它们似乎并不重要,如果他们顺时针或逆时针 –

+0

[This](http://gis.stackexchange.com/questions/18562/how-can-i-make-a -polyline-wrap-around-the-world)似乎相关:“你需要在+ -180度子午线处折断折线”。您可能必须创建2个多边形,一个“左”并停在子午线上,另一个右上并停在子午线上。 – Quantic

回答

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中运行时记录的错误创建一个多边形的时候,所以希望这能得到固定甚至没有工作 - 然而,目前大于180的零件将通过设计在3D中短路,因此您可能仍然需要将几何体分成两部分。