Is it possible to render a 3d object on a LineSegment?

162
2
06-17-2019 03:23 PM
DanH1
by
New Contributor II

I will have the need in the near future to render a path through 3d space and would like to represent the aircraft flying this path in the correct position and orientation.  What's the best way to do this using the ArcGIS Pro SDK?  Thanks!

0 Kudos
2 Replies
UmaHarano
Esri Regular Contributor

Hi

I am assuming that your flight data will have its current position and orientation as attributes. If so, you can use "Attribute Driven symbology". The data has to be Z enabled 3D data. This will allow you to use Pro's Symbology Rotation attributes.  You will also then have the capability to access the "Vary symbology by attributes" property page to drive your flight path using your data's fields.

Using the Pro SDK, here is a snippet that will accomplish this:

 protected override void OnClick()
        {
            var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
            QueuedTask.Run( () => {
                var renderer = lyr.GetRenderer() as CIMSimpleRenderer;
                var cimExpressionInfoX = new CIMExpressionInfo { Expression = "$feature.X" };
                var cimVisualVariableInfoX = new CIMVisualVariableInfo { VisualVariableInfoType = VisualVariableInfoType.Expression, ValueExpressionInfo = cimExpressionInfoX };

                var cimExpressionInfoY = new CIMExpressionInfo { Expression = "$feature.Y" };
                var cimVisualVariableInfoY = new CIMVisualVariableInfo { VisualVariableInfoType = VisualVariableInfoType.Expression, ValueExpressionInfo = cimExpressionInfoY };

                var cimVisualVariableInfoZ = new CIMVisualVariableInfo { VisualVariableInfoType = VisualVariableInfoType.None };

                var listCIMVisualVariables = new List<CIMVisualVariable>
                {
                    new CIMRotationVisualVariable {
                        VisualVariableInfoX = cimVisualVariableInfoX,
                        VisualVariableInfoY = cimVisualVariableInfoY,
                        VisualVariableInfoZ = cimVisualVariableInfoZ
                    }
                };

                renderer.VisualVariables = listCIMVisualVariables.ToArray();

                lyr.SetRenderer(renderer);
            });
            

        }

Thanks

Uma

DanH1
by
New Contributor II

Thank you.  I will give it a try this week and let you know if I have any questions or problems.

0 Kudos