GetZsFromSurfaceAsync
从表面获得
namespace BeforeSketchCompleted
{
internal class BeforeSketchCompleted : Button
{
readonly string surfaceName = "Ground";
ArcGIS.Core.Events.SubscriptionToken bscToken = null;
protected override void OnClick()
{
//subscribe to BeforeSketchCompleted event once
if (bscToken == null)
bscToken = ArcGIS.Desktop.Mapping.Events.BeforeSketchCompletedEvent.Subscribe(OnBeforeSketchCompletedEvent);
}
private async Task OnBeforeSketchCompletedEvent(BeforeSketchCompletedEventArgs arg)
{
//check if surfacename is in the map
if (arg.MapView.Map.ElevationSurfaces.Count(s => s.Name == surfaceName) == 0)
{
MessageBox.Show("Surface: " + surfaceName + " is not in the map");
return;
}
//set the sketch Z values from the specified elevation surface
var ZResult = await arg.MapView.Map.GetZsFromSurfaceAsync(arg.Sketch,surfaceName);
if (ZResult.Status == SurfaceZsResultStatus.Ok)
arg.SetSketchGeometry(ZResult.Geometry);
}
浙公网安备 33010602011771号