I'm using the ArcGIS Runtime .NET Quartz Beta
I have an application which needs to render large polygons on the 3D Scene View.
For instance, I execute this code:
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 } });
gives me this result (I was expecting the polygon to wrap most of the way around the globe)
So, I changed it to have intermediatepoints to try to force it to go around the globe, like this:
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));
and the resulting picture is exactly the same....
How would I render the polygon I want to render?
This is a bug in the 3D Renderer. The only way around it that I've found is to create two graphics, and each half must be less than 180 degrees wide. It didn't even work when creating a single polygon with two parts (the outline rendered correctly but the fill was still wrong)
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 } });
I have logged a bug in the ArcGIS Runtime, so hopefully this can get fixed - however currently parts > 180 will go the short way in 3D by design, so you might still have to split the geometry in two parts.