sercanmetu

draw a 3d line in globe control

Discussion created by sercanmetu on Oct 17, 2011
Latest reply on Oct 18, 2011 by erice-esristaff
I am using ArcGIS 10 and I want to draw a realistic line on globe control by using c# and my code is below.But my problem is when i run my program it draws a straight line.But i want t� draw a geodesic line(a curved segment according to earth's geodic shape )

public void drawline(double lon1, double lat1, double alt1, double lon2, double lat2, double alt2)
        {
            const esriSimple3DLineStyle AxisStyle = esriSimple3DLineStyle.esriS3DLSTube;
            const double AxisWidth = 1;


            IPoint point = (IPoint)new ESRI.ArcGIS.Geometry.Point();
            ((IZAware)point).ZAware = true;
            point.PutCoords(lon1, lat1);
            point.Z = alt1;

            IPoint point2 = new ESRI.ArcGIS.Geometry.Point();
            ((IZAware)point2).ZAware = true;
            point2.PutCoords(lon2, lat2);
            point2.Z = alt2;

            IPoint zero = new ESRI.ArcGIS.Geometry.Point();
            ((IZAware)zero).ZAware = true;
            zero.PutCoords(0, 0);
            zero.Z = 0;

            IRgbColor color = new RgbColor();
            color.Red = 255;
            color.Green = 0;
            color.Blue = 0;

            IPointCollection axisPointCollection = new Polyline();
            // ((IGeometry)axisPointCollection).SpatialReference = //axGlobeControl1.GlobeDisplay.Scene.SpatialReference;
            axisPointCollection.AddPoint(point, ref _missing, ref _missing);
            axisPointCollection.AddPoint(point2, ref _missing, ref _missing);

            IZAware zAware = axisPointCollection as IZAware;
            zAware.ZAware = true;



            ISimpleLine3DSymbol simpleLine3DSymbol = new SimpleLine3DSymbol();
            simpleLine3DSymbol.Style = AxisStyle;
            simpleLine3DSymbol.ResolutionQuality = 1;

            ILineSymbol lineSymbol = simpleLine3DSymbol as ILineSymbol;
            lineSymbol.Color = color;

            lineSymbol.Width = AxisWidth * 20;

            ILine3DPlacement line3DPlacement = lineSymbol as ILine3DPlacement;
            //line3DPlacement.Units = Units;

            ILineElement lineElement = (ILineElement)new LineElement();
            lineElement.Symbol = lineSymbol;

            IElement element = lineElement as IElement;
            element.Geometry = axisPointCollection as IPolyline;



            ((IGraphicsContainer)m_globeGraphicsLayer).AddElement(element, 1);
        }


Is there a way to do so.

Thanks in advance.

Outcomes