Is there any control to draw a 3D polyline on a SceneView?

524
1
07-05-2018 01:45 AM
PeterChen1
New Contributor

Is there any existing control to draw a 3D polyline on a sceneView? similar to SketchEditor on MapView?

0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor

There currently is no SketchEditor for SceneView but you should be able to use PolylineBuilder and GeoViewTapped events. Something like this. 

PolylineBuilder builder = new PolylineBuilder(SpatialReferences.Wgs84);
private void MySceneView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
{
    builder.AddPoint(e.Location);
    var overlay = MySceneView.GraphicsOverlays.FirstOrDefault();
    var graphic = overlay.Graphics.FirstOrDefault();
    if (graphic == null)
        overlay.Graphics.Add(new Graphic(builder.ToGeometry(), new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Red, 3)));
    else
        graphic.Geometry = builder.ToGeometry();
}‍‍‍‍‍‍‍‍‍‍‍

In sample code above, we use tapped location but if you have 3D objects you want considered (i.e. buildings in ArcGISSceneLayer), you might want to use this location instead.

var location = await MySceneView.ScreenToLocationAsync(e.Position);

Meanwhile, you can try looking into one of our demo apps originally written against ArcGIS Runtime for .NET 10.x. I updated it slightly to use 100.x in this branch. I hope it will help you get started.

0 Kudos