ArcGIS Runtime:如何在带有Z的SceneView中创建3d立方体?

问题描述

我想通过交互操作在SceneView中绘制3d立方体。

我希望实现的功能是:

  1. 通过交互在SceneView上单击多个点(x1,y1,0),(x2,y2,0),(x3,y3,0),(x4,y4,0)。
  2. 通过弹出窗口输入高度h
  3. 用以下几点绘制一个立方体: (x1,y1,0),(x2,y2,0),(x3,y3,0),(x4,y4,0),(x1,y1,h),(x2,y2,h),(x3 ,y3,h),(x4,y4,h)

我尝试过:

var centerPoint = new MapPoint(vm.X,vm.Y,vm.Z,onMapLocation.SpatialReference);

SimpleMarkerSceneSymbol symbol = SimpleMarkerSceneSymbol.CreateCube(System.Drawing.Color.DarkSeaGreen,1,SceneSymbolAnchorPosition.Center);
symbol.Heading = vm.Heading;
symbol.Height = vm.Height;
symbol.Width = vm.Width;
symbol.Depth = vm.Depth;
// Create the graphic from the geometry and the symbol.
Graphic item = new Graphic(centerPoint,symbol);

// Add the graphic to the overlay.
graphicOverlay.Graphics.Add(item);

它有效,但是我只能从“几何”中得到1分。我想得到立方体的所有顶点。

然后我尝试绘制不带Z的多边形,并将Renderer设置为显示:

// Create a new simple line symbol for the feature layer
SimpleLineSymbol mySimpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid,System.Drawing.Color.Black,1);

// Create a new simple fill symbol for the feature layer 
SimpleFillSymbol mysimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid,System.Drawing.Color.WhiteSmoke,mySimpleLineSymbol);

// Create a new simple renderer for the feature layer
SimpleRenderer mySimpleRenderer = new SimpleRenderer(mysimpleFillSymbol);

// Get the scene properties from the simple renderer
RendererSceneProperties myRendererSceneProperties = mySimpleRenderer.SceneProperties;

// Set the extrusion mode for the scene properties
myRendererSceneProperties.ExtrusionMode = ExtrusionMode.AbsoluteHeight;

// Set the initial extrusion expression
myRendererSceneProperties.ExtrusionExpression = "[Z]";

// Set the feature layer's renderer to the define simple renderer
featureLayer.Renderer = mySimpleRenderer;

在我的featureLayer中,它具有功能Z,因此可以正常工作。 但这不符合我的要求,我想实时绘制多维数据集,而不是读取数据。

我不知道该怎么实现... .NET解决方案是最好的,其他语言也可以接受。 最后,请原谅我的英语不好:(

解决方法

最后,我使用Render解决了该问题,但是我对这种解决方案不满意。 这是我完成的结果: https://www.cnblogs.com/Lulus/p/13948464.html

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...