AnsweredAssumed Answered

Add multipoint to graphics container

Question asked by fallingdog on Nov 22, 2015
Latest reply on Nov 23, 2015 by fallingdog

How can I draw a multipoint with a graphic?

 

I am working on C#.NET ArcObjects add in for ArcGIS desktop 10.0/10.1. The bellow code works fine for adding a one of the points when I set the element.Geometry = points[0] in line 32. But I do not know the right pattern when add a group of points to a graphic container. I have looked around but could not find an example.

 

Thanks for any help!

 

            RgbColor color = new RgbColorClass();
            color.Blue = 255;
            color.Red = 0;
            color.Green = 0;
            RgbColor colorOutline = new RgbColorClass();
            ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
            simpleMarkerSymbol.Color = color;
            simpleMarkerSymbol.Outline = true;
            simpleMarkerSymbol.OutlineColor = colorOutline;
            simpleMarkerSymbol.Size = 9;
            simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSDiamond;
            IMarkerElement markerElement = new MarkerElementClass();
            markerElement.Symbol = simpleMarkerSymbol;
            List<IPoint> points = new List<IPoint>();
            int numberOfPoints = pipeOids.Count;
            for (int i = 0; i < numberOfPoints; i++)
            {
                IPoint point = new PointClass();
                point = MeasureToPoint(pipeOids[i], measures[i]);
                points.Add(point);
            }
            
            Multipoint multipoint = new MultipointClass();
            foreach (IPoint point in points)
            {
                multipoint.AddPoint(point);
            }


            IElement element = null;
            element = (IElement) markerElement;
            element.Geometry = (IGeometry) multipoint;
            graphicsContainer.AddElement(element, 0);

Outcomes